@spiffcommerce/preview 5.7.9-9 → 5.7.10-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.esm.js +362 -357
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { ArcRotateCamera as
|
|
2
|
-
import { Engine as
|
|
3
|
-
import { NullEngine as
|
|
4
|
-
import { HighlightLayer as
|
|
5
|
-
import { SceneLoader as
|
|
1
|
+
import { ArcRotateCamera as fe } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
|
+
import { Engine as be } from "@babylonjs/core/Engines/engine";
|
|
3
|
+
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HighlightLayer as xe } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
+
import { SceneLoader as D } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
6
|
import { CubeTexture as ne } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
|
-
import { Color4 as b, Color3 as
|
|
8
|
-
import { Vector3 as
|
|
7
|
+
import { Color4 as b, Color3 as C } from "@babylonjs/core/Maths/math.color";
|
|
8
|
+
import { Vector3 as f, Quaternion as A, Vector2 as se, Matrix as re } from "@babylonjs/core/Maths/math.vector";
|
|
9
9
|
import { DracoCompression as Ae } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
|
-
import { Observable as
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { GLTFLoaderAnimationStartMode as
|
|
15
|
-
import { PBRMaterial as
|
|
16
|
-
import { MirrorTexture as
|
|
17
|
-
import { Color3 as
|
|
18
|
-
import { ReflectionProbe as
|
|
19
|
-
import { GlowLayer as
|
|
20
|
-
import { ActionManager as
|
|
10
|
+
import { Observable as x } from "@babylonjs/core/Misc/observable";
|
|
11
|
+
import { Tools as ye } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as Me } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
14
|
+
import { GLTFLoaderAnimationStartMode as Re } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
|
+
import { PBRMaterial as k } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
16
|
+
import { MirrorTexture as Ee } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
17
|
+
import { Color3 as Te, Vector3 as ae, Plane as Oe } from "@babylonjs/core/Maths/math";
|
|
18
|
+
import { ReflectionProbe as Le } from "@babylonjs/core/Probes/reflectionProbe";
|
|
19
|
+
import { GlowLayer as Ie } from "@babylonjs/core/Layers/glowLayer";
|
|
20
|
+
import { ActionManager as T } from "@babylonjs/core/Actions/actionManager";
|
|
21
21
|
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
|
|
22
|
+
import { Mesh as Fe } from "@babylonjs/core/Meshes/mesh";
|
|
23
|
+
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
24
|
+
import { DynamicTexture as Be } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
25
|
+
import { Texture as De } from "@babylonjs/core/Materials/Textures/texture";
|
|
26
|
+
import { Animation as w } from "@babylonjs/core/Animations/animation";
|
|
27
|
+
import { QuadraticEase as ke, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
28
|
+
import { AssetsManager as Ne } from "@babylonjs/core/Misc/assetsManager";
|
|
29
29
|
import { ColorCurves as le } from "@babylonjs/core/Materials/colorCurves";
|
|
30
|
-
import { ImageProcessingConfiguration as
|
|
31
|
-
import { DefaultRenderingPipeline as
|
|
32
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
30
|
+
import { ImageProcessingConfiguration as R } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
|
+
import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
32
|
+
import { DepthOfFieldEffectBlurLevel as O } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
33
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
34
34
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
35
35
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
@@ -40,43 +40,48 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
40
40
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
41
41
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
42
42
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
var S = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(S || {}), B = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(B || {});
|
|
44
|
+
const he = /* @__PURE__ */ new Map();
|
|
45
|
+
async function z(s, e, t) {
|
|
46
|
+
const i = await he.get(s);
|
|
47
|
+
if (i && i.scene.uid === e.uid)
|
|
48
|
+
return i;
|
|
49
|
+
const r = D.LoadAssetContainerAsync(
|
|
46
50
|
s,
|
|
47
51
|
void 0,
|
|
48
52
|
e,
|
|
49
53
|
t
|
|
50
54
|
);
|
|
55
|
+
return he.set(s, r), r;
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
s.name === "gltf" && (s.animationStartMode =
|
|
57
|
+
D.OnPluginActivatedObservable.add((s) => {
|
|
58
|
+
s.name === "gltf" && (s.animationStartMode = Re.NONE);
|
|
54
59
|
});
|
|
55
|
-
class
|
|
60
|
+
class ce {
|
|
56
61
|
constructor(e) {
|
|
57
62
|
this.getSceneClearColor = () => {
|
|
58
|
-
var i,
|
|
59
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
63
|
+
var i, r, n, o;
|
|
64
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
60
65
|
if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
61
66
|
return new b(0, 0, 0, t).toLinearSpace();
|
|
62
67
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
63
|
-
const
|
|
68
|
+
const a = C.FromHexString(
|
|
64
69
|
this.customOptions.backgroundColor
|
|
65
70
|
);
|
|
66
71
|
return new b(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
a.r,
|
|
73
|
+
a.g,
|
|
74
|
+
a.b,
|
|
70
75
|
t
|
|
71
76
|
).toLinearSpace();
|
|
72
77
|
}
|
|
73
78
|
return new b(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
74
79
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new b(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
75
|
-
const
|
|
80
|
+
const r = C.FromHexString(t);
|
|
76
81
|
return new b(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
r.r,
|
|
83
|
+
r.g,
|
|
84
|
+
r.b,
|
|
80
85
|
i
|
|
81
86
|
).toLinearSpace();
|
|
82
87
|
}, this.customOptions = e;
|
|
@@ -92,13 +97,13 @@ class he {
|
|
|
92
97
|
* Configuration related to the scene
|
|
93
98
|
*/
|
|
94
99
|
get scene() {
|
|
95
|
-
var e, t, i,
|
|
100
|
+
var e, t, i, r, n;
|
|
96
101
|
return {
|
|
97
102
|
clearColor: this.getSceneClearColor(),
|
|
98
103
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
99
104
|
environment: {
|
|
100
105
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
101
|
-
intensity: ((
|
|
106
|
+
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
102
107
|
rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
103
108
|
// Convert to radians
|
|
104
109
|
}
|
|
@@ -108,7 +113,7 @@ class he {
|
|
|
108
113
|
* Configuration related to the camera used to view and interact with the scene.
|
|
109
114
|
*/
|
|
110
115
|
get camera() {
|
|
111
|
-
var e, t, i,
|
|
116
|
+
var e, t, i, r, n, o, a, h, l, c, u, m, p;
|
|
112
117
|
return {
|
|
113
118
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
114
119
|
autoRotation: {
|
|
@@ -117,14 +122,14 @@ class he {
|
|
|
117
122
|
},
|
|
118
123
|
limits: {
|
|
119
124
|
min: {
|
|
120
|
-
alpha: (
|
|
121
|
-
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((
|
|
125
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
126
|
+
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
122
127
|
radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
|
|
123
128
|
},
|
|
124
129
|
max: {
|
|
125
130
|
alpha: (l = this.customOptions) != null && l.upperAlphaLimitDeg ? ((c = this.customOptions) == null ? void 0 : c.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
126
|
-
beta: (
|
|
127
|
-
radius: (
|
|
131
|
+
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
132
|
+
radius: (p = this.customOptions) == null ? void 0 : p.maxZoomOverride
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
};
|
|
@@ -141,10 +146,10 @@ class he {
|
|
|
141
146
|
};
|
|
142
147
|
}
|
|
143
148
|
get lighting() {
|
|
144
|
-
var e, t, i,
|
|
149
|
+
var e, t, i, r;
|
|
145
150
|
return {
|
|
146
151
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
147
|
-
contrast: ((
|
|
152
|
+
contrast: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
get emissiveGlowIntensity() {
|
|
@@ -152,12 +157,12 @@ class he {
|
|
|
152
157
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
|
-
class
|
|
160
|
+
class M {
|
|
156
161
|
/**
|
|
157
162
|
* Returns the resolution expected for generated textures.
|
|
158
163
|
*/
|
|
159
164
|
static getDynamicTextureResolution() {
|
|
160
|
-
return this.getIsMobile() || !
|
|
165
|
+
return this.getIsMobile() || !M.offscreenRenderingSupported() ? {
|
|
161
166
|
width: 1024,
|
|
162
167
|
height: 1024
|
|
163
168
|
} : {
|
|
@@ -193,7 +198,7 @@ class y {
|
|
|
193
198
|
}
|
|
194
199
|
}
|
|
195
200
|
}
|
|
196
|
-
const
|
|
201
|
+
const Ve = 128, d = {
|
|
197
202
|
antiAliasing: {
|
|
198
203
|
samples: 4,
|
|
199
204
|
fxaaEnabled: !1
|
|
@@ -250,7 +255,7 @@ const qe = 128, d = {
|
|
|
250
255
|
weight: 1
|
|
251
256
|
}
|
|
252
257
|
};
|
|
253
|
-
class
|
|
258
|
+
class _e {
|
|
254
259
|
constructor(e) {
|
|
255
260
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
256
261
|
}
|
|
@@ -265,11 +270,11 @@ class Ve {
|
|
|
265
270
|
return this.loader.loadNodeAsync(
|
|
266
271
|
e,
|
|
267
272
|
t,
|
|
268
|
-
function(
|
|
273
|
+
function(r) {
|
|
269
274
|
t.extras && Object.keys(t.extras).forEach((n) => {
|
|
270
275
|
const o = t.extras[n];
|
|
271
|
-
|
|
272
|
-
}), i(
|
|
276
|
+
r.metadata[n] = o;
|
|
277
|
+
}), i(r);
|
|
273
278
|
}
|
|
274
279
|
);
|
|
275
280
|
}
|
|
@@ -294,14 +299,14 @@ class Ve {
|
|
|
294
299
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
295
300
|
*/
|
|
296
301
|
enableMaterialExtrasIfRequired(e, t) {
|
|
297
|
-
if (!(!e.extras || !(t instanceof
|
|
302
|
+
if (!(!e.extras || !(t instanceof k))) {
|
|
298
303
|
if (e.extras.sheen) {
|
|
299
304
|
const i = t;
|
|
300
305
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
301
306
|
}
|
|
302
307
|
if (e.extras.translucency) {
|
|
303
308
|
const i = t;
|
|
304
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
309
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new Te(
|
|
305
310
|
e.extras.translucencyR,
|
|
306
311
|
e.extras.translucencyG,
|
|
307
312
|
e.extras.translucencyB
|
|
@@ -329,19 +334,19 @@ class Ve {
|
|
|
329
334
|
applyReflections(e) {
|
|
330
335
|
function t(n) {
|
|
331
336
|
const o = [];
|
|
332
|
-
return n.transformNodes.forEach((
|
|
333
|
-
|
|
334
|
-
}), n.meshes.forEach((
|
|
335
|
-
|
|
337
|
+
return n.transformNodes.forEach((a) => {
|
|
338
|
+
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
339
|
+
}), n.meshes.forEach((a) => {
|
|
340
|
+
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
336
341
|
}), o;
|
|
337
342
|
}
|
|
338
343
|
function i(n, o = 1) {
|
|
339
|
-
const
|
|
340
|
-
if (!
|
|
344
|
+
const a = n.material;
|
|
345
|
+
if (!a)
|
|
341
346
|
return;
|
|
342
|
-
const h = new
|
|
347
|
+
const h = new Ee(
|
|
343
348
|
"mirror",
|
|
344
|
-
|
|
349
|
+
M.getMirrorTextureResolution(),
|
|
345
350
|
e,
|
|
346
351
|
!0
|
|
347
352
|
);
|
|
@@ -352,30 +357,30 @@ class Ve {
|
|
|
352
357
|
"Mirror attribute specified on: " + n.name + "But no normals exist to generate a mirror from!"
|
|
353
358
|
);
|
|
354
359
|
n.computeWorldMatrix(!0);
|
|
355
|
-
const c = n.getWorldMatrix(),
|
|
360
|
+
const c = n.getWorldMatrix(), u = ae.TransformNormal(
|
|
356
361
|
new ae(l[0], l[1], l[2]),
|
|
357
362
|
c
|
|
358
|
-
).normalize(),
|
|
363
|
+
).normalize(), m = Oe.FromPositionAndNormal(
|
|
359
364
|
n.position,
|
|
360
|
-
|
|
365
|
+
u.scale(-1)
|
|
361
366
|
);
|
|
362
|
-
h.mirrorPlane =
|
|
367
|
+
h.mirrorPlane = m, h.level = o, a.reflectionTexture = h;
|
|
363
368
|
}
|
|
364
|
-
function
|
|
365
|
-
const o = n.material,
|
|
369
|
+
function r(n) {
|
|
370
|
+
const o = n.material, a = new Le(
|
|
366
371
|
"probe-" + o.name,
|
|
367
|
-
|
|
372
|
+
Ve,
|
|
368
373
|
e
|
|
369
374
|
);
|
|
370
|
-
|
|
375
|
+
a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
371
376
|
}
|
|
372
377
|
e.meshes.forEach((n) => {
|
|
373
378
|
const o = n.metadata;
|
|
374
|
-
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe &&
|
|
379
|
+
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
|
|
375
380
|
});
|
|
376
381
|
}
|
|
377
382
|
}
|
|
378
|
-
class
|
|
383
|
+
class Ge {
|
|
379
384
|
constructor(e, t) {
|
|
380
385
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
381
386
|
}
|
|
@@ -384,7 +389,7 @@ class _e {
|
|
|
384
389
|
}
|
|
385
390
|
includeMeshes(e) {
|
|
386
391
|
if (e) {
|
|
387
|
-
this.glowLayer || (this.glowLayer = new
|
|
392
|
+
this.glowLayer || (this.glowLayer = new Ie("glow", this.scene), this.glowLayer.intensity = this.intensity);
|
|
388
393
|
for (const t of e)
|
|
389
394
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
390
395
|
}
|
|
@@ -397,42 +402,42 @@ class _e {
|
|
|
397
402
|
}
|
|
398
403
|
}
|
|
399
404
|
}
|
|
400
|
-
function
|
|
405
|
+
function He(s, e, t, i, r = "") {
|
|
401
406
|
t.forEach((n) => {
|
|
402
|
-
const o = n.getID(),
|
|
403
|
-
s.filter((c) => c.name ===
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
|
|
407
|
+
const o = n.getID(), a = n.getName(), h = M.getDynamicTextureResolution();
|
|
408
|
+
s.filter((c) => c.name === r + a).forEach((c) => {
|
|
409
|
+
const u = i.get(o), m = !1;
|
|
410
|
+
if (u)
|
|
411
|
+
de(c, u), u.update(m);
|
|
407
412
|
else {
|
|
408
|
-
const
|
|
409
|
-
|
|
413
|
+
const p = Ue(
|
|
414
|
+
a,
|
|
410
415
|
e,
|
|
411
416
|
h.width,
|
|
412
417
|
h.height
|
|
413
418
|
);
|
|
414
|
-
i.set(o,
|
|
415
|
-
|
|
416
|
-
),
|
|
417
|
-
|
|
419
|
+
i.set(o, p), n.setStaticContext(
|
|
420
|
+
p.getContext()
|
|
421
|
+
), de(c, p), p.onLoadObservable.addOnce(() => {
|
|
422
|
+
p.update(m);
|
|
418
423
|
});
|
|
419
424
|
}
|
|
420
425
|
});
|
|
421
426
|
});
|
|
422
427
|
}
|
|
423
|
-
function
|
|
424
|
-
const
|
|
428
|
+
function Ue(s, e, t, i) {
|
|
429
|
+
const r = new Be(
|
|
425
430
|
s,
|
|
426
431
|
{ width: t, height: i },
|
|
427
432
|
e,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
), n =
|
|
432
|
-
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i),
|
|
433
|
+
M.shouldMipMap(),
|
|
434
|
+
De.TRILINEAR_SAMPLINGMODE,
|
|
435
|
+
be.TEXTUREFORMAT_RGBA
|
|
436
|
+
), n = r.getContext();
|
|
437
|
+
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
|
|
433
438
|
}
|
|
434
|
-
function
|
|
435
|
-
if (s instanceof
|
|
439
|
+
function de(s, e) {
|
|
440
|
+
if (s instanceof k) {
|
|
436
441
|
const t = s, i = t.albedoTexture;
|
|
437
442
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
438
443
|
} else {
|
|
@@ -440,25 +445,25 @@ function ce(s, e) {
|
|
|
440
445
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
441
446
|
}
|
|
442
447
|
}
|
|
443
|
-
function
|
|
448
|
+
function Ke() {
|
|
444
449
|
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
445
450
|
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
446
451
|
}
|
|
447
|
-
const
|
|
448
|
-
function
|
|
452
|
+
const y = 60, ue = 1;
|
|
453
|
+
function me(s) {
|
|
449
454
|
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
450
455
|
}
|
|
451
|
-
function
|
|
452
|
-
const o =
|
|
456
|
+
function ve(s, e, t, i, r, n) {
|
|
457
|
+
const o = r ? s.filter((c) => c.name === r) : s;
|
|
453
458
|
if (o.length === 0) {
|
|
454
|
-
console.warn(`No animations found for name: ${
|
|
459
|
+
console.warn(`No animations found for name: ${r}`);
|
|
455
460
|
return;
|
|
456
461
|
}
|
|
457
|
-
let
|
|
462
|
+
let a = 0;
|
|
458
463
|
const h = () => {
|
|
459
|
-
|
|
460
|
-
}, l = (c, m,
|
|
461
|
-
c.stop(), c.start(m,
|
|
464
|
+
a++, a === o.length && n && n();
|
|
465
|
+
}, l = (c, u, m, p, g) => {
|
|
466
|
+
c.stop(), c.start(u, m, p, g), n && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
|
|
462
467
|
h();
|
|
463
468
|
}) : c.onAnimationLoopObservable.addOnce(() => {
|
|
464
469
|
h();
|
|
@@ -466,70 +471,70 @@ function be(s, e, t, i, a, n) {
|
|
|
466
471
|
};
|
|
467
472
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
468
473
|
o.forEach((c) => {
|
|
469
|
-
const
|
|
470
|
-
l(c, !1,
|
|
474
|
+
const u = me(c), m = i * u;
|
|
475
|
+
l(c, !1, ue, m, m);
|
|
471
476
|
});
|
|
472
477
|
return;
|
|
473
478
|
}
|
|
474
479
|
o.forEach((c) => {
|
|
475
|
-
const
|
|
476
|
-
l(c, e,
|
|
480
|
+
const u = me(c), m = i !== void 0 ? i * u : void 0, p = t !== void 0 ? t * u : void 0;
|
|
481
|
+
l(c, e, ue, m, p);
|
|
477
482
|
});
|
|
478
483
|
}
|
|
479
|
-
function
|
|
484
|
+
function We(s, e, t) {
|
|
480
485
|
return new Promise((i) => {
|
|
481
|
-
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
482
|
-
const
|
|
483
|
-
if (t.target && Object.keys(t.target).length > 0 &&
|
|
484
|
-
|
|
486
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
|
|
487
|
+
const r = [], n = t.target, o = 0, a = n ? 1 : 0;
|
|
488
|
+
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
489
|
+
E(
|
|
485
490
|
"cameraTargetLerp",
|
|
486
491
|
"target",
|
|
487
|
-
new
|
|
488
|
-
new
|
|
492
|
+
new f().copyFrom(e.target),
|
|
493
|
+
new f(
|
|
489
494
|
t.target.x,
|
|
490
495
|
t.target.y,
|
|
491
496
|
t.target.z
|
|
492
497
|
),
|
|
493
|
-
|
|
498
|
+
w.ANIMATIONTYPE_VECTOR3,
|
|
494
499
|
o
|
|
495
500
|
)
|
|
496
|
-
),
|
|
497
|
-
|
|
501
|
+
), r.push(
|
|
502
|
+
E(
|
|
498
503
|
"cameraAlphaLerp",
|
|
499
504
|
"alpha",
|
|
500
505
|
e.alpha,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
506
|
+
ge(t.lonDeg),
|
|
507
|
+
w.ANIMATIONTYPE_FLOAT,
|
|
508
|
+
a
|
|
504
509
|
)
|
|
505
|
-
),
|
|
506
|
-
|
|
510
|
+
), r.push(
|
|
511
|
+
E(
|
|
507
512
|
"cameraBetaLerp",
|
|
508
513
|
"beta",
|
|
509
514
|
e.beta,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
515
|
+
ge(t.latDeg),
|
|
516
|
+
w.ANIMATIONTYPE_FLOAT,
|
|
517
|
+
a
|
|
513
518
|
)
|
|
514
519
|
), t.radius !== void 0) {
|
|
515
520
|
const c = Math.max(0.01, t.radius);
|
|
516
|
-
|
|
517
|
-
|
|
521
|
+
r.push(
|
|
522
|
+
E(
|
|
518
523
|
"cameraRadiusLerp",
|
|
519
524
|
"radius",
|
|
520
525
|
e.radius,
|
|
521
526
|
c,
|
|
522
|
-
|
|
523
|
-
|
|
527
|
+
w.ANIMATIONTYPE_FLOAT,
|
|
528
|
+
a
|
|
524
529
|
)
|
|
525
530
|
);
|
|
526
531
|
}
|
|
527
|
-
e.animations.push(...
|
|
532
|
+
e.animations.push(...r);
|
|
528
533
|
const l = e.useAutoRotationBehavior;
|
|
529
534
|
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
530
535
|
e,
|
|
531
536
|
0,
|
|
532
|
-
n ?
|
|
537
|
+
n ? y * 2 : y,
|
|
533
538
|
!1,
|
|
534
539
|
1,
|
|
535
540
|
() => {
|
|
@@ -538,33 +543,33 @@ function Ke(s, e, t) {
|
|
|
538
543
|
);
|
|
539
544
|
});
|
|
540
545
|
}
|
|
541
|
-
function
|
|
546
|
+
function ge(s) {
|
|
542
547
|
return s * Math.PI / 180;
|
|
543
548
|
}
|
|
544
|
-
function
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const h = new
|
|
549
|
+
function E(s, e, t, i, r, n = 0, o = w.ANIMATIONLOOPMODE_CONSTANT) {
|
|
550
|
+
const a = new ke();
|
|
551
|
+
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
552
|
+
const h = new w(
|
|
548
553
|
s,
|
|
549
554
|
e,
|
|
550
|
-
|
|
551
|
-
|
|
555
|
+
y,
|
|
556
|
+
r,
|
|
552
557
|
o
|
|
553
558
|
), l = [];
|
|
554
|
-
return n > 0 && l.push({ frame: 0, value: t }), l.push({ frame:
|
|
555
|
-
frame:
|
|
559
|
+
return n > 0 && l.push({ frame: 0, value: t }), l.push({ frame: y * n, value: t }), l.push({
|
|
560
|
+
frame: y * (n + 1),
|
|
556
561
|
value: i
|
|
557
|
-
}), h.setKeys(l), h.setEasingFunction(
|
|
562
|
+
}), h.setKeys(l), h.setEasingFunction(a), h;
|
|
558
563
|
}
|
|
559
|
-
function
|
|
564
|
+
function Ye(s, e, t) {
|
|
560
565
|
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
561
566
|
}
|
|
562
|
-
function
|
|
567
|
+
function Qe(s, e, t) {
|
|
563
568
|
s.forEach((i) => {
|
|
564
569
|
t && i.name !== t || i.goToFrame(e);
|
|
565
570
|
});
|
|
566
571
|
}
|
|
567
|
-
const
|
|
572
|
+
const Ze = {
|
|
568
573
|
albedoTexture: "albedoMap",
|
|
569
574
|
bumpTexture: "normalMap",
|
|
570
575
|
ambientTexture: "ambientMap",
|
|
@@ -585,50 +590,50 @@ function $e(s, e, t, i) {
|
|
|
585
590
|
"refractionTexture",
|
|
586
591
|
"reflectionTexture"
|
|
587
592
|
].forEach((n) => {
|
|
588
|
-
|
|
593
|
+
je(
|
|
589
594
|
n,
|
|
590
595
|
s,
|
|
591
596
|
e,
|
|
592
597
|
t,
|
|
593
598
|
i
|
|
594
599
|
);
|
|
595
|
-
}),
|
|
600
|
+
}), et(s, e);
|
|
596
601
|
}
|
|
597
|
-
function
|
|
598
|
-
const n =
|
|
602
|
+
function je(s, e, t, i, r) {
|
|
603
|
+
const n = Ze[s];
|
|
599
604
|
if (!n)
|
|
600
605
|
throw new Error("Unexpected texture name encountered.");
|
|
601
|
-
const o = e[n],
|
|
602
|
-
|
|
606
|
+
const o = e[n], a = o == null ? void 0 : o.fileLink;
|
|
607
|
+
a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
603
608
|
s,
|
|
604
|
-
|
|
609
|
+
a,
|
|
605
610
|
void 0,
|
|
606
611
|
!1,
|
|
607
612
|
void 0,
|
|
608
613
|
!0
|
|
609
|
-
) :
|
|
614
|
+
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
610
615
|
s,
|
|
611
|
-
|
|
616
|
+
a,
|
|
612
617
|
128,
|
|
613
618
|
!1,
|
|
614
619
|
!0,
|
|
615
620
|
!1
|
|
616
|
-
) : i.addTextureTask(s,
|
|
621
|
+
) : 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));
|
|
617
622
|
}
|
|
618
|
-
function
|
|
619
|
-
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
|
|
623
|
+
function Xe(s, e) {
|
|
624
|
+
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);
|
|
620
625
|
}
|
|
621
|
-
function
|
|
626
|
+
function Je(s, e, t, i) {
|
|
622
627
|
if (!e) {
|
|
623
628
|
console.error("Failed to apply texture to material: material is null.");
|
|
624
629
|
return;
|
|
625
630
|
}
|
|
626
|
-
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
|
|
631
|
+
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);
|
|
627
632
|
}
|
|
628
|
-
function
|
|
629
|
-
s.clearCoat && (s.clearCoat ===
|
|
633
|
+
function et(s, e) {
|
|
634
|
+
s.clearCoat && (s.clearCoat === B.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === B.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
630
635
|
}
|
|
631
|
-
class
|
|
636
|
+
class tt {
|
|
632
637
|
constructor(e, t, i) {
|
|
633
638
|
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;
|
|
634
639
|
}
|
|
@@ -641,41 +646,41 @@ class et {
|
|
|
641
646
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
642
647
|
* where we want to undo changes are remove effects from display.
|
|
643
648
|
*/
|
|
644
|
-
async applyMaterial(e, t, i,
|
|
649
|
+
async applyMaterial(e, t, i, r) {
|
|
645
650
|
return new Promise((n) => {
|
|
646
651
|
const o = this.materialVariantMap.get(e);
|
|
647
652
|
this.materialVariantMap.set(e, {
|
|
648
653
|
...o,
|
|
649
654
|
...t
|
|
650
655
|
});
|
|
651
|
-
const
|
|
652
|
-
(c) => c.name ===
|
|
656
|
+
const a = this.renameClonedAsset(e), h = this.scene.materials.filter(
|
|
657
|
+
(c) => c.name === a
|
|
653
658
|
);
|
|
654
659
|
if (h.length === 0) {
|
|
655
660
|
n();
|
|
656
661
|
return;
|
|
657
662
|
}
|
|
658
|
-
const l = new
|
|
663
|
+
const l = new Ne(this.scene);
|
|
659
664
|
l.useDefaultLoadingScreen = !1, h.forEach(
|
|
660
665
|
(c) => $e(
|
|
661
666
|
t,
|
|
662
667
|
c,
|
|
663
668
|
l,
|
|
664
|
-
|
|
669
|
+
r
|
|
665
670
|
)
|
|
666
|
-
), l.onProgress = (c,
|
|
667
|
-
i && i(c /
|
|
671
|
+
), l.onProgress = (c, u, m) => {
|
|
672
|
+
i && i(c / u * 100, 100, m.name);
|
|
668
673
|
}, l.onFinish = (c) => {
|
|
669
|
-
c.forEach((
|
|
670
|
-
const
|
|
671
|
-
i && i(100, 100,
|
|
672
|
-
(
|
|
673
|
-
).forEach((
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
674
|
+
c.forEach((u) => {
|
|
675
|
+
const m = u;
|
|
676
|
+
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
677
|
+
(g) => g.name === a
|
|
678
|
+
).forEach((g) => {
|
|
679
|
+
Je(
|
|
680
|
+
u.name,
|
|
681
|
+
g,
|
|
677
682
|
t,
|
|
678
|
-
|
|
683
|
+
m.texture
|
|
679
684
|
);
|
|
680
685
|
});
|
|
681
686
|
}), n();
|
|
@@ -692,37 +697,37 @@ class et {
|
|
|
692
697
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
693
698
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
694
699
|
*/
|
|
695
|
-
async applyModel(e, t, i,
|
|
696
|
-
var m;
|
|
700
|
+
async applyModel(e, t, i, r, n, o, a) {
|
|
701
|
+
var u, m, p;
|
|
697
702
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
698
|
-
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (
|
|
699
|
-
(
|
|
703
|
+
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (u = this.loadedContainerForKey.get(e)) == null || u.dispose(), this.loadedContainerForKey.delete(e), (m = this.loadedMaterialsForKey.get(e)) == null || m.forEach((g) => g.dispose()), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
704
|
+
(g) => g !== e
|
|
700
705
|
), Promise.resolve(void 0);
|
|
701
|
-
const l = (await
|
|
706
|
+
const l = (await z(i, this.scene, r)).instantiateModelsToScene(
|
|
702
707
|
this.renameClonedAsset,
|
|
703
708
|
!0
|
|
704
709
|
);
|
|
705
|
-
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), n) {
|
|
706
|
-
const
|
|
707
|
-
if (
|
|
710
|
+
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), (p = this.loadedMaterialsForKey.get(e)) == null || p.forEach((g) => g.dispose()), this.loadedMaterialsForKey.delete(e)), n) {
|
|
711
|
+
const g = o && o(), v = n.name ? this.renameClonedAsset(n.name) : void 0;
|
|
712
|
+
if (ve(
|
|
708
713
|
l.animationGroups,
|
|
709
714
|
n.loop,
|
|
710
715
|
n.to,
|
|
711
716
|
n.from,
|
|
712
|
-
|
|
713
|
-
),
|
|
714
|
-
const
|
|
715
|
-
|
|
717
|
+
v
|
|
718
|
+
), g != null) {
|
|
719
|
+
const P = a && a() || !0;
|
|
720
|
+
Qe(
|
|
716
721
|
l.animationGroups,
|
|
717
|
-
|
|
718
|
-
|
|
722
|
+
g + (P ? 2 : 0),
|
|
723
|
+
v
|
|
719
724
|
);
|
|
720
725
|
}
|
|
721
726
|
}
|
|
722
|
-
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, l), this.loadedMaterialsForKey.set(e,
|
|
727
|
+
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, l), this.loadedMaterialsForKey.set(e, we(l));
|
|
723
728
|
const c = [];
|
|
724
|
-
return this.materialVariantMap.forEach(async (
|
|
725
|
-
c.push(this.applyMaterial(
|
|
729
|
+
return this.materialVariantMap.forEach(async (g, v) => {
|
|
730
|
+
c.push(this.applyMaterial(v, g));
|
|
726
731
|
}), await Promise.all(c), l;
|
|
727
732
|
}
|
|
728
733
|
dispose() {
|
|
@@ -745,18 +750,18 @@ class et {
|
|
|
745
750
|
}), e;
|
|
746
751
|
}
|
|
747
752
|
}
|
|
748
|
-
function
|
|
753
|
+
function we(s) {
|
|
749
754
|
const e = [];
|
|
750
755
|
return s.rootNodes.forEach((t) => {
|
|
751
756
|
t.getChildMeshes().forEach((i) => {
|
|
752
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
753
|
-
const n =
|
|
757
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
758
|
+
const n = r.getMaterial(!1);
|
|
754
759
|
n && !e.includes(n) && e.push(n);
|
|
755
760
|
});
|
|
756
761
|
});
|
|
757
762
|
}), e;
|
|
758
763
|
}
|
|
759
|
-
function
|
|
764
|
+
function pe(s, e = "") {
|
|
760
765
|
return s.map((t) => ({
|
|
761
766
|
name: t.name.substring(e.length),
|
|
762
767
|
loop: t.loopAnimation,
|
|
@@ -764,36 +769,36 @@ function ge(s, e = "") {
|
|
|
764
769
|
from: t.from
|
|
765
770
|
}));
|
|
766
771
|
}
|
|
767
|
-
class
|
|
772
|
+
class it {
|
|
768
773
|
constructor(e) {
|
|
769
|
-
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new
|
|
774
|
+
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new x(), this.materialDeselectedObservable = new x(), this.materialVariantObservable = new x(), this.modelVariantObservable = new x(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__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 = [];
|
|
770
775
|
const {
|
|
771
776
|
enablePicking: t,
|
|
772
777
|
modelDetails: i,
|
|
773
|
-
previewService:
|
|
778
|
+
previewService: r,
|
|
774
779
|
progressHandler: n,
|
|
775
780
|
scene: o
|
|
776
781
|
} = e;
|
|
777
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
782
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new tt(
|
|
778
783
|
o,
|
|
779
784
|
this.renameClonedAsset.bind(this),
|
|
780
785
|
this.setBaseModelEnabled.bind(this)
|
|
781
|
-
), this.transformRoot = new
|
|
782
|
-
const
|
|
786
|
+
), this.transformRoot = new Se("root", this.scene);
|
|
787
|
+
const a = async () => {
|
|
783
788
|
if (!i.model)
|
|
784
789
|
throw new Error(
|
|
785
790
|
"Model container constructed with no URL. This is currently unsupported."
|
|
786
791
|
);
|
|
787
|
-
return this.assetContainer = await
|
|
792
|
+
return this.assetContainer = await z(
|
|
788
793
|
i.model,
|
|
789
794
|
o,
|
|
790
795
|
n
|
|
791
796
|
), await this.instantiate(), this;
|
|
792
797
|
};
|
|
793
|
-
this.importPromise =
|
|
798
|
+
this.importPromise = a();
|
|
794
799
|
}
|
|
795
800
|
//#region Interface implementation
|
|
796
|
-
async applyMaterialVariant(e, t, i,
|
|
801
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
797
802
|
if (!this.initialized) {
|
|
798
803
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
799
804
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -804,7 +809,7 @@ class tt {
|
|
|
804
809
|
e,
|
|
805
810
|
t,
|
|
806
811
|
i,
|
|
807
|
-
|
|
812
|
+
r
|
|
808
813
|
)
|
|
809
814
|
);
|
|
810
815
|
} else {
|
|
@@ -820,7 +825,7 @@ class tt {
|
|
|
820
825
|
e,
|
|
821
826
|
t,
|
|
822
827
|
i,
|
|
823
|
-
|
|
828
|
+
r
|
|
824
829
|
)
|
|
825
830
|
);
|
|
826
831
|
}
|
|
@@ -830,14 +835,14 @@ class tt {
|
|
|
830
835
|
await this.variantManager.applyMaterial(
|
|
831
836
|
e,
|
|
832
837
|
i,
|
|
833
|
-
(o,
|
|
838
|
+
(o, a, h) => {
|
|
834
839
|
this.materialVariantObservable.notifyObservers({
|
|
835
840
|
remainingCount: o,
|
|
836
|
-
totalCount:
|
|
841
|
+
totalCount: a,
|
|
837
842
|
taskName: h
|
|
838
843
|
});
|
|
839
844
|
},
|
|
840
|
-
|
|
845
|
+
r
|
|
841
846
|
);
|
|
842
847
|
};
|
|
843
848
|
if (this.materialChangesInProgress.includes(e)) {
|
|
@@ -858,8 +863,8 @@ class tt {
|
|
|
858
863
|
const o = this.queuedMaterialChanges.get(e);
|
|
859
864
|
if (!o)
|
|
860
865
|
throw new Error("Target material is undefined");
|
|
861
|
-
o.forEach(async (
|
|
862
|
-
await
|
|
866
|
+
o.forEach(async (a) => {
|
|
867
|
+
await a();
|
|
863
868
|
}), this.queuedMaterialChanges.delete(e);
|
|
864
869
|
}
|
|
865
870
|
this.materialChangesInProgress.splice(
|
|
@@ -880,13 +885,13 @@ class tt {
|
|
|
880
885
|
);
|
|
881
886
|
return;
|
|
882
887
|
}
|
|
883
|
-
const
|
|
888
|
+
const r = () => this.variantManager.applyModel(
|
|
884
889
|
e,
|
|
885
890
|
i,
|
|
886
891
|
t == null ? void 0 : t.model,
|
|
887
|
-
(
|
|
892
|
+
(a) => {
|
|
888
893
|
this.modelVariantObservable.notifyObservers({
|
|
889
|
-
...
|
|
894
|
+
...a,
|
|
890
895
|
key: e
|
|
891
896
|
});
|
|
892
897
|
},
|
|
@@ -895,22 +900,22 @@ class tt {
|
|
|
895
900
|
this.getAnimationIsPlaying.bind(this)
|
|
896
901
|
);
|
|
897
902
|
if (this.modelChangesInProgress.includes(e)) {
|
|
898
|
-
this.queuedModelChanges.set(e,
|
|
903
|
+
this.queuedModelChanges.set(e, r);
|
|
899
904
|
return;
|
|
900
905
|
}
|
|
901
906
|
const o = await (async () => {
|
|
902
907
|
this.modelChangesInProgress.push(e);
|
|
903
|
-
let
|
|
908
|
+
let a = await r();
|
|
904
909
|
if (this.queuedModelChanges.has(e)) {
|
|
905
910
|
const h = this.queuedModelChanges.get(e);
|
|
906
911
|
if (!h)
|
|
907
912
|
throw new Error("Queued change resolved undefined");
|
|
908
|
-
|
|
913
|
+
a = await h(), this.queuedModelChanges.delete(e);
|
|
909
914
|
}
|
|
910
915
|
return this.modelChangesInProgress.splice(
|
|
911
916
|
this.modelChangesInProgress.indexOf(e),
|
|
912
917
|
1
|
|
913
|
-
),
|
|
918
|
+
), a;
|
|
914
919
|
})();
|
|
915
920
|
this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
916
921
|
}
|
|
@@ -924,34 +929,34 @@ class tt {
|
|
|
924
929
|
let t = () => {
|
|
925
930
|
};
|
|
926
931
|
const i = async () => {
|
|
927
|
-
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((
|
|
932
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
928
933
|
var o;
|
|
929
934
|
const n = [
|
|
930
935
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
931
936
|
...this.variantManager.getAnimationGroups()
|
|
932
937
|
];
|
|
933
|
-
|
|
938
|
+
ve(
|
|
934
939
|
n,
|
|
935
940
|
e.loop,
|
|
936
941
|
e.to,
|
|
937
942
|
e.from,
|
|
938
943
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
939
|
-
|
|
944
|
+
r
|
|
940
945
|
);
|
|
941
946
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
942
947
|
};
|
|
943
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
944
|
-
t =
|
|
948
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
949
|
+
t = r;
|
|
945
950
|
})) : i();
|
|
946
951
|
}
|
|
947
952
|
getAnimations(e) {
|
|
948
953
|
return [
|
|
949
954
|
...this.animations,
|
|
950
|
-
...e ?
|
|
955
|
+
...e ? pe(
|
|
951
956
|
this.variantManager.getAnimationGroups(),
|
|
952
957
|
this.renameClonedAsset("")
|
|
953
958
|
) : []
|
|
954
|
-
].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);
|
|
955
960
|
}
|
|
956
961
|
getId() {
|
|
957
962
|
return this.id;
|
|
@@ -986,7 +991,7 @@ class tt {
|
|
|
986
991
|
set position(e) {
|
|
987
992
|
if (!this.transformRoot)
|
|
988
993
|
throw new Error("ModelContainer disposed prior to setting position!");
|
|
989
|
-
this.transformRoot.position = new
|
|
994
|
+
this.transformRoot.position = new f(e.x, e.y, e.z);
|
|
990
995
|
}
|
|
991
996
|
get rotation() {
|
|
992
997
|
var e;
|
|
@@ -1011,22 +1016,22 @@ class tt {
|
|
|
1011
1016
|
set scale(e) {
|
|
1012
1017
|
if (!this.transformRoot)
|
|
1013
1018
|
throw new Error("ModelContainer disposed prior to setting scale!");
|
|
1014
|
-
this.transformRoot.scaling = new
|
|
1019
|
+
this.transformRoot.scaling = new f(e.x, e.y, e.z);
|
|
1015
1020
|
}
|
|
1016
1021
|
//#endregion
|
|
1017
1022
|
//#region Custom implementation functions
|
|
1018
1023
|
attachPickingHandler(e) {
|
|
1019
1024
|
e.rootNodes.forEach((t) => {
|
|
1020
1025
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1021
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
1022
|
-
new oe(
|
|
1023
|
-
|
|
1026
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new T(this.scene)), i.actionManager.registerAction(
|
|
1027
|
+
new oe(T.OnPointerOverTrigger, (r) => {
|
|
1028
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1024
1029
|
id: i.material.id,
|
|
1025
1030
|
name: this.stripIdFromName(i.material.name)
|
|
1026
1031
|
});
|
|
1027
1032
|
})
|
|
1028
1033
|
), i.actionManager.registerAction(
|
|
1029
|
-
new oe(
|
|
1034
|
+
new oe(T.OnPointerOutTrigger, () => {
|
|
1030
1035
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
1031
1036
|
id: i.material.id,
|
|
1032
1037
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1055,7 +1060,7 @@ class tt {
|
|
|
1055
1060
|
return this.modelReadyToLoadCallbacks.size;
|
|
1056
1061
|
}
|
|
1057
1062
|
configureGlowLayer() {
|
|
1058
|
-
const e = (i) => i instanceof
|
|
1063
|
+
const e = (i) => i instanceof k && i.emissiveTexture !== null;
|
|
1059
1064
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1060
1065
|
}
|
|
1061
1066
|
configureModelInstance(e) {
|
|
@@ -1064,14 +1069,14 @@ class tt {
|
|
|
1064
1069
|
throw new Error(
|
|
1065
1070
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1066
1071
|
);
|
|
1067
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1068
|
-
this.transformRoot.position =
|
|
1072
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1073
|
+
this.transformRoot.position = f.Zero(), this.transformRoot.rotationQuaternion = A.Identity(), this.transformRoot.scaling = f.One();
|
|
1069
1074
|
for (const o of e.rootNodes) {
|
|
1070
1075
|
o.parent = this.transformRoot;
|
|
1071
|
-
for (const
|
|
1072
|
-
|
|
1076
|
+
for (const a of o.getChildMeshes(!1))
|
|
1077
|
+
a.alwaysSelectAsActiveMesh = !0;
|
|
1073
1078
|
}
|
|
1074
|
-
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(
|
|
1075
1080
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1076
1081
|
this.scene,
|
|
1077
1082
|
this.canvasPanels,
|
|
@@ -1089,7 +1094,7 @@ class tt {
|
|
|
1089
1094
|
getAllMeshes() {
|
|
1090
1095
|
var e;
|
|
1091
1096
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1092
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1097
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Fe)
|
|
1093
1098
|
).flat();
|
|
1094
1099
|
}
|
|
1095
1100
|
async instantiate() {
|
|
@@ -1100,7 +1105,7 @@ class tt {
|
|
|
1100
1105
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
1101
1106
|
this.renameClonedAsset.bind(this),
|
|
1102
1107
|
!0
|
|
1103
|
-
), this.materials =
|
|
1108
|
+
), this.materials = we(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = pe(
|
|
1104
1109
|
this.modelInstance.animationGroups,
|
|
1105
1110
|
this.renameClonedAsset("")
|
|
1106
1111
|
), this.initialized = !0, await this.processQueuedEvents();
|
|
@@ -1115,8 +1120,8 @@ class tt {
|
|
|
1115
1120
|
var e;
|
|
1116
1121
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1117
1122
|
(t, i) => {
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1123
|
+
const r = this.dynamicTextures.get(i);
|
|
1124
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1120
1125
|
}
|
|
1121
1126
|
);
|
|
1122
1127
|
}
|
|
@@ -1174,18 +1179,18 @@ class tt {
|
|
|
1174
1179
|
}
|
|
1175
1180
|
//#endregion
|
|
1176
1181
|
}
|
|
1177
|
-
class
|
|
1178
|
-
constructor(e, t, i,
|
|
1182
|
+
class N extends fe {
|
|
1183
|
+
constructor(e, t, i, r, n, o, a, h) {
|
|
1179
1184
|
super(
|
|
1180
1185
|
e,
|
|
1181
1186
|
t,
|
|
1182
1187
|
i,
|
|
1183
|
-
|
|
1188
|
+
r,
|
|
1184
1189
|
n,
|
|
1185
1190
|
o,
|
|
1186
1191
|
h
|
|
1187
|
-
), this.lastFocus = new
|
|
1188
|
-
|
|
1192
|
+
), this.lastFocus = new f(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(
|
|
1193
|
+
a.camera.autoRotation.idleTimeMs
|
|
1189
1194
|
));
|
|
1190
1195
|
}
|
|
1191
1196
|
updateConfiguration(e) {
|
|
@@ -1200,7 +1205,7 @@ class k extends pe {
|
|
|
1200
1205
|
this._isRunningFramingBehavior = e, !e && this.framingBehaviourCallback && (this.framingBehaviourCallback(), this.framingBehaviourCallback = void 0);
|
|
1201
1206
|
}
|
|
1202
1207
|
setPanEnabled(e) {
|
|
1203
|
-
this.panEnabled = e, this.panningSensibility = 1e3 / this.panDenominator, this.panningAxis = e ? new
|
|
1208
|
+
this.panEnabled = e, this.panningSensibility = 1e3 / this.panDenominator, this.panningAxis = e ? new f(1, 1, 0) : new f(0, 0, 0);
|
|
1204
1209
|
}
|
|
1205
1210
|
/**
|
|
1206
1211
|
* Returns the framing behavior of this camera.
|
|
@@ -1225,7 +1230,7 @@ class k extends pe {
|
|
|
1225
1230
|
this.useFramingBehavior = !0;
|
|
1226
1231
|
const e = this.getFramingBehavior();
|
|
1227
1232
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1228
|
-
const t =
|
|
1233
|
+
const t = L(this._scene);
|
|
1229
1234
|
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;
|
|
1230
1235
|
}
|
|
1231
1236
|
/**
|
|
@@ -1237,14 +1242,14 @@ class k extends pe {
|
|
|
1237
1242
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1238
1243
|
const i = this.getFramingBehavior();
|
|
1239
1244
|
i.framingTime = t || 800;
|
|
1240
|
-
const
|
|
1245
|
+
const r = () => {
|
|
1241
1246
|
this.isRunningFramingBehavior = !1;
|
|
1242
|
-
}, n =
|
|
1243
|
-
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(
|
|
1247
|
+
}, n = L(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
|
|
1248
|
+
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(
|
|
1244
1249
|
n.min,
|
|
1245
1250
|
n.max,
|
|
1246
1251
|
void 0,
|
|
1247
|
-
|
|
1252
|
+
r
|
|
1248
1253
|
), i.framingTime = 0;
|
|
1249
1254
|
}
|
|
1250
1255
|
/**
|
|
@@ -1276,7 +1281,7 @@ class k extends pe {
|
|
|
1276
1281
|
*/
|
|
1277
1282
|
static create(e, t, i) {
|
|
1278
1283
|
var h;
|
|
1279
|
-
const
|
|
1284
|
+
const r = L(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new N(
|
|
1280
1285
|
"ProductCamera",
|
|
1281
1286
|
-(Math.PI / 2),
|
|
1282
1287
|
Math.PI / 2,
|
|
@@ -1285,25 +1290,25 @@ class k extends pe {
|
|
|
1285
1290
|
e,
|
|
1286
1291
|
t
|
|
1287
1292
|
);
|
|
1288
|
-
return
|
|
1293
|
+
return a.setPanEnabled(
|
|
1289
1294
|
((h = t.options) == null ? void 0 : h.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1290
|
-
),
|
|
1291
|
-
|
|
1292
|
-
}), i && (e.activeCamera =
|
|
1295
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1296
|
+
a.setPanEnabled(a.panEnabled);
|
|
1297
|
+
}), i && (e.activeCamera = a), a;
|
|
1293
1298
|
}
|
|
1294
1299
|
}
|
|
1295
|
-
function
|
|
1300
|
+
function L(s) {
|
|
1296
1301
|
if (s.meshes.length === 0)
|
|
1297
1302
|
return {
|
|
1298
|
-
min: new
|
|
1299
|
-
max: new
|
|
1303
|
+
min: new f(-1, -1, -1),
|
|
1304
|
+
max: new f(1, 1, 1)
|
|
1300
1305
|
};
|
|
1301
1306
|
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1302
1307
|
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1303
1308
|
}
|
|
1304
|
-
class
|
|
1309
|
+
class nt {
|
|
1305
1310
|
constructor(e, t = !1, i = void 0) {
|
|
1306
|
-
this.renderingPipeline = new
|
|
1311
|
+
this.renderingPipeline = new qe(
|
|
1307
1312
|
"default",
|
|
1308
1313
|
t,
|
|
1309
1314
|
e,
|
|
@@ -1319,42 +1324,42 @@ class it {
|
|
|
1319
1324
|
return this.currentConfiguration;
|
|
1320
1325
|
}
|
|
1321
1326
|
setConfiguration(e) {
|
|
1322
|
-
var t, i,
|
|
1327
|
+
var t, i, r, n, o, a, h, l, c, u, m, p, g, v, P, q, V, _, G, H, U, K, W, Y, Q, Z, $, j, X, J, ee, te, ie;
|
|
1323
1328
|
if (this.renderingPipeline.isSupported) {
|
|
1324
|
-
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 = ((
|
|
1329
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((n = e.bloom) == null ? void 0 : n.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((h = e.bloom) == null ? void 0 : h.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((l = e.chromaticAberration) == null ? void 0 : l.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new se(
|
|
1325
1330
|
e.chromaticAberration.direction.x,
|
|
1326
1331
|
e.chromaticAberration.direction.y
|
|
1327
1332
|
) : new se(
|
|
1328
1333
|
d.chromaticAberration.direction.x,
|
|
1329
1334
|
d.chromaticAberration.direction.y
|
|
1330
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((
|
|
1335
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new le(), this.renderingPipeline.depthOfFieldEnabled = ((g = e.depthOfField) == null ? void 0 : g.enabled) ?? d.depthOfField.enabled, e.depthOfField)
|
|
1331
1336
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1332
1337
|
case "Low":
|
|
1333
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1338
|
+
this.renderingPipeline.depthOfFieldBlurLevel = O.Low;
|
|
1334
1339
|
break;
|
|
1335
1340
|
case "Medium":
|
|
1336
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1341
|
+
this.renderingPipeline.depthOfFieldBlurLevel = O.Medium;
|
|
1337
1342
|
break;
|
|
1338
1343
|
case "High":
|
|
1339
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1344
|
+
this.renderingPipeline.depthOfFieldBlurLevel = O.High;
|
|
1340
1345
|
break;
|
|
1341
1346
|
}
|
|
1342
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1347
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((v = e.depthOfField) == null ? void 0 : v.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((P = e.depthOfField) == null ? void 0 : P.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((q = e.depthOfField) == null ? void 0 : q.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)
|
|
1343
1348
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1344
1349
|
case "Standard":
|
|
1345
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1350
|
+
this.renderingPipeline.imageProcessing.toneMappingType = R.TONEMAPPING_STANDARD;
|
|
1346
1351
|
break;
|
|
1347
1352
|
case "ACES":
|
|
1348
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1353
|
+
this.renderingPipeline.imageProcessing.toneMappingType = R.TONEMAPPING_ACES;
|
|
1349
1354
|
break;
|
|
1350
1355
|
}
|
|
1351
|
-
if (this.renderingPipeline.sharpenEnabled = ((Y = e.sharpen) == null ? void 0 : Y.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((
|
|
1356
|
+
if (this.renderingPipeline.sharpenEnabled = ((Y = e.sharpen) == null ? void 0 : Y.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = (($ = e.vignette) == null ? void 0 : $.enabled) ?? d.vignette.enabled, (j = e.vignette) != null && j.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
|
|
1352
1357
|
switch (((X = e.vignette) == null ? void 0 : X.blendMode) ?? d.vignette.blendMode) {
|
|
1353
1358
|
case "Multiply":
|
|
1354
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1359
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = R.VIGNETTEMODE_MULTIPLY;
|
|
1355
1360
|
break;
|
|
1356
1361
|
case "Opaque":
|
|
1357
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1362
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = R.VIGNETTEMODE_OPAQUE;
|
|
1358
1363
|
break;
|
|
1359
1364
|
}
|
|
1360
1365
|
(J = e.vignette) != null && J.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
@@ -1375,36 +1380,36 @@ class it {
|
|
|
1375
1380
|
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;
|
|
1376
1381
|
}
|
|
1377
1382
|
}
|
|
1378
|
-
|
|
1379
|
-
return new
|
|
1383
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1384
|
+
return new _e(s);
|
|
1380
1385
|
});
|
|
1381
|
-
|
|
1386
|
+
D.OnPluginActivatedObservable.add((s) => {
|
|
1382
1387
|
if (s.name === "gltf") {
|
|
1383
1388
|
const e = s;
|
|
1384
1389
|
e.transparencyAsCoverage = !0;
|
|
1385
1390
|
}
|
|
1386
1391
|
});
|
|
1387
|
-
function
|
|
1388
|
-
return new
|
|
1392
|
+
function I(s) {
|
|
1393
|
+
return new f(s.x, s.y, s.z);
|
|
1389
1394
|
}
|
|
1390
|
-
function
|
|
1395
|
+
function F(s) {
|
|
1391
1396
|
return { x: s.x, y: s.y, z: s.z };
|
|
1392
1397
|
}
|
|
1393
|
-
class
|
|
1398
|
+
class Wt {
|
|
1394
1399
|
constructor(e) {
|
|
1395
1400
|
var h;
|
|
1396
|
-
this.focusLostNotified = !1, this.focusLostObservable = new
|
|
1401
|
+
this.focusLostNotified = !1, this.focusLostObservable = new x(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1397
1402
|
if (!this.engine.views)
|
|
1398
1403
|
return;
|
|
1399
|
-
this.modelContainers.forEach((
|
|
1400
|
-
|
|
1404
|
+
this.modelContainers.forEach((u) => {
|
|
1405
|
+
u.updateDynamicTextures();
|
|
1401
1406
|
}), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0;
|
|
1402
1407
|
const l = this.engine.getRenderingCanvas();
|
|
1403
1408
|
if (l)
|
|
1404
1409
|
if (l.getContext("webgl2") ?? l.getContext("webgl")) {
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
|
|
1410
|
+
const u = this.configuration.scene.clearColor, m = l.getContext("webgl2") ?? l.getContext("webgl");
|
|
1411
|
+
m.clearDepth(1), m.depthFunc(m.LEQUAL), m.clearStencil(0), m.clearColor(u.r, u.g, u.b, u.a), m.clear(
|
|
1412
|
+
m.COLOR_BUFFER_BIT | m.DEPTH_BUFFER_BIT | m.STENCIL_BUFFER_BIT
|
|
1408
1413
|
);
|
|
1409
1414
|
} else
|
|
1410
1415
|
l.getContext("2d") ? l.getContext("2d").clearRect(0, 0, l.width, l.height) : console.error(
|
|
@@ -1413,22 +1418,22 @@ class Kt {
|
|
|
1413
1418
|
this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1414
1419
|
const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
|
|
1415
1420
|
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
|
|
1416
|
-
}, this.configuration = new
|
|
1421
|
+
}, this.configuration = new ce(e);
|
|
1417
1422
|
const i = (() => {
|
|
1418
1423
|
if (!(e != null && e.noRender))
|
|
1419
1424
|
return this.configuration.createCanvas();
|
|
1420
|
-
})(),
|
|
1425
|
+
})(), r = "1.5.6";
|
|
1421
1426
|
Ae.Configuration = {
|
|
1422
1427
|
decoder: {
|
|
1423
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1424
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1425
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1428
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1429
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1430
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1426
1431
|
}
|
|
1427
1432
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1428
1433
|
const n = console.log;
|
|
1429
1434
|
console.log = () => {
|
|
1430
1435
|
};
|
|
1431
|
-
const o = i ? new
|
|
1436
|
+
const o = i ? new be(i, !0, {
|
|
1432
1437
|
adaptToDeviceRatio: !0,
|
|
1433
1438
|
limitDeviceRatio: 2,
|
|
1434
1439
|
premultipliedAlpha: !1,
|
|
@@ -1436,19 +1441,19 @@ class Kt {
|
|
|
1436
1441
|
audioEngine: !1,
|
|
1437
1442
|
stencil: this.configuration.highlights.enabled,
|
|
1438
1443
|
forceSRGBBufferSupportState: !0
|
|
1439
|
-
}) : new
|
|
1440
|
-
console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new
|
|
1444
|
+
}) : new Ce();
|
|
1445
|
+
console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Me(o), this.camera = N.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1441
1446
|
this.scene,
|
|
1442
1447
|
!1,
|
|
1443
1448
|
this.camera
|
|
1444
1449
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1445
|
-
const
|
|
1450
|
+
const a = ne.CreateFromPrefilteredData(
|
|
1446
1451
|
this.configuration.scene.environment.file,
|
|
1447
1452
|
this.scene
|
|
1448
1453
|
);
|
|
1449
|
-
|
|
1454
|
+
a.name = "initial-environment-cube", a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (h = this.configuration.options) != null && h.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1450
1455
|
this.configuration.options.renderingPipelineConfiguration
|
|
1451
|
-
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new
|
|
1456
|
+
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
|
|
1452
1457
|
this.scene,
|
|
1453
1458
|
this.configuration.emissiveGlowIntensity
|
|
1454
1459
|
), this.initPromise = new Promise((l) => {
|
|
@@ -1485,7 +1490,7 @@ class Kt {
|
|
|
1485
1490
|
}
|
|
1486
1491
|
registerView(e) {
|
|
1487
1492
|
const t = e.height, i = e.width;
|
|
1488
|
-
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1493
|
+
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(S.Pan), this.reattachControls(e);
|
|
1489
1494
|
}
|
|
1490
1495
|
getNumViewports() {
|
|
1491
1496
|
var e;
|
|
@@ -1498,19 +1503,19 @@ class Kt {
|
|
|
1498
1503
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1499
1504
|
}
|
|
1500
1505
|
executeCameraAnimation(e) {
|
|
1501
|
-
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((
|
|
1506
|
+
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((r) => r.getIsInitialized()))
|
|
1502
1507
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1503
1508
|
let t = () => {
|
|
1504
1509
|
};
|
|
1505
1510
|
const i = async () => {
|
|
1506
|
-
this.isAnimatingCamera = !0, await
|
|
1511
|
+
this.isAnimatingCamera = !0, await We(
|
|
1507
1512
|
this.scene,
|
|
1508
1513
|
this.scene.activeCamera,
|
|
1509
1514
|
e
|
|
1510
1515
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1511
1516
|
};
|
|
1512
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1513
|
-
t =
|
|
1517
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1518
|
+
t = r;
|
|
1514
1519
|
})) : i();
|
|
1515
1520
|
}
|
|
1516
1521
|
getCameraPose() {
|
|
@@ -1527,7 +1532,7 @@ class Kt {
|
|
|
1527
1532
|
};
|
|
1528
1533
|
}
|
|
1529
1534
|
setCameraPose(e) {
|
|
1530
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1535
|
+
this.scene && this.camera && (this.camera.target = new f(
|
|
1531
1536
|
e.target.x,
|
|
1532
1537
|
e.target.y,
|
|
1533
1538
|
e.target.z
|
|
@@ -1539,7 +1544,7 @@ class Kt {
|
|
|
1539
1544
|
throw new Error(
|
|
1540
1545
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1541
1546
|
);
|
|
1542
|
-
e ===
|
|
1547
|
+
e === S.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1543
1548
|
}
|
|
1544
1549
|
animateToLastCameraFocus() {
|
|
1545
1550
|
let e = () => {
|
|
@@ -1547,13 +1552,13 @@ class Kt {
|
|
|
1547
1552
|
const t = async () => {
|
|
1548
1553
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1549
1554
|
this.focusLostNotified = !1;
|
|
1550
|
-
const
|
|
1555
|
+
const r = () => {
|
|
1551
1556
|
const n = this.configuration;
|
|
1552
1557
|
this.camera.rerunFramingBehavior(() => {
|
|
1553
1558
|
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();
|
|
1554
1559
|
});
|
|
1555
1560
|
};
|
|
1556
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1561
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1557
1562
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1558
1563
|
};
|
|
1559
1564
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1575,18 +1580,18 @@ class Kt {
|
|
|
1575
1580
|
async renderSceneScreenshot(e, t) {
|
|
1576
1581
|
if (!this.camera)
|
|
1577
1582
|
throw new Error("Missing product camera, cannot render screenshot!");
|
|
1578
|
-
const i = new
|
|
1583
|
+
const i = new fe(
|
|
1579
1584
|
"screenshotCamera",
|
|
1580
1585
|
0,
|
|
1581
1586
|
0,
|
|
1582
1587
|
0,
|
|
1583
|
-
|
|
1588
|
+
f.Zero(),
|
|
1584
1589
|
this.scene
|
|
1585
1590
|
);
|
|
1586
1591
|
try {
|
|
1587
|
-
const
|
|
1588
|
-
i.target = t.target ? new
|
|
1589
|
-
const o = await
|
|
1592
|
+
const r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
|
|
1593
|
+
i.target = t.target ? new f(t.target.x, t.target.y, t.target.z) : f.Zero(), i.alpha = n, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1594
|
+
const o = await ye.CreateScreenshotUsingRenderTargetAsync(
|
|
1590
1595
|
this.engine,
|
|
1591
1596
|
i,
|
|
1592
1597
|
e,
|
|
@@ -1603,33 +1608,33 @@ class Kt {
|
|
|
1603
1608
|
const e = this.configuration;
|
|
1604
1609
|
if (!e)
|
|
1605
1610
|
return !0;
|
|
1606
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1607
|
-
if (t === void 0 || i === void 0 ||
|
|
1611
|
+
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;
|
|
1612
|
+
if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
|
|
1608
1613
|
return !0;
|
|
1609
|
-
const o = [t, i],
|
|
1614
|
+
const o = [t, i], a = [r, n], h = o.every((c) => c === t), l = a.every((c) => c === r);
|
|
1610
1615
|
return !h && !l;
|
|
1611
1616
|
}
|
|
1612
1617
|
fireResizeEvent() {
|
|
1613
1618
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1614
1619
|
}
|
|
1615
1620
|
setHighlights(e, t) {
|
|
1616
|
-
var
|
|
1617
|
-
e.length === 0 && ((
|
|
1621
|
+
var r;
|
|
1622
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new xe("highlights", this.scene, {
|
|
1618
1623
|
isStroke: !0,
|
|
1619
1624
|
blurVerticalSize: 0.85,
|
|
1620
1625
|
blurHorizontalSize: 0.85
|
|
1621
1626
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1622
|
-
const i = t ? new
|
|
1627
|
+
const i = t ? new C(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1623
1628
|
e.forEach((n) => {
|
|
1624
1629
|
const o = this.scene.materials.find(
|
|
1625
|
-
(
|
|
1630
|
+
(a) => a.name === n.name && a.id === n.id
|
|
1626
1631
|
);
|
|
1627
1632
|
o && o.getBindedMeshes().forEach(
|
|
1628
|
-
(
|
|
1633
|
+
(a) => {
|
|
1629
1634
|
var h;
|
|
1630
1635
|
return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
|
|
1631
|
-
|
|
1632
|
-
i ||
|
|
1636
|
+
a,
|
|
1637
|
+
i || C.FromHexString("#fcba03")
|
|
1633
1638
|
);
|
|
1634
1639
|
}
|
|
1635
1640
|
);
|
|
@@ -1639,12 +1644,12 @@ class Kt {
|
|
|
1639
1644
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1640
1645
|
}
|
|
1641
1646
|
loadModel(e, t) {
|
|
1642
|
-
const { refocusCamera: i = !0, progressHandler:
|
|
1647
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new it({
|
|
1643
1648
|
enablePicking: this.configuration.highlights.enabled,
|
|
1644
1649
|
modelDetails: e,
|
|
1645
1650
|
scene: this.scene,
|
|
1646
1651
|
previewService: this,
|
|
1647
|
-
progressHandler:
|
|
1652
|
+
progressHandler: r
|
|
1648
1653
|
});
|
|
1649
1654
|
return n.getInitializationPromise().then(() => {
|
|
1650
1655
|
if (this.modelContainers.size <= 1 && i) {
|
|
@@ -1659,13 +1664,13 @@ class Kt {
|
|
|
1659
1664
|
this.setHighlights([o]);
|
|
1660
1665
|
}), n.registerMaterialDeselectedCallback(() => {
|
|
1661
1666
|
this.setHighlights([]);
|
|
1662
|
-
})),
|
|
1667
|
+
})), this.modelContainers.set(n.getId(), n), this.triggerModelLoadEvent({
|
|
1663
1668
|
eventType: "load",
|
|
1664
1669
|
modelContainer: n
|
|
1665
1670
|
}), n;
|
|
1666
1671
|
}
|
|
1667
1672
|
async preloadModel(e) {
|
|
1668
|
-
await
|
|
1673
|
+
await z(e, this.scene);
|
|
1669
1674
|
}
|
|
1670
1675
|
getAllModels() {
|
|
1671
1676
|
return Array.from(this.modelContainers.values());
|
|
@@ -1682,13 +1687,13 @@ class Kt {
|
|
|
1682
1687
|
}
|
|
1683
1688
|
unregisterPlugin(e) {
|
|
1684
1689
|
const t = this.plugins.indexOf(e);
|
|
1685
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1690
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1686
1691
|
}
|
|
1687
1692
|
getGlowLayerManager() {
|
|
1688
1693
|
return this.glowLayerManager;
|
|
1689
1694
|
}
|
|
1690
1695
|
modelUnloaded(e) {
|
|
1691
|
-
|
|
1696
|
+
this.modelContainers.delete(e.getId()), this.triggerModelLoadEvent({
|
|
1692
1697
|
eventType: "unload",
|
|
1693
1698
|
modelContainer: e
|
|
1694
1699
|
});
|
|
@@ -1700,28 +1705,28 @@ class Kt {
|
|
|
1700
1705
|
* Flips a transform around the origin.
|
|
1701
1706
|
*/
|
|
1702
1707
|
flipTransform(e, t, i) {
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1708
|
+
const r = re.Compose(
|
|
1709
|
+
I(i || { x: 1, y: 1, z: 1 }),
|
|
1705
1710
|
A.FromEulerVector(
|
|
1706
|
-
|
|
1711
|
+
I(t || { x: 0, y: 0, z: 0 })
|
|
1707
1712
|
),
|
|
1708
|
-
|
|
1709
|
-
), n = re.RotationAxis(
|
|
1710
|
-
return o.decompose(l, h,
|
|
1711
|
-
position:
|
|
1712
|
-
rotation:
|
|
1713
|
-
scale:
|
|
1713
|
+
I(e || { x: 0, y: 0, z: 0 })
|
|
1714
|
+
), n = re.RotationAxis(f.Up(), Math.PI), o = r.multiply(n), a = f.Zero(), h = A.Identity(), l = f.Zero();
|
|
1715
|
+
return o.decompose(l, h, a), h.multiplyInPlace(A.FromEulerAngles(0, Math.PI, 0)), {
|
|
1716
|
+
position: F(a),
|
|
1717
|
+
rotation: F(h.toEulerAngles()),
|
|
1718
|
+
scale: F(l)
|
|
1714
1719
|
};
|
|
1715
1720
|
}
|
|
1716
1721
|
updatePreviewOptions(e) {
|
|
1717
|
-
var
|
|
1718
|
-
const t = new
|
|
1722
|
+
var r, n;
|
|
1723
|
+
const t = new ce(e);
|
|
1719
1724
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1720
1725
|
let i = this.scene.environmentTexture;
|
|
1721
1726
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = ne.CreateFromPrefilteredData(
|
|
1722
1727
|
t.scene.environment.file,
|
|
1723
1728
|
this.scene
|
|
1724
|
-
), 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, (
|
|
1729
|
+
), 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(
|
|
1725
1730
|
t.options.renderingPipelineConfiguration
|
|
1726
1731
|
) : (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(
|
|
1727
1732
|
((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
|
|
@@ -1742,10 +1747,10 @@ class Kt {
|
|
|
1742
1747
|
}
|
|
1743
1748
|
}
|
|
1744
1749
|
export {
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
+
B as MaterialEffectMode,
|
|
1751
|
+
S as ProductCameraRig,
|
|
1752
|
+
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1753
|
+
M as RenderingConfiguration,
|
|
1754
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1750
1755
|
d as renderingPipelineDefaults
|
|
1751
1756
|
};
|