@spiffcommerce/preview 5.8.8-alpha.0 → 5.8.8-alpha.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 +249 -254
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,17 +2,17 @@ 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
4
|
import { HighlightLayer as Ae } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
-
import { SceneLoader as
|
|
5
|
+
import { SceneLoader as q } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
6
|
import { CubeTexture as ne } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as v, Color3 as A } from "@babylonjs/core/Maths/math.color";
|
|
8
8
|
import { Vector3 as g, Quaternion as x, Vector2 as se, Matrix as re } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
-
import { DracoCompression as
|
|
10
|
-
import { Observable as
|
|
9
|
+
import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
|
+
import { Observable as M } from "@babylonjs/core/Misc/observable";
|
|
11
11
|
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
-
import { Scene as
|
|
12
|
+
import { Scene as ye } 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 k } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
16
16
|
import { MirrorTexture as Ee } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
17
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";
|
|
@@ -24,8 +24,8 @@ import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
|
24
24
|
import { DynamicTexture as Be } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
25
25
|
import { Texture as De } from "@babylonjs/core/Materials/Textures/texture";
|
|
26
26
|
import { Animation as C } from "@babylonjs/core/Animations/animation";
|
|
27
|
-
import { QuadraticEase as
|
|
28
|
-
import { AssetsManager as
|
|
27
|
+
import { QuadraticEase as qe, EasingFunction as ke } from "@babylonjs/core/Animations/easing";
|
|
28
|
+
import { AssetsManager as Ne } from "@babylonjs/core/Misc/assetsManager";
|
|
29
29
|
import { ColorCurves as le } from "@babylonjs/core/Materials/colorCurves";
|
|
30
30
|
import { ImageProcessingConfiguration as E } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
31
|
import { DefaultRenderingPipeline as ze } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
@@ -40,32 +40,32 @@ 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 B = /* @__PURE__ */ ((
|
|
43
|
+
var B = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(B || {}), D = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(D || {});
|
|
44
44
|
function Ve() {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
45
|
+
const s = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
|
|
46
|
+
return s && e && t;
|
|
47
47
|
}
|
|
48
48
|
const he = /* @__PURE__ */ new Map();
|
|
49
|
-
async function
|
|
50
|
-
const i = await he.get(
|
|
49
|
+
async function N(s, e, t) {
|
|
50
|
+
const i = await he.get(s);
|
|
51
51
|
if (i && i.scene.uid === e.uid)
|
|
52
52
|
return i;
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const r = q.LoadAssetContainerAsync(
|
|
54
|
+
s,
|
|
55
55
|
void 0,
|
|
56
56
|
e,
|
|
57
57
|
t
|
|
58
58
|
);
|
|
59
|
-
return !Ve() && he.set(
|
|
59
|
+
return !Ve() && he.set(s, r), r;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
q.OnPluginActivatedObservable.add((s) => {
|
|
62
|
+
s.name === "gltf" && (s.animationStartMode = Re.NONE);
|
|
63
63
|
});
|
|
64
64
|
class ce {
|
|
65
65
|
constructor(e) {
|
|
66
66
|
this.getSceneClearColor = () => {
|
|
67
|
-
var i,
|
|
68
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
67
|
+
var i, r, n, o;
|
|
68
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
69
69
|
if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
70
70
|
return new v(0, 0, 0, t).toLinearSpace();
|
|
71
71
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
@@ -81,11 +81,11 @@ class ce {
|
|
|
81
81
|
}
|
|
82
82
|
return new v(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
83
83
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new v(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
84
|
-
const
|
|
84
|
+
const r = A.FromHexString(t);
|
|
85
85
|
return new v(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
r.r,
|
|
87
|
+
r.g,
|
|
88
|
+
r.b,
|
|
89
89
|
i
|
|
90
90
|
).toLinearSpace();
|
|
91
91
|
}, this.customOptions = e;
|
|
@@ -101,13 +101,13 @@ class ce {
|
|
|
101
101
|
* Configuration related to the scene
|
|
102
102
|
*/
|
|
103
103
|
get scene() {
|
|
104
|
-
var e, t, i,
|
|
104
|
+
var e, t, i, r, n;
|
|
105
105
|
return {
|
|
106
106
|
clearColor: this.getSceneClearColor(),
|
|
107
107
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
108
108
|
environment: {
|
|
109
109
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
110
|
-
intensity: ((
|
|
110
|
+
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
111
111
|
rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
112
112
|
// Convert to radians
|
|
113
113
|
}
|
|
@@ -117,7 +117,7 @@ class ce {
|
|
|
117
117
|
* Configuration related to the camera used to view and interact with the scene.
|
|
118
118
|
*/
|
|
119
119
|
get camera() {
|
|
120
|
-
var e, t, i,
|
|
120
|
+
var e, t, i, r, n, o, a, l, h, c, u, m, f;
|
|
121
121
|
return {
|
|
122
122
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
123
123
|
autoRotation: {
|
|
@@ -126,12 +126,12 @@ class ce {
|
|
|
126
126
|
},
|
|
127
127
|
limits: {
|
|
128
128
|
min: {
|
|
129
|
-
alpha: (
|
|
129
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
130
130
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
131
|
-
radius: (
|
|
131
|
+
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
132
132
|
},
|
|
133
133
|
max: {
|
|
134
|
-
alpha: (
|
|
134
|
+
alpha: (h = this.customOptions) != null && h.upperAlphaLimitDeg ? ((c = this.customOptions) == null ? void 0 : c.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
135
135
|
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
136
136
|
radius: (f = this.customOptions) == null ? void 0 : f.maxZoomOverride
|
|
137
137
|
}
|
|
@@ -150,10 +150,10 @@ class ce {
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
get lighting() {
|
|
153
|
-
var e, t, i,
|
|
153
|
+
var e, t, i, r;
|
|
154
154
|
return {
|
|
155
155
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
156
|
-
contrast: ((
|
|
156
|
+
contrast: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
get emissiveGlowIntensity() {
|
|
@@ -202,7 +202,7 @@ class P {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
const
|
|
205
|
+
const Ge = 128, d = {
|
|
206
206
|
antiAliasing: {
|
|
207
207
|
samples: 4,
|
|
208
208
|
fxaaEnabled: !1
|
|
@@ -259,7 +259,7 @@ const _e = 128, d = {
|
|
|
259
259
|
weight: 1
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
|
-
class
|
|
262
|
+
class _e {
|
|
263
263
|
constructor(e) {
|
|
264
264
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
265
265
|
}
|
|
@@ -274,11 +274,11 @@ class Ge {
|
|
|
274
274
|
return this.loader.loadNodeAsync(
|
|
275
275
|
e,
|
|
276
276
|
t,
|
|
277
|
-
function(
|
|
277
|
+
function(r) {
|
|
278
278
|
t.extras && Object.keys(t.extras).forEach((n) => {
|
|
279
279
|
const o = t.extras[n];
|
|
280
|
-
|
|
281
|
-
}), i(
|
|
280
|
+
r.metadata[n] = o;
|
|
281
|
+
}), i(r);
|
|
282
282
|
}
|
|
283
283
|
);
|
|
284
284
|
}
|
|
@@ -303,7 +303,7 @@ class Ge {
|
|
|
303
303
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
304
304
|
*/
|
|
305
305
|
enableMaterialExtrasIfRequired(e, t) {
|
|
306
|
-
if (!(!e.extras || !(t instanceof
|
|
306
|
+
if (!(!e.extras || !(t instanceof k))) {
|
|
307
307
|
if (e.extras.sheen) {
|
|
308
308
|
const i = t;
|
|
309
309
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
@@ -348,39 +348,39 @@ class Ge {
|
|
|
348
348
|
const a = n.material;
|
|
349
349
|
if (!a)
|
|
350
350
|
return;
|
|
351
|
-
const
|
|
351
|
+
const l = new Ee(
|
|
352
352
|
"mirror",
|
|
353
353
|
P.getMirrorTextureResolution(),
|
|
354
354
|
e,
|
|
355
355
|
!0
|
|
356
356
|
);
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
if (!
|
|
357
|
+
l.renderList = t(e);
|
|
358
|
+
const h = n.getVerticesData("normal");
|
|
359
|
+
if (!h)
|
|
360
360
|
throw new Error(
|
|
361
361
|
"Mirror attribute specified on: " + n.name + "But no normals exist to generate a mirror from!"
|
|
362
362
|
);
|
|
363
363
|
n.computeWorldMatrix(!0);
|
|
364
364
|
const c = n.getWorldMatrix(), u = ae.TransformNormal(
|
|
365
|
-
new ae(
|
|
365
|
+
new ae(h[0], h[1], h[2]),
|
|
366
366
|
c
|
|
367
367
|
).normalize(), m = Oe.FromPositionAndNormal(
|
|
368
368
|
n.position,
|
|
369
369
|
u.scale(-1)
|
|
370
370
|
);
|
|
371
|
-
|
|
371
|
+
l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
|
|
372
372
|
}
|
|
373
|
-
function
|
|
373
|
+
function r(n) {
|
|
374
374
|
const o = n.material, a = new Le(
|
|
375
375
|
"probe-" + o.name,
|
|
376
|
-
|
|
376
|
+
Ge,
|
|
377
377
|
e
|
|
378
378
|
);
|
|
379
379
|
a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
380
380
|
}
|
|
381
381
|
e.meshes.forEach((n) => {
|
|
382
382
|
const o = n.metadata;
|
|
383
|
-
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe &&
|
|
383
|
+
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
386
|
}
|
|
@@ -406,12 +406,12 @@ class He {
|
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function Ue(
|
|
409
|
+
function Ue(s, e, t, i, r = "") {
|
|
410
410
|
t.forEach((n) => {
|
|
411
|
-
const o = n.getID(), a = n.getName(),
|
|
412
|
-
(
|
|
411
|
+
const o = n.getID(), a = n.getName(), l = n.getPanelSize && n.getPanelSize(), h = P.getDynamicTextureResolution(
|
|
412
|
+
(l == null ? void 0 : l.width) === 1 || (l == null ? void 0 : l.height) === 1
|
|
413
413
|
);
|
|
414
|
-
|
|
414
|
+
s.filter((u) => u.name === r + a).forEach((u) => {
|
|
415
415
|
const m = i.get(o), f = !1;
|
|
416
416
|
if (m)
|
|
417
417
|
de(u, m), m.update(f);
|
|
@@ -419,8 +419,8 @@ function Ue(r, e, t, i, s = "") {
|
|
|
419
419
|
const p = Ke(
|
|
420
420
|
a,
|
|
421
421
|
e,
|
|
422
|
-
|
|
423
|
-
|
|
422
|
+
h.width,
|
|
423
|
+
h.height
|
|
424
424
|
);
|
|
425
425
|
i.set(o, p), n.setStaticContext(
|
|
426
426
|
p.getContext()
|
|
@@ -431,67 +431,67 @@ function Ue(r, e, t, i, s = "") {
|
|
|
431
431
|
});
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
function Ke(
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
function Ke(s, e, t, i) {
|
|
435
|
+
const r = new Be(
|
|
436
|
+
s,
|
|
437
437
|
{ width: t, height: i },
|
|
438
438
|
e,
|
|
439
439
|
P.shouldMipMap(),
|
|
440
440
|
De.TRILINEAR_SAMPLINGMODE,
|
|
441
441
|
be.TEXTUREFORMAT_RGBA
|
|
442
|
-
), n =
|
|
443
|
-
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i),
|
|
442
|
+
), n = r.getContext();
|
|
443
|
+
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
|
|
444
444
|
}
|
|
445
|
-
function de(
|
|
446
|
-
if (
|
|
447
|
-
const t =
|
|
445
|
+
function de(s, e) {
|
|
446
|
+
if (s instanceof k) {
|
|
447
|
+
const t = s, i = t.albedoTexture;
|
|
448
448
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
449
449
|
} else {
|
|
450
|
-
const t =
|
|
450
|
+
const t = s, i = t.diffuseTexture;
|
|
451
451
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
function We() {
|
|
455
|
-
const
|
|
456
|
-
return
|
|
455
|
+
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
456
|
+
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
457
457
|
}
|
|
458
|
-
const
|
|
459
|
-
function me(
|
|
460
|
-
return
|
|
458
|
+
const y = 60, ue = 1;
|
|
459
|
+
function me(s) {
|
|
460
|
+
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
461
461
|
}
|
|
462
|
-
function ve(
|
|
463
|
-
const o =
|
|
462
|
+
function ve(s, e, t, i, r, n) {
|
|
463
|
+
const o = r ? s.filter((c) => c.name === r) : s;
|
|
464
464
|
if (o.length === 0) {
|
|
465
|
-
console.warn(`No animations found for name: ${
|
|
465
|
+
console.warn(`No animations found for name: ${r}`);
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
let a = 0;
|
|
469
|
-
const
|
|
469
|
+
const l = () => {
|
|
470
470
|
a++, a === o.length && n && n();
|
|
471
|
-
},
|
|
471
|
+
}, h = (c, u, m, f, p) => {
|
|
472
472
|
c.stop(), c.start(u, m, f, p), n && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
|
|
473
|
-
|
|
473
|
+
l();
|
|
474
474
|
}) : c.onAnimationLoopObservable.addOnce(() => {
|
|
475
|
-
|
|
475
|
+
l();
|
|
476
476
|
}));
|
|
477
477
|
};
|
|
478
478
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
479
479
|
o.forEach((c) => {
|
|
480
480
|
const u = me(c), m = i * u;
|
|
481
|
-
|
|
481
|
+
h(c, !1, ue, m, m);
|
|
482
482
|
});
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
485
|
o.forEach((c) => {
|
|
486
486
|
const u = me(c), m = i !== void 0 ? i * u : void 0, f = t !== void 0 ? t * u : void 0;
|
|
487
|
-
|
|
487
|
+
h(c, e, ue, m, f);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
|
-
function Ye(
|
|
490
|
+
function Ye(s, e, t) {
|
|
491
491
|
return new Promise((i) => {
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
if (t.target && Object.keys(t.target).length > 0 &&
|
|
492
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
|
|
493
|
+
const r = [], n = t.target, o = 0, a = n ? 1 : 0;
|
|
494
|
+
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
495
495
|
T(
|
|
496
496
|
"cameraTargetLerp",
|
|
497
497
|
"target",
|
|
@@ -504,7 +504,7 @@ function Ye(r, e, t) {
|
|
|
504
504
|
C.ANIMATIONTYPE_VECTOR3,
|
|
505
505
|
o
|
|
506
506
|
)
|
|
507
|
-
),
|
|
507
|
+
), r.push(
|
|
508
508
|
T(
|
|
509
509
|
"cameraAlphaLerp",
|
|
510
510
|
"alpha",
|
|
@@ -513,7 +513,7 @@ function Ye(r, e, t) {
|
|
|
513
513
|
C.ANIMATIONTYPE_FLOAT,
|
|
514
514
|
a
|
|
515
515
|
)
|
|
516
|
-
),
|
|
516
|
+
), r.push(
|
|
517
517
|
T(
|
|
518
518
|
"cameraBetaLerp",
|
|
519
519
|
"beta",
|
|
@@ -524,7 +524,7 @@ function Ye(r, e, t) {
|
|
|
524
524
|
)
|
|
525
525
|
), t.radius !== void 0) {
|
|
526
526
|
const c = Math.max(0.01, t.radius);
|
|
527
|
-
|
|
527
|
+
r.push(
|
|
528
528
|
T(
|
|
529
529
|
"cameraRadiusLerp",
|
|
530
530
|
"radius",
|
|
@@ -535,43 +535,43 @@ function Ye(r, e, t) {
|
|
|
535
535
|
)
|
|
536
536
|
);
|
|
537
537
|
}
|
|
538
|
-
e.animations.push(...
|
|
539
|
-
const
|
|
540
|
-
e.disableAutoRotationBehavior(),
|
|
538
|
+
e.animations.push(...r);
|
|
539
|
+
const h = e.useAutoRotationBehavior;
|
|
540
|
+
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
541
541
|
e,
|
|
542
542
|
0,
|
|
543
|
-
n ?
|
|
543
|
+
n ? y * 2 : y,
|
|
544
544
|
!1,
|
|
545
545
|
1,
|
|
546
546
|
() => {
|
|
547
|
-
e.animations = [],
|
|
547
|
+
e.animations = [], h && e.enableAutoRotationBehavior(), i();
|
|
548
548
|
}
|
|
549
549
|
);
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
|
-
function ge(
|
|
553
|
-
return
|
|
552
|
+
function ge(s) {
|
|
553
|
+
return s * Math.PI / 180;
|
|
554
554
|
}
|
|
555
|
-
function T(
|
|
556
|
-
const a = new
|
|
557
|
-
a.setEasingMode(
|
|
558
|
-
const
|
|
559
|
-
r,
|
|
560
|
-
e,
|
|
561
|
-
M,
|
|
555
|
+
function T(s, e, t, i, r, n = 0, o = C.ANIMATIONLOOPMODE_CONSTANT) {
|
|
556
|
+
const a = new qe();
|
|
557
|
+
a.setEasingMode(ke.EASINGMODE_EASEINOUT);
|
|
558
|
+
const l = new C(
|
|
562
559
|
s,
|
|
560
|
+
e,
|
|
561
|
+
y,
|
|
562
|
+
r,
|
|
563
563
|
o
|
|
564
|
-
),
|
|
565
|
-
return n > 0 &&
|
|
566
|
-
frame:
|
|
564
|
+
), h = [];
|
|
565
|
+
return n > 0 && h.push({ frame: 0, value: t }), h.push({ frame: y * n, value: t }), h.push({
|
|
566
|
+
frame: y * (n + 1),
|
|
567
567
|
value: i
|
|
568
|
-
}),
|
|
568
|
+
}), l.setKeys(h), l.setEasingFunction(a), l;
|
|
569
569
|
}
|
|
570
|
-
function Qe(
|
|
571
|
-
return
|
|
570
|
+
function Qe(s, e, t) {
|
|
571
|
+
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
572
572
|
}
|
|
573
|
-
function Ze(
|
|
574
|
-
|
|
573
|
+
function Ze(s, e, t) {
|
|
574
|
+
s.forEach((i) => {
|
|
575
575
|
t && i.name !== t || i.goToFrame(e);
|
|
576
576
|
});
|
|
577
577
|
}
|
|
@@ -585,7 +585,7 @@ const $e = {
|
|
|
585
585
|
refractionTexture: "refractionMap",
|
|
586
586
|
reflectionTexture: "reflectionMap"
|
|
587
587
|
};
|
|
588
|
-
function je(
|
|
588
|
+
function je(s, e, t, i) {
|
|
589
589
|
[
|
|
590
590
|
"albedoTexture",
|
|
591
591
|
"bumpTexture",
|
|
@@ -598,46 +598,46 @@ function je(r, e, t, i) {
|
|
|
598
598
|
].forEach((n) => {
|
|
599
599
|
Xe(
|
|
600
600
|
n,
|
|
601
|
-
|
|
601
|
+
s,
|
|
602
602
|
e,
|
|
603
603
|
t,
|
|
604
604
|
i
|
|
605
605
|
);
|
|
606
|
-
}), tt(
|
|
606
|
+
}), tt(s, e);
|
|
607
607
|
}
|
|
608
|
-
function Xe(
|
|
609
|
-
const n = $e[
|
|
608
|
+
function Xe(s, e, t, i, r) {
|
|
609
|
+
const n = $e[s];
|
|
610
610
|
if (!n)
|
|
611
611
|
throw new Error("Unexpected texture name encountered.");
|
|
612
612
|
const o = e[n], a = o == null ? void 0 : o.fileLink;
|
|
613
|
-
a ?
|
|
614
|
-
|
|
613
|
+
a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
614
|
+
s,
|
|
615
615
|
a,
|
|
616
616
|
void 0,
|
|
617
617
|
!1,
|
|
618
618
|
void 0,
|
|
619
619
|
!0
|
|
620
620
|
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
621
|
-
|
|
621
|
+
s,
|
|
622
622
|
a,
|
|
623
623
|
128,
|
|
624
624
|
!1,
|
|
625
625
|
!0,
|
|
626
626
|
!1
|
|
627
|
-
) : i.addTextureTask(
|
|
627
|
+
) : i.addTextureTask(s, a, !1, !1) : i.addTextureTask(s, a, !1, !1) : r && t[s] && (t[s] && t[s].dispose(), t[s] = null, Je(s, t));
|
|
628
628
|
}
|
|
629
|
-
function Je(
|
|
630
|
-
|
|
629
|
+
function Je(s, e) {
|
|
630
|
+
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 A(0, 0, 0), e.reflectionTexture);
|
|
631
631
|
}
|
|
632
|
-
function et(
|
|
632
|
+
function et(s, e, t, i) {
|
|
633
633
|
if (!e) {
|
|
634
634
|
console.error("Failed to apply texture to material: material is null.");
|
|
635
635
|
return;
|
|
636
636
|
}
|
|
637
|
-
|
|
637
|
+
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 A(1, 1, 1), e.emissiveIntensity = 1);
|
|
638
638
|
}
|
|
639
|
-
function tt(
|
|
640
|
-
|
|
639
|
+
function tt(s, e) {
|
|
640
|
+
s.clearCoat && (s.clearCoat === D.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === D.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
641
641
|
}
|
|
642
642
|
class it {
|
|
643
643
|
constructor(e, t, i) {
|
|
@@ -652,31 +652,31 @@ class it {
|
|
|
652
652
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
653
653
|
* where we want to undo changes are remove effects from display.
|
|
654
654
|
*/
|
|
655
|
-
async applyMaterial(e, t, i,
|
|
655
|
+
async applyMaterial(e, t, i, r) {
|
|
656
656
|
return new Promise((n) => {
|
|
657
657
|
const o = this.materialVariantMap.get(e);
|
|
658
658
|
this.materialVariantMap.set(e, {
|
|
659
659
|
...o,
|
|
660
660
|
...t
|
|
661
661
|
});
|
|
662
|
-
const a = this.renameClonedAsset(e),
|
|
662
|
+
const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
663
663
|
(c) => c.name === a
|
|
664
664
|
);
|
|
665
|
-
if (
|
|
665
|
+
if (l.length === 0) {
|
|
666
666
|
n();
|
|
667
667
|
return;
|
|
668
668
|
}
|
|
669
|
-
const
|
|
670
|
-
|
|
669
|
+
const h = new Ne(this.scene);
|
|
670
|
+
h.useDefaultLoadingScreen = !1, l.forEach(
|
|
671
671
|
(c) => je(
|
|
672
672
|
t,
|
|
673
673
|
c,
|
|
674
|
-
|
|
675
|
-
|
|
674
|
+
h,
|
|
675
|
+
r
|
|
676
676
|
)
|
|
677
|
-
),
|
|
677
|
+
), h.onProgress = (c, u, m) => {
|
|
678
678
|
i && i(c / u * 100, 100, m.name);
|
|
679
|
-
},
|
|
679
|
+
}, h.onFinish = (c) => {
|
|
680
680
|
c.forEach((u) => {
|
|
681
681
|
const m = u;
|
|
682
682
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
@@ -690,7 +690,7 @@ class it {
|
|
|
690
690
|
);
|
|
691
691
|
});
|
|
692
692
|
}), n();
|
|
693
|
-
},
|
|
693
|
+
}, h.loadAsync();
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
/**
|
|
@@ -703,13 +703,13 @@ class it {
|
|
|
703
703
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
704
704
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
705
705
|
*/
|
|
706
|
-
async applyModel(e, t, i,
|
|
706
|
+
async applyModel(e, t, i, r, n, o, a) {
|
|
707
707
|
var m, f, p;
|
|
708
708
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
709
709
|
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), (f = this.loadedMaterialsForKey.get(e)) == null || f.forEach((b) => b.dispose()), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
710
710
|
(b) => b !== e
|
|
711
711
|
), Promise.resolve(void 0);
|
|
712
|
-
const
|
|
712
|
+
const h = (await N(i, this.scene, r)).instantiateModelsToScene(
|
|
713
713
|
this.renameClonedAsset,
|
|
714
714
|
!0
|
|
715
715
|
);
|
|
@@ -718,7 +718,7 @@ class it {
|
|
|
718
718
|
if (c) {
|
|
719
719
|
const b = o && o(), w = c.name ? this.renameClonedAsset(c.name) : void 0;
|
|
720
720
|
if (ve(
|
|
721
|
-
|
|
721
|
+
h.animationGroups,
|
|
722
722
|
c.loop,
|
|
723
723
|
c.to,
|
|
724
724
|
c.from,
|
|
@@ -726,17 +726,17 @@ class it {
|
|
|
726
726
|
), b != null) {
|
|
727
727
|
const R = a && a() || !0;
|
|
728
728
|
Ze(
|
|
729
|
-
|
|
729
|
+
h.animationGroups,
|
|
730
730
|
b + (R ? 2 : 0),
|
|
731
731
|
w
|
|
732
732
|
);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e,
|
|
735
|
+
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, h), this.loadedMaterialsForKey.set(e, we(h));
|
|
736
736
|
const u = [];
|
|
737
737
|
return this.materialVariantMap.forEach(async (b, w) => {
|
|
738
738
|
u.push(this.applyMaterial(w, b));
|
|
739
|
-
}), await Promise.all(u),
|
|
739
|
+
}), await Promise.all(u), h;
|
|
740
740
|
}
|
|
741
741
|
dispose() {
|
|
742
742
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -758,19 +758,19 @@ class it {
|
|
|
758
758
|
}), e;
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
|
-
function we(
|
|
761
|
+
function we(s) {
|
|
762
762
|
const e = [];
|
|
763
|
-
return
|
|
763
|
+
return s.rootNodes.forEach((t) => {
|
|
764
764
|
t.getChildMeshes().forEach((i) => {
|
|
765
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
766
|
-
const n =
|
|
765
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
766
|
+
const n = r.getMaterial(!1);
|
|
767
767
|
n && !e.includes(n) && e.push(n);
|
|
768
768
|
});
|
|
769
769
|
});
|
|
770
770
|
}), e;
|
|
771
771
|
}
|
|
772
|
-
function pe(
|
|
773
|
-
return
|
|
772
|
+
function pe(s, e = "") {
|
|
773
|
+
return s.map((t) => ({
|
|
774
774
|
name: t.name.substring(e.length),
|
|
775
775
|
loop: t.loopAnimation,
|
|
776
776
|
to: t.to,
|
|
@@ -779,15 +779,15 @@ function pe(r, e = "") {
|
|
|
779
779
|
}
|
|
780
780
|
class nt {
|
|
781
781
|
constructor(e) {
|
|
782
|
-
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new
|
|
782
|
+
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new M(), this.materialDeselectedObservable = new M(), this.materialVariantObservable = new M(), this.modelVariantObservable = new M(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
|
|
783
783
|
const {
|
|
784
784
|
enablePicking: t,
|
|
785
785
|
modelDetails: i,
|
|
786
|
-
previewService:
|
|
786
|
+
previewService: r,
|
|
787
787
|
progressHandler: n,
|
|
788
788
|
scene: o
|
|
789
789
|
} = e;
|
|
790
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService =
|
|
790
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = r, this.scene = o, this.variantManager = new it(
|
|
791
791
|
o,
|
|
792
792
|
this.renameClonedAsset.bind(this),
|
|
793
793
|
this.setBaseModelEnabled.bind(this)
|
|
@@ -797,7 +797,7 @@ class nt {
|
|
|
797
797
|
throw new Error(
|
|
798
798
|
"Model container constructed with no URL. This is currently unsupported."
|
|
799
799
|
);
|
|
800
|
-
return this.assetContainer = await
|
|
800
|
+
return this.assetContainer = await N(
|
|
801
801
|
i.model,
|
|
802
802
|
o,
|
|
803
803
|
n
|
|
@@ -806,7 +806,7 @@ class nt {
|
|
|
806
806
|
this.importPromise = a();
|
|
807
807
|
}
|
|
808
808
|
//#region Interface implementation
|
|
809
|
-
async applyMaterialVariant(e, t, i,
|
|
809
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
810
810
|
if (!this.initialized) {
|
|
811
811
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
812
812
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -817,7 +817,7 @@ class nt {
|
|
|
817
817
|
e,
|
|
818
818
|
t,
|
|
819
819
|
i,
|
|
820
|
-
|
|
820
|
+
r
|
|
821
821
|
)
|
|
822
822
|
);
|
|
823
823
|
} else {
|
|
@@ -833,7 +833,7 @@ class nt {
|
|
|
833
833
|
e,
|
|
834
834
|
t,
|
|
835
835
|
i,
|
|
836
|
-
|
|
836
|
+
r
|
|
837
837
|
)
|
|
838
838
|
);
|
|
839
839
|
}
|
|
@@ -843,14 +843,14 @@ class nt {
|
|
|
843
843
|
await this.variantManager.applyMaterial(
|
|
844
844
|
e,
|
|
845
845
|
i,
|
|
846
|
-
(o, a,
|
|
846
|
+
(o, a, l) => {
|
|
847
847
|
this.materialVariantObservable.notifyObservers({
|
|
848
848
|
remainingCount: o,
|
|
849
849
|
totalCount: a,
|
|
850
|
-
taskName:
|
|
850
|
+
taskName: l
|
|
851
851
|
});
|
|
852
852
|
},
|
|
853
|
-
|
|
853
|
+
r
|
|
854
854
|
);
|
|
855
855
|
};
|
|
856
856
|
if (this.materialChangesInProgress.includes(e)) {
|
|
@@ -881,7 +881,7 @@ class nt {
|
|
|
881
881
|
), this.configureGlowLayer(), this.scene.cleanCachedTextureBuffer();
|
|
882
882
|
}
|
|
883
883
|
async applyModelVariant(e, t, i) {
|
|
884
|
-
const
|
|
884
|
+
const r = () => this.variantManager.applyModel(
|
|
885
885
|
e,
|
|
886
886
|
i,
|
|
887
887
|
t == null ? void 0 : t.model,
|
|
@@ -894,29 +894,29 @@ class nt {
|
|
|
894
894
|
this.getLastRequestedAnimation.bind(this),
|
|
895
895
|
this.getCurrentAnimationFrame.bind(this),
|
|
896
896
|
this.getAnimationIsPlaying.bind(this)
|
|
897
|
-
)
|
|
898
|
-
if (!this.initialized) {
|
|
899
|
-
this.modelReadyToLoadCallbacks.set(e, s);
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
if (this.modelChangesInProgress.includes(e)) {
|
|
903
|
-
this.queuedModelChanges.set(e, s);
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
const o = await (async () => {
|
|
897
|
+
), n = async () => {
|
|
907
898
|
this.modelChangesInProgress.push(e);
|
|
908
|
-
let a = await
|
|
899
|
+
let a = await r();
|
|
909
900
|
if (this.queuedModelChanges.has(e)) {
|
|
910
|
-
const
|
|
911
|
-
if (!
|
|
901
|
+
const l = this.queuedModelChanges.get(e);
|
|
902
|
+
if (!l)
|
|
912
903
|
throw new Error("Queued change resolved undefined");
|
|
913
|
-
a = await
|
|
904
|
+
a = await l(), this.queuedModelChanges.delete(e);
|
|
914
905
|
}
|
|
915
906
|
return this.modelChangesInProgress.splice(
|
|
916
907
|
this.modelChangesInProgress.indexOf(e),
|
|
917
908
|
1
|
|
918
909
|
), a;
|
|
919
|
-
}
|
|
910
|
+
};
|
|
911
|
+
if (!this.initialized || this.modelChangesInProgress.includes(e)) {
|
|
912
|
+
const a = async () => {
|
|
913
|
+
const l = await r();
|
|
914
|
+
return l ? this.configureModelInstance(l) : this.configureGlowLayer(), l;
|
|
915
|
+
};
|
|
916
|
+
this.queuedModelChanges.set(e, a);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
const o = await n();
|
|
920
920
|
this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
921
921
|
}
|
|
922
922
|
dispose() {
|
|
@@ -929,7 +929,7 @@ class nt {
|
|
|
929
929
|
let t = () => {
|
|
930
930
|
};
|
|
931
931
|
const i = async () => {
|
|
932
|
-
this.isExecutingAnimation = !0, await new Promise((
|
|
932
|
+
this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
933
933
|
var o;
|
|
934
934
|
const n = [
|
|
935
935
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
@@ -941,12 +941,12 @@ class nt {
|
|
|
941
941
|
e.to,
|
|
942
942
|
e.from,
|
|
943
943
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
944
|
-
|
|
944
|
+
r
|
|
945
945
|
);
|
|
946
946
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
947
947
|
};
|
|
948
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
949
|
-
t =
|
|
948
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
949
|
+
t = r;
|
|
950
950
|
})) : i();
|
|
951
951
|
}
|
|
952
952
|
getAnimations(e) {
|
|
@@ -956,7 +956,7 @@ class nt {
|
|
|
956
956
|
this.variantManager.getAnimationGroups(),
|
|
957
957
|
this.renameClonedAsset("")
|
|
958
958
|
) : []
|
|
959
|
-
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i,
|
|
959
|
+
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((n) => n.name === t.name)) == i);
|
|
960
960
|
}
|
|
961
961
|
getId() {
|
|
962
962
|
return this.id;
|
|
@@ -1024,8 +1024,8 @@ class nt {
|
|
|
1024
1024
|
e.rootNodes.forEach((t) => {
|
|
1025
1025
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1026
1026
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new O(this.scene)), i.actionManager.registerAction(
|
|
1027
|
-
new oe(O.OnPointerOverTrigger, (
|
|
1028
|
-
|
|
1027
|
+
new oe(O.OnPointerOverTrigger, (r) => {
|
|
1028
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1029
1029
|
id: i.material.id,
|
|
1030
1030
|
name: this.stripIdFromName(i.material.name)
|
|
1031
1031
|
});
|
|
@@ -1057,10 +1057,10 @@ class nt {
|
|
|
1057
1057
|
return this.materialReadyToLoadCallbacks.size;
|
|
1058
1058
|
}
|
|
1059
1059
|
getQueuedModelVariantCount() {
|
|
1060
|
-
return this.
|
|
1060
|
+
return this.queuedModelChanges.size;
|
|
1061
1061
|
}
|
|
1062
1062
|
configureGlowLayer() {
|
|
1063
|
-
const e = (i) => i instanceof
|
|
1063
|
+
const e = (i) => i instanceof k && i.emissiveTexture !== null;
|
|
1064
1064
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1065
1065
|
}
|
|
1066
1066
|
configureModelInstance(e) {
|
|
@@ -1069,14 +1069,14 @@ class nt {
|
|
|
1069
1069
|
throw new Error(
|
|
1070
1070
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1071
1071
|
);
|
|
1072
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1072
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1073
1073
|
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = x.Identity(), this.transformRoot.scaling = g.One();
|
|
1074
1074
|
for (const o of e.rootNodes) {
|
|
1075
1075
|
o.parent = this.transformRoot;
|
|
1076
1076
|
for (const a of o.getChildMeshes(!1))
|
|
1077
1077
|
a.alwaysSelectAsActiveMesh = !0;
|
|
1078
1078
|
}
|
|
1079
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1079
|
+
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(), Ue(
|
|
1080
1080
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1081
1081
|
this.scene,
|
|
1082
1082
|
this.canvasPanels,
|
|
@@ -1120,13 +1120,8 @@ class nt {
|
|
|
1120
1120
|
var e;
|
|
1121
1121
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1122
1122
|
(t, i) => {
|
|
1123
|
-
const
|
|
1124
|
-
t.
|
|
1125
|
-
t.getName(),
|
|
1126
|
-
s,
|
|
1127
|
-
t.getStaticContextDirty(),
|
|
1128
|
-
s == null ? void 0 : s.isReady()
|
|
1129
|
-
), s && t.getStaticContextDirty() && s.isReady() && (s.update(!1), t.setStaticContextDirty(!1));
|
|
1123
|
+
const r = this.dynamicTextures.get(i);
|
|
1124
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1130
1125
|
}
|
|
1131
1126
|
);
|
|
1132
1127
|
}
|
|
@@ -1178,25 +1173,25 @@ class nt {
|
|
|
1178
1173
|
(e) => Array.from(e.values()).map((t) => t())
|
|
1179
1174
|
)
|
|
1180
1175
|
), this.materialReadyToLoadCallbacks.clear(), await Promise.all(
|
|
1181
|
-
Array.from(this.
|
|
1176
|
+
Array.from(this.queuedModelChanges.values()).map(
|
|
1182
1177
|
(e) => e()
|
|
1183
1178
|
)
|
|
1184
|
-
), this.
|
|
1179
|
+
), this.queuedModelChanges.clear(), this.scene.onAfterRenderObservable.addOnce(() => {
|
|
1185
1180
|
this.queuedModelAnimation && (this.executeAnimation(this.queuedModelAnimation), this.queuedModelAnimation = void 0);
|
|
1186
1181
|
});
|
|
1187
1182
|
}
|
|
1188
1183
|
//#endregion
|
|
1189
1184
|
}
|
|
1190
1185
|
class z extends fe {
|
|
1191
|
-
constructor(e, t, i,
|
|
1186
|
+
constructor(e, t, i, r, n, o, a, l) {
|
|
1192
1187
|
super(
|
|
1193
1188
|
e,
|
|
1194
1189
|
t,
|
|
1195
1190
|
i,
|
|
1196
|
-
|
|
1191
|
+
r,
|
|
1197
1192
|
n,
|
|
1198
1193
|
o,
|
|
1199
|
-
|
|
1194
|
+
l
|
|
1200
1195
|
), this.lastFocus = new g(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(
|
|
1201
1196
|
a.camera.autoRotation.idleTimeMs
|
|
1202
1197
|
));
|
|
@@ -1250,14 +1245,14 @@ class z extends fe {
|
|
|
1250
1245
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1251
1246
|
const i = this.getFramingBehavior();
|
|
1252
1247
|
i.framingTime = t || 800;
|
|
1253
|
-
const
|
|
1248
|
+
const r = () => {
|
|
1254
1249
|
this.isRunningFramingBehavior = !1;
|
|
1255
1250
|
}, n = I(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
|
|
1256
1251
|
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(
|
|
1257
1252
|
n.min,
|
|
1258
1253
|
n.max,
|
|
1259
1254
|
void 0,
|
|
1260
|
-
|
|
1255
|
+
r
|
|
1261
1256
|
), i.framingTime = 0;
|
|
1262
1257
|
}
|
|
1263
1258
|
/**
|
|
@@ -1288,8 +1283,8 @@ class z extends fe {
|
|
|
1288
1283
|
* @param disablePan If true the camera will not allow panning.
|
|
1289
1284
|
*/
|
|
1290
1285
|
static create(e, t, i) {
|
|
1291
|
-
var
|
|
1292
|
-
const
|
|
1286
|
+
var l;
|
|
1287
|
+
const r = I(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new z(
|
|
1293
1288
|
"ProductCamera",
|
|
1294
1289
|
-(Math.PI / 2),
|
|
1295
1290
|
Math.PI / 2,
|
|
@@ -1299,20 +1294,20 @@ class z extends fe {
|
|
|
1299
1294
|
t
|
|
1300
1295
|
);
|
|
1301
1296
|
return a.setPanEnabled(
|
|
1302
|
-
((
|
|
1297
|
+
((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1303
1298
|
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1304
1299
|
a.setPanEnabled(a.panEnabled);
|
|
1305
1300
|
}), i && (e.activeCamera = a), a;
|
|
1306
1301
|
}
|
|
1307
1302
|
}
|
|
1308
|
-
function I(
|
|
1309
|
-
if (
|
|
1303
|
+
function I(s) {
|
|
1304
|
+
if (s.meshes.length === 0)
|
|
1310
1305
|
return {
|
|
1311
1306
|
min: new g(-1, -1, -1),
|
|
1312
1307
|
max: new g(1, 1, 1)
|
|
1313
1308
|
};
|
|
1314
|
-
const e =
|
|
1315
|
-
return
|
|
1309
|
+
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1310
|
+
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1316
1311
|
}
|
|
1317
1312
|
class st {
|
|
1318
1313
|
constructor(e, t = !1, i = void 0) {
|
|
@@ -1332,9 +1327,9 @@ class st {
|
|
|
1332
1327
|
return this.currentConfiguration;
|
|
1333
1328
|
}
|
|
1334
1329
|
setConfiguration(e) {
|
|
1335
|
-
var t, i,
|
|
1330
|
+
var t, i, r, n, o, a, l, h, c, u, m, f, p, b, w, R, V, G, _, H, U, K, W, Y, Q, Z, $, j, X, J, ee, te, ie;
|
|
1336
1331
|
if (this.renderingPipeline.isSupported) {
|
|
1337
|
-
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 = ((
|
|
1332
|
+
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 = ((l = e.bloom) == null ? void 0 : l.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((h = e.chromaticAberration) == null ? void 0 : h.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new se(
|
|
1338
1333
|
e.chromaticAberration.direction.x,
|
|
1339
1334
|
e.chromaticAberration.direction.y
|
|
1340
1335
|
) : new se(
|
|
@@ -1352,7 +1347,7 @@ class st {
|
|
|
1352
1347
|
this.renderingPipeline.depthOfFieldBlurLevel = L.High;
|
|
1353
1348
|
break;
|
|
1354
1349
|
}
|
|
1355
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((
|
|
1350
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.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)
|
|
1356
1351
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1357
1352
|
case "Standard":
|
|
1358
1353
|
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
|
|
@@ -1388,39 +1383,39 @@ class st {
|
|
|
1388
1383
|
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;
|
|
1389
1384
|
}
|
|
1390
1385
|
}
|
|
1391
|
-
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1392
|
-
return new
|
|
1386
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1387
|
+
return new _e(s);
|
|
1393
1388
|
});
|
|
1394
|
-
|
|
1395
|
-
if (
|
|
1396
|
-
const e =
|
|
1389
|
+
q.OnPluginActivatedObservable.add((s) => {
|
|
1390
|
+
if (s.name === "gltf") {
|
|
1391
|
+
const e = s;
|
|
1397
1392
|
e.transparencyAsCoverage = !0;
|
|
1398
1393
|
}
|
|
1399
1394
|
});
|
|
1400
|
-
function F(
|
|
1401
|
-
return new g(
|
|
1395
|
+
function F(s) {
|
|
1396
|
+
return new g(s.x, s.y, s.z);
|
|
1402
1397
|
}
|
|
1403
|
-
function S(
|
|
1404
|
-
return { x:
|
|
1398
|
+
function S(s) {
|
|
1399
|
+
return { x: s.x, y: s.y, z: s.z };
|
|
1405
1400
|
}
|
|
1406
1401
|
class Yt {
|
|
1407
1402
|
constructor(e) {
|
|
1408
|
-
var
|
|
1409
|
-
this.focusLostNotified = !1, this.focusLostObservable = new
|
|
1403
|
+
var l;
|
|
1404
|
+
this.focusLostNotified = !1, this.focusLostObservable = new M(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1410
1405
|
if (!this.engine.views)
|
|
1411
1406
|
return;
|
|
1412
1407
|
this.modelContainers.forEach((u) => {
|
|
1413
1408
|
u.updateDynamicTextures();
|
|
1414
1409
|
}), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0;
|
|
1415
|
-
const
|
|
1416
|
-
if (
|
|
1417
|
-
if (
|
|
1418
|
-
const u = this.configuration.scene.clearColor, m =
|
|
1410
|
+
const h = this.engine.getRenderingCanvas();
|
|
1411
|
+
if (h)
|
|
1412
|
+
if (h.getContext("webgl2") ?? h.getContext("webgl")) {
|
|
1413
|
+
const u = this.configuration.scene.clearColor, m = h.getContext("webgl2") ?? h.getContext("webgl");
|
|
1419
1414
|
m.clearDepth(1), m.depthFunc(m.LEQUAL), m.clearStencil(0), m.clearColor(u.r, u.g, u.b, u.a), m.clear(
|
|
1420
1415
|
m.COLOR_BUFFER_BIT | m.DEPTH_BUFFER_BIT | m.STENCIL_BUFFER_BIT
|
|
1421
1416
|
);
|
|
1422
1417
|
} else
|
|
1423
|
-
|
|
1418
|
+
h.getContext("2d") ? h.getContext("2d").clearRect(0, 0, h.width, h.height) : console.error(
|
|
1424
1419
|
"SpiffCommerce: Failed to get any context on the rendering canvas."
|
|
1425
1420
|
);
|
|
1426
1421
|
this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
@@ -1430,12 +1425,12 @@ class Yt {
|
|
|
1430
1425
|
const i = (() => {
|
|
1431
1426
|
if (!(e != null && e.noRender))
|
|
1432
1427
|
return this.configuration.createCanvas();
|
|
1433
|
-
})(),
|
|
1434
|
-
|
|
1428
|
+
})(), r = "1.5.6";
|
|
1429
|
+
Me.Configuration = {
|
|
1435
1430
|
decoder: {
|
|
1436
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1437
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1438
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1431
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1432
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1433
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1439
1434
|
}
|
|
1440
1435
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1441
1436
|
const n = console.log;
|
|
@@ -1450,7 +1445,7 @@ class Yt {
|
|
|
1450
1445
|
stencil: this.configuration.highlights.enabled,
|
|
1451
1446
|
forceSRGBBufferSupportState: !0
|
|
1452
1447
|
}) : new Ce();
|
|
1453
|
-
o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new
|
|
1448
|
+
o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new ye(o), this.camera = z.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
|
|
1454
1449
|
this.scene,
|
|
1455
1450
|
!1,
|
|
1456
1451
|
this.camera
|
|
@@ -1459,14 +1454,14 @@ class Yt {
|
|
|
1459
1454
|
this.configuration.scene.environment.file,
|
|
1460
1455
|
this.scene
|
|
1461
1456
|
);
|
|
1462
|
-
a.name = "initial-environment-cube", a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (
|
|
1457
|
+
a.name = "initial-environment-cube", a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1463
1458
|
this.configuration.options.renderingPipelineConfiguration
|
|
1464
1459
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new He(
|
|
1465
1460
|
this.scene,
|
|
1466
1461
|
this.configuration.emissiveGlowIntensity
|
|
1467
|
-
), this.initPromise = new Promise((
|
|
1462
|
+
), this.initPromise = new Promise((h) => {
|
|
1468
1463
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1469
|
-
this.initComplete = !0,
|
|
1464
|
+
this.initComplete = !0, h();
|
|
1470
1465
|
});
|
|
1471
1466
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1472
1467
|
}
|
|
@@ -1511,7 +1506,7 @@ class Yt {
|
|
|
1511
1506
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1512
1507
|
}
|
|
1513
1508
|
executeCameraAnimation(e) {
|
|
1514
|
-
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((
|
|
1509
|
+
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((r) => r.getIsInitialized()))
|
|
1515
1510
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1516
1511
|
let t = () => {
|
|
1517
1512
|
};
|
|
@@ -1522,8 +1517,8 @@ class Yt {
|
|
|
1522
1517
|
e
|
|
1523
1518
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1524
1519
|
};
|
|
1525
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1526
|
-
t =
|
|
1520
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1521
|
+
t = r;
|
|
1527
1522
|
})) : i();
|
|
1528
1523
|
}
|
|
1529
1524
|
getCameraPose() {
|
|
@@ -1560,13 +1555,13 @@ class Yt {
|
|
|
1560
1555
|
const t = async () => {
|
|
1561
1556
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1562
1557
|
this.focusLostNotified = !1;
|
|
1563
|
-
const
|
|
1558
|
+
const r = () => {
|
|
1564
1559
|
const n = this.configuration;
|
|
1565
1560
|
this.camera.rerunFramingBehavior(() => {
|
|
1566
1561
|
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();
|
|
1567
1562
|
});
|
|
1568
1563
|
};
|
|
1569
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1564
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1570
1565
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1571
1566
|
};
|
|
1572
1567
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1597,8 +1592,8 @@ class Yt {
|
|
|
1597
1592
|
this.scene
|
|
1598
1593
|
);
|
|
1599
1594
|
try {
|
|
1600
|
-
const
|
|
1601
|
-
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = n, i.beta =
|
|
1595
|
+
const r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
|
|
1596
|
+
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = n, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1602
1597
|
const o = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1603
1598
|
this.engine,
|
|
1604
1599
|
i,
|
|
@@ -1616,18 +1611,18 @@ class Yt {
|
|
|
1616
1611
|
const e = this.configuration;
|
|
1617
1612
|
if (!e)
|
|
1618
1613
|
return !0;
|
|
1619
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1620
|
-
if (t === void 0 || i === void 0 ||
|
|
1614
|
+
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;
|
|
1615
|
+
if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
|
|
1621
1616
|
return !0;
|
|
1622
|
-
const o = [t, i], a = [
|
|
1623
|
-
return !
|
|
1617
|
+
const o = [t, i], a = [r, n], l = o.every((c) => c === t), h = a.every((c) => c === r);
|
|
1618
|
+
return !l && !h;
|
|
1624
1619
|
}
|
|
1625
1620
|
fireResizeEvent() {
|
|
1626
1621
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1627
1622
|
}
|
|
1628
1623
|
setHighlights(e, t) {
|
|
1629
|
-
var
|
|
1630
|
-
e.length === 0 && ((
|
|
1624
|
+
var r;
|
|
1625
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new Ae("highlights", this.scene, {
|
|
1631
1626
|
isStroke: !0,
|
|
1632
1627
|
blurVerticalSize: 0.85,
|
|
1633
1628
|
blurHorizontalSize: 0.85
|
|
@@ -1639,8 +1634,8 @@ class Yt {
|
|
|
1639
1634
|
);
|
|
1640
1635
|
o && o.getBindedMeshes().forEach(
|
|
1641
1636
|
(a) => {
|
|
1642
|
-
var
|
|
1643
|
-
return (
|
|
1637
|
+
var l;
|
|
1638
|
+
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1644
1639
|
a,
|
|
1645
1640
|
i || A.FromHexString("#fcba03")
|
|
1646
1641
|
);
|
|
@@ -1652,12 +1647,12 @@ class Yt {
|
|
|
1652
1647
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1653
1648
|
}
|
|
1654
1649
|
loadModel(e, t) {
|
|
1655
|
-
const { refocusCamera: i = !0, progressHandler:
|
|
1650
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new nt({
|
|
1656
1651
|
enablePicking: this.configuration.highlights.enabled,
|
|
1657
1652
|
modelDetails: e,
|
|
1658
1653
|
scene: this.scene,
|
|
1659
1654
|
previewService: this,
|
|
1660
|
-
progressHandler:
|
|
1655
|
+
progressHandler: r
|
|
1661
1656
|
});
|
|
1662
1657
|
return n.getInitializationPromise().then(() => {
|
|
1663
1658
|
if (this.modelContainers.size <= 1 && i) {
|
|
@@ -1678,7 +1673,7 @@ class Yt {
|
|
|
1678
1673
|
}), n;
|
|
1679
1674
|
}
|
|
1680
1675
|
async preloadModel(e) {
|
|
1681
|
-
await
|
|
1676
|
+
await N(e, this.scene);
|
|
1682
1677
|
}
|
|
1683
1678
|
getAllModels() {
|
|
1684
1679
|
return Array.from(this.modelContainers.values());
|
|
@@ -1695,7 +1690,7 @@ class Yt {
|
|
|
1695
1690
|
}
|
|
1696
1691
|
unregisterPlugin(e) {
|
|
1697
1692
|
const t = this.plugins.indexOf(e);
|
|
1698
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1693
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1699
1694
|
}
|
|
1700
1695
|
getGlowLayerManager() {
|
|
1701
1696
|
return this.glowLayerManager;
|
|
@@ -1713,28 +1708,28 @@ class Yt {
|
|
|
1713
1708
|
* Flips a transform around the origin.
|
|
1714
1709
|
*/
|
|
1715
1710
|
flipTransform(e, t, i) {
|
|
1716
|
-
const
|
|
1711
|
+
const r = re.Compose(
|
|
1717
1712
|
F(i || { x: 1, y: 1, z: 1 }),
|
|
1718
1713
|
x.FromEulerVector(
|
|
1719
1714
|
F(t || { x: 0, y: 0, z: 0 })
|
|
1720
1715
|
),
|
|
1721
1716
|
F(e || { x: 0, y: 0, z: 0 })
|
|
1722
|
-
), n = re.RotationAxis(g.Up(), Math.PI), o =
|
|
1723
|
-
return o.decompose(
|
|
1717
|
+
), n = re.RotationAxis(g.Up(), Math.PI), o = r.multiply(n), a = g.Zero(), l = x.Identity(), h = g.Zero();
|
|
1718
|
+
return o.decompose(h, l, a), l.multiplyInPlace(x.FromEulerAngles(0, Math.PI, 0)), {
|
|
1724
1719
|
position: S(a),
|
|
1725
|
-
rotation: S(
|
|
1726
|
-
scale: S(
|
|
1720
|
+
rotation: S(l.toEulerAngles()),
|
|
1721
|
+
scale: S(h)
|
|
1727
1722
|
};
|
|
1728
1723
|
}
|
|
1729
1724
|
updatePreviewOptions(e) {
|
|
1730
|
-
var
|
|
1725
|
+
var r, n;
|
|
1731
1726
|
const t = new ce(e);
|
|
1732
1727
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1733
1728
|
let i = this.scene.environmentTexture;
|
|
1734
1729
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = ne.CreateFromPrefilteredData(
|
|
1735
1730
|
t.scene.environment.file,
|
|
1736
1731
|
this.scene
|
|
1737
|
-
), i.name = "updated-environment-cube", i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (
|
|
1732
|
+
), i.name = "updated-environment-cube", 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(
|
|
1738
1733
|
t.options.renderingPipelineConfiguration
|
|
1739
1734
|
) : (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(
|
|
1740
1735
|
((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
|
|
@@ -1757,7 +1752,7 @@ class Yt {
|
|
|
1757
1752
|
export {
|
|
1758
1753
|
D as MaterialEffectMode,
|
|
1759
1754
|
B as ProductCameraRig,
|
|
1760
|
-
|
|
1755
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1761
1756
|
P as RenderingConfiguration,
|
|
1762
1757
|
Yt as SpiffCommerce3DPreviewService,
|
|
1763
1758
|
d as renderingPipelineDefaults
|