@spiffcommerce/preview 5.3.11-rc.0 → 5.3.11
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.esm.js +332 -285
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { ArcRotateCamera as pe } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
2
|
import { Engine as fe } from "@babylonjs/core/Engines/engine";
|
|
3
|
-
import { NullEngine as
|
|
4
|
-
import { HighlightLayer as
|
|
3
|
+
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
5
|
import { SceneLoader as S } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
6
|
import { CubeTexture as ie } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as p, Quaternion as y, Vector2 as ne, Matrix as se } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
11
|
+
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as Pe } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Ae } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { PBRMaterial as B } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
|
-
import { MirrorTexture as
|
|
16
|
-
import { Color3 as
|
|
17
|
-
import { ReflectionProbe as
|
|
18
|
-
import { GlowLayer as
|
|
15
|
+
import { MirrorTexture as Re } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Te, Vector3 as re, Plane as Ee } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
|
+
import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
|
|
19
19
|
import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
|
|
20
20
|
import { ExecuteCodeAction as ae } from "@babylonjs/core/Actions/directActions";
|
|
21
|
-
import { Mesh as
|
|
22
|
-
import { TransformNode as
|
|
23
|
-
import { GLTFLoaderAnimationStartMode as
|
|
24
|
-
import { DynamicTexture as
|
|
25
|
-
import { Texture as
|
|
21
|
+
import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
|
|
22
|
+
import { TransformNode as Fe } from "@babylonjs/core/Meshes/transformNode";
|
|
23
|
+
import { GLTFLoaderAnimationStartMode as Se } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
24
|
+
import { DynamicTexture as Be } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
25
|
+
import { Texture as De } from "@babylonjs/core/Materials/Textures/texture";
|
|
26
26
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
27
|
-
import { QuadraticEase as
|
|
28
|
-
import { AssetsManager as
|
|
27
|
+
import { QuadraticEase as ke, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
28
|
+
import { AssetsManager as Ve } from "@babylonjs/core/Misc/assetsManager";
|
|
29
29
|
import { ColorCurves as oe } from "@babylonjs/core/Materials/colorCurves";
|
|
30
30
|
import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
|
-
import { DefaultRenderingPipeline as
|
|
31
|
+
import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
32
32
|
import { DepthOfFieldEffectBlurLevel as T } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
33
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
34
34
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
@@ -44,18 +44,18 @@ var I = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan",
|
|
|
44
44
|
class le {
|
|
45
45
|
constructor(e) {
|
|
46
46
|
this.getSceneClearColor = () => {
|
|
47
|
-
var i, s,
|
|
47
|
+
var i, s, r, o;
|
|
48
48
|
const t = (i = this.customOptions) != null && i.transparentBackground || (s = this.customOptions) != null && s.backgroundImage ? 0 : 1;
|
|
49
|
-
if (this.customOptions && ((
|
|
49
|
+
if (this.customOptions && ((r = this.customOptions) != null && r.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
50
50
|
return new b(0, 0, 0, t).toLinearSpace();
|
|
51
51
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
52
|
-
const
|
|
52
|
+
const a = w.FromHexString(
|
|
53
53
|
this.customOptions.backgroundColor
|
|
54
54
|
);
|
|
55
55
|
return new b(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
a.r,
|
|
57
|
+
a.g,
|
|
58
|
+
a.b,
|
|
59
59
|
t
|
|
60
60
|
).toLinearSpace();
|
|
61
61
|
}
|
|
@@ -81,14 +81,14 @@ class le {
|
|
|
81
81
|
* Configuration related to the scene
|
|
82
82
|
*/
|
|
83
83
|
get scene() {
|
|
84
|
-
var e, t, i, s,
|
|
84
|
+
var e, t, i, s, r;
|
|
85
85
|
return {
|
|
86
86
|
clearColor: this.getSceneClearColor(),
|
|
87
87
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
88
88
|
environment: {
|
|
89
89
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
90
90
|
intensity: ((s = this.customOptions) == null ? void 0 : s.environmentIntensity) ?? 1,
|
|
91
|
-
rotationY: (((
|
|
91
|
+
rotationY: (((r = this.customOptions) == null ? void 0 : r.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
92
92
|
// Convert to radians
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -97,7 +97,7 @@ class le {
|
|
|
97
97
|
* Configuration related to the camera used to view and interact with the scene.
|
|
98
98
|
*/
|
|
99
99
|
get camera() {
|
|
100
|
-
var e, t, i, s,
|
|
100
|
+
var e, t, i, s, r, o, a, h, c, l, u, m, g;
|
|
101
101
|
return {
|
|
102
102
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
103
103
|
autoRotation: {
|
|
@@ -106,14 +106,14 @@ class le {
|
|
|
106
106
|
},
|
|
107
107
|
limits: {
|
|
108
108
|
min: {
|
|
109
|
-
alpha: (s = this.customOptions) != null && s.lowerAlphaLimitDeg ? ((
|
|
110
|
-
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((
|
|
111
|
-
radius: (
|
|
109
|
+
alpha: (s = this.customOptions) != null && s.lowerAlphaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
110
|
+
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
111
|
+
radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
|
|
112
112
|
},
|
|
113
113
|
max: {
|
|
114
|
-
alpha: (
|
|
114
|
+
alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((l = this.customOptions) == null ? void 0 : l.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
115
115
|
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
116
|
-
radius: (
|
|
116
|
+
radius: (g = this.customOptions) == null ? void 0 : g.maxZoomOverride
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
};
|
|
@@ -182,7 +182,7 @@ class x {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
const
|
|
185
|
+
const Ge = 128, d = {
|
|
186
186
|
antiAliasing: {
|
|
187
187
|
samples: 4,
|
|
188
188
|
fxaaEnabled: !1
|
|
@@ -255,9 +255,9 @@ class Ne {
|
|
|
255
255
|
e,
|
|
256
256
|
t,
|
|
257
257
|
function(s) {
|
|
258
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
259
|
-
const o = t.extras[
|
|
260
|
-
s.metadata[
|
|
258
|
+
t.extras && Object.keys(t.extras).forEach((r) => {
|
|
259
|
+
const o = t.extras[r];
|
|
260
|
+
s.metadata[r] = o;
|
|
261
261
|
}), i(s);
|
|
262
262
|
}
|
|
263
263
|
);
|
|
@@ -290,7 +290,7 @@ class Ne {
|
|
|
290
290
|
}
|
|
291
291
|
if (e.extras.translucency) {
|
|
292
292
|
const i = t;
|
|
293
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
293
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new Te(
|
|
294
294
|
e.extras.translucencyR,
|
|
295
295
|
e.extras.translucencyG,
|
|
296
296
|
e.extras.translucencyB
|
|
@@ -316,55 +316,55 @@ class Ne {
|
|
|
316
316
|
* @param scene The scene to parse.
|
|
317
317
|
*/
|
|
318
318
|
applyReflections(e) {
|
|
319
|
-
function t(
|
|
319
|
+
function t(r) {
|
|
320
320
|
const o = [];
|
|
321
|
-
return
|
|
322
|
-
|
|
323
|
-
}),
|
|
324
|
-
|
|
321
|
+
return r.transformNodes.forEach((a) => {
|
|
322
|
+
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
323
|
+
}), r.meshes.forEach((a) => {
|
|
324
|
+
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
325
325
|
}), o;
|
|
326
326
|
}
|
|
327
|
-
function i(
|
|
328
|
-
const
|
|
329
|
-
if (!
|
|
327
|
+
function i(r, o = 1) {
|
|
328
|
+
const a = r.material;
|
|
329
|
+
if (!a)
|
|
330
330
|
return;
|
|
331
|
-
const
|
|
331
|
+
const h = new Re(
|
|
332
332
|
"mirror",
|
|
333
333
|
x.getMirrorTextureResolution(),
|
|
334
334
|
e,
|
|
335
335
|
!0
|
|
336
336
|
);
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
337
|
+
h.renderList = t(e);
|
|
338
|
+
const c = r.getVerticesData("normal");
|
|
339
|
+
if (!c)
|
|
340
340
|
throw new Error(
|
|
341
|
-
"Mirror attribute specified on: " +
|
|
341
|
+
"Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
|
|
342
342
|
);
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
new re(
|
|
346
|
-
|
|
347
|
-
).normalize(), m =
|
|
348
|
-
|
|
343
|
+
r.computeWorldMatrix(!0);
|
|
344
|
+
const l = r.getWorldMatrix(), u = re.TransformNormal(
|
|
345
|
+
new re(c[0], c[1], c[2]),
|
|
346
|
+
l
|
|
347
|
+
).normalize(), m = Ee.FromPositionAndNormal(
|
|
348
|
+
r.position,
|
|
349
349
|
u.scale(-1)
|
|
350
350
|
);
|
|
351
|
-
|
|
351
|
+
h.mirrorPlane = m, h.level = o, a.reflectionTexture = h;
|
|
352
352
|
}
|
|
353
|
-
function s(
|
|
354
|
-
const o =
|
|
353
|
+
function s(r) {
|
|
354
|
+
const o = r.material, a = new Oe(
|
|
355
355
|
"probe-" + o.name,
|
|
356
|
-
|
|
356
|
+
Ge,
|
|
357
357
|
e
|
|
358
358
|
);
|
|
359
|
-
|
|
359
|
+
a.attachToMesh(r), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
360
360
|
}
|
|
361
|
-
e.meshes.forEach((
|
|
362
|
-
const o =
|
|
363
|
-
o && (o.mirrorTexture && i(
|
|
361
|
+
e.meshes.forEach((r) => {
|
|
362
|
+
const o = r.metadata;
|
|
363
|
+
o && (o.mirrorTexture && i(r, o.mirrorTexture), o.reflectionProbe && s(r));
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
class
|
|
367
|
+
class _e {
|
|
368
368
|
constructor(e, t) {
|
|
369
369
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
370
370
|
}
|
|
@@ -373,7 +373,7 @@ class Ge {
|
|
|
373
373
|
}
|
|
374
374
|
includeMeshes(e) {
|
|
375
375
|
if (e) {
|
|
376
|
-
this.glowLayer || (this.glowLayer = new
|
|
376
|
+
this.glowLayer || (this.glowLayer = new Le("glow", this.scene), this.glowLayer.intensity = this.intensity);
|
|
377
377
|
for (const t of e)
|
|
378
378
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
379
379
|
}
|
|
@@ -402,41 +402,41 @@ async function be(n, e, t) {
|
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
S.OnPluginActivatedObservable.add((n) => {
|
|
405
|
-
n.name === "gltf" && (n.animationStartMode =
|
|
405
|
+
n.name === "gltf" && (n.animationStartMode = Se.NONE);
|
|
406
406
|
});
|
|
407
|
-
function
|
|
408
|
-
t.forEach((
|
|
409
|
-
const o =
|
|
410
|
-
n.filter((
|
|
407
|
+
function He(n, e, t, i, s = "") {
|
|
408
|
+
t.forEach((r) => {
|
|
409
|
+
const o = r.getID(), a = r.getName(), h = x.getDynamicTextureResolution();
|
|
410
|
+
n.filter((l) => l.name === s + a).forEach((l) => {
|
|
411
411
|
const u = i.get(o), m = !1;
|
|
412
412
|
if (u)
|
|
413
|
-
ce(
|
|
413
|
+
ce(l, u), u.update(m);
|
|
414
414
|
else {
|
|
415
|
-
const
|
|
416
|
-
|
|
415
|
+
const g = Ke(
|
|
416
|
+
a,
|
|
417
417
|
e,
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
h.width,
|
|
419
|
+
h.height
|
|
420
420
|
);
|
|
421
|
-
i.set(o,
|
|
422
|
-
|
|
423
|
-
), ce(
|
|
424
|
-
|
|
421
|
+
i.set(o, g), r.setStaticContext(
|
|
422
|
+
g.getContext()
|
|
423
|
+
), ce(l, g), g.onLoadObservable.addOnce(() => {
|
|
424
|
+
g.update(m);
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
|
-
function
|
|
431
|
-
const s = new
|
|
430
|
+
function Ke(n, e, t, i) {
|
|
431
|
+
const s = new Be(
|
|
432
432
|
n,
|
|
433
433
|
{ width: t, height: i },
|
|
434
434
|
e,
|
|
435
435
|
x.shouldMipMap(),
|
|
436
|
-
|
|
436
|
+
De.TRILINEAR_SAMPLINGMODE,
|
|
437
437
|
fe.TEXTUREFORMAT_RGBA
|
|
438
|
-
),
|
|
439
|
-
return
|
|
438
|
+
), r = s.getContext();
|
|
439
|
+
return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), s.update()), s;
|
|
440
440
|
}
|
|
441
441
|
function ce(n, e) {
|
|
442
442
|
if (n instanceof B) {
|
|
@@ -447,7 +447,7 @@ function ce(n, e) {
|
|
|
447
447
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function Ue() {
|
|
451
451
|
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
452
452
|
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
453
453
|
}
|
|
@@ -455,49 +455,44 @@ const M = 60, de = 1;
|
|
|
455
455
|
function ue(n) {
|
|
456
456
|
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
const o = s ? n.filter((
|
|
458
|
+
function ve(n, e, t, i, s, r) {
|
|
459
|
+
const o = s ? n.filter((l) => l.name === s) : n;
|
|
460
460
|
if (o.length === 0) {
|
|
461
461
|
console.warn(`No animations found for name: ${s}`);
|
|
462
462
|
return;
|
|
463
463
|
}
|
|
464
|
-
let
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}) :
|
|
471
|
-
|
|
464
|
+
let a = 0;
|
|
465
|
+
const h = () => {
|
|
466
|
+
a++, a === o.length && r && r();
|
|
467
|
+
}, c = (l, u, m, g, f) => {
|
|
468
|
+
l.stop(), l.start(u, m, g, f), r && (u == !1 || u === void 0 && !l.loopAnimation ? l.onAnimationGroupEndObservable.addOnce(() => {
|
|
469
|
+
h();
|
|
470
|
+
}) : l.onAnimationLoopObservable.addOnce(() => {
|
|
471
|
+
h();
|
|
472
472
|
}));
|
|
473
473
|
};
|
|
474
474
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
475
|
-
o.forEach((
|
|
476
|
-
const u = ue(
|
|
477
|
-
|
|
475
|
+
o.forEach((l) => {
|
|
476
|
+
const u = ue(l), m = i * u;
|
|
477
|
+
c(l, !1, de, m, m);
|
|
478
478
|
});
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
|
-
o.forEach((
|
|
482
|
-
const u = ue(
|
|
483
|
-
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
function We(n) {
|
|
487
|
-
n.forEach((e) => {
|
|
488
|
-
e.reset(), e.stop();
|
|
481
|
+
o.forEach((l) => {
|
|
482
|
+
const u = ue(l), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
|
|
483
|
+
c(l, e, de, m, g);
|
|
489
484
|
});
|
|
490
485
|
}
|
|
491
|
-
function
|
|
486
|
+
function We(n, e, t) {
|
|
492
487
|
return new Promise((i) => {
|
|
493
|
-
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
494
|
-
const s = [],
|
|
488
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
|
|
489
|
+
const s = [], r = t.target, o = 0, a = r ? 1 : 0;
|
|
495
490
|
if (t.target && Object.keys(t.target).length > 0 && s.push(
|
|
496
491
|
A(
|
|
497
492
|
"cameraTargetLerp",
|
|
498
493
|
"target",
|
|
499
|
-
new
|
|
500
|
-
new
|
|
494
|
+
new p().copyFrom(e.target),
|
|
495
|
+
new p(
|
|
501
496
|
t.target.x,
|
|
502
497
|
t.target.y,
|
|
503
498
|
t.target.z
|
|
@@ -512,7 +507,7 @@ function Ye(n, e, t) {
|
|
|
512
507
|
e.alpha,
|
|
513
508
|
me(t.lonDeg),
|
|
514
509
|
v.ANIMATIONTYPE_FLOAT,
|
|
515
|
-
|
|
510
|
+
a
|
|
516
511
|
)
|
|
517
512
|
), s.push(
|
|
518
513
|
A(
|
|
@@ -521,31 +516,31 @@ function Ye(n, e, t) {
|
|
|
521
516
|
e.beta,
|
|
522
517
|
me(t.latDeg),
|
|
523
518
|
v.ANIMATIONTYPE_FLOAT,
|
|
524
|
-
|
|
519
|
+
a
|
|
525
520
|
)
|
|
526
521
|
), t.radius !== void 0) {
|
|
527
|
-
const
|
|
522
|
+
const l = Math.max(0.01, t.radius);
|
|
528
523
|
s.push(
|
|
529
524
|
A(
|
|
530
525
|
"cameraRadiusLerp",
|
|
531
526
|
"radius",
|
|
532
527
|
e.radius,
|
|
533
|
-
|
|
528
|
+
l,
|
|
534
529
|
v.ANIMATIONTYPE_FLOAT,
|
|
535
|
-
|
|
530
|
+
a
|
|
536
531
|
)
|
|
537
532
|
);
|
|
538
533
|
}
|
|
539
534
|
e.animations.push(...s);
|
|
540
|
-
const
|
|
535
|
+
const c = e.useAutoRotationBehavior;
|
|
541
536
|
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
542
537
|
e,
|
|
543
538
|
0,
|
|
544
|
-
|
|
539
|
+
r ? M * 2 : M,
|
|
545
540
|
!1,
|
|
546
541
|
1,
|
|
547
542
|
() => {
|
|
548
|
-
e.animations = [],
|
|
543
|
+
e.animations = [], c && e.enableAutoRotationBehavior(), i();
|
|
549
544
|
}
|
|
550
545
|
);
|
|
551
546
|
});
|
|
@@ -553,24 +548,29 @@ function Ye(n, e, t) {
|
|
|
553
548
|
function me(n) {
|
|
554
549
|
return n * Math.PI / 180;
|
|
555
550
|
}
|
|
556
|
-
function A(n, e, t, i, s,
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
const
|
|
551
|
+
function A(n, e, t, i, s, r = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
552
|
+
const a = new ke();
|
|
553
|
+
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
554
|
+
const h = new v(
|
|
560
555
|
n,
|
|
561
556
|
e,
|
|
562
557
|
M,
|
|
563
558
|
s,
|
|
564
559
|
o
|
|
565
|
-
),
|
|
566
|
-
return
|
|
567
|
-
frame: M * (
|
|
560
|
+
), c = [];
|
|
561
|
+
return r > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * r, value: t }), c.push({
|
|
562
|
+
frame: M * (r + 1),
|
|
568
563
|
value: i
|
|
569
|
-
}),
|
|
564
|
+
}), h.setKeys(c), h.setEasingFunction(a), h;
|
|
570
565
|
}
|
|
571
|
-
function
|
|
566
|
+
function Ye(n, e, t) {
|
|
572
567
|
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
573
568
|
}
|
|
569
|
+
function Qe(n, e) {
|
|
570
|
+
n.forEach((t) => {
|
|
571
|
+
t.goToFrame(e);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
574
|
const Ze = {
|
|
575
575
|
albedoTexture: "albedoMap",
|
|
576
576
|
bumpTexture: "normalMap",
|
|
@@ -591,9 +591,9 @@ function $e(n, e, t, i) {
|
|
|
591
591
|
"metallicTexture",
|
|
592
592
|
"refractionTexture",
|
|
593
593
|
"reflectionTexture"
|
|
594
|
-
].forEach((
|
|
594
|
+
].forEach((r) => {
|
|
595
595
|
je(
|
|
596
|
-
|
|
596
|
+
r,
|
|
597
597
|
n,
|
|
598
598
|
e,
|
|
599
599
|
t,
|
|
@@ -602,25 +602,25 @@ function $e(n, e, t, i) {
|
|
|
602
602
|
}), et(n, e);
|
|
603
603
|
}
|
|
604
604
|
function je(n, e, t, i, s) {
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
605
|
+
const r = Ze[n];
|
|
606
|
+
if (!r)
|
|
607
607
|
throw new Error("Unexpected texture name encountered.");
|
|
608
|
-
const o = e[
|
|
609
|
-
|
|
608
|
+
const o = e[r], a = o == null ? void 0 : o.fileLink;
|
|
609
|
+
a ? n === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
610
610
|
n,
|
|
611
|
-
|
|
611
|
+
a,
|
|
612
612
|
void 0,
|
|
613
613
|
!1,
|
|
614
614
|
void 0,
|
|
615
615
|
!0
|
|
616
|
-
) :
|
|
616
|
+
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
617
617
|
n,
|
|
618
|
-
|
|
618
|
+
a,
|
|
619
619
|
128,
|
|
620
620
|
!1,
|
|
621
621
|
!0,
|
|
622
622
|
!1
|
|
623
|
-
) : i.addTextureTask(n,
|
|
623
|
+
) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Xe(n, t));
|
|
624
624
|
}
|
|
625
625
|
function Xe(n, e) {
|
|
626
626
|
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 === "reflectionTexture" && (e.environmentIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0), e.reflectionTexture);
|
|
@@ -649,34 +649,34 @@ class tt {
|
|
|
649
649
|
* where we want to undo changes are remove effects from display.
|
|
650
650
|
*/
|
|
651
651
|
async applyMaterial(e, t, i, s) {
|
|
652
|
-
return new Promise((
|
|
652
|
+
return new Promise((r) => {
|
|
653
653
|
const o = this.materialVariantMap.get(e);
|
|
654
654
|
this.materialVariantMap.set(e, {
|
|
655
655
|
...o,
|
|
656
656
|
...t
|
|
657
657
|
});
|
|
658
|
-
const
|
|
659
|
-
(
|
|
658
|
+
const a = this.renameClonedAsset(e), h = this.scene.materials.filter(
|
|
659
|
+
(l) => l.name === a
|
|
660
660
|
);
|
|
661
|
-
if (
|
|
662
|
-
|
|
661
|
+
if (h.length === 0) {
|
|
662
|
+
r();
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
(
|
|
665
|
+
const c = new Ve(this.scene);
|
|
666
|
+
c.useDefaultLoadingScreen = !1, h.forEach(
|
|
667
|
+
(l) => $e(
|
|
668
668
|
t,
|
|
669
|
-
|
|
670
|
-
|
|
669
|
+
l,
|
|
670
|
+
c,
|
|
671
671
|
s
|
|
672
672
|
)
|
|
673
|
-
),
|
|
674
|
-
i && i(
|
|
675
|
-
},
|
|
676
|
-
|
|
673
|
+
), c.onProgress = (l, u, m) => {
|
|
674
|
+
i && i(l / u * 100, 100, m.name);
|
|
675
|
+
}, c.onFinish = (l) => {
|
|
676
|
+
l.forEach((u) => {
|
|
677
677
|
const m = u;
|
|
678
678
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
679
|
-
(f) => f.name ===
|
|
679
|
+
(f) => f.name === a
|
|
680
680
|
).forEach(
|
|
681
681
|
(f) => Je(
|
|
682
682
|
u.name,
|
|
@@ -685,8 +685,8 @@ class tt {
|
|
|
685
685
|
m.texture
|
|
686
686
|
)
|
|
687
687
|
);
|
|
688
|
-
}),
|
|
689
|
-
},
|
|
688
|
+
}), r();
|
|
689
|
+
}, c.loadAsync();
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
692
|
/**
|
|
@@ -695,22 +695,44 @@ class tt {
|
|
|
695
695
|
* @param replaceProductModel When true, we should replace the base product model.
|
|
696
696
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
697
697
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
698
|
+
* @param lastPlayedAnimation The last played animation, this is used to ensure the animation is played on the new model.
|
|
699
|
+
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
700
|
+
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
698
701
|
*/
|
|
699
|
-
async applyModel(e, t, i, s) {
|
|
700
|
-
var
|
|
702
|
+
async applyModel(e, t, i, s, r, o, a) {
|
|
703
|
+
var u;
|
|
701
704
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
702
|
-
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (
|
|
703
|
-
(
|
|
705
|
+
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (u = this.loadedContainerForKey.get(e)) == null || u.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
706
|
+
(m) => m !== e
|
|
704
707
|
), Promise.resolve(void 0);
|
|
705
|
-
const
|
|
708
|
+
const c = (await be(i, this.scene, s)).instantiateModelsToScene(
|
|
706
709
|
this.renameClonedAsset,
|
|
707
710
|
!0
|
|
708
711
|
);
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
712
|
+
if (this.loadedContainerForKey.has(e)) {
|
|
713
|
+
if (r) {
|
|
714
|
+
const m = o && o();
|
|
715
|
+
if (ve(
|
|
716
|
+
c.animationGroups,
|
|
717
|
+
r.loop,
|
|
718
|
+
r.to,
|
|
719
|
+
r.from,
|
|
720
|
+
r.name
|
|
721
|
+
), m != null) {
|
|
722
|
+
const g = a && a() || !0;
|
|
723
|
+
Qe(
|
|
724
|
+
c.animationGroups,
|
|
725
|
+
m + (g ? 2 : 0)
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e);
|
|
730
|
+
}
|
|
731
|
+
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, we(c));
|
|
732
|
+
const l = [];
|
|
733
|
+
return this.materialVariantMap.forEach(async (m, g) => {
|
|
734
|
+
l.push(this.applyMaterial(g, m));
|
|
735
|
+
}), await Promise.all(l), c;
|
|
714
736
|
}
|
|
715
737
|
dispose() {
|
|
716
738
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -732,13 +754,13 @@ class tt {
|
|
|
732
754
|
}), e;
|
|
733
755
|
}
|
|
734
756
|
}
|
|
735
|
-
function
|
|
757
|
+
function we(n) {
|
|
736
758
|
const e = [];
|
|
737
759
|
return n.rootNodes.forEach((t) => {
|
|
738
760
|
t.getChildMeshes().forEach((i) => {
|
|
739
761
|
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((s) => {
|
|
740
|
-
const
|
|
741
|
-
|
|
762
|
+
const r = s.getMaterial(!1);
|
|
763
|
+
r && !e.includes(r) && e.push(r);
|
|
742
764
|
});
|
|
743
765
|
});
|
|
744
766
|
}), e;
|
|
@@ -758,15 +780,15 @@ class it {
|
|
|
758
780
|
enablePicking: t,
|
|
759
781
|
modelDetails: i,
|
|
760
782
|
previewService: s,
|
|
761
|
-
progressHandler:
|
|
783
|
+
progressHandler: r,
|
|
762
784
|
scene: o
|
|
763
785
|
} = e;
|
|
764
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
786
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = s, this.scene = o, this.variantManager = new tt(
|
|
765
787
|
o,
|
|
766
788
|
this.renameClonedAsset.bind(this),
|
|
767
789
|
this.setBaseModelEnabled.bind(this)
|
|
768
|
-
), this.transformRoot = new
|
|
769
|
-
const
|
|
790
|
+
), this.transformRoot = new Fe("root", this.scene);
|
|
791
|
+
const a = async () => {
|
|
770
792
|
if (!i.model)
|
|
771
793
|
throw new Error(
|
|
772
794
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -774,10 +796,10 @@ class it {
|
|
|
774
796
|
return this.assetContainer = await be(
|
|
775
797
|
i.model,
|
|
776
798
|
o,
|
|
777
|
-
|
|
799
|
+
r
|
|
778
800
|
), await this.instantiate(), this;
|
|
779
801
|
};
|
|
780
|
-
this.importPromise =
|
|
802
|
+
this.importPromise = a();
|
|
781
803
|
}
|
|
782
804
|
//#region Interface implementation
|
|
783
805
|
async applyMaterialVariant(e, t, i, s) {
|
|
@@ -813,15 +835,15 @@ class it {
|
|
|
813
835
|
}
|
|
814
836
|
return;
|
|
815
837
|
}
|
|
816
|
-
const
|
|
838
|
+
const r = async () => {
|
|
817
839
|
await this.variantManager.applyMaterial(
|
|
818
840
|
e,
|
|
819
841
|
i,
|
|
820
|
-
(o,
|
|
842
|
+
(o, a, h) => {
|
|
821
843
|
this.materialVariantObservable.notifyObservers({
|
|
822
844
|
remainingCount: o,
|
|
823
|
-
totalCount:
|
|
824
|
-
taskName:
|
|
845
|
+
totalCount: a,
|
|
846
|
+
taskName: h
|
|
825
847
|
});
|
|
826
848
|
},
|
|
827
849
|
s
|
|
@@ -830,23 +852,23 @@ class it {
|
|
|
830
852
|
if (this.materialChangesInProgress.includes(e)) {
|
|
831
853
|
if (this.queuedMaterialChanges.has(e)) {
|
|
832
854
|
const o = this.queuedMaterialChanges.get(e);
|
|
833
|
-
o == null || o.set(t,
|
|
855
|
+
o == null || o.set(t, r);
|
|
834
856
|
} else {
|
|
835
857
|
this.queuedMaterialChanges.set(
|
|
836
858
|
e,
|
|
837
859
|
/* @__PURE__ */ new Map()
|
|
838
860
|
);
|
|
839
861
|
const o = this.queuedMaterialChanges.get(e);
|
|
840
|
-
o == null || o.set(t,
|
|
862
|
+
o == null || o.set(t, r);
|
|
841
863
|
}
|
|
842
864
|
return;
|
|
843
865
|
}
|
|
844
|
-
if (this.materialChangesInProgress.push(e), await
|
|
866
|
+
if (this.materialChangesInProgress.push(e), await r(), this.queuedMaterialChanges.has(e)) {
|
|
845
867
|
const o = this.queuedMaterialChanges.get(e);
|
|
846
868
|
if (!o)
|
|
847
869
|
throw new Error("Target material is undefined");
|
|
848
|
-
o.forEach(async (
|
|
849
|
-
await
|
|
870
|
+
o.forEach(async (a) => {
|
|
871
|
+
await a();
|
|
850
872
|
}), this.queuedMaterialChanges.delete(e);
|
|
851
873
|
}
|
|
852
874
|
this.materialChangesInProgress.splice(
|
|
@@ -871,12 +893,15 @@ class it {
|
|
|
871
893
|
e,
|
|
872
894
|
i,
|
|
873
895
|
t == null ? void 0 : t.model,
|
|
874
|
-
(
|
|
896
|
+
(a) => {
|
|
875
897
|
this.modelVariantObservable.notifyObservers({
|
|
876
|
-
...
|
|
898
|
+
...a,
|
|
877
899
|
key: e
|
|
878
900
|
});
|
|
879
|
-
}
|
|
901
|
+
},
|
|
902
|
+
this.lastPlayedAnimation,
|
|
903
|
+
this.getCurrentAnimationFrame.bind(this),
|
|
904
|
+
this.getAnimationIsPlaying.bind(this)
|
|
880
905
|
);
|
|
881
906
|
if (this.modelChangesInProgress.includes(e)) {
|
|
882
907
|
this.queuedModelChanges.set(e, s);
|
|
@@ -884,19 +909,19 @@ class it {
|
|
|
884
909
|
}
|
|
885
910
|
const o = await (async () => {
|
|
886
911
|
this.modelChangesInProgress.push(e);
|
|
887
|
-
let
|
|
912
|
+
let a = await s();
|
|
888
913
|
if (this.queuedModelChanges.has(e)) {
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
914
|
+
const h = this.queuedModelChanges.get(e);
|
|
915
|
+
if (!h)
|
|
891
916
|
throw new Error("Queued change resolved undefined");
|
|
892
|
-
|
|
917
|
+
a = await h(), this.queuedModelChanges.delete(e);
|
|
893
918
|
}
|
|
894
919
|
return this.modelChangesInProgress.splice(
|
|
895
920
|
this.modelChangesInProgress.indexOf(e),
|
|
896
921
|
1
|
|
897
|
-
),
|
|
922
|
+
), a;
|
|
898
923
|
})();
|
|
899
|
-
this.
|
|
924
|
+
this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
900
925
|
}
|
|
901
926
|
dispose() {
|
|
902
927
|
var e;
|
|
@@ -905,17 +930,17 @@ class it {
|
|
|
905
930
|
executeAnimation(e) {
|
|
906
931
|
if (!this.initialized)
|
|
907
932
|
return this.queuedModelAnimation = e, Promise.resolve();
|
|
908
|
-
if (!this.modelInstance)
|
|
909
|
-
return Promise.resolve();
|
|
910
933
|
let t = () => {
|
|
911
934
|
};
|
|
912
935
|
const i = async () => {
|
|
913
|
-
this.isExecutingAnimation = !0, await new Promise((s) => {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
936
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((s) => {
|
|
937
|
+
var o;
|
|
938
|
+
const r = [
|
|
939
|
+
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
940
|
+
...this.variantManager.getAnimationGroups()
|
|
941
|
+
];
|
|
942
|
+
ve(
|
|
943
|
+
r,
|
|
919
944
|
e.loop,
|
|
920
945
|
e.to,
|
|
921
946
|
e.from,
|
|
@@ -970,7 +995,7 @@ class it {
|
|
|
970
995
|
set position(e) {
|
|
971
996
|
if (!this.transformRoot)
|
|
972
997
|
throw new Error("ModelContainer disposed prior to setting position!");
|
|
973
|
-
this.transformRoot.position = new
|
|
998
|
+
this.transformRoot.position = new p(e.x, e.y, e.z);
|
|
974
999
|
}
|
|
975
1000
|
get rotation() {
|
|
976
1001
|
var e;
|
|
@@ -995,7 +1020,7 @@ class it {
|
|
|
995
1020
|
set scale(e) {
|
|
996
1021
|
if (!this.transformRoot)
|
|
997
1022
|
throw new Error("ModelContainer disposed prior to setting scale!");
|
|
998
|
-
this.transformRoot.scaling = new
|
|
1023
|
+
this.transformRoot.scaling = new p(e.x, e.y, e.z);
|
|
999
1024
|
}
|
|
1000
1025
|
//#endregion
|
|
1001
1026
|
//#region Custom implementation functions
|
|
@@ -1043,16 +1068,16 @@ class it {
|
|
|
1043
1068
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1044
1069
|
}
|
|
1045
1070
|
configureModelInstance(e) {
|
|
1046
|
-
var
|
|
1071
|
+
var r;
|
|
1047
1072
|
if (!this.transformRoot)
|
|
1048
1073
|
throw new Error(
|
|
1049
1074
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1050
1075
|
);
|
|
1051
1076
|
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, s = this.transformRoot.scaling;
|
|
1052
|
-
this.transformRoot.position =
|
|
1077
|
+
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1053
1078
|
for (const o of e.rootNodes)
|
|
1054
1079
|
o.parent = this.transformRoot;
|
|
1055
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((
|
|
1080
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1056
1081
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1057
1082
|
this.scene,
|
|
1058
1083
|
this.canvasPanels,
|
|
@@ -1070,7 +1095,7 @@ class it {
|
|
|
1070
1095
|
getAllMeshes() {
|
|
1071
1096
|
var e;
|
|
1072
1097
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1073
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1098
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
1074
1099
|
).flat();
|
|
1075
1100
|
}
|
|
1076
1101
|
async instantiate() {
|
|
@@ -1081,7 +1106,7 @@ class it {
|
|
|
1081
1106
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
1082
1107
|
this.renameClonedAsset.bind(this),
|
|
1083
1108
|
!0
|
|
1084
|
-
), this.materials =
|
|
1109
|
+
), this.materials = we(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = ge(
|
|
1085
1110
|
this.modelInstance.animationGroups,
|
|
1086
1111
|
this.renameClonedAsset("")
|
|
1087
1112
|
), this.initialized = !0, await this.processQueuedEvents();
|
|
@@ -1115,6 +1140,28 @@ class it {
|
|
|
1115
1140
|
this.modelVariantObservable.removeCallback(e);
|
|
1116
1141
|
}
|
|
1117
1142
|
//#endregion
|
|
1143
|
+
getCurrentAnimationFrame() {
|
|
1144
|
+
var t;
|
|
1145
|
+
const e = [
|
|
1146
|
+
...((t = this.modelInstance) == null ? void 0 : t.animationGroups) || [],
|
|
1147
|
+
...this.variantManager.getAnimationGroups()
|
|
1148
|
+
];
|
|
1149
|
+
for (const i of e)
|
|
1150
|
+
if (i.animatables.length > 0 && i.animatables[0].masterFrame !== void 0 && i.animatables[0].masterFrame !== null)
|
|
1151
|
+
return i.animatables[0].masterFrame;
|
|
1152
|
+
return 0;
|
|
1153
|
+
}
|
|
1154
|
+
getAnimationIsPlaying() {
|
|
1155
|
+
var t;
|
|
1156
|
+
const e = [
|
|
1157
|
+
...((t = this.modelInstance) == null ? void 0 : t.animationGroups) || [],
|
|
1158
|
+
...this.variantManager.getAnimationGroups()
|
|
1159
|
+
];
|
|
1160
|
+
for (const i of e)
|
|
1161
|
+
if (i.isPlaying)
|
|
1162
|
+
return !0;
|
|
1163
|
+
return !1;
|
|
1164
|
+
}
|
|
1118
1165
|
stripIdFromName(e) {
|
|
1119
1166
|
return e.substring(this.id.length + 1);
|
|
1120
1167
|
}
|
|
@@ -1134,17 +1181,17 @@ class it {
|
|
|
1134
1181
|
//#endregion
|
|
1135
1182
|
}
|
|
1136
1183
|
class D extends pe {
|
|
1137
|
-
constructor(e, t, i, s,
|
|
1184
|
+
constructor(e, t, i, s, r, o, a, h) {
|
|
1138
1185
|
super(
|
|
1139
1186
|
e,
|
|
1140
1187
|
t,
|
|
1141
1188
|
i,
|
|
1142
1189
|
s,
|
|
1143
|
-
|
|
1190
|
+
r,
|
|
1144
1191
|
o,
|
|
1145
|
-
|
|
1146
|
-
), this.lastFocus = new
|
|
1147
|
-
|
|
1192
|
+
h
|
|
1193
|
+
), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, a.camera.autoOrientation && (this.alpha += Math.PI), a && (a.camera.limits.min.beta && (this.lowerBetaLimit = a.camera.limits.min.beta), a.camera.limits.max.beta && (this.upperBetaLimit = a.camera.limits.max.beta), a.camera.limits.min.alpha && (this.lowerAlphaLimit = a.camera.limits.min.alpha), a.camera.limits.max.alpha && (this.upperAlphaLimit = a.camera.limits.max.alpha), a.camera.limits.min.radius && (this.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.upperRadiusLimit = a.camera.limits.max.radius), a.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1194
|
+
a.camera.autoRotation.idleTimeMs
|
|
1148
1195
|
));
|
|
1149
1196
|
}
|
|
1150
1197
|
get isRunningFramingBehavior() {
|
|
@@ -1190,10 +1237,10 @@ class D extends pe {
|
|
|
1190
1237
|
i.framingTime = t || 800;
|
|
1191
1238
|
const s = () => {
|
|
1192
1239
|
this.isRunningFramingBehavior = !1;
|
|
1193
|
-
},
|
|
1194
|
-
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(
|
|
1195
|
-
|
|
1196
|
-
|
|
1240
|
+
}, r = E(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
|
|
1241
|
+
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(a), this.panDenominator = o.length(), this.lastFocus.copyFrom(a), i.zoomOnBoundingInfo(
|
|
1242
|
+
r.min,
|
|
1243
|
+
r.max,
|
|
1197
1244
|
void 0,
|
|
1198
1245
|
s
|
|
1199
1246
|
), i.framingTime = 0;
|
|
@@ -1225,39 +1272,39 @@ class D extends pe {
|
|
|
1225
1272
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1226
1273
|
*/
|
|
1227
1274
|
static create(e, t, i) {
|
|
1228
|
-
const s = E(e),
|
|
1275
|
+
const s = E(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new D(
|
|
1229
1276
|
"ProductCamera",
|
|
1230
1277
|
-(Math.PI / 2),
|
|
1231
1278
|
Math.PI / 2,
|
|
1232
|
-
|
|
1279
|
+
r.length() * 1.5,
|
|
1233
1280
|
o,
|
|
1234
1281
|
e,
|
|
1235
1282
|
t
|
|
1236
1283
|
);
|
|
1237
|
-
return
|
|
1238
|
-
|
|
1239
|
-
}), i && (e.activeCamera =
|
|
1284
|
+
return a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = r.length(), a.onAfterCheckInputsObservable.add(() => {
|
|
1285
|
+
a.panningSensibility = 1e3 / a.panDenominator;
|
|
1286
|
+
}), i && (e.activeCamera = a), a;
|
|
1240
1287
|
}
|
|
1241
1288
|
}
|
|
1242
1289
|
function E(n) {
|
|
1243
1290
|
if (n.meshes.length === 0)
|
|
1244
1291
|
return {
|
|
1245
|
-
min: new
|
|
1246
|
-
max: new
|
|
1292
|
+
min: new p(-1, -1, -1),
|
|
1293
|
+
max: new p(1, 1, 1)
|
|
1247
1294
|
};
|
|
1248
1295
|
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1249
1296
|
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1250
1297
|
}
|
|
1251
1298
|
class nt {
|
|
1252
1299
|
constructor(e, t = !1, i = void 0) {
|
|
1253
|
-
this.renderingPipeline = new
|
|
1300
|
+
this.renderingPipeline = new qe(
|
|
1254
1301
|
"default",
|
|
1255
1302
|
t,
|
|
1256
1303
|
e,
|
|
1257
1304
|
i ? [i] : void 0,
|
|
1258
1305
|
!1
|
|
1259
1306
|
// Disable automatic build
|
|
1260
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1307
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(d));
|
|
1261
1308
|
}
|
|
1262
1309
|
dispose() {
|
|
1263
1310
|
this.renderingPipeline.dispose();
|
|
@@ -1266,16 +1313,16 @@ class nt {
|
|
|
1266
1313
|
return this.currentConfiguration;
|
|
1267
1314
|
}
|
|
1268
1315
|
setConfiguration(e) {
|
|
1269
|
-
var t, i, s,
|
|
1316
|
+
var t, i, s, r, o, a, h, c, l, u, m, g, f, k, z, V, q, G, N, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te;
|
|
1270
1317
|
if (this.renderingPipeline.isSupported) {
|
|
1271
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ??
|
|
1318
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((s = e.bloom) == null ? void 0 : s.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((h = e.bloom) == null ? void 0 : h.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((l = e.chromaticAberration) == null ? void 0 : l.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ne(
|
|
1272
1319
|
e.chromaticAberration.direction.x,
|
|
1273
1320
|
e.chromaticAberration.direction.y
|
|
1274
1321
|
) : new ne(
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((
|
|
1278
|
-
switch (e.depthOfField.blurLevel ??
|
|
1322
|
+
d.chromaticAberration.direction.x,
|
|
1323
|
+
d.chromaticAberration.direction.y
|
|
1324
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new oe(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
|
|
1325
|
+
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1279
1326
|
case "Low":
|
|
1280
1327
|
this.renderingPipeline.depthOfFieldBlurLevel = T.Low;
|
|
1281
1328
|
break;
|
|
@@ -1286,8 +1333,8 @@ class nt {
|
|
|
1286
1333
|
this.renderingPipeline.depthOfFieldBlurLevel = T.High;
|
|
1287
1334
|
break;
|
|
1288
1335
|
}
|
|
1289
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((k = e.depthOfField) == null ? void 0 : k.focalLength) ??
|
|
1290
|
-
switch (e.misc.toneMappingType ??
|
|
1336
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((k = e.depthOfField) == null ? void 0 : k.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((q = e.depthOfField) == null ? void 0 : q.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((N = e.grain) == null ? void 0 : N.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1337
|
+
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1291
1338
|
case "Standard":
|
|
1292
1339
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1293
1340
|
break;
|
|
@@ -1295,8 +1342,8 @@ class nt {
|
|
|
1295
1342
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1296
1343
|
break;
|
|
1297
1344
|
}
|
|
1298
|
-
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ??
|
|
1299
|
-
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ??
|
|
1345
|
+
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? d.vignette.enabled, ($ = e.vignette) != null && $.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
|
|
1346
|
+
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? d.vignette.blendMode) {
|
|
1300
1347
|
case "Multiply":
|
|
1301
1348
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1302
1349
|
break;
|
|
@@ -1310,11 +1357,11 @@ class nt {
|
|
|
1310
1357
|
e.vignette.colorRgba.b,
|
|
1311
1358
|
e.vignette.colorRgba.a
|
|
1312
1359
|
) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ??
|
|
1360
|
+
d.vignette.colorRgba.r,
|
|
1361
|
+
d.vignette.colorRgba.g,
|
|
1362
|
+
d.vignette.colorRgba.b,
|
|
1363
|
+
d.vignette.colorRgba.a
|
|
1364
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1318
1365
|
}
|
|
1319
1366
|
}
|
|
1320
1367
|
updateColorCurve(e) {
|
|
@@ -1322,7 +1369,7 @@ class nt {
|
|
|
1322
1369
|
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;
|
|
1323
1370
|
}
|
|
1324
1371
|
}
|
|
1325
|
-
|
|
1372
|
+
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1326
1373
|
return new Ne(n);
|
|
1327
1374
|
});
|
|
1328
1375
|
S.OnPluginActivatedObservable.add((n) => {
|
|
@@ -1332,35 +1379,35 @@ S.OnPluginActivatedObservable.add((n) => {
|
|
|
1332
1379
|
}
|
|
1333
1380
|
});
|
|
1334
1381
|
function O(n) {
|
|
1335
|
-
return new
|
|
1382
|
+
return new p(n.x, n.y, n.z);
|
|
1336
1383
|
}
|
|
1337
1384
|
function L(n) {
|
|
1338
1385
|
return { x: n.x, y: n.y, z: n.z };
|
|
1339
1386
|
}
|
|
1340
1387
|
class Wt {
|
|
1341
1388
|
constructor(e) {
|
|
1342
|
-
var
|
|
1389
|
+
var h;
|
|
1343
1390
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1344
1391
|
if (!this.engine.views)
|
|
1345
1392
|
return;
|
|
1346
|
-
this.modelContainers.forEach((
|
|
1347
|
-
|
|
1393
|
+
this.modelContainers.forEach((l) => {
|
|
1394
|
+
l.updateDynamicTextures();
|
|
1348
1395
|
}), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1349
|
-
const
|
|
1350
|
-
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus,
|
|
1396
|
+
const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
|
|
1397
|
+
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
|
|
1351
1398
|
}, this.configuration = new le(e);
|
|
1352
1399
|
const i = (() => {
|
|
1353
1400
|
if (!(e != null && e.noRender))
|
|
1354
1401
|
return this.configuration.createCanvas();
|
|
1355
1402
|
})(), s = "1.5.6";
|
|
1356
|
-
|
|
1403
|
+
Me.Configuration = {
|
|
1357
1404
|
decoder: {
|
|
1358
1405
|
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_wasm_wrapper_gltf.js`,
|
|
1359
1406
|
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.wasm`,
|
|
1360
1407
|
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.js`
|
|
1361
1408
|
}
|
|
1362
1409
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1363
|
-
const
|
|
1410
|
+
const r = console.log;
|
|
1364
1411
|
console.log = () => {
|
|
1365
1412
|
};
|
|
1366
1413
|
const o = i ? new fe(i, !0, {
|
|
@@ -1371,24 +1418,24 @@ class Wt {
|
|
|
1371
1418
|
audioEngine: !1,
|
|
1372
1419
|
stencil: this.configuration.highlights.enabled,
|
|
1373
1420
|
forceSRGBBufferSupportState: !0
|
|
1374
|
-
}) : new
|
|
1375
|
-
console.log =
|
|
1421
|
+
}) : new Ce();
|
|
1422
|
+
console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Pe(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = D.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1376
1423
|
this.scene,
|
|
1377
1424
|
!1,
|
|
1378
1425
|
this.camera
|
|
1379
1426
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1380
|
-
const
|
|
1427
|
+
const a = ie.CreateFromPrefilteredData(
|
|
1381
1428
|
this.configuration.scene.environment.file,
|
|
1382
1429
|
this.scene
|
|
1383
1430
|
);
|
|
1384
|
-
|
|
1431
|
+
a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (h = this.configuration.options) != null && h.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1385
1432
|
this.configuration.options.renderingPipelineConfiguration
|
|
1386
|
-
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new
|
|
1433
|
+
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
|
|
1387
1434
|
this.scene,
|
|
1388
1435
|
this.configuration.emissiveGlowIntensity
|
|
1389
|
-
), this.initPromise = new Promise((
|
|
1436
|
+
), this.initPromise = new Promise((c) => {
|
|
1390
1437
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1391
|
-
this.initComplete = !0,
|
|
1438
|
+
this.initComplete = !0, c();
|
|
1392
1439
|
});
|
|
1393
1440
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1394
1441
|
}
|
|
@@ -1438,7 +1485,7 @@ class Wt {
|
|
|
1438
1485
|
let t = () => {
|
|
1439
1486
|
};
|
|
1440
1487
|
const i = async () => {
|
|
1441
|
-
this.isAnimatingCamera = !0, await
|
|
1488
|
+
this.isAnimatingCamera = !0, await We(
|
|
1442
1489
|
this.scene,
|
|
1443
1490
|
this.scene.activeCamera,
|
|
1444
1491
|
e
|
|
@@ -1462,7 +1509,7 @@ class Wt {
|
|
|
1462
1509
|
};
|
|
1463
1510
|
}
|
|
1464
1511
|
setCameraPose(e) {
|
|
1465
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1512
|
+
this.scene && this.camera && (this.camera.target = new p(
|
|
1466
1513
|
e.target.x,
|
|
1467
1514
|
e.target.y,
|
|
1468
1515
|
e.target.z
|
|
@@ -1483,9 +1530,9 @@ class Wt {
|
|
|
1483
1530
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1484
1531
|
this.focusLostNotified = !1;
|
|
1485
1532
|
const s = () => {
|
|
1486
|
-
const
|
|
1533
|
+
const r = this.configuration;
|
|
1487
1534
|
this.camera.rerunFramingBehavior(() => {
|
|
1488
|
-
|
|
1535
|
+
r.camera.limits.min.radius && (this.camera.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.camera.upperRadiusLimit = r.camera.limits.max.radius), i();
|
|
1489
1536
|
});
|
|
1490
1537
|
};
|
|
1491
1538
|
this.scene.onAfterRenderObservable.addOnce(s);
|
|
@@ -1511,13 +1558,13 @@ class Wt {
|
|
|
1511
1558
|
0,
|
|
1512
1559
|
0,
|
|
1513
1560
|
0,
|
|
1514
|
-
|
|
1561
|
+
p.Zero(),
|
|
1515
1562
|
this.scene
|
|
1516
1563
|
);
|
|
1517
1564
|
try {
|
|
1518
|
-
const s = t.latDeg * Math.PI / 180,
|
|
1519
|
-
i.target = t.target ? new
|
|
1520
|
-
const o = await
|
|
1565
|
+
const s = t.latDeg * Math.PI / 180, r = t.lonDeg * Math.PI / 180;
|
|
1566
|
+
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = r, i.beta = s, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1567
|
+
const o = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1521
1568
|
this.engine,
|
|
1522
1569
|
i,
|
|
1523
1570
|
e,
|
|
@@ -1534,32 +1581,32 @@ class Wt {
|
|
|
1534
1581
|
const e = this.configuration;
|
|
1535
1582
|
if (!e)
|
|
1536
1583
|
return !0;
|
|
1537
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, s = e.camera.limits.min.beta,
|
|
1538
|
-
if (t === void 0 || i === void 0 || s === void 0 ||
|
|
1584
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, s = e.camera.limits.min.beta, r = e.camera.limits.max.beta;
|
|
1585
|
+
if (t === void 0 || i === void 0 || s === void 0 || r === void 0)
|
|
1539
1586
|
return !0;
|
|
1540
|
-
const o = [t, i],
|
|
1541
|
-
return !
|
|
1587
|
+
const o = [t, i], a = [s, r], h = o.every((l) => l === t), c = a.every((l) => l === s);
|
|
1588
|
+
return !h && !c;
|
|
1542
1589
|
}
|
|
1543
1590
|
fireResizeEvent() {
|
|
1544
1591
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1545
1592
|
}
|
|
1546
1593
|
setHighlights(e, t) {
|
|
1547
1594
|
var s;
|
|
1548
|
-
e.length === 0 && ((s = this.highlightLayer) == null || s.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new
|
|
1595
|
+
e.length === 0 && ((s = this.highlightLayer) == null || s.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1549
1596
|
isStroke: !0,
|
|
1550
1597
|
blurVerticalSize: 0.85,
|
|
1551
1598
|
blurHorizontalSize: 0.85
|
|
1552
1599
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1553
1600
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1554
|
-
e.forEach((
|
|
1601
|
+
e.forEach((r) => {
|
|
1555
1602
|
const o = this.scene.materials.find(
|
|
1556
|
-
(
|
|
1603
|
+
(a) => a.name === r.name && a.id === r.id
|
|
1557
1604
|
);
|
|
1558
1605
|
o && o.getBindedMeshes().forEach(
|
|
1559
|
-
(
|
|
1560
|
-
var
|
|
1561
|
-
return (
|
|
1562
|
-
|
|
1606
|
+
(a) => {
|
|
1607
|
+
var h;
|
|
1608
|
+
return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
|
|
1609
|
+
a,
|
|
1563
1610
|
i || w.FromHexString("#fcba03")
|
|
1564
1611
|
);
|
|
1565
1612
|
}
|
|
@@ -1631,11 +1678,11 @@ class Wt {
|
|
|
1631
1678
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1632
1679
|
),
|
|
1633
1680
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1634
|
-
),
|
|
1635
|
-
return o.decompose(
|
|
1636
|
-
position: L(
|
|
1637
|
-
rotation: L(
|
|
1638
|
-
scale: L(
|
|
1681
|
+
), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), h = y.Identity(), c = p.Zero();
|
|
1682
|
+
return o.decompose(c, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1683
|
+
position: L(a),
|
|
1684
|
+
rotation: L(h.toEulerAngles()),
|
|
1685
|
+
scale: L(c)
|
|
1639
1686
|
};
|
|
1640
1687
|
}
|
|
1641
1688
|
updatePreviewOptions(e) {
|
|
@@ -1657,7 +1704,7 @@ class Wt {
|
|
|
1657
1704
|
*/
|
|
1658
1705
|
reattachControls(e, t = 2) {
|
|
1659
1706
|
if (this.scene.detachControl(), this.engine.inputElement = e, this.camera) {
|
|
1660
|
-
this.camera.attachControl(!
|
|
1707
|
+
this.camera.attachControl(!0, !1, t);
|
|
1661
1708
|
const i = this.camera.inputs.attached.pointers;
|
|
1662
1709
|
i.multiTouchPanning = !1;
|
|
1663
1710
|
}
|
|
@@ -1667,8 +1714,8 @@ class Wt {
|
|
|
1667
1714
|
export {
|
|
1668
1715
|
F as MaterialEffectMode,
|
|
1669
1716
|
I as ProductCameraRig,
|
|
1670
|
-
|
|
1717
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1671
1718
|
x as RenderingConfiguration,
|
|
1672
1719
|
Wt as SpiffCommerce3DPreviewService,
|
|
1673
|
-
|
|
1720
|
+
d as renderingPipelineDefaults
|
|
1674
1721
|
};
|