@spiffcommerce/preview 5.7.9-1 → 5.7.9-10
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 +295 -309
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,23 +2,23 @@ import { ArcRotateCamera as fe } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
|
2
2
|
import { Engine as be } from "@babylonjs/core/Engines/engine";
|
|
3
3
|
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
4
|
import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
-
import { SceneLoader as
|
|
6
|
-
import { CubeTexture as
|
|
5
|
+
import { SceneLoader as B } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as se } 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 y, Vector2 as
|
|
8
|
+
import { Vector3 as p, Quaternion as y, Vector2 as re, Matrix as ae } 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
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
11
|
+
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as Me } from "@babylonjs/core/scene";
|
|
13
13
|
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { GLTFLoaderAnimationStartMode as Re } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
|
-
import { PBRMaterial as
|
|
15
|
+
import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
16
16
|
import { MirrorTexture as Ee } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
17
|
-
import { Color3 as Te, Vector3 as
|
|
17
|
+
import { Color3 as Te, Vector3 as oe, Plane as Oe } from "@babylonjs/core/Maths/math";
|
|
18
18
|
import { ReflectionProbe as Le } from "@babylonjs/core/Probes/reflectionProbe";
|
|
19
19
|
import { GlowLayer as Ie } from "@babylonjs/core/Layers/glowLayer";
|
|
20
20
|
import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
|
|
21
|
-
import { ExecuteCodeAction as
|
|
21
|
+
import { ExecuteCodeAction as le } from "@babylonjs/core/Actions/directActions";
|
|
22
22
|
import { Mesh as Fe } from "@babylonjs/core/Meshes/mesh";
|
|
23
23
|
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
24
24
|
import { DynamicTexture as Be } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
@@ -26,8 +26,8 @@ import { Texture as De } from "@babylonjs/core/Materials/Textures/texture";
|
|
|
26
26
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
27
27
|
import { QuadraticEase as ke, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
28
28
|
import { AssetsManager as Ne } from "@babylonjs/core/Misc/assetsManager";
|
|
29
|
-
import { ColorCurves as
|
|
30
|
-
import { ImageProcessingConfiguration as
|
|
29
|
+
import { ColorCurves as he } from "@babylonjs/core/Materials/colorCurves";
|
|
30
|
+
import { ImageProcessingConfiguration as M } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
31
|
import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
32
32
|
import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
33
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
@@ -40,29 +40,35 @@ 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
|
-
const
|
|
45
|
-
async function
|
|
46
|
-
|
|
43
|
+
var F = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(F || {}), S = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(S || {});
|
|
44
|
+
const T = /* @__PURE__ */ new Map();
|
|
45
|
+
async function k(s, e, t) {
|
|
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);
|
|
47
50
|
if (i && i.scene.uid === e.uid)
|
|
48
51
|
return i;
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
console.log(
|
|
53
|
+
`existing container belonged to scene ${i == null ? void 0 : i.scene.uid}`
|
|
54
|
+
);
|
|
55
|
+
const r = B.LoadAssetContainerAsync(
|
|
56
|
+
s,
|
|
51
57
|
void 0,
|
|
52
58
|
e,
|
|
53
59
|
t
|
|
54
60
|
);
|
|
55
|
-
return
|
|
61
|
+
return T.set(s, r), r;
|
|
56
62
|
}
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
B.OnPluginActivatedObservable.add((s) => {
|
|
64
|
+
s.name === "gltf" && (s.animationStartMode = Re.NONE);
|
|
59
65
|
});
|
|
60
66
|
class ce {
|
|
61
67
|
constructor(e) {
|
|
62
68
|
this.getSceneClearColor = () => {
|
|
63
|
-
var i,
|
|
64
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
65
|
-
if (this.customOptions && ((
|
|
69
|
+
var i, r, n, o;
|
|
70
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
71
|
+
if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
66
72
|
return new b(0, 0, 0, t).toLinearSpace();
|
|
67
73
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
68
74
|
const a = w.FromHexString(
|
|
@@ -77,11 +83,11 @@ class ce {
|
|
|
77
83
|
}
|
|
78
84
|
return new b(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
79
85
|
}, 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) => {
|
|
80
|
-
const
|
|
86
|
+
const r = w.FromHexString(t);
|
|
81
87
|
return new b(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
r.r,
|
|
89
|
+
r.g,
|
|
90
|
+
r.b,
|
|
85
91
|
i
|
|
86
92
|
).toLinearSpace();
|
|
87
93
|
}, this.customOptions = e;
|
|
@@ -97,14 +103,14 @@ class ce {
|
|
|
97
103
|
* Configuration related to the scene
|
|
98
104
|
*/
|
|
99
105
|
get scene() {
|
|
100
|
-
var e, t, i,
|
|
106
|
+
var e, t, i, r, n;
|
|
101
107
|
return {
|
|
102
108
|
clearColor: this.getSceneClearColor(),
|
|
103
109
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
104
110
|
environment: {
|
|
105
111
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
106
|
-
intensity: ((
|
|
107
|
-
rotationY: (((
|
|
112
|
+
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
113
|
+
rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
108
114
|
// Convert to radians
|
|
109
115
|
}
|
|
110
116
|
};
|
|
@@ -113,7 +119,7 @@ class ce {
|
|
|
113
119
|
* Configuration related to the camera used to view and interact with the scene.
|
|
114
120
|
*/
|
|
115
121
|
get camera() {
|
|
116
|
-
var e, t, i,
|
|
122
|
+
var e, t, i, r, n, o, a, h, l, c, m, u, g;
|
|
117
123
|
return {
|
|
118
124
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
119
125
|
autoRotation: {
|
|
@@ -122,7 +128,7 @@ class ce {
|
|
|
122
128
|
},
|
|
123
129
|
limits: {
|
|
124
130
|
min: {
|
|
125
|
-
alpha: (
|
|
131
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
126
132
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
127
133
|
radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
|
|
128
134
|
},
|
|
@@ -146,10 +152,10 @@ class ce {
|
|
|
146
152
|
};
|
|
147
153
|
}
|
|
148
154
|
get lighting() {
|
|
149
|
-
var e, t, i,
|
|
155
|
+
var e, t, i, r;
|
|
150
156
|
return {
|
|
151
157
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
152
|
-
contrast: ((
|
|
158
|
+
contrast: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
153
159
|
};
|
|
154
160
|
}
|
|
155
161
|
get emissiveGlowIntensity() {
|
|
@@ -157,12 +163,12 @@ class ce {
|
|
|
157
163
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
|
-
class
|
|
166
|
+
class x {
|
|
161
167
|
/**
|
|
162
168
|
* Returns the resolution expected for generated textures.
|
|
163
169
|
*/
|
|
164
170
|
static getDynamicTextureResolution() {
|
|
165
|
-
return this.getIsMobile() || !
|
|
171
|
+
return this.getIsMobile() || !x.offscreenRenderingSupported() ? {
|
|
166
172
|
width: 1024,
|
|
167
173
|
height: 1024
|
|
168
174
|
} : {
|
|
@@ -267,14 +273,16 @@ class _e {
|
|
|
267
273
|
* write the properties into the object metadata for retrieval at runtime.
|
|
268
274
|
*/
|
|
269
275
|
loadNodeAsync(e, t, i) {
|
|
270
|
-
return this.loader.loadNodeAsync(
|
|
276
|
+
return console.log(`async loading node ${t.name}`), this.loader.loadNodeAsync(
|
|
271
277
|
e,
|
|
272
278
|
t,
|
|
273
|
-
function(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
function(r) {
|
|
280
|
+
console.log(
|
|
281
|
+
`loadNode async processing mesh ${r.name} (${r.id})`
|
|
282
|
+
), t.extras && Object.keys(t.extras).forEach((n) => {
|
|
283
|
+
const o = t.extras[n];
|
|
284
|
+
r.metadata[n] = o;
|
|
285
|
+
}), i(r);
|
|
278
286
|
}
|
|
279
287
|
);
|
|
280
288
|
}
|
|
@@ -299,7 +307,7 @@ class _e {
|
|
|
299
307
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
300
308
|
*/
|
|
301
309
|
enableMaterialExtrasIfRequired(e, t) {
|
|
302
|
-
if (!(!e.extras || !(t instanceof
|
|
310
|
+
if (!(!e.extras || !(t instanceof D))) {
|
|
303
311
|
if (e.extras.sheen) {
|
|
304
312
|
const i = t;
|
|
305
313
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
@@ -332,51 +340,51 @@ class _e {
|
|
|
332
340
|
* @param scene The scene to parse.
|
|
333
341
|
*/
|
|
334
342
|
applyReflections(e) {
|
|
335
|
-
function t(
|
|
343
|
+
function t(n) {
|
|
336
344
|
const o = [];
|
|
337
|
-
return
|
|
345
|
+
return n.transformNodes.forEach((a) => {
|
|
338
346
|
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
339
|
-
}),
|
|
347
|
+
}), n.meshes.forEach((a) => {
|
|
340
348
|
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
341
349
|
}), o;
|
|
342
350
|
}
|
|
343
|
-
function i(
|
|
344
|
-
const a =
|
|
351
|
+
function i(n, o = 1) {
|
|
352
|
+
const a = n.material;
|
|
345
353
|
if (!a)
|
|
346
354
|
return;
|
|
347
355
|
const h = new Ee(
|
|
348
356
|
"mirror",
|
|
349
|
-
|
|
357
|
+
x.getMirrorTextureResolution(),
|
|
350
358
|
e,
|
|
351
359
|
!0
|
|
352
360
|
);
|
|
353
361
|
h.renderList = t(e);
|
|
354
|
-
const l =
|
|
362
|
+
const l = n.getVerticesData("normal");
|
|
355
363
|
if (!l)
|
|
356
364
|
throw new Error(
|
|
357
|
-
"Mirror attribute specified on: " +
|
|
365
|
+
"Mirror attribute specified on: " + n.name + "But no normals exist to generate a mirror from!"
|
|
358
366
|
);
|
|
359
|
-
|
|
360
|
-
const c =
|
|
361
|
-
new
|
|
367
|
+
n.computeWorldMatrix(!0);
|
|
368
|
+
const c = n.getWorldMatrix(), m = oe.TransformNormal(
|
|
369
|
+
new oe(l[0], l[1], l[2]),
|
|
362
370
|
c
|
|
363
371
|
).normalize(), u = Oe.FromPositionAndNormal(
|
|
364
|
-
|
|
372
|
+
n.position,
|
|
365
373
|
m.scale(-1)
|
|
366
374
|
);
|
|
367
375
|
h.mirrorPlane = u, h.level = o, a.reflectionTexture = h;
|
|
368
376
|
}
|
|
369
|
-
function n
|
|
370
|
-
const o =
|
|
377
|
+
function r(n) {
|
|
378
|
+
const o = n.material, a = new Le(
|
|
371
379
|
"probe-" + o.name,
|
|
372
380
|
Ve,
|
|
373
381
|
e
|
|
374
382
|
);
|
|
375
|
-
a.attachToMesh(
|
|
383
|
+
a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
376
384
|
}
|
|
377
|
-
e.meshes.forEach((
|
|
378
|
-
const o =
|
|
379
|
-
o && (o.mirrorTexture && i(
|
|
385
|
+
e.meshes.forEach((n) => {
|
|
386
|
+
const o = n.metadata;
|
|
387
|
+
o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
|
|
380
388
|
});
|
|
381
389
|
}
|
|
382
390
|
}
|
|
@@ -402,90 +410,68 @@ class Ge {
|
|
|
402
410
|
}
|
|
403
411
|
}
|
|
404
412
|
}
|
|
405
|
-
function He(
|
|
406
|
-
t.forEach((
|
|
407
|
-
const o =
|
|
408
|
-
|
|
409
|
-
console.log(`cheking material ${c.name}`);
|
|
413
|
+
function He(s, e, t, i, r = "") {
|
|
414
|
+
t.forEach((n) => {
|
|
415
|
+
const o = n.getID(), a = n.getName(), h = x.getDynamicTextureResolution();
|
|
416
|
+
s.filter((c) => c.name === r + a).forEach((c) => {
|
|
410
417
|
const m = i.get(o), u = !1;
|
|
411
418
|
if (m)
|
|
412
|
-
de(c, m),
|
|
419
|
+
de(c, m), m.update(u);
|
|
413
420
|
else {
|
|
414
|
-
const g =
|
|
421
|
+
const g = Ue(
|
|
415
422
|
a,
|
|
416
423
|
e,
|
|
417
424
|
h.width,
|
|
418
425
|
h.height
|
|
419
426
|
);
|
|
420
|
-
i.set(o, g),
|
|
427
|
+
i.set(o, g), n.setStaticContext(
|
|
421
428
|
g.getContext()
|
|
422
|
-
), de(c, g),
|
|
429
|
+
), de(c, g), g.onLoadObservable.addOnce(() => {
|
|
423
430
|
g.update(u);
|
|
424
431
|
});
|
|
425
432
|
}
|
|
426
433
|
});
|
|
427
|
-
}), Ue(e);
|
|
428
|
-
}
|
|
429
|
-
const Ue = (r) => {
|
|
430
|
-
const e = () => r.textures.reduce((i, n) => {
|
|
431
|
-
var o;
|
|
432
|
-
return !r.meshes.some(
|
|
433
|
-
(a) => a.material && a.material.hasTexture(n)
|
|
434
|
-
) && !((o = n == null ? void 0 : n.url) != null && o.includes("data:")) && i.push(n), i;
|
|
435
|
-
}, []), t = () => r.materials.reduce((i, n) => (n.getBindedMeshes().length == 0 && i.push(n), i), []);
|
|
436
|
-
e().forEach((i) => {
|
|
437
|
-
try {
|
|
438
|
-
console.log(`disposing texture ${i.name}`), i.dispose();
|
|
439
|
-
} catch {
|
|
440
|
-
console.log(`Failed to dispose texture ${i.name}`);
|
|
441
|
-
}
|
|
442
|
-
}), t().forEach((i) => {
|
|
443
|
-
try {
|
|
444
|
-
console.log(`disposing material ${i.name}`), i.dispose(!0, !0);
|
|
445
|
-
} catch {
|
|
446
|
-
console.log(`Failed to dispose material ${i.name}`);
|
|
447
|
-
}
|
|
448
434
|
});
|
|
449
|
-
}
|
|
450
|
-
function
|
|
451
|
-
const
|
|
452
|
-
|
|
435
|
+
}
|
|
436
|
+
function Ue(s, e, t, i) {
|
|
437
|
+
const r = new Be(
|
|
438
|
+
s,
|
|
453
439
|
{ width: t, height: i },
|
|
454
440
|
e,
|
|
455
|
-
|
|
441
|
+
x.shouldMipMap(),
|
|
456
442
|
De.TRILINEAR_SAMPLINGMODE,
|
|
457
443
|
be.TEXTUREFORMAT_RGBA
|
|
458
|
-
),
|
|
459
|
-
return
|
|
444
|
+
), n = r.getContext();
|
|
445
|
+
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
|
|
460
446
|
}
|
|
461
|
-
function de(
|
|
462
|
-
if (
|
|
463
|
-
const t =
|
|
447
|
+
function de(s, e) {
|
|
448
|
+
if (s instanceof D) {
|
|
449
|
+
const t = s, i = t.albedoTexture;
|
|
464
450
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
465
451
|
} else {
|
|
466
|
-
const t =
|
|
452
|
+
const t = s, i = t.diffuseTexture;
|
|
467
453
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
468
454
|
}
|
|
469
455
|
}
|
|
470
|
-
function
|
|
471
|
-
const
|
|
472
|
-
return
|
|
456
|
+
function Ke() {
|
|
457
|
+
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
458
|
+
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
473
459
|
}
|
|
474
460
|
const A = 60, ue = 1;
|
|
475
|
-
function me(
|
|
476
|
-
return
|
|
461
|
+
function me(s) {
|
|
462
|
+
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
477
463
|
}
|
|
478
|
-
function ve(
|
|
479
|
-
const o =
|
|
464
|
+
function ve(s, e, t, i, r, n) {
|
|
465
|
+
const o = r ? s.filter((c) => c.name === r) : s;
|
|
480
466
|
if (o.length === 0) {
|
|
481
|
-
console.warn(`No animations found for name: ${
|
|
467
|
+
console.warn(`No animations found for name: ${r}`);
|
|
482
468
|
return;
|
|
483
469
|
}
|
|
484
470
|
let a = 0;
|
|
485
471
|
const h = () => {
|
|
486
|
-
a++, a === o.length &&
|
|
472
|
+
a++, a === o.length && n && n();
|
|
487
473
|
}, l = (c, m, u, g, f) => {
|
|
488
|
-
c.stop(), c.start(m, u, g, f),
|
|
474
|
+
c.stop(), c.start(m, u, g, f), n && (m == !1 || m === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
|
|
489
475
|
h();
|
|
490
476
|
}) : c.onAnimationLoopObservable.addOnce(() => {
|
|
491
477
|
h();
|
|
@@ -503,11 +489,11 @@ function ve(r, e, t, i, n, s) {
|
|
|
503
489
|
l(c, e, ue, u, g);
|
|
504
490
|
});
|
|
505
491
|
}
|
|
506
|
-
function
|
|
492
|
+
function $e(s, e, t) {
|
|
507
493
|
return new Promise((i) => {
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
if (t.target && Object.keys(t.target).length > 0 &&
|
|
494
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = We(e.alpha, 0, 2 * Math.PI));
|
|
495
|
+
const r = [], n = t.target, o = 0, a = n ? 1 : 0;
|
|
496
|
+
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
511
497
|
P(
|
|
512
498
|
"cameraTargetLerp",
|
|
513
499
|
"target",
|
|
@@ -520,7 +506,7 @@ function Ye(r, e, t) {
|
|
|
520
506
|
v.ANIMATIONTYPE_VECTOR3,
|
|
521
507
|
o
|
|
522
508
|
)
|
|
523
|
-
),
|
|
509
|
+
), r.push(
|
|
524
510
|
P(
|
|
525
511
|
"cameraAlphaLerp",
|
|
526
512
|
"alpha",
|
|
@@ -529,7 +515,7 @@ function Ye(r, e, t) {
|
|
|
529
515
|
v.ANIMATIONTYPE_FLOAT,
|
|
530
516
|
a
|
|
531
517
|
)
|
|
532
|
-
),
|
|
518
|
+
), r.push(
|
|
533
519
|
P(
|
|
534
520
|
"cameraBetaLerp",
|
|
535
521
|
"beta",
|
|
@@ -540,7 +526,7 @@ function Ye(r, e, t) {
|
|
|
540
526
|
)
|
|
541
527
|
), t.radius !== void 0) {
|
|
542
528
|
const c = Math.max(0.01, t.radius);
|
|
543
|
-
|
|
529
|
+
r.push(
|
|
544
530
|
P(
|
|
545
531
|
"cameraRadiusLerp",
|
|
546
532
|
"radius",
|
|
@@ -551,12 +537,12 @@ function Ye(r, e, t) {
|
|
|
551
537
|
)
|
|
552
538
|
);
|
|
553
539
|
}
|
|
554
|
-
e.animations.push(...
|
|
540
|
+
e.animations.push(...r);
|
|
555
541
|
const l = e.useAutoRotationBehavior;
|
|
556
|
-
e.disableAutoRotationBehavior(),
|
|
542
|
+
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
557
543
|
e,
|
|
558
544
|
0,
|
|
559
|
-
|
|
545
|
+
n ? A * 2 : A,
|
|
560
546
|
!1,
|
|
561
547
|
1,
|
|
562
548
|
() => {
|
|
@@ -565,33 +551,33 @@ function Ye(r, e, t) {
|
|
|
565
551
|
);
|
|
566
552
|
});
|
|
567
553
|
}
|
|
568
|
-
function ge(
|
|
569
|
-
return
|
|
554
|
+
function ge(s) {
|
|
555
|
+
return s * Math.PI / 180;
|
|
570
556
|
}
|
|
571
|
-
function P(
|
|
557
|
+
function P(s, e, t, i, r, n = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
572
558
|
const a = new ke();
|
|
573
559
|
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
574
560
|
const h = new v(
|
|
575
|
-
|
|
561
|
+
s,
|
|
576
562
|
e,
|
|
577
563
|
A,
|
|
578
|
-
|
|
564
|
+
r,
|
|
579
565
|
o
|
|
580
566
|
), l = [];
|
|
581
|
-
return
|
|
582
|
-
frame: A * (
|
|
567
|
+
return n > 0 && l.push({ frame: 0, value: t }), l.push({ frame: A * n, value: t }), l.push({
|
|
568
|
+
frame: A * (n + 1),
|
|
583
569
|
value: i
|
|
584
570
|
}), h.setKeys(l), h.setEasingFunction(a), h;
|
|
585
571
|
}
|
|
586
|
-
function
|
|
587
|
-
return
|
|
572
|
+
function We(s, e, t) {
|
|
573
|
+
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
588
574
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
575
|
+
function Ye(s, e, t) {
|
|
576
|
+
s.forEach((i) => {
|
|
591
577
|
t && i.name !== t || i.goToFrame(e);
|
|
592
578
|
});
|
|
593
579
|
}
|
|
594
|
-
const
|
|
580
|
+
const Qe = {
|
|
595
581
|
albedoTexture: "albedoMap",
|
|
596
582
|
bumpTexture: "normalMap",
|
|
597
583
|
ambientTexture: "ambientMap",
|
|
@@ -601,7 +587,7 @@ const Ze = {
|
|
|
601
587
|
refractionTexture: "refractionMap",
|
|
602
588
|
reflectionTexture: "reflectionMap"
|
|
603
589
|
};
|
|
604
|
-
function
|
|
590
|
+
function Ze(s, e, t, i) {
|
|
605
591
|
[
|
|
606
592
|
"albedoTexture",
|
|
607
593
|
"bumpTexture",
|
|
@@ -611,51 +597,51 @@ function je(r, e, t, i) {
|
|
|
611
597
|
"metallicTexture",
|
|
612
598
|
"refractionTexture",
|
|
613
599
|
"reflectionTexture"
|
|
614
|
-
].forEach((
|
|
615
|
-
|
|
600
|
+
].forEach((n) => {
|
|
601
|
+
je(
|
|
602
|
+
n,
|
|
616
603
|
s,
|
|
617
|
-
r,
|
|
618
604
|
e,
|
|
619
605
|
t,
|
|
620
606
|
i
|
|
621
607
|
);
|
|
622
|
-
}),
|
|
608
|
+
}), et(s, e);
|
|
623
609
|
}
|
|
624
|
-
function
|
|
625
|
-
const
|
|
626
|
-
if (!
|
|
610
|
+
function je(s, e, t, i, r) {
|
|
611
|
+
const n = Qe[s];
|
|
612
|
+
if (!n)
|
|
627
613
|
throw new Error("Unexpected texture name encountered.");
|
|
628
|
-
const o = e[
|
|
629
|
-
a ?
|
|
630
|
-
|
|
614
|
+
const o = e[n], a = o == null ? void 0 : o.fileLink;
|
|
615
|
+
a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
616
|
+
s,
|
|
631
617
|
a,
|
|
632
618
|
void 0,
|
|
633
619
|
!1,
|
|
634
620
|
void 0,
|
|
635
621
|
!0
|
|
636
622
|
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
637
|
-
|
|
623
|
+
s,
|
|
638
624
|
a,
|
|
639
625
|
128,
|
|
640
626
|
!1,
|
|
641
627
|
!0,
|
|
642
628
|
!1
|
|
643
|
-
) : i.addTextureTask(
|
|
629
|
+
) : 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));
|
|
644
630
|
}
|
|
645
|
-
function
|
|
646
|
-
|
|
631
|
+
function Xe(s, e) {
|
|
632
|
+
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);
|
|
647
633
|
}
|
|
648
|
-
function
|
|
634
|
+
function Je(s, e, t, i) {
|
|
649
635
|
if (!e) {
|
|
650
636
|
console.error("Failed to apply texture to material: material is null.");
|
|
651
637
|
return;
|
|
652
638
|
}
|
|
653
|
-
|
|
639
|
+
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);
|
|
654
640
|
}
|
|
655
|
-
function
|
|
656
|
-
|
|
641
|
+
function et(s, e) {
|
|
642
|
+
s.clearCoat && (s.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
657
643
|
}
|
|
658
|
-
class
|
|
644
|
+
class tt {
|
|
659
645
|
constructor(e, t, i) {
|
|
660
646
|
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;
|
|
661
647
|
}
|
|
@@ -668,8 +654,8 @@ class it {
|
|
|
668
654
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
669
655
|
* where we want to undo changes are remove effects from display.
|
|
670
656
|
*/
|
|
671
|
-
async applyMaterial(e, t, i,
|
|
672
|
-
return new Promise((
|
|
657
|
+
async applyMaterial(e, t, i, r) {
|
|
658
|
+
return new Promise((n) => {
|
|
673
659
|
const o = this.materialVariantMap.get(e);
|
|
674
660
|
this.materialVariantMap.set(e, {
|
|
675
661
|
...o,
|
|
@@ -679,16 +665,16 @@ class it {
|
|
|
679
665
|
(c) => c.name === a
|
|
680
666
|
);
|
|
681
667
|
if (h.length === 0) {
|
|
682
|
-
|
|
668
|
+
n();
|
|
683
669
|
return;
|
|
684
670
|
}
|
|
685
671
|
const l = new Ne(this.scene);
|
|
686
672
|
l.useDefaultLoadingScreen = !1, h.forEach(
|
|
687
|
-
(c) =>
|
|
673
|
+
(c) => Ze(
|
|
688
674
|
t,
|
|
689
675
|
c,
|
|
690
676
|
l,
|
|
691
|
-
|
|
677
|
+
r
|
|
692
678
|
)
|
|
693
679
|
), l.onProgress = (c, m, u) => {
|
|
694
680
|
i && i(c / m * 100, 100, u.name);
|
|
@@ -697,15 +683,15 @@ class it {
|
|
|
697
683
|
const u = m;
|
|
698
684
|
i && i(100, 100, m.name), this.scene.materials.filter(
|
|
699
685
|
(f) => f.name === a
|
|
700
|
-
).forEach(
|
|
701
|
-
(
|
|
686
|
+
).forEach((f) => {
|
|
687
|
+
Je(
|
|
702
688
|
m.name,
|
|
703
689
|
f,
|
|
704
690
|
t,
|
|
705
691
|
u.texture
|
|
706
|
-
)
|
|
707
|
-
);
|
|
708
|
-
}),
|
|
692
|
+
);
|
|
693
|
+
});
|
|
694
|
+
}), n();
|
|
709
695
|
}, l.loadAsync();
|
|
710
696
|
});
|
|
711
697
|
}
|
|
@@ -719,27 +705,27 @@ class it {
|
|
|
719
705
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
720
706
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
721
707
|
*/
|
|
722
|
-
async applyModel(e, t, i,
|
|
708
|
+
async applyModel(e, t, i, r, n, o, a) {
|
|
723
709
|
var m;
|
|
724
710
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
725
711
|
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(
|
|
726
712
|
(u) => u !== e
|
|
727
713
|
), Promise.resolve(void 0);
|
|
728
|
-
const l = (await
|
|
714
|
+
const l = (await k(i, this.scene, r)).instantiateModelsToScene(
|
|
729
715
|
this.renameClonedAsset,
|
|
730
716
|
!0
|
|
731
717
|
);
|
|
732
|
-
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)),
|
|
733
|
-
const u = o && o(), g =
|
|
718
|
+
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), n) {
|
|
719
|
+
const u = o && o(), g = n.name ? this.renameClonedAsset(n.name) : void 0;
|
|
734
720
|
if (ve(
|
|
735
721
|
l.animationGroups,
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
722
|
+
n.loop,
|
|
723
|
+
n.to,
|
|
724
|
+
n.from,
|
|
739
725
|
g
|
|
740
726
|
), u != null) {
|
|
741
727
|
const f = a && a() || !0;
|
|
742
|
-
|
|
728
|
+
Ye(
|
|
743
729
|
l.animationGroups,
|
|
744
730
|
u + (f ? 2 : 0),
|
|
745
731
|
g
|
|
@@ -772,36 +758,36 @@ class it {
|
|
|
772
758
|
}), e;
|
|
773
759
|
}
|
|
774
760
|
}
|
|
775
|
-
function we(
|
|
761
|
+
function we(s) {
|
|
776
762
|
const e = [];
|
|
777
|
-
return
|
|
763
|
+
return s.rootNodes.forEach((t) => {
|
|
778
764
|
t.getChildMeshes().forEach((i) => {
|
|
779
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
780
|
-
const
|
|
781
|
-
|
|
765
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
766
|
+
const n = r.getMaterial(!1);
|
|
767
|
+
n && !e.includes(n) && e.push(n);
|
|
782
768
|
});
|
|
783
769
|
});
|
|
784
770
|
}), e;
|
|
785
771
|
}
|
|
786
|
-
function pe(
|
|
787
|
-
return
|
|
772
|
+
function pe(s, e = "") {
|
|
773
|
+
return s.map((t) => ({
|
|
788
774
|
name: t.name.substring(e.length),
|
|
789
775
|
loop: t.loopAnimation,
|
|
790
776
|
to: t.to,
|
|
791
777
|
from: t.from
|
|
792
778
|
}));
|
|
793
779
|
}
|
|
794
|
-
class
|
|
780
|
+
class it {
|
|
795
781
|
constructor(e) {
|
|
796
782
|
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 = [];
|
|
797
783
|
const {
|
|
798
784
|
enablePicking: t,
|
|
799
785
|
modelDetails: i,
|
|
800
|
-
previewService:
|
|
801
|
-
progressHandler:
|
|
786
|
+
previewService: r,
|
|
787
|
+
progressHandler: n,
|
|
802
788
|
scene: o
|
|
803
789
|
} = e;
|
|
804
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
790
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new tt(
|
|
805
791
|
o,
|
|
806
792
|
this.renameClonedAsset.bind(this),
|
|
807
793
|
this.setBaseModelEnabled.bind(this)
|
|
@@ -811,16 +797,16 @@ class nt {
|
|
|
811
797
|
throw new Error(
|
|
812
798
|
"Model container constructed with no URL. This is currently unsupported."
|
|
813
799
|
);
|
|
814
|
-
return this.assetContainer = await
|
|
800
|
+
return this.assetContainer = await k(
|
|
815
801
|
i.model,
|
|
816
802
|
o,
|
|
817
|
-
|
|
803
|
+
n
|
|
818
804
|
), await this.instantiate(), this;
|
|
819
805
|
};
|
|
820
806
|
this.importPromise = a();
|
|
821
807
|
}
|
|
822
808
|
//#region Interface implementation
|
|
823
|
-
async applyMaterialVariant(e, t, i,
|
|
809
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
824
810
|
if (!this.initialized) {
|
|
825
811
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
826
812
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -831,7 +817,7 @@ class nt {
|
|
|
831
817
|
e,
|
|
832
818
|
t,
|
|
833
819
|
i,
|
|
834
|
-
|
|
820
|
+
r
|
|
835
821
|
)
|
|
836
822
|
);
|
|
837
823
|
} else {
|
|
@@ -847,13 +833,13 @@ class nt {
|
|
|
847
833
|
e,
|
|
848
834
|
t,
|
|
849
835
|
i,
|
|
850
|
-
|
|
836
|
+
r
|
|
851
837
|
)
|
|
852
838
|
);
|
|
853
839
|
}
|
|
854
840
|
return;
|
|
855
841
|
}
|
|
856
|
-
const
|
|
842
|
+
const n = async () => {
|
|
857
843
|
await this.variantManager.applyMaterial(
|
|
858
844
|
e,
|
|
859
845
|
i,
|
|
@@ -864,24 +850,24 @@ class nt {
|
|
|
864
850
|
taskName: h
|
|
865
851
|
});
|
|
866
852
|
},
|
|
867
|
-
|
|
853
|
+
r
|
|
868
854
|
);
|
|
869
855
|
};
|
|
870
856
|
if (this.materialChangesInProgress.includes(e)) {
|
|
871
857
|
if (this.queuedMaterialChanges.has(e)) {
|
|
872
858
|
const o = this.queuedMaterialChanges.get(e);
|
|
873
|
-
o == null || o.set(t,
|
|
859
|
+
o == null || o.set(t, n);
|
|
874
860
|
} else {
|
|
875
861
|
this.queuedMaterialChanges.set(
|
|
876
862
|
e,
|
|
877
863
|
/* @__PURE__ */ new Map()
|
|
878
864
|
);
|
|
879
865
|
const o = this.queuedMaterialChanges.get(e);
|
|
880
|
-
o == null || o.set(t,
|
|
866
|
+
o == null || o.set(t, n);
|
|
881
867
|
}
|
|
882
868
|
return;
|
|
883
869
|
}
|
|
884
|
-
if (this.materialChangesInProgress.push(e), await
|
|
870
|
+
if (this.materialChangesInProgress.push(e), await n(), this.queuedMaterialChanges.has(e)) {
|
|
885
871
|
const o = this.queuedMaterialChanges.get(e);
|
|
886
872
|
if (!o)
|
|
887
873
|
throw new Error("Target material is undefined");
|
|
@@ -907,7 +893,7 @@ class nt {
|
|
|
907
893
|
);
|
|
908
894
|
return;
|
|
909
895
|
}
|
|
910
|
-
const
|
|
896
|
+
const r = () => this.variantManager.applyModel(
|
|
911
897
|
e,
|
|
912
898
|
i,
|
|
913
899
|
t == null ? void 0 : t.model,
|
|
@@ -922,12 +908,12 @@ class nt {
|
|
|
922
908
|
this.getAnimationIsPlaying.bind(this)
|
|
923
909
|
);
|
|
924
910
|
if (this.modelChangesInProgress.includes(e)) {
|
|
925
|
-
this.queuedModelChanges.set(e,
|
|
911
|
+
this.queuedModelChanges.set(e, r);
|
|
926
912
|
return;
|
|
927
913
|
}
|
|
928
914
|
const o = await (async () => {
|
|
929
915
|
this.modelChangesInProgress.push(e);
|
|
930
|
-
let a = await
|
|
916
|
+
let a = await r();
|
|
931
917
|
if (this.queuedModelChanges.has(e)) {
|
|
932
918
|
const h = this.queuedModelChanges.get(e);
|
|
933
919
|
if (!h)
|
|
@@ -951,24 +937,24 @@ class nt {
|
|
|
951
937
|
let t = () => {
|
|
952
938
|
};
|
|
953
939
|
const i = async () => {
|
|
954
|
-
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((
|
|
940
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
955
941
|
var o;
|
|
956
|
-
const
|
|
942
|
+
const n = [
|
|
957
943
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
958
944
|
...this.variantManager.getAnimationGroups()
|
|
959
945
|
];
|
|
960
946
|
ve(
|
|
961
|
-
|
|
947
|
+
n,
|
|
962
948
|
e.loop,
|
|
963
949
|
e.to,
|
|
964
950
|
e.from,
|
|
965
951
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
966
|
-
|
|
952
|
+
r
|
|
967
953
|
);
|
|
968
954
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
969
955
|
};
|
|
970
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
971
|
-
t =
|
|
956
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
957
|
+
t = r;
|
|
972
958
|
})) : i();
|
|
973
959
|
}
|
|
974
960
|
getAnimations(e) {
|
|
@@ -978,7 +964,7 @@ class nt {
|
|
|
978
964
|
this.variantManager.getAnimationGroups(),
|
|
979
965
|
this.renameClonedAsset("")
|
|
980
966
|
) : []
|
|
981
|
-
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i,
|
|
967
|
+
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((n) => n.name === t.name)) == i);
|
|
982
968
|
}
|
|
983
969
|
getId() {
|
|
984
970
|
return this.id;
|
|
@@ -1045,15 +1031,15 @@ class nt {
|
|
|
1045
1031
|
attachPickingHandler(e) {
|
|
1046
1032
|
e.rootNodes.forEach((t) => {
|
|
1047
1033
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1048
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
|
|
1049
|
-
new
|
|
1050
|
-
|
|
1034
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), console.log(`registering actions against mesh ${i.name} (${i.id})`), i.actionManager.registerAction(
|
|
1035
|
+
new le(R.OnPointerOverTrigger, (r) => {
|
|
1036
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1051
1037
|
id: i.material.id,
|
|
1052
1038
|
name: this.stripIdFromName(i.material.name)
|
|
1053
1039
|
});
|
|
1054
1040
|
})
|
|
1055
1041
|
), i.actionManager.registerAction(
|
|
1056
|
-
new
|
|
1042
|
+
new le(R.OnPointerOutTrigger, () => {
|
|
1057
1043
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
1058
1044
|
id: i.material.id,
|
|
1059
1045
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1082,23 +1068,23 @@ class nt {
|
|
|
1082
1068
|
return this.modelReadyToLoadCallbacks.size;
|
|
1083
1069
|
}
|
|
1084
1070
|
configureGlowLayer() {
|
|
1085
|
-
const e = (i) => i instanceof
|
|
1071
|
+
const e = (i) => i instanceof D && i.emissiveTexture !== null;
|
|
1086
1072
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1087
1073
|
}
|
|
1088
1074
|
configureModelInstance(e) {
|
|
1089
|
-
var
|
|
1075
|
+
var n;
|
|
1090
1076
|
if (!this.transformRoot)
|
|
1091
1077
|
throw new Error(
|
|
1092
1078
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1093
1079
|
);
|
|
1094
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1080
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1095
1081
|
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1096
1082
|
for (const o of e.rootNodes) {
|
|
1097
1083
|
o.parent = this.transformRoot;
|
|
1098
1084
|
for (const a of o.getChildMeshes(!1))
|
|
1099
1085
|
a.alwaysSelectAsActiveMesh = !0;
|
|
1100
1086
|
}
|
|
1101
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1087
|
+
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(
|
|
1102
1088
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1103
1089
|
this.scene,
|
|
1104
1090
|
this.canvasPanels,
|
|
@@ -1142,8 +1128,8 @@ class nt {
|
|
|
1142
1128
|
var e;
|
|
1143
1129
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1144
1130
|
(t, i) => {
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1131
|
+
const r = this.dynamicTextures.get(i);
|
|
1132
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1147
1133
|
}
|
|
1148
1134
|
);
|
|
1149
1135
|
}
|
|
@@ -1201,14 +1187,14 @@ class nt {
|
|
|
1201
1187
|
}
|
|
1202
1188
|
//#endregion
|
|
1203
1189
|
}
|
|
1204
|
-
class
|
|
1205
|
-
constructor(e, t, i,
|
|
1190
|
+
class z extends fe {
|
|
1191
|
+
constructor(e, t, i, r, n, o, a, h) {
|
|
1206
1192
|
super(
|
|
1207
1193
|
e,
|
|
1208
1194
|
t,
|
|
1209
1195
|
i,
|
|
1196
|
+
r,
|
|
1210
1197
|
n,
|
|
1211
|
-
s,
|
|
1212
1198
|
o,
|
|
1213
1199
|
h
|
|
1214
1200
|
), 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, 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(
|
|
@@ -1252,7 +1238,7 @@ class k extends fe {
|
|
|
1252
1238
|
this.useFramingBehavior = !0;
|
|
1253
1239
|
const e = this.getFramingBehavior();
|
|
1254
1240
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1255
|
-
const t =
|
|
1241
|
+
const t = O(this._scene);
|
|
1256
1242
|
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;
|
|
1257
1243
|
}
|
|
1258
1244
|
/**
|
|
@@ -1264,14 +1250,14 @@ class k extends fe {
|
|
|
1264
1250
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1265
1251
|
const i = this.getFramingBehavior();
|
|
1266
1252
|
i.framingTime = t || 800;
|
|
1267
|
-
const
|
|
1253
|
+
const r = () => {
|
|
1268
1254
|
this.isRunningFramingBehavior = !1;
|
|
1269
|
-
},
|
|
1255
|
+
}, n = O(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
|
|
1270
1256
|
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(
|
|
1271
|
-
|
|
1272
|
-
|
|
1257
|
+
n.min,
|
|
1258
|
+
n.max,
|
|
1273
1259
|
void 0,
|
|
1274
|
-
|
|
1260
|
+
r
|
|
1275
1261
|
), i.framingTime = 0;
|
|
1276
1262
|
}
|
|
1277
1263
|
/**
|
|
@@ -1303,32 +1289,32 @@ class k extends fe {
|
|
|
1303
1289
|
*/
|
|
1304
1290
|
static create(e, t, i) {
|
|
1305
1291
|
var h;
|
|
1306
|
-
const
|
|
1292
|
+
const r = O(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new z(
|
|
1307
1293
|
"ProductCamera",
|
|
1308
1294
|
-(Math.PI / 2),
|
|
1309
1295
|
Math.PI / 2,
|
|
1310
|
-
|
|
1296
|
+
n.length() * 1.5,
|
|
1311
1297
|
o,
|
|
1312
1298
|
e,
|
|
1313
1299
|
t
|
|
1314
1300
|
);
|
|
1315
1301
|
return a.setPanEnabled(
|
|
1316
1302
|
((h = t.options) == null ? void 0 : h.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1317
|
-
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator =
|
|
1303
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1318
1304
|
a.setPanEnabled(a.panEnabled);
|
|
1319
1305
|
}), i && (e.activeCamera = a), a;
|
|
1320
1306
|
}
|
|
1321
1307
|
}
|
|
1322
|
-
function
|
|
1323
|
-
if (
|
|
1308
|
+
function O(s) {
|
|
1309
|
+
if (s.meshes.length === 0)
|
|
1324
1310
|
return {
|
|
1325
1311
|
min: new p(-1, -1, -1),
|
|
1326
1312
|
max: new p(1, 1, 1)
|
|
1327
1313
|
};
|
|
1328
|
-
const e =
|
|
1329
|
-
return
|
|
1314
|
+
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1315
|
+
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1330
1316
|
}
|
|
1331
|
-
class
|
|
1317
|
+
class nt {
|
|
1332
1318
|
constructor(e, t = !1, i = void 0) {
|
|
1333
1319
|
this.renderingPipeline = new qe(
|
|
1334
1320
|
"default",
|
|
@@ -1346,15 +1332,15 @@ class st {
|
|
|
1346
1332
|
return this.currentConfiguration;
|
|
1347
1333
|
}
|
|
1348
1334
|
setConfiguration(e) {
|
|
1349
|
-
var t, i,
|
|
1335
|
+
var t, i, r, n, o, a, h, l, c, m, u, g, f, N, q, V, _, G, H, U, K, $, W, Y, Q, Z, j, X, J, ee, te, ie, ne;
|
|
1350
1336
|
if (this.renderingPipeline.isSupported) {
|
|
1351
|
-
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 = ((
|
|
1337
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((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 = ((m = e.chromaticAberration) == null ? void 0 : m.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (u = e.chromaticAberration) != null && u.direction ? new re(
|
|
1352
1338
|
e.chromaticAberration.direction.x,
|
|
1353
1339
|
e.chromaticAberration.direction.y
|
|
1354
|
-
) : new
|
|
1340
|
+
) : new re(
|
|
1355
1341
|
d.chromaticAberration.direction.x,
|
|
1356
1342
|
d.chromaticAberration.direction.y
|
|
1357
|
-
), 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
|
|
1343
|
+
), 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 he(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
|
|
1358
1344
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1359
1345
|
case "Low":
|
|
1360
1346
|
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
@@ -1366,58 +1352,58 @@ class st {
|
|
|
1366
1352
|
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1367
1353
|
break;
|
|
1368
1354
|
}
|
|
1369
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1355
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((N = e.depthOfField) == null ? void 0 : N.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((q = e.depthOfField) == null ? void 0 : q.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((_ = e.depthOfField) == null ? void 0 : _.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = (($ = e.misc) == null ? void 0 : $.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((W = e.misc) == null ? void 0 : W.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1370
1356
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1371
1357
|
case "Standard":
|
|
1372
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1358
|
+
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_STANDARD;
|
|
1373
1359
|
break;
|
|
1374
1360
|
case "ACES":
|
|
1375
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1361
|
+
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_ACES;
|
|
1376
1362
|
break;
|
|
1377
1363
|
}
|
|
1378
|
-
if (this.renderingPipeline.sharpenEnabled = ((Y = e.sharpen) == null ? void 0 : Y.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((
|
|
1379
|
-
switch (((
|
|
1364
|
+
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 = ((j = e.vignette) == null ? void 0 : j.enabled) ?? d.vignette.enabled, (X = e.vignette) != null && X.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)
|
|
1365
|
+
switch (((J = e.vignette) == null ? void 0 : J.blendMode) ?? d.vignette.blendMode) {
|
|
1380
1366
|
case "Multiply":
|
|
1381
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1367
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_MULTIPLY;
|
|
1382
1368
|
break;
|
|
1383
1369
|
case "Opaque":
|
|
1384
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1370
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_OPAQUE;
|
|
1385
1371
|
break;
|
|
1386
1372
|
}
|
|
1387
|
-
(
|
|
1373
|
+
(ee = e.vignette) != null && ee.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1388
1374
|
e.vignette.colorRgba.r,
|
|
1389
1375
|
e.vignette.colorRgba.g,
|
|
1390
1376
|
e.vignette.colorRgba.b,
|
|
1391
1377
|
e.vignette.colorRgba.a
|
|
1392
|
-
) : (
|
|
1378
|
+
) : (te = e.vignette) != null && te.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1393
1379
|
d.vignette.colorRgba.r,
|
|
1394
1380
|
d.vignette.colorRgba.g,
|
|
1395
1381
|
d.vignette.colorRgba.b,
|
|
1396
1382
|
d.vignette.colorRgba.a
|
|
1397
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((
|
|
1383
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ie = e.vignette) == null ? void 0 : ie.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ne = e.vignette) == null ? void 0 : ne.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1398
1384
|
}
|
|
1399
1385
|
}
|
|
1400
1386
|
updateColorCurve(e) {
|
|
1401
|
-
const t = new
|
|
1387
|
+
const t = new he();
|
|
1402
1388
|
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;
|
|
1403
1389
|
}
|
|
1404
1390
|
}
|
|
1405
|
-
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1406
|
-
return new _e(
|
|
1391
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1392
|
+
return new _e(s);
|
|
1407
1393
|
});
|
|
1408
|
-
|
|
1409
|
-
if (
|
|
1410
|
-
const e =
|
|
1394
|
+
B.OnPluginActivatedObservable.add((s) => {
|
|
1395
|
+
if (s.name === "gltf") {
|
|
1396
|
+
const e = s;
|
|
1411
1397
|
e.transparencyAsCoverage = !0;
|
|
1412
1398
|
}
|
|
1413
1399
|
});
|
|
1414
|
-
function
|
|
1415
|
-
return new p(
|
|
1400
|
+
function L(s) {
|
|
1401
|
+
return new p(s.x, s.y, s.z);
|
|
1416
1402
|
}
|
|
1417
|
-
function
|
|
1418
|
-
return { x:
|
|
1403
|
+
function I(s) {
|
|
1404
|
+
return { x: s.x, y: s.y, z: s.z };
|
|
1419
1405
|
}
|
|
1420
|
-
class
|
|
1406
|
+
class $t {
|
|
1421
1407
|
constructor(e) {
|
|
1422
1408
|
var h;
|
|
1423
1409
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
@@ -1444,15 +1430,15 @@ class Yt {
|
|
|
1444
1430
|
const i = (() => {
|
|
1445
1431
|
if (!(e != null && e.noRender))
|
|
1446
1432
|
return this.configuration.createCanvas();
|
|
1447
|
-
})(),
|
|
1433
|
+
})(), r = "1.5.6";
|
|
1448
1434
|
Ae.Configuration = {
|
|
1449
1435
|
decoder: {
|
|
1450
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1451
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1452
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1436
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1437
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1438
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1453
1439
|
}
|
|
1454
1440
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1455
|
-
const
|
|
1441
|
+
const n = console.log;
|
|
1456
1442
|
console.log = () => {
|
|
1457
1443
|
};
|
|
1458
1444
|
const o = i ? new be(i, !0, {
|
|
@@ -1464,16 +1450,16 @@ class Yt {
|
|
|
1464
1450
|
stencil: this.configuration.highlights.enabled,
|
|
1465
1451
|
forceSRGBBufferSupportState: !0
|
|
1466
1452
|
}) : new Ce();
|
|
1467
|
-
console.log =
|
|
1453
|
+
console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Me(o), this.camera = z.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1468
1454
|
this.scene,
|
|
1469
1455
|
!1,
|
|
1470
1456
|
this.camera
|
|
1471
1457
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1472
|
-
const a =
|
|
1458
|
+
const a = se.CreateFromPrefilteredData(
|
|
1473
1459
|
this.configuration.scene.environment.file,
|
|
1474
1460
|
this.scene
|
|
1475
1461
|
);
|
|
1476
|
-
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(
|
|
1462
|
+
a.name = "initial-environment-cube", a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (h = this.configuration.options) != null && h.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1477
1463
|
this.configuration.options.renderingPipelineConfiguration
|
|
1478
1464
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
|
|
1479
1465
|
this.scene,
|
|
@@ -1512,7 +1498,7 @@ class Yt {
|
|
|
1512
1498
|
}
|
|
1513
1499
|
registerView(e) {
|
|
1514
1500
|
const t = e.height, i = e.width;
|
|
1515
|
-
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1501
|
+
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(F.Pan), this.reattachControls(e);
|
|
1516
1502
|
}
|
|
1517
1503
|
getNumViewports() {
|
|
1518
1504
|
var e;
|
|
@@ -1525,19 +1511,19 @@ class Yt {
|
|
|
1525
1511
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1526
1512
|
}
|
|
1527
1513
|
executeCameraAnimation(e) {
|
|
1528
|
-
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((
|
|
1514
|
+
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((r) => r.getIsInitialized()))
|
|
1529
1515
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1530
1516
|
let t = () => {
|
|
1531
1517
|
};
|
|
1532
1518
|
const i = async () => {
|
|
1533
|
-
this.isAnimatingCamera = !0, await
|
|
1519
|
+
this.isAnimatingCamera = !0, await $e(
|
|
1534
1520
|
this.scene,
|
|
1535
1521
|
this.scene.activeCamera,
|
|
1536
1522
|
e
|
|
1537
1523
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1538
1524
|
};
|
|
1539
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1540
|
-
t =
|
|
1525
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1526
|
+
t = r;
|
|
1541
1527
|
})) : i();
|
|
1542
1528
|
}
|
|
1543
1529
|
getCameraPose() {
|
|
@@ -1566,7 +1552,7 @@ class Yt {
|
|
|
1566
1552
|
throw new Error(
|
|
1567
1553
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1568
1554
|
);
|
|
1569
|
-
e ===
|
|
1555
|
+
e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1570
1556
|
}
|
|
1571
1557
|
animateToLastCameraFocus() {
|
|
1572
1558
|
let e = () => {
|
|
@@ -1574,13 +1560,13 @@ class Yt {
|
|
|
1574
1560
|
const t = async () => {
|
|
1575
1561
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1576
1562
|
this.focusLostNotified = !1;
|
|
1577
|
-
const
|
|
1578
|
-
const
|
|
1563
|
+
const r = () => {
|
|
1564
|
+
const n = this.configuration;
|
|
1579
1565
|
this.camera.rerunFramingBehavior(() => {
|
|
1580
|
-
|
|
1566
|
+
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();
|
|
1581
1567
|
});
|
|
1582
1568
|
};
|
|
1583
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1569
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1584
1570
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1585
1571
|
};
|
|
1586
1572
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1611,9 +1597,9 @@ class Yt {
|
|
|
1611
1597
|
this.scene
|
|
1612
1598
|
);
|
|
1613
1599
|
try {
|
|
1614
|
-
const
|
|
1615
|
-
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha =
|
|
1616
|
-
const o = await
|
|
1600
|
+
const r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
|
|
1601
|
+
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = n, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1602
|
+
const o = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1617
1603
|
this.engine,
|
|
1618
1604
|
i,
|
|
1619
1605
|
e,
|
|
@@ -1630,26 +1616,26 @@ class Yt {
|
|
|
1630
1616
|
const e = this.configuration;
|
|
1631
1617
|
if (!e)
|
|
1632
1618
|
return !0;
|
|
1633
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1634
|
-
if (t === void 0 || i === void 0 ||
|
|
1619
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, n = e.camera.limits.max.beta;
|
|
1620
|
+
if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
|
|
1635
1621
|
return !0;
|
|
1636
|
-
const o = [t, i], a = [
|
|
1622
|
+
const o = [t, i], a = [r, n], h = o.every((c) => c === t), l = a.every((c) => c === r);
|
|
1637
1623
|
return !h && !l;
|
|
1638
1624
|
}
|
|
1639
1625
|
fireResizeEvent() {
|
|
1640
1626
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1641
1627
|
}
|
|
1642
1628
|
setHighlights(e, t) {
|
|
1643
|
-
var
|
|
1644
|
-
e.length === 0 && ((
|
|
1629
|
+
var r;
|
|
1630
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1645
1631
|
isStroke: !0,
|
|
1646
1632
|
blurVerticalSize: 0.85,
|
|
1647
1633
|
blurHorizontalSize: 0.85
|
|
1648
1634
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1649
1635
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1650
|
-
e.forEach((
|
|
1636
|
+
e.forEach((n) => {
|
|
1651
1637
|
const o = this.scene.materials.find(
|
|
1652
|
-
(a) => a.name ===
|
|
1638
|
+
(a) => a.name === n.name && a.id === n.id
|
|
1653
1639
|
);
|
|
1654
1640
|
o && o.getBindedMeshes().forEach(
|
|
1655
1641
|
(a) => {
|
|
@@ -1666,14 +1652,14 @@ class Yt {
|
|
|
1666
1652
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1667
1653
|
}
|
|
1668
1654
|
loadModel(e, t) {
|
|
1669
|
-
const { refocusCamera: i = !0, progressHandler:
|
|
1655
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new it({
|
|
1670
1656
|
enablePicking: this.configuration.highlights.enabled,
|
|
1671
1657
|
modelDetails: e,
|
|
1672
1658
|
scene: this.scene,
|
|
1673
1659
|
previewService: this,
|
|
1674
|
-
progressHandler:
|
|
1660
|
+
progressHandler: r
|
|
1675
1661
|
});
|
|
1676
|
-
return
|
|
1662
|
+
return n.getInitializationPromise().then(() => {
|
|
1677
1663
|
if (this.modelContainers.size <= 1 && i) {
|
|
1678
1664
|
const o = this.queuedCameraAnimation;
|
|
1679
1665
|
this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
|
|
@@ -1682,17 +1668,17 @@ class Yt {
|
|
|
1682
1668
|
});
|
|
1683
1669
|
}, 1);
|
|
1684
1670
|
}
|
|
1685
|
-
}), this.configuration.highlights.enabled && (
|
|
1671
|
+
}), this.configuration.highlights.enabled && (n.registerMaterialSelectedCallback((o) => {
|
|
1686
1672
|
this.setHighlights([o]);
|
|
1687
|
-
}),
|
|
1673
|
+
}), n.registerMaterialDeselectedCallback(() => {
|
|
1688
1674
|
this.setHighlights([]);
|
|
1689
|
-
})), this.modelContainers.set(
|
|
1675
|
+
})), console.log(`loading model container ${n.getId()}`), this.modelContainers.set(n.getId(), n), this.triggerModelLoadEvent({
|
|
1690
1676
|
eventType: "load",
|
|
1691
|
-
modelContainer:
|
|
1692
|
-
}),
|
|
1677
|
+
modelContainer: n
|
|
1678
|
+
}), n;
|
|
1693
1679
|
}
|
|
1694
1680
|
async preloadModel(e) {
|
|
1695
|
-
await
|
|
1681
|
+
await k(e, this.scene);
|
|
1696
1682
|
}
|
|
1697
1683
|
getAllModels() {
|
|
1698
1684
|
return Array.from(this.modelContainers.values());
|
|
@@ -1709,13 +1695,13 @@ class Yt {
|
|
|
1709
1695
|
}
|
|
1710
1696
|
unregisterPlugin(e) {
|
|
1711
1697
|
const t = this.plugins.indexOf(e);
|
|
1712
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1698
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1713
1699
|
}
|
|
1714
1700
|
getGlowLayerManager() {
|
|
1715
1701
|
return this.glowLayerManager;
|
|
1716
1702
|
}
|
|
1717
1703
|
modelUnloaded(e) {
|
|
1718
|
-
this.modelContainers.delete(e.getId()), this.triggerModelLoadEvent({
|
|
1704
|
+
console.log(`unloaded ${e.getId()}`), this.modelContainers.delete(e.getId()), this.triggerModelLoadEvent({
|
|
1719
1705
|
eventType: "unload",
|
|
1720
1706
|
modelContainer: e
|
|
1721
1707
|
});
|
|
@@ -1727,31 +1713,31 @@ class Yt {
|
|
|
1727
1713
|
* Flips a transform around the origin.
|
|
1728
1714
|
*/
|
|
1729
1715
|
flipTransform(e, t, i) {
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1716
|
+
const r = ae.Compose(
|
|
1717
|
+
L(i || { x: 1, y: 1, z: 1 }),
|
|
1732
1718
|
y.FromEulerVector(
|
|
1733
|
-
|
|
1719
|
+
L(t || { x: 0, y: 0, z: 0 })
|
|
1734
1720
|
),
|
|
1735
|
-
|
|
1736
|
-
),
|
|
1721
|
+
L(e || { x: 0, y: 0, z: 0 })
|
|
1722
|
+
), n = ae.RotationAxis(p.Up(), Math.PI), o = r.multiply(n), a = p.Zero(), h = y.Identity(), l = p.Zero();
|
|
1737
1723
|
return o.decompose(l, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1738
|
-
position:
|
|
1739
|
-
rotation:
|
|
1740
|
-
scale:
|
|
1724
|
+
position: I(a),
|
|
1725
|
+
rotation: I(h.toEulerAngles()),
|
|
1726
|
+
scale: I(l)
|
|
1741
1727
|
};
|
|
1742
1728
|
}
|
|
1743
1729
|
updatePreviewOptions(e) {
|
|
1744
|
-
var
|
|
1730
|
+
var r, n;
|
|
1745
1731
|
const t = new ce(e);
|
|
1746
1732
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1747
1733
|
let i = this.scene.environmentTexture;
|
|
1748
|
-
this.configuration.scene.environment.file !== t.scene.environment.file && (i =
|
|
1734
|
+
this.configuration.scene.environment.file !== t.scene.environment.file && (i = se.CreateFromPrefilteredData(
|
|
1749
1735
|
t.scene.environment.file,
|
|
1750
1736
|
this.scene
|
|
1751
|
-
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (
|
|
1737
|
+
), i.name = "updated-environment-cube", i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1752
1738
|
t.options.renderingPipelineConfiguration
|
|
1753
1739
|
) : (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(
|
|
1754
|
-
((
|
|
1740
|
+
((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1755
1741
|
), this.configuration = t;
|
|
1756
1742
|
}
|
|
1757
1743
|
/**
|
|
@@ -1769,10 +1755,10 @@ class Yt {
|
|
|
1769
1755
|
}
|
|
1770
1756
|
}
|
|
1771
1757
|
export {
|
|
1772
|
-
|
|
1773
|
-
|
|
1758
|
+
S as MaterialEffectMode,
|
|
1759
|
+
F as ProductCameraRig,
|
|
1774
1760
|
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1775
|
-
|
|
1776
|
-
|
|
1761
|
+
x as RenderingConfiguration,
|
|
1762
|
+
$t as SpiffCommerce3DPreviewService,
|
|
1777
1763
|
d as renderingPipelineDefaults
|
|
1778
1764
|
};
|