@spiffcommerce/preview 5.8.9 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +13 -6
- package/dist/index.esm.js +247 -249
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
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 Ae } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
4
|
import { SceneLoader as q } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
5
|
import { CubeTexture as ne } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
|
-
import { Color4 as v, Color3 as
|
|
6
|
+
import { Color4 as v, Color3 as C } from "@babylonjs/core/Maths/math.color";
|
|
8
7
|
import { Vector3 as g, Quaternion as x, Vector2 as se, Matrix as re } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { DracoCompression as Ae } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
9
|
import { Observable as M } from "@babylonjs/core/Misc/observable";
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { GLTFLoaderAnimationStartMode as
|
|
10
|
+
import { Tools as Me } from "@babylonjs/core/Misc/tools";
|
|
11
|
+
import { Scene as xe } from "@babylonjs/core/scene";
|
|
12
|
+
import { GLTF2 as ye } from "@babylonjs/loaders/glTF";
|
|
13
|
+
import { GLTFLoaderAnimationStartMode as Pe } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
14
|
import { PBRMaterial as k } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
16
|
-
import { MirrorTexture as
|
|
17
|
-
import { Color3 as
|
|
18
|
-
import { ReflectionProbe as
|
|
15
|
+
import { MirrorTexture as Re } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Ee, Vector3 as ae, Plane as Te } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
19
18
|
import { GlowLayer as Ie } from "@babylonjs/core/Layers/glowLayer";
|
|
20
19
|
import { ActionManager as O } from "@babylonjs/core/Actions/actionManager";
|
|
21
20
|
import { ExecuteCodeAction as oe } from "@babylonjs/core/Actions/directActions";
|
|
22
|
-
import { Mesh as
|
|
23
|
-
import { TransformNode as
|
|
24
|
-
import { DynamicTexture as
|
|
25
|
-
import { Texture as
|
|
26
|
-
import { Animation as
|
|
27
|
-
import { QuadraticEase as
|
|
28
|
-
import { AssetsManager as
|
|
21
|
+
import { Mesh as Le } from "@babylonjs/core/Meshes/mesh";
|
|
22
|
+
import { TransformNode as Fe } from "@babylonjs/core/Meshes/transformNode";
|
|
23
|
+
import { DynamicTexture as Se } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
24
|
+
import { Texture as Be } from "@babylonjs/core/Materials/Textures/texture";
|
|
25
|
+
import { Animation as A } from "@babylonjs/core/Animations/animation";
|
|
26
|
+
import { QuadraticEase as De, EasingFunction as qe } from "@babylonjs/core/Animations/easing";
|
|
27
|
+
import { AssetsManager as ke } from "@babylonjs/core/Misc/assetsManager";
|
|
29
28
|
import { ColorCurves as le } from "@babylonjs/core/Materials/colorCurves";
|
|
30
29
|
import { ImageProcessingConfiguration as E } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
|
-
import { DefaultRenderingPipeline as
|
|
32
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
30
|
+
import { DefaultRenderingPipeline as Ne } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
|
+
import { DepthOfFieldEffectBlurLevel as I } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
32
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
34
33
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
35
34
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
35
|
+
import "@babylonjs/core/Culling/ray";
|
|
36
36
|
import "@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader";
|
|
37
37
|
import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader";
|
|
38
38
|
import "@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader";
|
|
@@ -41,7 +41,7 @@ import "@babylonjs/core/Misc/screenshotTools";
|
|
|
41
41
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
42
42
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
43
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
|
-
function
|
|
44
|
+
function ze() {
|
|
45
45
|
const s = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
|
|
46
46
|
return s && e && t;
|
|
47
47
|
}
|
|
@@ -50,42 +50,42 @@ async function N(s, e, t) {
|
|
|
50
50
|
const i = await he.get(s);
|
|
51
51
|
if (i && i.scene.uid === e.uid)
|
|
52
52
|
return i;
|
|
53
|
-
const
|
|
53
|
+
const r = q.LoadAssetContainerAsync(
|
|
54
54
|
s,
|
|
55
55
|
void 0,
|
|
56
56
|
e,
|
|
57
57
|
t
|
|
58
58
|
);
|
|
59
|
-
return !
|
|
59
|
+
return !ze() && he.set(s, r), r;
|
|
60
60
|
}
|
|
61
61
|
q.OnPluginActivatedObservable.add((s) => {
|
|
62
|
-
s.name === "gltf" && (s.animationStartMode =
|
|
62
|
+
s.name === "gltf" && (s.animationStartMode = Pe.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) {
|
|
72
|
-
const
|
|
72
|
+
const a = C.FromHexString(
|
|
73
73
|
this.customOptions.backgroundColor
|
|
74
74
|
);
|
|
75
75
|
return new v(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
a.r,
|
|
77
|
+
a.g,
|
|
78
|
+
a.b,
|
|
79
79
|
t
|
|
80
80
|
).toLinearSpace();
|
|
81
81
|
}
|
|
82
82
|
return new v(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
83
|
-
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) :
|
|
84
|
-
const
|
|
83
|
+
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : v.FromColor3(C.Gray()), this.hexToColor4 = (t, i = 1) => {
|
|
84
|
+
const r = C.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,8 +126,8 @@ class ce {
|
|
|
126
126
|
},
|
|
127
127
|
limits: {
|
|
128
128
|
min: {
|
|
129
|
-
alpha: (
|
|
130
|
-
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((
|
|
129
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
130
|
+
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
131
131
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
132
132
|
},
|
|
133
133
|
max: {
|
|
@@ -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 Ve = 128, d = {
|
|
206
206
|
antiAliasing: {
|
|
207
207
|
samples: 4,
|
|
208
208
|
fxaaEnabled: !1
|
|
@@ -274,11 +274,11 @@ class _e {
|
|
|
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
|
}
|
|
@@ -310,7 +310,7 @@ class _e {
|
|
|
310
310
|
}
|
|
311
311
|
if (e.extras.translucency) {
|
|
312
312
|
const i = t;
|
|
313
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
313
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new Ee(
|
|
314
314
|
e.extras.translucencyR,
|
|
315
315
|
e.extras.translucencyG,
|
|
316
316
|
e.extras.translucencyB
|
|
@@ -338,17 +338,17 @@ class _e {
|
|
|
338
338
|
applyReflections(e) {
|
|
339
339
|
function t(n) {
|
|
340
340
|
const o = [];
|
|
341
|
-
return n.transformNodes.forEach((
|
|
342
|
-
|
|
343
|
-
}), n.meshes.forEach((
|
|
344
|
-
|
|
341
|
+
return n.transformNodes.forEach((a) => {
|
|
342
|
+
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
343
|
+
}), n.meshes.forEach((a) => {
|
|
344
|
+
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
345
345
|
}), o;
|
|
346
346
|
}
|
|
347
347
|
function i(n, o = 1) {
|
|
348
|
-
const
|
|
349
|
-
if (!
|
|
348
|
+
const a = n.material;
|
|
349
|
+
if (!a)
|
|
350
350
|
return;
|
|
351
|
-
const l = new
|
|
351
|
+
const l = new Re(
|
|
352
352
|
"mirror",
|
|
353
353
|
P.getMirrorTextureResolution(),
|
|
354
354
|
e,
|
|
@@ -364,27 +364,27 @@ class _e {
|
|
|
364
364
|
const c = n.getWorldMatrix(), u = ae.TransformNormal(
|
|
365
365
|
new ae(h[0], h[1], h[2]),
|
|
366
366
|
c
|
|
367
|
-
).normalize(), m =
|
|
367
|
+
).normalize(), m = Te.FromPositionAndNormal(
|
|
368
368
|
n.position,
|
|
369
369
|
u.scale(-1)
|
|
370
370
|
);
|
|
371
|
-
l.mirrorPlane = m, l.level = o,
|
|
371
|
+
l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
const o = n.material,
|
|
373
|
+
function r(n) {
|
|
374
|
+
const o = n.material, a = new Oe(
|
|
375
375
|
"probe-" + o.name,
|
|
376
|
-
|
|
376
|
+
Ve,
|
|
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
|
}
|
|
387
|
-
class
|
|
387
|
+
class Ge {
|
|
388
388
|
constructor(e, t) {
|
|
389
389
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
390
390
|
}
|
|
@@ -406,18 +406,18 @@ class He {
|
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function He(s, e, t, i, r = "") {
|
|
410
410
|
t.forEach((n) => {
|
|
411
|
-
const o = n.getID(),
|
|
411
|
+
const o = n.getID(), a = n.getName(), l = n.getPanelSize && n.getPanelSize(), h = P.getDynamicTextureResolution(
|
|
412
412
|
(l == null ? void 0 : l.width) === 1 || (l == null ? void 0 : l.height) === 1
|
|
413
413
|
);
|
|
414
|
-
s.filter((u) => u.name ===
|
|
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);
|
|
418
418
|
else {
|
|
419
|
-
const p =
|
|
420
|
-
|
|
419
|
+
const p = Ue(
|
|
420
|
+
a,
|
|
421
421
|
e,
|
|
422
422
|
h.width,
|
|
423
423
|
h.height
|
|
@@ -431,16 +431,16 @@ function Ue(s, e, t, i, a = "") {
|
|
|
431
431
|
});
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
const
|
|
434
|
+
function Ue(s, e, t, i) {
|
|
435
|
+
const r = new Se(
|
|
436
436
|
s,
|
|
437
437
|
{ width: t, height: i },
|
|
438
438
|
e,
|
|
439
439
|
P.shouldMipMap(),
|
|
440
|
-
|
|
440
|
+
Be.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
445
|
function de(s, e) {
|
|
446
446
|
if (s instanceof k) {
|
|
@@ -451,7 +451,7 @@ function de(s, e) {
|
|
|
451
451
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function Ke() {
|
|
455
455
|
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
456
456
|
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
457
457
|
}
|
|
@@ -459,15 +459,15 @@ const y = 60, ue = 1;
|
|
|
459
459
|
function me(s) {
|
|
460
460
|
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
461
461
|
}
|
|
462
|
-
function ve(s, e, t, i,
|
|
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
|
-
let
|
|
468
|
+
let a = 0;
|
|
469
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();
|
|
@@ -487,11 +487,11 @@ function ve(s, e, t, i, a, n) {
|
|
|
487
487
|
h(c, e, ue, m, f);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function We(s, e, t) {
|
|
491
491
|
return new Promise((i) => {
|
|
492
|
-
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
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 = Ye(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",
|
|
@@ -501,41 +501,41 @@ function Ye(s, e, t) {
|
|
|
501
501
|
t.target.y,
|
|
502
502
|
t.target.z
|
|
503
503
|
),
|
|
504
|
-
|
|
504
|
+
A.ANIMATIONTYPE_VECTOR3,
|
|
505
505
|
o
|
|
506
506
|
)
|
|
507
|
-
),
|
|
507
|
+
), r.push(
|
|
508
508
|
T(
|
|
509
509
|
"cameraAlphaLerp",
|
|
510
510
|
"alpha",
|
|
511
511
|
e.alpha,
|
|
512
512
|
ge(t.lonDeg),
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
A.ANIMATIONTYPE_FLOAT,
|
|
514
|
+
a
|
|
515
515
|
)
|
|
516
|
-
),
|
|
516
|
+
), r.push(
|
|
517
517
|
T(
|
|
518
518
|
"cameraBetaLerp",
|
|
519
519
|
"beta",
|
|
520
520
|
e.beta,
|
|
521
521
|
ge(t.latDeg),
|
|
522
|
-
|
|
523
|
-
|
|
522
|
+
A.ANIMATIONTYPE_FLOAT,
|
|
523
|
+
a
|
|
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",
|
|
531
531
|
e.radius,
|
|
532
532
|
c,
|
|
533
|
-
|
|
534
|
-
|
|
533
|
+
A.ANIMATIONTYPE_FLOAT,
|
|
534
|
+
a
|
|
535
535
|
)
|
|
536
536
|
);
|
|
537
537
|
}
|
|
538
|
-
e.animations.push(...
|
|
538
|
+
e.animations.push(...r);
|
|
539
539
|
const h = e.useAutoRotationBehavior;
|
|
540
540
|
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
541
541
|
e,
|
|
@@ -552,30 +552,30 @@ function Ye(s, e, t) {
|
|
|
552
552
|
function ge(s) {
|
|
553
553
|
return s * Math.PI / 180;
|
|
554
554
|
}
|
|
555
|
-
function T(s, e, t, i,
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
const l = new
|
|
555
|
+
function T(s, e, t, i, r, n = 0, o = A.ANIMATIONLOOPMODE_CONSTANT) {
|
|
556
|
+
const a = new De();
|
|
557
|
+
a.setEasingMode(qe.EASINGMODE_EASEINOUT);
|
|
558
|
+
const l = new A(
|
|
559
559
|
s,
|
|
560
560
|
e,
|
|
561
561
|
y,
|
|
562
|
-
|
|
562
|
+
r,
|
|
563
563
|
o
|
|
564
564
|
), h = [];
|
|
565
565
|
return n > 0 && h.push({ frame: 0, value: t }), h.push({ frame: y * n, value: t }), h.push({
|
|
566
566
|
frame: y * (n + 1),
|
|
567
567
|
value: i
|
|
568
|
-
}), l.setKeys(h), l.setEasingFunction(
|
|
568
|
+
}), l.setKeys(h), l.setEasingFunction(a), l;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function Ye(s, e, t) {
|
|
571
571
|
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Qe(s, e, t) {
|
|
574
574
|
s.forEach((i) => {
|
|
575
575
|
t && i.name !== t || i.goToFrame(e);
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
|
-
const
|
|
578
|
+
const Ze = {
|
|
579
579
|
albedoTexture: "albedoMap",
|
|
580
580
|
bumpTexture: "normalMap",
|
|
581
581
|
ambientTexture: "ambientMap",
|
|
@@ -585,7 +585,7 @@ const $e = {
|
|
|
585
585
|
refractionTexture: "refractionMap",
|
|
586
586
|
reflectionTexture: "reflectionMap"
|
|
587
587
|
};
|
|
588
|
-
function
|
|
588
|
+
function $e(s, e, t, i) {
|
|
589
589
|
[
|
|
590
590
|
"albedoTexture",
|
|
591
591
|
"bumpTexture",
|
|
@@ -596,50 +596,50 @@ function je(s, e, t, i) {
|
|
|
596
596
|
"refractionTexture",
|
|
597
597
|
"reflectionTexture"
|
|
598
598
|
].forEach((n) => {
|
|
599
|
-
|
|
599
|
+
je(
|
|
600
600
|
n,
|
|
601
601
|
s,
|
|
602
602
|
e,
|
|
603
603
|
t,
|
|
604
604
|
i
|
|
605
605
|
);
|
|
606
|
-
}),
|
|
606
|
+
}), et(s, e);
|
|
607
607
|
}
|
|
608
|
-
function
|
|
609
|
-
const n =
|
|
608
|
+
function je(s, e, t, i, r) {
|
|
609
|
+
const n = Ze[s];
|
|
610
610
|
if (!n)
|
|
611
611
|
throw new Error("Unexpected texture name encountered.");
|
|
612
|
-
const o = e[n],
|
|
613
|
-
|
|
612
|
+
const o = e[n], a = o == null ? void 0 : o.fileLink;
|
|
613
|
+
a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
614
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(s,
|
|
627
|
+
) : i.addTextureTask(s, a, !1, !1) : i.addTextureTask(s, a, !1, !1) : r && t[s] && (t[s] && t[s].dispose(), t[s] = null, Xe(s, t));
|
|
628
628
|
}
|
|
629
|
-
function
|
|
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
|
|
629
|
+
function Xe(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 C(0, 0, 0), e.reflectionTexture);
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Je(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
|
-
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
|
|
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 C(1, 1, 1), e.emissiveIntensity = 1);
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function et(s, e) {
|
|
640
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
|
-
class
|
|
642
|
+
class tt {
|
|
643
643
|
constructor(e, t, i) {
|
|
644
644
|
this.materialVariantMap = /* @__PURE__ */ new Map(), this.keysThatRemovedBaseModel = [], this.loadedContainerForKey = /* @__PURE__ */ new Map(), this.loadedMaterialsForKey = /* @__PURE__ */ new Map(), this.scene = e, this.renameClonedAsset = t, this.setBaseModelEnabled = i;
|
|
645
645
|
}
|
|
@@ -652,27 +652,27 @@ 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
|
|
663
|
-
(c) => c.name ===
|
|
662
|
+
const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
663
|
+
(c) => c.name === a
|
|
664
664
|
);
|
|
665
665
|
if (l.length === 0) {
|
|
666
666
|
n();
|
|
667
667
|
return;
|
|
668
668
|
}
|
|
669
|
-
const h = new
|
|
669
|
+
const h = new ke(this.scene);
|
|
670
670
|
h.useDefaultLoadingScreen = !1, l.forEach(
|
|
671
|
-
(c) =>
|
|
671
|
+
(c) => $e(
|
|
672
672
|
t,
|
|
673
673
|
c,
|
|
674
674
|
h,
|
|
675
|
-
|
|
675
|
+
r
|
|
676
676
|
)
|
|
677
677
|
), h.onProgress = (c, u, m) => {
|
|
678
678
|
i && i(c / u * 100, 100, m.name);
|
|
@@ -680,9 +680,9 @@ class it {
|
|
|
680
680
|
c.forEach((u) => {
|
|
681
681
|
const m = u;
|
|
682
682
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
683
|
-
(p) => p.name ===
|
|
683
|
+
(p) => p.name === a
|
|
684
684
|
).forEach((p) => {
|
|
685
|
-
|
|
685
|
+
Je(
|
|
686
686
|
u.name,
|
|
687
687
|
p,
|
|
688
688
|
t,
|
|
@@ -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 h = (await N(i, this.scene,
|
|
712
|
+
const h = (await N(i, this.scene, r)).instantiateModelsToScene(
|
|
713
713
|
this.renameClonedAsset,
|
|
714
714
|
!0
|
|
715
715
|
);
|
|
@@ -724,8 +724,8 @@ class it {
|
|
|
724
724
|
c.from,
|
|
725
725
|
w
|
|
726
726
|
), b != null) {
|
|
727
|
-
const R =
|
|
728
|
-
|
|
727
|
+
const R = a && a() || !0;
|
|
728
|
+
Qe(
|
|
729
729
|
h.animationGroups,
|
|
730
730
|
b + (R ? 2 : 0),
|
|
731
731
|
w
|
|
@@ -762,8 +762,8 @@ function we(s) {
|
|
|
762
762
|
const e = [];
|
|
763
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
|
});
|
|
@@ -777,22 +777,22 @@ function pe(s, e = "") {
|
|
|
777
777
|
from: t.from
|
|
778
778
|
}));
|
|
779
779
|
}
|
|
780
|
-
class
|
|
780
|
+
class it {
|
|
781
781
|
constructor(e) {
|
|
782
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 =
|
|
790
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new tt(
|
|
791
791
|
o,
|
|
792
792
|
this.renameClonedAsset.bind(this),
|
|
793
793
|
this.setBaseModelEnabled.bind(this)
|
|
794
|
-
), this.transformRoot = new
|
|
795
|
-
const
|
|
794
|
+
), this.transformRoot = new Fe("root", this.scene);
|
|
795
|
+
const a = async () => {
|
|
796
796
|
if (!i.model)
|
|
797
797
|
throw new Error(
|
|
798
798
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -803,10 +803,10 @@ class nt {
|
|
|
803
803
|
n
|
|
804
804
|
), await this.instantiate(), this;
|
|
805
805
|
};
|
|
806
|
-
this.importPromise =
|
|
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,
|
|
846
|
+
(o, a, l) => {
|
|
847
847
|
this.materialVariantObservable.notifyObservers({
|
|
848
848
|
remainingCount: o,
|
|
849
|
-
totalCount:
|
|
849
|
+
totalCount: a,
|
|
850
850
|
taskName: l
|
|
851
851
|
});
|
|
852
852
|
},
|
|
853
|
-
|
|
853
|
+
r
|
|
854
854
|
);
|
|
855
855
|
};
|
|
856
856
|
if (this.materialChangesInProgress.includes(e)) {
|
|
@@ -871,8 +871,8 @@ class nt {
|
|
|
871
871
|
const o = this.queuedMaterialChanges.get(e);
|
|
872
872
|
if (!o)
|
|
873
873
|
throw new Error("Target material is undefined");
|
|
874
|
-
o.forEach(async (
|
|
875
|
-
await
|
|
874
|
+
o.forEach(async (a) => {
|
|
875
|
+
await a();
|
|
876
876
|
}), this.queuedMaterialChanges.delete(e);
|
|
877
877
|
}
|
|
878
878
|
this.materialChangesInProgress.splice(
|
|
@@ -881,13 +881,13 @@ 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,
|
|
888
|
-
(
|
|
888
|
+
(a) => {
|
|
889
889
|
this.modelVariantObservable.notifyObservers({
|
|
890
|
-
...
|
|
890
|
+
...a,
|
|
891
891
|
key: e
|
|
892
892
|
});
|
|
893
893
|
},
|
|
@@ -896,24 +896,24 @@ class nt {
|
|
|
896
896
|
this.getAnimationIsPlaying.bind(this)
|
|
897
897
|
), n = async () => {
|
|
898
898
|
this.modelChangesInProgress.push(e);
|
|
899
|
-
let
|
|
899
|
+
let a = await r();
|
|
900
900
|
if (this.queuedModelChanges.has(e)) {
|
|
901
901
|
const l = this.queuedModelChanges.get(e);
|
|
902
902
|
if (!l)
|
|
903
903
|
throw new Error("Queued change resolved undefined");
|
|
904
|
-
|
|
904
|
+
a = await l(), this.queuedModelChanges.delete(e);
|
|
905
905
|
}
|
|
906
906
|
return this.modelChangesInProgress.splice(
|
|
907
907
|
this.modelChangesInProgress.indexOf(e),
|
|
908
908
|
1
|
|
909
|
-
),
|
|
909
|
+
), a;
|
|
910
910
|
};
|
|
911
911
|
if (!this.initialized || this.modelChangesInProgress.includes(e)) {
|
|
912
|
-
const
|
|
913
|
-
const l = await
|
|
912
|
+
const a = async () => {
|
|
913
|
+
const l = await r();
|
|
914
914
|
return l ? this.configureModelInstance(l) : this.configureGlowLayer(), l;
|
|
915
915
|
};
|
|
916
|
-
this.queuedModelChanges.set(e,
|
|
916
|
+
this.queuedModelChanges.set(e, a);
|
|
917
917
|
return;
|
|
918
918
|
}
|
|
919
919
|
const o = await n();
|
|
@@ -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
|
});
|
|
@@ -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
|
-
for (const
|
|
1077
|
-
|
|
1076
|
+
for (const a of o.getChildMeshes(!1))
|
|
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(), He(
|
|
1080
1080
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1081
1081
|
this.scene,
|
|
1082
1082
|
this.canvasPanels,
|
|
@@ -1094,7 +1094,7 @@ class nt {
|
|
|
1094
1094
|
getAllMeshes() {
|
|
1095
1095
|
var e;
|
|
1096
1096
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1097
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1097
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Le)
|
|
1098
1098
|
).flat();
|
|
1099
1099
|
}
|
|
1100
1100
|
async instantiate() {
|
|
@@ -1120,8 +1120,8 @@ class nt {
|
|
|
1120
1120
|
var e;
|
|
1121
1121
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1122
1122
|
(t, i) => {
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1123
|
+
const r = this.dynamicTextures.get(i);
|
|
1124
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1125
1125
|
}
|
|
1126
1126
|
);
|
|
1127
1127
|
}
|
|
@@ -1183,17 +1183,17 @@ class nt {
|
|
|
1183
1183
|
//#endregion
|
|
1184
1184
|
}
|
|
1185
1185
|
class z extends fe {
|
|
1186
|
-
constructor(e, t, i,
|
|
1186
|
+
constructor(e, t, i, r, n, o, a, l) {
|
|
1187
1187
|
super(
|
|
1188
1188
|
e,
|
|
1189
1189
|
t,
|
|
1190
1190
|
i,
|
|
1191
|
-
|
|
1191
|
+
r,
|
|
1192
1192
|
n,
|
|
1193
1193
|
o,
|
|
1194
1194
|
l
|
|
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,
|
|
1196
|
-
|
|
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(
|
|
1196
|
+
a.camera.autoRotation.idleTimeMs
|
|
1197
1197
|
));
|
|
1198
1198
|
}
|
|
1199
1199
|
updateConfiguration(e) {
|
|
@@ -1233,7 +1233,7 @@ class z extends fe {
|
|
|
1233
1233
|
this.useFramingBehavior = !0;
|
|
1234
1234
|
const e = this.getFramingBehavior();
|
|
1235
1235
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1236
|
-
const t =
|
|
1236
|
+
const t = L(this._scene);
|
|
1237
1237
|
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;
|
|
1238
1238
|
}
|
|
1239
1239
|
/**
|
|
@@ -1245,14 +1245,14 @@ class z extends fe {
|
|
|
1245
1245
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1246
1246
|
const i = this.getFramingBehavior();
|
|
1247
1247
|
i.framingTime = t || 800;
|
|
1248
|
-
const
|
|
1248
|
+
const r = () => {
|
|
1249
1249
|
this.isRunningFramingBehavior = !1;
|
|
1250
|
-
}, n =
|
|
1251
|
-
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(
|
|
1250
|
+
}, n = L(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
|
|
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(
|
|
1252
1252
|
n.min,
|
|
1253
1253
|
n.max,
|
|
1254
1254
|
void 0,
|
|
1255
|
-
|
|
1255
|
+
r
|
|
1256
1256
|
), i.framingTime = 0;
|
|
1257
1257
|
}
|
|
1258
1258
|
/**
|
|
@@ -1284,7 +1284,7 @@ class z extends fe {
|
|
|
1284
1284
|
*/
|
|
1285
1285
|
static create(e, t, i) {
|
|
1286
1286
|
var l;
|
|
1287
|
-
const
|
|
1287
|
+
const r = L(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new z(
|
|
1288
1288
|
"ProductCamera",
|
|
1289
1289
|
-(Math.PI / 2),
|
|
1290
1290
|
Math.PI / 2,
|
|
@@ -1293,14 +1293,14 @@ class z extends fe {
|
|
|
1293
1293
|
e,
|
|
1294
1294
|
t
|
|
1295
1295
|
);
|
|
1296
|
-
return
|
|
1296
|
+
return a.setPanEnabled(
|
|
1297
1297
|
((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1298
|
-
),
|
|
1299
|
-
|
|
1300
|
-
}), i && (e.activeCamera =
|
|
1298
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1299
|
+
a.setPanEnabled(a.panEnabled);
|
|
1300
|
+
}), i && (e.activeCamera = a), a;
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
|
-
function
|
|
1303
|
+
function L(s) {
|
|
1304
1304
|
if (s.meshes.length === 0)
|
|
1305
1305
|
return {
|
|
1306
1306
|
min: new g(-1, -1, -1),
|
|
@@ -1309,9 +1309,9 @@ function I(s) {
|
|
|
1309
1309
|
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1310
1310
|
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1311
1311
|
}
|
|
1312
|
-
class
|
|
1312
|
+
class nt {
|
|
1313
1313
|
constructor(e, t = !1, i = void 0) {
|
|
1314
|
-
this.renderingPipeline = new
|
|
1314
|
+
this.renderingPipeline = new Ne(
|
|
1315
1315
|
"default",
|
|
1316
1316
|
t,
|
|
1317
1317
|
e,
|
|
@@ -1327,9 +1327,9 @@ class st {
|
|
|
1327
1327
|
return this.currentConfiguration;
|
|
1328
1328
|
}
|
|
1329
1329
|
setConfiguration(e) {
|
|
1330
|
-
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;
|
|
1331
1331
|
if (this.renderingPipeline.isSupported) {
|
|
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 = ((
|
|
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(
|
|
1333
1333
|
e.chromaticAberration.direction.x,
|
|
1334
1334
|
e.chromaticAberration.direction.y
|
|
1335
1335
|
) : new se(
|
|
@@ -1338,16 +1338,16 @@ class st {
|
|
|
1338
1338
|
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((f = e.colorCurves) == null ? void 0 : f.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new le(), this.renderingPipeline.depthOfFieldEnabled = ((p = e.depthOfField) == null ? void 0 : p.enabled) ?? d.depthOfField.enabled, e.depthOfField)
|
|
1339
1339
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1340
1340
|
case "Low":
|
|
1341
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1341
|
+
this.renderingPipeline.depthOfFieldBlurLevel = I.Low;
|
|
1342
1342
|
break;
|
|
1343
1343
|
case "Medium":
|
|
1344
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1344
|
+
this.renderingPipeline.depthOfFieldBlurLevel = I.Medium;
|
|
1345
1345
|
break;
|
|
1346
1346
|
case "High":
|
|
1347
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1347
|
+
this.renderingPipeline.depthOfFieldBlurLevel = I.High;
|
|
1348
1348
|
break;
|
|
1349
1349
|
}
|
|
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 = ((
|
|
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 = ((_ = e.grain) == null ? void 0 : _.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.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)
|
|
1351
1351
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1352
1352
|
case "Standard":
|
|
1353
1353
|
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
|
|
@@ -1383,7 +1383,7 @@ class st {
|
|
|
1383
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;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
|
|
1386
|
+
ye.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1387
1387
|
return new _e(s);
|
|
1388
1388
|
});
|
|
1389
1389
|
q.OnPluginActivatedObservable.add((s) => {
|
|
@@ -1398,10 +1398,10 @@ function F(s) {
|
|
|
1398
1398
|
function S(s) {
|
|
1399
1399
|
return { x: s.x, y: s.y, z: s.z };
|
|
1400
1400
|
}
|
|
1401
|
-
class
|
|
1401
|
+
class Wt {
|
|
1402
1402
|
constructor(e) {
|
|
1403
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 = () => {
|
|
1404
|
+
this.focusLostNotified = !1, this.focusLostObservable = new M(), this.modelLoadEventCallbacks = [], this.validHighlightMaterials = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1405
1405
|
if (!this.engine.views)
|
|
1406
1406
|
return;
|
|
1407
1407
|
this.modelContainers.forEach((u) => {
|
|
@@ -1425,12 +1425,12 @@ class Yt {
|
|
|
1425
1425
|
const i = (() => {
|
|
1426
1426
|
if (!(e != null && e.noRender))
|
|
1427
1427
|
return this.configuration.createCanvas();
|
|
1428
|
-
})(),
|
|
1429
|
-
|
|
1428
|
+
})(), r = "1.5.7";
|
|
1429
|
+
Ae.Configuration = {
|
|
1430
1430
|
decoder: {
|
|
1431
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1432
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1433
|
-
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`
|
|
1434
1434
|
}
|
|
1435
1435
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1436
1436
|
const n = console.log;
|
|
@@ -1445,18 +1445,18 @@ class Yt {
|
|
|
1445
1445
|
stencil: this.configuration.highlights.enabled,
|
|
1446
1446
|
forceSRGBBufferSupportState: !0
|
|
1447
1447
|
}) : new Ce();
|
|
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
|
|
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 xe(o), this.camera = z.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1449
1449
|
this.scene,
|
|
1450
1450
|
!1,
|
|
1451
1451
|
this.camera
|
|
1452
1452
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1453
|
-
const
|
|
1453
|
+
const a = ne.CreateFromPrefilteredData(
|
|
1454
1454
|
this.configuration.scene.environment.file,
|
|
1455
1455
|
this.scene
|
|
1456
1456
|
);
|
|
1457
|
-
|
|
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(
|
|
1458
1458
|
this.configuration.options.renderingPipelineConfiguration
|
|
1459
|
-
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new
|
|
1459
|
+
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
|
|
1460
1460
|
this.scene,
|
|
1461
1461
|
this.configuration.emissiveGlowIntensity
|
|
1462
1462
|
), this.initPromise = new Promise((h) => {
|
|
@@ -1506,19 +1506,19 @@ class Yt {
|
|
|
1506
1506
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1507
1507
|
}
|
|
1508
1508
|
executeCameraAnimation(e) {
|
|
1509
|
-
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()))
|
|
1510
1510
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1511
1511
|
let t = () => {
|
|
1512
1512
|
};
|
|
1513
1513
|
const i = async () => {
|
|
1514
|
-
this.isAnimatingCamera = !0, await
|
|
1514
|
+
this.isAnimatingCamera = !0, await We(
|
|
1515
1515
|
this.scene,
|
|
1516
1516
|
this.scene.activeCamera,
|
|
1517
1517
|
e
|
|
1518
1518
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1519
1519
|
};
|
|
1520
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1521
|
-
t =
|
|
1520
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1521
|
+
t = r;
|
|
1522
1522
|
})) : i();
|
|
1523
1523
|
}
|
|
1524
1524
|
getCameraPose() {
|
|
@@ -1555,13 +1555,13 @@ class Yt {
|
|
|
1555
1555
|
const t = async () => {
|
|
1556
1556
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1557
1557
|
this.focusLostNotified = !1;
|
|
1558
|
-
const
|
|
1558
|
+
const r = () => {
|
|
1559
1559
|
const n = this.configuration;
|
|
1560
1560
|
this.camera.rerunFramingBehavior(() => {
|
|
1561
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();
|
|
1562
1562
|
});
|
|
1563
1563
|
};
|
|
1564
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1564
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1565
1565
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1566
1566
|
};
|
|
1567
1567
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1590,13 +1590,13 @@ class Yt {
|
|
|
1590
1590
|
0,
|
|
1591
1591
|
g.Zero(),
|
|
1592
1592
|
this.scene
|
|
1593
|
-
),
|
|
1594
|
-
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = n, i.beta =
|
|
1593
|
+
), r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
|
|
1594
|
+
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;
|
|
1595
1595
|
try {
|
|
1596
1596
|
return await new Promise((o) => {
|
|
1597
|
-
const
|
|
1598
|
-
this.scene.onBeforeRenderObservable.remove(
|
|
1599
|
-
const l = await
|
|
1597
|
+
const a = this.scene.onBeforeRenderObservable.add(async () => {
|
|
1598
|
+
this.scene.onBeforeRenderObservable.remove(a);
|
|
1599
|
+
const l = await Me.CreateScreenshotUsingRenderTargetAsync(
|
|
1600
1600
|
this.engine,
|
|
1601
1601
|
i,
|
|
1602
1602
|
e,
|
|
@@ -1616,48 +1616,43 @@ class Yt {
|
|
|
1616
1616
|
const e = this.configuration;
|
|
1617
1617
|
if (!e)
|
|
1618
1618
|
return !0;
|
|
1619
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1620
|
-
if (t === void 0 || i === void 0 ||
|
|
1619
|
+
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;
|
|
1620
|
+
if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
|
|
1621
1621
|
return !0;
|
|
1622
|
-
const o = [t, i],
|
|
1622
|
+
const o = [t, i], a = [r, n], l = o.every((c) => c === t), h = a.every((c) => c === r);
|
|
1623
1623
|
return !l && !h;
|
|
1624
1624
|
}
|
|
1625
1625
|
fireResizeEvent() {
|
|
1626
1626
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1627
1627
|
}
|
|
1628
|
-
setHighlights(e
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
(r) => r.name === n.name && r.id === n.id
|
|
1639
|
-
);
|
|
1640
|
-
o && o.getBindedMeshes().forEach(
|
|
1641
|
-
(r) => {
|
|
1642
|
-
var l;
|
|
1643
|
-
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1644
|
-
r,
|
|
1645
|
-
i || A.FromHexString("#fcba03")
|
|
1646
|
-
);
|
|
1647
|
-
}
|
|
1628
|
+
setHighlights(e) {
|
|
1629
|
+
this.scene.materials.forEach(() => {
|
|
1630
|
+
this.scene.materials.forEach((i) => {
|
|
1631
|
+
i.emissiveIntensity === 0.18 && (i.emissiveColor = C.Black(), i.emissiveIntensity = 1);
|
|
1632
|
+
});
|
|
1633
|
+
}), e.filter(
|
|
1634
|
+
(i) => this.validHighlightMaterials.includes(i.name)
|
|
1635
|
+
).forEach((i) => {
|
|
1636
|
+
const r = this.scene.materials.find(
|
|
1637
|
+
(n) => n.id === i.id
|
|
1648
1638
|
);
|
|
1639
|
+
r && (r.emissiveColor = new C(
|
|
1640
|
+
this.configuration.highlights.color.r,
|
|
1641
|
+
this.configuration.highlights.color.g,
|
|
1642
|
+
this.configuration.highlights.color.b
|
|
1643
|
+
), r.emissiveIntensity = 0.18);
|
|
1649
1644
|
});
|
|
1650
1645
|
}
|
|
1651
1646
|
setRenderingPipelineConfiguration(e) {
|
|
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 it({
|
|
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) {
|
|
@@ -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,33 +1708,36 @@ 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(h, l,
|
|
1724
|
-
position: S(
|
|
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)), {
|
|
1719
|
+
position: S(a),
|
|
1725
1720
|
rotation: S(l.toEulerAngles()),
|
|
1726
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
|
|
1741
1736
|
), this.configuration = t;
|
|
1742
1737
|
}
|
|
1738
|
+
setHighlightMaterials(e) {
|
|
1739
|
+
this.validHighlightMaterials = e;
|
|
1740
|
+
}
|
|
1743
1741
|
/**
|
|
1744
1742
|
* Given a valid canvas element, will remove any existing input controls
|
|
1745
1743
|
* and re-attach them to the given canvas. The pan mouse button can be set
|
|
@@ -1757,8 +1755,8 @@ class Yt {
|
|
|
1757
1755
|
export {
|
|
1758
1756
|
D as MaterialEffectMode,
|
|
1759
1757
|
B as ProductCameraRig,
|
|
1760
|
-
|
|
1758
|
+
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1761
1759
|
P as RenderingConfiguration,
|
|
1762
|
-
|
|
1760
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1763
1761
|
d as renderingPipelineDefaults
|
|
1764
1762
|
};
|