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