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