@spiffcommerce/preview 5.3.11-beta.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 +341 -289
- 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,44 +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
|
-
|
|
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);
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
function We(n, e, t) {
|
|
487
487
|
return new Promise((i) => {
|
|
488
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 = [],
|
|
489
|
+
const s = [], r = t.target, o = 0, a = r ? 1 : 0;
|
|
490
490
|
if (t.target && Object.keys(t.target).length > 0 && s.push(
|
|
491
491
|
A(
|
|
492
492
|
"cameraTargetLerp",
|
|
493
493
|
"target",
|
|
494
|
-
new
|
|
495
|
-
new
|
|
494
|
+
new p().copyFrom(e.target),
|
|
495
|
+
new p(
|
|
496
496
|
t.target.x,
|
|
497
497
|
t.target.y,
|
|
498
498
|
t.target.z
|
|
@@ -507,7 +507,7 @@ function We(n, e, t) {
|
|
|
507
507
|
e.alpha,
|
|
508
508
|
me(t.lonDeg),
|
|
509
509
|
v.ANIMATIONTYPE_FLOAT,
|
|
510
|
-
|
|
510
|
+
a
|
|
511
511
|
)
|
|
512
512
|
), s.push(
|
|
513
513
|
A(
|
|
@@ -516,31 +516,31 @@ function We(n, e, t) {
|
|
|
516
516
|
e.beta,
|
|
517
517
|
me(t.latDeg),
|
|
518
518
|
v.ANIMATIONTYPE_FLOAT,
|
|
519
|
-
|
|
519
|
+
a
|
|
520
520
|
)
|
|
521
521
|
), t.radius !== void 0) {
|
|
522
|
-
const
|
|
522
|
+
const l = Math.max(0.01, t.radius);
|
|
523
523
|
s.push(
|
|
524
524
|
A(
|
|
525
525
|
"cameraRadiusLerp",
|
|
526
526
|
"radius",
|
|
527
527
|
e.radius,
|
|
528
|
-
|
|
528
|
+
l,
|
|
529
529
|
v.ANIMATIONTYPE_FLOAT,
|
|
530
|
-
|
|
530
|
+
a
|
|
531
531
|
)
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
534
|
e.animations.push(...s);
|
|
535
|
-
const
|
|
535
|
+
const c = e.useAutoRotationBehavior;
|
|
536
536
|
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
537
537
|
e,
|
|
538
538
|
0,
|
|
539
|
-
|
|
539
|
+
r ? M * 2 : M,
|
|
540
540
|
!1,
|
|
541
541
|
1,
|
|
542
542
|
() => {
|
|
543
|
-
e.animations = [],
|
|
543
|
+
e.animations = [], c && e.enableAutoRotationBehavior(), i();
|
|
544
544
|
}
|
|
545
545
|
);
|
|
546
546
|
});
|
|
@@ -548,25 +548,30 @@ function We(n, e, t) {
|
|
|
548
548
|
function me(n) {
|
|
549
549
|
return n * Math.PI / 180;
|
|
550
550
|
}
|
|
551
|
-
function A(n, e, t, i, s,
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
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(
|
|
555
555
|
n,
|
|
556
556
|
e,
|
|
557
557
|
M,
|
|
558
558
|
s,
|
|
559
559
|
o
|
|
560
|
-
),
|
|
561
|
-
return
|
|
562
|
-
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),
|
|
563
563
|
value: i
|
|
564
|
-
}),
|
|
564
|
+
}), h.setKeys(c), h.setEasingFunction(a), h;
|
|
565
565
|
}
|
|
566
566
|
function Ye(n, e, t) {
|
|
567
567
|
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
568
568
|
}
|
|
569
|
-
|
|
569
|
+
function Qe(n, e) {
|
|
570
|
+
n.forEach((t) => {
|
|
571
|
+
t.goToFrame(e);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
const Ze = {
|
|
570
575
|
albedoTexture: "albedoMap",
|
|
571
576
|
bumpTexture: "normalMap",
|
|
572
577
|
ambientTexture: "ambientMap",
|
|
@@ -576,7 +581,7 @@ const Qe = {
|
|
|
576
581
|
refractionTexture: "refractionMap",
|
|
577
582
|
reflectionTexture: "reflectionMap"
|
|
578
583
|
};
|
|
579
|
-
function
|
|
584
|
+
function $e(n, e, t, i) {
|
|
580
585
|
[
|
|
581
586
|
"albedoTexture",
|
|
582
587
|
"bumpTexture",
|
|
@@ -586,51 +591,51 @@ function Ze(n, e, t, i) {
|
|
|
586
591
|
"metallicTexture",
|
|
587
592
|
"refractionTexture",
|
|
588
593
|
"reflectionTexture"
|
|
589
|
-
].forEach((
|
|
590
|
-
|
|
591
|
-
|
|
594
|
+
].forEach((r) => {
|
|
595
|
+
je(
|
|
596
|
+
r,
|
|
592
597
|
n,
|
|
593
598
|
e,
|
|
594
599
|
t,
|
|
595
600
|
i
|
|
596
601
|
);
|
|
597
|
-
}),
|
|
602
|
+
}), et(n, e);
|
|
598
603
|
}
|
|
599
|
-
function
|
|
600
|
-
const
|
|
601
|
-
if (!
|
|
604
|
+
function je(n, e, t, i, s) {
|
|
605
|
+
const r = Ze[n];
|
|
606
|
+
if (!r)
|
|
602
607
|
throw new Error("Unexpected texture name encountered.");
|
|
603
|
-
const o = e[
|
|
604
|
-
|
|
608
|
+
const o = e[r], a = o == null ? void 0 : o.fileLink;
|
|
609
|
+
a ? n === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
605
610
|
n,
|
|
606
|
-
|
|
611
|
+
a,
|
|
607
612
|
void 0,
|
|
608
613
|
!1,
|
|
609
614
|
void 0,
|
|
610
615
|
!0
|
|
611
|
-
) :
|
|
616
|
+
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
612
617
|
n,
|
|
613
|
-
|
|
618
|
+
a,
|
|
614
619
|
128,
|
|
615
620
|
!1,
|
|
616
621
|
!0,
|
|
617
622
|
!1
|
|
618
|
-
) : 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));
|
|
619
624
|
}
|
|
620
|
-
function
|
|
625
|
+
function Xe(n, e) {
|
|
621
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);
|
|
622
627
|
}
|
|
623
|
-
function
|
|
628
|
+
function Je(n, e, t, i) {
|
|
624
629
|
if (!e) {
|
|
625
630
|
console.error("Failed to apply texture to material: material is null.");
|
|
626
631
|
return;
|
|
627
632
|
}
|
|
628
633
|
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), n === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
629
634
|
}
|
|
630
|
-
function
|
|
635
|
+
function et(n, e) {
|
|
631
636
|
n.clearCoat && (n.clearCoat === F.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === F.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
632
637
|
}
|
|
633
|
-
class
|
|
638
|
+
class tt {
|
|
634
639
|
constructor(e, t, i) {
|
|
635
640
|
this.materialVariantMap = /* @__PURE__ */ new Map(), this.keysThatRemovedBaseModel = [], this.loadedContainerForKey = /* @__PURE__ */ new Map(), this.loadedMaterialsForKey = /* @__PURE__ */ new Map(), this.scene = e, this.renameClonedAsset = t, this.setBaseModelEnabled = i;
|
|
636
641
|
}
|
|
@@ -644,44 +649,44 @@ class et {
|
|
|
644
649
|
* where we want to undo changes are remove effects from display.
|
|
645
650
|
*/
|
|
646
651
|
async applyMaterial(e, t, i, s) {
|
|
647
|
-
return new Promise((
|
|
652
|
+
return new Promise((r) => {
|
|
648
653
|
const o = this.materialVariantMap.get(e);
|
|
649
654
|
this.materialVariantMap.set(e, {
|
|
650
655
|
...o,
|
|
651
656
|
...t
|
|
652
657
|
});
|
|
653
|
-
const
|
|
654
|
-
(
|
|
658
|
+
const a = this.renameClonedAsset(e), h = this.scene.materials.filter(
|
|
659
|
+
(l) => l.name === a
|
|
655
660
|
);
|
|
656
|
-
if (
|
|
657
|
-
|
|
661
|
+
if (h.length === 0) {
|
|
662
|
+
r();
|
|
658
663
|
return;
|
|
659
664
|
}
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
(
|
|
665
|
+
const c = new Ve(this.scene);
|
|
666
|
+
c.useDefaultLoadingScreen = !1, h.forEach(
|
|
667
|
+
(l) => $e(
|
|
663
668
|
t,
|
|
664
|
-
|
|
665
|
-
|
|
669
|
+
l,
|
|
670
|
+
c,
|
|
666
671
|
s
|
|
667
672
|
)
|
|
668
|
-
),
|
|
669
|
-
i && i(
|
|
670
|
-
},
|
|
671
|
-
|
|
673
|
+
), c.onProgress = (l, u, m) => {
|
|
674
|
+
i && i(l / u * 100, 100, m.name);
|
|
675
|
+
}, c.onFinish = (l) => {
|
|
676
|
+
l.forEach((u) => {
|
|
672
677
|
const m = u;
|
|
673
678
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
674
|
-
(f) => f.name ===
|
|
679
|
+
(f) => f.name === a
|
|
675
680
|
).forEach(
|
|
676
|
-
(f) =>
|
|
681
|
+
(f) => Je(
|
|
677
682
|
u.name,
|
|
678
683
|
f,
|
|
679
684
|
t,
|
|
680
685
|
m.texture
|
|
681
686
|
)
|
|
682
687
|
);
|
|
683
|
-
}),
|
|
684
|
-
},
|
|
688
|
+
}), r();
|
|
689
|
+
}, c.loadAsync();
|
|
685
690
|
});
|
|
686
691
|
}
|
|
687
692
|
/**
|
|
@@ -690,22 +695,44 @@ class et {
|
|
|
690
695
|
* @param replaceProductModel When true, we should replace the base product model.
|
|
691
696
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
692
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.
|
|
693
701
|
*/
|
|
694
|
-
async applyModel(e, t, i, s) {
|
|
695
|
-
var
|
|
702
|
+
async applyModel(e, t, i, s, r, o, a) {
|
|
703
|
+
var u;
|
|
696
704
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
697
|
-
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (
|
|
698
|
-
(
|
|
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
|
|
699
707
|
), Promise.resolve(void 0);
|
|
700
|
-
const
|
|
708
|
+
const c = (await be(i, this.scene, s)).instantiateModelsToScene(
|
|
701
709
|
this.renameClonedAsset,
|
|
702
710
|
!0
|
|
703
711
|
);
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
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;
|
|
709
736
|
}
|
|
710
737
|
dispose() {
|
|
711
738
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -727,13 +754,13 @@ class et {
|
|
|
727
754
|
}), e;
|
|
728
755
|
}
|
|
729
756
|
}
|
|
730
|
-
function
|
|
757
|
+
function we(n) {
|
|
731
758
|
const e = [];
|
|
732
759
|
return n.rootNodes.forEach((t) => {
|
|
733
760
|
t.getChildMeshes().forEach((i) => {
|
|
734
761
|
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((s) => {
|
|
735
|
-
const
|
|
736
|
-
|
|
762
|
+
const r = s.getMaterial(!1);
|
|
763
|
+
r && !e.includes(r) && e.push(r);
|
|
737
764
|
});
|
|
738
765
|
});
|
|
739
766
|
}), e;
|
|
@@ -746,22 +773,22 @@ function ge(n, e = "") {
|
|
|
746
773
|
from: t.from
|
|
747
774
|
}));
|
|
748
775
|
}
|
|
749
|
-
class
|
|
776
|
+
class it {
|
|
750
777
|
constructor(e) {
|
|
751
778
|
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new C(), this.materialDeselectedObservable = new C(), this.materialVariantObservable = new C(), this.modelVariantObservable = new C(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
|
|
752
779
|
const {
|
|
753
780
|
enablePicking: t,
|
|
754
781
|
modelDetails: i,
|
|
755
782
|
previewService: s,
|
|
756
|
-
progressHandler:
|
|
783
|
+
progressHandler: r,
|
|
757
784
|
scene: o
|
|
758
785
|
} = e;
|
|
759
|
-
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(
|
|
760
787
|
o,
|
|
761
788
|
this.renameClonedAsset.bind(this),
|
|
762
789
|
this.setBaseModelEnabled.bind(this)
|
|
763
|
-
), this.transformRoot = new
|
|
764
|
-
const
|
|
790
|
+
), this.transformRoot = new Fe("root", this.scene);
|
|
791
|
+
const a = async () => {
|
|
765
792
|
if (!i.model)
|
|
766
793
|
throw new Error(
|
|
767
794
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -769,10 +796,10 @@ class tt {
|
|
|
769
796
|
return this.assetContainer = await be(
|
|
770
797
|
i.model,
|
|
771
798
|
o,
|
|
772
|
-
|
|
799
|
+
r
|
|
773
800
|
), await this.instantiate(), this;
|
|
774
801
|
};
|
|
775
|
-
this.importPromise =
|
|
802
|
+
this.importPromise = a();
|
|
776
803
|
}
|
|
777
804
|
//#region Interface implementation
|
|
778
805
|
async applyMaterialVariant(e, t, i, s) {
|
|
@@ -808,15 +835,15 @@ class tt {
|
|
|
808
835
|
}
|
|
809
836
|
return;
|
|
810
837
|
}
|
|
811
|
-
const
|
|
838
|
+
const r = async () => {
|
|
812
839
|
await this.variantManager.applyMaterial(
|
|
813
840
|
e,
|
|
814
841
|
i,
|
|
815
|
-
(o,
|
|
842
|
+
(o, a, h) => {
|
|
816
843
|
this.materialVariantObservable.notifyObservers({
|
|
817
844
|
remainingCount: o,
|
|
818
|
-
totalCount:
|
|
819
|
-
taskName:
|
|
845
|
+
totalCount: a,
|
|
846
|
+
taskName: h
|
|
820
847
|
});
|
|
821
848
|
},
|
|
822
849
|
s
|
|
@@ -825,23 +852,23 @@ class tt {
|
|
|
825
852
|
if (this.materialChangesInProgress.includes(e)) {
|
|
826
853
|
if (this.queuedMaterialChanges.has(e)) {
|
|
827
854
|
const o = this.queuedMaterialChanges.get(e);
|
|
828
|
-
o == null || o.set(t,
|
|
855
|
+
o == null || o.set(t, r);
|
|
829
856
|
} else {
|
|
830
857
|
this.queuedMaterialChanges.set(
|
|
831
858
|
e,
|
|
832
859
|
/* @__PURE__ */ new Map()
|
|
833
860
|
);
|
|
834
861
|
const o = this.queuedMaterialChanges.get(e);
|
|
835
|
-
o == null || o.set(t,
|
|
862
|
+
o == null || o.set(t, r);
|
|
836
863
|
}
|
|
837
864
|
return;
|
|
838
865
|
}
|
|
839
|
-
if (this.materialChangesInProgress.push(e), await
|
|
866
|
+
if (this.materialChangesInProgress.push(e), await r(), this.queuedMaterialChanges.has(e)) {
|
|
840
867
|
const o = this.queuedMaterialChanges.get(e);
|
|
841
868
|
if (!o)
|
|
842
869
|
throw new Error("Target material is undefined");
|
|
843
|
-
o.forEach(async (
|
|
844
|
-
await
|
|
870
|
+
o.forEach(async (a) => {
|
|
871
|
+
await a();
|
|
845
872
|
}), this.queuedMaterialChanges.delete(e);
|
|
846
873
|
}
|
|
847
874
|
this.materialChangesInProgress.splice(
|
|
@@ -866,12 +893,15 @@ class tt {
|
|
|
866
893
|
e,
|
|
867
894
|
i,
|
|
868
895
|
t == null ? void 0 : t.model,
|
|
869
|
-
(
|
|
896
|
+
(a) => {
|
|
870
897
|
this.modelVariantObservable.notifyObservers({
|
|
871
|
-
...
|
|
898
|
+
...a,
|
|
872
899
|
key: e
|
|
873
900
|
});
|
|
874
|
-
}
|
|
901
|
+
},
|
|
902
|
+
this.lastPlayedAnimation,
|
|
903
|
+
this.getCurrentAnimationFrame.bind(this),
|
|
904
|
+
this.getAnimationIsPlaying.bind(this)
|
|
875
905
|
);
|
|
876
906
|
if (this.modelChangesInProgress.includes(e)) {
|
|
877
907
|
this.queuedModelChanges.set(e, s);
|
|
@@ -879,17 +909,17 @@ class tt {
|
|
|
879
909
|
}
|
|
880
910
|
const o = await (async () => {
|
|
881
911
|
this.modelChangesInProgress.push(e);
|
|
882
|
-
let
|
|
912
|
+
let a = await s();
|
|
883
913
|
if (this.queuedModelChanges.has(e)) {
|
|
884
|
-
const
|
|
885
|
-
if (!
|
|
914
|
+
const h = this.queuedModelChanges.get(e);
|
|
915
|
+
if (!h)
|
|
886
916
|
throw new Error("Queued change resolved undefined");
|
|
887
|
-
|
|
917
|
+
a = await h(), this.queuedModelChanges.delete(e);
|
|
888
918
|
}
|
|
889
919
|
return this.modelChangesInProgress.splice(
|
|
890
920
|
this.modelChangesInProgress.indexOf(e),
|
|
891
921
|
1
|
|
892
|
-
),
|
|
922
|
+
), a;
|
|
893
923
|
})();
|
|
894
924
|
this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
895
925
|
}
|
|
@@ -900,17 +930,17 @@ class tt {
|
|
|
900
930
|
executeAnimation(e) {
|
|
901
931
|
if (!this.initialized)
|
|
902
932
|
return this.queuedModelAnimation = e, Promise.resolve();
|
|
903
|
-
if (!this.modelInstance)
|
|
904
|
-
return Promise.resolve();
|
|
905
933
|
let t = () => {
|
|
906
934
|
};
|
|
907
935
|
const i = async () => {
|
|
908
|
-
this.isExecutingAnimation = !0, await new Promise((s) => {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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,
|
|
914
944
|
e.loop,
|
|
915
945
|
e.to,
|
|
916
946
|
e.from,
|
|
@@ -965,7 +995,7 @@ class tt {
|
|
|
965
995
|
set position(e) {
|
|
966
996
|
if (!this.transformRoot)
|
|
967
997
|
throw new Error("ModelContainer disposed prior to setting position!");
|
|
968
|
-
this.transformRoot.position = new
|
|
998
|
+
this.transformRoot.position = new p(e.x, e.y, e.z);
|
|
969
999
|
}
|
|
970
1000
|
get rotation() {
|
|
971
1001
|
var e;
|
|
@@ -990,7 +1020,7 @@ class tt {
|
|
|
990
1020
|
set scale(e) {
|
|
991
1021
|
if (!this.transformRoot)
|
|
992
1022
|
throw new Error("ModelContainer disposed prior to setting scale!");
|
|
993
|
-
this.transformRoot.scaling = new
|
|
1023
|
+
this.transformRoot.scaling = new p(e.x, e.y, e.z);
|
|
994
1024
|
}
|
|
995
1025
|
//#endregion
|
|
996
1026
|
//#region Custom implementation functions
|
|
@@ -1038,16 +1068,16 @@ class tt {
|
|
|
1038
1068
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1039
1069
|
}
|
|
1040
1070
|
configureModelInstance(e) {
|
|
1041
|
-
var
|
|
1071
|
+
var r;
|
|
1042
1072
|
if (!this.transformRoot)
|
|
1043
1073
|
throw new Error(
|
|
1044
1074
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1045
1075
|
);
|
|
1046
1076
|
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, s = this.transformRoot.scaling;
|
|
1047
|
-
this.transformRoot.position =
|
|
1077
|
+
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1048
1078
|
for (const o of e.rootNodes)
|
|
1049
1079
|
o.parent = this.transformRoot;
|
|
1050
|
-
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(
|
|
1051
1081
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1052
1082
|
this.scene,
|
|
1053
1083
|
this.canvasPanels,
|
|
@@ -1065,7 +1095,7 @@ class tt {
|
|
|
1065
1095
|
getAllMeshes() {
|
|
1066
1096
|
var e;
|
|
1067
1097
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1068
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1098
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
1069
1099
|
).flat();
|
|
1070
1100
|
}
|
|
1071
1101
|
async instantiate() {
|
|
@@ -1076,7 +1106,7 @@ class tt {
|
|
|
1076
1106
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
1077
1107
|
this.renameClonedAsset.bind(this),
|
|
1078
1108
|
!0
|
|
1079
|
-
), this.materials =
|
|
1109
|
+
), this.materials = we(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = ge(
|
|
1080
1110
|
this.modelInstance.animationGroups,
|
|
1081
1111
|
this.renameClonedAsset("")
|
|
1082
1112
|
), this.initialized = !0, await this.processQueuedEvents();
|
|
@@ -1110,6 +1140,28 @@ class tt {
|
|
|
1110
1140
|
this.modelVariantObservable.removeCallback(e);
|
|
1111
1141
|
}
|
|
1112
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
|
+
}
|
|
1113
1165
|
stripIdFromName(e) {
|
|
1114
1166
|
return e.substring(this.id.length + 1);
|
|
1115
1167
|
}
|
|
@@ -1129,17 +1181,17 @@ class tt {
|
|
|
1129
1181
|
//#endregion
|
|
1130
1182
|
}
|
|
1131
1183
|
class D extends pe {
|
|
1132
|
-
constructor(e, t, i, s,
|
|
1184
|
+
constructor(e, t, i, s, r, o, a, h) {
|
|
1133
1185
|
super(
|
|
1134
1186
|
e,
|
|
1135
1187
|
t,
|
|
1136
1188
|
i,
|
|
1137
1189
|
s,
|
|
1138
|
-
|
|
1190
|
+
r,
|
|
1139
1191
|
o,
|
|
1140
|
-
|
|
1141
|
-
), this.lastFocus = new
|
|
1142
|
-
|
|
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
|
|
1143
1195
|
));
|
|
1144
1196
|
}
|
|
1145
1197
|
get isRunningFramingBehavior() {
|
|
@@ -1185,10 +1237,10 @@ class D extends pe {
|
|
|
1185
1237
|
i.framingTime = t || 800;
|
|
1186
1238
|
const s = () => {
|
|
1187
1239
|
this.isRunningFramingBehavior = !1;
|
|
1188
|
-
},
|
|
1189
|
-
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(
|
|
1190
|
-
|
|
1191
|
-
|
|
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,
|
|
1192
1244
|
void 0,
|
|
1193
1245
|
s
|
|
1194
1246
|
), i.framingTime = 0;
|
|
@@ -1220,39 +1272,39 @@ class D extends pe {
|
|
|
1220
1272
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1221
1273
|
*/
|
|
1222
1274
|
static create(e, t, i) {
|
|
1223
|
-
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(
|
|
1224
1276
|
"ProductCamera",
|
|
1225
1277
|
-(Math.PI / 2),
|
|
1226
1278
|
Math.PI / 2,
|
|
1227
|
-
|
|
1279
|
+
r.length() * 1.5,
|
|
1228
1280
|
o,
|
|
1229
1281
|
e,
|
|
1230
1282
|
t
|
|
1231
1283
|
);
|
|
1232
|
-
return
|
|
1233
|
-
|
|
1234
|
-
}), 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;
|
|
1235
1287
|
}
|
|
1236
1288
|
}
|
|
1237
1289
|
function E(n) {
|
|
1238
1290
|
if (n.meshes.length === 0)
|
|
1239
1291
|
return {
|
|
1240
|
-
min: new
|
|
1241
|
-
max: new
|
|
1292
|
+
min: new p(-1, -1, -1),
|
|
1293
|
+
max: new p(1, 1, 1)
|
|
1242
1294
|
};
|
|
1243
1295
|
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1244
1296
|
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1245
1297
|
}
|
|
1246
|
-
class
|
|
1298
|
+
class nt {
|
|
1247
1299
|
constructor(e, t = !1, i = void 0) {
|
|
1248
|
-
this.renderingPipeline = new
|
|
1300
|
+
this.renderingPipeline = new qe(
|
|
1249
1301
|
"default",
|
|
1250
1302
|
t,
|
|
1251
1303
|
e,
|
|
1252
1304
|
i ? [i] : void 0,
|
|
1253
1305
|
!1
|
|
1254
1306
|
// Disable automatic build
|
|
1255
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1307
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(d));
|
|
1256
1308
|
}
|
|
1257
1309
|
dispose() {
|
|
1258
1310
|
this.renderingPipeline.dispose();
|
|
@@ -1261,16 +1313,16 @@ class it {
|
|
|
1261
1313
|
return this.currentConfiguration;
|
|
1262
1314
|
}
|
|
1263
1315
|
setConfiguration(e) {
|
|
1264
|
-
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;
|
|
1265
1317
|
if (this.renderingPipeline.isSupported) {
|
|
1266
|
-
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(
|
|
1267
1319
|
e.chromaticAberration.direction.x,
|
|
1268
1320
|
e.chromaticAberration.direction.y
|
|
1269
1321
|
) : new ne(
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((
|
|
1273
|
-
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) {
|
|
1274
1326
|
case "Low":
|
|
1275
1327
|
this.renderingPipeline.depthOfFieldBlurLevel = T.Low;
|
|
1276
1328
|
break;
|
|
@@ -1281,8 +1333,8 @@ class it {
|
|
|
1281
1333
|
this.renderingPipeline.depthOfFieldBlurLevel = T.High;
|
|
1282
1334
|
break;
|
|
1283
1335
|
}
|
|
1284
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((k = e.depthOfField) == null ? void 0 : k.focalLength) ??
|
|
1285
|
-
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) {
|
|
1286
1338
|
case "Standard":
|
|
1287
1339
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1288
1340
|
break;
|
|
@@ -1290,8 +1342,8 @@ class it {
|
|
|
1290
1342
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1291
1343
|
break;
|
|
1292
1344
|
}
|
|
1293
|
-
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ??
|
|
1294
|
-
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) {
|
|
1295
1347
|
case "Multiply":
|
|
1296
1348
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1297
1349
|
break;
|
|
@@ -1305,11 +1357,11 @@ class it {
|
|
|
1305
1357
|
e.vignette.colorRgba.b,
|
|
1306
1358
|
e.vignette.colorRgba.a
|
|
1307
1359
|
) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
), 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;
|
|
1313
1365
|
}
|
|
1314
1366
|
}
|
|
1315
1367
|
updateColorCurve(e) {
|
|
@@ -1317,7 +1369,7 @@ class it {
|
|
|
1317
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;
|
|
1318
1370
|
}
|
|
1319
1371
|
}
|
|
1320
|
-
|
|
1372
|
+
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1321
1373
|
return new Ne(n);
|
|
1322
1374
|
});
|
|
1323
1375
|
S.OnPluginActivatedObservable.add((n) => {
|
|
@@ -1327,35 +1379,35 @@ S.OnPluginActivatedObservable.add((n) => {
|
|
|
1327
1379
|
}
|
|
1328
1380
|
});
|
|
1329
1381
|
function O(n) {
|
|
1330
|
-
return new
|
|
1382
|
+
return new p(n.x, n.y, n.z);
|
|
1331
1383
|
}
|
|
1332
1384
|
function L(n) {
|
|
1333
1385
|
return { x: n.x, y: n.y, z: n.z };
|
|
1334
1386
|
}
|
|
1335
|
-
class
|
|
1387
|
+
class Wt {
|
|
1336
1388
|
constructor(e) {
|
|
1337
|
-
var
|
|
1389
|
+
var h;
|
|
1338
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 = () => {
|
|
1339
1391
|
if (!this.engine.views)
|
|
1340
1392
|
return;
|
|
1341
|
-
this.modelContainers.forEach((
|
|
1342
|
-
|
|
1393
|
+
this.modelContainers.forEach((l) => {
|
|
1394
|
+
l.updateDynamicTextures();
|
|
1343
1395
|
}), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1344
|
-
const
|
|
1345
|
-
!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);
|
|
1346
1398
|
}, this.configuration = new le(e);
|
|
1347
1399
|
const i = (() => {
|
|
1348
1400
|
if (!(e != null && e.noRender))
|
|
1349
1401
|
return this.configuration.createCanvas();
|
|
1350
1402
|
})(), s = "1.5.6";
|
|
1351
|
-
|
|
1403
|
+
Me.Configuration = {
|
|
1352
1404
|
decoder: {
|
|
1353
1405
|
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_wasm_wrapper_gltf.js`,
|
|
1354
1406
|
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.wasm`,
|
|
1355
1407
|
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.js`
|
|
1356
1408
|
}
|
|
1357
1409
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1358
|
-
const
|
|
1410
|
+
const r = console.log;
|
|
1359
1411
|
console.log = () => {
|
|
1360
1412
|
};
|
|
1361
1413
|
const o = i ? new fe(i, !0, {
|
|
@@ -1366,24 +1418,24 @@ class Ut {
|
|
|
1366
1418
|
audioEngine: !1,
|
|
1367
1419
|
stencil: this.configuration.highlights.enabled,
|
|
1368
1420
|
forceSRGBBufferSupportState: !0
|
|
1369
|
-
}) : new
|
|
1370
|
-
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(
|
|
1371
1423
|
this.scene,
|
|
1372
1424
|
!1,
|
|
1373
1425
|
this.camera
|
|
1374
1426
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1375
|
-
const
|
|
1427
|
+
const a = ie.CreateFromPrefilteredData(
|
|
1376
1428
|
this.configuration.scene.environment.file,
|
|
1377
1429
|
this.scene
|
|
1378
1430
|
);
|
|
1379
|
-
|
|
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(
|
|
1380
1432
|
this.configuration.options.renderingPipelineConfiguration
|
|
1381
|
-
) : (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(
|
|
1382
1434
|
this.scene,
|
|
1383
1435
|
this.configuration.emissiveGlowIntensity
|
|
1384
|
-
), this.initPromise = new Promise((
|
|
1436
|
+
), this.initPromise = new Promise((c) => {
|
|
1385
1437
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1386
|
-
this.initComplete = !0,
|
|
1438
|
+
this.initComplete = !0, c();
|
|
1387
1439
|
});
|
|
1388
1440
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1389
1441
|
}
|
|
@@ -1457,7 +1509,7 @@ class Ut {
|
|
|
1457
1509
|
};
|
|
1458
1510
|
}
|
|
1459
1511
|
setCameraPose(e) {
|
|
1460
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1512
|
+
this.scene && this.camera && (this.camera.target = new p(
|
|
1461
1513
|
e.target.x,
|
|
1462
1514
|
e.target.y,
|
|
1463
1515
|
e.target.z
|
|
@@ -1478,9 +1530,9 @@ class Ut {
|
|
|
1478
1530
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1479
1531
|
this.focusLostNotified = !1;
|
|
1480
1532
|
const s = () => {
|
|
1481
|
-
const
|
|
1533
|
+
const r = this.configuration;
|
|
1482
1534
|
this.camera.rerunFramingBehavior(() => {
|
|
1483
|
-
|
|
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();
|
|
1484
1536
|
});
|
|
1485
1537
|
};
|
|
1486
1538
|
this.scene.onAfterRenderObservable.addOnce(s);
|
|
@@ -1506,13 +1558,13 @@ class Ut {
|
|
|
1506
1558
|
0,
|
|
1507
1559
|
0,
|
|
1508
1560
|
0,
|
|
1509
|
-
|
|
1561
|
+
p.Zero(),
|
|
1510
1562
|
this.scene
|
|
1511
1563
|
);
|
|
1512
1564
|
try {
|
|
1513
|
-
const s = t.latDeg * Math.PI / 180,
|
|
1514
|
-
i.target = t.target ? new
|
|
1515
|
-
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(
|
|
1516
1568
|
this.engine,
|
|
1517
1569
|
i,
|
|
1518
1570
|
e,
|
|
@@ -1529,32 +1581,32 @@ class Ut {
|
|
|
1529
1581
|
const e = this.configuration;
|
|
1530
1582
|
if (!e)
|
|
1531
1583
|
return !0;
|
|
1532
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, s = e.camera.limits.min.beta,
|
|
1533
|
-
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)
|
|
1534
1586
|
return !0;
|
|
1535
|
-
const o = [t, i],
|
|
1536
|
-
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;
|
|
1537
1589
|
}
|
|
1538
1590
|
fireResizeEvent() {
|
|
1539
1591
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1540
1592
|
}
|
|
1541
1593
|
setHighlights(e, t) {
|
|
1542
1594
|
var s;
|
|
1543
|
-
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, {
|
|
1544
1596
|
isStroke: !0,
|
|
1545
1597
|
blurVerticalSize: 0.85,
|
|
1546
1598
|
blurHorizontalSize: 0.85
|
|
1547
1599
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1548
1600
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1549
|
-
e.forEach((
|
|
1601
|
+
e.forEach((r) => {
|
|
1550
1602
|
const o = this.scene.materials.find(
|
|
1551
|
-
(
|
|
1603
|
+
(a) => a.name === r.name && a.id === r.id
|
|
1552
1604
|
);
|
|
1553
1605
|
o && o.getBindedMeshes().forEach(
|
|
1554
|
-
(
|
|
1555
|
-
var
|
|
1556
|
-
return (
|
|
1557
|
-
|
|
1606
|
+
(a) => {
|
|
1607
|
+
var h;
|
|
1608
|
+
return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
|
|
1609
|
+
a,
|
|
1558
1610
|
i || w.FromHexString("#fcba03")
|
|
1559
1611
|
);
|
|
1560
1612
|
}
|
|
@@ -1565,7 +1617,7 @@ class Ut {
|
|
|
1565
1617
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1566
1618
|
}
|
|
1567
1619
|
loadModel(e, t) {
|
|
1568
|
-
const i = new
|
|
1620
|
+
const i = new it({
|
|
1569
1621
|
enablePicking: this.configuration.highlights.enabled,
|
|
1570
1622
|
modelDetails: e,
|
|
1571
1623
|
scene: this.scene,
|
|
@@ -1626,11 +1678,11 @@ class Ut {
|
|
|
1626
1678
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1627
1679
|
),
|
|
1628
1680
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1629
|
-
),
|
|
1630
|
-
return o.decompose(
|
|
1631
|
-
position: L(
|
|
1632
|
-
rotation: L(
|
|
1633
|
-
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)
|
|
1634
1686
|
};
|
|
1635
1687
|
}
|
|
1636
1688
|
updatePreviewOptions(e) {
|
|
@@ -1662,8 +1714,8 @@ class Ut {
|
|
|
1662
1714
|
export {
|
|
1663
1715
|
F as MaterialEffectMode,
|
|
1664
1716
|
I as ProductCameraRig,
|
|
1665
|
-
|
|
1717
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1666
1718
|
x as RenderingConfiguration,
|
|
1667
|
-
|
|
1668
|
-
|
|
1719
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1720
|
+
d as renderingPipelineDefaults
|
|
1669
1721
|
};
|