@spiffcommerce/preview 5.0.0-rc.0 → 5.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +0 -39
- package/dist/index.esm.js +275 -315
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ArcRotateCamera as
|
|
1
|
+
import { ArcRotateCamera as ue } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
2
|
import { Engine as me } from "@babylonjs/core/Engines/engine";
|
|
3
|
-
import { NullEngine as
|
|
4
|
-
import { HighlightLayer as
|
|
5
|
-
import { SceneLoader as
|
|
6
|
-
import { CubeTexture as
|
|
3
|
+
import { NullEngine as ve } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HighlightLayer as we } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
+
import { SceneLoader as ge } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as Ce } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as f, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as
|
|
9
|
-
import { DracoCompression as
|
|
10
|
-
import { Observable as
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { PBRMaterial as
|
|
15
|
-
import { MirrorTexture as
|
|
16
|
-
import { Color3 as Ee, Vector3 as se, Plane as
|
|
17
|
-
import { ReflectionProbe as
|
|
8
|
+
import { Vector3 as m, Quaternion as x, Vector2 as te, Matrix as ie } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as xe } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
|
+
import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
11
|
+
import { Tools as Me } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as ye } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
14
|
+
import { PBRMaterial as F } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
|
+
import { MirrorTexture as Ae } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Ee, Vector3 as se, Plane as Re } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
18
|
import { GlowLayer as Te } from "@babylonjs/core/Layers/glowLayer";
|
|
19
|
-
import { ActionManager as
|
|
19
|
+
import { ActionManager as E } from "@babylonjs/core/Actions/actionManager";
|
|
20
20
|
import { ExecuteCodeAction as ne } from "@babylonjs/core/Actions/directActions";
|
|
21
|
-
import { Mesh as
|
|
22
|
-
import { TransformNode as
|
|
23
|
-
import { DynamicTexture as
|
|
24
|
-
import { Texture as
|
|
21
|
+
import { Mesh as Le } from "@babylonjs/core/Meshes/mesh";
|
|
22
|
+
import { TransformNode as Ie } from "@babylonjs/core/Meshes/transformNode";
|
|
23
|
+
import { DynamicTexture as Se } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
24
|
+
import { Texture as Fe } from "@babylonjs/core/Materials/Textures/texture";
|
|
25
25
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
26
|
-
import { QuadraticEase as
|
|
27
|
-
import { AssetsManager as
|
|
26
|
+
import { QuadraticEase as Be, EasingFunction as De } from "@babylonjs/core/Animations/easing";
|
|
27
|
+
import { AssetsManager as ze } from "@babylonjs/core/Misc/assetsManager";
|
|
28
28
|
import { ColorCurves as re } from "@babylonjs/core/Materials/colorCurves";
|
|
29
|
-
import { ImageProcessingConfiguration as
|
|
30
|
-
import { DefaultRenderingPipeline as
|
|
31
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
29
|
+
import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
30
|
+
import { DefaultRenderingPipeline as ke } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
|
+
import { DepthOfFieldEffectBlurLevel as R } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
32
32
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
33
33
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
34
34
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
@@ -39,32 +39,32 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
39
39
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
40
40
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
41
41
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
42
|
-
var
|
|
42
|
+
var I = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(I || {}), S = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(S || {});
|
|
43
43
|
class Ne {
|
|
44
44
|
constructor(e) {
|
|
45
45
|
this.getSceneClearColor = () => {
|
|
46
|
-
var i,
|
|
47
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
46
|
+
var i, o, a, n;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (o = this.customOptions) != null && o.backgroundImage ? 0 : 1;
|
|
48
48
|
if (this.customOptions && ((a = this.customOptions) != null && a.transparentBackground) || (n = this.customOptions) != null && n.backgroundImage)
|
|
49
49
|
return new f(0, 0, 0, t).toLinearSpace();
|
|
50
50
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
51
|
-
const
|
|
51
|
+
const r = w.FromHexString(
|
|
52
52
|
this.customOptions.backgroundColor
|
|
53
53
|
);
|
|
54
54
|
return new f(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
r.r,
|
|
56
|
+
r.g,
|
|
57
|
+
r.b,
|
|
58
58
|
t
|
|
59
59
|
).toLinearSpace();
|
|
60
60
|
}
|
|
61
61
|
return new f(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
62
62
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new f(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
63
|
-
const
|
|
63
|
+
const o = w.FromHexString(t);
|
|
64
64
|
return new f(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
o.r,
|
|
66
|
+
o.g,
|
|
67
|
+
o.b,
|
|
68
68
|
i
|
|
69
69
|
).toLinearSpace();
|
|
70
70
|
}, this.customOptions = e;
|
|
@@ -91,7 +91,7 @@ class Ne {
|
|
|
91
91
|
* Configuration related to the camera used to view and interact with the scene.
|
|
92
92
|
*/
|
|
93
93
|
get camera() {
|
|
94
|
-
var e, t, i,
|
|
94
|
+
var e, t, i, o, a, n, r, l, c, d, u, g, p;
|
|
95
95
|
return {
|
|
96
96
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
97
97
|
autoRotation: {
|
|
@@ -100,13 +100,13 @@ class Ne {
|
|
|
100
100
|
},
|
|
101
101
|
limits: {
|
|
102
102
|
min: {
|
|
103
|
-
alpha: (
|
|
104
|
-
beta: (n = this.customOptions) != null && n.lowerBetaLimitDeg ? ((
|
|
103
|
+
alpha: (o = this.customOptions) != null && o.lowerAlphaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
104
|
+
beta: (n = this.customOptions) != null && n.lowerBetaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
105
105
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
106
106
|
},
|
|
107
107
|
max: {
|
|
108
108
|
alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((d = this.customOptions) == null ? void 0 : d.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
109
|
-
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((
|
|
109
|
+
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((g = this.customOptions) == null ? void 0 : g.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
110
110
|
radius: (p = this.customOptions) == null ? void 0 : p.maxZoomOverride
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -124,10 +124,10 @@ class Ne {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
get lighting() {
|
|
127
|
-
var e, t, i,
|
|
127
|
+
var e, t, i, o;
|
|
128
128
|
return {
|
|
129
129
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
130
|
-
contrast: ((
|
|
130
|
+
contrast: ((o = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : o.contrast) ?? 1.6
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
get emissiveGlowIntensity() {
|
|
@@ -176,7 +176,7 @@ class y {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const Ve = 128, h = {
|
|
180
180
|
antiAliasing: {
|
|
181
181
|
samples: 4,
|
|
182
182
|
fxaaEnabled: !1
|
|
@@ -233,7 +233,7 @@ const Ge = 128, h = {
|
|
|
233
233
|
weight: 1
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
class
|
|
236
|
+
class Ge {
|
|
237
237
|
constructor(e) {
|
|
238
238
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
239
239
|
}
|
|
@@ -248,11 +248,11 @@ class He {
|
|
|
248
248
|
return this.loader.loadNodeAsync(
|
|
249
249
|
e,
|
|
250
250
|
t,
|
|
251
|
-
function(
|
|
251
|
+
function(o) {
|
|
252
252
|
t.extras && Object.keys(t.extras).forEach((a) => {
|
|
253
253
|
const n = t.extras[a];
|
|
254
|
-
|
|
255
|
-
}), i(
|
|
254
|
+
o.metadata[a] = n;
|
|
255
|
+
}), i(o);
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
258
|
}
|
|
@@ -277,7 +277,7 @@ class He {
|
|
|
277
277
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
278
278
|
*/
|
|
279
279
|
enableMaterialExtrasIfRequired(e, t) {
|
|
280
|
-
if (!(!e.extras || !(t instanceof
|
|
280
|
+
if (!(!e.extras || !(t instanceof F))) {
|
|
281
281
|
if (e.extras.sheen) {
|
|
282
282
|
const i = t;
|
|
283
283
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
@@ -312,17 +312,17 @@ class He {
|
|
|
312
312
|
applyReflections(e) {
|
|
313
313
|
function t(a) {
|
|
314
314
|
const n = [];
|
|
315
|
-
return a.transformNodes.forEach((
|
|
316
|
-
|
|
317
|
-
}), a.meshes.forEach((
|
|
318
|
-
|
|
315
|
+
return a.transformNodes.forEach((r) => {
|
|
316
|
+
r.metadata && r.metadata.reflective && n.push(...r.getChildMeshes());
|
|
317
|
+
}), a.meshes.forEach((r) => {
|
|
318
|
+
r.metadata && r.metadata.reflective && !n.includes(r) && n.push(r);
|
|
319
319
|
}), n;
|
|
320
320
|
}
|
|
321
321
|
function i(a, n = 1) {
|
|
322
|
-
const
|
|
323
|
-
if (!
|
|
322
|
+
const r = a.material;
|
|
323
|
+
if (!r)
|
|
324
324
|
return;
|
|
325
|
-
const l = new
|
|
325
|
+
const l = new Ae(
|
|
326
326
|
"mirror",
|
|
327
327
|
y.getMirrorTextureResolution(),
|
|
328
328
|
e,
|
|
@@ -338,67 +338,67 @@ class He {
|
|
|
338
338
|
const d = a.getWorldMatrix(), u = se.TransformNormal(
|
|
339
339
|
new se(c[0], c[1], c[2]),
|
|
340
340
|
d
|
|
341
|
-
).normalize(),
|
|
341
|
+
).normalize(), g = Re.FromPositionAndNormal(
|
|
342
342
|
a.position,
|
|
343
343
|
u.scale(-1)
|
|
344
344
|
);
|
|
345
|
-
l.mirrorPlane =
|
|
345
|
+
l.mirrorPlane = g, l.level = n, r.reflectionTexture = l;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
const n = a.material,
|
|
347
|
+
function o(a) {
|
|
348
|
+
const n = a.material, r = new Oe(
|
|
349
349
|
"probe-" + n.name,
|
|
350
|
-
|
|
350
|
+
Ve,
|
|
351
351
|
e
|
|
352
352
|
);
|
|
353
|
-
|
|
353
|
+
r.attachToMesh(a), r.renderList && r.renderList.push(...t(e)), n.reflectionTexture = r.cubeTexture;
|
|
354
354
|
}
|
|
355
355
|
e.meshes.forEach((a) => {
|
|
356
356
|
const n = a.metadata;
|
|
357
|
-
n && (n.mirrorTexture && i(a, n.mirrorTexture), n.reflectionProbe &&
|
|
357
|
+
n && (n.mirrorTexture && i(a, n.mirrorTexture), n.reflectionProbe && o(a));
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class He {
|
|
362
362
|
constructor(e, t) {
|
|
363
363
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
364
364
|
}
|
|
365
365
|
includeMeshes(e) {
|
|
366
|
-
this.glowLayer || (this.glowLayer = new Te("glow", this.scene), this.glowLayer.intensity = this.intensity), e.forEach((t) => {
|
|
366
|
+
e && (this.glowLayer || (this.glowLayer = new Te("glow", this.scene), this.glowLayer.intensity = this.intensity), e.forEach((t) => {
|
|
367
367
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
368
|
-
});
|
|
368
|
+
}));
|
|
369
369
|
}
|
|
370
370
|
removeMeshes(e) {
|
|
371
|
-
this.glowLayer
|
|
371
|
+
!this.glowLayer || !e || (e.forEach((t) => {
|
|
372
372
|
this.glowLayer.hasMesh(t) && (this.glowLayer.removeIncludedOnlyMesh(t), this.meshCount--);
|
|
373
373
|
}), this.meshCount === 0 && (this.glowLayer.dispose(), this.glowLayer = void 0));
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
const ae = /* @__PURE__ */ new Map();
|
|
377
|
-
async function
|
|
378
|
-
return new Promise((i,
|
|
377
|
+
async function pe(s, e, t) {
|
|
378
|
+
return new Promise((i, o) => {
|
|
379
379
|
const a = ae.get(s);
|
|
380
380
|
if (a && a.scene.uid === e.uid)
|
|
381
381
|
return i(a);
|
|
382
|
-
|
|
382
|
+
ge.LoadAssetContainerAsync(
|
|
383
383
|
s,
|
|
384
384
|
void 0,
|
|
385
385
|
e,
|
|
386
386
|
t
|
|
387
387
|
).then((n) => {
|
|
388
388
|
ae.set(s, n), i(n);
|
|
389
|
-
}).catch(
|
|
389
|
+
}).catch(o);
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function _e(s, e, t, i, o = "") {
|
|
393
393
|
t.forEach((a) => {
|
|
394
|
-
const n = a.getID(),
|
|
395
|
-
s.filter((d) => d.name ===
|
|
396
|
-
const u = i.get(n),
|
|
394
|
+
const n = a.getID(), r = a.getName(), l = y.getDynamicTextureResolution();
|
|
395
|
+
s.filter((d) => d.name === o + r).forEach((d) => {
|
|
396
|
+
const u = i.get(n), g = !1;
|
|
397
397
|
if (u)
|
|
398
|
-
oe(d, u), u.update(
|
|
398
|
+
oe(d, u), u.update(g);
|
|
399
399
|
else {
|
|
400
|
-
const p =
|
|
401
|
-
|
|
400
|
+
const p = qe(
|
|
401
|
+
r,
|
|
402
402
|
e,
|
|
403
403
|
l.width,
|
|
404
404
|
l.height
|
|
@@ -406,25 +406,25 @@ function qe(s, e, t, i, r = "") {
|
|
|
406
406
|
i.set(n, p), a.setStaticContext(
|
|
407
407
|
p.getContext()
|
|
408
408
|
), oe(d, p), p.onLoadObservable.addOnce(() => {
|
|
409
|
-
p.update(
|
|
409
|
+
p.update(g);
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
const
|
|
415
|
+
function qe(s, e, t, i) {
|
|
416
|
+
const o = new Se(
|
|
417
417
|
s,
|
|
418
418
|
{ width: t, height: i },
|
|
419
419
|
e,
|
|
420
420
|
y.shouldMipMap(),
|
|
421
|
-
|
|
421
|
+
Fe.TRILINEAR_SAMPLINGMODE,
|
|
422
422
|
me.TEXTUREFORMAT_RGBA
|
|
423
|
-
), a =
|
|
424
|
-
return a && (a.fillStyle = "#f5f5f5", a.fillRect(0, 0, t, i),
|
|
423
|
+
), a = o.getContext();
|
|
424
|
+
return a && (a.fillStyle = "#f5f5f5", a.fillRect(0, 0, t, i), o.update()), o;
|
|
425
425
|
}
|
|
426
426
|
function oe(s, e) {
|
|
427
|
-
if (s instanceof
|
|
427
|
+
if (s instanceof F) {
|
|
428
428
|
const t = s, i = t.albedoTexture;
|
|
429
429
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
430
430
|
} else {
|
|
@@ -432,7 +432,7 @@ function oe(s, e) {
|
|
|
432
432
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function Ke() {
|
|
436
436
|
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
437
437
|
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
438
438
|
}
|
|
@@ -440,44 +440,44 @@ const M = 60, le = 1;
|
|
|
440
440
|
function he(s) {
|
|
441
441
|
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
const a =
|
|
443
|
+
function Ue(s, e, t, i, o) {
|
|
444
|
+
const a = o ? s.filter((n) => n.name === o) : s;
|
|
445
445
|
if (a.length === 0) {
|
|
446
|
-
console.warn(`No animations found for name: ${
|
|
446
|
+
console.warn(`No animations found for name: ${o}`);
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
449
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
450
450
|
a.forEach((n) => {
|
|
451
451
|
n.stop();
|
|
452
|
-
const
|
|
452
|
+
const r = he(n), l = i * r;
|
|
453
453
|
n.start(e, le, l, l);
|
|
454
454
|
});
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
457
|
a.forEach((n) => {
|
|
458
458
|
n.stop();
|
|
459
|
-
const
|
|
459
|
+
const r = he(n), l = i !== void 0 ? i * r : void 0, c = t !== void 0 ? t * r : void 0;
|
|
460
460
|
n.start(e, le, l, c);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function fe(s) {
|
|
464
464
|
s.forEach((e) => {
|
|
465
465
|
e.stop();
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function We(s) {
|
|
469
469
|
const e = s.animationGroups;
|
|
470
|
-
|
|
470
|
+
fe(e);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
474
|
-
const i = [],
|
|
472
|
+
function Qe(s, e, t) {
|
|
473
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ze(e.alpha, 0, 2 * Math.PI));
|
|
474
|
+
const i = [], o = t.target, a = 0, n = o ? 1 : 0;
|
|
475
475
|
if (t.target && Object.keys(t.target).length > 0 && i.push(
|
|
476
|
-
|
|
476
|
+
A(
|
|
477
477
|
"cameraTargetLerp",
|
|
478
478
|
"target",
|
|
479
|
-
new
|
|
480
|
-
new
|
|
479
|
+
new m().copyFrom(e.target),
|
|
480
|
+
new m(
|
|
481
481
|
t.target.x,
|
|
482
482
|
t.target.y,
|
|
483
483
|
t.target.z
|
|
@@ -486,7 +486,7 @@ function Ze(s, e, t) {
|
|
|
486
486
|
a
|
|
487
487
|
)
|
|
488
488
|
), i.push(
|
|
489
|
-
|
|
489
|
+
A(
|
|
490
490
|
"cameraAlphaLerp",
|
|
491
491
|
"alpha",
|
|
492
492
|
e.alpha,
|
|
@@ -495,7 +495,7 @@ function Ze(s, e, t) {
|
|
|
495
495
|
n
|
|
496
496
|
)
|
|
497
497
|
), i.push(
|
|
498
|
-
|
|
498
|
+
A(
|
|
499
499
|
"cameraBetaLerp",
|
|
500
500
|
"beta",
|
|
501
501
|
e.beta,
|
|
@@ -506,7 +506,7 @@ function Ze(s, e, t) {
|
|
|
506
506
|
), t.radius !== void 0) {
|
|
507
507
|
const c = Math.max(0.01, t.radius);
|
|
508
508
|
i.push(
|
|
509
|
-
|
|
509
|
+
A(
|
|
510
510
|
"cameraRadiusLerp",
|
|
511
511
|
"radius",
|
|
512
512
|
e.radius,
|
|
@@ -521,7 +521,7 @@ function Ze(s, e, t) {
|
|
|
521
521
|
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
522
522
|
e,
|
|
523
523
|
0,
|
|
524
|
-
|
|
524
|
+
o ? M * 2 : M,
|
|
525
525
|
!1,
|
|
526
526
|
1,
|
|
527
527
|
() => {
|
|
@@ -532,25 +532,25 @@ function Ze(s, e, t) {
|
|
|
532
532
|
function ce(s) {
|
|
533
533
|
return s * Math.PI / 180;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
const
|
|
537
|
-
|
|
535
|
+
function A(s, e, t, i, o, a = 0, n = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
536
|
+
const r = new Be();
|
|
537
|
+
r.setEasingMode(De.EASINGMODE_EASEINOUT);
|
|
538
538
|
const l = new v(
|
|
539
539
|
s,
|
|
540
540
|
e,
|
|
541
541
|
M,
|
|
542
|
-
|
|
542
|
+
o,
|
|
543
543
|
n
|
|
544
544
|
), c = [];
|
|
545
545
|
return a > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * a, value: t }), c.push({
|
|
546
546
|
frame: M * (a + 1),
|
|
547
547
|
value: i
|
|
548
|
-
}), l.setKeys(c), l.setEasingFunction(
|
|
548
|
+
}), l.setKeys(c), l.setEasingFunction(r), l;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function Ze(s, e, t) {
|
|
551
551
|
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
552
552
|
}
|
|
553
|
-
const
|
|
553
|
+
const $e = {
|
|
554
554
|
albedoTexture: "albedoMap",
|
|
555
555
|
bumpTexture: "normalMap",
|
|
556
556
|
ambientTexture: "ambientMap",
|
|
@@ -559,7 +559,7 @@ const Ye = {
|
|
|
559
559
|
metallicTexture: "metallicMap",
|
|
560
560
|
refractionTexture: "refractionMap"
|
|
561
561
|
};
|
|
562
|
-
function
|
|
562
|
+
function Ye(s, e, t, i) {
|
|
563
563
|
[
|
|
564
564
|
"albedoTexture",
|
|
565
565
|
"bumpTexture",
|
|
@@ -569,32 +569,36 @@ function je(s, e, t, i) {
|
|
|
569
569
|
"metallicTexture",
|
|
570
570
|
"refractionTexture"
|
|
571
571
|
].forEach((a) => {
|
|
572
|
-
|
|
572
|
+
je(
|
|
573
573
|
a,
|
|
574
574
|
s,
|
|
575
575
|
e,
|
|
576
576
|
t,
|
|
577
577
|
i
|
|
578
578
|
);
|
|
579
|
-
}),
|
|
579
|
+
}), et(s, e);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
const a =
|
|
581
|
+
function je(s, e, t, i, o) {
|
|
582
|
+
const a = $e[s];
|
|
583
583
|
if (!a)
|
|
584
584
|
throw new Error("Unexpected texture name encountered.");
|
|
585
|
-
const n = e[a],
|
|
586
|
-
|
|
585
|
+
const n = e[a], r = n == null ? void 0 : n.fileLink;
|
|
586
|
+
r ? i.addTextureTask(s, r, !1, !1) : o && t[s] && (t[s] && t[s].dispose(), t[s] = null, Xe(s, t));
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function Xe(s, e) {
|
|
589
589
|
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 === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0));
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Je(s, e, t, i) {
|
|
592
|
+
if (!e) {
|
|
593
|
+
console.error("Failed to apply texture to material: material is null.");
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
592
596
|
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), e[s] = i, s === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
593
597
|
}
|
|
594
|
-
function
|
|
595
|
-
s.clearCoat && (s.clearCoat ===
|
|
598
|
+
function et(s, e) {
|
|
599
|
+
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));
|
|
596
600
|
}
|
|
597
|
-
class
|
|
601
|
+
class tt {
|
|
598
602
|
constructor(e, t, i) {
|
|
599
603
|
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;
|
|
600
604
|
}
|
|
@@ -607,39 +611,41 @@ class it {
|
|
|
607
611
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
608
612
|
* where we want to undo changes are remove effects from display.
|
|
609
613
|
*/
|
|
610
|
-
async applyMaterial(e, t, i,
|
|
614
|
+
async applyMaterial(e, t, i, o) {
|
|
611
615
|
return new Promise((a) => {
|
|
612
616
|
const n = this.materialVariantMap.get(e);
|
|
613
617
|
this.materialVariantMap.set(e, {
|
|
614
618
|
...n,
|
|
615
619
|
...t
|
|
616
620
|
});
|
|
617
|
-
const
|
|
618
|
-
(d) => d.name ===
|
|
621
|
+
const r = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
622
|
+
(d) => d.name === r
|
|
619
623
|
);
|
|
620
624
|
if (l.length === 0) {
|
|
621
625
|
a();
|
|
622
626
|
return;
|
|
623
627
|
}
|
|
624
|
-
const c = new
|
|
628
|
+
const c = new ze(this.scene);
|
|
625
629
|
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
626
|
-
(d) =>
|
|
630
|
+
(d) => Ye(
|
|
627
631
|
t,
|
|
628
632
|
d,
|
|
629
633
|
c,
|
|
630
|
-
|
|
634
|
+
o
|
|
631
635
|
)
|
|
632
|
-
), c.onProgress = (d, u,
|
|
633
|
-
i && i(d / u * 100, 100,
|
|
636
|
+
), c.onProgress = (d, u, g) => {
|
|
637
|
+
i && i(d / u * 100, 100, g.name);
|
|
634
638
|
}, c.onFinish = (d) => {
|
|
635
639
|
d.forEach((u) => {
|
|
636
|
-
const
|
|
637
|
-
i && i(100, 100, u.name),
|
|
638
|
-
(
|
|
640
|
+
const g = u;
|
|
641
|
+
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
642
|
+
(b) => b.name === r
|
|
643
|
+
).forEach(
|
|
644
|
+
(b) => Je(
|
|
639
645
|
u.name,
|
|
640
|
-
|
|
646
|
+
b,
|
|
641
647
|
t,
|
|
642
|
-
|
|
648
|
+
g.texture
|
|
643
649
|
)
|
|
644
650
|
);
|
|
645
651
|
}), a();
|
|
@@ -653,20 +659,19 @@ class it {
|
|
|
653
659
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
654
660
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
655
661
|
*/
|
|
656
|
-
async applyModel(e, t, i,
|
|
662
|
+
async applyModel(e, t, i, o) {
|
|
657
663
|
var l, c;
|
|
658
664
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
659
665
|
return this.keysThatRemovedBaseModel.includes(e) && this.setBaseModelEnabled(!0), (l = this.loadedContainerForKey.get(e)) == null || l.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), Promise.resolve(void 0);
|
|
660
|
-
|
|
661
|
-
const n = (await fe(i, this.scene, r)).instantiateModelsToScene(
|
|
666
|
+
const n = (await pe(i, this.scene, o)).instantiateModelsToScene(
|
|
662
667
|
this.renameClonedAsset,
|
|
663
668
|
!0
|
|
664
669
|
);
|
|
665
|
-
this.loadedContainerForKey.set(e, n), this.loadedMaterialsForKey.set(e,
|
|
666
|
-
const
|
|
670
|
+
this.loadedContainerForKey.has(e) && ((c = this.loadedContainerForKey.get(e)) == null || c.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, n), this.loadedMaterialsForKey.set(e, be(n));
|
|
671
|
+
const r = [];
|
|
667
672
|
return this.materialVariantMap.forEach(async (d, u) => {
|
|
668
|
-
|
|
669
|
-
}), await Promise.all(
|
|
673
|
+
r.push(this.applyMaterial(u, d));
|
|
674
|
+
}), await Promise.all(r), n;
|
|
670
675
|
}
|
|
671
676
|
dispose() {
|
|
672
677
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -688,12 +693,12 @@ class it {
|
|
|
688
693
|
}), e;
|
|
689
694
|
}
|
|
690
695
|
}
|
|
691
|
-
function
|
|
696
|
+
function be(s) {
|
|
692
697
|
const e = [];
|
|
693
698
|
return s.rootNodes.forEach((t) => {
|
|
694
699
|
t.getChildMeshes().forEach((i) => {
|
|
695
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
696
|
-
const a =
|
|
700
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((o) => {
|
|
701
|
+
const a = o.getMaterial(!1);
|
|
697
702
|
a && !e.includes(a) && e.push(a);
|
|
698
703
|
});
|
|
699
704
|
});
|
|
@@ -707,32 +712,32 @@ function de(s, e = "") {
|
|
|
707
712
|
from: t.from
|
|
708
713
|
}));
|
|
709
714
|
}
|
|
710
|
-
class
|
|
715
|
+
class it {
|
|
711
716
|
constructor(e) {
|
|
712
|
-
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new
|
|
717
|
+
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.animations = [], this.initialized = !1, this.materials = [];
|
|
713
718
|
const {
|
|
714
719
|
enablePicking: t,
|
|
715
720
|
modelDetails: i,
|
|
716
|
-
previewService:
|
|
721
|
+
previewService: o,
|
|
717
722
|
progressHandler: a,
|
|
718
723
|
scene: n
|
|
719
724
|
} = e;
|
|
720
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
725
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = o, this.scene = n, this.variantManager = new tt(
|
|
721
726
|
n,
|
|
722
727
|
this.renameClonedAsset.bind(this),
|
|
723
728
|
this.setBaseModelEnabled.bind(this)
|
|
724
729
|
), this.previewService.registerInitializedListener(
|
|
725
730
|
async () => await this.processQueuedEvents()
|
|
726
|
-
), this.transformRoot = new
|
|
727
|
-
const
|
|
731
|
+
), this.transformRoot = new Ie("root", this.scene);
|
|
732
|
+
const r = async () => (this.assetContainer = await pe(
|
|
728
733
|
i.model,
|
|
729
734
|
n,
|
|
730
735
|
a
|
|
731
736
|
), this.initialized = !0, this.instantiate(), this);
|
|
732
|
-
this.importPromise =
|
|
737
|
+
this.importPromise = r();
|
|
733
738
|
}
|
|
734
739
|
//#region Interface implementation
|
|
735
|
-
async applyMaterialVariant(e, t, i,
|
|
740
|
+
async applyMaterialVariant(e, t, i, o) {
|
|
736
741
|
if (!this.initialized) {
|
|
737
742
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
738
743
|
const n = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -743,7 +748,7 @@ class st {
|
|
|
743
748
|
e,
|
|
744
749
|
t,
|
|
745
750
|
i,
|
|
746
|
-
|
|
751
|
+
o
|
|
747
752
|
)
|
|
748
753
|
);
|
|
749
754
|
} else {
|
|
@@ -759,7 +764,7 @@ class st {
|
|
|
759
764
|
e,
|
|
760
765
|
t,
|
|
761
766
|
i,
|
|
762
|
-
|
|
767
|
+
o
|
|
763
768
|
)
|
|
764
769
|
);
|
|
765
770
|
}
|
|
@@ -769,14 +774,14 @@ class st {
|
|
|
769
774
|
await this.variantManager.applyMaterial(
|
|
770
775
|
e,
|
|
771
776
|
i,
|
|
772
|
-
(n,
|
|
777
|
+
(n, r, l) => {
|
|
773
778
|
this.materialVariantObservable.notifyObservers({
|
|
774
779
|
remainingCount: n,
|
|
775
|
-
totalCount:
|
|
780
|
+
totalCount: r,
|
|
776
781
|
taskName: l
|
|
777
782
|
});
|
|
778
783
|
},
|
|
779
|
-
|
|
784
|
+
o
|
|
780
785
|
);
|
|
781
786
|
};
|
|
782
787
|
if (this.materialChangesInProgress.includes(e)) {
|
|
@@ -793,8 +798,8 @@ class st {
|
|
|
793
798
|
}
|
|
794
799
|
return;
|
|
795
800
|
}
|
|
796
|
-
this.materialChangesInProgress.push(e), await a(), this.queuedMaterialChanges.has(e) && (this.queuedMaterialChanges.get(e).forEach(async (
|
|
797
|
-
await
|
|
801
|
+
this.materialChangesInProgress.push(e), await a(), this.queuedMaterialChanges.has(e) && (this.queuedMaterialChanges.get(e).forEach(async (r) => {
|
|
802
|
+
await r();
|
|
798
803
|
}), this.queuedMaterialChanges.delete(e)), this.materialChangesInProgress.splice(
|
|
799
804
|
this.materialChangesInProgress.indexOf(e),
|
|
800
805
|
1
|
|
@@ -813,30 +818,30 @@ class st {
|
|
|
813
818
|
);
|
|
814
819
|
return;
|
|
815
820
|
}
|
|
816
|
-
const
|
|
821
|
+
const o = () => this.variantManager.applyModel(
|
|
817
822
|
e,
|
|
818
823
|
i,
|
|
819
824
|
t == null ? void 0 : t.model,
|
|
820
|
-
(
|
|
825
|
+
(r) => {
|
|
821
826
|
this.modelVariantObservable.notifyObservers({
|
|
822
|
-
...
|
|
827
|
+
...r,
|
|
823
828
|
key: e
|
|
824
829
|
});
|
|
825
830
|
}
|
|
826
831
|
);
|
|
827
832
|
if (this.modelChangesInProgress.includes(e)) {
|
|
828
|
-
this.queuedModelChanges.set(e,
|
|
833
|
+
this.queuedModelChanges.set(e, o);
|
|
829
834
|
return;
|
|
830
835
|
}
|
|
831
836
|
const n = await (async () => {
|
|
832
837
|
this.modelChangesInProgress.push(e);
|
|
833
|
-
let
|
|
834
|
-
return this.queuedModelChanges.has(e) && (
|
|
838
|
+
let r = await o();
|
|
839
|
+
return this.queuedModelChanges.has(e) && (r = await this.queuedModelChanges.get(e)(), this.queuedModelChanges.delete(e)), this.modelChangesInProgress.splice(
|
|
835
840
|
this.modelChangesInProgress.indexOf(e),
|
|
836
841
|
1
|
|
837
|
-
),
|
|
842
|
+
), r;
|
|
838
843
|
})();
|
|
839
|
-
this.modelInstance &&
|
|
844
|
+
this.modelInstance && fe(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), n ? this.configureModelInstance(n) : this.configureGlowLayer();
|
|
840
845
|
}
|
|
841
846
|
dispose() {
|
|
842
847
|
var e;
|
|
@@ -847,7 +852,7 @@ class st {
|
|
|
847
852
|
this.queuedModelAnimation = e;
|
|
848
853
|
return;
|
|
849
854
|
}
|
|
850
|
-
this.modelInstance &&
|
|
855
|
+
this.modelInstance && Ue(
|
|
851
856
|
[
|
|
852
857
|
...this.modelInstance.animationGroups,
|
|
853
858
|
...this.variantManager.getAnimationGroups()
|
|
@@ -896,13 +901,13 @@ class st {
|
|
|
896
901
|
return this.transformRoot.position;
|
|
897
902
|
}
|
|
898
903
|
set position(e) {
|
|
899
|
-
this.transformRoot.position = new
|
|
904
|
+
this.transformRoot.position = new m(e.x, e.y, e.z);
|
|
900
905
|
}
|
|
901
906
|
get rotation() {
|
|
902
907
|
return this.transformRoot.rotationQuaternion.toEulerAngles();
|
|
903
908
|
}
|
|
904
909
|
set rotation(e) {
|
|
905
|
-
this.transformRoot.rotationQuaternion =
|
|
910
|
+
this.transformRoot.rotationQuaternion = x.FromEulerAngles(
|
|
906
911
|
e.x,
|
|
907
912
|
e.y,
|
|
908
913
|
e.z
|
|
@@ -912,22 +917,22 @@ class st {
|
|
|
912
917
|
return this.transformRoot.scaling;
|
|
913
918
|
}
|
|
914
919
|
set scale(e) {
|
|
915
|
-
this.transformRoot.scaling = new
|
|
920
|
+
this.transformRoot.scaling = new m(e.x, e.y, e.z);
|
|
916
921
|
}
|
|
917
922
|
//#endregion
|
|
918
923
|
//#region Custom implementation functions
|
|
919
924
|
attachPickingHandler(e) {
|
|
920
925
|
e.rootNodes.forEach((t) => {
|
|
921
926
|
t.getChildMeshes(!1).forEach((i) => {
|
|
922
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
923
|
-
new ne(
|
|
924
|
-
|
|
927
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new E(this.scene)), i.actionManager.registerAction(
|
|
928
|
+
new ne(E.OnPointerOverTrigger, (o) => {
|
|
929
|
+
o.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
925
930
|
id: i.material.id,
|
|
926
931
|
name: this.stripIdFromName(i.material.name)
|
|
927
932
|
});
|
|
928
933
|
})
|
|
929
934
|
), i.actionManager.registerAction(
|
|
930
|
-
new ne(
|
|
935
|
+
new ne(E.OnPointerOutTrigger, () => {
|
|
931
936
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
932
937
|
id: i.material.id,
|
|
933
938
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -956,15 +961,15 @@ class st {
|
|
|
956
961
|
return this.modelReadyToLoadCallbacks.size;
|
|
957
962
|
}
|
|
958
963
|
configureGlowLayer() {
|
|
959
|
-
const e = (i) => i instanceof
|
|
964
|
+
const e = (i) => i instanceof F && i.emissiveTexture !== null;
|
|
960
965
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
961
966
|
}
|
|
962
967
|
configureModelInstance(e) {
|
|
963
968
|
var a;
|
|
964
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
965
|
-
this.transformRoot.position =
|
|
969
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, o = this.transformRoot.scaling;
|
|
970
|
+
this.transformRoot.position = m.Zero(), this.transformRoot.rotationQuaternion = x.Identity(), this.transformRoot.scaling = m.One(), e.rootNodes.forEach((n) => {
|
|
966
971
|
n.parent = this.transformRoot;
|
|
967
|
-
}), this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
972
|
+
}), this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = o, this.canvasPanels = ((a = this.contextService) == null ? void 0 : a.getAll()) || /* @__PURE__ */ new Map(), _e(
|
|
968
973
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
969
974
|
this.scene,
|
|
970
975
|
this.canvasPanels,
|
|
@@ -982,14 +987,14 @@ class st {
|
|
|
982
987
|
getAllMeshes() {
|
|
983
988
|
var e;
|
|
984
989
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
985
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
990
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Le)
|
|
986
991
|
).flat();
|
|
987
992
|
}
|
|
988
993
|
instantiate() {
|
|
989
994
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
990
995
|
this.renameClonedAsset.bind(this),
|
|
991
996
|
!0
|
|
992
|
-
), this.materials =
|
|
997
|
+
), this.materials = be(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = de(
|
|
993
998
|
this.modelInstance.animationGroups,
|
|
994
999
|
this.renameClonedAsset("")
|
|
995
1000
|
), this.processQueuedEvents();
|
|
@@ -1004,8 +1009,8 @@ class st {
|
|
|
1004
1009
|
var e;
|
|
1005
1010
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1006
1011
|
(t, i) => {
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1012
|
+
const o = this.dynamicTextures.get(i);
|
|
1013
|
+
o && t.getStaticContextDirty() && o.isReady() && (o.update(!1), t.setStaticContextDirty(!1));
|
|
1009
1014
|
}
|
|
1010
1015
|
);
|
|
1011
1016
|
}
|
|
@@ -1039,18 +1044,18 @@ class st {
|
|
|
1039
1044
|
}
|
|
1040
1045
|
//#endregion
|
|
1041
1046
|
}
|
|
1042
|
-
class
|
|
1043
|
-
constructor(e, t, i,
|
|
1047
|
+
class B extends ue {
|
|
1048
|
+
constructor(e, t, i, o, a, n, r, l) {
|
|
1044
1049
|
super(
|
|
1045
1050
|
e,
|
|
1046
1051
|
t,
|
|
1047
1052
|
i,
|
|
1048
|
-
|
|
1053
|
+
o,
|
|
1049
1054
|
a,
|
|
1050
1055
|
n,
|
|
1051
1056
|
l
|
|
1052
|
-
), this.lastFocus = new
|
|
1053
|
-
|
|
1057
|
+
), this.lastFocus = new m(0, 0, 0), this.panDenominator = 1, this.minZ = 0.01, this.setRadius(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, r.camera.autoOrientation && (this.alpha += Math.PI), r && (r.camera.limits.min.beta && (this.lowerBetaLimit = r.camera.limits.min.beta), r.camera.limits.max.beta && (this.upperBetaLimit = r.camera.limits.max.beta), r.camera.limits.min.alpha && (this.lowerAlphaLimit = r.camera.limits.min.alpha), r.camera.limits.max.alpha && (this.upperAlphaLimit = r.camera.limits.max.alpha), r.camera.limits.min.radius && (this.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.upperRadiusLimit = r.camera.limits.max.radius), r.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1058
|
+
r.camera.autoRotation.idleTimeMs
|
|
1054
1059
|
));
|
|
1055
1060
|
}
|
|
1056
1061
|
/**
|
|
@@ -1076,7 +1081,7 @@ class F extends ge {
|
|
|
1076
1081
|
this.useFramingBehavior = !0;
|
|
1077
1082
|
const e = this.getFramingBehavior();
|
|
1078
1083
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1079
|
-
const t =
|
|
1084
|
+
const t = O(this._scene);
|
|
1080
1085
|
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;
|
|
1081
1086
|
}
|
|
1082
1087
|
/**
|
|
@@ -1087,14 +1092,14 @@ class F extends ge {
|
|
|
1087
1092
|
rerunFramingBehavior(e, t) {
|
|
1088
1093
|
const i = this.getFramingBehavior();
|
|
1089
1094
|
i.framingTime = t || 800;
|
|
1090
|
-
const
|
|
1095
|
+
const o = () => {
|
|
1091
1096
|
e && e();
|
|
1092
|
-
}, a =
|
|
1093
|
-
this.setRadius(n.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(
|
|
1097
|
+
}, a = O(this._scene), n = a.max.subtract(a.min), r = a.min.add(n.scale(0.5));
|
|
1098
|
+
this.setRadius(n.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(r), this.panDenominator = n.length(), i.zoomOnBoundingInfo(
|
|
1094
1099
|
a.min,
|
|
1095
1100
|
a.max,
|
|
1096
1101
|
void 0,
|
|
1097
|
-
|
|
1102
|
+
o
|
|
1098
1103
|
), i.framingTime = 0;
|
|
1099
1104
|
}
|
|
1100
1105
|
/**
|
|
@@ -1124,7 +1129,7 @@ class F extends ge {
|
|
|
1124
1129
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1125
1130
|
*/
|
|
1126
1131
|
static create(e, t, i) {
|
|
1127
|
-
const
|
|
1132
|
+
const o = O(e), a = o.max.subtract(o.min), n = o.min.add(a.scale(0.5)), r = new B(
|
|
1128
1133
|
"ProductCamera",
|
|
1129
1134
|
-(Math.PI / 2),
|
|
1130
1135
|
Math.PI / 2,
|
|
@@ -1133,23 +1138,23 @@ class F extends ge {
|
|
|
1133
1138
|
e,
|
|
1134
1139
|
t
|
|
1135
1140
|
);
|
|
1136
|
-
return
|
|
1137
|
-
|
|
1138
|
-
}), i && (e.activeCamera =
|
|
1141
|
+
return r.panningInertia = 0, r.panningOriginTarget.copyFrom(n), r.panDenominator = a.length(), r.onAfterCheckInputsObservable.add(() => {
|
|
1142
|
+
r.panningSensibility = 1e3 / r.panDenominator;
|
|
1143
|
+
}), i && (e.activeCamera = r), r;
|
|
1139
1144
|
}
|
|
1140
1145
|
}
|
|
1141
|
-
function
|
|
1146
|
+
function O(s) {
|
|
1142
1147
|
if (s.meshes.length === 0)
|
|
1143
1148
|
return {
|
|
1144
|
-
min: new
|
|
1145
|
-
max: new
|
|
1149
|
+
min: new m(-1, -1, -1),
|
|
1150
|
+
max: new m(1, 1, 1)
|
|
1146
1151
|
};
|
|
1147
1152
|
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1148
1153
|
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1149
1154
|
}
|
|
1150
|
-
class
|
|
1155
|
+
class st {
|
|
1151
1156
|
constructor(e, t = !1, i = void 0) {
|
|
1152
|
-
this.renderingPipeline = new
|
|
1157
|
+
this.renderingPipeline = new ke(
|
|
1153
1158
|
"default",
|
|
1154
1159
|
t,
|
|
1155
1160
|
e,
|
|
@@ -1165,42 +1170,42 @@ class nt {
|
|
|
1165
1170
|
return this.currentConfiguration;
|
|
1166
1171
|
}
|
|
1167
1172
|
setConfiguration(e) {
|
|
1168
|
-
var t, i,
|
|
1173
|
+
var t, i, o, a, n, r, l, c, d, u, g, p, b, D, z, k, N, V, G, H, _, q, K, U, W, Q, Z, $, Y, j, X, J, ee;
|
|
1169
1174
|
if (this.renderingPipeline.isSupported) {
|
|
1170
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? h.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? h.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((
|
|
1175
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? h.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? h.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((o = e.bloom) == null ? void 0 : o.enabled) ?? h.bloom.enabled, this.renderingPipeline.bloomKernel = ((a = e.bloom) == null ? void 0 : a.kernel) ?? h.bloom.kernel, this.renderingPipeline.bloomScale = ((n = e.bloom) == null ? void 0 : n.scale) ?? h.bloom.scale, this.renderingPipeline.bloomThreshold = ((r = e.bloom) == null ? void 0 : r.threshold) ?? h.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? h.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? h.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((d = e.chromaticAberration) == null ? void 0 : d.aberrationAmount) ?? h.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? h.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (g = e.chromaticAberration) != null && g.direction ? new te(
|
|
1171
1176
|
e.chromaticAberration.direction.x,
|
|
1172
1177
|
e.chromaticAberration.direction.y
|
|
1173
1178
|
) : new te(
|
|
1174
1179
|
h.chromaticAberration.direction.x,
|
|
1175
1180
|
h.chromaticAberration.direction.y
|
|
1176
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? h.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new re(), this.renderingPipeline.depthOfFieldEnabled = ((
|
|
1181
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? h.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new re(), this.renderingPipeline.depthOfFieldEnabled = ((b = e.depthOfField) == null ? void 0 : b.enabled) ?? h.depthOfField.enabled, e.depthOfField)
|
|
1177
1182
|
switch (e.depthOfField.blurLevel ?? h.depthOfField.blurLevel) {
|
|
1178
1183
|
case "Low":
|
|
1179
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1184
|
+
this.renderingPipeline.depthOfFieldBlurLevel = R.Low;
|
|
1180
1185
|
break;
|
|
1181
1186
|
case "Medium":
|
|
1182
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1187
|
+
this.renderingPipeline.depthOfFieldBlurLevel = R.Medium;
|
|
1183
1188
|
break;
|
|
1184
1189
|
case "High":
|
|
1185
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1190
|
+
this.renderingPipeline.depthOfFieldBlurLevel = R.High;
|
|
1186
1191
|
break;
|
|
1187
1192
|
}
|
|
1188
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? h.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((k = e.depthOfField) == null ? void 0 : k.focusDistance) ?? h.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((
|
|
1193
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? h.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((k = e.depthOfField) == null ? void 0 : k.focusDistance) ?? h.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((N = e.depthOfField) == null ? void 0 : N.lensSize) ?? h.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((V = e.grain) == null ? void 0 : V.enabled) ?? h.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? h.grain.animated, this.renderingPipeline.grain.intensity = ((H = e.grain) == null ? void 0 : H.intensity) ?? h.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((_ = e.misc) == null ? void 0 : _.contrast) ?? h.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((q = e.misc) == null ? void 0 : q.exposure) ?? h.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((K = e.misc) == null ? void 0 : K.toneMappingEnabled) ?? h.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1189
1194
|
switch (e.misc.toneMappingType ?? h.misc.toneMappingType) {
|
|
1190
1195
|
case "Standard":
|
|
1191
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1196
|
+
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1192
1197
|
break;
|
|
1193
1198
|
case "ACES":
|
|
1194
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1199
|
+
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1195
1200
|
break;
|
|
1196
1201
|
}
|
|
1197
1202
|
if (this.renderingPipeline.sharpenEnabled = ((U = e.sharpen) == null ? void 0 : U.enabled) ?? h.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((W = e.sharpen) == null ? void 0 : W.colorAmount) ?? h.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? h.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? h.vignette.enabled, ($ = e.vignette) != null && $.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = h.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = h.vignette.center.y), e.vignette)
|
|
1198
1203
|
switch (((Y = e.vignette) == null ? void 0 : Y.blendMode) ?? h.vignette.blendMode) {
|
|
1199
1204
|
case "Multiply":
|
|
1200
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1205
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1201
1206
|
break;
|
|
1202
1207
|
case "Opaque":
|
|
1203
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1208
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_OPAQUE;
|
|
1204
1209
|
break;
|
|
1205
1210
|
}
|
|
1206
1211
|
(j = e.vignette) != null && j.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
@@ -1221,28 +1226,25 @@ class nt {
|
|
|
1221
1226
|
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;
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
1224
|
-
|
|
1225
|
-
return new
|
|
1229
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1230
|
+
return new Ge(s);
|
|
1226
1231
|
});
|
|
1227
|
-
|
|
1232
|
+
ge.OnPluginActivatedObservable.add((s) => {
|
|
1228
1233
|
if (s.name === "gltf") {
|
|
1229
1234
|
const e = s;
|
|
1230
1235
|
e.transparencyAsCoverage = !0;
|
|
1231
1236
|
}
|
|
1232
1237
|
});
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
return new g(s.x, s.y, s.z);
|
|
1238
|
+
function T(s) {
|
|
1239
|
+
return new m(s.x, s.y, s.z);
|
|
1236
1240
|
}
|
|
1237
|
-
function
|
|
1241
|
+
function L(s) {
|
|
1238
1242
|
return { x: s.x, y: s.y, z: s.z };
|
|
1239
1243
|
}
|
|
1240
|
-
class
|
|
1244
|
+
class Ut {
|
|
1241
1245
|
constructor(e) {
|
|
1242
|
-
var
|
|
1243
|
-
this.
|
|
1244
|
-
[ue, 0]
|
|
1245
|
-
]), this.focusLostNotified = !1, this.loadObservable = new b(), this.focusLostObservable = new b(), this.initializedCallbacks = [], this.isInitialized = !1, this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.renderLoop = () => {
|
|
1246
|
+
var r;
|
|
1247
|
+
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.initializedCallbacks = [], this.isInitialized = !1, this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.renderLoop = () => {
|
|
1246
1248
|
this.engine.views && (this.modelContainers.forEach((l) => {
|
|
1247
1249
|
l.updateDynamicTextures();
|
|
1248
1250
|
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((l) => {
|
|
@@ -1253,12 +1255,12 @@ class Wt {
|
|
|
1253
1255
|
const i = (() => {
|
|
1254
1256
|
if (!(e != null && e.noRender))
|
|
1255
1257
|
return this.configuration.createCanvas();
|
|
1256
|
-
})(),
|
|
1257
|
-
|
|
1258
|
+
})(), o = "1.5.6";
|
|
1259
|
+
xe.Configuration = {
|
|
1258
1260
|
decoder: {
|
|
1259
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1260
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1261
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1261
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${o}/draco_wasm_wrapper_gltf.js`,
|
|
1262
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${o}/draco_decoder_gltf.wasm`,
|
|
1263
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${o}/draco_decoder_gltf.js`
|
|
1262
1264
|
}
|
|
1263
1265
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1264
1266
|
const a = console.log;
|
|
@@ -1272,17 +1274,17 @@ class Wt {
|
|
|
1272
1274
|
audioEngine: !1,
|
|
1273
1275
|
stencil: this.configuration.highlights.enabled,
|
|
1274
1276
|
forceSRGBBufferSupportState: !0
|
|
1275
|
-
}) : new
|
|
1276
|
-
console.log = a, n.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = n, this.scene = new
|
|
1277
|
+
}) : new ve();
|
|
1278
|
+
console.log = a, n.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = n, this.scene = new ye(n), this.camera = B.create(this.scene, this.configuration), this.renderingPipeline = new st(
|
|
1277
1279
|
this.scene,
|
|
1278
1280
|
!1,
|
|
1279
1281
|
this.camera
|
|
1280
|
-
), this.scene.activeCamera = this.camera, this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture =
|
|
1282
|
+
), this.scene.activeCamera = this.camera, this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture = Ce.CreateFromPrefilteredData(
|
|
1281
1283
|
this.configuration.scene.environmentFile,
|
|
1282
1284
|
this.scene
|
|
1283
|
-
), (
|
|
1285
|
+
), (r = this.configuration.options) != null && r.renderingPipelineConfiguration && this.renderingPipeline.setConfiguration(
|
|
1284
1286
|
this.configuration.options.renderingPipelineConfiguration
|
|
1285
|
-
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new
|
|
1287
|
+
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new He(
|
|
1286
1288
|
this.scene,
|
|
1287
1289
|
this.configuration.emissiveGlowIntensity
|
|
1288
1290
|
), this.engine.onEndFrameObservable.addOnce(() => {
|
|
@@ -1302,12 +1304,6 @@ class Wt {
|
|
|
1302
1304
|
unregisterFocusLostListener(e) {
|
|
1303
1305
|
this.focusLostObservable.removeCallback(e);
|
|
1304
1306
|
}
|
|
1305
|
-
registerLoadProgressListener(e) {
|
|
1306
|
-
this.loadObservable.add(e), e(this.getLoadListenerEvent());
|
|
1307
|
-
}
|
|
1308
|
-
unregisterLoadProgressListener(e) {
|
|
1309
|
-
this.loadObservable.removeCallback(e);
|
|
1310
|
-
}
|
|
1311
1307
|
registerInitializedListener(e) {
|
|
1312
1308
|
this.isInitialized || !this.isInitialized && this.initializedCallbacks.push(e);
|
|
1313
1309
|
}
|
|
@@ -1329,7 +1325,7 @@ class Wt {
|
|
|
1329
1325
|
}
|
|
1330
1326
|
registerView(e) {
|
|
1331
1327
|
const t = e.height, i = e.width;
|
|
1332
|
-
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1328
|
+
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
|
|
1333
1329
|
}
|
|
1334
1330
|
getNumViewports() {
|
|
1335
1331
|
var e;
|
|
@@ -1341,15 +1337,12 @@ class Wt {
|
|
|
1341
1337
|
shutdown() {
|
|
1342
1338
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1343
1339
|
}
|
|
1344
|
-
getSceneInitializationProgress() {
|
|
1345
|
-
return this.loadProgress.get(ue);
|
|
1346
|
-
}
|
|
1347
1340
|
executeCameraAnimation(e) {
|
|
1348
|
-
if (
|
|
1341
|
+
if (!this.camera || this.scene.activeCamera !== this.camera) {
|
|
1349
1342
|
this.queuedCameraAnimation = e;
|
|
1350
1343
|
return;
|
|
1351
1344
|
}
|
|
1352
|
-
|
|
1345
|
+
Qe(
|
|
1353
1346
|
this.scene,
|
|
1354
1347
|
this.scene.activeCamera,
|
|
1355
1348
|
e
|
|
@@ -1369,7 +1362,7 @@ class Wt {
|
|
|
1369
1362
|
};
|
|
1370
1363
|
}
|
|
1371
1364
|
setCameraPose(e) {
|
|
1372
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1365
|
+
this.scene && this.camera && (this.camera.target = new m(
|
|
1373
1366
|
e.target.x,
|
|
1374
1367
|
e.target.y,
|
|
1375
1368
|
e.target.z
|
|
@@ -1381,7 +1374,7 @@ class Wt {
|
|
|
1381
1374
|
throw new Error(
|
|
1382
1375
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1383
1376
|
);
|
|
1384
|
-
e ===
|
|
1377
|
+
e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1385
1378
|
}
|
|
1386
1379
|
animateToLastCameraFocus() {
|
|
1387
1380
|
return new Promise((e) => {
|
|
@@ -1405,18 +1398,18 @@ class Wt {
|
|
|
1405
1398
|
async renderSceneScreenshot(e, t) {
|
|
1406
1399
|
if (!this.camera)
|
|
1407
1400
|
throw new Error("Missing product camera, cannot render screenshot!");
|
|
1408
|
-
const i = new
|
|
1401
|
+
const i = new ue(
|
|
1409
1402
|
"screenshotCamera",
|
|
1410
1403
|
0,
|
|
1411
1404
|
0,
|
|
1412
1405
|
0,
|
|
1413
|
-
|
|
1406
|
+
m.Zero(),
|
|
1414
1407
|
this.scene
|
|
1415
1408
|
);
|
|
1416
1409
|
try {
|
|
1417
|
-
const
|
|
1418
|
-
i.target = t.target ? new
|
|
1419
|
-
const n = await
|
|
1410
|
+
const o = t.latDeg * Math.PI / 180, a = t.lonDeg * Math.PI / 180;
|
|
1411
|
+
i.target = t.target ? new m(t.target.x, t.target.y, t.target.z) : m.Zero(), i.alpha = a, i.beta = o, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1412
|
+
const n = await Me.CreateScreenshotUsingRenderTargetAsync(
|
|
1420
1413
|
this.engine,
|
|
1421
1414
|
i,
|
|
1422
1415
|
e,
|
|
@@ -1433,18 +1426,18 @@ class Wt {
|
|
|
1433
1426
|
const e = this.configuration;
|
|
1434
1427
|
if (!e)
|
|
1435
1428
|
return !0;
|
|
1436
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1437
|
-
if (t === void 0 || i === void 0 ||
|
|
1429
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, o = e.camera.limits.min.beta, a = e.camera.limits.max.beta;
|
|
1430
|
+
if (t === void 0 || i === void 0 || o === void 0 || a === void 0)
|
|
1438
1431
|
return !0;
|
|
1439
|
-
const n = [t, i],
|
|
1432
|
+
const n = [t, i], r = [o, a], l = n.every((d) => d === t), c = r.every((d) => d === o);
|
|
1440
1433
|
return !l && !c;
|
|
1441
1434
|
}
|
|
1442
1435
|
fireResizeEvent() {
|
|
1443
1436
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1444
1437
|
}
|
|
1445
1438
|
setHighlights(e, t) {
|
|
1446
|
-
var
|
|
1447
|
-
e.length === 0 && ((
|
|
1439
|
+
var o;
|
|
1440
|
+
e.length === 0 && ((o = this.highlightLayer) == null || o.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new we("highlights", this.scene, {
|
|
1448
1441
|
isStroke: !0,
|
|
1449
1442
|
blurVerticalSize: 0.85,
|
|
1450
1443
|
blurHorizontalSize: 0.85
|
|
@@ -1452,13 +1445,13 @@ class Wt {
|
|
|
1452
1445
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1453
1446
|
e.forEach((a) => {
|
|
1454
1447
|
const n = this.scene.materials.find(
|
|
1455
|
-
(
|
|
1448
|
+
(r) => r.name === a.name && r.id === a.id
|
|
1456
1449
|
);
|
|
1457
1450
|
n && n.getBindedMeshes().forEach(
|
|
1458
|
-
(
|
|
1451
|
+
(r) => {
|
|
1459
1452
|
var l;
|
|
1460
1453
|
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1461
|
-
|
|
1454
|
+
r,
|
|
1462
1455
|
i || w.FromHexString("#fcba03")
|
|
1463
1456
|
);
|
|
1464
1457
|
}
|
|
@@ -1469,7 +1462,7 @@ class Wt {
|
|
|
1469
1462
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1470
1463
|
}
|
|
1471
1464
|
loadModel(e, t) {
|
|
1472
|
-
const i = new
|
|
1465
|
+
const i = new it({
|
|
1473
1466
|
enablePicking: this.configuration.highlights.enabled,
|
|
1474
1467
|
modelDetails: e,
|
|
1475
1468
|
scene: this.scene,
|
|
@@ -1477,17 +1470,9 @@ class Wt {
|
|
|
1477
1470
|
progressHandler: t
|
|
1478
1471
|
});
|
|
1479
1472
|
return i.getInitializationPromise().then(() => {
|
|
1480
|
-
this.modelContainers.size <= 1 && this.camera.rerunFramingBehavior(void 0, 1),
|
|
1481
|
-
}), i.
|
|
1482
|
-
|
|
1483
|
-
r.remainingCount,
|
|
1484
|
-
r.totalCount,
|
|
1485
|
-
r.taskName
|
|
1486
|
-
)
|
|
1487
|
-
), i.registerModelVariantListener(
|
|
1488
|
-
(r) => this.handleModelProgressCallback(r, r.key)
|
|
1489
|
-
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((r) => {
|
|
1490
|
-
this.setHighlights([r]);
|
|
1473
|
+
this.modelContainers.size <= 1 && this.camera.rerunFramingBehavior(void 0, 1), We(this.scene), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0);
|
|
1474
|
+
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((o) => {
|
|
1475
|
+
this.setHighlights([o]);
|
|
1491
1476
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1492
1477
|
this.setHighlights([]);
|
|
1493
1478
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1510,7 +1495,7 @@ class Wt {
|
|
|
1510
1495
|
}
|
|
1511
1496
|
unregisterPlugin(e) {
|
|
1512
1497
|
const t = this.plugins.indexOf(e);
|
|
1513
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1498
|
+
t > -1 && this.plugins.splice(t, 1).forEach((o) => o.dispose(!1));
|
|
1514
1499
|
}
|
|
1515
1500
|
getGlowLayerManager() {
|
|
1516
1501
|
return this.glowLayerManager;
|
|
@@ -1528,25 +1513,19 @@ class Wt {
|
|
|
1528
1513
|
* Flips a transform around the origin.
|
|
1529
1514
|
*/
|
|
1530
1515
|
flipTransform(e, t, i) {
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1516
|
+
const o = ie.Compose(
|
|
1517
|
+
T(i || { x: 1, y: 1, z: 1 }),
|
|
1518
|
+
x.FromEulerVector(
|
|
1519
|
+
T(t || { x: 0, y: 0, z: 0 })
|
|
1535
1520
|
),
|
|
1536
|
-
|
|
1537
|
-
), a = ie.RotationAxis(
|
|
1538
|
-
return n.decompose(c, l,
|
|
1539
|
-
position:
|
|
1540
|
-
rotation:
|
|
1541
|
-
scale:
|
|
1521
|
+
T(e || { x: 0, y: 0, z: 0 })
|
|
1522
|
+
), a = ie.RotationAxis(m.Up(), Math.PI), n = o.multiply(a), r = m.Zero(), l = x.Identity(), c = m.Zero();
|
|
1523
|
+
return n.decompose(c, l, r), l.multiplyInPlace(x.FromEulerAngles(0, Math.PI, 0)), {
|
|
1524
|
+
position: L(r),
|
|
1525
|
+
rotation: L(l.toEulerAngles()),
|
|
1526
|
+
scale: L(c)
|
|
1542
1527
|
};
|
|
1543
1528
|
}
|
|
1544
|
-
handleMaterialProgressCallback(e, t, i) {
|
|
1545
|
-
this.loadProgress.set(`key_${i}`, e / t * 100), this.notifyLoadHandlers();
|
|
1546
|
-
}
|
|
1547
|
-
handleModelProgressCallback(e, t) {
|
|
1548
|
-
this.loadProgress.set(t, e.loaded * 100 / e.total), this.notifyLoadHandlers();
|
|
1549
|
-
}
|
|
1550
1529
|
/**
|
|
1551
1530
|
* Given a valid canvas element, will remove any existing input controls
|
|
1552
1531
|
* and re-attach them to the given canvas. The pan mouse button can be set
|
|
@@ -1560,31 +1539,12 @@ class Wt {
|
|
|
1560
1539
|
}
|
|
1561
1540
|
this.scene.attachControl(!0, !0, !0);
|
|
1562
1541
|
}
|
|
1563
|
-
/**
|
|
1564
|
-
* Computes a load listener event based on current state of scene.
|
|
1565
|
-
*/
|
|
1566
|
-
getLoadListenerEvent() {
|
|
1567
|
-
const e = Array.from(this.loadProgress.values()).filter(
|
|
1568
|
-
(r) => r < 100
|
|
1569
|
-
), i = e.reduce((r, a) => r + a, 0) / e.length || 0;
|
|
1570
|
-
return {
|
|
1571
|
-
loadValue: e.length === 0 ? 100 : i,
|
|
1572
|
-
sceneInitialized: this.getSceneInitializationProgress() === 100
|
|
1573
|
-
};
|
|
1574
|
-
}
|
|
1575
|
-
/**
|
|
1576
|
-
* Computes the average loading time across all loading events and notifies
|
|
1577
|
-
* listeners of the current load progress.
|
|
1578
|
-
*/
|
|
1579
|
-
notifyLoadHandlers() {
|
|
1580
|
-
this.loadObservable.notifyObservers(this.getLoadListenerEvent());
|
|
1581
|
-
}
|
|
1582
1542
|
}
|
|
1583
1543
|
export {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1544
|
+
S as MaterialEffectMode,
|
|
1545
|
+
I as ProductCameraRig,
|
|
1546
|
+
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1587
1547
|
y as RenderingConfiguration,
|
|
1588
|
-
|
|
1548
|
+
Ut as SpiffCommerce3DPreviewService,
|
|
1589
1549
|
h as renderingPipelineDefaults
|
|
1590
1550
|
};
|