@spiffcommerce/preview 5.3.13 → 5.3.14-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -0
- package/dist/index.esm.js +224 -205
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ArcRotateCamera as pe } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
|
2
2
|
import { Engine as fe } from "@babylonjs/core/Engines/engine";
|
|
3
3
|
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
4
|
import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
-
import { SceneLoader as
|
|
5
|
+
import { SceneLoader as B } 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
8
|
import { Vector3 as p, Quaternion as y, Vector2 as ne, Matrix as se } from "@babylonjs/core/Maths/math.vector";
|
|
@@ -11,12 +11,12 @@ import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
|
11
11
|
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
12
|
import { Scene as Ae } from "@babylonjs/core/scene";
|
|
13
13
|
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
14
|
-
import { PBRMaterial as
|
|
14
|
+
import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
15
|
import { MirrorTexture as Re } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
16
|
import { Color3 as Te, Vector3 as re, Plane as Ee } from "@babylonjs/core/Maths/math";
|
|
17
17
|
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
18
|
import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
|
|
19
|
-
import { ActionManager as
|
|
19
|
+
import { ActionManager as T } from "@babylonjs/core/Actions/actionManager";
|
|
20
20
|
import { ExecuteCodeAction as ae } from "@babylonjs/core/Actions/directActions";
|
|
21
21
|
import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
|
|
22
22
|
import { TransformNode as Fe } from "@babylonjs/core/Meshes/transformNode";
|
|
@@ -27,9 +27,9 @@ import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
|
27
27
|
import { QuadraticEase as ke, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
28
28
|
import { AssetsManager as Ve } from "@babylonjs/core/Misc/assetsManager";
|
|
29
29
|
import { ColorCurves as oe } from "@babylonjs/core/Materials/colorCurves";
|
|
30
|
-
import { ImageProcessingConfiguration as
|
|
30
|
+
import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
31
|
import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
32
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
32
|
+
import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
33
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
34
34
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
35
35
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
@@ -40,7 +40,7 @@ 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
|
|
43
|
+
var F = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(F || {}), S = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(S || {});
|
|
44
44
|
class le {
|
|
45
45
|
constructor(e) {
|
|
46
46
|
this.getSceneClearColor = () => {
|
|
@@ -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, r, o, a,
|
|
100
|
+
var e, t, i, s, r, o, a, l, d, h, u, m, g;
|
|
101
101
|
return {
|
|
102
102
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
103
103
|
autoRotation: {
|
|
@@ -108,10 +108,10 @@ class le {
|
|
|
108
108
|
min: {
|
|
109
109
|
alpha: (s = this.customOptions) != null && s.lowerAlphaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
110
110
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
111
|
-
radius: (
|
|
111
|
+
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
112
112
|
},
|
|
113
113
|
max: {
|
|
114
|
-
alpha: (
|
|
114
|
+
alpha: (d = this.customOptions) != null && d.upperAlphaLimitDeg ? ((h = this.customOptions) == null ? void 0 : h.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
116
|
radius: (g = this.customOptions) == null ? void 0 : g.maxZoomOverride
|
|
117
117
|
}
|
|
@@ -182,7 +182,7 @@ class x {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
const Ne = 128,
|
|
185
|
+
const Ne = 128, c = {
|
|
186
186
|
antiAliasing: {
|
|
187
187
|
samples: 4,
|
|
188
188
|
fxaaEnabled: !1
|
|
@@ -283,7 +283,7 @@ class Ge {
|
|
|
283
283
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
284
284
|
*/
|
|
285
285
|
enableMaterialExtrasIfRequired(e, t) {
|
|
286
|
-
if (!(!e.extras || !(t instanceof
|
|
286
|
+
if (!(!e.extras || !(t instanceof D))) {
|
|
287
287
|
if (e.extras.sheen) {
|
|
288
288
|
const i = t;
|
|
289
289
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
@@ -328,27 +328,27 @@ class Ge {
|
|
|
328
328
|
const a = r.material;
|
|
329
329
|
if (!a)
|
|
330
330
|
return;
|
|
331
|
-
const
|
|
331
|
+
const l = new Re(
|
|
332
332
|
"mirror",
|
|
333
333
|
x.getMirrorTextureResolution(),
|
|
334
334
|
e,
|
|
335
335
|
!0
|
|
336
336
|
);
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
337
|
+
l.renderList = t(e);
|
|
338
|
+
const d = r.getVerticesData("normal");
|
|
339
|
+
if (!d)
|
|
340
340
|
throw new Error(
|
|
341
341
|
"Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
|
|
342
342
|
);
|
|
343
343
|
r.computeWorldMatrix(!0);
|
|
344
|
-
const
|
|
345
|
-
new re(
|
|
346
|
-
|
|
344
|
+
const h = r.getWorldMatrix(), u = re.TransformNormal(
|
|
345
|
+
new re(d[0], d[1], d[2]),
|
|
346
|
+
h
|
|
347
347
|
).normalize(), m = Ee.FromPositionAndNormal(
|
|
348
348
|
r.position,
|
|
349
349
|
u.scale(-1)
|
|
350
350
|
);
|
|
351
|
-
|
|
351
|
+
l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
|
|
352
352
|
}
|
|
353
353
|
function s(r) {
|
|
354
354
|
const o = r.material, a = new Oe(
|
|
@@ -387,47 +387,54 @@ class _e {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
const he = /* @__PURE__ */ new Map();
|
|
390
|
-
async function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
async function He(n, e) {
|
|
391
|
+
if (e)
|
|
392
|
+
return e(n).then(
|
|
393
|
+
(t) => new File([t], n, { type: "model/gltf-binary" })
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
async function be(n, e, t, i) {
|
|
397
|
+
const s = he.get(n);
|
|
398
|
+
if (s && s.scene.uid === e.uid)
|
|
399
|
+
return s;
|
|
394
400
|
{
|
|
395
|
-
const
|
|
401
|
+
const r = await He(n, i), o = await B.LoadAssetContainerAsync(
|
|
396
402
|
n,
|
|
397
|
-
|
|
403
|
+
r,
|
|
398
404
|
e,
|
|
399
|
-
t
|
|
405
|
+
t,
|
|
406
|
+
".glb"
|
|
400
407
|
);
|
|
401
|
-
return he.set(n,
|
|
408
|
+
return he.set(n, o), o;
|
|
402
409
|
}
|
|
403
410
|
}
|
|
404
|
-
|
|
411
|
+
B.OnPluginActivatedObservable.add((n) => {
|
|
405
412
|
n.name === "gltf" && (n.animationStartMode = Se.NONE);
|
|
406
413
|
});
|
|
407
|
-
function
|
|
414
|
+
function Ke(n, e, t, i, s = "") {
|
|
408
415
|
t.forEach((r) => {
|
|
409
|
-
const o = r.getID(), a = r.getName(),
|
|
410
|
-
n.filter((
|
|
416
|
+
const o = r.getID(), a = r.getName(), l = x.getDynamicTextureResolution();
|
|
417
|
+
n.filter((h) => h.name === s + a).forEach((h) => {
|
|
411
418
|
const u = i.get(o), m = !1;
|
|
412
419
|
if (u)
|
|
413
|
-
ce(
|
|
420
|
+
ce(h, u), u.update(m);
|
|
414
421
|
else {
|
|
415
|
-
const g =
|
|
422
|
+
const g = Ue(
|
|
416
423
|
a,
|
|
417
424
|
e,
|
|
418
|
-
|
|
419
|
-
|
|
425
|
+
l.width,
|
|
426
|
+
l.height
|
|
420
427
|
);
|
|
421
428
|
i.set(o, g), r.setStaticContext(
|
|
422
429
|
g.getContext()
|
|
423
|
-
), ce(
|
|
430
|
+
), ce(h, g), g.onLoadObservable.addOnce(() => {
|
|
424
431
|
g.update(m);
|
|
425
432
|
});
|
|
426
433
|
}
|
|
427
434
|
});
|
|
428
435
|
});
|
|
429
436
|
}
|
|
430
|
-
function
|
|
437
|
+
function Ue(n, e, t, i) {
|
|
431
438
|
const s = new Be(
|
|
432
439
|
n,
|
|
433
440
|
{ width: t, height: i },
|
|
@@ -439,7 +446,7 @@ function Ke(n, e, t, i) {
|
|
|
439
446
|
return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), s.update()), s;
|
|
440
447
|
}
|
|
441
448
|
function ce(n, e) {
|
|
442
|
-
if (n instanceof
|
|
449
|
+
if (n instanceof D) {
|
|
443
450
|
const t = n, i = t.albedoTexture;
|
|
444
451
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
445
452
|
} else {
|
|
@@ -447,7 +454,7 @@ function ce(n, e) {
|
|
|
447
454
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
448
455
|
}
|
|
449
456
|
}
|
|
450
|
-
function
|
|
457
|
+
function We() {
|
|
451
458
|
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
452
459
|
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
453
460
|
}
|
|
@@ -456,39 +463,39 @@ function ue(n) {
|
|
|
456
463
|
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
457
464
|
}
|
|
458
465
|
function ve(n, e, t, i, s, r) {
|
|
459
|
-
const o = s ? n.filter((
|
|
466
|
+
const o = s ? n.filter((h) => h.name === s) : n;
|
|
460
467
|
if (o.length === 0) {
|
|
461
468
|
console.warn(`No animations found for name: ${s}`);
|
|
462
469
|
return;
|
|
463
470
|
}
|
|
464
471
|
let a = 0;
|
|
465
|
-
const
|
|
472
|
+
const l = () => {
|
|
466
473
|
a++, a === o.length && r && r();
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}) :
|
|
471
|
-
|
|
474
|
+
}, d = (h, u, m, g, f) => {
|
|
475
|
+
h.stop(), h.start(u, m, g, f), r && (u == !1 || u === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
|
|
476
|
+
l();
|
|
477
|
+
}) : h.onAnimationLoopObservable.addOnce(() => {
|
|
478
|
+
l();
|
|
472
479
|
}));
|
|
473
480
|
};
|
|
474
481
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
475
|
-
o.forEach((
|
|
476
|
-
const u = ue(
|
|
477
|
-
|
|
482
|
+
o.forEach((h) => {
|
|
483
|
+
const u = ue(h), m = i * u;
|
|
484
|
+
d(h, !1, de, m, m);
|
|
478
485
|
});
|
|
479
486
|
return;
|
|
480
487
|
}
|
|
481
|
-
o.forEach((
|
|
482
|
-
const u = ue(
|
|
483
|
-
|
|
488
|
+
o.forEach((h) => {
|
|
489
|
+
const u = ue(h), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
|
|
490
|
+
d(h, e, de, m, g);
|
|
484
491
|
});
|
|
485
492
|
}
|
|
486
|
-
function
|
|
493
|
+
function Ye(n, e, t) {
|
|
487
494
|
return new Promise((i) => {
|
|
488
|
-
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
495
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
|
|
489
496
|
const s = [], r = t.target, o = 0, a = r ? 1 : 0;
|
|
490
497
|
if (t.target && Object.keys(t.target).length > 0 && s.push(
|
|
491
|
-
|
|
498
|
+
R(
|
|
492
499
|
"cameraTargetLerp",
|
|
493
500
|
"target",
|
|
494
501
|
new p().copyFrom(e.target),
|
|
@@ -501,7 +508,7 @@ function We(n, e, t) {
|
|
|
501
508
|
o
|
|
502
509
|
)
|
|
503
510
|
), s.push(
|
|
504
|
-
|
|
511
|
+
R(
|
|
505
512
|
"cameraAlphaLerp",
|
|
506
513
|
"alpha",
|
|
507
514
|
e.alpha,
|
|
@@ -510,7 +517,7 @@ function We(n, e, t) {
|
|
|
510
517
|
a
|
|
511
518
|
)
|
|
512
519
|
), s.push(
|
|
513
|
-
|
|
520
|
+
R(
|
|
514
521
|
"cameraBetaLerp",
|
|
515
522
|
"beta",
|
|
516
523
|
e.beta,
|
|
@@ -519,20 +526,20 @@ function We(n, e, t) {
|
|
|
519
526
|
a
|
|
520
527
|
)
|
|
521
528
|
), t.radius !== void 0) {
|
|
522
|
-
const
|
|
529
|
+
const h = Math.max(0.01, t.radius);
|
|
523
530
|
s.push(
|
|
524
|
-
|
|
531
|
+
R(
|
|
525
532
|
"cameraRadiusLerp",
|
|
526
533
|
"radius",
|
|
527
534
|
e.radius,
|
|
528
|
-
|
|
535
|
+
h,
|
|
529
536
|
v.ANIMATIONTYPE_FLOAT,
|
|
530
537
|
a
|
|
531
538
|
)
|
|
532
539
|
);
|
|
533
540
|
}
|
|
534
541
|
e.animations.push(...s);
|
|
535
|
-
const
|
|
542
|
+
const d = e.useAutoRotationBehavior;
|
|
536
543
|
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
537
544
|
e,
|
|
538
545
|
0,
|
|
@@ -540,7 +547,7 @@ function We(n, e, t) {
|
|
|
540
547
|
!1,
|
|
541
548
|
1,
|
|
542
549
|
() => {
|
|
543
|
-
e.animations = [],
|
|
550
|
+
e.animations = [], d && e.enableAutoRotationBehavior(), i();
|
|
544
551
|
}
|
|
545
552
|
);
|
|
546
553
|
});
|
|
@@ -548,30 +555,30 @@ function We(n, e, t) {
|
|
|
548
555
|
function me(n) {
|
|
549
556
|
return n * Math.PI / 180;
|
|
550
557
|
}
|
|
551
|
-
function
|
|
558
|
+
function R(n, e, t, i, s, r = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
552
559
|
const a = new ke();
|
|
553
560
|
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
554
|
-
const
|
|
561
|
+
const l = new v(
|
|
555
562
|
n,
|
|
556
563
|
e,
|
|
557
564
|
M,
|
|
558
565
|
s,
|
|
559
566
|
o
|
|
560
|
-
),
|
|
561
|
-
return r > 0 &&
|
|
567
|
+
), d = [];
|
|
568
|
+
return r > 0 && d.push({ frame: 0, value: t }), d.push({ frame: M * r, value: t }), d.push({
|
|
562
569
|
frame: M * (r + 1),
|
|
563
570
|
value: i
|
|
564
|
-
}),
|
|
571
|
+
}), l.setKeys(d), l.setEasingFunction(a), l;
|
|
565
572
|
}
|
|
566
|
-
function
|
|
573
|
+
function Qe(n, e, t) {
|
|
567
574
|
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
568
575
|
}
|
|
569
|
-
function
|
|
576
|
+
function Ze(n, e, t) {
|
|
570
577
|
n.forEach((i) => {
|
|
571
578
|
t && i.name !== t || i.goToFrame(e);
|
|
572
579
|
});
|
|
573
580
|
}
|
|
574
|
-
const
|
|
581
|
+
const $e = {
|
|
575
582
|
albedoTexture: "albedoMap",
|
|
576
583
|
bumpTexture: "normalMap",
|
|
577
584
|
ambientTexture: "ambientMap",
|
|
@@ -581,7 +588,7 @@ const Ze = {
|
|
|
581
588
|
refractionTexture: "refractionMap",
|
|
582
589
|
reflectionTexture: "reflectionMap"
|
|
583
590
|
};
|
|
584
|
-
function
|
|
591
|
+
function je(n, e, t, i) {
|
|
585
592
|
[
|
|
586
593
|
"albedoTexture",
|
|
587
594
|
"bumpTexture",
|
|
@@ -592,17 +599,17 @@ function $e(n, e, t, i) {
|
|
|
592
599
|
"refractionTexture",
|
|
593
600
|
"reflectionTexture"
|
|
594
601
|
].forEach((r) => {
|
|
595
|
-
|
|
602
|
+
Xe(
|
|
596
603
|
r,
|
|
597
604
|
n,
|
|
598
605
|
e,
|
|
599
606
|
t,
|
|
600
607
|
i
|
|
601
608
|
);
|
|
602
|
-
}),
|
|
609
|
+
}), tt(n, e);
|
|
603
610
|
}
|
|
604
|
-
function
|
|
605
|
-
const r =
|
|
611
|
+
function Xe(n, e, t, i, s) {
|
|
612
|
+
const r = $e[n];
|
|
606
613
|
if (!r)
|
|
607
614
|
throw new Error("Unexpected texture name encountered.");
|
|
608
615
|
const o = e[r], a = o == null ? void 0 : o.fileLink;
|
|
@@ -620,22 +627,22 @@ function je(n, e, t, i, s) {
|
|
|
620
627
|
!1,
|
|
621
628
|
!0,
|
|
622
629
|
!1
|
|
623
|
-
) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null,
|
|
630
|
+
) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Je(n, t));
|
|
624
631
|
}
|
|
625
|
-
function
|
|
632
|
+
function Je(n, e) {
|
|
626
633
|
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);
|
|
627
634
|
}
|
|
628
|
-
function
|
|
635
|
+
function et(n, e, t, i) {
|
|
629
636
|
if (!e) {
|
|
630
637
|
console.error("Failed to apply texture to material: material is null.");
|
|
631
638
|
return;
|
|
632
639
|
}
|
|
633
640
|
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);
|
|
634
641
|
}
|
|
635
|
-
function
|
|
636
|
-
n.clearCoat && (n.clearCoat ===
|
|
642
|
+
function tt(n, e) {
|
|
643
|
+
n.clearCoat && (n.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
637
644
|
}
|
|
638
|
-
class
|
|
645
|
+
class it {
|
|
639
646
|
constructor(e, t, i) {
|
|
640
647
|
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;
|
|
641
648
|
}
|
|
@@ -655,30 +662,30 @@ class tt {
|
|
|
655
662
|
...o,
|
|
656
663
|
...t
|
|
657
664
|
});
|
|
658
|
-
const a = this.renameClonedAsset(e),
|
|
659
|
-
(
|
|
665
|
+
const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
666
|
+
(h) => h.name === a
|
|
660
667
|
);
|
|
661
|
-
if (
|
|
668
|
+
if (l.length === 0) {
|
|
662
669
|
r();
|
|
663
670
|
return;
|
|
664
671
|
}
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
(
|
|
672
|
+
const d = new Ve(this.scene);
|
|
673
|
+
d.useDefaultLoadingScreen = !1, l.forEach(
|
|
674
|
+
(h) => je(
|
|
668
675
|
t,
|
|
669
|
-
|
|
670
|
-
|
|
676
|
+
h,
|
|
677
|
+
d,
|
|
671
678
|
s
|
|
672
679
|
)
|
|
673
|
-
),
|
|
674
|
-
i && i(
|
|
675
|
-
},
|
|
676
|
-
|
|
680
|
+
), d.onProgress = (h, u, m) => {
|
|
681
|
+
i && i(h / u * 100, 100, m.name);
|
|
682
|
+
}, d.onFinish = (h) => {
|
|
683
|
+
h.forEach((u) => {
|
|
677
684
|
const m = u;
|
|
678
685
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
679
686
|
(f) => f.name === a
|
|
680
687
|
).forEach(
|
|
681
|
-
(f) =>
|
|
688
|
+
(f) => et(
|
|
682
689
|
u.name,
|
|
683
690
|
f,
|
|
684
691
|
t,
|
|
@@ -686,7 +693,7 @@ class tt {
|
|
|
686
693
|
)
|
|
687
694
|
);
|
|
688
695
|
}), r();
|
|
689
|
-
},
|
|
696
|
+
}, d.loadAsync();
|
|
690
697
|
});
|
|
691
698
|
}
|
|
692
699
|
/**
|
|
@@ -698,39 +705,45 @@ class tt {
|
|
|
698
705
|
* @param lastPlayedAnimation The last played animation, this is used to ensure the animation is played on the new model.
|
|
699
706
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
700
707
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
708
|
+
* @param loadModel A function that loads a model from a given URL.
|
|
701
709
|
*/
|
|
702
|
-
async applyModel(e, t, i, s, r, o, a) {
|
|
703
|
-
var
|
|
710
|
+
async applyModel(e, t, i, s, r, o, a, l) {
|
|
711
|
+
var m;
|
|
704
712
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
705
|
-
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (
|
|
706
|
-
(
|
|
713
|
+
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), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
714
|
+
(g) => g !== e
|
|
707
715
|
), Promise.resolve(void 0);
|
|
708
|
-
const
|
|
716
|
+
const h = (await be(
|
|
717
|
+
i,
|
|
718
|
+
this.scene,
|
|
719
|
+
s,
|
|
720
|
+
l
|
|
721
|
+
)).instantiateModelsToScene(
|
|
709
722
|
this.renameClonedAsset,
|
|
710
723
|
!0
|
|
711
724
|
);
|
|
712
725
|
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), r) {
|
|
713
|
-
const
|
|
726
|
+
const g = o && o(), f = r.name ? this.renameClonedAsset(r.name) : void 0;
|
|
714
727
|
if (ve(
|
|
715
|
-
|
|
728
|
+
h.animationGroups,
|
|
716
729
|
r.loop,
|
|
717
730
|
r.to,
|
|
718
731
|
r.from,
|
|
719
|
-
|
|
720
|
-
),
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
732
|
+
f
|
|
733
|
+
), g != null) {
|
|
734
|
+
const A = a && a() || !0;
|
|
735
|
+
Ze(
|
|
736
|
+
h.animationGroups,
|
|
737
|
+
g + (A ? 2 : 0),
|
|
738
|
+
f
|
|
726
739
|
);
|
|
727
740
|
}
|
|
728
741
|
}
|
|
729
|
-
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e,
|
|
730
|
-
const
|
|
731
|
-
return this.materialVariantMap.forEach(async (
|
|
732
|
-
|
|
733
|
-
}), await Promise.all(
|
|
742
|
+
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, h), this.loadedMaterialsForKey.set(e, we(h));
|
|
743
|
+
const u = [];
|
|
744
|
+
return this.materialVariantMap.forEach(async (g, f) => {
|
|
745
|
+
u.push(this.applyMaterial(f, g));
|
|
746
|
+
}), await Promise.all(u), h;
|
|
734
747
|
}
|
|
735
748
|
dispose() {
|
|
736
749
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -771,7 +784,7 @@ function ge(n, e = "") {
|
|
|
771
784
|
from: t.from
|
|
772
785
|
}));
|
|
773
786
|
}
|
|
774
|
-
class
|
|
787
|
+
class nt {
|
|
775
788
|
constructor(e) {
|
|
776
789
|
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 = [];
|
|
777
790
|
const {
|
|
@@ -781,12 +794,13 @@ class it {
|
|
|
781
794
|
progressHandler: r,
|
|
782
795
|
scene: o
|
|
783
796
|
} = e;
|
|
784
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
797
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = s, this.scene = o, this.variantManager = new it(
|
|
785
798
|
o,
|
|
786
799
|
this.renameClonedAsset.bind(this),
|
|
787
800
|
this.setBaseModelEnabled.bind(this)
|
|
788
801
|
), this.transformRoot = new Fe("root", this.scene);
|
|
789
802
|
const a = async () => {
|
|
803
|
+
var l;
|
|
790
804
|
if (!i.model)
|
|
791
805
|
throw new Error(
|
|
792
806
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -794,7 +808,8 @@ class it {
|
|
|
794
808
|
return this.assetContainer = await be(
|
|
795
809
|
i.model,
|
|
796
810
|
o,
|
|
797
|
-
r
|
|
811
|
+
r,
|
|
812
|
+
(l = this.previewService.getCurrentConfiguration()) == null ? void 0 : l.loadModel
|
|
798
813
|
), await this.instantiate(), this;
|
|
799
814
|
};
|
|
800
815
|
this.importPromise = a();
|
|
@@ -837,11 +852,11 @@ class it {
|
|
|
837
852
|
await this.variantManager.applyMaterial(
|
|
838
853
|
e,
|
|
839
854
|
i,
|
|
840
|
-
(o, a,
|
|
855
|
+
(o, a, l) => {
|
|
841
856
|
this.materialVariantObservable.notifyObservers({
|
|
842
857
|
remainingCount: o,
|
|
843
858
|
totalCount: a,
|
|
844
|
-
taskName:
|
|
859
|
+
taskName: l
|
|
845
860
|
});
|
|
846
861
|
},
|
|
847
862
|
s
|
|
@@ -887,20 +902,24 @@ class it {
|
|
|
887
902
|
);
|
|
888
903
|
return;
|
|
889
904
|
}
|
|
890
|
-
const s = () =>
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
905
|
+
const s = () => {
|
|
906
|
+
var a;
|
|
907
|
+
return this.variantManager.applyModel(
|
|
908
|
+
e,
|
|
909
|
+
i,
|
|
910
|
+
t == null ? void 0 : t.model,
|
|
911
|
+
(l) => {
|
|
912
|
+
this.modelVariantObservable.notifyObservers({
|
|
913
|
+
...l,
|
|
914
|
+
key: e
|
|
915
|
+
});
|
|
916
|
+
},
|
|
917
|
+
this.lastPlayedAnimation,
|
|
918
|
+
this.getCurrentAnimationFrame.bind(this),
|
|
919
|
+
this.getAnimationIsPlaying.bind(this),
|
|
920
|
+
(a = this.previewService.getCurrentConfiguration()) == null ? void 0 : a.loadModel
|
|
921
|
+
);
|
|
922
|
+
};
|
|
904
923
|
if (this.modelChangesInProgress.includes(e)) {
|
|
905
924
|
this.queuedModelChanges.set(e, s);
|
|
906
925
|
return;
|
|
@@ -909,10 +928,10 @@ class it {
|
|
|
909
928
|
this.modelChangesInProgress.push(e);
|
|
910
929
|
let a = await s();
|
|
911
930
|
if (this.queuedModelChanges.has(e)) {
|
|
912
|
-
const
|
|
913
|
-
if (!
|
|
931
|
+
const l = this.queuedModelChanges.get(e);
|
|
932
|
+
if (!l)
|
|
914
933
|
throw new Error("Queued change resolved undefined");
|
|
915
|
-
a = await
|
|
934
|
+
a = await l(), this.queuedModelChanges.delete(e);
|
|
916
935
|
}
|
|
917
936
|
return this.modelChangesInProgress.splice(
|
|
918
937
|
this.modelChangesInProgress.indexOf(e),
|
|
@@ -1025,15 +1044,15 @@ class it {
|
|
|
1025
1044
|
attachPickingHandler(e) {
|
|
1026
1045
|
e.rootNodes.forEach((t) => {
|
|
1027
1046
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1028
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
1029
|
-
new ae(
|
|
1047
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new T(this.scene)), i.actionManager.registerAction(
|
|
1048
|
+
new ae(T.OnPointerOverTrigger, (s) => {
|
|
1030
1049
|
s.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1031
1050
|
id: i.material.id,
|
|
1032
1051
|
name: this.stripIdFromName(i.material.name)
|
|
1033
1052
|
});
|
|
1034
1053
|
})
|
|
1035
1054
|
), i.actionManager.registerAction(
|
|
1036
|
-
new ae(
|
|
1055
|
+
new ae(T.OnPointerOutTrigger, () => {
|
|
1037
1056
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
1038
1057
|
id: i.material.id,
|
|
1039
1058
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1062,7 +1081,7 @@ class it {
|
|
|
1062
1081
|
return this.modelReadyToLoadCallbacks.size;
|
|
1063
1082
|
}
|
|
1064
1083
|
configureGlowLayer() {
|
|
1065
|
-
const e = (i) => i instanceof
|
|
1084
|
+
const e = (i) => i instanceof D && i.emissiveTexture !== null;
|
|
1066
1085
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1067
1086
|
}
|
|
1068
1087
|
configureModelInstance(e) {
|
|
@@ -1075,7 +1094,7 @@ class it {
|
|
|
1075
1094
|
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1076
1095
|
for (const o of e.rootNodes)
|
|
1077
1096
|
o.parent = this.transformRoot;
|
|
1078
|
-
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(),
|
|
1097
|
+
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(), Ke(
|
|
1079
1098
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1080
1099
|
this.scene,
|
|
1081
1100
|
this.canvasPanels,
|
|
@@ -1178,8 +1197,8 @@ class it {
|
|
|
1178
1197
|
}
|
|
1179
1198
|
//#endregion
|
|
1180
1199
|
}
|
|
1181
|
-
class
|
|
1182
|
-
constructor(e, t, i, s, r, o, a,
|
|
1200
|
+
class k extends pe {
|
|
1201
|
+
constructor(e, t, i, s, r, o, a, l) {
|
|
1183
1202
|
super(
|
|
1184
1203
|
e,
|
|
1185
1204
|
t,
|
|
@@ -1187,7 +1206,7 @@ class D extends pe {
|
|
|
1187
1206
|
s,
|
|
1188
1207
|
r,
|
|
1189
1208
|
o,
|
|
1190
|
-
|
|
1209
|
+
l
|
|
1191
1210
|
), 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(
|
|
1192
1211
|
a.camera.autoRotation.idleTimeMs
|
|
1193
1212
|
));
|
|
@@ -1221,7 +1240,7 @@ class D extends pe {
|
|
|
1221
1240
|
this.useFramingBehavior = !0;
|
|
1222
1241
|
const e = this.getFramingBehavior();
|
|
1223
1242
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1224
|
-
const t =
|
|
1243
|
+
const t = O(this._scene);
|
|
1225
1244
|
return e.zoomOnBoundingInfo(t.min, t.max), this.wheelPrecision = 100 / this.radius, this.lowerRadiusLimit === null && (this.lowerRadiusLimit = 0.1), this.lastFocus.copyFrom(this.target), e;
|
|
1226
1245
|
}
|
|
1227
1246
|
/**
|
|
@@ -1235,7 +1254,7 @@ class D extends pe {
|
|
|
1235
1254
|
i.framingTime = t || 800;
|
|
1236
1255
|
const s = () => {
|
|
1237
1256
|
this.isRunningFramingBehavior = !1;
|
|
1238
|
-
}, r =
|
|
1257
|
+
}, r = O(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
|
|
1239
1258
|
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(
|
|
1240
1259
|
r.min,
|
|
1241
1260
|
r.max,
|
|
@@ -1270,7 +1289,7 @@ class D extends pe {
|
|
|
1270
1289
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1271
1290
|
*/
|
|
1272
1291
|
static create(e, t, i) {
|
|
1273
|
-
const s =
|
|
1292
|
+
const s = O(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new k(
|
|
1274
1293
|
"ProductCamera",
|
|
1275
1294
|
-(Math.PI / 2),
|
|
1276
1295
|
Math.PI / 2,
|
|
@@ -1284,7 +1303,7 @@ class D extends pe {
|
|
|
1284
1303
|
}), i && (e.activeCamera = a), a;
|
|
1285
1304
|
}
|
|
1286
1305
|
}
|
|
1287
|
-
function
|
|
1306
|
+
function O(n) {
|
|
1288
1307
|
if (n.meshes.length === 0)
|
|
1289
1308
|
return {
|
|
1290
1309
|
min: new p(-1, -1, -1),
|
|
@@ -1293,7 +1312,7 @@ function E(n) {
|
|
|
1293
1312
|
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1294
1313
|
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1295
1314
|
}
|
|
1296
|
-
class
|
|
1315
|
+
class st {
|
|
1297
1316
|
constructor(e, t = !1, i = void 0) {
|
|
1298
1317
|
this.renderingPipeline = new qe(
|
|
1299
1318
|
"default",
|
|
@@ -1302,7 +1321,7 @@ class nt {
|
|
|
1302
1321
|
i ? [i] : void 0,
|
|
1303
1322
|
!1
|
|
1304
1323
|
// Disable automatic build
|
|
1305
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1324
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(c));
|
|
1306
1325
|
}
|
|
1307
1326
|
dispose() {
|
|
1308
1327
|
this.renderingPipeline.dispose();
|
|
@@ -1311,42 +1330,42 @@ class nt {
|
|
|
1311
1330
|
return this.currentConfiguration;
|
|
1312
1331
|
}
|
|
1313
1332
|
setConfiguration(e) {
|
|
1314
|
-
var t, i, s, r, o, a,
|
|
1333
|
+
var t, i, s, r, o, a, l, d, h, u, m, g, f, A, z, V, q, N, G, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te;
|
|
1315
1334
|
if (this.renderingPipeline.isSupported) {
|
|
1316
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ??
|
|
1335
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? c.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? c.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((s = e.bloom) == null ? void 0 : s.enabled) ?? c.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.kernel) ?? c.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? c.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? c.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? c.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((d = e.chromaticAberration) == null ? void 0 : d.enabled) ?? c.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? c.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? c.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ne(
|
|
1317
1336
|
e.chromaticAberration.direction.x,
|
|
1318
1337
|
e.chromaticAberration.direction.y
|
|
1319
1338
|
) : new ne(
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ??
|
|
1323
|
-
switch (e.depthOfField.blurLevel ??
|
|
1339
|
+
c.chromaticAberration.direction.x,
|
|
1340
|
+
c.chromaticAberration.direction.y
|
|
1341
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? c.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) ?? c.depthOfField.enabled, e.depthOfField)
|
|
1342
|
+
switch (e.depthOfField.blurLevel ?? c.depthOfField.blurLevel) {
|
|
1324
1343
|
case "Low":
|
|
1325
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1344
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
1326
1345
|
break;
|
|
1327
1346
|
case "Medium":
|
|
1328
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1347
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
|
|
1329
1348
|
break;
|
|
1330
1349
|
case "High":
|
|
1331
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1350
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1332
1351
|
break;
|
|
1333
1352
|
}
|
|
1334
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1335
|
-
switch (e.misc.toneMappingType ??
|
|
1353
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((A = e.depthOfField) == null ? void 0 : A.focalLength) ?? c.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? c.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? c.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((q = e.depthOfField) == null ? void 0 : q.lensSize) ?? c.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((N = e.grain) == null ? void 0 : N.enabled) ?? c.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? c.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? c.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? c.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? c.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? c.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1354
|
+
switch (e.misc.toneMappingType ?? c.misc.toneMappingType) {
|
|
1336
1355
|
case "Standard":
|
|
1337
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1356
|
+
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1338
1357
|
break;
|
|
1339
1358
|
case "ACES":
|
|
1340
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1359
|
+
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1341
1360
|
break;
|
|
1342
1361
|
}
|
|
1343
|
-
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ??
|
|
1344
|
-
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ??
|
|
1362
|
+
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? c.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? c.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? c.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? c.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 = c.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = c.vignette.center.y), e.vignette)
|
|
1363
|
+
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? c.vignette.blendMode) {
|
|
1345
1364
|
case "Multiply":
|
|
1346
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1365
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1347
1366
|
break;
|
|
1348
1367
|
case "Opaque":
|
|
1349
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1368
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_OPAQUE;
|
|
1350
1369
|
break;
|
|
1351
1370
|
}
|
|
1352
1371
|
(X = e.vignette) != null && X.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
@@ -1355,11 +1374,11 @@ class nt {
|
|
|
1355
1374
|
e.vignette.colorRgba.b,
|
|
1356
1375
|
e.vignette.colorRgba.a
|
|
1357
1376
|
) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ??
|
|
1377
|
+
c.vignette.colorRgba.r,
|
|
1378
|
+
c.vignette.colorRgba.g,
|
|
1379
|
+
c.vignette.colorRgba.b,
|
|
1380
|
+
c.vignette.colorRgba.a
|
|
1381
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? c.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? c.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1363
1382
|
}
|
|
1364
1383
|
}
|
|
1365
1384
|
updateColorCurve(e) {
|
|
@@ -1370,29 +1389,29 @@ class nt {
|
|
|
1370
1389
|
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1371
1390
|
return new Ge(n);
|
|
1372
1391
|
});
|
|
1373
|
-
|
|
1392
|
+
B.OnPluginActivatedObservable.add((n) => {
|
|
1374
1393
|
if (n.name === "gltf") {
|
|
1375
1394
|
const e = n;
|
|
1376
1395
|
e.transparencyAsCoverage = !0;
|
|
1377
1396
|
}
|
|
1378
1397
|
});
|
|
1379
|
-
function
|
|
1398
|
+
function L(n) {
|
|
1380
1399
|
return new p(n.x, n.y, n.z);
|
|
1381
1400
|
}
|
|
1382
|
-
function
|
|
1401
|
+
function I(n) {
|
|
1383
1402
|
return { x: n.x, y: n.y, z: n.z };
|
|
1384
1403
|
}
|
|
1385
|
-
class
|
|
1404
|
+
class Yt {
|
|
1386
1405
|
constructor(e) {
|
|
1387
|
-
var
|
|
1406
|
+
var l;
|
|
1388
1407
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1389
1408
|
if (!this.engine.views)
|
|
1390
1409
|
return;
|
|
1391
|
-
this.modelContainers.forEach((
|
|
1392
|
-
|
|
1410
|
+
this.modelContainers.forEach((h) => {
|
|
1411
|
+
h.updateDynamicTextures();
|
|
1393
1412
|
}), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1394
|
-
const
|
|
1395
|
-
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus,
|
|
1413
|
+
const d = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
|
|
1414
|
+
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, d) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
|
|
1396
1415
|
}, this.configuration = new le(e);
|
|
1397
1416
|
const i = (() => {
|
|
1398
1417
|
if (!(e != null && e.noRender))
|
|
@@ -1417,7 +1436,7 @@ class Wt {
|
|
|
1417
1436
|
stencil: this.configuration.highlights.enabled,
|
|
1418
1437
|
forceSRGBBufferSupportState: !0
|
|
1419
1438
|
}) : new Ce();
|
|
1420
|
-
console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Ae(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera =
|
|
1439
|
+
console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Ae(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
|
|
1421
1440
|
this.scene,
|
|
1422
1441
|
!1,
|
|
1423
1442
|
this.camera
|
|
@@ -1426,14 +1445,14 @@ class Wt {
|
|
|
1426
1445
|
this.configuration.scene.environment.file,
|
|
1427
1446
|
this.scene
|
|
1428
1447
|
);
|
|
1429
|
-
a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (
|
|
1448
|
+
a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1430
1449
|
this.configuration.options.renderingPipelineConfiguration
|
|
1431
1450
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
|
|
1432
1451
|
this.scene,
|
|
1433
1452
|
this.configuration.emissiveGlowIntensity
|
|
1434
|
-
), this.initPromise = new Promise((
|
|
1453
|
+
), this.initPromise = new Promise((d) => {
|
|
1435
1454
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1436
|
-
this.initComplete = !0,
|
|
1455
|
+
this.initComplete = !0, d();
|
|
1437
1456
|
});
|
|
1438
1457
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1439
1458
|
}
|
|
@@ -1465,7 +1484,7 @@ class Wt {
|
|
|
1465
1484
|
}
|
|
1466
1485
|
registerView(e) {
|
|
1467
1486
|
const t = e.height, i = e.width;
|
|
1468
|
-
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1487
|
+
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(F.Pan), this.reattachControls(e);
|
|
1469
1488
|
}
|
|
1470
1489
|
getNumViewports() {
|
|
1471
1490
|
var e;
|
|
@@ -1483,7 +1502,7 @@ class Wt {
|
|
|
1483
1502
|
let t = () => {
|
|
1484
1503
|
};
|
|
1485
1504
|
const i = async () => {
|
|
1486
|
-
this.isAnimatingCamera = !0, await
|
|
1505
|
+
this.isAnimatingCamera = !0, await Ye(
|
|
1487
1506
|
this.scene,
|
|
1488
1507
|
this.scene.activeCamera,
|
|
1489
1508
|
e
|
|
@@ -1519,7 +1538,7 @@ class Wt {
|
|
|
1519
1538
|
throw new Error(
|
|
1520
1539
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1521
1540
|
);
|
|
1522
|
-
e ===
|
|
1541
|
+
e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1523
1542
|
}
|
|
1524
1543
|
animateToLastCameraFocus() {
|
|
1525
1544
|
let e = () => {
|
|
@@ -1582,8 +1601,8 @@ class Wt {
|
|
|
1582
1601
|
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;
|
|
1583
1602
|
if (t === void 0 || i === void 0 || s === void 0 || r === void 0)
|
|
1584
1603
|
return !0;
|
|
1585
|
-
const o = [t, i], a = [s, r],
|
|
1586
|
-
return !
|
|
1604
|
+
const o = [t, i], a = [s, r], l = o.every((h) => h === t), d = a.every((h) => h === s);
|
|
1605
|
+
return !l && !d;
|
|
1587
1606
|
}
|
|
1588
1607
|
fireResizeEvent() {
|
|
1589
1608
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
@@ -1602,8 +1621,8 @@ class Wt {
|
|
|
1602
1621
|
);
|
|
1603
1622
|
o && o.getBindedMeshes().forEach(
|
|
1604
1623
|
(a) => {
|
|
1605
|
-
var
|
|
1606
|
-
return (
|
|
1624
|
+
var l;
|
|
1625
|
+
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1607
1626
|
a,
|
|
1608
1627
|
i || w.FromHexString("#fcba03")
|
|
1609
1628
|
);
|
|
@@ -1615,7 +1634,7 @@ class Wt {
|
|
|
1615
1634
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1616
1635
|
}
|
|
1617
1636
|
loadModel(e, t) {
|
|
1618
|
-
const i = new
|
|
1637
|
+
const i = new nt({
|
|
1619
1638
|
enablePicking: this.configuration.highlights.enabled,
|
|
1620
1639
|
modelDetails: e,
|
|
1621
1640
|
scene: this.scene,
|
|
@@ -1671,16 +1690,16 @@ class Wt {
|
|
|
1671
1690
|
*/
|
|
1672
1691
|
flipTransform(e, t, i) {
|
|
1673
1692
|
const s = se.Compose(
|
|
1674
|
-
|
|
1693
|
+
L(i || { x: 1, y: 1, z: 1 }),
|
|
1675
1694
|
y.FromEulerVector(
|
|
1676
|
-
|
|
1695
|
+
L(t || { x: 0, y: 0, z: 0 })
|
|
1677
1696
|
),
|
|
1678
|
-
|
|
1679
|
-
), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(),
|
|
1680
|
-
return o.decompose(
|
|
1681
|
-
position:
|
|
1682
|
-
rotation:
|
|
1683
|
-
scale:
|
|
1697
|
+
L(e || { x: 0, y: 0, z: 0 })
|
|
1698
|
+
), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), l = y.Identity(), d = p.Zero();
|
|
1699
|
+
return o.decompose(d, l, a), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1700
|
+
position: I(a),
|
|
1701
|
+
rotation: I(l.toEulerAngles()),
|
|
1702
|
+
scale: I(d)
|
|
1684
1703
|
};
|
|
1685
1704
|
}
|
|
1686
1705
|
updatePreviewOptions(e) {
|
|
@@ -1710,10 +1729,10 @@ class Wt {
|
|
|
1710
1729
|
}
|
|
1711
1730
|
}
|
|
1712
1731
|
export {
|
|
1713
|
-
|
|
1714
|
-
|
|
1732
|
+
S as MaterialEffectMode,
|
|
1733
|
+
F as ProductCameraRig,
|
|
1715
1734
|
Ne as REFLECTION_PROBE_RESOLUTION,
|
|
1716
1735
|
x as RenderingConfiguration,
|
|
1717
|
-
|
|
1718
|
-
|
|
1736
|
+
Yt as SpiffCommerce3DPreviewService,
|
|
1737
|
+
c as renderingPipelineDefaults
|
|
1719
1738
|
};
|