@spiffcommerce/preview 5.3.11-rc.0 → 5.3.12-alpha.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.esm.js +329 -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,41 @@ 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
|
-
this.loadedContainerForKey.has(e) && (
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
712
|
+
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), console.log("lastPlayedAnimation", r), r) {
|
|
713
|
+
const m = o && o();
|
|
714
|
+
if (ve(
|
|
715
|
+
c.animationGroups,
|
|
716
|
+
r.loop,
|
|
717
|
+
r.to,
|
|
718
|
+
r.from,
|
|
719
|
+
r.name
|
|
720
|
+
), m != null) {
|
|
721
|
+
const g = a && a() || !0;
|
|
722
|
+
Qe(
|
|
723
|
+
c.animationGroups,
|
|
724
|
+
m + (g ? 2 : 0)
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, we(c));
|
|
729
|
+
const l = [];
|
|
730
|
+
return this.materialVariantMap.forEach(async (m, g) => {
|
|
731
|
+
l.push(this.applyMaterial(g, m));
|
|
732
|
+
}), await Promise.all(l), c;
|
|
714
733
|
}
|
|
715
734
|
dispose() {
|
|
716
735
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -732,13 +751,13 @@ class tt {
|
|
|
732
751
|
}), e;
|
|
733
752
|
}
|
|
734
753
|
}
|
|
735
|
-
function
|
|
754
|
+
function we(n) {
|
|
736
755
|
const e = [];
|
|
737
756
|
return n.rootNodes.forEach((t) => {
|
|
738
757
|
t.getChildMeshes().forEach((i) => {
|
|
739
758
|
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((s) => {
|
|
740
|
-
const
|
|
741
|
-
|
|
759
|
+
const r = s.getMaterial(!1);
|
|
760
|
+
r && !e.includes(r) && e.push(r);
|
|
742
761
|
});
|
|
743
762
|
});
|
|
744
763
|
}), e;
|
|
@@ -758,15 +777,15 @@ class it {
|
|
|
758
777
|
enablePicking: t,
|
|
759
778
|
modelDetails: i,
|
|
760
779
|
previewService: s,
|
|
761
|
-
progressHandler:
|
|
780
|
+
progressHandler: r,
|
|
762
781
|
scene: o
|
|
763
782
|
} = e;
|
|
764
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
783
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = s, this.scene = o, this.variantManager = new tt(
|
|
765
784
|
o,
|
|
766
785
|
this.renameClonedAsset.bind(this),
|
|
767
786
|
this.setBaseModelEnabled.bind(this)
|
|
768
|
-
), this.transformRoot = new
|
|
769
|
-
const
|
|
787
|
+
), this.transformRoot = new Fe("root", this.scene);
|
|
788
|
+
const a = async () => {
|
|
770
789
|
if (!i.model)
|
|
771
790
|
throw new Error(
|
|
772
791
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -774,10 +793,10 @@ class it {
|
|
|
774
793
|
return this.assetContainer = await be(
|
|
775
794
|
i.model,
|
|
776
795
|
o,
|
|
777
|
-
|
|
796
|
+
r
|
|
778
797
|
), await this.instantiate(), this;
|
|
779
798
|
};
|
|
780
|
-
this.importPromise =
|
|
799
|
+
this.importPromise = a();
|
|
781
800
|
}
|
|
782
801
|
//#region Interface implementation
|
|
783
802
|
async applyMaterialVariant(e, t, i, s) {
|
|
@@ -813,15 +832,15 @@ class it {
|
|
|
813
832
|
}
|
|
814
833
|
return;
|
|
815
834
|
}
|
|
816
|
-
const
|
|
835
|
+
const r = async () => {
|
|
817
836
|
await this.variantManager.applyMaterial(
|
|
818
837
|
e,
|
|
819
838
|
i,
|
|
820
|
-
(o,
|
|
839
|
+
(o, a, h) => {
|
|
821
840
|
this.materialVariantObservable.notifyObservers({
|
|
822
841
|
remainingCount: o,
|
|
823
|
-
totalCount:
|
|
824
|
-
taskName:
|
|
842
|
+
totalCount: a,
|
|
843
|
+
taskName: h
|
|
825
844
|
});
|
|
826
845
|
},
|
|
827
846
|
s
|
|
@@ -830,23 +849,23 @@ class it {
|
|
|
830
849
|
if (this.materialChangesInProgress.includes(e)) {
|
|
831
850
|
if (this.queuedMaterialChanges.has(e)) {
|
|
832
851
|
const o = this.queuedMaterialChanges.get(e);
|
|
833
|
-
o == null || o.set(t,
|
|
852
|
+
o == null || o.set(t, r);
|
|
834
853
|
} else {
|
|
835
854
|
this.queuedMaterialChanges.set(
|
|
836
855
|
e,
|
|
837
856
|
/* @__PURE__ */ new Map()
|
|
838
857
|
);
|
|
839
858
|
const o = this.queuedMaterialChanges.get(e);
|
|
840
|
-
o == null || o.set(t,
|
|
859
|
+
o == null || o.set(t, r);
|
|
841
860
|
}
|
|
842
861
|
return;
|
|
843
862
|
}
|
|
844
|
-
if (this.materialChangesInProgress.push(e), await
|
|
863
|
+
if (this.materialChangesInProgress.push(e), await r(), this.queuedMaterialChanges.has(e)) {
|
|
845
864
|
const o = this.queuedMaterialChanges.get(e);
|
|
846
865
|
if (!o)
|
|
847
866
|
throw new Error("Target material is undefined");
|
|
848
|
-
o.forEach(async (
|
|
849
|
-
await
|
|
867
|
+
o.forEach(async (a) => {
|
|
868
|
+
await a();
|
|
850
869
|
}), this.queuedMaterialChanges.delete(e);
|
|
851
870
|
}
|
|
852
871
|
this.materialChangesInProgress.splice(
|
|
@@ -871,12 +890,15 @@ class it {
|
|
|
871
890
|
e,
|
|
872
891
|
i,
|
|
873
892
|
t == null ? void 0 : t.model,
|
|
874
|
-
(
|
|
893
|
+
(a) => {
|
|
875
894
|
this.modelVariantObservable.notifyObservers({
|
|
876
|
-
...
|
|
895
|
+
...a,
|
|
877
896
|
key: e
|
|
878
897
|
});
|
|
879
|
-
}
|
|
898
|
+
},
|
|
899
|
+
this.lastPlayedAnimation,
|
|
900
|
+
this.getCurrentAnimationFrame.bind(this),
|
|
901
|
+
this.getAnimationIsPlaying.bind(this)
|
|
880
902
|
);
|
|
881
903
|
if (this.modelChangesInProgress.includes(e)) {
|
|
882
904
|
this.queuedModelChanges.set(e, s);
|
|
@@ -884,19 +906,19 @@ class it {
|
|
|
884
906
|
}
|
|
885
907
|
const o = await (async () => {
|
|
886
908
|
this.modelChangesInProgress.push(e);
|
|
887
|
-
let
|
|
909
|
+
let a = await s();
|
|
888
910
|
if (this.queuedModelChanges.has(e)) {
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
911
|
+
const h = this.queuedModelChanges.get(e);
|
|
912
|
+
if (!h)
|
|
891
913
|
throw new Error("Queued change resolved undefined");
|
|
892
|
-
|
|
914
|
+
a = await h(), this.queuedModelChanges.delete(e);
|
|
893
915
|
}
|
|
894
916
|
return this.modelChangesInProgress.splice(
|
|
895
917
|
this.modelChangesInProgress.indexOf(e),
|
|
896
918
|
1
|
|
897
|
-
),
|
|
919
|
+
), a;
|
|
898
920
|
})();
|
|
899
|
-
this.
|
|
921
|
+
this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
900
922
|
}
|
|
901
923
|
dispose() {
|
|
902
924
|
var e;
|
|
@@ -905,17 +927,17 @@ class it {
|
|
|
905
927
|
executeAnimation(e) {
|
|
906
928
|
if (!this.initialized)
|
|
907
929
|
return this.queuedModelAnimation = e, Promise.resolve();
|
|
908
|
-
if (!this.modelInstance)
|
|
909
|
-
return Promise.resolve();
|
|
910
930
|
let t = () => {
|
|
911
931
|
};
|
|
912
932
|
const i = async () => {
|
|
913
|
-
this.isExecutingAnimation = !0, await new Promise((s) => {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
933
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((s) => {
|
|
934
|
+
var o;
|
|
935
|
+
const r = [
|
|
936
|
+
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
937
|
+
...this.variantManager.getAnimationGroups()
|
|
938
|
+
];
|
|
939
|
+
ve(
|
|
940
|
+
r,
|
|
919
941
|
e.loop,
|
|
920
942
|
e.to,
|
|
921
943
|
e.from,
|
|
@@ -970,7 +992,7 @@ class it {
|
|
|
970
992
|
set position(e) {
|
|
971
993
|
if (!this.transformRoot)
|
|
972
994
|
throw new Error("ModelContainer disposed prior to setting position!");
|
|
973
|
-
this.transformRoot.position = new
|
|
995
|
+
this.transformRoot.position = new p(e.x, e.y, e.z);
|
|
974
996
|
}
|
|
975
997
|
get rotation() {
|
|
976
998
|
var e;
|
|
@@ -995,7 +1017,7 @@ class it {
|
|
|
995
1017
|
set scale(e) {
|
|
996
1018
|
if (!this.transformRoot)
|
|
997
1019
|
throw new Error("ModelContainer disposed prior to setting scale!");
|
|
998
|
-
this.transformRoot.scaling = new
|
|
1020
|
+
this.transformRoot.scaling = new p(e.x, e.y, e.z);
|
|
999
1021
|
}
|
|
1000
1022
|
//#endregion
|
|
1001
1023
|
//#region Custom implementation functions
|
|
@@ -1043,16 +1065,16 @@ class it {
|
|
|
1043
1065
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1044
1066
|
}
|
|
1045
1067
|
configureModelInstance(e) {
|
|
1046
|
-
var
|
|
1068
|
+
var r;
|
|
1047
1069
|
if (!this.transformRoot)
|
|
1048
1070
|
throw new Error(
|
|
1049
1071
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1050
1072
|
);
|
|
1051
1073
|
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, s = this.transformRoot.scaling;
|
|
1052
|
-
this.transformRoot.position =
|
|
1074
|
+
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1053
1075
|
for (const o of e.rootNodes)
|
|
1054
1076
|
o.parent = this.transformRoot;
|
|
1055
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((
|
|
1077
|
+
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
1078
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1057
1079
|
this.scene,
|
|
1058
1080
|
this.canvasPanels,
|
|
@@ -1070,7 +1092,7 @@ class it {
|
|
|
1070
1092
|
getAllMeshes() {
|
|
1071
1093
|
var e;
|
|
1072
1094
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1073
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1095
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
1074
1096
|
).flat();
|
|
1075
1097
|
}
|
|
1076
1098
|
async instantiate() {
|
|
@@ -1081,7 +1103,7 @@ class it {
|
|
|
1081
1103
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
1082
1104
|
this.renameClonedAsset.bind(this),
|
|
1083
1105
|
!0
|
|
1084
|
-
), this.materials =
|
|
1106
|
+
), this.materials = we(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = ge(
|
|
1085
1107
|
this.modelInstance.animationGroups,
|
|
1086
1108
|
this.renameClonedAsset("")
|
|
1087
1109
|
), this.initialized = !0, await this.processQueuedEvents();
|
|
@@ -1115,6 +1137,28 @@ class it {
|
|
|
1115
1137
|
this.modelVariantObservable.removeCallback(e);
|
|
1116
1138
|
}
|
|
1117
1139
|
//#endregion
|
|
1140
|
+
getCurrentAnimationFrame() {
|
|
1141
|
+
var t;
|
|
1142
|
+
const e = [
|
|
1143
|
+
...((t = this.modelInstance) == null ? void 0 : t.animationGroups) || [],
|
|
1144
|
+
...this.variantManager.getAnimationGroups()
|
|
1145
|
+
];
|
|
1146
|
+
for (const i of e)
|
|
1147
|
+
if (i.animatables.length > 0 && i.animatables[0].masterFrame !== void 0 && i.animatables[0].masterFrame !== null)
|
|
1148
|
+
return i.animatables[0].masterFrame;
|
|
1149
|
+
return 0;
|
|
1150
|
+
}
|
|
1151
|
+
getAnimationIsPlaying() {
|
|
1152
|
+
var t;
|
|
1153
|
+
const e = [
|
|
1154
|
+
...((t = this.modelInstance) == null ? void 0 : t.animationGroups) || [],
|
|
1155
|
+
...this.variantManager.getAnimationGroups()
|
|
1156
|
+
];
|
|
1157
|
+
for (const i of e)
|
|
1158
|
+
if (i.isPlaying)
|
|
1159
|
+
return !0;
|
|
1160
|
+
return !1;
|
|
1161
|
+
}
|
|
1118
1162
|
stripIdFromName(e) {
|
|
1119
1163
|
return e.substring(this.id.length + 1);
|
|
1120
1164
|
}
|
|
@@ -1134,17 +1178,17 @@ class it {
|
|
|
1134
1178
|
//#endregion
|
|
1135
1179
|
}
|
|
1136
1180
|
class D extends pe {
|
|
1137
|
-
constructor(e, t, i, s,
|
|
1181
|
+
constructor(e, t, i, s, r, o, a, h) {
|
|
1138
1182
|
super(
|
|
1139
1183
|
e,
|
|
1140
1184
|
t,
|
|
1141
1185
|
i,
|
|
1142
1186
|
s,
|
|
1143
|
-
|
|
1187
|
+
r,
|
|
1144
1188
|
o,
|
|
1145
|
-
|
|
1146
|
-
), this.lastFocus = new
|
|
1147
|
-
|
|
1189
|
+
h
|
|
1190
|
+
), 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(
|
|
1191
|
+
a.camera.autoRotation.idleTimeMs
|
|
1148
1192
|
));
|
|
1149
1193
|
}
|
|
1150
1194
|
get isRunningFramingBehavior() {
|
|
@@ -1190,10 +1234,10 @@ class D extends pe {
|
|
|
1190
1234
|
i.framingTime = t || 800;
|
|
1191
1235
|
const s = () => {
|
|
1192
1236
|
this.isRunningFramingBehavior = !1;
|
|
1193
|
-
},
|
|
1194
|
-
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(
|
|
1195
|
-
|
|
1196
|
-
|
|
1237
|
+
}, r = E(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
|
|
1238
|
+
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(
|
|
1239
|
+
r.min,
|
|
1240
|
+
r.max,
|
|
1197
1241
|
void 0,
|
|
1198
1242
|
s
|
|
1199
1243
|
), i.framingTime = 0;
|
|
@@ -1225,39 +1269,39 @@ class D extends pe {
|
|
|
1225
1269
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1226
1270
|
*/
|
|
1227
1271
|
static create(e, t, i) {
|
|
1228
|
-
const s = E(e),
|
|
1272
|
+
const s = E(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new D(
|
|
1229
1273
|
"ProductCamera",
|
|
1230
1274
|
-(Math.PI / 2),
|
|
1231
1275
|
Math.PI / 2,
|
|
1232
|
-
|
|
1276
|
+
r.length() * 1.5,
|
|
1233
1277
|
o,
|
|
1234
1278
|
e,
|
|
1235
1279
|
t
|
|
1236
1280
|
);
|
|
1237
|
-
return
|
|
1238
|
-
|
|
1239
|
-
}), i && (e.activeCamera =
|
|
1281
|
+
return a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = r.length(), a.onAfterCheckInputsObservable.add(() => {
|
|
1282
|
+
a.panningSensibility = 1e3 / a.panDenominator;
|
|
1283
|
+
}), i && (e.activeCamera = a), a;
|
|
1240
1284
|
}
|
|
1241
1285
|
}
|
|
1242
1286
|
function E(n) {
|
|
1243
1287
|
if (n.meshes.length === 0)
|
|
1244
1288
|
return {
|
|
1245
|
-
min: new
|
|
1246
|
-
max: new
|
|
1289
|
+
min: new p(-1, -1, -1),
|
|
1290
|
+
max: new p(1, 1, 1)
|
|
1247
1291
|
};
|
|
1248
1292
|
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1249
1293
|
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1250
1294
|
}
|
|
1251
1295
|
class nt {
|
|
1252
1296
|
constructor(e, t = !1, i = void 0) {
|
|
1253
|
-
this.renderingPipeline = new
|
|
1297
|
+
this.renderingPipeline = new qe(
|
|
1254
1298
|
"default",
|
|
1255
1299
|
t,
|
|
1256
1300
|
e,
|
|
1257
1301
|
i ? [i] : void 0,
|
|
1258
1302
|
!1
|
|
1259
1303
|
// Disable automatic build
|
|
1260
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1304
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(d));
|
|
1261
1305
|
}
|
|
1262
1306
|
dispose() {
|
|
1263
1307
|
this.renderingPipeline.dispose();
|
|
@@ -1266,16 +1310,16 @@ class nt {
|
|
|
1266
1310
|
return this.currentConfiguration;
|
|
1267
1311
|
}
|
|
1268
1312
|
setConfiguration(e) {
|
|
1269
|
-
var t, i, s,
|
|
1313
|
+
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
1314
|
if (this.renderingPipeline.isSupported) {
|
|
1271
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ??
|
|
1315
|
+
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
1316
|
e.chromaticAberration.direction.x,
|
|
1273
1317
|
e.chromaticAberration.direction.y
|
|
1274
1318
|
) : new ne(
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((
|
|
1278
|
-
switch (e.depthOfField.blurLevel ??
|
|
1319
|
+
d.chromaticAberration.direction.x,
|
|
1320
|
+
d.chromaticAberration.direction.y
|
|
1321
|
+
), 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)
|
|
1322
|
+
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1279
1323
|
case "Low":
|
|
1280
1324
|
this.renderingPipeline.depthOfFieldBlurLevel = T.Low;
|
|
1281
1325
|
break;
|
|
@@ -1286,8 +1330,8 @@ class nt {
|
|
|
1286
1330
|
this.renderingPipeline.depthOfFieldBlurLevel = T.High;
|
|
1287
1331
|
break;
|
|
1288
1332
|
}
|
|
1289
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((k = e.depthOfField) == null ? void 0 : k.focalLength) ??
|
|
1290
|
-
switch (e.misc.toneMappingType ??
|
|
1333
|
+
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)
|
|
1334
|
+
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1291
1335
|
case "Standard":
|
|
1292
1336
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1293
1337
|
break;
|
|
@@ -1295,8 +1339,8 @@ class nt {
|
|
|
1295
1339
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1296
1340
|
break;
|
|
1297
1341
|
}
|
|
1298
|
-
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ??
|
|
1299
|
-
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ??
|
|
1342
|
+
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)
|
|
1343
|
+
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? d.vignette.blendMode) {
|
|
1300
1344
|
case "Multiply":
|
|
1301
1345
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1302
1346
|
break;
|
|
@@ -1310,11 +1354,11 @@ class nt {
|
|
|
1310
1354
|
e.vignette.colorRgba.b,
|
|
1311
1355
|
e.vignette.colorRgba.a
|
|
1312
1356
|
) : (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) ??
|
|
1357
|
+
d.vignette.colorRgba.r,
|
|
1358
|
+
d.vignette.colorRgba.g,
|
|
1359
|
+
d.vignette.colorRgba.b,
|
|
1360
|
+
d.vignette.colorRgba.a
|
|
1361
|
+
), 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
1362
|
}
|
|
1319
1363
|
}
|
|
1320
1364
|
updateColorCurve(e) {
|
|
@@ -1322,7 +1366,7 @@ class nt {
|
|
|
1322
1366
|
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
1367
|
}
|
|
1324
1368
|
}
|
|
1325
|
-
|
|
1369
|
+
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1326
1370
|
return new Ne(n);
|
|
1327
1371
|
});
|
|
1328
1372
|
S.OnPluginActivatedObservable.add((n) => {
|
|
@@ -1332,35 +1376,35 @@ S.OnPluginActivatedObservable.add((n) => {
|
|
|
1332
1376
|
}
|
|
1333
1377
|
});
|
|
1334
1378
|
function O(n) {
|
|
1335
|
-
return new
|
|
1379
|
+
return new p(n.x, n.y, n.z);
|
|
1336
1380
|
}
|
|
1337
1381
|
function L(n) {
|
|
1338
1382
|
return { x: n.x, y: n.y, z: n.z };
|
|
1339
1383
|
}
|
|
1340
1384
|
class Wt {
|
|
1341
1385
|
constructor(e) {
|
|
1342
|
-
var
|
|
1386
|
+
var h;
|
|
1343
1387
|
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
1388
|
if (!this.engine.views)
|
|
1345
1389
|
return;
|
|
1346
|
-
this.modelContainers.forEach((
|
|
1347
|
-
|
|
1390
|
+
this.modelContainers.forEach((l) => {
|
|
1391
|
+
l.updateDynamicTextures();
|
|
1348
1392
|
}), 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,
|
|
1393
|
+
const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
|
|
1394
|
+
!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
1395
|
}, this.configuration = new le(e);
|
|
1352
1396
|
const i = (() => {
|
|
1353
1397
|
if (!(e != null && e.noRender))
|
|
1354
1398
|
return this.configuration.createCanvas();
|
|
1355
1399
|
})(), s = "1.5.6";
|
|
1356
|
-
|
|
1400
|
+
Me.Configuration = {
|
|
1357
1401
|
decoder: {
|
|
1358
1402
|
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_wasm_wrapper_gltf.js`,
|
|
1359
1403
|
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.wasm`,
|
|
1360
1404
|
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.js`
|
|
1361
1405
|
}
|
|
1362
1406
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1363
|
-
const
|
|
1407
|
+
const r = console.log;
|
|
1364
1408
|
console.log = () => {
|
|
1365
1409
|
};
|
|
1366
1410
|
const o = i ? new fe(i, !0, {
|
|
@@ -1371,24 +1415,24 @@ class Wt {
|
|
|
1371
1415
|
audioEngine: !1,
|
|
1372
1416
|
stencil: this.configuration.highlights.enabled,
|
|
1373
1417
|
forceSRGBBufferSupportState: !0
|
|
1374
|
-
}) : new
|
|
1375
|
-
console.log =
|
|
1418
|
+
}) : new Ce();
|
|
1419
|
+
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
1420
|
this.scene,
|
|
1377
1421
|
!1,
|
|
1378
1422
|
this.camera
|
|
1379
1423
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1380
|
-
const
|
|
1424
|
+
const a = ie.CreateFromPrefilteredData(
|
|
1381
1425
|
this.configuration.scene.environment.file,
|
|
1382
1426
|
this.scene
|
|
1383
1427
|
);
|
|
1384
|
-
|
|
1428
|
+
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
1429
|
this.configuration.options.renderingPipelineConfiguration
|
|
1386
|
-
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new
|
|
1430
|
+
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
|
|
1387
1431
|
this.scene,
|
|
1388
1432
|
this.configuration.emissiveGlowIntensity
|
|
1389
|
-
), this.initPromise = new Promise((
|
|
1433
|
+
), this.initPromise = new Promise((c) => {
|
|
1390
1434
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1391
|
-
this.initComplete = !0,
|
|
1435
|
+
this.initComplete = !0, c();
|
|
1392
1436
|
});
|
|
1393
1437
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1394
1438
|
}
|
|
@@ -1438,7 +1482,7 @@ class Wt {
|
|
|
1438
1482
|
let t = () => {
|
|
1439
1483
|
};
|
|
1440
1484
|
const i = async () => {
|
|
1441
|
-
this.isAnimatingCamera = !0, await
|
|
1485
|
+
this.isAnimatingCamera = !0, await We(
|
|
1442
1486
|
this.scene,
|
|
1443
1487
|
this.scene.activeCamera,
|
|
1444
1488
|
e
|
|
@@ -1462,7 +1506,7 @@ class Wt {
|
|
|
1462
1506
|
};
|
|
1463
1507
|
}
|
|
1464
1508
|
setCameraPose(e) {
|
|
1465
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1509
|
+
this.scene && this.camera && (this.camera.target = new p(
|
|
1466
1510
|
e.target.x,
|
|
1467
1511
|
e.target.y,
|
|
1468
1512
|
e.target.z
|
|
@@ -1483,9 +1527,9 @@ class Wt {
|
|
|
1483
1527
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1484
1528
|
this.focusLostNotified = !1;
|
|
1485
1529
|
const s = () => {
|
|
1486
|
-
const
|
|
1530
|
+
const r = this.configuration;
|
|
1487
1531
|
this.camera.rerunFramingBehavior(() => {
|
|
1488
|
-
|
|
1532
|
+
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
1533
|
});
|
|
1490
1534
|
};
|
|
1491
1535
|
this.scene.onAfterRenderObservable.addOnce(s);
|
|
@@ -1511,13 +1555,13 @@ class Wt {
|
|
|
1511
1555
|
0,
|
|
1512
1556
|
0,
|
|
1513
1557
|
0,
|
|
1514
|
-
|
|
1558
|
+
p.Zero(),
|
|
1515
1559
|
this.scene
|
|
1516
1560
|
);
|
|
1517
1561
|
try {
|
|
1518
|
-
const s = t.latDeg * Math.PI / 180,
|
|
1519
|
-
i.target = t.target ? new
|
|
1520
|
-
const o = await
|
|
1562
|
+
const s = t.latDeg * Math.PI / 180, r = t.lonDeg * Math.PI / 180;
|
|
1563
|
+
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();
|
|
1564
|
+
const o = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1521
1565
|
this.engine,
|
|
1522
1566
|
i,
|
|
1523
1567
|
e,
|
|
@@ -1534,32 +1578,32 @@ class Wt {
|
|
|
1534
1578
|
const e = this.configuration;
|
|
1535
1579
|
if (!e)
|
|
1536
1580
|
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 ||
|
|
1581
|
+
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;
|
|
1582
|
+
if (t === void 0 || i === void 0 || s === void 0 || r === void 0)
|
|
1539
1583
|
return !0;
|
|
1540
|
-
const o = [t, i],
|
|
1541
|
-
return !
|
|
1584
|
+
const o = [t, i], a = [s, r], h = o.every((l) => l === t), c = a.every((l) => l === s);
|
|
1585
|
+
return !h && !c;
|
|
1542
1586
|
}
|
|
1543
1587
|
fireResizeEvent() {
|
|
1544
1588
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1545
1589
|
}
|
|
1546
1590
|
setHighlights(e, t) {
|
|
1547
1591
|
var s;
|
|
1548
|
-
e.length === 0 && ((s = this.highlightLayer) == null || s.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new
|
|
1592
|
+
e.length === 0 && ((s = this.highlightLayer) == null || s.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1549
1593
|
isStroke: !0,
|
|
1550
1594
|
blurVerticalSize: 0.85,
|
|
1551
1595
|
blurHorizontalSize: 0.85
|
|
1552
1596
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1553
1597
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1554
|
-
e.forEach((
|
|
1598
|
+
e.forEach((r) => {
|
|
1555
1599
|
const o = this.scene.materials.find(
|
|
1556
|
-
(
|
|
1600
|
+
(a) => a.name === r.name && a.id === r.id
|
|
1557
1601
|
);
|
|
1558
1602
|
o && o.getBindedMeshes().forEach(
|
|
1559
|
-
(
|
|
1560
|
-
var
|
|
1561
|
-
return (
|
|
1562
|
-
|
|
1603
|
+
(a) => {
|
|
1604
|
+
var h;
|
|
1605
|
+
return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
|
|
1606
|
+
a,
|
|
1563
1607
|
i || w.FromHexString("#fcba03")
|
|
1564
1608
|
);
|
|
1565
1609
|
}
|
|
@@ -1631,11 +1675,11 @@ class Wt {
|
|
|
1631
1675
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1632
1676
|
),
|
|
1633
1677
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1634
|
-
),
|
|
1635
|
-
return o.decompose(
|
|
1636
|
-
position: L(
|
|
1637
|
-
rotation: L(
|
|
1638
|
-
scale: L(
|
|
1678
|
+
), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), h = y.Identity(), c = p.Zero();
|
|
1679
|
+
return o.decompose(c, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1680
|
+
position: L(a),
|
|
1681
|
+
rotation: L(h.toEulerAngles()),
|
|
1682
|
+
scale: L(c)
|
|
1639
1683
|
};
|
|
1640
1684
|
}
|
|
1641
1685
|
updatePreviewOptions(e) {
|
|
@@ -1657,7 +1701,7 @@ class Wt {
|
|
|
1657
1701
|
*/
|
|
1658
1702
|
reattachControls(e, t = 2) {
|
|
1659
1703
|
if (this.scene.detachControl(), this.engine.inputElement = e, this.camera) {
|
|
1660
|
-
this.camera.attachControl(!
|
|
1704
|
+
this.camera.attachControl(!0, !1, t);
|
|
1661
1705
|
const i = this.camera.inputs.attached.pointers;
|
|
1662
1706
|
i.multiTouchPanning = !1;
|
|
1663
1707
|
}
|
|
@@ -1667,8 +1711,8 @@ class Wt {
|
|
|
1667
1711
|
export {
|
|
1668
1712
|
F as MaterialEffectMode,
|
|
1669
1713
|
I as ProductCameraRig,
|
|
1670
|
-
|
|
1714
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1671
1715
|
x as RenderingConfiguration,
|
|
1672
1716
|
Wt as SpiffCommerce3DPreviewService,
|
|
1673
|
-
|
|
1717
|
+
d as renderingPipelineDefaults
|
|
1674
1718
|
};
|