@spiffcommerce/preview 5.3.12 → 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 +228 -208
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -2,21 +2,21 @@ 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";
|
|
9
9
|
import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
11
11
|
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { PBRMaterial as
|
|
12
|
+
import { Scene as Ae } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
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";
|
|
@@ -29,7 +29,7 @@ import { AssetsManager as Ve } from "@babylonjs/core/Misc/assetsManager";
|
|
|
29
29
|
import { ColorCurves as oe } from "@babylonjs/core/Materials/colorCurves";
|
|
30
30
|
import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
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
|
|
185
|
+
const Ne = 128, c = {
|
|
186
186
|
antiAliasing: {
|
|
187
187
|
samples: 4,
|
|
188
188
|
fxaaEnabled: !1
|
|
@@ -239,7 +239,7 @@ const Ge = 128, d = {
|
|
|
239
239
|
weight: 1
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
|
-
class
|
|
242
|
+
class Ge {
|
|
243
243
|
constructor(e) {
|
|
244
244
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
245
245
|
}
|
|
@@ -283,7 +283,7 @@ class Ne {
|
|
|
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,32 +328,32 @@ class Ne {
|
|
|
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(
|
|
355
355
|
"probe-" + o.name,
|
|
356
|
-
|
|
356
|
+
Ne,
|
|
357
357
|
e
|
|
358
358
|
);
|
|
359
359
|
a.attachToMesh(r), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
@@ -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
|
|
570
|
-
n.forEach((
|
|
571
|
-
t.goToFrame(e);
|
|
576
|
+
function Ze(n, e, t) {
|
|
577
|
+
n.forEach((i) => {
|
|
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,38 +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
|
-
|
|
732
|
+
f
|
|
733
|
+
), g != null) {
|
|
734
|
+
const A = a && a() || !0;
|
|
735
|
+
Ze(
|
|
736
|
+
h.animationGroups,
|
|
737
|
+
g + (A ? 2 : 0),
|
|
738
|
+
f
|
|
725
739
|
);
|
|
726
740
|
}
|
|
727
741
|
}
|
|
728
|
-
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e,
|
|
729
|
-
const
|
|
730
|
-
return this.materialVariantMap.forEach(async (
|
|
731
|
-
|
|
732
|
-
}), 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;
|
|
733
747
|
}
|
|
734
748
|
dispose() {
|
|
735
749
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -770,7 +784,7 @@ function ge(n, e = "") {
|
|
|
770
784
|
from: t.from
|
|
771
785
|
}));
|
|
772
786
|
}
|
|
773
|
-
class
|
|
787
|
+
class nt {
|
|
774
788
|
constructor(e) {
|
|
775
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 = [];
|
|
776
790
|
const {
|
|
@@ -780,12 +794,13 @@ class it {
|
|
|
780
794
|
progressHandler: r,
|
|
781
795
|
scene: o
|
|
782
796
|
} = e;
|
|
783
|
-
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(
|
|
784
798
|
o,
|
|
785
799
|
this.renameClonedAsset.bind(this),
|
|
786
800
|
this.setBaseModelEnabled.bind(this)
|
|
787
801
|
), this.transformRoot = new Fe("root", this.scene);
|
|
788
802
|
const a = async () => {
|
|
803
|
+
var l;
|
|
789
804
|
if (!i.model)
|
|
790
805
|
throw new Error(
|
|
791
806
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -793,7 +808,8 @@ class it {
|
|
|
793
808
|
return this.assetContainer = await be(
|
|
794
809
|
i.model,
|
|
795
810
|
o,
|
|
796
|
-
r
|
|
811
|
+
r,
|
|
812
|
+
(l = this.previewService.getCurrentConfiguration()) == null ? void 0 : l.loadModel
|
|
797
813
|
), await this.instantiate(), this;
|
|
798
814
|
};
|
|
799
815
|
this.importPromise = a();
|
|
@@ -836,11 +852,11 @@ class it {
|
|
|
836
852
|
await this.variantManager.applyMaterial(
|
|
837
853
|
e,
|
|
838
854
|
i,
|
|
839
|
-
(o, a,
|
|
855
|
+
(o, a, l) => {
|
|
840
856
|
this.materialVariantObservable.notifyObservers({
|
|
841
857
|
remainingCount: o,
|
|
842
858
|
totalCount: a,
|
|
843
|
-
taskName:
|
|
859
|
+
taskName: l
|
|
844
860
|
});
|
|
845
861
|
},
|
|
846
862
|
s
|
|
@@ -886,20 +902,24 @@ class it {
|
|
|
886
902
|
);
|
|
887
903
|
return;
|
|
888
904
|
}
|
|
889
|
-
const s = () =>
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
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
|
+
};
|
|
903
923
|
if (this.modelChangesInProgress.includes(e)) {
|
|
904
924
|
this.queuedModelChanges.set(e, s);
|
|
905
925
|
return;
|
|
@@ -908,10 +928,10 @@ class it {
|
|
|
908
928
|
this.modelChangesInProgress.push(e);
|
|
909
929
|
let a = await s();
|
|
910
930
|
if (this.queuedModelChanges.has(e)) {
|
|
911
|
-
const
|
|
912
|
-
if (!
|
|
931
|
+
const l = this.queuedModelChanges.get(e);
|
|
932
|
+
if (!l)
|
|
913
933
|
throw new Error("Queued change resolved undefined");
|
|
914
|
-
a = await
|
|
934
|
+
a = await l(), this.queuedModelChanges.delete(e);
|
|
915
935
|
}
|
|
916
936
|
return this.modelChangesInProgress.splice(
|
|
917
937
|
this.modelChangesInProgress.indexOf(e),
|
|
@@ -1024,15 +1044,15 @@ class it {
|
|
|
1024
1044
|
attachPickingHandler(e) {
|
|
1025
1045
|
e.rootNodes.forEach((t) => {
|
|
1026
1046
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1027
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
1028
|
-
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) => {
|
|
1029
1049
|
s.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1030
1050
|
id: i.material.id,
|
|
1031
1051
|
name: this.stripIdFromName(i.material.name)
|
|
1032
1052
|
});
|
|
1033
1053
|
})
|
|
1034
1054
|
), i.actionManager.registerAction(
|
|
1035
|
-
new ae(
|
|
1055
|
+
new ae(T.OnPointerOutTrigger, () => {
|
|
1036
1056
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
1037
1057
|
id: i.material.id,
|
|
1038
1058
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1061,7 +1081,7 @@ class it {
|
|
|
1061
1081
|
return this.modelReadyToLoadCallbacks.size;
|
|
1062
1082
|
}
|
|
1063
1083
|
configureGlowLayer() {
|
|
1064
|
-
const e = (i) => i instanceof
|
|
1084
|
+
const e = (i) => i instanceof D && i.emissiveTexture !== null;
|
|
1065
1085
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1066
1086
|
}
|
|
1067
1087
|
configureModelInstance(e) {
|
|
@@ -1074,7 +1094,7 @@ class it {
|
|
|
1074
1094
|
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1075
1095
|
for (const o of e.rootNodes)
|
|
1076
1096
|
o.parent = this.transformRoot;
|
|
1077
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(),
|
|
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(
|
|
1078
1098
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1079
1099
|
this.scene,
|
|
1080
1100
|
this.canvasPanels,
|
|
@@ -1177,8 +1197,8 @@ class it {
|
|
|
1177
1197
|
}
|
|
1178
1198
|
//#endregion
|
|
1179
1199
|
}
|
|
1180
|
-
class
|
|
1181
|
-
constructor(e, t, i, s, r, o, a,
|
|
1200
|
+
class k extends pe {
|
|
1201
|
+
constructor(e, t, i, s, r, o, a, l) {
|
|
1182
1202
|
super(
|
|
1183
1203
|
e,
|
|
1184
1204
|
t,
|
|
@@ -1186,7 +1206,7 @@ class D extends pe {
|
|
|
1186
1206
|
s,
|
|
1187
1207
|
r,
|
|
1188
1208
|
o,
|
|
1189
|
-
|
|
1209
|
+
l
|
|
1190
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(
|
|
1191
1211
|
a.camera.autoRotation.idleTimeMs
|
|
1192
1212
|
));
|
|
@@ -1220,7 +1240,7 @@ class D extends pe {
|
|
|
1220
1240
|
this.useFramingBehavior = !0;
|
|
1221
1241
|
const e = this.getFramingBehavior();
|
|
1222
1242
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1223
|
-
const t =
|
|
1243
|
+
const t = O(this._scene);
|
|
1224
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;
|
|
1225
1245
|
}
|
|
1226
1246
|
/**
|
|
@@ -1234,7 +1254,7 @@ class D extends pe {
|
|
|
1234
1254
|
i.framingTime = t || 800;
|
|
1235
1255
|
const s = () => {
|
|
1236
1256
|
this.isRunningFramingBehavior = !1;
|
|
1237
|
-
}, r =
|
|
1257
|
+
}, r = O(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
|
|
1238
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(
|
|
1239
1259
|
r.min,
|
|
1240
1260
|
r.max,
|
|
@@ -1269,7 +1289,7 @@ class D extends pe {
|
|
|
1269
1289
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1270
1290
|
*/
|
|
1271
1291
|
static create(e, t, i) {
|
|
1272
|
-
const s =
|
|
1292
|
+
const s = O(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new k(
|
|
1273
1293
|
"ProductCamera",
|
|
1274
1294
|
-(Math.PI / 2),
|
|
1275
1295
|
Math.PI / 2,
|
|
@@ -1283,7 +1303,7 @@ class D extends pe {
|
|
|
1283
1303
|
}), i && (e.activeCamera = a), a;
|
|
1284
1304
|
}
|
|
1285
1305
|
}
|
|
1286
|
-
function
|
|
1306
|
+
function O(n) {
|
|
1287
1307
|
if (n.meshes.length === 0)
|
|
1288
1308
|
return {
|
|
1289
1309
|
min: new p(-1, -1, -1),
|
|
@@ -1292,7 +1312,7 @@ function E(n) {
|
|
|
1292
1312
|
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1293
1313
|
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1294
1314
|
}
|
|
1295
|
-
class
|
|
1315
|
+
class st {
|
|
1296
1316
|
constructor(e, t = !1, i = void 0) {
|
|
1297
1317
|
this.renderingPipeline = new qe(
|
|
1298
1318
|
"default",
|
|
@@ -1301,7 +1321,7 @@ class nt {
|
|
|
1301
1321
|
i ? [i] : void 0,
|
|
1302
1322
|
!1
|
|
1303
1323
|
// Disable automatic build
|
|
1304
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1324
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(c));
|
|
1305
1325
|
}
|
|
1306
1326
|
dispose() {
|
|
1307
1327
|
this.renderingPipeline.dispose();
|
|
@@ -1310,28 +1330,28 @@ class nt {
|
|
|
1310
1330
|
return this.currentConfiguration;
|
|
1311
1331
|
}
|
|
1312
1332
|
setConfiguration(e) {
|
|
1313
|
-
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;
|
|
1314
1334
|
if (this.renderingPipeline.isSupported) {
|
|
1315
|
-
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(
|
|
1316
1336
|
e.chromaticAberration.direction.x,
|
|
1317
1337
|
e.chromaticAberration.direction.y
|
|
1318
1338
|
) : new ne(
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ??
|
|
1322
|
-
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) {
|
|
1323
1343
|
case "Low":
|
|
1324
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1344
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
1325
1345
|
break;
|
|
1326
1346
|
case "Medium":
|
|
1327
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1347
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
|
|
1328
1348
|
break;
|
|
1329
1349
|
case "High":
|
|
1330
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1350
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1331
1351
|
break;
|
|
1332
1352
|
}
|
|
1333
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1334
|
-
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) {
|
|
1335
1355
|
case "Standard":
|
|
1336
1356
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1337
1357
|
break;
|
|
@@ -1339,8 +1359,8 @@ class nt {
|
|
|
1339
1359
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1340
1360
|
break;
|
|
1341
1361
|
}
|
|
1342
|
-
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ??
|
|
1343
|
-
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) {
|
|
1344
1364
|
case "Multiply":
|
|
1345
1365
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1346
1366
|
break;
|
|
@@ -1354,11 +1374,11 @@ class nt {
|
|
|
1354
1374
|
e.vignette.colorRgba.b,
|
|
1355
1375
|
e.vignette.colorRgba.a
|
|
1356
1376
|
) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
), 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;
|
|
1362
1382
|
}
|
|
1363
1383
|
}
|
|
1364
1384
|
updateColorCurve(e) {
|
|
@@ -1366,32 +1386,32 @@ class nt {
|
|
|
1366
1386
|
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;
|
|
1367
1387
|
}
|
|
1368
1388
|
}
|
|
1369
|
-
|
|
1370
|
-
return new
|
|
1389
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1390
|
+
return new Ge(n);
|
|
1371
1391
|
});
|
|
1372
|
-
|
|
1392
|
+
B.OnPluginActivatedObservable.add((n) => {
|
|
1373
1393
|
if (n.name === "gltf") {
|
|
1374
1394
|
const e = n;
|
|
1375
1395
|
e.transparencyAsCoverage = !0;
|
|
1376
1396
|
}
|
|
1377
1397
|
});
|
|
1378
|
-
function
|
|
1398
|
+
function L(n) {
|
|
1379
1399
|
return new p(n.x, n.y, n.z);
|
|
1380
1400
|
}
|
|
1381
|
-
function
|
|
1401
|
+
function I(n) {
|
|
1382
1402
|
return { x: n.x, y: n.y, z: n.z };
|
|
1383
1403
|
}
|
|
1384
|
-
class
|
|
1404
|
+
class Yt {
|
|
1385
1405
|
constructor(e) {
|
|
1386
|
-
var
|
|
1406
|
+
var l;
|
|
1387
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 = () => {
|
|
1388
1408
|
if (!this.engine.views)
|
|
1389
1409
|
return;
|
|
1390
|
-
this.modelContainers.forEach((
|
|
1391
|
-
|
|
1410
|
+
this.modelContainers.forEach((h) => {
|
|
1411
|
+
h.updateDynamicTextures();
|
|
1392
1412
|
}), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1393
|
-
const
|
|
1394
|
-
!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);
|
|
1395
1415
|
}, this.configuration = new le(e);
|
|
1396
1416
|
const i = (() => {
|
|
1397
1417
|
if (!(e != null && e.noRender))
|
|
@@ -1416,7 +1436,7 @@ class Wt {
|
|
|
1416
1436
|
stencil: this.configuration.highlights.enabled,
|
|
1417
1437
|
forceSRGBBufferSupportState: !0
|
|
1418
1438
|
}) : new Ce();
|
|
1419
|
-
console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new
|
|
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(
|
|
1420
1440
|
this.scene,
|
|
1421
1441
|
!1,
|
|
1422
1442
|
this.camera
|
|
@@ -1425,14 +1445,14 @@ class Wt {
|
|
|
1425
1445
|
this.configuration.scene.environment.file,
|
|
1426
1446
|
this.scene
|
|
1427
1447
|
);
|
|
1428
|
-
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(
|
|
1429
1449
|
this.configuration.options.renderingPipelineConfiguration
|
|
1430
1450
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
|
|
1431
1451
|
this.scene,
|
|
1432
1452
|
this.configuration.emissiveGlowIntensity
|
|
1433
|
-
), this.initPromise = new Promise((
|
|
1453
|
+
), this.initPromise = new Promise((d) => {
|
|
1434
1454
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1435
|
-
this.initComplete = !0,
|
|
1455
|
+
this.initComplete = !0, d();
|
|
1436
1456
|
});
|
|
1437
1457
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1438
1458
|
}
|
|
@@ -1464,7 +1484,7 @@ class Wt {
|
|
|
1464
1484
|
}
|
|
1465
1485
|
registerView(e) {
|
|
1466
1486
|
const t = e.height, i = e.width;
|
|
1467
|
-
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);
|
|
1468
1488
|
}
|
|
1469
1489
|
getNumViewports() {
|
|
1470
1490
|
var e;
|
|
@@ -1482,7 +1502,7 @@ class Wt {
|
|
|
1482
1502
|
let t = () => {
|
|
1483
1503
|
};
|
|
1484
1504
|
const i = async () => {
|
|
1485
|
-
this.isAnimatingCamera = !0, await
|
|
1505
|
+
this.isAnimatingCamera = !0, await Ye(
|
|
1486
1506
|
this.scene,
|
|
1487
1507
|
this.scene.activeCamera,
|
|
1488
1508
|
e
|
|
@@ -1518,7 +1538,7 @@ class Wt {
|
|
|
1518
1538
|
throw new Error(
|
|
1519
1539
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1520
1540
|
);
|
|
1521
|
-
e ===
|
|
1541
|
+
e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1522
1542
|
}
|
|
1523
1543
|
animateToLastCameraFocus() {
|
|
1524
1544
|
let e = () => {
|
|
@@ -1581,8 +1601,8 @@ class Wt {
|
|
|
1581
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;
|
|
1582
1602
|
if (t === void 0 || i === void 0 || s === void 0 || r === void 0)
|
|
1583
1603
|
return !0;
|
|
1584
|
-
const o = [t, i], a = [s, r],
|
|
1585
|
-
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;
|
|
1586
1606
|
}
|
|
1587
1607
|
fireResizeEvent() {
|
|
1588
1608
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
@@ -1601,8 +1621,8 @@ class Wt {
|
|
|
1601
1621
|
);
|
|
1602
1622
|
o && o.getBindedMeshes().forEach(
|
|
1603
1623
|
(a) => {
|
|
1604
|
-
var
|
|
1605
|
-
return (
|
|
1624
|
+
var l;
|
|
1625
|
+
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1606
1626
|
a,
|
|
1607
1627
|
i || w.FromHexString("#fcba03")
|
|
1608
1628
|
);
|
|
@@ -1614,7 +1634,7 @@ class Wt {
|
|
|
1614
1634
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1615
1635
|
}
|
|
1616
1636
|
loadModel(e, t) {
|
|
1617
|
-
const i = new
|
|
1637
|
+
const i = new nt({
|
|
1618
1638
|
enablePicking: this.configuration.highlights.enabled,
|
|
1619
1639
|
modelDetails: e,
|
|
1620
1640
|
scene: this.scene,
|
|
@@ -1670,16 +1690,16 @@ class Wt {
|
|
|
1670
1690
|
*/
|
|
1671
1691
|
flipTransform(e, t, i) {
|
|
1672
1692
|
const s = se.Compose(
|
|
1673
|
-
|
|
1693
|
+
L(i || { x: 1, y: 1, z: 1 }),
|
|
1674
1694
|
y.FromEulerVector(
|
|
1675
|
-
|
|
1695
|
+
L(t || { x: 0, y: 0, z: 0 })
|
|
1676
1696
|
),
|
|
1677
|
-
|
|
1678
|
-
), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(),
|
|
1679
|
-
return o.decompose(
|
|
1680
|
-
position:
|
|
1681
|
-
rotation:
|
|
1682
|
-
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)
|
|
1683
1703
|
};
|
|
1684
1704
|
}
|
|
1685
1705
|
updatePreviewOptions(e) {
|
|
@@ -1709,10 +1729,10 @@ class Wt {
|
|
|
1709
1729
|
}
|
|
1710
1730
|
}
|
|
1711
1731
|
export {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1732
|
+
S as MaterialEffectMode,
|
|
1733
|
+
F as ProductCameraRig,
|
|
1734
|
+
Ne as REFLECTION_PROBE_RESOLUTION,
|
|
1715
1735
|
x as RenderingConfiguration,
|
|
1716
|
-
|
|
1717
|
-
|
|
1736
|
+
Yt as SpiffCommerce3DPreviewService,
|
|
1737
|
+
c as renderingPipelineDefaults
|
|
1718
1738
|
};
|