@spiffcommerce/preview 5.8.10 → 5.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +17 -6
- package/dist/index.esm.js +247 -250
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
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";
|
|
@@ -42,7 +41,7 @@ import "@babylonjs/core/Misc/screenshotTools";
|
|
|
42
41
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
43
42
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
44
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 || {});
|
|
45
|
-
function
|
|
44
|
+
function ze() {
|
|
46
45
|
const s = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
|
|
47
46
|
return s && e && t;
|
|
48
47
|
}
|
|
@@ -51,42 +50,42 @@ async function N(s, e, t) {
|
|
|
51
50
|
const i = await he.get(s);
|
|
52
51
|
if (i && i.scene.uid === e.uid)
|
|
53
52
|
return i;
|
|
54
|
-
const
|
|
53
|
+
const r = q.LoadAssetContainerAsync(
|
|
55
54
|
s,
|
|
56
55
|
void 0,
|
|
57
56
|
e,
|
|
58
57
|
t
|
|
59
58
|
);
|
|
60
|
-
return !
|
|
59
|
+
return !ze() && he.set(s, r), r;
|
|
61
60
|
}
|
|
62
61
|
q.OnPluginActivatedObservable.add((s) => {
|
|
63
|
-
s.name === "gltf" && (s.animationStartMode =
|
|
62
|
+
s.name === "gltf" && (s.animationStartMode = Pe.NONE);
|
|
64
63
|
});
|
|
65
64
|
class ce {
|
|
66
65
|
constructor(e) {
|
|
67
66
|
this.getSceneClearColor = () => {
|
|
68
|
-
var i,
|
|
69
|
-
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;
|
|
70
69
|
if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
71
70
|
return new v(0, 0, 0, t).toLinearSpace();
|
|
72
71
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
73
|
-
const
|
|
72
|
+
const a = C.FromHexString(
|
|
74
73
|
this.customOptions.backgroundColor
|
|
75
74
|
);
|
|
76
75
|
return new v(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
a.r,
|
|
77
|
+
a.g,
|
|
78
|
+
a.b,
|
|
80
79
|
t
|
|
81
80
|
).toLinearSpace();
|
|
82
81
|
}
|
|
83
82
|
return new v(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
84
|
-
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) :
|
|
85
|
-
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);
|
|
86
85
|
return new v(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
r.r,
|
|
87
|
+
r.g,
|
|
88
|
+
r.b,
|
|
90
89
|
i
|
|
91
90
|
).toLinearSpace();
|
|
92
91
|
}, this.customOptions = e;
|
|
@@ -102,13 +101,13 @@ class ce {
|
|
|
102
101
|
* Configuration related to the scene
|
|
103
102
|
*/
|
|
104
103
|
get scene() {
|
|
105
|
-
var e, t, i,
|
|
104
|
+
var e, t, i, r, n;
|
|
106
105
|
return {
|
|
107
106
|
clearColor: this.getSceneClearColor(),
|
|
108
107
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
109
108
|
environment: {
|
|
110
109
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
111
|
-
intensity: ((
|
|
110
|
+
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
112
111
|
rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
113
112
|
// Convert to radians
|
|
114
113
|
}
|
|
@@ -118,7 +117,7 @@ class ce {
|
|
|
118
117
|
* Configuration related to the camera used to view and interact with the scene.
|
|
119
118
|
*/
|
|
120
119
|
get camera() {
|
|
121
|
-
var e, t, i,
|
|
120
|
+
var e, t, i, r, n, o, a, l, h, c, u, m, f;
|
|
122
121
|
return {
|
|
123
122
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
124
123
|
autoRotation: {
|
|
@@ -127,8 +126,8 @@ class ce {
|
|
|
127
126
|
},
|
|
128
127
|
limits: {
|
|
129
128
|
min: {
|
|
130
|
-
alpha: (
|
|
131
|
-
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,
|
|
132
131
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
133
132
|
},
|
|
134
133
|
max: {
|
|
@@ -151,10 +150,10 @@ class ce {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
get lighting() {
|
|
154
|
-
var e, t, i,
|
|
153
|
+
var e, t, i, r;
|
|
155
154
|
return {
|
|
156
155
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
157
|
-
contrast: ((
|
|
156
|
+
contrast: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
158
157
|
};
|
|
159
158
|
}
|
|
160
159
|
get emissiveGlowIntensity() {
|
|
@@ -203,7 +202,7 @@ class P {
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
|
-
const
|
|
205
|
+
const Ve = 128, d = {
|
|
207
206
|
antiAliasing: {
|
|
208
207
|
samples: 4,
|
|
209
208
|
fxaaEnabled: !1
|
|
@@ -275,11 +274,11 @@ class _e {
|
|
|
275
274
|
return this.loader.loadNodeAsync(
|
|
276
275
|
e,
|
|
277
276
|
t,
|
|
278
|
-
function(
|
|
277
|
+
function(r) {
|
|
279
278
|
t.extras && Object.keys(t.extras).forEach((n) => {
|
|
280
279
|
const o = t.extras[n];
|
|
281
|
-
|
|
282
|
-
}), i(
|
|
280
|
+
r.metadata[n] = o;
|
|
281
|
+
}), i(r);
|
|
283
282
|
}
|
|
284
283
|
);
|
|
285
284
|
}
|
|
@@ -311,7 +310,7 @@ class _e {
|
|
|
311
310
|
}
|
|
312
311
|
if (e.extras.translucency) {
|
|
313
312
|
const i = t;
|
|
314
|
-
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(
|
|
315
314
|
e.extras.translucencyR,
|
|
316
315
|
e.extras.translucencyG,
|
|
317
316
|
e.extras.translucencyB
|
|
@@ -339,17 +338,17 @@ class _e {
|
|
|
339
338
|
applyReflections(e) {
|
|
340
339
|
function t(n) {
|
|
341
340
|
const o = [];
|
|
342
|
-
return n.transformNodes.forEach((
|
|
343
|
-
|
|
344
|
-
}), n.meshes.forEach((
|
|
345
|
-
|
|
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);
|
|
346
345
|
}), o;
|
|
347
346
|
}
|
|
348
347
|
function i(n, o = 1) {
|
|
349
|
-
const
|
|
350
|
-
if (!
|
|
348
|
+
const a = n.material;
|
|
349
|
+
if (!a)
|
|
351
350
|
return;
|
|
352
|
-
const l = new
|
|
351
|
+
const l = new Re(
|
|
353
352
|
"mirror",
|
|
354
353
|
P.getMirrorTextureResolution(),
|
|
355
354
|
e,
|
|
@@ -365,27 +364,27 @@ class _e {
|
|
|
365
364
|
const c = n.getWorldMatrix(), u = ae.TransformNormal(
|
|
366
365
|
new ae(h[0], h[1], h[2]),
|
|
367
366
|
c
|
|
368
|
-
).normalize(), m =
|
|
367
|
+
).normalize(), m = Te.FromPositionAndNormal(
|
|
369
368
|
n.position,
|
|
370
369
|
u.scale(-1)
|
|
371
370
|
);
|
|
372
|
-
l.mirrorPlane = m, l.level = o,
|
|
371
|
+
l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
|
|
373
372
|
}
|
|
374
|
-
function
|
|
375
|
-
const o = n.material,
|
|
373
|
+
function r(n) {
|
|
374
|
+
const o = n.material, a = new Oe(
|
|
376
375
|
"probe-" + o.name,
|
|
377
|
-
|
|
376
|
+
Ve,
|
|
378
377
|
e
|
|
379
378
|
);
|
|
380
|
-
|
|
379
|
+
a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
381
380
|
}
|
|
382
381
|
e.meshes.forEach((n) => {
|
|
383
382
|
const o = n.metadata;
|
|
384
|
-
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe &&
|
|
383
|
+
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
|
|
385
384
|
});
|
|
386
385
|
}
|
|
387
386
|
}
|
|
388
|
-
class
|
|
387
|
+
class Ge {
|
|
389
388
|
constructor(e, t) {
|
|
390
389
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
391
390
|
}
|
|
@@ -407,18 +406,18 @@ class He {
|
|
|
407
406
|
}
|
|
408
407
|
}
|
|
409
408
|
}
|
|
410
|
-
function
|
|
409
|
+
function He(s, e, t, i, r = "") {
|
|
411
410
|
t.forEach((n) => {
|
|
412
|
-
const o = n.getID(),
|
|
411
|
+
const o = n.getID(), a = n.getName(), l = n.getPanelSize && n.getPanelSize(), h = P.getDynamicTextureResolution(
|
|
413
412
|
(l == null ? void 0 : l.width) === 1 || (l == null ? void 0 : l.height) === 1
|
|
414
413
|
);
|
|
415
|
-
s.filter((u) => u.name ===
|
|
414
|
+
s.filter((u) => u.name === r + a).forEach((u) => {
|
|
416
415
|
const m = i.get(o), f = !1;
|
|
417
416
|
if (m)
|
|
418
417
|
de(u, m), m.update(f);
|
|
419
418
|
else {
|
|
420
|
-
const p =
|
|
421
|
-
|
|
419
|
+
const p = Ue(
|
|
420
|
+
a,
|
|
422
421
|
e,
|
|
423
422
|
h.width,
|
|
424
423
|
h.height
|
|
@@ -432,16 +431,16 @@ function Ue(s, e, t, i, a = "") {
|
|
|
432
431
|
});
|
|
433
432
|
});
|
|
434
433
|
}
|
|
435
|
-
function
|
|
436
|
-
const
|
|
434
|
+
function Ue(s, e, t, i) {
|
|
435
|
+
const r = new Se(
|
|
437
436
|
s,
|
|
438
437
|
{ width: t, height: i },
|
|
439
438
|
e,
|
|
440
439
|
P.shouldMipMap(),
|
|
441
|
-
|
|
440
|
+
Be.TRILINEAR_SAMPLINGMODE,
|
|
442
441
|
be.TEXTUREFORMAT_RGBA
|
|
443
|
-
), n =
|
|
444
|
-
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;
|
|
445
444
|
}
|
|
446
445
|
function de(s, e) {
|
|
447
446
|
if (s instanceof k) {
|
|
@@ -452,7 +451,7 @@ function de(s, e) {
|
|
|
452
451
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
453
452
|
}
|
|
454
453
|
}
|
|
455
|
-
function
|
|
454
|
+
function Ke() {
|
|
456
455
|
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
457
456
|
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
458
457
|
}
|
|
@@ -460,15 +459,15 @@ const y = 60, ue = 1;
|
|
|
460
459
|
function me(s) {
|
|
461
460
|
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
462
461
|
}
|
|
463
|
-
function ve(s, e, t, i,
|
|
464
|
-
const o =
|
|
462
|
+
function ve(s, e, t, i, r, n) {
|
|
463
|
+
const o = r ? s.filter((c) => c.name === r) : s;
|
|
465
464
|
if (o.length === 0) {
|
|
466
|
-
console.warn(`No animations found for name: ${
|
|
465
|
+
console.warn(`No animations found for name: ${r}`);
|
|
467
466
|
return;
|
|
468
467
|
}
|
|
469
|
-
let
|
|
468
|
+
let a = 0;
|
|
470
469
|
const l = () => {
|
|
471
|
-
|
|
470
|
+
a++, a === o.length && n && n();
|
|
472
471
|
}, h = (c, u, m, f, p) => {
|
|
473
472
|
c.stop(), c.start(u, m, f, p), n && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
|
|
474
473
|
l();
|
|
@@ -488,11 +487,11 @@ function ve(s, e, t, i, a, n) {
|
|
|
488
487
|
h(c, e, ue, m, f);
|
|
489
488
|
});
|
|
490
489
|
}
|
|
491
|
-
function
|
|
490
|
+
function We(s, e, t) {
|
|
492
491
|
return new Promise((i) => {
|
|
493
|
-
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
494
|
-
const
|
|
495
|
-
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(
|
|
496
495
|
T(
|
|
497
496
|
"cameraTargetLerp",
|
|
498
497
|
"target",
|
|
@@ -502,41 +501,41 @@ function Ye(s, e, t) {
|
|
|
502
501
|
t.target.y,
|
|
503
502
|
t.target.z
|
|
504
503
|
),
|
|
505
|
-
|
|
504
|
+
A.ANIMATIONTYPE_VECTOR3,
|
|
506
505
|
o
|
|
507
506
|
)
|
|
508
|
-
),
|
|
507
|
+
), r.push(
|
|
509
508
|
T(
|
|
510
509
|
"cameraAlphaLerp",
|
|
511
510
|
"alpha",
|
|
512
511
|
e.alpha,
|
|
513
512
|
ge(t.lonDeg),
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
A.ANIMATIONTYPE_FLOAT,
|
|
514
|
+
a
|
|
516
515
|
)
|
|
517
|
-
),
|
|
516
|
+
), r.push(
|
|
518
517
|
T(
|
|
519
518
|
"cameraBetaLerp",
|
|
520
519
|
"beta",
|
|
521
520
|
e.beta,
|
|
522
521
|
ge(t.latDeg),
|
|
523
|
-
|
|
524
|
-
|
|
522
|
+
A.ANIMATIONTYPE_FLOAT,
|
|
523
|
+
a
|
|
525
524
|
)
|
|
526
525
|
), t.radius !== void 0) {
|
|
527
526
|
const c = Math.max(0.01, t.radius);
|
|
528
|
-
|
|
527
|
+
r.push(
|
|
529
528
|
T(
|
|
530
529
|
"cameraRadiusLerp",
|
|
531
530
|
"radius",
|
|
532
531
|
e.radius,
|
|
533
532
|
c,
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
A.ANIMATIONTYPE_FLOAT,
|
|
534
|
+
a
|
|
536
535
|
)
|
|
537
536
|
);
|
|
538
537
|
}
|
|
539
|
-
e.animations.push(...
|
|
538
|
+
e.animations.push(...r);
|
|
540
539
|
const h = e.useAutoRotationBehavior;
|
|
541
540
|
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
542
541
|
e,
|
|
@@ -553,30 +552,30 @@ function Ye(s, e, t) {
|
|
|
553
552
|
function ge(s) {
|
|
554
553
|
return s * Math.PI / 180;
|
|
555
554
|
}
|
|
556
|
-
function T(s, e, t, i,
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
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(
|
|
560
559
|
s,
|
|
561
560
|
e,
|
|
562
561
|
y,
|
|
563
|
-
|
|
562
|
+
r,
|
|
564
563
|
o
|
|
565
564
|
), h = [];
|
|
566
565
|
return n > 0 && h.push({ frame: 0, value: t }), h.push({ frame: y * n, value: t }), h.push({
|
|
567
566
|
frame: y * (n + 1),
|
|
568
567
|
value: i
|
|
569
|
-
}), l.setKeys(h), l.setEasingFunction(
|
|
568
|
+
}), l.setKeys(h), l.setEasingFunction(a), l;
|
|
570
569
|
}
|
|
571
|
-
function
|
|
570
|
+
function Ye(s, e, t) {
|
|
572
571
|
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
573
572
|
}
|
|
574
|
-
function
|
|
573
|
+
function Qe(s, e, t) {
|
|
575
574
|
s.forEach((i) => {
|
|
576
575
|
t && i.name !== t || i.goToFrame(e);
|
|
577
576
|
});
|
|
578
577
|
}
|
|
579
|
-
const
|
|
578
|
+
const Ze = {
|
|
580
579
|
albedoTexture: "albedoMap",
|
|
581
580
|
bumpTexture: "normalMap",
|
|
582
581
|
ambientTexture: "ambientMap",
|
|
@@ -586,7 +585,7 @@ const $e = {
|
|
|
586
585
|
refractionTexture: "refractionMap",
|
|
587
586
|
reflectionTexture: "reflectionMap"
|
|
588
587
|
};
|
|
589
|
-
function
|
|
588
|
+
function $e(s, e, t, i) {
|
|
590
589
|
[
|
|
591
590
|
"albedoTexture",
|
|
592
591
|
"bumpTexture",
|
|
@@ -597,50 +596,50 @@ function je(s, e, t, i) {
|
|
|
597
596
|
"refractionTexture",
|
|
598
597
|
"reflectionTexture"
|
|
599
598
|
].forEach((n) => {
|
|
600
|
-
|
|
599
|
+
je(
|
|
601
600
|
n,
|
|
602
601
|
s,
|
|
603
602
|
e,
|
|
604
603
|
t,
|
|
605
604
|
i
|
|
606
605
|
);
|
|
607
|
-
}),
|
|
606
|
+
}), et(s, e);
|
|
608
607
|
}
|
|
609
|
-
function
|
|
610
|
-
const n =
|
|
608
|
+
function je(s, e, t, i, r) {
|
|
609
|
+
const n = Ze[s];
|
|
611
610
|
if (!n)
|
|
612
611
|
throw new Error("Unexpected texture name encountered.");
|
|
613
|
-
const o = e[n],
|
|
614
|
-
|
|
612
|
+
const o = e[n], a = o == null ? void 0 : o.fileLink;
|
|
613
|
+
a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
615
614
|
s,
|
|
616
|
-
|
|
615
|
+
a,
|
|
617
616
|
void 0,
|
|
618
617
|
!1,
|
|
619
618
|
void 0,
|
|
620
619
|
!0
|
|
621
|
-
) :
|
|
620
|
+
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
622
621
|
s,
|
|
623
|
-
|
|
622
|
+
a,
|
|
624
623
|
128,
|
|
625
624
|
!1,
|
|
626
625
|
!0,
|
|
627
626
|
!1
|
|
628
|
-
) : 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));
|
|
629
628
|
}
|
|
630
|
-
function
|
|
631
|
-
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);
|
|
632
631
|
}
|
|
633
|
-
function
|
|
632
|
+
function Je(s, e, t, i) {
|
|
634
633
|
if (!e) {
|
|
635
634
|
console.error("Failed to apply texture to material: material is null.");
|
|
636
635
|
return;
|
|
637
636
|
}
|
|
638
|
-
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);
|
|
639
638
|
}
|
|
640
|
-
function
|
|
639
|
+
function et(s, e) {
|
|
641
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));
|
|
642
641
|
}
|
|
643
|
-
class
|
|
642
|
+
class tt {
|
|
644
643
|
constructor(e, t, i) {
|
|
645
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;
|
|
646
645
|
}
|
|
@@ -653,27 +652,27 @@ class it {
|
|
|
653
652
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
654
653
|
* where we want to undo changes are remove effects from display.
|
|
655
654
|
*/
|
|
656
|
-
async applyMaterial(e, t, i,
|
|
655
|
+
async applyMaterial(e, t, i, r) {
|
|
657
656
|
return new Promise((n) => {
|
|
658
657
|
const o = this.materialVariantMap.get(e);
|
|
659
658
|
this.materialVariantMap.set(e, {
|
|
660
659
|
...o,
|
|
661
660
|
...t
|
|
662
661
|
});
|
|
663
|
-
const
|
|
664
|
-
(c) => c.name ===
|
|
662
|
+
const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
663
|
+
(c) => c.name === a
|
|
665
664
|
);
|
|
666
665
|
if (l.length === 0) {
|
|
667
666
|
n();
|
|
668
667
|
return;
|
|
669
668
|
}
|
|
670
|
-
const h = new
|
|
669
|
+
const h = new ke(this.scene);
|
|
671
670
|
h.useDefaultLoadingScreen = !1, l.forEach(
|
|
672
|
-
(c) =>
|
|
671
|
+
(c) => $e(
|
|
673
672
|
t,
|
|
674
673
|
c,
|
|
675
674
|
h,
|
|
676
|
-
|
|
675
|
+
r
|
|
677
676
|
)
|
|
678
677
|
), h.onProgress = (c, u, m) => {
|
|
679
678
|
i && i(c / u * 100, 100, m.name);
|
|
@@ -681,9 +680,9 @@ class it {
|
|
|
681
680
|
c.forEach((u) => {
|
|
682
681
|
const m = u;
|
|
683
682
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
684
|
-
(p) => p.name ===
|
|
683
|
+
(p) => p.name === a
|
|
685
684
|
).forEach((p) => {
|
|
686
|
-
|
|
685
|
+
Je(
|
|
687
686
|
u.name,
|
|
688
687
|
p,
|
|
689
688
|
t,
|
|
@@ -704,13 +703,13 @@ class it {
|
|
|
704
703
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
705
704
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
706
705
|
*/
|
|
707
|
-
async applyModel(e, t, i,
|
|
706
|
+
async applyModel(e, t, i, r, n, o, a) {
|
|
708
707
|
var m, f, p;
|
|
709
708
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
710
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(
|
|
711
710
|
(b) => b !== e
|
|
712
711
|
), Promise.resolve(void 0);
|
|
713
|
-
const h = (await N(i, this.scene,
|
|
712
|
+
const h = (await N(i, this.scene, r)).instantiateModelsToScene(
|
|
714
713
|
this.renameClonedAsset,
|
|
715
714
|
!0
|
|
716
715
|
);
|
|
@@ -725,8 +724,8 @@ class it {
|
|
|
725
724
|
c.from,
|
|
726
725
|
w
|
|
727
726
|
), b != null) {
|
|
728
|
-
const R =
|
|
729
|
-
|
|
727
|
+
const R = a && a() || !0;
|
|
728
|
+
Qe(
|
|
730
729
|
h.animationGroups,
|
|
731
730
|
b + (R ? 2 : 0),
|
|
732
731
|
w
|
|
@@ -763,8 +762,8 @@ function we(s) {
|
|
|
763
762
|
const e = [];
|
|
764
763
|
return s.rootNodes.forEach((t) => {
|
|
765
764
|
t.getChildMeshes().forEach((i) => {
|
|
766
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
767
|
-
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);
|
|
768
767
|
n && !e.includes(n) && e.push(n);
|
|
769
768
|
});
|
|
770
769
|
});
|
|
@@ -778,22 +777,22 @@ function pe(s, e = "") {
|
|
|
778
777
|
from: t.from
|
|
779
778
|
}));
|
|
780
779
|
}
|
|
781
|
-
class
|
|
780
|
+
class it {
|
|
782
781
|
constructor(e) {
|
|
783
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 = [];
|
|
784
783
|
const {
|
|
785
784
|
enablePicking: t,
|
|
786
785
|
modelDetails: i,
|
|
787
|
-
previewService:
|
|
786
|
+
previewService: r,
|
|
788
787
|
progressHandler: n,
|
|
789
788
|
scene: o
|
|
790
789
|
} = e;
|
|
791
|
-
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(
|
|
792
791
|
o,
|
|
793
792
|
this.renameClonedAsset.bind(this),
|
|
794
793
|
this.setBaseModelEnabled.bind(this)
|
|
795
|
-
), this.transformRoot = new
|
|
796
|
-
const
|
|
794
|
+
), this.transformRoot = new Fe("root", this.scene);
|
|
795
|
+
const a = async () => {
|
|
797
796
|
if (!i.model)
|
|
798
797
|
throw new Error(
|
|
799
798
|
"Model container constructed with no URL. This is currently unsupported."
|
|
@@ -804,10 +803,10 @@ class nt {
|
|
|
804
803
|
n
|
|
805
804
|
), await this.instantiate(), this;
|
|
806
805
|
};
|
|
807
|
-
this.importPromise =
|
|
806
|
+
this.importPromise = a();
|
|
808
807
|
}
|
|
809
808
|
//#region Interface implementation
|
|
810
|
-
async applyMaterialVariant(e, t, i,
|
|
809
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
811
810
|
if (!this.initialized) {
|
|
812
811
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
813
812
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -818,7 +817,7 @@ class nt {
|
|
|
818
817
|
e,
|
|
819
818
|
t,
|
|
820
819
|
i,
|
|
821
|
-
|
|
820
|
+
r
|
|
822
821
|
)
|
|
823
822
|
);
|
|
824
823
|
} else {
|
|
@@ -834,7 +833,7 @@ class nt {
|
|
|
834
833
|
e,
|
|
835
834
|
t,
|
|
836
835
|
i,
|
|
837
|
-
|
|
836
|
+
r
|
|
838
837
|
)
|
|
839
838
|
);
|
|
840
839
|
}
|
|
@@ -844,14 +843,14 @@ class nt {
|
|
|
844
843
|
await this.variantManager.applyMaterial(
|
|
845
844
|
e,
|
|
846
845
|
i,
|
|
847
|
-
(o,
|
|
846
|
+
(o, a, l) => {
|
|
848
847
|
this.materialVariantObservable.notifyObservers({
|
|
849
848
|
remainingCount: o,
|
|
850
|
-
totalCount:
|
|
849
|
+
totalCount: a,
|
|
851
850
|
taskName: l
|
|
852
851
|
});
|
|
853
852
|
},
|
|
854
|
-
|
|
853
|
+
r
|
|
855
854
|
);
|
|
856
855
|
};
|
|
857
856
|
if (this.materialChangesInProgress.includes(e)) {
|
|
@@ -872,8 +871,8 @@ class nt {
|
|
|
872
871
|
const o = this.queuedMaterialChanges.get(e);
|
|
873
872
|
if (!o)
|
|
874
873
|
throw new Error("Target material is undefined");
|
|
875
|
-
o.forEach(async (
|
|
876
|
-
await
|
|
874
|
+
o.forEach(async (a) => {
|
|
875
|
+
await a();
|
|
877
876
|
}), this.queuedMaterialChanges.delete(e);
|
|
878
877
|
}
|
|
879
878
|
this.materialChangesInProgress.splice(
|
|
@@ -882,13 +881,13 @@ class nt {
|
|
|
882
881
|
), this.configureGlowLayer(), this.scene.cleanCachedTextureBuffer();
|
|
883
882
|
}
|
|
884
883
|
async applyModelVariant(e, t, i) {
|
|
885
|
-
const
|
|
884
|
+
const r = () => this.variantManager.applyModel(
|
|
886
885
|
e,
|
|
887
886
|
i,
|
|
888
887
|
t == null ? void 0 : t.model,
|
|
889
|
-
(
|
|
888
|
+
(a) => {
|
|
890
889
|
this.modelVariantObservable.notifyObservers({
|
|
891
|
-
...
|
|
890
|
+
...a,
|
|
892
891
|
key: e
|
|
893
892
|
});
|
|
894
893
|
},
|
|
@@ -897,24 +896,24 @@ class nt {
|
|
|
897
896
|
this.getAnimationIsPlaying.bind(this)
|
|
898
897
|
), n = async () => {
|
|
899
898
|
this.modelChangesInProgress.push(e);
|
|
900
|
-
let
|
|
899
|
+
let a = await r();
|
|
901
900
|
if (this.queuedModelChanges.has(e)) {
|
|
902
901
|
const l = this.queuedModelChanges.get(e);
|
|
903
902
|
if (!l)
|
|
904
903
|
throw new Error("Queued change resolved undefined");
|
|
905
|
-
|
|
904
|
+
a = await l(), this.queuedModelChanges.delete(e);
|
|
906
905
|
}
|
|
907
906
|
return this.modelChangesInProgress.splice(
|
|
908
907
|
this.modelChangesInProgress.indexOf(e),
|
|
909
908
|
1
|
|
910
|
-
),
|
|
909
|
+
), a;
|
|
911
910
|
};
|
|
912
911
|
if (!this.initialized || this.modelChangesInProgress.includes(e)) {
|
|
913
|
-
const
|
|
914
|
-
const l = await
|
|
912
|
+
const a = async () => {
|
|
913
|
+
const l = await r();
|
|
915
914
|
return l ? this.configureModelInstance(l) : this.configureGlowLayer(), l;
|
|
916
915
|
};
|
|
917
|
-
this.queuedModelChanges.set(e,
|
|
916
|
+
this.queuedModelChanges.set(e, a);
|
|
918
917
|
return;
|
|
919
918
|
}
|
|
920
919
|
const o = await n();
|
|
@@ -930,7 +929,7 @@ class nt {
|
|
|
930
929
|
let t = () => {
|
|
931
930
|
};
|
|
932
931
|
const i = async () => {
|
|
933
|
-
this.isExecutingAnimation = !0, await new Promise((
|
|
932
|
+
this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
934
933
|
var o;
|
|
935
934
|
const n = [
|
|
936
935
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
@@ -942,12 +941,12 @@ class nt {
|
|
|
942
941
|
e.to,
|
|
943
942
|
e.from,
|
|
944
943
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
945
|
-
|
|
944
|
+
r
|
|
946
945
|
);
|
|
947
946
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
948
947
|
};
|
|
949
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
950
|
-
t =
|
|
948
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
949
|
+
t = r;
|
|
951
950
|
})) : i();
|
|
952
951
|
}
|
|
953
952
|
getAnimations(e) {
|
|
@@ -957,7 +956,7 @@ class nt {
|
|
|
957
956
|
this.variantManager.getAnimationGroups(),
|
|
958
957
|
this.renameClonedAsset("")
|
|
959
958
|
) : []
|
|
960
|
-
].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);
|
|
961
960
|
}
|
|
962
961
|
getId() {
|
|
963
962
|
return this.id;
|
|
@@ -1025,8 +1024,8 @@ class nt {
|
|
|
1025
1024
|
e.rootNodes.forEach((t) => {
|
|
1026
1025
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1027
1026
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new O(this.scene)), i.actionManager.registerAction(
|
|
1028
|
-
new oe(O.OnPointerOverTrigger, (
|
|
1029
|
-
|
|
1027
|
+
new oe(O.OnPointerOverTrigger, (r) => {
|
|
1028
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1030
1029
|
id: i.material.id,
|
|
1031
1030
|
name: this.stripIdFromName(i.material.name)
|
|
1032
1031
|
});
|
|
@@ -1070,14 +1069,14 @@ class nt {
|
|
|
1070
1069
|
throw new Error(
|
|
1071
1070
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1072
1071
|
);
|
|
1073
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1072
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1074
1073
|
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = x.Identity(), this.transformRoot.scaling = g.One();
|
|
1075
1074
|
for (const o of e.rootNodes) {
|
|
1076
1075
|
o.parent = this.transformRoot;
|
|
1077
|
-
for (const
|
|
1078
|
-
|
|
1076
|
+
for (const a of o.getChildMeshes(!1))
|
|
1077
|
+
a.alwaysSelectAsActiveMesh = !0;
|
|
1079
1078
|
}
|
|
1080
|
-
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(
|
|
1081
1080
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1082
1081
|
this.scene,
|
|
1083
1082
|
this.canvasPanels,
|
|
@@ -1095,7 +1094,7 @@ class nt {
|
|
|
1095
1094
|
getAllMeshes() {
|
|
1096
1095
|
var e;
|
|
1097
1096
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1098
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1097
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Le)
|
|
1099
1098
|
).flat();
|
|
1100
1099
|
}
|
|
1101
1100
|
async instantiate() {
|
|
@@ -1121,8 +1120,8 @@ class nt {
|
|
|
1121
1120
|
var e;
|
|
1122
1121
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1123
1122
|
(t, i) => {
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1123
|
+
const r = this.dynamicTextures.get(i);
|
|
1124
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1126
1125
|
}
|
|
1127
1126
|
);
|
|
1128
1127
|
}
|
|
@@ -1139,10 +1138,10 @@ class nt {
|
|
|
1139
1138
|
unregisterModelVariantListener(e) {
|
|
1140
1139
|
this.modelVariantObservable.removeCallback(e);
|
|
1141
1140
|
}
|
|
1142
|
-
//#endregion
|
|
1143
1141
|
getLastRequestedAnimation() {
|
|
1144
1142
|
return this.lastRequestedAnimation;
|
|
1145
1143
|
}
|
|
1144
|
+
//#endregion
|
|
1146
1145
|
getCurrentAnimationFrame() {
|
|
1147
1146
|
var t;
|
|
1148
1147
|
const e = [
|
|
@@ -1184,17 +1183,17 @@ class nt {
|
|
|
1184
1183
|
//#endregion
|
|
1185
1184
|
}
|
|
1186
1185
|
class z extends fe {
|
|
1187
|
-
constructor(e, t, i,
|
|
1186
|
+
constructor(e, t, i, r, n, o, a, l) {
|
|
1188
1187
|
super(
|
|
1189
1188
|
e,
|
|
1190
1189
|
t,
|
|
1191
1190
|
i,
|
|
1192
|
-
|
|
1191
|
+
r,
|
|
1193
1192
|
n,
|
|
1194
1193
|
o,
|
|
1195
1194
|
l
|
|
1196
|
-
), 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,
|
|
1197
|
-
|
|
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
|
|
1198
1197
|
));
|
|
1199
1198
|
}
|
|
1200
1199
|
updateConfiguration(e) {
|
|
@@ -1234,7 +1233,7 @@ class z extends fe {
|
|
|
1234
1233
|
this.useFramingBehavior = !0;
|
|
1235
1234
|
const e = this.getFramingBehavior();
|
|
1236
1235
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1237
|
-
const t =
|
|
1236
|
+
const t = L(this._scene);
|
|
1238
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;
|
|
1239
1238
|
}
|
|
1240
1239
|
/**
|
|
@@ -1246,14 +1245,14 @@ class z extends fe {
|
|
|
1246
1245
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1247
1246
|
const i = this.getFramingBehavior();
|
|
1248
1247
|
i.framingTime = t || 800;
|
|
1249
|
-
const
|
|
1248
|
+
const r = () => {
|
|
1250
1249
|
this.isRunningFramingBehavior = !1;
|
|
1251
|
-
}, n =
|
|
1252
|
-
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(
|
|
1253
1252
|
n.min,
|
|
1254
1253
|
n.max,
|
|
1255
1254
|
void 0,
|
|
1256
|
-
|
|
1255
|
+
r
|
|
1257
1256
|
), i.framingTime = 0;
|
|
1258
1257
|
}
|
|
1259
1258
|
/**
|
|
@@ -1285,7 +1284,7 @@ class z extends fe {
|
|
|
1285
1284
|
*/
|
|
1286
1285
|
static create(e, t, i) {
|
|
1287
1286
|
var l;
|
|
1288
|
-
const
|
|
1287
|
+
const r = L(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new z(
|
|
1289
1288
|
"ProductCamera",
|
|
1290
1289
|
-(Math.PI / 2),
|
|
1291
1290
|
Math.PI / 2,
|
|
@@ -1294,14 +1293,14 @@ class z extends fe {
|
|
|
1294
1293
|
e,
|
|
1295
1294
|
t
|
|
1296
1295
|
);
|
|
1297
|
-
return
|
|
1296
|
+
return a.setPanEnabled(
|
|
1298
1297
|
((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1299
|
-
),
|
|
1300
|
-
|
|
1301
|
-
}), 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;
|
|
1302
1301
|
}
|
|
1303
1302
|
}
|
|
1304
|
-
function
|
|
1303
|
+
function L(s) {
|
|
1305
1304
|
if (s.meshes.length === 0)
|
|
1306
1305
|
return {
|
|
1307
1306
|
min: new g(-1, -1, -1),
|
|
@@ -1310,9 +1309,9 @@ function I(s) {
|
|
|
1310
1309
|
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1311
1310
|
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1312
1311
|
}
|
|
1313
|
-
class
|
|
1312
|
+
class nt {
|
|
1314
1313
|
constructor(e, t = !1, i = void 0) {
|
|
1315
|
-
this.renderingPipeline = new
|
|
1314
|
+
this.renderingPipeline = new Ne(
|
|
1316
1315
|
"default",
|
|
1317
1316
|
t,
|
|
1318
1317
|
e,
|
|
@@ -1328,9 +1327,9 @@ class st {
|
|
|
1328
1327
|
return this.currentConfiguration;
|
|
1329
1328
|
}
|
|
1330
1329
|
setConfiguration(e) {
|
|
1331
|
-
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;
|
|
1332
1331
|
if (this.renderingPipeline.isSupported) {
|
|
1333
|
-
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(
|
|
1334
1333
|
e.chromaticAberration.direction.x,
|
|
1335
1334
|
e.chromaticAberration.direction.y
|
|
1336
1335
|
) : new se(
|
|
@@ -1339,16 +1338,16 @@ class st {
|
|
|
1339
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)
|
|
1340
1339
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1341
1340
|
case "Low":
|
|
1342
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1341
|
+
this.renderingPipeline.depthOfFieldBlurLevel = I.Low;
|
|
1343
1342
|
break;
|
|
1344
1343
|
case "Medium":
|
|
1345
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1344
|
+
this.renderingPipeline.depthOfFieldBlurLevel = I.Medium;
|
|
1346
1345
|
break;
|
|
1347
1346
|
case "High":
|
|
1348
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1347
|
+
this.renderingPipeline.depthOfFieldBlurLevel = I.High;
|
|
1349
1348
|
break;
|
|
1350
1349
|
}
|
|
1351
|
-
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)
|
|
1352
1351
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1353
1352
|
case "Standard":
|
|
1354
1353
|
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
|
|
@@ -1384,7 +1383,7 @@ class st {
|
|
|
1384
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;
|
|
1385
1384
|
}
|
|
1386
1385
|
}
|
|
1387
|
-
|
|
1386
|
+
ye.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1388
1387
|
return new _e(s);
|
|
1389
1388
|
});
|
|
1390
1389
|
q.OnPluginActivatedObservable.add((s) => {
|
|
@@ -1399,10 +1398,10 @@ function F(s) {
|
|
|
1399
1398
|
function S(s) {
|
|
1400
1399
|
return { x: s.x, y: s.y, z: s.z };
|
|
1401
1400
|
}
|
|
1402
|
-
class
|
|
1401
|
+
class Wt {
|
|
1403
1402
|
constructor(e) {
|
|
1404
1403
|
var l;
|
|
1405
|
-
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 = () => {
|
|
1406
1405
|
if (!this.engine.views)
|
|
1407
1406
|
return;
|
|
1408
1407
|
this.modelContainers.forEach((u) => {
|
|
@@ -1426,12 +1425,12 @@ class Qt {
|
|
|
1426
1425
|
const i = (() => {
|
|
1427
1426
|
if (!(e != null && e.noRender))
|
|
1428
1427
|
return this.configuration.createCanvas();
|
|
1429
|
-
})(),
|
|
1430
|
-
|
|
1428
|
+
})(), r = "1.5.7";
|
|
1429
|
+
Ae.Configuration = {
|
|
1431
1430
|
decoder: {
|
|
1432
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1433
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1434
|
-
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`
|
|
1435
1434
|
}
|
|
1436
1435
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1437
1436
|
const n = console.log;
|
|
@@ -1446,18 +1445,18 @@ class Qt {
|
|
|
1446
1445
|
stencil: this.configuration.highlights.enabled,
|
|
1447
1446
|
forceSRGBBufferSupportState: !0
|
|
1448
1447
|
}) : new Ce();
|
|
1449
|
-
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(
|
|
1450
1449
|
this.scene,
|
|
1451
1450
|
!1,
|
|
1452
1451
|
this.camera
|
|
1453
1452
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1454
|
-
const
|
|
1453
|
+
const a = ne.CreateFromPrefilteredData(
|
|
1455
1454
|
this.configuration.scene.environment.file,
|
|
1456
1455
|
this.scene
|
|
1457
1456
|
);
|
|
1458
|
-
|
|
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(
|
|
1459
1458
|
this.configuration.options.renderingPipelineConfiguration
|
|
1460
|
-
) : (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(
|
|
1461
1460
|
this.scene,
|
|
1462
1461
|
this.configuration.emissiveGlowIntensity
|
|
1463
1462
|
), this.initPromise = new Promise((h) => {
|
|
@@ -1507,19 +1506,19 @@ class Qt {
|
|
|
1507
1506
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1508
1507
|
}
|
|
1509
1508
|
executeCameraAnimation(e) {
|
|
1510
|
-
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()))
|
|
1511
1510
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1512
1511
|
let t = () => {
|
|
1513
1512
|
};
|
|
1514
1513
|
const i = async () => {
|
|
1515
|
-
this.isAnimatingCamera = !0, await
|
|
1514
|
+
this.isAnimatingCamera = !0, await We(
|
|
1516
1515
|
this.scene,
|
|
1517
1516
|
this.scene.activeCamera,
|
|
1518
1517
|
e
|
|
1519
1518
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1520
1519
|
};
|
|
1521
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1522
|
-
t =
|
|
1520
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1521
|
+
t = r;
|
|
1523
1522
|
})) : i();
|
|
1524
1523
|
}
|
|
1525
1524
|
getCameraPose() {
|
|
@@ -1556,13 +1555,13 @@ class Qt {
|
|
|
1556
1555
|
const t = async () => {
|
|
1557
1556
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1558
1557
|
this.focusLostNotified = !1;
|
|
1559
|
-
const
|
|
1558
|
+
const r = () => {
|
|
1560
1559
|
const n = this.configuration;
|
|
1561
1560
|
this.camera.rerunFramingBehavior(() => {
|
|
1562
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();
|
|
1563
1562
|
});
|
|
1564
1563
|
};
|
|
1565
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1564
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1566
1565
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1567
1566
|
};
|
|
1568
1567
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1591,13 +1590,13 @@ class Qt {
|
|
|
1591
1590
|
0,
|
|
1592
1591
|
g.Zero(),
|
|
1593
1592
|
this.scene
|
|
1594
|
-
),
|
|
1595
|
-
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;
|
|
1596
1595
|
try {
|
|
1597
1596
|
return await new Promise((o) => {
|
|
1598
|
-
const
|
|
1599
|
-
this.scene.onBeforeRenderObservable.remove(
|
|
1600
|
-
const l = await
|
|
1597
|
+
const a = this.scene.onBeforeRenderObservable.add(async () => {
|
|
1598
|
+
this.scene.onBeforeRenderObservable.remove(a);
|
|
1599
|
+
const l = await Me.CreateScreenshotUsingRenderTargetAsync(
|
|
1601
1600
|
this.engine,
|
|
1602
1601
|
i,
|
|
1603
1602
|
e,
|
|
@@ -1617,48 +1616,43 @@ class Qt {
|
|
|
1617
1616
|
const e = this.configuration;
|
|
1618
1617
|
if (!e)
|
|
1619
1618
|
return !0;
|
|
1620
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1621
|
-
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)
|
|
1622
1621
|
return !0;
|
|
1623
|
-
const o = [t, i],
|
|
1622
|
+
const o = [t, i], a = [r, n], l = o.every((c) => c === t), h = a.every((c) => c === r);
|
|
1624
1623
|
return !l && !h;
|
|
1625
1624
|
}
|
|
1626
1625
|
fireResizeEvent() {
|
|
1627
1626
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1628
1627
|
}
|
|
1629
|
-
setHighlights(e
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
(r) => r.name === n.name && r.id === n.id
|
|
1640
|
-
);
|
|
1641
|
-
o && o.getBindedMeshes().forEach(
|
|
1642
|
-
(r) => {
|
|
1643
|
-
var l;
|
|
1644
|
-
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1645
|
-
r,
|
|
1646
|
-
i || A.FromHexString("#fcba03")
|
|
1647
|
-
);
|
|
1648
|
-
}
|
|
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
|
|
1649
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);
|
|
1650
1644
|
});
|
|
1651
1645
|
}
|
|
1652
1646
|
setRenderingPipelineConfiguration(e) {
|
|
1653
1647
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1654
1648
|
}
|
|
1655
1649
|
loadModel(e, t) {
|
|
1656
|
-
const { refocusCamera: i = !0, progressHandler:
|
|
1650
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new it({
|
|
1657
1651
|
enablePicking: this.configuration.highlights.enabled,
|
|
1658
1652
|
modelDetails: e,
|
|
1659
1653
|
scene: this.scene,
|
|
1660
1654
|
previewService: this,
|
|
1661
|
-
progressHandler:
|
|
1655
|
+
progressHandler: r
|
|
1662
1656
|
});
|
|
1663
1657
|
return n.getInitializationPromise().then(() => {
|
|
1664
1658
|
if (this.modelContainers.size <= 1 && i) {
|
|
@@ -1696,7 +1690,7 @@ class Qt {
|
|
|
1696
1690
|
}
|
|
1697
1691
|
unregisterPlugin(e) {
|
|
1698
1692
|
const t = this.plugins.indexOf(e);
|
|
1699
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1693
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1700
1694
|
}
|
|
1701
1695
|
getGlowLayerManager() {
|
|
1702
1696
|
return this.glowLayerManager;
|
|
@@ -1714,33 +1708,36 @@ class Qt {
|
|
|
1714
1708
|
* Flips a transform around the origin.
|
|
1715
1709
|
*/
|
|
1716
1710
|
flipTransform(e, t, i) {
|
|
1717
|
-
const
|
|
1711
|
+
const r = re.Compose(
|
|
1718
1712
|
F(i || { x: 1, y: 1, z: 1 }),
|
|
1719
1713
|
x.FromEulerVector(
|
|
1720
1714
|
F(t || { x: 0, y: 0, z: 0 })
|
|
1721
1715
|
),
|
|
1722
1716
|
F(e || { x: 0, y: 0, z: 0 })
|
|
1723
|
-
), n = re.RotationAxis(g.Up(), Math.PI), o =
|
|
1724
|
-
return o.decompose(h, l,
|
|
1725
|
-
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),
|
|
1726
1720
|
rotation: S(l.toEulerAngles()),
|
|
1727
1721
|
scale: S(h)
|
|
1728
1722
|
};
|
|
1729
1723
|
}
|
|
1730
1724
|
updatePreviewOptions(e) {
|
|
1731
|
-
var
|
|
1725
|
+
var r, n;
|
|
1732
1726
|
const t = new ce(e);
|
|
1733
1727
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1734
1728
|
let i = this.scene.environmentTexture;
|
|
1735
1729
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = ne.CreateFromPrefilteredData(
|
|
1736
1730
|
t.scene.environment.file,
|
|
1737
1731
|
this.scene
|
|
1738
|
-
), 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(
|
|
1739
1733
|
t.options.renderingPipelineConfiguration
|
|
1740
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(
|
|
1741
1735
|
((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1742
1736
|
), this.configuration = t;
|
|
1743
1737
|
}
|
|
1738
|
+
setHighlightMaterials(e) {
|
|
1739
|
+
this.validHighlightMaterials = e;
|
|
1740
|
+
}
|
|
1744
1741
|
/**
|
|
1745
1742
|
* Given a valid canvas element, will remove any existing input controls
|
|
1746
1743
|
* and re-attach them to the given canvas. The pan mouse button can be set
|
|
@@ -1758,8 +1755,8 @@ class Qt {
|
|
|
1758
1755
|
export {
|
|
1759
1756
|
D as MaterialEffectMode,
|
|
1760
1757
|
B as ProductCameraRig,
|
|
1761
|
-
|
|
1758
|
+
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1762
1759
|
P as RenderingConfiguration,
|
|
1763
|
-
|
|
1760
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1764
1761
|
d as renderingPipelineDefaults
|
|
1765
1762
|
};
|