@spiffcommerce/preview 4.1.0-alpha.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -19
- package/dist/index.esm.js +337 -348
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ArcRotateCamera as
|
|
2
|
-
import { Engine as
|
|
3
|
-
import { NullEngine as
|
|
4
|
-
import { HighlightLayer as
|
|
5
|
-
import { SceneLoader as
|
|
6
|
-
import { CubeTexture as
|
|
1
|
+
import { ArcRotateCamera as ge } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
|
+
import { Engine as me } from "@babylonjs/core/Engines/engine";
|
|
3
|
+
import { NullEngine as we } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HighlightLayer as Ce } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
+
import { SceneLoader as pe } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as ye } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as f, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as g,
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as g, Quaternion as C, Vector2 as ie, Matrix as se } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as Pe } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as b } from "@babylonjs/core/Misc/observable";
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { PBRMaterial as
|
|
15
|
-
import { MirrorTexture as
|
|
16
|
-
import { Color3 as
|
|
17
|
-
import { ReflectionProbe as
|
|
18
|
-
import { GlowLayer as
|
|
19
|
-
import { ActionManager as
|
|
20
|
-
import { ExecuteCodeAction as
|
|
21
|
-
import { Mesh as
|
|
22
|
-
import { TransformNode as
|
|
23
|
-
import { DynamicTexture as
|
|
24
|
-
import { Texture as
|
|
11
|
+
import { Tools as Me } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as xe } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Le } from "@babylonjs/loaders/glTF";
|
|
14
|
+
import { PBRMaterial as F } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
|
+
import { MirrorTexture as Ae } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Ee, Vector3 as ne, Plane as Re } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
|
+
import { GlowLayer as Te } from "@babylonjs/core/Layers/glowLayer";
|
|
19
|
+
import { ActionManager as A } from "@babylonjs/core/Actions/actionManager";
|
|
20
|
+
import { ExecuteCodeAction as re } from "@babylonjs/core/Actions/directActions";
|
|
21
|
+
import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
|
|
22
|
+
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
23
|
+
import { DynamicTexture as Fe } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
24
|
+
import { Texture as Be } from "@babylonjs/core/Materials/Textures/texture";
|
|
25
25
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
26
|
-
import { QuadraticEase as
|
|
27
|
-
import { AssetsManager as
|
|
28
|
-
import { ColorCurves as
|
|
26
|
+
import { QuadraticEase as De, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
27
|
+
import { AssetsManager as ke } from "@babylonjs/core/Misc/assetsManager";
|
|
28
|
+
import { ColorCurves as ae } from "@babylonjs/core/Materials/colorCurves";
|
|
29
29
|
import { ImageProcessingConfiguration as M } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
30
|
-
import { DefaultRenderingPipeline as
|
|
31
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
30
|
+
import { DefaultRenderingPipeline as Ve } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
|
+
import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
32
32
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
33
33
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
34
34
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
@@ -39,13 +39,13 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
39
39
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
40
40
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
41
41
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
42
|
-
var
|
|
43
|
-
class
|
|
42
|
+
var I = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(I || {}), S = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(S || {});
|
|
43
|
+
class Ne {
|
|
44
44
|
constructor(e) {
|
|
45
45
|
this.getSceneClearColor = () => {
|
|
46
|
-
var i,
|
|
47
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
48
|
-
if (this.customOptions && ((
|
|
46
|
+
var i, a, r, s;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (a = this.customOptions) != null && a.backgroundImage ? 0 : 1;
|
|
48
|
+
if (this.customOptions && ((r = this.customOptions) != null && r.transparentBackground) || (s = this.customOptions) != null && s.backgroundImage)
|
|
49
49
|
return new f(0, 0, 0, t).toLinearSpace();
|
|
50
50
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
51
51
|
const o = w.FromHexString(
|
|
@@ -60,11 +60,11 @@ class ke {
|
|
|
60
60
|
}
|
|
61
61
|
return new f(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
62
62
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new f(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
63
|
-
const
|
|
63
|
+
const a = w.FromHexString(t);
|
|
64
64
|
return new f(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
a.r,
|
|
66
|
+
a.g,
|
|
67
|
+
a.b,
|
|
68
68
|
i
|
|
69
69
|
).toLinearSpace();
|
|
70
70
|
}, this.customOptions = e;
|
|
@@ -91,7 +91,7 @@ class ke {
|
|
|
91
91
|
* Configuration related to the camera used to view and interact with the scene.
|
|
92
92
|
*/
|
|
93
93
|
get camera() {
|
|
94
|
-
var e, t, i,
|
|
94
|
+
var e, t, i, a, r, s, o, l, c, d, u, m, p;
|
|
95
95
|
return {
|
|
96
96
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
97
97
|
autoRotation: {
|
|
@@ -100,7 +100,7 @@ class ke {
|
|
|
100
100
|
},
|
|
101
101
|
limits: {
|
|
102
102
|
min: {
|
|
103
|
-
alpha: (
|
|
103
|
+
alpha: (a = this.customOptions) != null && a.lowerAlphaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
104
104
|
beta: (s = this.customOptions) != null && s.lowerBetaLimitDeg ? ((o = this.customOptions) == null ? void 0 : o.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
105
105
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
106
106
|
},
|
|
@@ -124,10 +124,10 @@ class ke {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
get lighting() {
|
|
127
|
-
var e, t, i,
|
|
127
|
+
var e, t, i, a;
|
|
128
128
|
return {
|
|
129
129
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
130
|
-
contrast: ((
|
|
130
|
+
contrast: ((a = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : a.contrast) ?? 1.6
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
get emissiveGlowIntensity() {
|
|
@@ -135,12 +135,12 @@ class ke {
|
|
|
135
135
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
class
|
|
138
|
+
class P {
|
|
139
139
|
/**
|
|
140
140
|
* Returns the resolution expected for generated textures.
|
|
141
141
|
*/
|
|
142
142
|
static getDynamicTextureResolution() {
|
|
143
|
-
return this.getIsMobile() || !
|
|
143
|
+
return this.getIsMobile() || !P.offscreenRenderingSupported() ? {
|
|
144
144
|
width: 1024,
|
|
145
145
|
height: 1024
|
|
146
146
|
} : {
|
|
@@ -176,7 +176,7 @@ class y {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const Ge = 128, h = {
|
|
180
180
|
antiAliasing: {
|
|
181
181
|
samples: 4,
|
|
182
182
|
fxaaEnabled: !1
|
|
@@ -233,7 +233,7 @@ const Ve = 128, h = {
|
|
|
233
233
|
weight: 1
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
class
|
|
236
|
+
class He {
|
|
237
237
|
constructor(e) {
|
|
238
238
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
239
239
|
}
|
|
@@ -248,11 +248,11 @@ class Ne {
|
|
|
248
248
|
return this.loader.loadNodeAsync(
|
|
249
249
|
e,
|
|
250
250
|
t,
|
|
251
|
-
function(
|
|
252
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
253
|
-
const s = t.extras[
|
|
254
|
-
|
|
255
|
-
}), i(
|
|
251
|
+
function(a) {
|
|
252
|
+
t.extras && Object.keys(t.extras).forEach((r) => {
|
|
253
|
+
const s = t.extras[r];
|
|
254
|
+
a.metadata[r] = s;
|
|
255
|
+
}), i(a);
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
258
|
}
|
|
@@ -277,14 +277,14 @@ class Ne {
|
|
|
277
277
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
278
278
|
*/
|
|
279
279
|
enableMaterialExtrasIfRequired(e, t) {
|
|
280
|
-
if (!(!e.extras || !(t instanceof
|
|
280
|
+
if (!(!e.extras || !(t instanceof F))) {
|
|
281
281
|
if (e.extras.sheen) {
|
|
282
282
|
const i = t;
|
|
283
283
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
284
284
|
}
|
|
285
285
|
if (e.extras.translucency) {
|
|
286
286
|
const i = t;
|
|
287
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
287
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new Ee(
|
|
288
288
|
e.extras.translucencyR,
|
|
289
289
|
e.extras.translucencyG,
|
|
290
290
|
e.extras.translucencyB
|
|
@@ -310,60 +310,60 @@ class Ne {
|
|
|
310
310
|
* @param scene The scene to parse.
|
|
311
311
|
*/
|
|
312
312
|
applyReflections(e) {
|
|
313
|
-
function t(
|
|
313
|
+
function t(r) {
|
|
314
314
|
const s = [];
|
|
315
|
-
return
|
|
315
|
+
return r.transformNodes.forEach((o) => {
|
|
316
316
|
o.metadata && o.metadata.reflective && s.push(...o.getChildMeshes());
|
|
317
|
-
}),
|
|
317
|
+
}), r.meshes.forEach((o) => {
|
|
318
318
|
o.metadata && o.metadata.reflective && !s.includes(o) && s.push(o);
|
|
319
319
|
}), s;
|
|
320
320
|
}
|
|
321
|
-
function i(
|
|
322
|
-
const o =
|
|
321
|
+
function i(r, s = 1) {
|
|
322
|
+
const o = r.material;
|
|
323
323
|
if (!o)
|
|
324
324
|
return;
|
|
325
|
-
const l = new
|
|
325
|
+
const l = new Ae(
|
|
326
326
|
"mirror",
|
|
327
|
-
|
|
327
|
+
P.getMirrorTextureResolution(),
|
|
328
328
|
e,
|
|
329
329
|
!0
|
|
330
330
|
);
|
|
331
331
|
l.renderList = t(e);
|
|
332
|
-
const c =
|
|
332
|
+
const c = r.getVerticesData("normal");
|
|
333
333
|
if (!c)
|
|
334
334
|
throw new Error(
|
|
335
|
-
"Mirror attribute specified on: " +
|
|
335
|
+
"Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
|
|
336
336
|
);
|
|
337
|
-
|
|
338
|
-
const d =
|
|
339
|
-
new
|
|
337
|
+
r.computeWorldMatrix(!0);
|
|
338
|
+
const d = r.getWorldMatrix(), u = ne.TransformNormal(
|
|
339
|
+
new ne(c[0], c[1], c[2]),
|
|
340
340
|
d
|
|
341
341
|
).normalize(), m = Re.FromPositionAndNormal(
|
|
342
|
-
|
|
342
|
+
r.position,
|
|
343
343
|
u.scale(-1)
|
|
344
344
|
);
|
|
345
345
|
l.mirrorPlane = m, l.level = s, o.reflectionTexture = l;
|
|
346
346
|
}
|
|
347
|
-
function r
|
|
348
|
-
const s =
|
|
347
|
+
function a(r) {
|
|
348
|
+
const s = r.material, o = new Oe(
|
|
349
349
|
"probe-" + s.name,
|
|
350
|
-
|
|
350
|
+
Ge,
|
|
351
351
|
e
|
|
352
352
|
);
|
|
353
|
-
o.attachToMesh(
|
|
353
|
+
o.attachToMesh(r), o.renderList && o.renderList.push(...t(e)), s.reflectionTexture = o.cubeTexture;
|
|
354
354
|
}
|
|
355
|
-
e.meshes.forEach((
|
|
356
|
-
const s =
|
|
357
|
-
s && (s.mirrorTexture && i(
|
|
355
|
+
e.meshes.forEach((r) => {
|
|
356
|
+
const s = r.metadata;
|
|
357
|
+
s && (s.mirrorTexture && i(r, s.mirrorTexture), s.reflectionProbe && a(r));
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class _e {
|
|
362
362
|
constructor(e, t) {
|
|
363
363
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
364
364
|
}
|
|
365
365
|
includeMeshes(e) {
|
|
366
|
-
this.glowLayer || (this.glowLayer = new
|
|
366
|
+
this.glowLayer || (this.glowLayer = new Te("glow", this.scene), this.glowLayer.intensity = this.intensity), e.forEach((t) => {
|
|
367
367
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
368
368
|
});
|
|
369
369
|
}
|
|
@@ -373,107 +373,107 @@ class Ge {
|
|
|
373
373
|
}), this.meshCount === 0 && (this.glowLayer.dispose(), this.glowLayer = void 0));
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
async function
|
|
378
|
-
return new Promise((i,
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
return i(
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
const oe = /* @__PURE__ */ new Map();
|
|
377
|
+
async function fe(n, e, t) {
|
|
378
|
+
return new Promise((i, a) => {
|
|
379
|
+
const r = oe.get(n);
|
|
380
|
+
if (r && r.scene.uid === e.uid)
|
|
381
|
+
return i(r);
|
|
382
|
+
pe.LoadAssetContainerAsync(
|
|
383
|
+
n,
|
|
384
384
|
void 0,
|
|
385
385
|
e,
|
|
386
386
|
t
|
|
387
387
|
).then((s) => {
|
|
388
|
-
|
|
389
|
-
}).catch(
|
|
388
|
+
oe.set(n, s), i(s);
|
|
389
|
+
}).catch(a);
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
t.forEach((
|
|
394
|
-
const s =
|
|
395
|
-
|
|
392
|
+
function qe(n, e, t, i, a = "") {
|
|
393
|
+
t.forEach((r) => {
|
|
394
|
+
const s = r.getID(), o = r.getName(), l = P.getDynamicTextureResolution();
|
|
395
|
+
n.filter((d) => d.name === a + o).forEach((d) => {
|
|
396
396
|
const u = i.get(s), m = !1;
|
|
397
397
|
if (u)
|
|
398
|
-
|
|
398
|
+
le(d, u), u.update(m);
|
|
399
399
|
else {
|
|
400
|
-
const p =
|
|
400
|
+
const p = Ke(
|
|
401
401
|
o,
|
|
402
402
|
e,
|
|
403
403
|
l.width,
|
|
404
404
|
l.height
|
|
405
405
|
);
|
|
406
|
-
i.set(s, p),
|
|
406
|
+
i.set(s, p), r.setStaticContext(
|
|
407
407
|
p.getContext()
|
|
408
|
-
),
|
|
408
|
+
), le(d, p), p.onLoadObservable.addOnce(() => {
|
|
409
409
|
p.update(m);
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
const
|
|
417
|
-
|
|
415
|
+
function Ke(n, e, t, i) {
|
|
416
|
+
const a = new Fe(
|
|
417
|
+
n,
|
|
418
418
|
{ width: t, height: i },
|
|
419
419
|
e,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
),
|
|
424
|
-
return
|
|
420
|
+
P.shouldMipMap(),
|
|
421
|
+
Be.TRILINEAR_SAMPLINGMODE,
|
|
422
|
+
me.TEXTUREFORMAT_RGBA
|
|
423
|
+
), r = a.getContext();
|
|
424
|
+
return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), a.update()), a;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
if (
|
|
428
|
-
const t =
|
|
426
|
+
function le(n, e) {
|
|
427
|
+
if (n instanceof F) {
|
|
428
|
+
const t = n, i = t.albedoTexture;
|
|
429
429
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
430
430
|
} else {
|
|
431
|
-
const t =
|
|
431
|
+
const t = n, i = t.diffuseTexture;
|
|
432
432
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
const
|
|
437
|
-
return
|
|
435
|
+
function Ue() {
|
|
436
|
+
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
437
|
+
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
438
438
|
}
|
|
439
|
-
const
|
|
440
|
-
function
|
|
441
|
-
return
|
|
439
|
+
const y = 60, he = 1;
|
|
440
|
+
function ce(n) {
|
|
441
|
+
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
console.warn(`No animations found for name: ${
|
|
443
|
+
function We(n, e, t, i, a) {
|
|
444
|
+
const r = a ? n.filter((s) => s.name === a) : n;
|
|
445
|
+
if (r.length === 0) {
|
|
446
|
+
console.warn(`No animations found for name: ${a}`);
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
449
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
450
|
-
|
|
450
|
+
r.forEach((s) => {
|
|
451
451
|
s.stop();
|
|
452
|
-
const o =
|
|
453
|
-
s.start(e,
|
|
452
|
+
const o = ce(s), l = i * o;
|
|
453
|
+
s.start(e, he, l, l);
|
|
454
454
|
});
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
|
|
457
|
+
r.forEach((s) => {
|
|
458
458
|
s.stop();
|
|
459
|
-
const o =
|
|
460
|
-
s.start(e,
|
|
459
|
+
const o = ce(s), l = i !== void 0 ? i * o : void 0, c = t !== void 0 ? t * o : void 0;
|
|
460
|
+
s.start(e, he, l, c);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
|
|
463
|
+
function be(n) {
|
|
464
|
+
n.forEach((e) => {
|
|
465
465
|
e.stop();
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
const e =
|
|
470
|
-
|
|
468
|
+
function Qe(n) {
|
|
469
|
+
const e = n.animationGroups;
|
|
470
|
+
be(e);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
|
|
474
|
-
const i = [],
|
|
472
|
+
function Ze(n, e, t) {
|
|
473
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = $e(e.alpha, 0, 2 * Math.PI));
|
|
474
|
+
const i = [], a = t.target, r = 0, s = a ? 1 : 0;
|
|
475
475
|
if (t.target && Object.keys(t.target).length > 0 && i.push(
|
|
476
|
-
|
|
476
|
+
x(
|
|
477
477
|
"cameraTargetLerp",
|
|
478
478
|
"target",
|
|
479
479
|
new g().copyFrom(e.target),
|
|
@@ -483,30 +483,30 @@ function We(a, e, t) {
|
|
|
483
483
|
t.target.z
|
|
484
484
|
),
|
|
485
485
|
v.ANIMATIONTYPE_VECTOR3,
|
|
486
|
-
|
|
486
|
+
r
|
|
487
487
|
)
|
|
488
488
|
), i.push(
|
|
489
|
-
|
|
489
|
+
x(
|
|
490
490
|
"cameraAlphaLerp",
|
|
491
491
|
"alpha",
|
|
492
492
|
e.alpha,
|
|
493
|
-
|
|
493
|
+
de(t.lonDeg),
|
|
494
494
|
v.ANIMATIONTYPE_FLOAT,
|
|
495
495
|
s
|
|
496
496
|
)
|
|
497
497
|
), i.push(
|
|
498
|
-
|
|
498
|
+
x(
|
|
499
499
|
"cameraBetaLerp",
|
|
500
500
|
"beta",
|
|
501
501
|
e.beta,
|
|
502
|
-
|
|
502
|
+
de(t.latDeg),
|
|
503
503
|
v.ANIMATIONTYPE_FLOAT,
|
|
504
504
|
s
|
|
505
505
|
)
|
|
506
506
|
), t.radius !== void 0) {
|
|
507
507
|
const c = Math.max(0.01, t.radius);
|
|
508
508
|
i.push(
|
|
509
|
-
|
|
509
|
+
x(
|
|
510
510
|
"cameraRadiusLerp",
|
|
511
511
|
"radius",
|
|
512
512
|
e.radius,
|
|
@@ -518,10 +518,10 @@ function We(a, e, t) {
|
|
|
518
518
|
}
|
|
519
519
|
e.animations.push(...i);
|
|
520
520
|
const l = e.useAutoRotationBehavior;
|
|
521
|
-
e.disableAutoRotationBehavior(),
|
|
521
|
+
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
522
522
|
e,
|
|
523
523
|
0,
|
|
524
|
-
|
|
524
|
+
a ? y * 2 : y,
|
|
525
525
|
!1,
|
|
526
526
|
1,
|
|
527
527
|
() => {
|
|
@@ -529,28 +529,28 @@ function We(a, e, t) {
|
|
|
529
529
|
}
|
|
530
530
|
);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
return
|
|
532
|
+
function de(n) {
|
|
533
|
+
return n * Math.PI / 180;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
const o = new
|
|
537
|
-
o.setEasingMode(
|
|
535
|
+
function x(n, e, t, i, a, r = 0, s = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
536
|
+
const o = new De();
|
|
537
|
+
o.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
538
538
|
const l = new v(
|
|
539
|
-
|
|
539
|
+
n,
|
|
540
540
|
e,
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
y,
|
|
542
|
+
a,
|
|
543
543
|
s
|
|
544
544
|
), c = [];
|
|
545
|
-
return
|
|
546
|
-
frame:
|
|
545
|
+
return r > 0 && c.push({ frame: 0, value: t }), c.push({ frame: y * r, value: t }), c.push({
|
|
546
|
+
frame: y * (r + 1),
|
|
547
547
|
value: i
|
|
548
548
|
}), l.setKeys(c), l.setEasingFunction(o), l;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
return
|
|
550
|
+
function $e(n, e, t) {
|
|
551
|
+
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
552
552
|
}
|
|
553
|
-
const
|
|
553
|
+
const Ye = {
|
|
554
554
|
albedoTexture: "albedoMap",
|
|
555
555
|
bumpTexture: "normalMap",
|
|
556
556
|
ambientTexture: "ambientMap",
|
|
@@ -559,7 +559,7 @@ const $e = {
|
|
|
559
559
|
metallicTexture: "metallicMap",
|
|
560
560
|
refractionTexture: "refractionMap"
|
|
561
561
|
};
|
|
562
|
-
function
|
|
562
|
+
function je(n, e, t, i) {
|
|
563
563
|
[
|
|
564
564
|
"albedoTexture",
|
|
565
565
|
"bumpTexture",
|
|
@@ -568,33 +568,33 @@ function Qe(a, e, t, i) {
|
|
|
568
568
|
"opacityTexture",
|
|
569
569
|
"metallicTexture",
|
|
570
570
|
"refractionTexture"
|
|
571
|
-
].forEach((
|
|
572
|
-
|
|
571
|
+
].forEach((r) => {
|
|
572
|
+
Xe(
|
|
573
|
+
r,
|
|
573
574
|
n,
|
|
574
|
-
a,
|
|
575
575
|
e,
|
|
576
576
|
t,
|
|
577
577
|
i
|
|
578
578
|
);
|
|
579
|
-
}),
|
|
579
|
+
}), tt(n, e);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
581
|
+
function Xe(n, e, t, i, a) {
|
|
582
|
+
const r = Ye[n];
|
|
583
|
+
if (!r)
|
|
584
584
|
throw new Error("Unexpected texture name encountered.");
|
|
585
|
-
const s = e[
|
|
586
|
-
o ? i.addTextureTask(
|
|
585
|
+
const s = e[r], o = s == null ? void 0 : s.fileLink;
|
|
586
|
+
o ? i.addTextureTask(n, o, !1, !1) : a && t[n] && (t[n] && t[n].dispose(), t[n] = null, Je(n, t));
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
588
|
+
function Je(n, e) {
|
|
589
|
+
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0));
|
|
590
590
|
}
|
|
591
|
-
function
|
|
592
|
-
|
|
591
|
+
function et(n, e, t, i) {
|
|
592
|
+
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
593
593
|
}
|
|
594
|
-
function
|
|
595
|
-
|
|
594
|
+
function tt(n, e) {
|
|
595
|
+
n.clearCoat && (n.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
596
596
|
}
|
|
597
|
-
class
|
|
597
|
+
class it {
|
|
598
598
|
constructor(e, t, i) {
|
|
599
599
|
this.materialVariantMap = /* @__PURE__ */ new Map(), this.keysThatRemovedBaseModel = [], this.loadedContainerForKey = /* @__PURE__ */ new Map(), this.loadedMaterialsForKey = /* @__PURE__ */ new Map(), this.scene = e, this.renameClonedAsset = t, this.setBaseModelEnabled = i;
|
|
600
600
|
}
|
|
@@ -607,8 +607,8 @@ class et {
|
|
|
607
607
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
608
608
|
* where we want to undo changes are remove effects from display.
|
|
609
609
|
*/
|
|
610
|
-
async applyMaterial(e, t, i,
|
|
611
|
-
return new Promise((
|
|
610
|
+
async applyMaterial(e, t, i, a) {
|
|
611
|
+
return new Promise((r) => {
|
|
612
612
|
const s = this.materialVariantMap.get(e);
|
|
613
613
|
this.materialVariantMap.set(e, {
|
|
614
614
|
...s,
|
|
@@ -618,16 +618,16 @@ class et {
|
|
|
618
618
|
(d) => d.name === o
|
|
619
619
|
);
|
|
620
620
|
if (l.length === 0) {
|
|
621
|
-
|
|
621
|
+
r();
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
|
-
const c = new
|
|
624
|
+
const c = new ke(this.scene);
|
|
625
625
|
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
626
|
-
(d) =>
|
|
626
|
+
(d) => je(
|
|
627
627
|
t,
|
|
628
628
|
d,
|
|
629
629
|
c,
|
|
630
|
-
|
|
630
|
+
a
|
|
631
631
|
)
|
|
632
632
|
), c.onProgress = (d, u, m) => {
|
|
633
633
|
i && i(d / u * 100, 100, m.name);
|
|
@@ -635,14 +635,14 @@ class et {
|
|
|
635
635
|
d.forEach((u) => {
|
|
636
636
|
const m = u;
|
|
637
637
|
i && i(100, 100, u.name), l.forEach(
|
|
638
|
-
(p) =>
|
|
638
|
+
(p) => et(
|
|
639
639
|
u.name,
|
|
640
640
|
p,
|
|
641
641
|
t,
|
|
642
642
|
m.texture
|
|
643
643
|
)
|
|
644
644
|
);
|
|
645
|
-
}),
|
|
645
|
+
}), r();
|
|
646
646
|
}, c.loadAsync();
|
|
647
647
|
});
|
|
648
648
|
}
|
|
@@ -653,16 +653,16 @@ class et {
|
|
|
653
653
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
654
654
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
655
655
|
*/
|
|
656
|
-
async applyModel(e, t, i,
|
|
656
|
+
async applyModel(e, t, i, a) {
|
|
657
657
|
var l, c;
|
|
658
658
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
659
659
|
return this.keysThatRemovedBaseModel.includes(e) && this.setBaseModelEnabled(!0), (l = this.loadedContainerForKey.get(e)) == null || l.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), Promise.resolve(void 0);
|
|
660
660
|
this.loadedContainerForKey.has(e) && ((c = this.loadedContainerForKey.get(e)) == null || c.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && this.setBaseModelEnabled(!1);
|
|
661
|
-
const s = (await
|
|
661
|
+
const s = (await fe(i, this.scene, a)).instantiateModelsToScene(
|
|
662
662
|
this.renameClonedAsset,
|
|
663
663
|
!0
|
|
664
664
|
);
|
|
665
|
-
this.loadedContainerForKey.set(e, s), this.loadedMaterialsForKey.set(e,
|
|
665
|
+
this.loadedContainerForKey.set(e, s), this.loadedMaterialsForKey.set(e, ve(s));
|
|
666
666
|
const o = [];
|
|
667
667
|
return this.materialVariantMap.forEach(async (d, u) => {
|
|
668
668
|
o.push(this.applyMaterial(u, d));
|
|
@@ -688,51 +688,51 @@ class et {
|
|
|
688
688
|
}), e;
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function ve(n) {
|
|
692
692
|
const e = [];
|
|
693
|
-
return
|
|
693
|
+
return n.rootNodes.forEach((t) => {
|
|
694
694
|
t.getChildMeshes().forEach((i) => {
|
|
695
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
696
|
-
const
|
|
697
|
-
|
|
695
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((a) => {
|
|
696
|
+
const r = a.getMaterial(!1);
|
|
697
|
+
r && !e.includes(r) && e.push(r);
|
|
698
698
|
});
|
|
699
699
|
});
|
|
700
700
|
}), e;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
703
|
-
return
|
|
702
|
+
function ue(n, e = "") {
|
|
703
|
+
return n.map((t) => ({
|
|
704
704
|
name: t.name.substring(e.length),
|
|
705
705
|
loop: t.loopAnimation,
|
|
706
706
|
to: t.to,
|
|
707
707
|
from: t.from
|
|
708
708
|
}));
|
|
709
709
|
}
|
|
710
|
-
class
|
|
710
|
+
class st {
|
|
711
711
|
constructor(e) {
|
|
712
712
|
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new b(), this.materialDeselectedObservable = new b(), this.materialVariantObservable = new b(), this.modelVariantObservable = new b(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.animations = [], this.initialized = !1, this.materials = [];
|
|
713
713
|
const {
|
|
714
714
|
enablePicking: t,
|
|
715
715
|
modelDetails: i,
|
|
716
|
-
previewService:
|
|
717
|
-
progressHandler:
|
|
716
|
+
previewService: a,
|
|
717
|
+
progressHandler: r,
|
|
718
718
|
scene: s
|
|
719
719
|
} = e;
|
|
720
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
720
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = a, this.scene = s, this.variantManager = new it(
|
|
721
721
|
s,
|
|
722
722
|
this.renameClonedAsset.bind(this),
|
|
723
723
|
this.setEnabled.bind(this)
|
|
724
724
|
), this.previewService.registerInitializedListener(
|
|
725
725
|
async () => await this.processQueuedEvents()
|
|
726
|
-
), this.transformRoot = new
|
|
727
|
-
const o = async () => (this.assetContainer = await
|
|
726
|
+
), this.transformRoot = new Se("root", this.scene);
|
|
727
|
+
const o = async () => (this.assetContainer = await fe(
|
|
728
728
|
i.model,
|
|
729
729
|
s,
|
|
730
|
-
|
|
730
|
+
r
|
|
731
731
|
), this.initialized = !0, this.instantiate(), this);
|
|
732
732
|
this.importPromise = o();
|
|
733
733
|
}
|
|
734
734
|
//#region Interface implementation
|
|
735
|
-
async applyMaterialVariant(e, t, i,
|
|
735
|
+
async applyMaterialVariant(e, t, i, a) {
|
|
736
736
|
if (this.previewService.getSceneInitializationProgress() !== 100 || !this.initialized) {
|
|
737
737
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
738
738
|
const s = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -743,7 +743,7 @@ class tt {
|
|
|
743
743
|
e,
|
|
744
744
|
t,
|
|
745
745
|
i,
|
|
746
|
-
|
|
746
|
+
a
|
|
747
747
|
)
|
|
748
748
|
);
|
|
749
749
|
} else {
|
|
@@ -759,13 +759,13 @@ class tt {
|
|
|
759
759
|
e,
|
|
760
760
|
t,
|
|
761
761
|
i,
|
|
762
|
-
|
|
762
|
+
a
|
|
763
763
|
)
|
|
764
764
|
);
|
|
765
765
|
}
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
|
-
const
|
|
768
|
+
const r = async () => {
|
|
769
769
|
await this.variantManager.applyMaterial(
|
|
770
770
|
e,
|
|
771
771
|
i,
|
|
@@ -776,24 +776,24 @@ class tt {
|
|
|
776
776
|
taskName: l
|
|
777
777
|
});
|
|
778
778
|
},
|
|
779
|
-
|
|
779
|
+
a
|
|
780
780
|
);
|
|
781
781
|
};
|
|
782
782
|
if (this.materialChangesInProgress.includes(e)) {
|
|
783
783
|
if (this.queuedMaterialChanges.has(e)) {
|
|
784
784
|
const s = this.queuedMaterialChanges.get(e);
|
|
785
|
-
s == null || s.set(t,
|
|
785
|
+
s == null || s.set(t, r);
|
|
786
786
|
} else {
|
|
787
787
|
this.queuedMaterialChanges.set(
|
|
788
788
|
e,
|
|
789
789
|
/* @__PURE__ */ new Map()
|
|
790
790
|
);
|
|
791
791
|
const s = this.queuedMaterialChanges.get(e);
|
|
792
|
-
s == null || s.set(t,
|
|
792
|
+
s == null || s.set(t, r);
|
|
793
793
|
}
|
|
794
794
|
return;
|
|
795
795
|
}
|
|
796
|
-
this.materialChangesInProgress.push(e), await
|
|
796
|
+
this.materialChangesInProgress.push(e), await r(), this.queuedMaterialChanges.has(e) && (this.queuedMaterialChanges.get(e).forEach(async (o) => {
|
|
797
797
|
await o();
|
|
798
798
|
}), this.queuedMaterialChanges.delete(e)), this.materialChangesInProgress.splice(
|
|
799
799
|
this.materialChangesInProgress.indexOf(e),
|
|
@@ -813,7 +813,7 @@ class tt {
|
|
|
813
813
|
);
|
|
814
814
|
return;
|
|
815
815
|
}
|
|
816
|
-
const
|
|
816
|
+
const a = () => this.variantManager.applyModel(
|
|
817
817
|
e,
|
|
818
818
|
i,
|
|
819
819
|
t == null ? void 0 : t.model,
|
|
@@ -825,18 +825,18 @@ class tt {
|
|
|
825
825
|
}
|
|
826
826
|
);
|
|
827
827
|
if (this.modelChangesInProgress.includes(e)) {
|
|
828
|
-
this.queuedModelChanges.set(e,
|
|
828
|
+
this.queuedModelChanges.set(e, a);
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
831
|
const s = await (async () => {
|
|
832
832
|
this.modelChangesInProgress.push(e);
|
|
833
|
-
let o = await
|
|
833
|
+
let o = await a();
|
|
834
834
|
return this.queuedModelChanges.has(e) && (o = await this.queuedModelChanges.get(e)(), this.queuedModelChanges.delete(e)), this.modelChangesInProgress.splice(
|
|
835
835
|
this.modelChangesInProgress.indexOf(e),
|
|
836
836
|
1
|
|
837
837
|
), o;
|
|
838
838
|
})();
|
|
839
|
-
this.modelInstance &&
|
|
839
|
+
this.modelInstance && be(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), s ? this.configureModelInstance(s) : this.configureGlowLayer();
|
|
840
840
|
}
|
|
841
841
|
dispose() {
|
|
842
842
|
var e;
|
|
@@ -847,7 +847,7 @@ class tt {
|
|
|
847
847
|
this.queuedModelAnimation = e;
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
|
-
this.modelInstance &&
|
|
850
|
+
this.modelInstance && We(
|
|
851
851
|
[
|
|
852
852
|
...this.modelInstance.animationGroups,
|
|
853
853
|
...this.variantManager.getAnimationGroups()
|
|
@@ -861,7 +861,7 @@ class tt {
|
|
|
861
861
|
getAnimations(e) {
|
|
862
862
|
return [
|
|
863
863
|
...this.animations,
|
|
864
|
-
...e ?
|
|
864
|
+
...e ? ue(
|
|
865
865
|
this.variantManager.getAnimationGroups(),
|
|
866
866
|
this.renameClonedAsset("")
|
|
867
867
|
) : []
|
|
@@ -899,10 +899,14 @@ class tt {
|
|
|
899
899
|
this.transformRoot.position = new g(e.x, e.y, e.z);
|
|
900
900
|
}
|
|
901
901
|
get rotation() {
|
|
902
|
-
return this.transformRoot.
|
|
902
|
+
return this.transformRoot.rotationQuaternion.toEulerAngles();
|
|
903
903
|
}
|
|
904
904
|
set rotation(e) {
|
|
905
|
-
this.transformRoot.
|
|
905
|
+
this.transformRoot.rotationQuaternion = C.FromEulerAngles(
|
|
906
|
+
e.x,
|
|
907
|
+
e.y,
|
|
908
|
+
e.z
|
|
909
|
+
);
|
|
906
910
|
}
|
|
907
911
|
get scale() {
|
|
908
912
|
return this.transformRoot.scaling;
|
|
@@ -915,15 +919,15 @@ class tt {
|
|
|
915
919
|
attachPickingHandler(e) {
|
|
916
920
|
e.rootNodes.forEach((t) => {
|
|
917
921
|
t.getChildMeshes(!1).forEach((i) => {
|
|
918
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
919
|
-
new
|
|
920
|
-
|
|
922
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new A(this.scene)), i.actionManager.registerAction(
|
|
923
|
+
new re(A.OnPointerOverTrigger, (a) => {
|
|
924
|
+
a.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
921
925
|
id: i.material.id,
|
|
922
926
|
name: this.stripIdFromName(i.material.name)
|
|
923
927
|
});
|
|
924
928
|
})
|
|
925
929
|
), i.actionManager.registerAction(
|
|
926
|
-
new
|
|
930
|
+
new re(A.OnPointerOutTrigger, () => {
|
|
927
931
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
928
932
|
id: i.material.id,
|
|
929
933
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -952,15 +956,15 @@ class tt {
|
|
|
952
956
|
return this.modelReadyToLoadCallbacks.size;
|
|
953
957
|
}
|
|
954
958
|
configureGlowLayer() {
|
|
955
|
-
const e = (i) => i instanceof
|
|
959
|
+
const e = (i) => i instanceof F && i.emissiveTexture !== null;
|
|
956
960
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
957
961
|
}
|
|
958
962
|
configureModelInstance(e) {
|
|
959
|
-
var
|
|
960
|
-
const t = this.transformRoot.position, i = this.transformRoot.
|
|
961
|
-
this.transformRoot.position = g.Zero(), this.transformRoot.
|
|
963
|
+
var r;
|
|
964
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, a = this.transformRoot.scaling;
|
|
965
|
+
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = C.Identity(), this.transformRoot.scaling = g.One(), e.rootNodes.forEach((s) => {
|
|
962
966
|
s.parent = this.transformRoot;
|
|
963
|
-
}), this.transformRoot.position = t, this.transformRoot.
|
|
967
|
+
}), this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), qe(
|
|
964
968
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
965
969
|
this.scene,
|
|
966
970
|
this.canvasPanels,
|
|
@@ -978,14 +982,14 @@ class tt {
|
|
|
978
982
|
getAllMeshes() {
|
|
979
983
|
var e;
|
|
980
984
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
981
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
985
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
982
986
|
).flat();
|
|
983
987
|
}
|
|
984
988
|
instantiate() {
|
|
985
989
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
986
990
|
this.renameClonedAsset.bind(this),
|
|
987
991
|
!0
|
|
988
|
-
), this.materials =
|
|
992
|
+
), this.materials = ve(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = ue(
|
|
989
993
|
this.modelInstance.animationGroups,
|
|
990
994
|
this.renameClonedAsset("")
|
|
991
995
|
), this.processQueuedEvents();
|
|
@@ -1000,8 +1004,8 @@ class tt {
|
|
|
1000
1004
|
var e;
|
|
1001
1005
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1002
1006
|
(t, i) => {
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1007
|
+
const a = this.dynamicTextures.get(i);
|
|
1008
|
+
a && t.getStaticContextDirty() && a.isReady() && (a.update(!1), t.setStaticContextDirty(!1));
|
|
1005
1009
|
}
|
|
1006
1010
|
);
|
|
1007
1011
|
}
|
|
@@ -1035,14 +1039,14 @@ class tt {
|
|
|
1035
1039
|
}
|
|
1036
1040
|
//#endregion
|
|
1037
1041
|
}
|
|
1038
|
-
class
|
|
1039
|
-
constructor(e, t, i,
|
|
1042
|
+
class B extends ge {
|
|
1043
|
+
constructor(e, t, i, a, r, s, o, l) {
|
|
1040
1044
|
super(
|
|
1041
1045
|
e,
|
|
1042
1046
|
t,
|
|
1043
1047
|
i,
|
|
1048
|
+
a,
|
|
1044
1049
|
r,
|
|
1045
|
-
n,
|
|
1046
1050
|
s,
|
|
1047
1051
|
l
|
|
1048
1052
|
), this.lastFocus = new g(0, 0, 0), this.panDenominator = 1, this.minZ = 0.01, this.setRadius(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, o.camera.autoOrientation && (this.alpha += Math.PI), o && (o.camera.limits.min.beta && (this.lowerBetaLimit = o.camera.limits.min.beta), o.camera.limits.max.beta && (this.upperBetaLimit = o.camera.limits.max.beta), o.camera.limits.min.alpha && (this.lowerAlphaLimit = o.camera.limits.min.alpha), o.camera.limits.max.alpha && (this.upperAlphaLimit = o.camera.limits.max.alpha), o.camera.limits.min.radius && (this.lowerRadiusLimit = o.camera.limits.min.radius), o.camera.limits.max.radius && (this.upperRadiusLimit = o.camera.limits.max.radius), o.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
@@ -1072,7 +1076,7 @@ class I extends de {
|
|
|
1072
1076
|
this.useFramingBehavior = !0;
|
|
1073
1077
|
const e = this.getFramingBehavior();
|
|
1074
1078
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1075
|
-
const t =
|
|
1079
|
+
const t = R(this._scene);
|
|
1076
1080
|
return e.zoomOnBoundingInfo(t.min, t.max), this.wheelPrecision = 100 / this.radius, this.lowerRadiusLimit === null && (this.lowerRadiusLimit = 0.1), this.lastFocus.copyFrom(this.target), e;
|
|
1077
1081
|
}
|
|
1078
1082
|
/**
|
|
@@ -1083,14 +1087,14 @@ class I extends de {
|
|
|
1083
1087
|
rerunFramingBehavior(e, t) {
|
|
1084
1088
|
const i = this.getFramingBehavior();
|
|
1085
1089
|
i.framingTime = t || 800;
|
|
1086
|
-
const
|
|
1090
|
+
const a = () => {
|
|
1087
1091
|
e && e();
|
|
1088
|
-
},
|
|
1092
|
+
}, r = R(this._scene), s = r.max.subtract(r.min), o = r.min.add(s.scale(0.5));
|
|
1089
1093
|
this.setRadius(s.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(o), this.panDenominator = s.length(), i.zoomOnBoundingInfo(
|
|
1090
|
-
|
|
1091
|
-
|
|
1094
|
+
r.min,
|
|
1095
|
+
r.max,
|
|
1092
1096
|
void 0,
|
|
1093
|
-
|
|
1097
|
+
a
|
|
1094
1098
|
), i.framingTime = 0;
|
|
1095
1099
|
}
|
|
1096
1100
|
/**
|
|
@@ -1120,32 +1124,32 @@ class I extends de {
|
|
|
1120
1124
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1121
1125
|
*/
|
|
1122
1126
|
static create(e, t, i) {
|
|
1123
|
-
const
|
|
1127
|
+
const a = R(e), r = a.max.subtract(a.min), s = a.min.add(r.scale(0.5)), o = new B(
|
|
1124
1128
|
"ProductCamera",
|
|
1125
1129
|
-(Math.PI / 2),
|
|
1126
1130
|
Math.PI / 2,
|
|
1127
|
-
|
|
1131
|
+
r.length() * 1.5,
|
|
1128
1132
|
s,
|
|
1129
1133
|
e,
|
|
1130
1134
|
t
|
|
1131
1135
|
);
|
|
1132
|
-
return o.panningInertia = 0, o.panningOriginTarget.copyFrom(s), o.panDenominator =
|
|
1136
|
+
return o.panningInertia = 0, o.panningOriginTarget.copyFrom(s), o.panDenominator = r.length(), o.onAfterCheckInputsObservable.add(() => {
|
|
1133
1137
|
o.panningSensibility = 1e3 / o.panDenominator;
|
|
1134
1138
|
}), i && (e.activeCamera = o), o;
|
|
1135
1139
|
}
|
|
1136
1140
|
}
|
|
1137
|
-
function
|
|
1138
|
-
if (
|
|
1141
|
+
function R(n) {
|
|
1142
|
+
if (n.meshes.length === 0)
|
|
1139
1143
|
return {
|
|
1140
1144
|
min: new g(-1, -1, -1),
|
|
1141
1145
|
max: new g(1, 1, 1)
|
|
1142
1146
|
};
|
|
1143
|
-
const e =
|
|
1144
|
-
return
|
|
1147
|
+
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1148
|
+
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1145
1149
|
}
|
|
1146
|
-
class
|
|
1150
|
+
class nt {
|
|
1147
1151
|
constructor(e, t = !1, i = void 0) {
|
|
1148
|
-
this.renderingPipeline = new
|
|
1152
|
+
this.renderingPipeline = new Ve(
|
|
1149
1153
|
"default",
|
|
1150
1154
|
t,
|
|
1151
1155
|
e,
|
|
@@ -1161,27 +1165,27 @@ class it {
|
|
|
1161
1165
|
return this.currentConfiguration;
|
|
1162
1166
|
}
|
|
1163
1167
|
setConfiguration(e) {
|
|
1164
|
-
var t, i,
|
|
1168
|
+
var t, i, a, r, s, o, l, c, d, u, m, p, D, z, k, V, N, G, H, _, q, K, U, W, Q, Z, $, Y, j, X, J, ee, te;
|
|
1165
1169
|
if (this.renderingPipeline.isSupported) {
|
|
1166
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? h.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? h.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((
|
|
1170
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? h.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? h.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((a = e.bloom) == null ? void 0 : a.enabled) ?? h.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.kernel) ?? h.bloom.kernel, this.renderingPipeline.bloomScale = ((s = e.bloom) == null ? void 0 : s.scale) ?? h.bloom.scale, this.renderingPipeline.bloomThreshold = ((o = e.bloom) == null ? void 0 : o.threshold) ?? h.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? h.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? h.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((d = e.chromaticAberration) == null ? void 0 : d.aberrationAmount) ?? h.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? h.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ie(
|
|
1167
1171
|
e.chromaticAberration.direction.x,
|
|
1168
1172
|
e.chromaticAberration.direction.y
|
|
1169
|
-
) : new
|
|
1173
|
+
) : new ie(
|
|
1170
1174
|
h.chromaticAberration.direction.x,
|
|
1171
1175
|
h.chromaticAberration.direction.y
|
|
1172
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? h.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new
|
|
1176
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? h.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new ae(), this.renderingPipeline.depthOfFieldEnabled = ((D = e.depthOfField) == null ? void 0 : D.enabled) ?? h.depthOfField.enabled, e.depthOfField)
|
|
1173
1177
|
switch (e.depthOfField.blurLevel ?? h.depthOfField.blurLevel) {
|
|
1174
1178
|
case "Low":
|
|
1175
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1179
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
1176
1180
|
break;
|
|
1177
1181
|
case "Medium":
|
|
1178
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1182
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
|
|
1179
1183
|
break;
|
|
1180
1184
|
case "High":
|
|
1181
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1185
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1182
1186
|
break;
|
|
1183
1187
|
}
|
|
1184
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1188
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((z = e.depthOfField) == null ? void 0 : z.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((k = e.depthOfField) == null ? void 0 : k.fStop) ?? h.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? h.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((N = e.depthOfField) == null ? void 0 : N.lensSize) ?? h.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? h.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? h.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? h.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((q = e.misc) == null ? void 0 : q.contrast) ?? h.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? h.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? h.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1185
1189
|
switch (e.misc.toneMappingType ?? h.misc.toneMappingType) {
|
|
1186
1190
|
case "Standard":
|
|
1187
1191
|
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_STANDARD;
|
|
@@ -1190,8 +1194,8 @@ class it {
|
|
|
1190
1194
|
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_ACES;
|
|
1191
1195
|
break;
|
|
1192
1196
|
}
|
|
1193
|
-
if (this.renderingPipeline.sharpenEnabled = ((
|
|
1194
|
-
switch (((
|
|
1197
|
+
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? h.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? h.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? h.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = (($ = e.vignette) == null ? void 0 : $.enabled) ?? h.vignette.enabled, (Y = e.vignette) != null && Y.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = h.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = h.vignette.center.y), e.vignette)
|
|
1198
|
+
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? h.vignette.blendMode) {
|
|
1195
1199
|
case "Multiply":
|
|
1196
1200
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_MULTIPLY;
|
|
1197
1201
|
break;
|
|
@@ -1199,54 +1203,60 @@ class it {
|
|
|
1199
1203
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_OPAQUE;
|
|
1200
1204
|
break;
|
|
1201
1205
|
}
|
|
1202
|
-
(
|
|
1206
|
+
(X = e.vignette) != null && X.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1203
1207
|
e.vignette.colorRgba.r,
|
|
1204
1208
|
e.vignette.colorRgba.g,
|
|
1205
1209
|
e.vignette.colorRgba.b,
|
|
1206
1210
|
e.vignette.colorRgba.a
|
|
1207
|
-
) : (
|
|
1211
|
+
) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = f.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1208
1212
|
h.vignette.colorRgba.r,
|
|
1209
1213
|
h.vignette.colorRgba.g,
|
|
1210
1214
|
h.vignette.colorRgba.b,
|
|
1211
1215
|
h.vignette.colorRgba.a
|
|
1212
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((
|
|
1216
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? h.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? h.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1213
1217
|
}
|
|
1214
1218
|
}
|
|
1215
1219
|
updateColorCurve(e) {
|
|
1216
|
-
const t = new
|
|
1220
|
+
const t = new ae();
|
|
1217
1221
|
return t.globalDensity = e.globalDensity ?? t.globalDensity, t.globalExposure = e.globalExposure ?? t.globalExposure, t.globalHue = e.globalHue ?? t.globalHue, t.globalSaturation = e.globalSaturation ?? t.globalSaturation, t.highlightsDensity = e.highlightsDensity ?? t.highlightsDensity, t.highlightsExposure = e.highlightsExposure ?? t.highlightsExposure, t.highlightsHue = e.highlightsHue ?? t.highlightsHue, t.highlightsSaturation = e.highlightsSaturation ?? t.highlightsSaturation, t.midtonesDensity = e.midtonesDensity ?? t.midtonesDensity, t.midtonesExposure = e.midtonesExposure ?? t.midtonesExposure, t.midtonesHue = e.midtonesHue ?? t.midtonesHue, t.midtonesSaturation = e.midtonesSaturation ?? t.midtonesSaturation, t.shadowsDensity = e.shadowsDensity ?? t.shadowsDensity, t.shadowsExposure = e.shadowsExposure ?? t.shadowsExposure, t.shadowsHue = e.shadowsHue ?? t.shadowsHue, t.shadowsSaturation = e.shadowsSaturation ?? t.shadowsSaturation, t;
|
|
1218
1222
|
}
|
|
1219
1223
|
}
|
|
1220
|
-
|
|
1221
|
-
return new
|
|
1224
|
+
Le.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1225
|
+
return new He(n);
|
|
1222
1226
|
});
|
|
1223
|
-
|
|
1224
|
-
if (
|
|
1225
|
-
const e =
|
|
1227
|
+
pe.OnPluginActivatedObservable.add((n) => {
|
|
1228
|
+
if (n.name === "gltf") {
|
|
1229
|
+
const e = n;
|
|
1226
1230
|
e.transparencyAsCoverage = !0;
|
|
1227
1231
|
}
|
|
1228
1232
|
});
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1233
|
+
const L = "initialScene";
|
|
1234
|
+
function O(n) {
|
|
1235
|
+
return new g(n.x, n.y, n.z);
|
|
1236
|
+
}
|
|
1237
|
+
function T(n) {
|
|
1238
|
+
return { x: n.x, y: n.y, z: n.z };
|
|
1239
|
+
}
|
|
1240
|
+
class Wt {
|
|
1231
1241
|
constructor(e) {
|
|
1232
1242
|
this.loadProgress = /* @__PURE__ */ new Map([
|
|
1233
|
-
[
|
|
1234
|
-
]), this.focusLostNotified = !1, this.loadObservable = new b(), this.focusLostObservable = new b(), this.initializedCallbacks = [], this.isInitialized = !1, this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.configuration = new
|
|
1243
|
+
[L, 0]
|
|
1244
|
+
]), this.focusLostNotified = !1, this.loadObservable = new b(), this.focusLostObservable = new b(), this.initializedCallbacks = [], this.isInitialized = !1, this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.configuration = new Ne(e);
|
|
1235
1245
|
const i = (() => {
|
|
1236
1246
|
if (!(e != null && e.noRender))
|
|
1237
1247
|
return this.configuration.createCanvas();
|
|
1238
|
-
})(),
|
|
1239
|
-
|
|
1248
|
+
})(), a = "1.5.6";
|
|
1249
|
+
Pe.Configuration = {
|
|
1240
1250
|
decoder: {
|
|
1241
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1242
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1243
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1251
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_wasm_wrapper_gltf.js`,
|
|
1252
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.wasm`,
|
|
1253
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.js`
|
|
1244
1254
|
}
|
|
1245
1255
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1246
|
-
const
|
|
1256
|
+
const r = console.log;
|
|
1247
1257
|
console.log = () => {
|
|
1248
1258
|
};
|
|
1249
|
-
const s = i ? new
|
|
1259
|
+
const s = i ? new me(i, !0, {
|
|
1250
1260
|
adaptToDeviceRatio: !0,
|
|
1251
1261
|
limitDeviceRatio: 2,
|
|
1252
1262
|
premultipliedAlpha: !1,
|
|
@@ -1254,12 +1264,12 @@ class Kt {
|
|
|
1254
1264
|
audioEngine: !1,
|
|
1255
1265
|
stencil: this.configuration.highlights.enabled,
|
|
1256
1266
|
forceSRGBBufferSupportState: !0
|
|
1257
|
-
}) : new
|
|
1258
|
-
console.log =
|
|
1267
|
+
}) : new we();
|
|
1268
|
+
console.log = r, s.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = s, this.scene = new xe(s), this.camera = B.create(this.scene, this.configuration), this.renderingPipeline = new nt(
|
|
1259
1269
|
this.scene,
|
|
1260
1270
|
!1,
|
|
1261
1271
|
this.camera
|
|
1262
|
-
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new
|
|
1272
|
+
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new _e(
|
|
1263
1273
|
this.scene,
|
|
1264
1274
|
this.configuration.emissiveGlowIntensity
|
|
1265
1275
|
);
|
|
@@ -1304,7 +1314,7 @@ class Kt {
|
|
|
1304
1314
|
}
|
|
1305
1315
|
registerView(e) {
|
|
1306
1316
|
const t = e.height, i = e.width;
|
|
1307
|
-
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1317
|
+
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
|
|
1308
1318
|
}
|
|
1309
1319
|
getNumViewports() {
|
|
1310
1320
|
var e;
|
|
@@ -1317,11 +1327,11 @@ class Kt {
|
|
|
1317
1327
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1318
1328
|
}
|
|
1319
1329
|
getSceneInitializationProgress() {
|
|
1320
|
-
return this.loadProgress.get(
|
|
1330
|
+
return this.loadProgress.get(L);
|
|
1321
1331
|
}
|
|
1322
1332
|
async initialize(e) {
|
|
1323
|
-
var i,
|
|
1324
|
-
this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture =
|
|
1333
|
+
var i, a;
|
|
1334
|
+
this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture = ye.CreateFromPrefilteredData(
|
|
1325
1335
|
this.configuration.scene.environmentFile,
|
|
1326
1336
|
this.scene
|
|
1327
1337
|
);
|
|
@@ -1330,20 +1340,20 @@ class Kt {
|
|
|
1330
1340
|
e,
|
|
1331
1341
|
(s) => {
|
|
1332
1342
|
this.loadProgress.set(
|
|
1333
|
-
|
|
1343
|
+
L,
|
|
1334
1344
|
s.loaded * 100 / s.total
|
|
1335
1345
|
), this.notifyLoadHandlers();
|
|
1336
1346
|
}
|
|
1337
|
-
).getInitializationPromise()), this.loadProgress.set(
|
|
1347
|
+
).getInitializationPromise()), this.loadProgress.set(L, 100), this.notifyLoadHandlers(), this.scene.activeCamera = this.camera, this.camera.rerunFramingBehavior(void 0, 1), Qe(this.scene), ((i = this.engine.views) == null ? void 0 : i.length) >= 1 && this.reattachControls(
|
|
1338
1348
|
this.engine.views[this.engine.views.length - 1].target
|
|
1339
|
-
), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0), this.isInitialized = !0, await Promise.all(this.initializedCallbacks.map((
|
|
1349
|
+
), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0), this.isInitialized = !0, await Promise.all(this.initializedCallbacks.map((r) => r())), this.initializedCallbacks = [], (a = this.configuration.options) != null && a.renderingPipelineConfiguration && this.renderingPipeline.setConfiguration(
|
|
1340
1350
|
this.configuration.options.renderingPipelineConfiguration
|
|
1341
1351
|
), this.engine.runRenderLoop(() => {
|
|
1342
|
-
this.engine.views && (this.modelContainers.forEach((
|
|
1343
|
-
|
|
1344
|
-
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((
|
|
1352
|
+
this.engine.views && (this.modelContainers.forEach((r) => {
|
|
1353
|
+
r.updateDynamicTextures();
|
|
1354
|
+
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((r) => {
|
|
1345
1355
|
const s = this.engine.getRenderingCanvas();
|
|
1346
|
-
|
|
1356
|
+
r.target.getContext("2d").clearRect(
|
|
1347
1357
|
0,
|
|
1348
1358
|
0,
|
|
1349
1359
|
s.width,
|
|
@@ -1357,7 +1367,7 @@ class Kt {
|
|
|
1357
1367
|
this.queuedCameraAnimation = e;
|
|
1358
1368
|
return;
|
|
1359
1369
|
}
|
|
1360
|
-
|
|
1370
|
+
Ze(
|
|
1361
1371
|
this.scene,
|
|
1362
1372
|
this.scene.activeCamera,
|
|
1363
1373
|
e
|
|
@@ -1389,7 +1399,7 @@ class Kt {
|
|
|
1389
1399
|
throw new Error(
|
|
1390
1400
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1391
1401
|
);
|
|
1392
|
-
e ===
|
|
1402
|
+
e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1393
1403
|
}
|
|
1394
1404
|
animateToLastCameraFocus() {
|
|
1395
1405
|
return new Promise((e) => {
|
|
@@ -1413,7 +1423,7 @@ class Kt {
|
|
|
1413
1423
|
async renderSceneScreenshot(e, t) {
|
|
1414
1424
|
if (!this.camera)
|
|
1415
1425
|
throw new Error("Missing product camera, cannot render screenshot!");
|
|
1416
|
-
const i = new
|
|
1426
|
+
const i = new ge(
|
|
1417
1427
|
"screenshotCamera",
|
|
1418
1428
|
0,
|
|
1419
1429
|
0,
|
|
@@ -1422,9 +1432,9 @@ class Kt {
|
|
|
1422
1432
|
this.scene
|
|
1423
1433
|
);
|
|
1424
1434
|
try {
|
|
1425
|
-
const
|
|
1426
|
-
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha =
|
|
1427
|
-
const s = await
|
|
1435
|
+
const a = t.latDeg * Math.PI / 180, r = t.lonDeg * Math.PI / 180;
|
|
1436
|
+
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = r, i.beta = a, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1437
|
+
const s = await Me.CreateScreenshotUsingRenderTargetAsync(
|
|
1428
1438
|
this.engine,
|
|
1429
1439
|
i,
|
|
1430
1440
|
e,
|
|
@@ -1441,26 +1451,26 @@ class Kt {
|
|
|
1441
1451
|
const e = this.configuration;
|
|
1442
1452
|
if (!e)
|
|
1443
1453
|
return !0;
|
|
1444
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1445
|
-
if (t === void 0 || i === void 0 ||
|
|
1454
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, a = e.camera.limits.min.beta, r = e.camera.limits.max.beta;
|
|
1455
|
+
if (t === void 0 || i === void 0 || a === void 0 || r === void 0)
|
|
1446
1456
|
return !0;
|
|
1447
|
-
const s = [t, i], o = [
|
|
1457
|
+
const s = [t, i], o = [a, r], l = s.every((d) => d === t), c = o.every((d) => d === a);
|
|
1448
1458
|
return !l && !c;
|
|
1449
1459
|
}
|
|
1450
1460
|
fireResizeEvent() {
|
|
1451
1461
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1452
1462
|
}
|
|
1453
1463
|
setHighlights(e, t) {
|
|
1454
|
-
var
|
|
1455
|
-
e.length === 0 && ((
|
|
1464
|
+
var a;
|
|
1465
|
+
e.length === 0 && ((a = this.highlightLayer) == null || a.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new Ce("highlights", this.scene, {
|
|
1456
1466
|
isStroke: !0,
|
|
1457
1467
|
blurVerticalSize: 0.85,
|
|
1458
1468
|
blurHorizontalSize: 0.85
|
|
1459
1469
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1460
1470
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1461
|
-
e.forEach((
|
|
1471
|
+
e.forEach((r) => {
|
|
1462
1472
|
const s = this.scene.materials.find(
|
|
1463
|
-
(o) => o.name ===
|
|
1473
|
+
(o) => o.name === r.name && o.id === r.id
|
|
1464
1474
|
);
|
|
1465
1475
|
s && s.getBindedMeshes().forEach(
|
|
1466
1476
|
(o) => {
|
|
@@ -1477,7 +1487,7 @@ class Kt {
|
|
|
1477
1487
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1478
1488
|
}
|
|
1479
1489
|
loadModel(e, t) {
|
|
1480
|
-
const i = new
|
|
1490
|
+
const i = new st({
|
|
1481
1491
|
enablePicking: this.configuration.highlights.enabled,
|
|
1482
1492
|
modelDetails: e,
|
|
1483
1493
|
scene: this.scene,
|
|
@@ -1485,15 +1495,15 @@ class Kt {
|
|
|
1485
1495
|
progressHandler: t
|
|
1486
1496
|
});
|
|
1487
1497
|
return i.registerMaterialVariantListener(
|
|
1488
|
-
(
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1498
|
+
(a) => this.handleMaterialProgressCallback(
|
|
1499
|
+
a.remainingCount,
|
|
1500
|
+
a.totalCount,
|
|
1501
|
+
a.taskName
|
|
1492
1502
|
)
|
|
1493
1503
|
), i.registerModelVariantListener(
|
|
1494
|
-
(
|
|
1495
|
-
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1496
|
-
this.setHighlights([
|
|
1504
|
+
(a) => this.handleModelProgressCallback(a, a.key)
|
|
1505
|
+
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((a) => {
|
|
1506
|
+
this.setHighlights([a]);
|
|
1497
1507
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1498
1508
|
this.setHighlights([]);
|
|
1499
1509
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1516,7 +1526,7 @@ class Kt {
|
|
|
1516
1526
|
}
|
|
1517
1527
|
unregisterPlugin(e) {
|
|
1518
1528
|
const t = this.plugins.indexOf(e);
|
|
1519
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1529
|
+
t > -1 && this.plugins.splice(t, 1).forEach((a) => a.dispose(!1));
|
|
1520
1530
|
}
|
|
1521
1531
|
getGlowLayerManager() {
|
|
1522
1532
|
return this.glowLayerManager;
|
|
@@ -1527,47 +1537,26 @@ class Kt {
|
|
|
1527
1537
|
modelContainer: e
|
|
1528
1538
|
});
|
|
1529
1539
|
}
|
|
1540
|
+
triggerModelLoadEvent(e) {
|
|
1541
|
+
this.modelLoadEventCallbacks.forEach((t) => t(e));
|
|
1542
|
+
}
|
|
1530
1543
|
/**
|
|
1531
|
-
*
|
|
1532
|
-
* @param transform The transform to rotate. All values are optional and default to standard identity values.
|
|
1533
|
-
* @param axis The axis to rotate around. Defaults to the Y axis.
|
|
1534
|
-
* @param angle The angle to rotate by. Defaults to PI (180 degrees);
|
|
1544
|
+
* Flips a transform around the origin.
|
|
1535
1545
|
*/
|
|
1536
|
-
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
rotation: this.fromBabylonVector3(u.toEulerAngles()),
|
|
1549
|
-
scale: this.fromBabylonVector3(m)
|
|
1550
|
-
};
|
|
1551
|
-
}
|
|
1552
|
-
toBabylonVector3(e) {
|
|
1553
|
-
return new g(e.x, e.y, e.z);
|
|
1554
|
-
}
|
|
1555
|
-
fromBabylonVector3(e) {
|
|
1556
|
-
return { x: e.x, y: e.y, z: e.z };
|
|
1557
|
-
}
|
|
1558
|
-
toRadians(e) {
|
|
1559
|
-
return e * Math.PI / 180;
|
|
1560
|
-
}
|
|
1561
|
-
toRadiansVector(e) {
|
|
1562
|
-
return {
|
|
1563
|
-
x: this.toRadians(e.x),
|
|
1564
|
-
y: this.toRadians(e.y),
|
|
1565
|
-
z: this.toRadians(e.z)
|
|
1546
|
+
flipTransform(e, t, i) {
|
|
1547
|
+
const a = se.Compose(
|
|
1548
|
+
O(i || { x: 1, y: 1, z: 1 }),
|
|
1549
|
+
C.FromEulerVector(
|
|
1550
|
+
O(t || { x: 0, y: 0, z: 0 })
|
|
1551
|
+
),
|
|
1552
|
+
O(e || { x: 0, y: 0, z: 0 })
|
|
1553
|
+
), r = se.RotationAxis(g.Up(), Math.PI), s = a.multiply(r), o = g.Zero(), l = C.Identity(), c = g.Zero();
|
|
1554
|
+
return s.decompose(c, l, o), l.multiplyInPlace(C.FromEulerAngles(0, Math.PI, 0)), {
|
|
1555
|
+
position: T(o),
|
|
1556
|
+
rotation: T(l.toEulerAngles()),
|
|
1557
|
+
scale: T(c)
|
|
1566
1558
|
};
|
|
1567
1559
|
}
|
|
1568
|
-
triggerModelLoadEvent(e) {
|
|
1569
|
-
this.modelLoadEventCallbacks.forEach((t) => t(e));
|
|
1570
|
-
}
|
|
1571
1560
|
handleMaterialProgressCallback(e, t, i) {
|
|
1572
1561
|
this.loadProgress.set(`key_${i}`, e / t * 100), this.notifyLoadHandlers();
|
|
1573
1562
|
}
|
|
@@ -1592,8 +1581,8 @@ class Kt {
|
|
|
1592
1581
|
*/
|
|
1593
1582
|
getLoadListenerEvent() {
|
|
1594
1583
|
const e = Array.from(this.loadProgress.values()).filter(
|
|
1595
|
-
(
|
|
1596
|
-
), i = e.reduce((
|
|
1584
|
+
(a) => a < 100
|
|
1585
|
+
), i = e.reduce((a, r) => a + r, 0) / e.length || 0;
|
|
1597
1586
|
return {
|
|
1598
1587
|
loadValue: e.length === 0 ? 100 : i,
|
|
1599
1588
|
sceneInitialized: this.getSceneInitializationProgress() === 100
|
|
@@ -1608,10 +1597,10 @@ class Kt {
|
|
|
1608
1597
|
}
|
|
1609
1598
|
}
|
|
1610
1599
|
export {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1600
|
+
S as MaterialEffectMode,
|
|
1601
|
+
I as ProductCameraRig,
|
|
1602
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1603
|
+
P as RenderingConfiguration,
|
|
1604
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1616
1605
|
h as renderingPipelineDefaults
|
|
1617
1606
|
};
|