@spiffcommerce/preview 5.7.9-0 → 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 +293 -306
- 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,89 +410,68 @@ class Ge {
|
|
|
402
410
|
}
|
|
403
411
|
}
|
|
404
412
|
}
|
|
405
|
-
function He(
|
|
406
|
-
t.forEach((
|
|
407
|
-
const o =
|
|
408
|
-
|
|
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) => {
|
|
409
417
|
const m = i.get(o), u = !1;
|
|
410
418
|
if (m)
|
|
411
419
|
de(c, m), m.update(u);
|
|
412
420
|
else {
|
|
413
|
-
const g =
|
|
421
|
+
const g = Ue(
|
|
414
422
|
a,
|
|
415
423
|
e,
|
|
416
424
|
h.width,
|
|
417
425
|
h.height
|
|
418
426
|
);
|
|
419
|
-
i.set(o, g),
|
|
427
|
+
i.set(o, g), n.setStaticContext(
|
|
420
428
|
g.getContext()
|
|
421
429
|
), de(c, g), g.onLoadObservable.addOnce(() => {
|
|
422
430
|
g.update(u);
|
|
423
431
|
});
|
|
424
432
|
}
|
|
425
433
|
});
|
|
426
|
-
}), Ue(e);
|
|
427
|
-
}
|
|
428
|
-
const Ue = (r) => {
|
|
429
|
-
const e = () => r.textures.reduce((i, n) => {
|
|
430
|
-
var o;
|
|
431
|
-
return !r.meshes.some(
|
|
432
|
-
(a) => a.material && a.material.hasTexture(n)
|
|
433
|
-
) && !((o = n == null ? void 0 : n.url) != null && o.includes("data:")) && i.push(n), i;
|
|
434
|
-
}, []), t = () => r.materials.reduce((i, n) => (n.getBindedMeshes().length == 0 && i.push(n), i), []);
|
|
435
|
-
e().forEach((i) => {
|
|
436
|
-
try {
|
|
437
|
-
i.dispose();
|
|
438
|
-
} catch {
|
|
439
|
-
console.log(`Failed to dispose texture ${i.name}`);
|
|
440
|
-
}
|
|
441
|
-
}), t().forEach((i) => {
|
|
442
|
-
try {
|
|
443
|
-
i.dispose(!0, !0);
|
|
444
|
-
} catch {
|
|
445
|
-
console.log(`Failed to dispose material ${i.name}`);
|
|
446
|
-
}
|
|
447
434
|
});
|
|
448
|
-
}
|
|
449
|
-
function
|
|
450
|
-
const
|
|
451
|
-
|
|
435
|
+
}
|
|
436
|
+
function Ue(s, e, t, i) {
|
|
437
|
+
const r = new Be(
|
|
438
|
+
s,
|
|
452
439
|
{ width: t, height: i },
|
|
453
440
|
e,
|
|
454
|
-
|
|
441
|
+
x.shouldMipMap(),
|
|
455
442
|
De.TRILINEAR_SAMPLINGMODE,
|
|
456
443
|
be.TEXTUREFORMAT_RGBA
|
|
457
|
-
),
|
|
458
|
-
return
|
|
444
|
+
), n = r.getContext();
|
|
445
|
+
return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
|
|
459
446
|
}
|
|
460
|
-
function de(
|
|
461
|
-
if (
|
|
462
|
-
const t =
|
|
447
|
+
function de(s, e) {
|
|
448
|
+
if (s instanceof D) {
|
|
449
|
+
const t = s, i = t.albedoTexture;
|
|
463
450
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
464
451
|
} else {
|
|
465
|
-
const t =
|
|
452
|
+
const t = s, i = t.diffuseTexture;
|
|
466
453
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
467
454
|
}
|
|
468
455
|
}
|
|
469
|
-
function
|
|
470
|
-
const
|
|
471
|
-
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();
|
|
472
459
|
}
|
|
473
460
|
const A = 60, ue = 1;
|
|
474
|
-
function me(
|
|
475
|
-
return
|
|
461
|
+
function me(s) {
|
|
462
|
+
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
476
463
|
}
|
|
477
|
-
function ve(
|
|
478
|
-
const o =
|
|
464
|
+
function ve(s, e, t, i, r, n) {
|
|
465
|
+
const o = r ? s.filter((c) => c.name === r) : s;
|
|
479
466
|
if (o.length === 0) {
|
|
480
|
-
console.warn(`No animations found for name: ${
|
|
467
|
+
console.warn(`No animations found for name: ${r}`);
|
|
481
468
|
return;
|
|
482
469
|
}
|
|
483
470
|
let a = 0;
|
|
484
471
|
const h = () => {
|
|
485
|
-
a++, a === o.length &&
|
|
472
|
+
a++, a === o.length && n && n();
|
|
486
473
|
}, l = (c, m, u, g, f) => {
|
|
487
|
-
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(() => {
|
|
488
475
|
h();
|
|
489
476
|
}) : c.onAnimationLoopObservable.addOnce(() => {
|
|
490
477
|
h();
|
|
@@ -502,11 +489,11 @@ function ve(r, e, t, i, n, s) {
|
|
|
502
489
|
l(c, e, ue, u, g);
|
|
503
490
|
});
|
|
504
491
|
}
|
|
505
|
-
function
|
|
492
|
+
function $e(s, e, t) {
|
|
506
493
|
return new Promise((i) => {
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
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(
|
|
510
497
|
P(
|
|
511
498
|
"cameraTargetLerp",
|
|
512
499
|
"target",
|
|
@@ -519,7 +506,7 @@ function Ye(r, e, t) {
|
|
|
519
506
|
v.ANIMATIONTYPE_VECTOR3,
|
|
520
507
|
o
|
|
521
508
|
)
|
|
522
|
-
),
|
|
509
|
+
), r.push(
|
|
523
510
|
P(
|
|
524
511
|
"cameraAlphaLerp",
|
|
525
512
|
"alpha",
|
|
@@ -528,7 +515,7 @@ function Ye(r, e, t) {
|
|
|
528
515
|
v.ANIMATIONTYPE_FLOAT,
|
|
529
516
|
a
|
|
530
517
|
)
|
|
531
|
-
),
|
|
518
|
+
), r.push(
|
|
532
519
|
P(
|
|
533
520
|
"cameraBetaLerp",
|
|
534
521
|
"beta",
|
|
@@ -539,7 +526,7 @@ function Ye(r, e, t) {
|
|
|
539
526
|
)
|
|
540
527
|
), t.radius !== void 0) {
|
|
541
528
|
const c = Math.max(0.01, t.radius);
|
|
542
|
-
|
|
529
|
+
r.push(
|
|
543
530
|
P(
|
|
544
531
|
"cameraRadiusLerp",
|
|
545
532
|
"radius",
|
|
@@ -550,12 +537,12 @@ function Ye(r, e, t) {
|
|
|
550
537
|
)
|
|
551
538
|
);
|
|
552
539
|
}
|
|
553
|
-
e.animations.push(...
|
|
540
|
+
e.animations.push(...r);
|
|
554
541
|
const l = e.useAutoRotationBehavior;
|
|
555
|
-
e.disableAutoRotationBehavior(),
|
|
542
|
+
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
556
543
|
e,
|
|
557
544
|
0,
|
|
558
|
-
|
|
545
|
+
n ? A * 2 : A,
|
|
559
546
|
!1,
|
|
560
547
|
1,
|
|
561
548
|
() => {
|
|
@@ -564,33 +551,33 @@ function Ye(r, e, t) {
|
|
|
564
551
|
);
|
|
565
552
|
});
|
|
566
553
|
}
|
|
567
|
-
function ge(
|
|
568
|
-
return
|
|
554
|
+
function ge(s) {
|
|
555
|
+
return s * Math.PI / 180;
|
|
569
556
|
}
|
|
570
|
-
function P(
|
|
557
|
+
function P(s, e, t, i, r, n = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
571
558
|
const a = new ke();
|
|
572
559
|
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
573
560
|
const h = new v(
|
|
574
|
-
|
|
561
|
+
s,
|
|
575
562
|
e,
|
|
576
563
|
A,
|
|
577
|
-
|
|
564
|
+
r,
|
|
578
565
|
o
|
|
579
566
|
), l = [];
|
|
580
|
-
return
|
|
581
|
-
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),
|
|
582
569
|
value: i
|
|
583
570
|
}), h.setKeys(l), h.setEasingFunction(a), h;
|
|
584
571
|
}
|
|
585
|
-
function
|
|
586
|
-
return
|
|
572
|
+
function We(s, e, t) {
|
|
573
|
+
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
587
574
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
575
|
+
function Ye(s, e, t) {
|
|
576
|
+
s.forEach((i) => {
|
|
590
577
|
t && i.name !== t || i.goToFrame(e);
|
|
591
578
|
});
|
|
592
579
|
}
|
|
593
|
-
const
|
|
580
|
+
const Qe = {
|
|
594
581
|
albedoTexture: "albedoMap",
|
|
595
582
|
bumpTexture: "normalMap",
|
|
596
583
|
ambientTexture: "ambientMap",
|
|
@@ -600,7 +587,7 @@ const Ze = {
|
|
|
600
587
|
refractionTexture: "refractionMap",
|
|
601
588
|
reflectionTexture: "reflectionMap"
|
|
602
589
|
};
|
|
603
|
-
function
|
|
590
|
+
function Ze(s, e, t, i) {
|
|
604
591
|
[
|
|
605
592
|
"albedoTexture",
|
|
606
593
|
"bumpTexture",
|
|
@@ -610,51 +597,51 @@ function je(r, e, t, i) {
|
|
|
610
597
|
"metallicTexture",
|
|
611
598
|
"refractionTexture",
|
|
612
599
|
"reflectionTexture"
|
|
613
|
-
].forEach((
|
|
614
|
-
|
|
600
|
+
].forEach((n) => {
|
|
601
|
+
je(
|
|
602
|
+
n,
|
|
615
603
|
s,
|
|
616
|
-
r,
|
|
617
604
|
e,
|
|
618
605
|
t,
|
|
619
606
|
i
|
|
620
607
|
);
|
|
621
|
-
}),
|
|
608
|
+
}), et(s, e);
|
|
622
609
|
}
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
if (!
|
|
610
|
+
function je(s, e, t, i, r) {
|
|
611
|
+
const n = Qe[s];
|
|
612
|
+
if (!n)
|
|
626
613
|
throw new Error("Unexpected texture name encountered.");
|
|
627
|
-
const o = e[
|
|
628
|
-
a ?
|
|
629
|
-
|
|
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,
|
|
630
617
|
a,
|
|
631
618
|
void 0,
|
|
632
619
|
!1,
|
|
633
620
|
void 0,
|
|
634
621
|
!0
|
|
635
622
|
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
636
|
-
|
|
623
|
+
s,
|
|
637
624
|
a,
|
|
638
625
|
128,
|
|
639
626
|
!1,
|
|
640
627
|
!0,
|
|
641
628
|
!1
|
|
642
|
-
) : 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));
|
|
643
630
|
}
|
|
644
|
-
function
|
|
645
|
-
|
|
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);
|
|
646
633
|
}
|
|
647
|
-
function
|
|
634
|
+
function Je(s, e, t, i) {
|
|
648
635
|
if (!e) {
|
|
649
636
|
console.error("Failed to apply texture to material: material is null.");
|
|
650
637
|
return;
|
|
651
638
|
}
|
|
652
|
-
|
|
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);
|
|
653
640
|
}
|
|
654
|
-
function
|
|
655
|
-
|
|
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));
|
|
656
643
|
}
|
|
657
|
-
class
|
|
644
|
+
class tt {
|
|
658
645
|
constructor(e, t, i) {
|
|
659
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;
|
|
660
647
|
}
|
|
@@ -667,8 +654,8 @@ class it {
|
|
|
667
654
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
668
655
|
* where we want to undo changes are remove effects from display.
|
|
669
656
|
*/
|
|
670
|
-
async applyMaterial(e, t, i,
|
|
671
|
-
return new Promise((
|
|
657
|
+
async applyMaterial(e, t, i, r) {
|
|
658
|
+
return new Promise((n) => {
|
|
672
659
|
const o = this.materialVariantMap.get(e);
|
|
673
660
|
this.materialVariantMap.set(e, {
|
|
674
661
|
...o,
|
|
@@ -678,16 +665,16 @@ class it {
|
|
|
678
665
|
(c) => c.name === a
|
|
679
666
|
);
|
|
680
667
|
if (h.length === 0) {
|
|
681
|
-
|
|
668
|
+
n();
|
|
682
669
|
return;
|
|
683
670
|
}
|
|
684
671
|
const l = new Ne(this.scene);
|
|
685
672
|
l.useDefaultLoadingScreen = !1, h.forEach(
|
|
686
|
-
(c) =>
|
|
673
|
+
(c) => Ze(
|
|
687
674
|
t,
|
|
688
675
|
c,
|
|
689
676
|
l,
|
|
690
|
-
|
|
677
|
+
r
|
|
691
678
|
)
|
|
692
679
|
), l.onProgress = (c, m, u) => {
|
|
693
680
|
i && i(c / m * 100, 100, u.name);
|
|
@@ -696,15 +683,15 @@ class it {
|
|
|
696
683
|
const u = m;
|
|
697
684
|
i && i(100, 100, m.name), this.scene.materials.filter(
|
|
698
685
|
(f) => f.name === a
|
|
699
|
-
).forEach(
|
|
700
|
-
(
|
|
686
|
+
).forEach((f) => {
|
|
687
|
+
Je(
|
|
701
688
|
m.name,
|
|
702
689
|
f,
|
|
703
690
|
t,
|
|
704
691
|
u.texture
|
|
705
|
-
)
|
|
706
|
-
);
|
|
707
|
-
}),
|
|
692
|
+
);
|
|
693
|
+
});
|
|
694
|
+
}), n();
|
|
708
695
|
}, l.loadAsync();
|
|
709
696
|
});
|
|
710
697
|
}
|
|
@@ -718,27 +705,27 @@ class it {
|
|
|
718
705
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
719
706
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
720
707
|
*/
|
|
721
|
-
async applyModel(e, t, i,
|
|
708
|
+
async applyModel(e, t, i, r, n, o, a) {
|
|
722
709
|
var m;
|
|
723
710
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
724
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(
|
|
725
712
|
(u) => u !== e
|
|
726
713
|
), Promise.resolve(void 0);
|
|
727
|
-
const l = (await
|
|
714
|
+
const l = (await k(i, this.scene, r)).instantiateModelsToScene(
|
|
728
715
|
this.renameClonedAsset,
|
|
729
716
|
!0
|
|
730
717
|
);
|
|
731
|
-
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)),
|
|
732
|
-
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;
|
|
733
720
|
if (ve(
|
|
734
721
|
l.animationGroups,
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
722
|
+
n.loop,
|
|
723
|
+
n.to,
|
|
724
|
+
n.from,
|
|
738
725
|
g
|
|
739
726
|
), u != null) {
|
|
740
727
|
const f = a && a() || !0;
|
|
741
|
-
|
|
728
|
+
Ye(
|
|
742
729
|
l.animationGroups,
|
|
743
730
|
u + (f ? 2 : 0),
|
|
744
731
|
g
|
|
@@ -771,36 +758,36 @@ class it {
|
|
|
771
758
|
}), e;
|
|
772
759
|
}
|
|
773
760
|
}
|
|
774
|
-
function we(
|
|
761
|
+
function we(s) {
|
|
775
762
|
const e = [];
|
|
776
|
-
return
|
|
763
|
+
return s.rootNodes.forEach((t) => {
|
|
777
764
|
t.getChildMeshes().forEach((i) => {
|
|
778
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
779
|
-
const
|
|
780
|
-
|
|
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);
|
|
781
768
|
});
|
|
782
769
|
});
|
|
783
770
|
}), e;
|
|
784
771
|
}
|
|
785
|
-
function pe(
|
|
786
|
-
return
|
|
772
|
+
function pe(s, e = "") {
|
|
773
|
+
return s.map((t) => ({
|
|
787
774
|
name: t.name.substring(e.length),
|
|
788
775
|
loop: t.loopAnimation,
|
|
789
776
|
to: t.to,
|
|
790
777
|
from: t.from
|
|
791
778
|
}));
|
|
792
779
|
}
|
|
793
|
-
class
|
|
780
|
+
class it {
|
|
794
781
|
constructor(e) {
|
|
795
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 = [];
|
|
796
783
|
const {
|
|
797
784
|
enablePicking: t,
|
|
798
785
|
modelDetails: i,
|
|
799
|
-
previewService:
|
|
800
|
-
progressHandler:
|
|
786
|
+
previewService: r,
|
|
787
|
+
progressHandler: n,
|
|
801
788
|
scene: o
|
|
802
789
|
} = e;
|
|
803
|
-
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(
|
|
804
791
|
o,
|
|
805
792
|
this.renameClonedAsset.bind(this),
|
|
806
793
|
this.setBaseModelEnabled.bind(this)
|
|
@@ -810,16 +797,16 @@ class nt {
|
|
|
810
797
|
throw new Error(
|
|
811
798
|
"Model container constructed with no URL. This is currently unsupported."
|
|
812
799
|
);
|
|
813
|
-
return this.assetContainer = await
|
|
800
|
+
return this.assetContainer = await k(
|
|
814
801
|
i.model,
|
|
815
802
|
o,
|
|
816
|
-
|
|
803
|
+
n
|
|
817
804
|
), await this.instantiate(), this;
|
|
818
805
|
};
|
|
819
806
|
this.importPromise = a();
|
|
820
807
|
}
|
|
821
808
|
//#region Interface implementation
|
|
822
|
-
async applyMaterialVariant(e, t, i,
|
|
809
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
823
810
|
if (!this.initialized) {
|
|
824
811
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
825
812
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -830,7 +817,7 @@ class nt {
|
|
|
830
817
|
e,
|
|
831
818
|
t,
|
|
832
819
|
i,
|
|
833
|
-
|
|
820
|
+
r
|
|
834
821
|
)
|
|
835
822
|
);
|
|
836
823
|
} else {
|
|
@@ -846,13 +833,13 @@ class nt {
|
|
|
846
833
|
e,
|
|
847
834
|
t,
|
|
848
835
|
i,
|
|
849
|
-
|
|
836
|
+
r
|
|
850
837
|
)
|
|
851
838
|
);
|
|
852
839
|
}
|
|
853
840
|
return;
|
|
854
841
|
}
|
|
855
|
-
const
|
|
842
|
+
const n = async () => {
|
|
856
843
|
await this.variantManager.applyMaterial(
|
|
857
844
|
e,
|
|
858
845
|
i,
|
|
@@ -863,24 +850,24 @@ class nt {
|
|
|
863
850
|
taskName: h
|
|
864
851
|
});
|
|
865
852
|
},
|
|
866
|
-
|
|
853
|
+
r
|
|
867
854
|
);
|
|
868
855
|
};
|
|
869
856
|
if (this.materialChangesInProgress.includes(e)) {
|
|
870
857
|
if (this.queuedMaterialChanges.has(e)) {
|
|
871
858
|
const o = this.queuedMaterialChanges.get(e);
|
|
872
|
-
o == null || o.set(t,
|
|
859
|
+
o == null || o.set(t, n);
|
|
873
860
|
} else {
|
|
874
861
|
this.queuedMaterialChanges.set(
|
|
875
862
|
e,
|
|
876
863
|
/* @__PURE__ */ new Map()
|
|
877
864
|
);
|
|
878
865
|
const o = this.queuedMaterialChanges.get(e);
|
|
879
|
-
o == null || o.set(t,
|
|
866
|
+
o == null || o.set(t, n);
|
|
880
867
|
}
|
|
881
868
|
return;
|
|
882
869
|
}
|
|
883
|
-
if (this.materialChangesInProgress.push(e), await
|
|
870
|
+
if (this.materialChangesInProgress.push(e), await n(), this.queuedMaterialChanges.has(e)) {
|
|
884
871
|
const o = this.queuedMaterialChanges.get(e);
|
|
885
872
|
if (!o)
|
|
886
873
|
throw new Error("Target material is undefined");
|
|
@@ -906,7 +893,7 @@ class nt {
|
|
|
906
893
|
);
|
|
907
894
|
return;
|
|
908
895
|
}
|
|
909
|
-
const
|
|
896
|
+
const r = () => this.variantManager.applyModel(
|
|
910
897
|
e,
|
|
911
898
|
i,
|
|
912
899
|
t == null ? void 0 : t.model,
|
|
@@ -921,12 +908,12 @@ class nt {
|
|
|
921
908
|
this.getAnimationIsPlaying.bind(this)
|
|
922
909
|
);
|
|
923
910
|
if (this.modelChangesInProgress.includes(e)) {
|
|
924
|
-
this.queuedModelChanges.set(e,
|
|
911
|
+
this.queuedModelChanges.set(e, r);
|
|
925
912
|
return;
|
|
926
913
|
}
|
|
927
914
|
const o = await (async () => {
|
|
928
915
|
this.modelChangesInProgress.push(e);
|
|
929
|
-
let a = await
|
|
916
|
+
let a = await r();
|
|
930
917
|
if (this.queuedModelChanges.has(e)) {
|
|
931
918
|
const h = this.queuedModelChanges.get(e);
|
|
932
919
|
if (!h)
|
|
@@ -950,24 +937,24 @@ class nt {
|
|
|
950
937
|
let t = () => {
|
|
951
938
|
};
|
|
952
939
|
const i = async () => {
|
|
953
|
-
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((
|
|
940
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
954
941
|
var o;
|
|
955
|
-
const
|
|
942
|
+
const n = [
|
|
956
943
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
957
944
|
...this.variantManager.getAnimationGroups()
|
|
958
945
|
];
|
|
959
946
|
ve(
|
|
960
|
-
|
|
947
|
+
n,
|
|
961
948
|
e.loop,
|
|
962
949
|
e.to,
|
|
963
950
|
e.from,
|
|
964
951
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
965
|
-
|
|
952
|
+
r
|
|
966
953
|
);
|
|
967
954
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
968
955
|
};
|
|
969
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
970
|
-
t =
|
|
956
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
957
|
+
t = r;
|
|
971
958
|
})) : i();
|
|
972
959
|
}
|
|
973
960
|
getAnimations(e) {
|
|
@@ -977,7 +964,7 @@ class nt {
|
|
|
977
964
|
this.variantManager.getAnimationGroups(),
|
|
978
965
|
this.renameClonedAsset("")
|
|
979
966
|
) : []
|
|
980
|
-
].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);
|
|
981
968
|
}
|
|
982
969
|
getId() {
|
|
983
970
|
return this.id;
|
|
@@ -1044,15 +1031,15 @@ class nt {
|
|
|
1044
1031
|
attachPickingHandler(e) {
|
|
1045
1032
|
e.rootNodes.forEach((t) => {
|
|
1046
1033
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1047
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
|
|
1048
|
-
new
|
|
1049
|
-
|
|
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({
|
|
1050
1037
|
id: i.material.id,
|
|
1051
1038
|
name: this.stripIdFromName(i.material.name)
|
|
1052
1039
|
});
|
|
1053
1040
|
})
|
|
1054
1041
|
), i.actionManager.registerAction(
|
|
1055
|
-
new
|
|
1042
|
+
new le(R.OnPointerOutTrigger, () => {
|
|
1056
1043
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
1057
1044
|
id: i.material.id,
|
|
1058
1045
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1081,23 +1068,23 @@ class nt {
|
|
|
1081
1068
|
return this.modelReadyToLoadCallbacks.size;
|
|
1082
1069
|
}
|
|
1083
1070
|
configureGlowLayer() {
|
|
1084
|
-
const e = (i) => i instanceof
|
|
1071
|
+
const e = (i) => i instanceof D && i.emissiveTexture !== null;
|
|
1085
1072
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1086
1073
|
}
|
|
1087
1074
|
configureModelInstance(e) {
|
|
1088
|
-
var
|
|
1075
|
+
var n;
|
|
1089
1076
|
if (!this.transformRoot)
|
|
1090
1077
|
throw new Error(
|
|
1091
1078
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1092
1079
|
);
|
|
1093
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1080
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1094
1081
|
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1095
1082
|
for (const o of e.rootNodes) {
|
|
1096
1083
|
o.parent = this.transformRoot;
|
|
1097
1084
|
for (const a of o.getChildMeshes(!1))
|
|
1098
1085
|
a.alwaysSelectAsActiveMesh = !0;
|
|
1099
1086
|
}
|
|
1100
|
-
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(
|
|
1101
1088
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1102
1089
|
this.scene,
|
|
1103
1090
|
this.canvasPanels,
|
|
@@ -1141,8 +1128,8 @@ class nt {
|
|
|
1141
1128
|
var e;
|
|
1142
1129
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1143
1130
|
(t, i) => {
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1131
|
+
const r = this.dynamicTextures.get(i);
|
|
1132
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1146
1133
|
}
|
|
1147
1134
|
);
|
|
1148
1135
|
}
|
|
@@ -1200,14 +1187,14 @@ class nt {
|
|
|
1200
1187
|
}
|
|
1201
1188
|
//#endregion
|
|
1202
1189
|
}
|
|
1203
|
-
class
|
|
1204
|
-
constructor(e, t, i,
|
|
1190
|
+
class z extends fe {
|
|
1191
|
+
constructor(e, t, i, r, n, o, a, h) {
|
|
1205
1192
|
super(
|
|
1206
1193
|
e,
|
|
1207
1194
|
t,
|
|
1208
1195
|
i,
|
|
1196
|
+
r,
|
|
1209
1197
|
n,
|
|
1210
|
-
s,
|
|
1211
1198
|
o,
|
|
1212
1199
|
h
|
|
1213
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(
|
|
@@ -1251,7 +1238,7 @@ class k extends fe {
|
|
|
1251
1238
|
this.useFramingBehavior = !0;
|
|
1252
1239
|
const e = this.getFramingBehavior();
|
|
1253
1240
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1254
|
-
const t =
|
|
1241
|
+
const t = O(this._scene);
|
|
1255
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;
|
|
1256
1243
|
}
|
|
1257
1244
|
/**
|
|
@@ -1263,14 +1250,14 @@ class k extends fe {
|
|
|
1263
1250
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1264
1251
|
const i = this.getFramingBehavior();
|
|
1265
1252
|
i.framingTime = t || 800;
|
|
1266
|
-
const
|
|
1253
|
+
const r = () => {
|
|
1267
1254
|
this.isRunningFramingBehavior = !1;
|
|
1268
|
-
},
|
|
1255
|
+
}, n = O(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
|
|
1269
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(
|
|
1270
|
-
|
|
1271
|
-
|
|
1257
|
+
n.min,
|
|
1258
|
+
n.max,
|
|
1272
1259
|
void 0,
|
|
1273
|
-
|
|
1260
|
+
r
|
|
1274
1261
|
), i.framingTime = 0;
|
|
1275
1262
|
}
|
|
1276
1263
|
/**
|
|
@@ -1302,32 +1289,32 @@ class k extends fe {
|
|
|
1302
1289
|
*/
|
|
1303
1290
|
static create(e, t, i) {
|
|
1304
1291
|
var h;
|
|
1305
|
-
const
|
|
1292
|
+
const r = O(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new z(
|
|
1306
1293
|
"ProductCamera",
|
|
1307
1294
|
-(Math.PI / 2),
|
|
1308
1295
|
Math.PI / 2,
|
|
1309
|
-
|
|
1296
|
+
n.length() * 1.5,
|
|
1310
1297
|
o,
|
|
1311
1298
|
e,
|
|
1312
1299
|
t
|
|
1313
1300
|
);
|
|
1314
1301
|
return a.setPanEnabled(
|
|
1315
1302
|
((h = t.options) == null ? void 0 : h.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1316
|
-
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator =
|
|
1303
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1317
1304
|
a.setPanEnabled(a.panEnabled);
|
|
1318
1305
|
}), i && (e.activeCamera = a), a;
|
|
1319
1306
|
}
|
|
1320
1307
|
}
|
|
1321
|
-
function
|
|
1322
|
-
if (
|
|
1308
|
+
function O(s) {
|
|
1309
|
+
if (s.meshes.length === 0)
|
|
1323
1310
|
return {
|
|
1324
1311
|
min: new p(-1, -1, -1),
|
|
1325
1312
|
max: new p(1, 1, 1)
|
|
1326
1313
|
};
|
|
1327
|
-
const e =
|
|
1328
|
-
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)));
|
|
1329
1316
|
}
|
|
1330
|
-
class
|
|
1317
|
+
class nt {
|
|
1331
1318
|
constructor(e, t = !1, i = void 0) {
|
|
1332
1319
|
this.renderingPipeline = new qe(
|
|
1333
1320
|
"default",
|
|
@@ -1345,15 +1332,15 @@ class st {
|
|
|
1345
1332
|
return this.currentConfiguration;
|
|
1346
1333
|
}
|
|
1347
1334
|
setConfiguration(e) {
|
|
1348
|
-
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;
|
|
1349
1336
|
if (this.renderingPipeline.isSupported) {
|
|
1350
|
-
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(
|
|
1351
1338
|
e.chromaticAberration.direction.x,
|
|
1352
1339
|
e.chromaticAberration.direction.y
|
|
1353
|
-
) : new
|
|
1340
|
+
) : new re(
|
|
1354
1341
|
d.chromaticAberration.direction.x,
|
|
1355
1342
|
d.chromaticAberration.direction.y
|
|
1356
|
-
), 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)
|
|
1357
1344
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1358
1345
|
case "Low":
|
|
1359
1346
|
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
@@ -1365,58 +1352,58 @@ class st {
|
|
|
1365
1352
|
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1366
1353
|
break;
|
|
1367
1354
|
}
|
|
1368
|
-
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)
|
|
1369
1356
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1370
1357
|
case "Standard":
|
|
1371
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1358
|
+
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_STANDARD;
|
|
1372
1359
|
break;
|
|
1373
1360
|
case "ACES":
|
|
1374
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1361
|
+
this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_ACES;
|
|
1375
1362
|
break;
|
|
1376
1363
|
}
|
|
1377
|
-
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 = ((
|
|
1378
|
-
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) {
|
|
1379
1366
|
case "Multiply":
|
|
1380
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1367
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_MULTIPLY;
|
|
1381
1368
|
break;
|
|
1382
1369
|
case "Opaque":
|
|
1383
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1370
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_OPAQUE;
|
|
1384
1371
|
break;
|
|
1385
1372
|
}
|
|
1386
|
-
(
|
|
1373
|
+
(ee = e.vignette) != null && ee.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1387
1374
|
e.vignette.colorRgba.r,
|
|
1388
1375
|
e.vignette.colorRgba.g,
|
|
1389
1376
|
e.vignette.colorRgba.b,
|
|
1390
1377
|
e.vignette.colorRgba.a
|
|
1391
|
-
) : (
|
|
1378
|
+
) : (te = e.vignette) != null && te.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1392
1379
|
d.vignette.colorRgba.r,
|
|
1393
1380
|
d.vignette.colorRgba.g,
|
|
1394
1381
|
d.vignette.colorRgba.b,
|
|
1395
1382
|
d.vignette.colorRgba.a
|
|
1396
|
-
), 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;
|
|
1397
1384
|
}
|
|
1398
1385
|
}
|
|
1399
1386
|
updateColorCurve(e) {
|
|
1400
|
-
const t = new
|
|
1387
|
+
const t = new he();
|
|
1401
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;
|
|
1402
1389
|
}
|
|
1403
1390
|
}
|
|
1404
|
-
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1405
|
-
return new _e(
|
|
1391
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1392
|
+
return new _e(s);
|
|
1406
1393
|
});
|
|
1407
|
-
|
|
1408
|
-
if (
|
|
1409
|
-
const e =
|
|
1394
|
+
B.OnPluginActivatedObservable.add((s) => {
|
|
1395
|
+
if (s.name === "gltf") {
|
|
1396
|
+
const e = s;
|
|
1410
1397
|
e.transparencyAsCoverage = !0;
|
|
1411
1398
|
}
|
|
1412
1399
|
});
|
|
1413
|
-
function
|
|
1414
|
-
return new p(
|
|
1400
|
+
function L(s) {
|
|
1401
|
+
return new p(s.x, s.y, s.z);
|
|
1415
1402
|
}
|
|
1416
|
-
function
|
|
1417
|
-
return { x:
|
|
1403
|
+
function I(s) {
|
|
1404
|
+
return { x: s.x, y: s.y, z: s.z };
|
|
1418
1405
|
}
|
|
1419
|
-
class
|
|
1406
|
+
class $t {
|
|
1420
1407
|
constructor(e) {
|
|
1421
1408
|
var h;
|
|
1422
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 = () => {
|
|
@@ -1443,15 +1430,15 @@ class Yt {
|
|
|
1443
1430
|
const i = (() => {
|
|
1444
1431
|
if (!(e != null && e.noRender))
|
|
1445
1432
|
return this.configuration.createCanvas();
|
|
1446
|
-
})(),
|
|
1433
|
+
})(), r = "1.5.6";
|
|
1447
1434
|
Ae.Configuration = {
|
|
1448
1435
|
decoder: {
|
|
1449
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1450
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1451
|
-
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`
|
|
1452
1439
|
}
|
|
1453
1440
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1454
|
-
const
|
|
1441
|
+
const n = console.log;
|
|
1455
1442
|
console.log = () => {
|
|
1456
1443
|
};
|
|
1457
1444
|
const o = i ? new be(i, !0, {
|
|
@@ -1463,16 +1450,16 @@ class Yt {
|
|
|
1463
1450
|
stencil: this.configuration.highlights.enabled,
|
|
1464
1451
|
forceSRGBBufferSupportState: !0
|
|
1465
1452
|
}) : new Ce();
|
|
1466
|
-
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(
|
|
1467
1454
|
this.scene,
|
|
1468
1455
|
!1,
|
|
1469
1456
|
this.camera
|
|
1470
1457
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1471
|
-
const a =
|
|
1458
|
+
const a = se.CreateFromPrefilteredData(
|
|
1472
1459
|
this.configuration.scene.environment.file,
|
|
1473
1460
|
this.scene
|
|
1474
1461
|
);
|
|
1475
|
-
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(
|
|
1476
1463
|
this.configuration.options.renderingPipelineConfiguration
|
|
1477
1464
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
|
|
1478
1465
|
this.scene,
|
|
@@ -1511,7 +1498,7 @@ class Yt {
|
|
|
1511
1498
|
}
|
|
1512
1499
|
registerView(e) {
|
|
1513
1500
|
const t = e.height, i = e.width;
|
|
1514
|
-
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);
|
|
1515
1502
|
}
|
|
1516
1503
|
getNumViewports() {
|
|
1517
1504
|
var e;
|
|
@@ -1524,19 +1511,19 @@ class Yt {
|
|
|
1524
1511
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1525
1512
|
}
|
|
1526
1513
|
executeCameraAnimation(e) {
|
|
1527
|
-
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()))
|
|
1528
1515
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1529
1516
|
let t = () => {
|
|
1530
1517
|
};
|
|
1531
1518
|
const i = async () => {
|
|
1532
|
-
this.isAnimatingCamera = !0, await
|
|
1519
|
+
this.isAnimatingCamera = !0, await $e(
|
|
1533
1520
|
this.scene,
|
|
1534
1521
|
this.scene.activeCamera,
|
|
1535
1522
|
e
|
|
1536
1523
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1537
1524
|
};
|
|
1538
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1539
|
-
t =
|
|
1525
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1526
|
+
t = r;
|
|
1540
1527
|
})) : i();
|
|
1541
1528
|
}
|
|
1542
1529
|
getCameraPose() {
|
|
@@ -1565,7 +1552,7 @@ class Yt {
|
|
|
1565
1552
|
throw new Error(
|
|
1566
1553
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1567
1554
|
);
|
|
1568
|
-
e ===
|
|
1555
|
+
e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1569
1556
|
}
|
|
1570
1557
|
animateToLastCameraFocus() {
|
|
1571
1558
|
let e = () => {
|
|
@@ -1573,13 +1560,13 @@ class Yt {
|
|
|
1573
1560
|
const t = async () => {
|
|
1574
1561
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1575
1562
|
this.focusLostNotified = !1;
|
|
1576
|
-
const
|
|
1577
|
-
const
|
|
1563
|
+
const r = () => {
|
|
1564
|
+
const n = this.configuration;
|
|
1578
1565
|
this.camera.rerunFramingBehavior(() => {
|
|
1579
|
-
|
|
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();
|
|
1580
1567
|
});
|
|
1581
1568
|
};
|
|
1582
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1569
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1583
1570
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1584
1571
|
};
|
|
1585
1572
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1610,9 +1597,9 @@ class Yt {
|
|
|
1610
1597
|
this.scene
|
|
1611
1598
|
);
|
|
1612
1599
|
try {
|
|
1613
|
-
const
|
|
1614
|
-
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha =
|
|
1615
|
-
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(
|
|
1616
1603
|
this.engine,
|
|
1617
1604
|
i,
|
|
1618
1605
|
e,
|
|
@@ -1629,26 +1616,26 @@ class Yt {
|
|
|
1629
1616
|
const e = this.configuration;
|
|
1630
1617
|
if (!e)
|
|
1631
1618
|
return !0;
|
|
1632
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1633
|
-
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)
|
|
1634
1621
|
return !0;
|
|
1635
|
-
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);
|
|
1636
1623
|
return !h && !l;
|
|
1637
1624
|
}
|
|
1638
1625
|
fireResizeEvent() {
|
|
1639
1626
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1640
1627
|
}
|
|
1641
1628
|
setHighlights(e, t) {
|
|
1642
|
-
var
|
|
1643
|
-
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, {
|
|
1644
1631
|
isStroke: !0,
|
|
1645
1632
|
blurVerticalSize: 0.85,
|
|
1646
1633
|
blurHorizontalSize: 0.85
|
|
1647
1634
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1648
1635
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1649
|
-
e.forEach((
|
|
1636
|
+
e.forEach((n) => {
|
|
1650
1637
|
const o = this.scene.materials.find(
|
|
1651
|
-
(a) => a.name ===
|
|
1638
|
+
(a) => a.name === n.name && a.id === n.id
|
|
1652
1639
|
);
|
|
1653
1640
|
o && o.getBindedMeshes().forEach(
|
|
1654
1641
|
(a) => {
|
|
@@ -1665,14 +1652,14 @@ class Yt {
|
|
|
1665
1652
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1666
1653
|
}
|
|
1667
1654
|
loadModel(e, t) {
|
|
1668
|
-
const { refocusCamera: i = !0, progressHandler:
|
|
1655
|
+
const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new it({
|
|
1669
1656
|
enablePicking: this.configuration.highlights.enabled,
|
|
1670
1657
|
modelDetails: e,
|
|
1671
1658
|
scene: this.scene,
|
|
1672
1659
|
previewService: this,
|
|
1673
|
-
progressHandler:
|
|
1660
|
+
progressHandler: r
|
|
1674
1661
|
});
|
|
1675
|
-
return
|
|
1662
|
+
return n.getInitializationPromise().then(() => {
|
|
1676
1663
|
if (this.modelContainers.size <= 1 && i) {
|
|
1677
1664
|
const o = this.queuedCameraAnimation;
|
|
1678
1665
|
this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
|
|
@@ -1681,17 +1668,17 @@ class Yt {
|
|
|
1681
1668
|
});
|
|
1682
1669
|
}, 1);
|
|
1683
1670
|
}
|
|
1684
|
-
}), this.configuration.highlights.enabled && (
|
|
1671
|
+
}), this.configuration.highlights.enabled && (n.registerMaterialSelectedCallback((o) => {
|
|
1685
1672
|
this.setHighlights([o]);
|
|
1686
|
-
}),
|
|
1673
|
+
}), n.registerMaterialDeselectedCallback(() => {
|
|
1687
1674
|
this.setHighlights([]);
|
|
1688
|
-
})), this.modelContainers.set(
|
|
1675
|
+
})), console.log(`loading model container ${n.getId()}`), this.modelContainers.set(n.getId(), n), this.triggerModelLoadEvent({
|
|
1689
1676
|
eventType: "load",
|
|
1690
|
-
modelContainer:
|
|
1691
|
-
}),
|
|
1677
|
+
modelContainer: n
|
|
1678
|
+
}), n;
|
|
1692
1679
|
}
|
|
1693
1680
|
async preloadModel(e) {
|
|
1694
|
-
await
|
|
1681
|
+
await k(e, this.scene);
|
|
1695
1682
|
}
|
|
1696
1683
|
getAllModels() {
|
|
1697
1684
|
return Array.from(this.modelContainers.values());
|
|
@@ -1708,13 +1695,13 @@ class Yt {
|
|
|
1708
1695
|
}
|
|
1709
1696
|
unregisterPlugin(e) {
|
|
1710
1697
|
const t = this.plugins.indexOf(e);
|
|
1711
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1698
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1712
1699
|
}
|
|
1713
1700
|
getGlowLayerManager() {
|
|
1714
1701
|
return this.glowLayerManager;
|
|
1715
1702
|
}
|
|
1716
1703
|
modelUnloaded(e) {
|
|
1717
|
-
this.modelContainers.delete(e.getId()), this.triggerModelLoadEvent({
|
|
1704
|
+
console.log(`unloaded ${e.getId()}`), this.modelContainers.delete(e.getId()), this.triggerModelLoadEvent({
|
|
1718
1705
|
eventType: "unload",
|
|
1719
1706
|
modelContainer: e
|
|
1720
1707
|
});
|
|
@@ -1726,31 +1713,31 @@ class Yt {
|
|
|
1726
1713
|
* Flips a transform around the origin.
|
|
1727
1714
|
*/
|
|
1728
1715
|
flipTransform(e, t, i) {
|
|
1729
|
-
const
|
|
1730
|
-
|
|
1716
|
+
const r = ae.Compose(
|
|
1717
|
+
L(i || { x: 1, y: 1, z: 1 }),
|
|
1731
1718
|
y.FromEulerVector(
|
|
1732
|
-
|
|
1719
|
+
L(t || { x: 0, y: 0, z: 0 })
|
|
1733
1720
|
),
|
|
1734
|
-
|
|
1735
|
-
),
|
|
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();
|
|
1736
1723
|
return o.decompose(l, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1737
|
-
position:
|
|
1738
|
-
rotation:
|
|
1739
|
-
scale:
|
|
1724
|
+
position: I(a),
|
|
1725
|
+
rotation: I(h.toEulerAngles()),
|
|
1726
|
+
scale: I(l)
|
|
1740
1727
|
};
|
|
1741
1728
|
}
|
|
1742
1729
|
updatePreviewOptions(e) {
|
|
1743
|
-
var
|
|
1730
|
+
var r, n;
|
|
1744
1731
|
const t = new ce(e);
|
|
1745
1732
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1746
1733
|
let i = this.scene.environmentTexture;
|
|
1747
|
-
this.configuration.scene.environment.file !== t.scene.environment.file && (i =
|
|
1734
|
+
this.configuration.scene.environment.file !== t.scene.environment.file && (i = se.CreateFromPrefilteredData(
|
|
1748
1735
|
t.scene.environment.file,
|
|
1749
1736
|
this.scene
|
|
1750
|
-
), 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(
|
|
1751
1738
|
t.options.renderingPipelineConfiguration
|
|
1752
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(
|
|
1753
|
-
((
|
|
1740
|
+
((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1754
1741
|
), this.configuration = t;
|
|
1755
1742
|
}
|
|
1756
1743
|
/**
|
|
@@ -1768,10 +1755,10 @@ class Yt {
|
|
|
1768
1755
|
}
|
|
1769
1756
|
}
|
|
1770
1757
|
export {
|
|
1771
|
-
|
|
1772
|
-
|
|
1758
|
+
S as MaterialEffectMode,
|
|
1759
|
+
F as ProductCameraRig,
|
|
1773
1760
|
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1774
|
-
|
|
1775
|
-
|
|
1761
|
+
x as RenderingConfiguration,
|
|
1762
|
+
$t as SpiffCommerce3DPreviewService,
|
|
1776
1763
|
d as renderingPipelineDefaults
|
|
1777
1764
|
};
|