@spiffcommerce/preview 5.11.5 → 5.11.6-1
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 +215 -199
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -4,9 +4,9 @@ import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
|
4
4
|
import { SceneLoader as k } from "@babylonjs/core/Loading/sceneLoader";
|
|
5
5
|
import { CubeTexture as se } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
6
6
|
import { Color4 as v, Color3 as C } from "@babylonjs/core/Maths/math.color";
|
|
7
|
-
import { Vector3 as g, Quaternion as
|
|
7
|
+
import { Vector3 as g, Quaternion as y, Vector2 as re, Matrix as ae } from "@babylonjs/core/Maths/math.vector";
|
|
8
8
|
import { DracoCompression as Ae } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
9
|
-
import { Observable as
|
|
9
|
+
import { Observable as x } from "@babylonjs/core/Misc/observable";
|
|
10
10
|
import { Tools as Me } from "@babylonjs/core/Misc/tools";
|
|
11
11
|
import { Scene as xe } from "@babylonjs/core/scene";
|
|
12
12
|
import { GLTF2 as ye } from "@babylonjs/loaders/glTF";
|
|
@@ -40,33 +40,33 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
40
40
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
41
41
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
42
42
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
43
|
-
var D = /* @__PURE__ */ ((
|
|
43
|
+
var D = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(D || {}), q = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(q || {});
|
|
44
44
|
function ze() {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
45
|
+
const s = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
|
|
46
|
+
return s && e && t;
|
|
47
47
|
}
|
|
48
48
|
const ce = /* @__PURE__ */ new Map();
|
|
49
|
-
async function z(
|
|
50
|
-
const i = await ce.get(
|
|
49
|
+
async function z(s, e, t) {
|
|
50
|
+
const i = await ce.get(s);
|
|
51
51
|
if (i && i.scene.uid === e.uid)
|
|
52
52
|
return i;
|
|
53
53
|
const r = k.LoadAssetContainerAsync(
|
|
54
|
-
|
|
54
|
+
s,
|
|
55
55
|
void 0,
|
|
56
56
|
e,
|
|
57
57
|
t
|
|
58
58
|
);
|
|
59
|
-
return !ze() && ce.set(
|
|
59
|
+
return !ze() && ce.set(s, r), r;
|
|
60
60
|
}
|
|
61
|
-
k.OnPluginActivatedObservable.add((
|
|
62
|
-
|
|
61
|
+
k.OnPluginActivatedObservable.add((s) => {
|
|
62
|
+
s.name === "gltf" && (s.animationStartMode = Pe.NONE);
|
|
63
63
|
});
|
|
64
64
|
class de {
|
|
65
65
|
constructor(e) {
|
|
66
66
|
this.getSceneClearColor = () => {
|
|
67
|
-
var i, r,
|
|
67
|
+
var i, r, n, o;
|
|
68
68
|
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
69
|
-
if (this.customOptions && ((
|
|
69
|
+
if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
70
70
|
return new v(0, 0, 0, t).toLinearSpace();
|
|
71
71
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
72
72
|
const a = C.FromHexString(
|
|
@@ -101,14 +101,14 @@ class de {
|
|
|
101
101
|
* Configuration related to the scene
|
|
102
102
|
*/
|
|
103
103
|
get scene() {
|
|
104
|
-
var e, t, i, r,
|
|
104
|
+
var e, t, i, r, n;
|
|
105
105
|
return {
|
|
106
106
|
clearColor: this.getSceneClearColor(),
|
|
107
107
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
108
108
|
environment: {
|
|
109
109
|
file: (i = this.customOptions) == null ? void 0 : i.environmentFile,
|
|
110
110
|
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
111
|
-
rotationY: (((
|
|
111
|
+
rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
112
112
|
// Convert to radians
|
|
113
113
|
}
|
|
114
114
|
};
|
|
@@ -117,7 +117,7 @@ class de {
|
|
|
117
117
|
* Configuration related to the camera used to view and interact with the scene.
|
|
118
118
|
*/
|
|
119
119
|
get camera() {
|
|
120
|
-
var e, t, i, r,
|
|
120
|
+
var e, t, i, r, n, o, a, l, c, h, d, m, f;
|
|
121
121
|
return {
|
|
122
122
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
123
123
|
autoRotation: {
|
|
@@ -126,7 +126,7 @@ class de {
|
|
|
126
126
|
},
|
|
127
127
|
limits: {
|
|
128
128
|
min: {
|
|
129
|
-
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((
|
|
129
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
130
130
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
131
131
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
132
132
|
},
|
|
@@ -161,12 +161,12 @@ class de {
|
|
|
161
161
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
class
|
|
164
|
+
class M {
|
|
165
165
|
/**
|
|
166
166
|
* Returns the resolution expected for generated textures.
|
|
167
167
|
*/
|
|
168
168
|
static getDynamicTextureResolution(e = !1) {
|
|
169
|
-
return e ? { width: 1, height: 1 } : this.getIsMobile() || !
|
|
169
|
+
return e ? { width: 1, height: 1 } : this.getIsMobile() || !M.offscreenRenderingSupported() ? {
|
|
170
170
|
width: 1024,
|
|
171
171
|
height: 1024
|
|
172
172
|
} : {
|
|
@@ -275,9 +275,9 @@ class Ve {
|
|
|
275
275
|
e,
|
|
276
276
|
t,
|
|
277
277
|
function(r) {
|
|
278
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
279
|
-
const o = t.extras[
|
|
280
|
-
r.metadata[
|
|
278
|
+
t.extras && Object.keys(t.extras).forEach((n) => {
|
|
279
|
+
const o = t.extras[n];
|
|
280
|
+
r.metadata[n] = o;
|
|
281
281
|
}), i(r);
|
|
282
282
|
}
|
|
283
283
|
);
|
|
@@ -336,51 +336,51 @@ class Ve {
|
|
|
336
336
|
* @param scene The scene to parse.
|
|
337
337
|
*/
|
|
338
338
|
applyReflections(e) {
|
|
339
|
-
function t(
|
|
339
|
+
function t(n) {
|
|
340
340
|
const o = [];
|
|
341
|
-
return
|
|
341
|
+
return n.transformNodes.forEach((a) => {
|
|
342
342
|
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
343
|
-
}),
|
|
343
|
+
}), n.meshes.forEach((a) => {
|
|
344
344
|
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
345
345
|
}), o;
|
|
346
346
|
}
|
|
347
|
-
function i(
|
|
348
|
-
const a =
|
|
347
|
+
function i(n, o = 1) {
|
|
348
|
+
const a = n.material;
|
|
349
349
|
if (!a)
|
|
350
350
|
return;
|
|
351
351
|
const l = new Re(
|
|
352
352
|
"mirror",
|
|
353
|
-
|
|
353
|
+
M.getMirrorTextureResolution(),
|
|
354
354
|
e,
|
|
355
355
|
!0
|
|
356
356
|
);
|
|
357
357
|
l.renderList = t(e);
|
|
358
|
-
const c =
|
|
358
|
+
const c = n.getVerticesData("normal");
|
|
359
359
|
if (!c)
|
|
360
360
|
throw new Error(
|
|
361
|
-
"Mirror attribute specified on: " +
|
|
361
|
+
"Mirror attribute specified on: " + n.name + "But no normals exist to generate a mirror from!"
|
|
362
362
|
);
|
|
363
|
-
|
|
364
|
-
const h =
|
|
363
|
+
n.computeWorldMatrix(!0);
|
|
364
|
+
const h = n.getWorldMatrix(), d = oe.TransformNormal(
|
|
365
365
|
new oe(c[0], c[1], c[2]),
|
|
366
366
|
h
|
|
367
367
|
).normalize(), m = Te.FromPositionAndNormal(
|
|
368
|
-
|
|
368
|
+
n.position,
|
|
369
369
|
d.scale(-1)
|
|
370
370
|
);
|
|
371
371
|
l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
|
|
372
372
|
}
|
|
373
|
-
function r(
|
|
374
|
-
const o =
|
|
373
|
+
function r(n) {
|
|
374
|
+
const o = n.material, a = new Oe(
|
|
375
375
|
"probe-" + o.name,
|
|
376
376
|
Ge,
|
|
377
377
|
e
|
|
378
378
|
);
|
|
379
|
-
a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(
|
|
379
|
+
a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
380
380
|
}
|
|
381
|
-
e.meshes.forEach((
|
|
382
|
-
const o =
|
|
383
|
-
o && (o.mirrorTexture && i(
|
|
381
|
+
e.meshes.forEach((n) => {
|
|
382
|
+
const o = n.metadata;
|
|
383
|
+
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
386
|
}
|
|
@@ -406,12 +406,12 @@ class _e {
|
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function He(
|
|
410
|
-
t.forEach((
|
|
411
|
-
const o =
|
|
409
|
+
function He(s, e, t, i, r = "") {
|
|
410
|
+
t.forEach((n) => {
|
|
411
|
+
const o = n.getID(), a = n.getName(), l = n.getPanelSize && n.getPanelSize(), c = M.getDynamicTextureResolution(
|
|
412
412
|
(l == null ? void 0 : l.width) === 1 || (l == null ? void 0 : l.height) === 1
|
|
413
413
|
);
|
|
414
|
-
|
|
414
|
+
s.filter((d) => d.name === r + a).forEach((d) => {
|
|
415
415
|
const m = i.get(o), f = !1;
|
|
416
416
|
if (m)
|
|
417
417
|
ue(d, m), m.update(f);
|
|
@@ -422,7 +422,7 @@ function He(n, e, t, i, r = "") {
|
|
|
422
422
|
c.width,
|
|
423
423
|
c.height
|
|
424
424
|
);
|
|
425
|
-
i.set(o, p),
|
|
425
|
+
i.set(o, p), n.setStaticContext(
|
|
426
426
|
p.getContext()
|
|
427
427
|
), ue(d, p), p.onLoadObservable.addOnce(() => {
|
|
428
428
|
p.update(f);
|
|
@@ -431,45 +431,45 @@ function He(n, e, t, i, r = "") {
|
|
|
431
431
|
});
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
function Ue(
|
|
434
|
+
function Ue(s, e, t, i) {
|
|
435
435
|
const r = new Se(
|
|
436
|
-
|
|
436
|
+
s,
|
|
437
437
|
{ width: t, height: i },
|
|
438
438
|
e,
|
|
439
|
-
|
|
439
|
+
M.shouldMipMap(),
|
|
440
440
|
Be.TRILINEAR_SAMPLINGMODE,
|
|
441
441
|
B.TEXTUREFORMAT_RGBA
|
|
442
|
-
),
|
|
443
|
-
return
|
|
442
|
+
), n = r.getContext();
|
|
443
|
+
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
|
|
444
444
|
}
|
|
445
|
-
function ue(
|
|
446
|
-
if (
|
|
447
|
-
const t =
|
|
445
|
+
function ue(s, e) {
|
|
446
|
+
if (s instanceof N) {
|
|
447
|
+
const t = s, i = t.albedoTexture;
|
|
448
448
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
449
449
|
} else {
|
|
450
|
-
const t =
|
|
450
|
+
const t = s, i = t.diffuseTexture;
|
|
451
451
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
function Ke() {
|
|
455
|
-
const
|
|
456
|
-
return
|
|
455
|
+
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
456
|
+
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
457
457
|
}
|
|
458
|
-
const
|
|
459
|
-
function ge(
|
|
460
|
-
return
|
|
458
|
+
const P = 60, me = 1;
|
|
459
|
+
function ge(s) {
|
|
460
|
+
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
461
461
|
}
|
|
462
|
-
function ve(
|
|
463
|
-
const o = r ?
|
|
462
|
+
function ve(s, e, t, i, r, n) {
|
|
463
|
+
const o = r ? s.filter((h) => h.name === r) : s;
|
|
464
464
|
if (o.length === 0) {
|
|
465
465
|
console.warn(`No animations found for name: ${r}`);
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
let a = 0;
|
|
469
469
|
const l = () => {
|
|
470
|
-
a++, a === o.length &&
|
|
470
|
+
a++, a === o.length && n && n();
|
|
471
471
|
}, c = (h, d, m, f, p) => {
|
|
472
|
-
h.stop(), h.start(d, m, f, p),
|
|
472
|
+
h.stop(), h.start(d, m, f, p), n && (d == !1 || d === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
|
|
473
473
|
l();
|
|
474
474
|
}) : h.onAnimationLoopObservable.addOnce(() => {
|
|
475
475
|
l();
|
|
@@ -487,19 +487,19 @@ function ve(n, e, t, i, r, s) {
|
|
|
487
487
|
c(h, e, me, m, f);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
|
-
function We(
|
|
491
|
-
|
|
490
|
+
function We(s) {
|
|
491
|
+
s.forEach((e) => {
|
|
492
492
|
e.reset(), e.stop();
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
const e =
|
|
495
|
+
function $e(s) {
|
|
496
|
+
const e = s.animationGroups;
|
|
497
497
|
We(e);
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function Qe(s, e, t) {
|
|
500
500
|
return new Promise((i) => {
|
|
501
|
-
|
|
502
|
-
const r = [],
|
|
501
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
|
|
502
|
+
const r = [], n = t.target;
|
|
503
503
|
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
504
504
|
T(
|
|
505
505
|
"cameraTargetLerp",
|
|
@@ -542,10 +542,10 @@ function Ye(n, e, t) {
|
|
|
542
542
|
}
|
|
543
543
|
e.animations.push(...r);
|
|
544
544
|
const a = e.useAutoRotationBehavior;
|
|
545
|
-
e.disableAutoRotationBehavior(),
|
|
545
|
+
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
546
546
|
e,
|
|
547
547
|
0,
|
|
548
|
-
|
|
548
|
+
n ? P * 2 : P,
|
|
549
549
|
!1,
|
|
550
550
|
1,
|
|
551
551
|
() => {
|
|
@@ -554,33 +554,36 @@ function Ye(n, e, t) {
|
|
|
554
554
|
);
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
function pe(
|
|
558
|
-
return
|
|
557
|
+
function pe(s) {
|
|
558
|
+
return s * Math.PI / 180;
|
|
559
559
|
}
|
|
560
|
-
function T(
|
|
560
|
+
function T(s, e, t, i, r, n = 0, o = A.ANIMATIONLOOPMODE_CONSTANT) {
|
|
561
561
|
const a = new De();
|
|
562
562
|
a.setEasingMode(qe.EASINGMODE_EASEINOUT);
|
|
563
563
|
const l = new A(
|
|
564
|
-
|
|
564
|
+
s,
|
|
565
565
|
e,
|
|
566
|
-
|
|
566
|
+
P,
|
|
567
567
|
r,
|
|
568
568
|
o
|
|
569
569
|
), c = [];
|
|
570
|
-
return
|
|
571
|
-
frame:
|
|
570
|
+
return n > 0 && c.push({ frame: 0, value: t }), c.push({ frame: P * n, value: t }), c.push({
|
|
571
|
+
frame: P * (n + 1),
|
|
572
572
|
value: i
|
|
573
573
|
}), l.setKeys(c), l.setEasingFunction(a), l;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
575
|
+
function Ye(s, e, t) {
|
|
576
|
+
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
|
|
578
|
+
function Ze(s, e, t) {
|
|
579
|
+
s.forEach((i) => {
|
|
580
580
|
t && i.name !== t || i.goToFrame(e);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
const je = {
|
|
583
|
+
const je = (s, e = 512, t, i) => {
|
|
584
|
+
const r = s.includes("?") ? "&" : "?", n = [`w=${e}`, `h=${e}`];
|
|
585
|
+
return i !== void 0 && n.push(`q=${i}`), t && n.push(`format=${t}`), `${s}${r}${n.join("&")}`;
|
|
586
|
+
}, Xe = {
|
|
584
587
|
albedoTexture: "albedoMap",
|
|
585
588
|
bumpTexture: "normalMap",
|
|
586
589
|
ambientTexture: "ambientMap",
|
|
@@ -590,7 +593,7 @@ const je = {
|
|
|
590
593
|
refractionTexture: "refractionMap",
|
|
591
594
|
reflectionTexture: "reflectionMap"
|
|
592
595
|
};
|
|
593
|
-
function
|
|
596
|
+
function Je(s, e, t, i) {
|
|
594
597
|
[
|
|
595
598
|
"albedoTexture",
|
|
596
599
|
"bumpTexture",
|
|
@@ -600,51 +603,64 @@ function Xe(n, e, t, i) {
|
|
|
600
603
|
"metallicTexture",
|
|
601
604
|
"refractionTexture",
|
|
602
605
|
"reflectionTexture"
|
|
603
|
-
].forEach((
|
|
604
|
-
|
|
605
|
-
s,
|
|
606
|
+
].forEach((n) => {
|
|
607
|
+
et(
|
|
606
608
|
n,
|
|
609
|
+
s,
|
|
607
610
|
e,
|
|
608
611
|
t,
|
|
609
612
|
i
|
|
610
613
|
);
|
|
611
|
-
}),
|
|
614
|
+
}), nt(s, e);
|
|
612
615
|
}
|
|
613
|
-
function
|
|
614
|
-
const
|
|
615
|
-
if (!
|
|
616
|
+
function et(s, e, t, i, r) {
|
|
617
|
+
const n = Xe[s];
|
|
618
|
+
if (!n)
|
|
616
619
|
throw new Error("Unexpected texture name encountered.");
|
|
617
|
-
const o = e[
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
620
|
+
const o = e[n], a = o == null ? void 0 : o.fileLink;
|
|
621
|
+
if (a)
|
|
622
|
+
if (s === "reflectionTexture")
|
|
623
|
+
a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
624
|
+
s,
|
|
625
|
+
a,
|
|
626
|
+
void 0,
|
|
627
|
+
!1,
|
|
628
|
+
void 0,
|
|
629
|
+
!0
|
|
630
|
+
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
631
|
+
s,
|
|
632
|
+
a,
|
|
633
|
+
128,
|
|
634
|
+
!1,
|
|
635
|
+
!0,
|
|
636
|
+
!1
|
|
637
|
+
) : i.addTextureTask(s, a, !1, !1);
|
|
638
|
+
else {
|
|
639
|
+
const l = M.getDynamicTextureResolution(!1);
|
|
640
|
+
i.addTextureTask(
|
|
641
|
+
s,
|
|
642
|
+
je(a, l.width, "webp", 80),
|
|
643
|
+
!1,
|
|
644
|
+
!1
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
else
|
|
648
|
+
r && t[s] && (t[s] && t[s].dispose(), t[s] = null, tt(s, t));
|
|
633
649
|
}
|
|
634
|
-
function
|
|
635
|
-
|
|
650
|
+
function tt(s, e) {
|
|
651
|
+
s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), s === "reflectionTexture" && (e.environmentIntensity = 1), s === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new C(0, 0, 0), e.reflectionTexture);
|
|
636
652
|
}
|
|
637
|
-
function
|
|
653
|
+
function it(s, e, t, i) {
|
|
638
654
|
if (!e) {
|
|
639
655
|
console.error("Failed to apply texture to material: material is null.");
|
|
640
656
|
return;
|
|
641
657
|
}
|
|
642
|
-
|
|
658
|
+
s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), s === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[s] = i, s === "emissiveTexture" && (e.emissiveColor = new C(1, 1, 1), e.emissiveIntensity = 1);
|
|
643
659
|
}
|
|
644
|
-
function
|
|
645
|
-
|
|
660
|
+
function nt(s, e) {
|
|
661
|
+
s.clearCoat && (s.clearCoat === q.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === q.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
646
662
|
}
|
|
647
|
-
class
|
|
663
|
+
class st {
|
|
648
664
|
constructor(e, t, i) {
|
|
649
665
|
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;
|
|
650
666
|
}
|
|
@@ -658,7 +674,7 @@ class nt {
|
|
|
658
674
|
* where we want to undo changes are remove effects from display.
|
|
659
675
|
*/
|
|
660
676
|
async applyMaterial(e, t, i, r) {
|
|
661
|
-
return new Promise((
|
|
677
|
+
return new Promise((n) => {
|
|
662
678
|
const o = this.materialVariantMap.get(e);
|
|
663
679
|
this.materialVariantMap.set(e, {
|
|
664
680
|
...o,
|
|
@@ -668,12 +684,12 @@ class nt {
|
|
|
668
684
|
(h) => h.name === a
|
|
669
685
|
);
|
|
670
686
|
if (l.length === 0) {
|
|
671
|
-
|
|
687
|
+
n();
|
|
672
688
|
return;
|
|
673
689
|
}
|
|
674
690
|
const c = new ke(this.scene);
|
|
675
691
|
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
676
|
-
(h) =>
|
|
692
|
+
(h) => Je(
|
|
677
693
|
t,
|
|
678
694
|
h,
|
|
679
695
|
c,
|
|
@@ -687,14 +703,14 @@ class nt {
|
|
|
687
703
|
i && i(100, 100, d.name), this.scene.materials.filter(
|
|
688
704
|
(p) => p.name === a
|
|
689
705
|
).forEach((p) => {
|
|
690
|
-
|
|
706
|
+
it(
|
|
691
707
|
d.name,
|
|
692
708
|
p,
|
|
693
709
|
t,
|
|
694
710
|
m.texture
|
|
695
711
|
);
|
|
696
712
|
});
|
|
697
|
-
}),
|
|
713
|
+
}), n();
|
|
698
714
|
}, c.loadAsync();
|
|
699
715
|
});
|
|
700
716
|
}
|
|
@@ -708,7 +724,7 @@ class nt {
|
|
|
708
724
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
709
725
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
710
726
|
*/
|
|
711
|
-
async applyModel(e, t, i, r,
|
|
727
|
+
async applyModel(e, t, i, r, n, o, a) {
|
|
712
728
|
var m, f, p;
|
|
713
729
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
714
730
|
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (m = this.loadedContainerForKey.get(e)) == null || m.dispose(), this.loadedContainerForKey.delete(e), (f = this.loadedMaterialsForKey.get(e)) == null || f.forEach((b) => b.dispose()), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
@@ -719,7 +735,7 @@ class nt {
|
|
|
719
735
|
!0
|
|
720
736
|
);
|
|
721
737
|
this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), (p = this.loadedMaterialsForKey.get(e)) == null || p.forEach((b) => b.dispose()), this.loadedMaterialsForKey.delete(e));
|
|
722
|
-
const h =
|
|
738
|
+
const h = n && n();
|
|
723
739
|
if (h) {
|
|
724
740
|
const b = o && o(), w = h.name ? this.renameClonedAsset(h.name) : void 0;
|
|
725
741
|
if (ve(
|
|
@@ -730,7 +746,7 @@ class nt {
|
|
|
730
746
|
w
|
|
731
747
|
), b != null) {
|
|
732
748
|
const R = a && a() || !0;
|
|
733
|
-
|
|
749
|
+
Ze(
|
|
734
750
|
c.animationGroups,
|
|
735
751
|
b + (R ? 2 : 0),
|
|
736
752
|
w
|
|
@@ -763,36 +779,36 @@ class nt {
|
|
|
763
779
|
}), e;
|
|
764
780
|
}
|
|
765
781
|
}
|
|
766
|
-
function we(
|
|
782
|
+
function we(s) {
|
|
767
783
|
const e = [];
|
|
768
|
-
return
|
|
784
|
+
return s.rootNodes.forEach((t) => {
|
|
769
785
|
t.getChildMeshes().forEach((i) => {
|
|
770
786
|
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
771
|
-
const
|
|
772
|
-
|
|
787
|
+
const n = r.getMaterial(!1);
|
|
788
|
+
n && !e.includes(n) && e.push(n);
|
|
773
789
|
});
|
|
774
790
|
});
|
|
775
791
|
}), e;
|
|
776
792
|
}
|
|
777
|
-
function fe(
|
|
778
|
-
return
|
|
793
|
+
function fe(s, e = "") {
|
|
794
|
+
return s.map((t) => ({
|
|
779
795
|
name: t.name.substring(e.length),
|
|
780
796
|
loop: t.loopAnimation,
|
|
781
797
|
to: t.to,
|
|
782
798
|
from: t.from
|
|
783
799
|
}));
|
|
784
800
|
}
|
|
785
|
-
class
|
|
801
|
+
class rt {
|
|
786
802
|
constructor(e) {
|
|
787
|
-
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new
|
|
803
|
+
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new x(), this.materialDeselectedObservable = new x(), this.materialVariantObservable = new x(), this.modelVariantObservable = new x(), this.materialReadyToLoadCallbacks = /* @__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 = [];
|
|
788
804
|
const {
|
|
789
805
|
enablePicking: t,
|
|
790
806
|
modelDetails: i,
|
|
791
807
|
previewService: r,
|
|
792
|
-
progressHandler:
|
|
808
|
+
progressHandler: n,
|
|
793
809
|
scene: o
|
|
794
810
|
} = e;
|
|
795
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new
|
|
811
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new st(
|
|
796
812
|
o,
|
|
797
813
|
this.renameClonedAsset.bind(this),
|
|
798
814
|
this.setBaseModelEnabled.bind(this)
|
|
@@ -805,7 +821,7 @@ class st {
|
|
|
805
821
|
return this.assetContainer = await z(
|
|
806
822
|
i.model,
|
|
807
823
|
o,
|
|
808
|
-
|
|
824
|
+
n
|
|
809
825
|
), await this.instantiate(), this;
|
|
810
826
|
};
|
|
811
827
|
this.importPromise = a();
|
|
@@ -844,7 +860,7 @@ class st {
|
|
|
844
860
|
}
|
|
845
861
|
return;
|
|
846
862
|
}
|
|
847
|
-
const
|
|
863
|
+
const n = async () => {
|
|
848
864
|
await this.variantManager.applyMaterial(
|
|
849
865
|
e,
|
|
850
866
|
i,
|
|
@@ -861,18 +877,18 @@ class st {
|
|
|
861
877
|
if (this.materialChangesInProgress.includes(e)) {
|
|
862
878
|
if (this.queuedMaterialChanges.has(e)) {
|
|
863
879
|
const o = this.queuedMaterialChanges.get(e);
|
|
864
|
-
o == null || o.set(t,
|
|
880
|
+
o == null || o.set(t, n);
|
|
865
881
|
} else {
|
|
866
882
|
this.queuedMaterialChanges.set(
|
|
867
883
|
e,
|
|
868
884
|
/* @__PURE__ */ new Map()
|
|
869
885
|
);
|
|
870
886
|
const o = this.queuedMaterialChanges.get(e);
|
|
871
|
-
o == null || o.set(t,
|
|
887
|
+
o == null || o.set(t, n);
|
|
872
888
|
}
|
|
873
889
|
return;
|
|
874
890
|
}
|
|
875
|
-
if (this.materialChangesInProgress.push(e), await
|
|
891
|
+
if (this.materialChangesInProgress.push(e), await n(), this.queuedMaterialChanges.has(e)) {
|
|
876
892
|
const o = this.queuedMaterialChanges.get(e);
|
|
877
893
|
if (!o)
|
|
878
894
|
throw new Error("Target material is undefined");
|
|
@@ -899,7 +915,7 @@ class st {
|
|
|
899
915
|
this.getLastRequestedAnimation.bind(this),
|
|
900
916
|
this.getCurrentAnimationFrame.bind(this),
|
|
901
917
|
this.getAnimationIsPlaying.bind(this)
|
|
902
|
-
),
|
|
918
|
+
), n = async () => {
|
|
903
919
|
this.modelChangesInProgress.push(e);
|
|
904
920
|
let a = await r();
|
|
905
921
|
if (this.queuedModelChanges.has(e)) {
|
|
@@ -921,7 +937,7 @@ class st {
|
|
|
921
937
|
this.queuedModelChanges.set(e, a);
|
|
922
938
|
return;
|
|
923
939
|
}
|
|
924
|
-
const o = await
|
|
940
|
+
const o = await n();
|
|
925
941
|
this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
926
942
|
}
|
|
927
943
|
dispose() {
|
|
@@ -934,7 +950,7 @@ class st {
|
|
|
934
950
|
let i = () => {
|
|
935
951
|
};
|
|
936
952
|
const r = async () => {
|
|
937
|
-
this.isExecutingAnimation = !0, await new Promise((
|
|
953
|
+
this.isExecutingAnimation = !0, await new Promise((n) => {
|
|
938
954
|
var a;
|
|
939
955
|
const o = [
|
|
940
956
|
...((a = this.modelInstance) == null ? void 0 : a.animationGroups) || [],
|
|
@@ -946,12 +962,12 @@ class st {
|
|
|
946
962
|
e.to,
|
|
947
963
|
e.from,
|
|
948
964
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
949
|
-
|
|
965
|
+
n
|
|
950
966
|
);
|
|
951
967
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, i();
|
|
952
968
|
};
|
|
953
|
-
return t ? (
|
|
954
|
-
i =
|
|
969
|
+
return t ? ($e(this.scene), r()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = r, new Promise((n) => {
|
|
970
|
+
i = n;
|
|
955
971
|
})) : r();
|
|
956
972
|
}
|
|
957
973
|
getAnimations(e) {
|
|
@@ -961,7 +977,7 @@ class st {
|
|
|
961
977
|
this.variantManager.getAnimationGroups(),
|
|
962
978
|
this.renameClonedAsset("")
|
|
963
979
|
) : []
|
|
964
|
-
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((
|
|
980
|
+
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((n) => n.name === t.name)) == i);
|
|
965
981
|
}
|
|
966
982
|
getId() {
|
|
967
983
|
return this.id;
|
|
@@ -1007,7 +1023,7 @@ class st {
|
|
|
1007
1023
|
set rotation(e) {
|
|
1008
1024
|
if (!this.transformRoot)
|
|
1009
1025
|
throw new Error("ModelContainer disposed prior to setting rotation!");
|
|
1010
|
-
this.transformRoot.rotationQuaternion =
|
|
1026
|
+
this.transformRoot.rotationQuaternion = y.FromEulerAngles(
|
|
1011
1027
|
e.x,
|
|
1012
1028
|
e.y,
|
|
1013
1029
|
e.z
|
|
@@ -1069,19 +1085,19 @@ class st {
|
|
|
1069
1085
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1070
1086
|
}
|
|
1071
1087
|
configureModelInstance(e) {
|
|
1072
|
-
var
|
|
1088
|
+
var n;
|
|
1073
1089
|
if (!this.transformRoot)
|
|
1074
1090
|
throw new Error(
|
|
1075
1091
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1076
1092
|
);
|
|
1077
1093
|
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1078
|
-
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion =
|
|
1094
|
+
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = g.One();
|
|
1079
1095
|
for (const o of e.rootNodes) {
|
|
1080
1096
|
o.parent = this.transformRoot;
|
|
1081
1097
|
for (const a of o.getChildMeshes(!1))
|
|
1082
1098
|
a.alwaysSelectAsActiveMesh = !0;
|
|
1083
1099
|
}
|
|
1084
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((
|
|
1100
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((n = this.contextService) == null ? void 0 : n.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1085
1101
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1086
1102
|
this.scene,
|
|
1087
1103
|
this.canvasPanels,
|
|
@@ -1188,13 +1204,13 @@ class st {
|
|
|
1188
1204
|
//#endregion
|
|
1189
1205
|
}
|
|
1190
1206
|
class G extends be {
|
|
1191
|
-
constructor(e, t, i, r,
|
|
1207
|
+
constructor(e, t, i, r, n, o, a, l) {
|
|
1192
1208
|
super(
|
|
1193
1209
|
e,
|
|
1194
1210
|
t,
|
|
1195
1211
|
i,
|
|
1196
1212
|
r,
|
|
1197
|
-
|
|
1213
|
+
n,
|
|
1198
1214
|
o,
|
|
1199
1215
|
l
|
|
1200
1216
|
), this.lastFocus = new g(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, 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(
|
|
@@ -1252,10 +1268,10 @@ class G extends be {
|
|
|
1252
1268
|
i.framingTime = t || 800;
|
|
1253
1269
|
const r = () => {
|
|
1254
1270
|
this.isRunningFramingBehavior = !1;
|
|
1255
|
-
},
|
|
1271
|
+
}, n = I(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
|
|
1256
1272
|
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(
|
|
1257
|
-
|
|
1258
|
-
|
|
1273
|
+
n.min,
|
|
1274
|
+
n.max,
|
|
1259
1275
|
void 0,
|
|
1260
1276
|
r
|
|
1261
1277
|
), i.framingTime = 0;
|
|
@@ -1289,32 +1305,32 @@ class G extends be {
|
|
|
1289
1305
|
*/
|
|
1290
1306
|
static create(e, t, i) {
|
|
1291
1307
|
var l;
|
|
1292
|
-
const r = I(e),
|
|
1308
|
+
const r = I(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new G(
|
|
1293
1309
|
"ProductCamera",
|
|
1294
1310
|
-(Math.PI / 2),
|
|
1295
1311
|
Math.PI / 2,
|
|
1296
|
-
|
|
1312
|
+
n.length() * 1.5,
|
|
1297
1313
|
o,
|
|
1298
1314
|
e,
|
|
1299
1315
|
t
|
|
1300
1316
|
);
|
|
1301
1317
|
return a.setPanEnabled(
|
|
1302
1318
|
((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1303
|
-
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator =
|
|
1319
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1304
1320
|
a.setPanEnabled(a.panEnabled);
|
|
1305
1321
|
}), i && (e.activeCamera = a), a;
|
|
1306
1322
|
}
|
|
1307
1323
|
}
|
|
1308
|
-
function I(
|
|
1309
|
-
if (
|
|
1324
|
+
function I(s) {
|
|
1325
|
+
if (s.meshes.length === 0)
|
|
1310
1326
|
return {
|
|
1311
1327
|
min: new g(-1, -1, -1),
|
|
1312
1328
|
max: new g(1, 1, 1)
|
|
1313
1329
|
};
|
|
1314
|
-
const e =
|
|
1315
|
-
return
|
|
1330
|
+
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1331
|
+
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1316
1332
|
}
|
|
1317
|
-
class
|
|
1333
|
+
class at {
|
|
1318
1334
|
constructor(e, t = !1, i = void 0) {
|
|
1319
1335
|
this.renderingPipeline = new Ne(
|
|
1320
1336
|
"default",
|
|
@@ -1332,9 +1348,9 @@ class rt {
|
|
|
1332
1348
|
return this.currentConfiguration;
|
|
1333
1349
|
}
|
|
1334
1350
|
setConfiguration(e) {
|
|
1335
|
-
var t, i, r,
|
|
1351
|
+
var t, i, r, n, o, a, l, c, h, d, m, f, p, b, w, R, V, _, H, U, K, W, $, Q, Y, Z, j, X, J, ee, te, ie, ne;
|
|
1336
1352
|
if (this.renderingPipeline.isSupported) {
|
|
1337
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? u.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? u.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? u.bloom.enabled, this.renderingPipeline.bloomKernel = ((
|
|
1353
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? u.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? u.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? u.bloom.enabled, this.renderingPipeline.bloomKernel = ((n = e.bloom) == null ? void 0 : n.kernel) ?? u.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? u.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? u.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? u.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? u.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? u.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((d = e.chromaticAberration) == null ? void 0 : d.radialIntensity) ?? u.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new re(
|
|
1338
1354
|
e.chromaticAberration.direction.x,
|
|
1339
1355
|
e.chromaticAberration.direction.y
|
|
1340
1356
|
) : new re(
|
|
@@ -1352,7 +1368,7 @@ class rt {
|
|
|
1352
1368
|
this.renderingPipeline.depthOfFieldBlurLevel = L.High;
|
|
1353
1369
|
break;
|
|
1354
1370
|
}
|
|
1355
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? u.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? u.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? u.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? u.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? u.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? u.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? u.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? u.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? u.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((
|
|
1371
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? u.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? u.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? u.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? u.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? u.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? u.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? u.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? u.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? u.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = (($ = e.misc) == null ? void 0 : $.toneMappingEnabled) ?? u.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1356
1372
|
switch (e.misc.toneMappingType ?? u.misc.toneMappingType) {
|
|
1357
1373
|
case "Standard":
|
|
1358
1374
|
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
|
|
@@ -1361,7 +1377,7 @@ class rt {
|
|
|
1361
1377
|
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_ACES;
|
|
1362
1378
|
break;
|
|
1363
1379
|
}
|
|
1364
|
-
if (this.renderingPipeline.sharpenEnabled = ((
|
|
1380
|
+
if (this.renderingPipeline.sharpenEnabled = ((Q = e.sharpen) == null ? void 0 : Q.enabled) ?? u.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? u.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? u.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((j = e.vignette) == null ? void 0 : j.enabled) ?? u.vignette.enabled, (X = e.vignette) != null && X.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = u.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = u.vignette.center.y), e.vignette)
|
|
1365
1381
|
switch (((J = e.vignette) == null ? void 0 : J.blendMode) ?? u.vignette.blendMode) {
|
|
1366
1382
|
case "Multiply":
|
|
1367
1383
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = E.VIGNETTEMODE_MULTIPLY;
|
|
@@ -1388,25 +1404,25 @@ class rt {
|
|
|
1388
1404
|
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;
|
|
1389
1405
|
}
|
|
1390
1406
|
}
|
|
1391
|
-
ye.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1392
|
-
return new Ve(
|
|
1407
|
+
ye.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1408
|
+
return new Ve(s);
|
|
1393
1409
|
});
|
|
1394
|
-
k.OnPluginActivatedObservable.add((
|
|
1395
|
-
if (
|
|
1396
|
-
const e =
|
|
1410
|
+
k.OnPluginActivatedObservable.add((s) => {
|
|
1411
|
+
if (s.name === "gltf") {
|
|
1412
|
+
const e = s;
|
|
1397
1413
|
e.transparencyAsCoverage = !0;
|
|
1398
1414
|
}
|
|
1399
1415
|
});
|
|
1400
|
-
function F(
|
|
1401
|
-
return new g(
|
|
1416
|
+
function F(s) {
|
|
1417
|
+
return new g(s.x, s.y, s.z);
|
|
1402
1418
|
}
|
|
1403
|
-
function S(
|
|
1404
|
-
return { x:
|
|
1419
|
+
function S(s) {
|
|
1420
|
+
return { x: s.x, y: s.y, z: s.z };
|
|
1405
1421
|
}
|
|
1406
1422
|
class Yt {
|
|
1407
1423
|
constructor(e) {
|
|
1408
1424
|
var a;
|
|
1409
|
-
this.focusLostNotified = !1, this.focusLostObservable = new
|
|
1425
|
+
this.focusLostNotified = !1, this.focusLostObservable = new x(), this.modelLoadEventCallbacks = [], this.validHighlightMaterials = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1410
1426
|
if (!this.engine.views)
|
|
1411
1427
|
return;
|
|
1412
1428
|
this.modelContainers.forEach((h) => {
|
|
@@ -1438,7 +1454,7 @@ class Yt {
|
|
|
1438
1454
|
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1439
1455
|
}
|
|
1440
1456
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1441
|
-
const
|
|
1457
|
+
const n = console.log;
|
|
1442
1458
|
console.log = () => {
|
|
1443
1459
|
};
|
|
1444
1460
|
const o = i ? new B(i, !0, {
|
|
@@ -1450,7 +1466,7 @@ class Yt {
|
|
|
1450
1466
|
stencil: this.configuration.highlights.enabled,
|
|
1451
1467
|
forceSRGBBufferSupportState: !0
|
|
1452
1468
|
}) : new Ce();
|
|
1453
|
-
if (o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log =
|
|
1469
|
+
if (o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.camera = G.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new at(
|
|
1454
1470
|
this.scene,
|
|
1455
1471
|
!1,
|
|
1456
1472
|
this.camera
|
|
@@ -1518,7 +1534,7 @@ class Yt {
|
|
|
1518
1534
|
let t = () => {
|
|
1519
1535
|
};
|
|
1520
1536
|
const i = async () => {
|
|
1521
|
-
this.isAnimatingCamera = !0, await
|
|
1537
|
+
this.isAnimatingCamera = !0, await Qe(
|
|
1522
1538
|
this.scene,
|
|
1523
1539
|
this.scene.activeCamera,
|
|
1524
1540
|
e
|
|
@@ -1563,9 +1579,9 @@ class Yt {
|
|
|
1563
1579
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1564
1580
|
this.focusLostNotified = !1;
|
|
1565
1581
|
const r = () => {
|
|
1566
|
-
const
|
|
1582
|
+
const n = this.configuration;
|
|
1567
1583
|
this.camera.rerunFramingBehavior(() => {
|
|
1568
|
-
|
|
1584
|
+
n.camera.limits.min.radius && (this.camera.lowerRadiusLimit = n.camera.limits.min.radius), n.camera.limits.max.radius && (this.camera.upperRadiusLimit = n.camera.limits.max.radius), i();
|
|
1569
1585
|
});
|
|
1570
1586
|
};
|
|
1571
1587
|
this.scene.onAfterRenderObservable.addOnce(r);
|
|
@@ -1597,8 +1613,8 @@ class Yt {
|
|
|
1597
1613
|
0,
|
|
1598
1614
|
g.Zero(),
|
|
1599
1615
|
this.scene
|
|
1600
|
-
), r = t.latDeg * Math.PI / 180,
|
|
1601
|
-
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha =
|
|
1616
|
+
), r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
|
|
1617
|
+
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = n, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01;
|
|
1602
1618
|
try {
|
|
1603
1619
|
return await new Promise((o) => {
|
|
1604
1620
|
const a = this.scene.onBeforeRenderObservable.add(async () => {
|
|
@@ -1623,10 +1639,10 @@ class Yt {
|
|
|
1623
1639
|
const e = this.configuration;
|
|
1624
1640
|
if (!e)
|
|
1625
1641
|
return !0;
|
|
1626
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta,
|
|
1627
|
-
if (t === void 0 || i === void 0 || r === void 0 ||
|
|
1642
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, n = e.camera.limits.max.beta;
|
|
1643
|
+
if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
|
|
1628
1644
|
return !0;
|
|
1629
|
-
const o = [t, i], a = [r,
|
|
1645
|
+
const o = [t, i], a = [r, n], l = o.every((h) => h === t), c = a.every((h) => h === r);
|
|
1630
1646
|
return !l && !c;
|
|
1631
1647
|
}
|
|
1632
1648
|
fireResizeEvent() {
|
|
@@ -1641,7 +1657,7 @@ class Yt {
|
|
|
1641
1657
|
(i) => this.validHighlightMaterials.includes(i.name)
|
|
1642
1658
|
).forEach((i) => {
|
|
1643
1659
|
const r = this.scene.materials.find(
|
|
1644
|
-
(
|
|
1660
|
+
(n) => n.id === i.id
|
|
1645
1661
|
);
|
|
1646
1662
|
r && (r.emissiveColor = new C(
|
|
1647
1663
|
this.configuration.highlights.color.r,
|
|
@@ -1654,14 +1670,14 @@ class Yt {
|
|
|
1654
1670
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1655
1671
|
}
|
|
1656
1672
|
loadModel(e, t) {
|
|
1657
|
-
const { refocusCamera: i = !0, progressHandler: r } = t ?? {},
|
|
1673
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new rt({
|
|
1658
1674
|
enablePicking: this.configuration.highlights.enabled,
|
|
1659
1675
|
modelDetails: e,
|
|
1660
1676
|
scene: this.scene,
|
|
1661
1677
|
previewService: this,
|
|
1662
1678
|
progressHandler: r
|
|
1663
1679
|
});
|
|
1664
|
-
return
|
|
1680
|
+
return n.getInitializationPromise().then(() => {
|
|
1665
1681
|
if (this.modelContainers.size <= 1 && i) {
|
|
1666
1682
|
const o = this.queuedCameraAnimation;
|
|
1667
1683
|
this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
|
|
@@ -1670,14 +1686,14 @@ class Yt {
|
|
|
1670
1686
|
});
|
|
1671
1687
|
}, 1);
|
|
1672
1688
|
}
|
|
1673
|
-
}), this.configuration.highlights.enabled && (
|
|
1689
|
+
}), this.configuration.highlights.enabled && (n.registerMaterialSelectedCallback((o) => {
|
|
1674
1690
|
this.setHighlights([o]);
|
|
1675
|
-
}),
|
|
1691
|
+
}), n.registerMaterialDeselectedCallback(() => {
|
|
1676
1692
|
this.setHighlights([]);
|
|
1677
|
-
})), this.modelContainers.set(
|
|
1693
|
+
})), this.modelContainers.set(n.getId(), n), this.triggerModelLoadEvent({
|
|
1678
1694
|
eventType: "load",
|
|
1679
|
-
modelContainer:
|
|
1680
|
-
}),
|
|
1695
|
+
modelContainer: n
|
|
1696
|
+
}), n;
|
|
1681
1697
|
}
|
|
1682
1698
|
async preloadModel(e) {
|
|
1683
1699
|
await z(e, this.scene);
|
|
@@ -1717,19 +1733,19 @@ class Yt {
|
|
|
1717
1733
|
flipTransform(e, t, i) {
|
|
1718
1734
|
const r = ae.Compose(
|
|
1719
1735
|
F(i || { x: 1, y: 1, z: 1 }),
|
|
1720
|
-
|
|
1736
|
+
y.FromEulerVector(
|
|
1721
1737
|
F(t || { x: 0, y: 0, z: 0 })
|
|
1722
1738
|
),
|
|
1723
1739
|
F(e || { x: 0, y: 0, z: 0 })
|
|
1724
|
-
),
|
|
1725
|
-
return o.decompose(c, l, a), l.multiplyInPlace(
|
|
1740
|
+
), n = ae.RotationAxis(g.Up(), Math.PI), o = r.multiply(n), a = g.Zero(), l = y.Identity(), c = g.Zero();
|
|
1741
|
+
return o.decompose(c, l, a), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1726
1742
|
position: S(a),
|
|
1727
1743
|
rotation: S(l.toEulerAngles()),
|
|
1728
1744
|
scale: S(c)
|
|
1729
1745
|
};
|
|
1730
1746
|
}
|
|
1731
1747
|
updatePreviewOptions(e) {
|
|
1732
|
-
var r,
|
|
1748
|
+
var r, n;
|
|
1733
1749
|
const t = new de(e);
|
|
1734
1750
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1735
1751
|
let i = this.scene.environmentTexture;
|
|
@@ -1739,7 +1755,7 @@ class Yt {
|
|
|
1739
1755
|
), i.name = "updated-environment-cube", this.scene.environmentTexture = i), i && (i.rotationY = t.scene.environment.rotationY), this.scene.environmentIntensity = t.scene.environment.intensity, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1740
1756
|
t.options.renderingPipelineConfiguration
|
|
1741
1757
|
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
|
|
1742
|
-
((
|
|
1758
|
+
((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1743
1759
|
), this.configuration = t;
|
|
1744
1760
|
}
|
|
1745
1761
|
setHighlightMaterials(e) {
|
|
@@ -1766,7 +1782,7 @@ export {
|
|
|
1766
1782
|
q as MaterialEffectMode,
|
|
1767
1783
|
D as ProductCameraRig,
|
|
1768
1784
|
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1769
|
-
|
|
1785
|
+
M as RenderingConfiguration,
|
|
1770
1786
|
Yt as SpiffCommerce3DPreviewService,
|
|
1771
1787
|
u as renderingPipelineDefaults
|
|
1772
1788
|
};
|