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