@spiffcommerce/preview 5.7.5 → 5.7.6-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +218 -215
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { ArcRotateCamera as fe } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
2
|
import { Engine as be } from "@babylonjs/core/Engines/engine";
|
|
3
3
|
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
-
import { HighlightLayer as
|
|
5
|
-
import { SceneLoader as
|
|
6
|
-
import { CubeTexture as
|
|
4
|
+
import { HighlightLayer as xe } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
+
import { SceneLoader as B } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as se } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as p, Quaternion as
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as p, Quaternion as x, Vector2 as re, Matrix as ae } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as ye } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
11
11
|
import { Tools as Ae } from "@babylonjs/core/Misc/tools";
|
|
12
12
|
import { Scene as Me } from "@babylonjs/core/scene";
|
|
13
13
|
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { GLTFLoaderAnimationStartMode as Re } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
|
-
import { PBRMaterial as
|
|
15
|
+
import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
16
16
|
import { MirrorTexture as Ee } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
17
|
-
import { Color3 as Te, Vector3 as
|
|
17
|
+
import { Color3 as Te, Vector3 as oe, Plane as Oe } from "@babylonjs/core/Maths/math";
|
|
18
18
|
import { ReflectionProbe as Le } from "@babylonjs/core/Probes/reflectionProbe";
|
|
19
19
|
import { GlowLayer as Ie } from "@babylonjs/core/Layers/glowLayer";
|
|
20
20
|
import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
|
|
21
|
-
import { ExecuteCodeAction as
|
|
21
|
+
import { ExecuteCodeAction as le } from "@babylonjs/core/Actions/directActions";
|
|
22
22
|
import { Mesh as Fe } from "@babylonjs/core/Meshes/mesh";
|
|
23
23
|
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
24
24
|
import { DynamicTexture as Be } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
@@ -26,7 +26,7 @@ import { Texture as De } from "@babylonjs/core/Materials/Textures/texture";
|
|
|
26
26
|
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 qe } from "@babylonjs/core/Misc/assetsManager";
|
|
29
|
-
import { ColorCurves as
|
|
29
|
+
import { ColorCurves as he } from "@babylonjs/core/Materials/colorCurves";
|
|
30
30
|
import { ImageProcessingConfiguration as M } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
31
|
import { DefaultRenderingPipeline as Ve } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
32
32
|
import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
@@ -40,31 +40,34 @@ 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
|
|
44
|
-
const
|
|
45
|
-
async function
|
|
46
|
-
|
|
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
|
+
const T = /* @__PURE__ */ new Map();
|
|
45
|
+
async function k(n, e, t) {
|
|
46
|
+
console.log(`Getting assset ${n} for scene ${e.getUniqueId()}`);
|
|
47
|
+
const i = T.get(n);
|
|
47
48
|
if (i)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
if (console.log(`Container exists for ${n}`), (await i).scene.isDisposed)
|
|
50
|
+
console.log(`Deleting existing container for ${n}`), T.delete(n);
|
|
51
|
+
else
|
|
52
|
+
return console.log(`Returning existing container for ${n}`), i;
|
|
53
|
+
console.log(`Creating new container for ${n}`);
|
|
54
|
+
const r = B.LoadAssetContainerAsync(
|
|
55
|
+
n,
|
|
56
|
+
void 0,
|
|
57
|
+
e,
|
|
58
|
+
t
|
|
59
|
+
);
|
|
60
|
+
return T.set(n, r), r;
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
B.OnPluginActivatedObservable.add((n) => {
|
|
63
|
+
n.name === "gltf" && (n.animationStartMode = Re.NONE);
|
|
61
64
|
});
|
|
62
65
|
class ce {
|
|
63
66
|
constructor(e) {
|
|
64
67
|
this.getSceneClearColor = () => {
|
|
65
|
-
var i, r,
|
|
68
|
+
var i, r, s, o;
|
|
66
69
|
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
67
|
-
if (this.customOptions && ((
|
|
70
|
+
if (this.customOptions && ((s = this.customOptions) != null && s.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
68
71
|
return new b(0, 0, 0, t).toLinearSpace();
|
|
69
72
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
70
73
|
const a = w.FromHexString(
|
|
@@ -99,14 +102,14 @@ class ce {
|
|
|
99
102
|
* Configuration related to the scene
|
|
100
103
|
*/
|
|
101
104
|
get scene() {
|
|
102
|
-
var e, t, i, r,
|
|
105
|
+
var e, t, i, r, s;
|
|
103
106
|
return {
|
|
104
107
|
clearColor: this.getSceneClearColor(),
|
|
105
108
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
106
109
|
environment: {
|
|
107
110
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
108
111
|
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
109
|
-
rotationY: (((
|
|
112
|
+
rotationY: (((s = this.customOptions) == null ? void 0 : s.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
110
113
|
// Convert to radians
|
|
111
114
|
}
|
|
112
115
|
};
|
|
@@ -115,7 +118,7 @@ class ce {
|
|
|
115
118
|
* Configuration related to the camera used to view and interact with the scene.
|
|
116
119
|
*/
|
|
117
120
|
get camera() {
|
|
118
|
-
var e, t, i, r,
|
|
121
|
+
var e, t, i, r, s, o, a, h, l, c, m, u, g;
|
|
119
122
|
return {
|
|
120
123
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
121
124
|
autoRotation: {
|
|
@@ -124,7 +127,7 @@ class ce {
|
|
|
124
127
|
},
|
|
125
128
|
limits: {
|
|
126
129
|
min: {
|
|
127
|
-
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((
|
|
130
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((s = this.customOptions) == null ? void 0 : s.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
128
131
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
129
132
|
radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
|
|
130
133
|
},
|
|
@@ -273,9 +276,9 @@ class Ge {
|
|
|
273
276
|
e,
|
|
274
277
|
t,
|
|
275
278
|
function(r) {
|
|
276
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
277
|
-
const o = t.extras[
|
|
278
|
-
r.metadata[
|
|
279
|
+
t.extras && Object.keys(t.extras).forEach((s) => {
|
|
280
|
+
const o = t.extras[s];
|
|
281
|
+
r.metadata[s] = o;
|
|
279
282
|
}), i(r);
|
|
280
283
|
}
|
|
281
284
|
);
|
|
@@ -301,7 +304,7 @@ class Ge {
|
|
|
301
304
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
302
305
|
*/
|
|
303
306
|
enableMaterialExtrasIfRequired(e, t) {
|
|
304
|
-
if (!(!e.extras || !(t instanceof
|
|
307
|
+
if (!(!e.extras || !(t instanceof D))) {
|
|
305
308
|
if (e.extras.sheen) {
|
|
306
309
|
const i = t;
|
|
307
310
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
@@ -334,16 +337,16 @@ class Ge {
|
|
|
334
337
|
* @param scene The scene to parse.
|
|
335
338
|
*/
|
|
336
339
|
applyReflections(e) {
|
|
337
|
-
function t(
|
|
340
|
+
function t(s) {
|
|
338
341
|
const o = [];
|
|
339
|
-
return
|
|
342
|
+
return s.transformNodes.forEach((a) => {
|
|
340
343
|
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
341
|
-
}),
|
|
344
|
+
}), s.meshes.forEach((a) => {
|
|
342
345
|
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
343
346
|
}), o;
|
|
344
347
|
}
|
|
345
|
-
function i(
|
|
346
|
-
const a =
|
|
348
|
+
function i(s, o = 1) {
|
|
349
|
+
const a = s.material;
|
|
347
350
|
if (!a)
|
|
348
351
|
return;
|
|
349
352
|
const h = new Ee(
|
|
@@ -353,32 +356,32 @@ class Ge {
|
|
|
353
356
|
!0
|
|
354
357
|
);
|
|
355
358
|
h.renderList = t(e);
|
|
356
|
-
const l =
|
|
359
|
+
const l = s.getVerticesData("normal");
|
|
357
360
|
if (!l)
|
|
358
361
|
throw new Error(
|
|
359
|
-
"Mirror attribute specified on: " +
|
|
362
|
+
"Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
|
|
360
363
|
);
|
|
361
|
-
|
|
362
|
-
const c =
|
|
363
|
-
new
|
|
364
|
+
s.computeWorldMatrix(!0);
|
|
365
|
+
const c = s.getWorldMatrix(), m = oe.TransformNormal(
|
|
366
|
+
new oe(l[0], l[1], l[2]),
|
|
364
367
|
c
|
|
365
368
|
).normalize(), u = Oe.FromPositionAndNormal(
|
|
366
|
-
|
|
369
|
+
s.position,
|
|
367
370
|
m.scale(-1)
|
|
368
371
|
);
|
|
369
372
|
h.mirrorPlane = u, h.level = o, a.reflectionTexture = h;
|
|
370
373
|
}
|
|
371
|
-
function r(
|
|
372
|
-
const o =
|
|
374
|
+
function r(s) {
|
|
375
|
+
const o = s.material, a = new Le(
|
|
373
376
|
"probe-" + o.name,
|
|
374
377
|
Ne,
|
|
375
378
|
e
|
|
376
379
|
);
|
|
377
|
-
a.attachToMesh(
|
|
380
|
+
a.attachToMesh(s), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
378
381
|
}
|
|
379
|
-
e.meshes.forEach((
|
|
380
|
-
const o =
|
|
381
|
-
o && (o.mirrorTexture && i(
|
|
382
|
+
e.meshes.forEach((s) => {
|
|
383
|
+
const o = s.metadata;
|
|
384
|
+
o && (o.mirrorTexture && i(s, o.mirrorTexture), o.reflectionProbe && r(s));
|
|
382
385
|
});
|
|
383
386
|
}
|
|
384
387
|
}
|
|
@@ -404,10 +407,10 @@ class _e {
|
|
|
404
407
|
}
|
|
405
408
|
}
|
|
406
409
|
}
|
|
407
|
-
function He(
|
|
408
|
-
t.forEach((
|
|
409
|
-
const o =
|
|
410
|
-
|
|
410
|
+
function He(n, e, t, i, r = "") {
|
|
411
|
+
t.forEach((s) => {
|
|
412
|
+
const o = s.getID(), a = s.getName(), h = A.getDynamicTextureResolution();
|
|
413
|
+
n.filter((c) => c.name === r + a).forEach((c) => {
|
|
411
414
|
const m = i.get(o), u = !1;
|
|
412
415
|
if (m)
|
|
413
416
|
de(c, m), m.update(u);
|
|
@@ -418,7 +421,7 @@ function He(s, e, t, i, r = "") {
|
|
|
418
421
|
h.width,
|
|
419
422
|
h.height
|
|
420
423
|
);
|
|
421
|
-
i.set(o, g),
|
|
424
|
+
i.set(o, g), s.setStaticContext(
|
|
422
425
|
g.getContext()
|
|
423
426
|
), de(c, g), g.onLoadObservable.addOnce(() => {
|
|
424
427
|
g.update(u);
|
|
@@ -427,45 +430,45 @@ function He(s, e, t, i, r = "") {
|
|
|
427
430
|
});
|
|
428
431
|
});
|
|
429
432
|
}
|
|
430
|
-
function Ue(
|
|
433
|
+
function Ue(n, e, t, i) {
|
|
431
434
|
const r = new Be(
|
|
432
|
-
|
|
435
|
+
n,
|
|
433
436
|
{ width: t, height: i },
|
|
434
437
|
e,
|
|
435
438
|
A.shouldMipMap(),
|
|
436
439
|
De.TRILINEAR_SAMPLINGMODE,
|
|
437
440
|
be.TEXTUREFORMAT_RGBA
|
|
438
|
-
),
|
|
439
|
-
return
|
|
441
|
+
), s = r.getContext();
|
|
442
|
+
return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), r.update()), r;
|
|
440
443
|
}
|
|
441
|
-
function de(
|
|
442
|
-
if (
|
|
443
|
-
const t =
|
|
444
|
+
function de(n, e) {
|
|
445
|
+
if (n instanceof D) {
|
|
446
|
+
const t = n, i = t.albedoTexture;
|
|
444
447
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
445
448
|
} else {
|
|
446
|
-
const t =
|
|
449
|
+
const t = n, i = t.diffuseTexture;
|
|
447
450
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
448
451
|
}
|
|
449
452
|
}
|
|
450
453
|
function Ke() {
|
|
451
|
-
const
|
|
452
|
-
return
|
|
454
|
+
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
455
|
+
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
453
456
|
}
|
|
454
|
-
const
|
|
455
|
-
function me(
|
|
456
|
-
return
|
|
457
|
+
const y = 60, ue = 1;
|
|
458
|
+
function me(n) {
|
|
459
|
+
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
457
460
|
}
|
|
458
|
-
function ve(
|
|
459
|
-
const o = r ?
|
|
461
|
+
function ve(n, e, t, i, r, s) {
|
|
462
|
+
const o = r ? n.filter((c) => c.name === r) : n;
|
|
460
463
|
if (o.length === 0) {
|
|
461
464
|
console.warn(`No animations found for name: ${r}`);
|
|
462
465
|
return;
|
|
463
466
|
}
|
|
464
467
|
let a = 0;
|
|
465
468
|
const h = () => {
|
|
466
|
-
a++, a === o.length &&
|
|
469
|
+
a++, a === o.length && s && s();
|
|
467
470
|
}, l = (c, m, u, g, f) => {
|
|
468
|
-
c.stop(), c.start(m, u, g, f),
|
|
471
|
+
c.stop(), c.start(m, u, g, f), s && (m == !1 || m === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
|
|
469
472
|
h();
|
|
470
473
|
}) : c.onAnimationLoopObservable.addOnce(() => {
|
|
471
474
|
h();
|
|
@@ -483,10 +486,10 @@ function ve(s, e, t, i, r, n) {
|
|
|
483
486
|
l(c, e, ue, u, g);
|
|
484
487
|
});
|
|
485
488
|
}
|
|
486
|
-
function We(
|
|
489
|
+
function We(n, e, t) {
|
|
487
490
|
return new Promise((i) => {
|
|
488
|
-
|
|
489
|
-
const r = [],
|
|
491
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
|
|
492
|
+
const r = [], s = t.target, o = 0, a = s ? 1 : 0;
|
|
490
493
|
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
491
494
|
P(
|
|
492
495
|
"cameraTargetLerp",
|
|
@@ -533,10 +536,10 @@ function We(s, e, t) {
|
|
|
533
536
|
}
|
|
534
537
|
e.animations.push(...r);
|
|
535
538
|
const l = e.useAutoRotationBehavior;
|
|
536
|
-
e.disableAutoRotationBehavior(),
|
|
539
|
+
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
537
540
|
e,
|
|
538
541
|
0,
|
|
539
|
-
|
|
542
|
+
s ? y * 2 : y,
|
|
540
543
|
!1,
|
|
541
544
|
1,
|
|
542
545
|
() => {
|
|
@@ -545,33 +548,33 @@ function We(s, e, t) {
|
|
|
545
548
|
);
|
|
546
549
|
});
|
|
547
550
|
}
|
|
548
|
-
function ge(
|
|
549
|
-
return
|
|
551
|
+
function ge(n) {
|
|
552
|
+
return n * Math.PI / 180;
|
|
550
553
|
}
|
|
551
|
-
function P(
|
|
554
|
+
function P(n, e, t, i, r, s = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
552
555
|
const a = new ke();
|
|
553
556
|
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
554
557
|
const h = new v(
|
|
555
|
-
|
|
558
|
+
n,
|
|
556
559
|
e,
|
|
557
|
-
|
|
560
|
+
y,
|
|
558
561
|
r,
|
|
559
562
|
o
|
|
560
563
|
), l = [];
|
|
561
|
-
return
|
|
562
|
-
frame:
|
|
564
|
+
return s > 0 && l.push({ frame: 0, value: t }), l.push({ frame: y * s, value: t }), l.push({
|
|
565
|
+
frame: y * (s + 1),
|
|
563
566
|
value: i
|
|
564
567
|
}), h.setKeys(l), h.setEasingFunction(a), h;
|
|
565
568
|
}
|
|
566
|
-
function Ye(
|
|
567
|
-
return
|
|
569
|
+
function Ye(n, e, t) {
|
|
570
|
+
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
568
571
|
}
|
|
569
|
-
function Qe(
|
|
570
|
-
|
|
572
|
+
function Qe(n, e, t) {
|
|
573
|
+
n.forEach((i) => {
|
|
571
574
|
t && i.name !== t || i.goToFrame(e);
|
|
572
575
|
});
|
|
573
576
|
}
|
|
574
|
-
const
|
|
577
|
+
const $e = {
|
|
575
578
|
albedoTexture: "albedoMap",
|
|
576
579
|
bumpTexture: "normalMap",
|
|
577
580
|
ambientTexture: "ambientMap",
|
|
@@ -581,7 +584,7 @@ const Ze = {
|
|
|
581
584
|
refractionTexture: "refractionMap",
|
|
582
585
|
reflectionTexture: "reflectionMap"
|
|
583
586
|
};
|
|
584
|
-
function
|
|
587
|
+
function Ze(n, e, t, i) {
|
|
585
588
|
[
|
|
586
589
|
"albedoTexture",
|
|
587
590
|
"bumpTexture",
|
|
@@ -591,49 +594,49 @@ function $e(s, e, t, i) {
|
|
|
591
594
|
"metallicTexture",
|
|
592
595
|
"refractionTexture",
|
|
593
596
|
"reflectionTexture"
|
|
594
|
-
].forEach((
|
|
597
|
+
].forEach((s) => {
|
|
595
598
|
je(
|
|
596
|
-
n,
|
|
597
599
|
s,
|
|
600
|
+
n,
|
|
598
601
|
e,
|
|
599
602
|
t,
|
|
600
603
|
i
|
|
601
604
|
);
|
|
602
|
-
}), et(
|
|
605
|
+
}), et(n, e);
|
|
603
606
|
}
|
|
604
|
-
function je(
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
607
|
+
function je(n, e, t, i, r) {
|
|
608
|
+
const s = $e[n];
|
|
609
|
+
if (!s)
|
|
607
610
|
throw new Error("Unexpected texture name encountered.");
|
|
608
|
-
const o = e[
|
|
609
|
-
a ?
|
|
610
|
-
|
|
611
|
+
const o = e[s], a = o == null ? void 0 : o.fileLink;
|
|
612
|
+
a ? n === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
613
|
+
n,
|
|
611
614
|
a,
|
|
612
615
|
void 0,
|
|
613
616
|
!1,
|
|
614
617
|
void 0,
|
|
615
618
|
!0
|
|
616
619
|
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
617
|
-
|
|
620
|
+
n,
|
|
618
621
|
a,
|
|
619
622
|
128,
|
|
620
623
|
!1,
|
|
621
624
|
!0,
|
|
622
625
|
!1
|
|
623
|
-
) : i.addTextureTask(
|
|
626
|
+
) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : r && t[n] && (t[n] && t[n].dispose(), t[n] = null, Xe(n, t));
|
|
624
627
|
}
|
|
625
|
-
function Xe(
|
|
626
|
-
|
|
628
|
+
function Xe(n, e) {
|
|
629
|
+
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
630
|
}
|
|
628
|
-
function Je(
|
|
631
|
+
function Je(n, e, t, i) {
|
|
629
632
|
if (!e) {
|
|
630
633
|
console.error("Failed to apply texture to material: material is null.");
|
|
631
634
|
return;
|
|
632
635
|
}
|
|
633
|
-
|
|
636
|
+
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
637
|
}
|
|
635
|
-
function et(
|
|
636
|
-
|
|
638
|
+
function et(n, e) {
|
|
639
|
+
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
640
|
}
|
|
638
641
|
class tt {
|
|
639
642
|
constructor(e, t, i) {
|
|
@@ -649,7 +652,7 @@ class tt {
|
|
|
649
652
|
* where we want to undo changes are remove effects from display.
|
|
650
653
|
*/
|
|
651
654
|
async applyMaterial(e, t, i, r) {
|
|
652
|
-
return new Promise((
|
|
655
|
+
return new Promise((s) => {
|
|
653
656
|
const o = this.materialVariantMap.get(e);
|
|
654
657
|
this.materialVariantMap.set(e, {
|
|
655
658
|
...o,
|
|
@@ -659,12 +662,12 @@ class tt {
|
|
|
659
662
|
(c) => c.name === a
|
|
660
663
|
);
|
|
661
664
|
if (h.length === 0) {
|
|
662
|
-
|
|
665
|
+
s();
|
|
663
666
|
return;
|
|
664
667
|
}
|
|
665
668
|
const l = new qe(this.scene);
|
|
666
669
|
l.useDefaultLoadingScreen = !1, h.forEach(
|
|
667
|
-
(c) =>
|
|
670
|
+
(c) => Ze(
|
|
668
671
|
t,
|
|
669
672
|
c,
|
|
670
673
|
l,
|
|
@@ -685,7 +688,7 @@ class tt {
|
|
|
685
688
|
u.texture
|
|
686
689
|
)
|
|
687
690
|
);
|
|
688
|
-
}),
|
|
691
|
+
}), s();
|
|
689
692
|
}, l.loadAsync();
|
|
690
693
|
});
|
|
691
694
|
}
|
|
@@ -699,23 +702,23 @@ class tt {
|
|
|
699
702
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
700
703
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
701
704
|
*/
|
|
702
|
-
async applyModel(e, t, i, r,
|
|
705
|
+
async applyModel(e, t, i, r, s, o, a) {
|
|
703
706
|
var m;
|
|
704
707
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
705
708
|
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(
|
|
706
709
|
(u) => u !== e
|
|
707
710
|
), Promise.resolve(void 0);
|
|
708
|
-
const l = (await
|
|
711
|
+
const l = (await k(i, this.scene, r)).instantiateModelsToScene(
|
|
709
712
|
this.renameClonedAsset,
|
|
710
713
|
!0
|
|
711
714
|
);
|
|
712
|
-
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)),
|
|
713
|
-
const u = o && o(), g =
|
|
715
|
+
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), s) {
|
|
716
|
+
const u = o && o(), g = s.name ? this.renameClonedAsset(s.name) : void 0;
|
|
714
717
|
if (ve(
|
|
715
718
|
l.animationGroups,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
+
s.loop,
|
|
720
|
+
s.to,
|
|
721
|
+
s.from,
|
|
719
722
|
g
|
|
720
723
|
), u != null) {
|
|
721
724
|
const f = a && a() || !0;
|
|
@@ -752,19 +755,19 @@ class tt {
|
|
|
752
755
|
}), e;
|
|
753
756
|
}
|
|
754
757
|
}
|
|
755
|
-
function we(
|
|
758
|
+
function we(n) {
|
|
756
759
|
const e = [];
|
|
757
|
-
return
|
|
760
|
+
return n.rootNodes.forEach((t) => {
|
|
758
761
|
t.getChildMeshes().forEach((i) => {
|
|
759
762
|
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
760
|
-
const
|
|
761
|
-
|
|
763
|
+
const s = r.getMaterial(!1);
|
|
764
|
+
s && !e.includes(s) && e.push(s);
|
|
762
765
|
});
|
|
763
766
|
});
|
|
764
767
|
}), e;
|
|
765
768
|
}
|
|
766
|
-
function pe(
|
|
767
|
-
return
|
|
769
|
+
function pe(n, e = "") {
|
|
770
|
+
return n.map((t) => ({
|
|
768
771
|
name: t.name.substring(e.length),
|
|
769
772
|
loop: t.loopAnimation,
|
|
770
773
|
to: t.to,
|
|
@@ -778,7 +781,7 @@ class it {
|
|
|
778
781
|
enablePicking: t,
|
|
779
782
|
modelDetails: i,
|
|
780
783
|
previewService: r,
|
|
781
|
-
progressHandler:
|
|
784
|
+
progressHandler: s,
|
|
782
785
|
scene: o
|
|
783
786
|
} = e;
|
|
784
787
|
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new tt(
|
|
@@ -791,10 +794,10 @@ class it {
|
|
|
791
794
|
throw new Error(
|
|
792
795
|
"Model container constructed with no URL. This is currently unsupported."
|
|
793
796
|
);
|
|
794
|
-
return this.assetContainer = await
|
|
797
|
+
return this.assetContainer = await k(
|
|
795
798
|
i.model,
|
|
796
799
|
o,
|
|
797
|
-
|
|
800
|
+
s
|
|
798
801
|
), await this.instantiate(), this;
|
|
799
802
|
};
|
|
800
803
|
this.importPromise = a();
|
|
@@ -833,7 +836,7 @@ class it {
|
|
|
833
836
|
}
|
|
834
837
|
return;
|
|
835
838
|
}
|
|
836
|
-
const
|
|
839
|
+
const s = async () => {
|
|
837
840
|
await this.variantManager.applyMaterial(
|
|
838
841
|
e,
|
|
839
842
|
i,
|
|
@@ -850,18 +853,18 @@ class it {
|
|
|
850
853
|
if (this.materialChangesInProgress.includes(e)) {
|
|
851
854
|
if (this.queuedMaterialChanges.has(e)) {
|
|
852
855
|
const o = this.queuedMaterialChanges.get(e);
|
|
853
|
-
o == null || o.set(t,
|
|
856
|
+
o == null || o.set(t, s);
|
|
854
857
|
} else {
|
|
855
858
|
this.queuedMaterialChanges.set(
|
|
856
859
|
e,
|
|
857
860
|
/* @__PURE__ */ new Map()
|
|
858
861
|
);
|
|
859
862
|
const o = this.queuedMaterialChanges.get(e);
|
|
860
|
-
o == null || o.set(t,
|
|
863
|
+
o == null || o.set(t, s);
|
|
861
864
|
}
|
|
862
865
|
return;
|
|
863
866
|
}
|
|
864
|
-
if (this.materialChangesInProgress.push(e), await
|
|
867
|
+
if (this.materialChangesInProgress.push(e), await s(), this.queuedMaterialChanges.has(e)) {
|
|
865
868
|
const o = this.queuedMaterialChanges.get(e);
|
|
866
869
|
if (!o)
|
|
867
870
|
throw new Error("Target material is undefined");
|
|
@@ -933,12 +936,12 @@ class it {
|
|
|
933
936
|
const i = async () => {
|
|
934
937
|
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
935
938
|
var o;
|
|
936
|
-
const
|
|
939
|
+
const s = [
|
|
937
940
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
938
941
|
...this.variantManager.getAnimationGroups()
|
|
939
942
|
];
|
|
940
943
|
ve(
|
|
941
|
-
|
|
944
|
+
s,
|
|
942
945
|
e.loop,
|
|
943
946
|
e.to,
|
|
944
947
|
e.from,
|
|
@@ -1004,7 +1007,7 @@ class it {
|
|
|
1004
1007
|
set rotation(e) {
|
|
1005
1008
|
if (!this.transformRoot)
|
|
1006
1009
|
throw new Error("ModelContainer disposed prior to setting rotation!");
|
|
1007
|
-
this.transformRoot.rotationQuaternion =
|
|
1010
|
+
this.transformRoot.rotationQuaternion = x.FromEulerAngles(
|
|
1008
1011
|
e.x,
|
|
1009
1012
|
e.y,
|
|
1010
1013
|
e.z
|
|
@@ -1026,14 +1029,14 @@ class it {
|
|
|
1026
1029
|
e.rootNodes.forEach((t) => {
|
|
1027
1030
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1028
1031
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
|
|
1029
|
-
new
|
|
1032
|
+
new le(R.OnPointerOverTrigger, (r) => {
|
|
1030
1033
|
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1031
1034
|
id: i.material.id,
|
|
1032
1035
|
name: this.stripIdFromName(i.material.name)
|
|
1033
1036
|
});
|
|
1034
1037
|
})
|
|
1035
1038
|
), i.actionManager.registerAction(
|
|
1036
|
-
new
|
|
1039
|
+
new le(R.OnPointerOutTrigger, () => {
|
|
1037
1040
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
1038
1041
|
id: i.material.id,
|
|
1039
1042
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1062,23 +1065,23 @@ class it {
|
|
|
1062
1065
|
return this.modelReadyToLoadCallbacks.size;
|
|
1063
1066
|
}
|
|
1064
1067
|
configureGlowLayer() {
|
|
1065
|
-
const e = (i) => i instanceof
|
|
1068
|
+
const e = (i) => i instanceof D && i.emissiveTexture !== null;
|
|
1066
1069
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1067
1070
|
}
|
|
1068
1071
|
configureModelInstance(e) {
|
|
1069
|
-
var
|
|
1072
|
+
var s;
|
|
1070
1073
|
if (!this.transformRoot)
|
|
1071
1074
|
throw new Error(
|
|
1072
1075
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1073
1076
|
);
|
|
1074
1077
|
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1075
|
-
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion =
|
|
1078
|
+
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = x.Identity(), this.transformRoot.scaling = p.One();
|
|
1076
1079
|
for (const o of e.rootNodes) {
|
|
1077
1080
|
o.parent = this.transformRoot;
|
|
1078
1081
|
for (const a of o.getChildMeshes(!1))
|
|
1079
1082
|
a.alwaysSelectAsActiveMesh = !0;
|
|
1080
1083
|
}
|
|
1081
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((
|
|
1084
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((s = this.contextService) == null ? void 0 : s.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1082
1085
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1083
1086
|
this.scene,
|
|
1084
1087
|
this.canvasPanels,
|
|
@@ -1181,14 +1184,14 @@ class it {
|
|
|
1181
1184
|
}
|
|
1182
1185
|
//#endregion
|
|
1183
1186
|
}
|
|
1184
|
-
class
|
|
1185
|
-
constructor(e, t, i, r,
|
|
1187
|
+
class z extends fe {
|
|
1188
|
+
constructor(e, t, i, r, s, o, a, h) {
|
|
1186
1189
|
super(
|
|
1187
1190
|
e,
|
|
1188
1191
|
t,
|
|
1189
1192
|
i,
|
|
1190
1193
|
r,
|
|
1191
|
-
|
|
1194
|
+
s,
|
|
1192
1195
|
o,
|
|
1193
1196
|
h
|
|
1194
1197
|
), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, a.camera.autoOrientation && (this.alpha += Math.PI), a && (a.camera.limits.min.beta && (this.lowerBetaLimit = a.camera.limits.min.beta), a.camera.limits.max.beta && (this.upperBetaLimit = a.camera.limits.max.beta), a.camera.limits.min.alpha && (this.lowerAlphaLimit = a.camera.limits.min.alpha), a.camera.limits.max.alpha && (this.upperAlphaLimit = a.camera.limits.max.alpha), a.camera.limits.min.radius && (this.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.upperRadiusLimit = a.camera.limits.max.radius), a.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
@@ -1232,7 +1235,7 @@ class k extends fe {
|
|
|
1232
1235
|
this.useFramingBehavior = !0;
|
|
1233
1236
|
const e = this.getFramingBehavior();
|
|
1234
1237
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1235
|
-
const t =
|
|
1238
|
+
const t = O(this._scene);
|
|
1236
1239
|
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;
|
|
1237
1240
|
}
|
|
1238
1241
|
/**
|
|
@@ -1246,10 +1249,10 @@ class k extends fe {
|
|
|
1246
1249
|
i.framingTime = t || 800;
|
|
1247
1250
|
const r = () => {
|
|
1248
1251
|
this.isRunningFramingBehavior = !1;
|
|
1249
|
-
},
|
|
1252
|
+
}, s = O(this._scene), o = s.max.subtract(s.min), a = s.min.add(o.scale(0.5));
|
|
1250
1253
|
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(
|
|
1251
|
-
|
|
1252
|
-
|
|
1254
|
+
s.min,
|
|
1255
|
+
s.max,
|
|
1253
1256
|
void 0,
|
|
1254
1257
|
r
|
|
1255
1258
|
), i.framingTime = 0;
|
|
@@ -1283,30 +1286,30 @@ class k extends fe {
|
|
|
1283
1286
|
*/
|
|
1284
1287
|
static create(e, t, i) {
|
|
1285
1288
|
var h;
|
|
1286
|
-
const r =
|
|
1289
|
+
const r = O(e), s = r.max.subtract(r.min), o = r.min.add(s.scale(0.5)), a = new z(
|
|
1287
1290
|
"ProductCamera",
|
|
1288
1291
|
-(Math.PI / 2),
|
|
1289
1292
|
Math.PI / 2,
|
|
1290
|
-
|
|
1293
|
+
s.length() * 1.5,
|
|
1291
1294
|
o,
|
|
1292
1295
|
e,
|
|
1293
1296
|
t
|
|
1294
1297
|
);
|
|
1295
1298
|
return a.setPanEnabled(
|
|
1296
1299
|
((h = t.options) == null ? void 0 : h.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1297
|
-
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator =
|
|
1300
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = s.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1298
1301
|
a.setPanEnabled(a.panEnabled);
|
|
1299
1302
|
}), i && (e.activeCamera = a), a;
|
|
1300
1303
|
}
|
|
1301
1304
|
}
|
|
1302
|
-
function
|
|
1303
|
-
if (
|
|
1305
|
+
function O(n) {
|
|
1306
|
+
if (n.meshes.length === 0)
|
|
1304
1307
|
return {
|
|
1305
1308
|
min: new p(-1, -1, -1),
|
|
1306
1309
|
max: new p(1, 1, 1)
|
|
1307
1310
|
};
|
|
1308
|
-
const e =
|
|
1309
|
-
return
|
|
1311
|
+
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1312
|
+
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1310
1313
|
}
|
|
1311
1314
|
class nt {
|
|
1312
1315
|
constructor(e, t = !1, i = void 0) {
|
|
@@ -1326,15 +1329,15 @@ class nt {
|
|
|
1326
1329
|
return this.currentConfiguration;
|
|
1327
1330
|
}
|
|
1328
1331
|
setConfiguration(e) {
|
|
1329
|
-
var t, i, r,
|
|
1332
|
+
var t, i, r, s, o, a, h, l, c, m, u, g, f, q, V, N, G, _, H, U, K, W, Y, Q, $, Z, j, X, J, ee, te, ie, ne;
|
|
1330
1333
|
if (this.renderingPipeline.isSupported) {
|
|
1331
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((
|
|
1334
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((s = e.bloom) == null ? void 0 : s.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((h = e.bloom) == null ? void 0 : h.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((l = e.chromaticAberration) == null ? void 0 : l.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((m = e.chromaticAberration) == null ? void 0 : m.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (u = e.chromaticAberration) != null && u.direction ? new re(
|
|
1332
1335
|
e.chromaticAberration.direction.x,
|
|
1333
1336
|
e.chromaticAberration.direction.y
|
|
1334
|
-
) : new
|
|
1337
|
+
) : new re(
|
|
1335
1338
|
d.chromaticAberration.direction.x,
|
|
1336
1339
|
d.chromaticAberration.direction.y
|
|
1337
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new
|
|
1340
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new he(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
|
|
1338
1341
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1339
1342
|
case "Low":
|
|
1340
1343
|
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
@@ -1346,7 +1349,7 @@ class nt {
|
|
|
1346
1349
|
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1347
1350
|
break;
|
|
1348
1351
|
}
|
|
1349
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1352
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((q = e.depthOfField) == null ? void 0 : q.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((V = e.depthOfField) == null ? void 0 : V.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((N = e.depthOfField) == null ? void 0 : N.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((G = e.depthOfField) == null ? void 0 : G.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((Y = e.misc) == null ? void 0 : Y.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1350
1353
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1351
1354
|
case "Standard":
|
|
1352
1355
|
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_STANDARD;
|
|
@@ -1355,8 +1358,8 @@ class nt {
|
|
|
1355
1358
|
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_ACES;
|
|
1356
1359
|
break;
|
|
1357
1360
|
}
|
|
1358
|
-
if (this.renderingPipeline.sharpenEnabled = ((
|
|
1359
|
-
switch (((
|
|
1361
|
+
if (this.renderingPipeline.sharpenEnabled = ((Q = e.sharpen) == null ? void 0 : Q.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = (($ = e.sharpen) == null ? void 0 : $.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((j = e.vignette) == null ? void 0 : j.enabled) ?? d.vignette.enabled, (X = e.vignette) != null && X.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
|
|
1362
|
+
switch (((J = e.vignette) == null ? void 0 : J.blendMode) ?? d.vignette.blendMode) {
|
|
1360
1363
|
case "Multiply":
|
|
1361
1364
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_MULTIPLY;
|
|
1362
1365
|
break;
|
|
@@ -1364,38 +1367,38 @@ class nt {
|
|
|
1364
1367
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_OPAQUE;
|
|
1365
1368
|
break;
|
|
1366
1369
|
}
|
|
1367
|
-
(
|
|
1370
|
+
(ee = e.vignette) != null && ee.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1368
1371
|
e.vignette.colorRgba.r,
|
|
1369
1372
|
e.vignette.colorRgba.g,
|
|
1370
1373
|
e.vignette.colorRgba.b,
|
|
1371
1374
|
e.vignette.colorRgba.a
|
|
1372
|
-
) : (
|
|
1375
|
+
) : (te = e.vignette) != null && te.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1373
1376
|
d.vignette.colorRgba.r,
|
|
1374
1377
|
d.vignette.colorRgba.g,
|
|
1375
1378
|
d.vignette.colorRgba.b,
|
|
1376
1379
|
d.vignette.colorRgba.a
|
|
1377
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((
|
|
1380
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ie = e.vignette) == null ? void 0 : ie.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ne = e.vignette) == null ? void 0 : ne.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1378
1381
|
}
|
|
1379
1382
|
}
|
|
1380
1383
|
updateColorCurve(e) {
|
|
1381
|
-
const t = new
|
|
1384
|
+
const t = new he();
|
|
1382
1385
|
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;
|
|
1383
1386
|
}
|
|
1384
1387
|
}
|
|
1385
|
-
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1386
|
-
return new Ge(
|
|
1388
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1389
|
+
return new Ge(n);
|
|
1387
1390
|
});
|
|
1388
|
-
|
|
1389
|
-
if (
|
|
1390
|
-
const e =
|
|
1391
|
+
B.OnPluginActivatedObservable.add((n) => {
|
|
1392
|
+
if (n.name === "gltf") {
|
|
1393
|
+
const e = n;
|
|
1391
1394
|
e.transparencyAsCoverage = !0;
|
|
1392
1395
|
}
|
|
1393
1396
|
});
|
|
1394
|
-
function
|
|
1395
|
-
return new p(
|
|
1397
|
+
function L(n) {
|
|
1398
|
+
return new p(n.x, n.y, n.z);
|
|
1396
1399
|
}
|
|
1397
|
-
function
|
|
1398
|
-
return { x:
|
|
1400
|
+
function I(n) {
|
|
1401
|
+
return { x: n.x, y: n.y, z: n.z };
|
|
1399
1402
|
}
|
|
1400
1403
|
class Wt {
|
|
1401
1404
|
constructor(e) {
|
|
@@ -1425,14 +1428,14 @@ class Wt {
|
|
|
1425
1428
|
if (!(e != null && e.noRender))
|
|
1426
1429
|
return this.configuration.createCanvas();
|
|
1427
1430
|
})(), r = "1.5.6";
|
|
1428
|
-
|
|
1431
|
+
ye.Configuration = {
|
|
1429
1432
|
decoder: {
|
|
1430
1433
|
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1431
1434
|
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1432
1435
|
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1433
1436
|
}
|
|
1434
1437
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1435
|
-
const
|
|
1438
|
+
const s = console.log;
|
|
1436
1439
|
console.log = () => {
|
|
1437
1440
|
};
|
|
1438
1441
|
const o = i ? new be(i, !0, {
|
|
@@ -1444,12 +1447,12 @@ class Wt {
|
|
|
1444
1447
|
stencil: this.configuration.highlights.enabled,
|
|
1445
1448
|
forceSRGBBufferSupportState: !0
|
|
1446
1449
|
}) : new Ce();
|
|
1447
|
-
console.log =
|
|
1450
|
+
console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Me(o), this.camera = z.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1448
1451
|
this.scene,
|
|
1449
1452
|
!1,
|
|
1450
1453
|
this.camera
|
|
1451
1454
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1452
|
-
const a =
|
|
1455
|
+
const a = se.CreateFromPrefilteredData(
|
|
1453
1456
|
this.configuration.scene.environment.file,
|
|
1454
1457
|
this.scene
|
|
1455
1458
|
);
|
|
@@ -1492,7 +1495,7 @@ class Wt {
|
|
|
1492
1495
|
}
|
|
1493
1496
|
registerView(e) {
|
|
1494
1497
|
const t = e.height, i = e.width;
|
|
1495
|
-
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1498
|
+
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);
|
|
1496
1499
|
}
|
|
1497
1500
|
getNumViewports() {
|
|
1498
1501
|
var e;
|
|
@@ -1546,7 +1549,7 @@ class Wt {
|
|
|
1546
1549
|
throw new Error(
|
|
1547
1550
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1548
1551
|
);
|
|
1549
|
-
e ===
|
|
1552
|
+
e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1550
1553
|
}
|
|
1551
1554
|
animateToLastCameraFocus() {
|
|
1552
1555
|
let e = () => {
|
|
@@ -1555,9 +1558,9 @@ class Wt {
|
|
|
1555
1558
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1556
1559
|
this.focusLostNotified = !1;
|
|
1557
1560
|
const r = () => {
|
|
1558
|
-
const
|
|
1561
|
+
const s = this.configuration;
|
|
1559
1562
|
this.camera.rerunFramingBehavior(() => {
|
|
1560
|
-
|
|
1563
|
+
s.camera.limits.min.radius && (this.camera.lowerRadiusLimit = s.camera.limits.min.radius), s.camera.limits.max.radius && (this.camera.upperRadiusLimit = s.camera.limits.max.radius), i();
|
|
1561
1564
|
});
|
|
1562
1565
|
};
|
|
1563
1566
|
this.scene.onAfterRenderObservable.addOnce(r);
|
|
@@ -1591,8 +1594,8 @@ class Wt {
|
|
|
1591
1594
|
this.scene
|
|
1592
1595
|
);
|
|
1593
1596
|
try {
|
|
1594
|
-
const r = t.latDeg * Math.PI / 180,
|
|
1595
|
-
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha =
|
|
1597
|
+
const r = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
|
|
1598
|
+
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = s, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1596
1599
|
const o = await Ae.CreateScreenshotUsingRenderTargetAsync(
|
|
1597
1600
|
this.engine,
|
|
1598
1601
|
i,
|
|
@@ -1610,10 +1613,10 @@ class Wt {
|
|
|
1610
1613
|
const e = this.configuration;
|
|
1611
1614
|
if (!e)
|
|
1612
1615
|
return !0;
|
|
1613
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta,
|
|
1614
|
-
if (t === void 0 || i === void 0 || r === void 0 ||
|
|
1616
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
|
|
1617
|
+
if (t === void 0 || i === void 0 || r === void 0 || s === void 0)
|
|
1615
1618
|
return !0;
|
|
1616
|
-
const o = [t, i], a = [r,
|
|
1619
|
+
const o = [t, i], a = [r, s], h = o.every((c) => c === t), l = a.every((c) => c === r);
|
|
1617
1620
|
return !h && !l;
|
|
1618
1621
|
}
|
|
1619
1622
|
fireResizeEvent() {
|
|
@@ -1621,15 +1624,15 @@ class Wt {
|
|
|
1621
1624
|
}
|
|
1622
1625
|
setHighlights(e, t) {
|
|
1623
1626
|
var r;
|
|
1624
|
-
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new
|
|
1627
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new xe("highlights", this.scene, {
|
|
1625
1628
|
isStroke: !0,
|
|
1626
1629
|
blurVerticalSize: 0.85,
|
|
1627
1630
|
blurHorizontalSize: 0.85
|
|
1628
1631
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1629
1632
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1630
|
-
e.forEach((
|
|
1633
|
+
e.forEach((s) => {
|
|
1631
1634
|
const o = this.scene.materials.find(
|
|
1632
|
-
(a) => a.name ===
|
|
1635
|
+
(a) => a.name === s.name && a.id === s.id
|
|
1633
1636
|
);
|
|
1634
1637
|
o && o.getBindedMeshes().forEach(
|
|
1635
1638
|
(a) => {
|
|
@@ -1646,30 +1649,30 @@ class Wt {
|
|
|
1646
1649
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1647
1650
|
}
|
|
1648
1651
|
loadModel(e, t) {
|
|
1649
|
-
const { refocusCamera: i = !0, progressHandler: r } = t ?? {},
|
|
1652
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, s = new it({
|
|
1650
1653
|
enablePicking: this.configuration.highlights.enabled,
|
|
1651
1654
|
modelDetails: e,
|
|
1652
1655
|
scene: this.scene,
|
|
1653
1656
|
previewService: this,
|
|
1654
1657
|
progressHandler: r
|
|
1655
1658
|
});
|
|
1656
|
-
return
|
|
1659
|
+
return s.getInitializationPromise().then(() => {
|
|
1657
1660
|
this.modelContainers.size <= 1 && i && (this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
|
|
1658
1661
|
this.scene.onAfterRenderObservable.addOnce(() => {
|
|
1659
1662
|
this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0);
|
|
1660
1663
|
});
|
|
1661
1664
|
}, 1));
|
|
1662
|
-
}), this.configuration.highlights.enabled && (
|
|
1665
|
+
}), this.configuration.highlights.enabled && (s.registerMaterialSelectedCallback((o) => {
|
|
1663
1666
|
this.setHighlights([o]);
|
|
1664
|
-
}),
|
|
1667
|
+
}), s.registerMaterialDeselectedCallback(() => {
|
|
1665
1668
|
this.setHighlights([]);
|
|
1666
|
-
})), this.modelContainers.set(
|
|
1669
|
+
})), this.modelContainers.set(s.getId(), s), this.triggerModelLoadEvent({
|
|
1667
1670
|
eventType: "load",
|
|
1668
|
-
modelContainer:
|
|
1669
|
-
}),
|
|
1671
|
+
modelContainer: s
|
|
1672
|
+
}), s;
|
|
1670
1673
|
}
|
|
1671
1674
|
async preloadModel(e) {
|
|
1672
|
-
await
|
|
1675
|
+
await k(e, this.scene);
|
|
1673
1676
|
}
|
|
1674
1677
|
getAllModels() {
|
|
1675
1678
|
return Array.from(this.modelContainers.values());
|
|
@@ -1704,31 +1707,31 @@ class Wt {
|
|
|
1704
1707
|
* Flips a transform around the origin.
|
|
1705
1708
|
*/
|
|
1706
1709
|
flipTransform(e, t, i) {
|
|
1707
|
-
const r =
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1710
|
+
const r = ae.Compose(
|
|
1711
|
+
L(i || { x: 1, y: 1, z: 1 }),
|
|
1712
|
+
x.FromEulerVector(
|
|
1713
|
+
L(t || { x: 0, y: 0, z: 0 })
|
|
1711
1714
|
),
|
|
1712
|
-
|
|
1713
|
-
),
|
|
1714
|
-
return o.decompose(l, h, a), h.multiplyInPlace(
|
|
1715
|
-
position:
|
|
1716
|
-
rotation:
|
|
1717
|
-
scale:
|
|
1715
|
+
L(e || { x: 0, y: 0, z: 0 })
|
|
1716
|
+
), s = ae.RotationAxis(p.Up(), Math.PI), o = r.multiply(s), a = p.Zero(), h = x.Identity(), l = p.Zero();
|
|
1717
|
+
return o.decompose(l, h, a), h.multiplyInPlace(x.FromEulerAngles(0, Math.PI, 0)), {
|
|
1718
|
+
position: I(a),
|
|
1719
|
+
rotation: I(h.toEulerAngles()),
|
|
1720
|
+
scale: I(l)
|
|
1718
1721
|
};
|
|
1719
1722
|
}
|
|
1720
1723
|
updatePreviewOptions(e) {
|
|
1721
|
-
var r,
|
|
1724
|
+
var r, s;
|
|
1722
1725
|
const t = new ce(e);
|
|
1723
1726
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1724
1727
|
let i = this.scene.environmentTexture;
|
|
1725
|
-
this.configuration.scene.environment.file !== t.scene.environment.file && (i =
|
|
1728
|
+
this.configuration.scene.environment.file !== t.scene.environment.file && (i = se.CreateFromPrefilteredData(
|
|
1726
1729
|
t.scene.environment.file,
|
|
1727
1730
|
this.scene
|
|
1728
1731
|
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1729
1732
|
t.options.renderingPipelineConfiguration
|
|
1730
1733
|
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
|
|
1731
|
-
((
|
|
1734
|
+
((s = t.options) == null ? void 0 : s.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1732
1735
|
), this.configuration = t;
|
|
1733
1736
|
}
|
|
1734
1737
|
/**
|
|
@@ -1746,8 +1749,8 @@ class Wt {
|
|
|
1746
1749
|
}
|
|
1747
1750
|
}
|
|
1748
1751
|
export {
|
|
1749
|
-
|
|
1750
|
-
|
|
1752
|
+
S as MaterialEffectMode,
|
|
1753
|
+
F as ProductCameraRig,
|
|
1751
1754
|
Ne as REFLECTION_PROBE_RESOLUTION,
|
|
1752
1755
|
A as RenderingConfiguration,
|
|
1753
1756
|
Wt as SpiffCommerce3DPreviewService,
|