@spiffcommerce/preview 4.1.0 → 5.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -8
- package/dist/index.esm.js +326 -342
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,21 +3,21 @@ import { Engine as me } from "@babylonjs/core/Engines/engine";
|
|
|
3
3
|
import { NullEngine as we } from "@babylonjs/core/Engines/nullEngine";
|
|
4
4
|
import { HighlightLayer as Ce } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
5
|
import { SceneLoader as pe } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
-
import { CubeTexture as
|
|
6
|
+
import { CubeTexture as Me } 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 g, Quaternion as C, Vector2 as
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as g, Quaternion as C, Vector2 as te, Matrix as ie } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as ye } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as b } from "@babylonjs/core/Misc/observable";
|
|
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
|
|
17
|
-
import { ReflectionProbe as
|
|
11
|
+
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as Pe } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Ae } from "@babylonjs/loaders/glTF";
|
|
14
|
+
import { PBRMaterial as S } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
|
+
import { MirrorTexture as Le } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Ee, Vector3 as se, Plane as Oe } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Re } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
18
|
import { GlowLayer as Te } from "@babylonjs/core/Layers/glowLayer";
|
|
19
19
|
import { ActionManager as A } from "@babylonjs/core/Actions/actionManager";
|
|
20
|
-
import { ExecuteCodeAction as
|
|
20
|
+
import { ExecuteCodeAction as ne } from "@babylonjs/core/Actions/directActions";
|
|
21
21
|
import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
|
|
22
22
|
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
23
23
|
import { DynamicTexture as Fe } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
@@ -25,10 +25,10 @@ import { Texture as Be } from "@babylonjs/core/Materials/Textures/texture";
|
|
|
25
25
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
26
26
|
import { QuadraticEase as De, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
27
27
|
import { AssetsManager as ke } from "@babylonjs/core/Misc/assetsManager";
|
|
28
|
-
import { ColorCurves as
|
|
29
|
-
import { ImageProcessingConfiguration as
|
|
28
|
+
import { ColorCurves as re } from "@babylonjs/core/Materials/colorCurves";
|
|
29
|
+
import { ImageProcessingConfiguration as x } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
30
30
|
import { DefaultRenderingPipeline as Ve } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
31
|
+
import { DepthOfFieldEffectBlurLevel as L } 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,13 +39,13 @@ 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 T = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(T || {}), I = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(I || {});
|
|
43
43
|
class Ne {
|
|
44
44
|
constructor(e) {
|
|
45
45
|
this.getSceneClearColor = () => {
|
|
46
|
-
var i,
|
|
47
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
48
|
-
if (this.customOptions && ((
|
|
46
|
+
var i, r, a, n;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
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
51
|
const o = w.FromHexString(
|
|
@@ -60,11 +60,11 @@ class Ne {
|
|
|
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 r = w.FromHexString(t);
|
|
64
64
|
return new f(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
r.r,
|
|
66
|
+
r.g,
|
|
67
|
+
r.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, r, a, n, o, l, c, d, u, m, p;
|
|
95
95
|
return {
|
|
96
96
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
97
97
|
autoRotation: {
|
|
@@ -100,8 +100,8 @@ class Ne {
|
|
|
100
100
|
},
|
|
101
101
|
limits: {
|
|
102
102
|
min: {
|
|
103
|
-
alpha: (
|
|
104
|
-
beta: (
|
|
103
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
104
|
+
beta: (n = this.customOptions) != null && n.lowerBetaLimitDeg ? ((o = this.customOptions) == null ? void 0 : o.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
105
105
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
106
106
|
},
|
|
107
107
|
max: {
|
|
@@ -124,10 +124,10 @@ class Ne {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
get lighting() {
|
|
127
|
-
var e, t, i,
|
|
127
|
+
var e, t, i, r;
|
|
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: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
get emissiveGlowIntensity() {
|
|
@@ -135,12 +135,12 @@ class Ne {
|
|
|
135
135
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
class
|
|
138
|
+
class y {
|
|
139
139
|
/**
|
|
140
140
|
* Returns the resolution expected for generated textures.
|
|
141
141
|
*/
|
|
142
142
|
static getDynamicTextureResolution() {
|
|
143
|
-
return this.getIsMobile() || !
|
|
143
|
+
return this.getIsMobile() || !y.offscreenRenderingSupported() ? {
|
|
144
144
|
width: 1024,
|
|
145
145
|
height: 1024
|
|
146
146
|
} : {
|
|
@@ -248,11 +248,11 @@ class He {
|
|
|
248
248
|
return this.loader.loadNodeAsync(
|
|
249
249
|
e,
|
|
250
250
|
t,
|
|
251
|
-
function(
|
|
252
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
}), i(
|
|
251
|
+
function(r) {
|
|
252
|
+
t.extras && Object.keys(t.extras).forEach((a) => {
|
|
253
|
+
const n = t.extras[a];
|
|
254
|
+
r.metadata[a] = n;
|
|
255
|
+
}), i(r);
|
|
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 S))) {
|
|
281
281
|
if (e.extras.sheen) {
|
|
282
282
|
const i = t;
|
|
283
283
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
@@ -310,51 +310,51 @@ class He {
|
|
|
310
310
|
* @param scene The scene to parse.
|
|
311
311
|
*/
|
|
312
312
|
applyReflections(e) {
|
|
313
|
-
function t(
|
|
314
|
-
const
|
|
315
|
-
return
|
|
316
|
-
o.metadata && o.metadata.reflective &&
|
|
317
|
-
}),
|
|
318
|
-
o.metadata && o.metadata.reflective && !
|
|
319
|
-
}),
|
|
313
|
+
function t(a) {
|
|
314
|
+
const n = [];
|
|
315
|
+
return a.transformNodes.forEach((o) => {
|
|
316
|
+
o.metadata && o.metadata.reflective && n.push(...o.getChildMeshes());
|
|
317
|
+
}), a.meshes.forEach((o) => {
|
|
318
|
+
o.metadata && o.metadata.reflective && !n.includes(o) && n.push(o);
|
|
319
|
+
}), n;
|
|
320
320
|
}
|
|
321
|
-
function i(
|
|
322
|
-
const o =
|
|
321
|
+
function i(a, n = 1) {
|
|
322
|
+
const o = a.material;
|
|
323
323
|
if (!o)
|
|
324
324
|
return;
|
|
325
|
-
const l = new
|
|
325
|
+
const l = new Le(
|
|
326
326
|
"mirror",
|
|
327
|
-
|
|
327
|
+
y.getMirrorTextureResolution(),
|
|
328
328
|
e,
|
|
329
329
|
!0
|
|
330
330
|
);
|
|
331
331
|
l.renderList = t(e);
|
|
332
|
-
const c =
|
|
332
|
+
const c = a.getVerticesData("normal");
|
|
333
333
|
if (!c)
|
|
334
334
|
throw new Error(
|
|
335
|
-
"Mirror attribute specified on: " +
|
|
335
|
+
"Mirror attribute specified on: " + a.name + "But no normals exist to generate a mirror from!"
|
|
336
336
|
);
|
|
337
|
-
|
|
338
|
-
const d =
|
|
339
|
-
new
|
|
337
|
+
a.computeWorldMatrix(!0);
|
|
338
|
+
const d = a.getWorldMatrix(), u = se.TransformNormal(
|
|
339
|
+
new se(c[0], c[1], c[2]),
|
|
340
340
|
d
|
|
341
|
-
).normalize(), m =
|
|
342
|
-
|
|
341
|
+
).normalize(), m = Oe.FromPositionAndNormal(
|
|
342
|
+
a.position,
|
|
343
343
|
u.scale(-1)
|
|
344
344
|
);
|
|
345
|
-
l.mirrorPlane = m, l.level =
|
|
345
|
+
l.mirrorPlane = m, l.level = n, o.reflectionTexture = l;
|
|
346
346
|
}
|
|
347
|
-
function a
|
|
348
|
-
const
|
|
349
|
-
"probe-" +
|
|
347
|
+
function r(a) {
|
|
348
|
+
const n = a.material, o = new Re(
|
|
349
|
+
"probe-" + n.name,
|
|
350
350
|
Ge,
|
|
351
351
|
e
|
|
352
352
|
);
|
|
353
|
-
o.attachToMesh(
|
|
353
|
+
o.attachToMesh(a), o.renderList && o.renderList.push(...t(e)), n.reflectionTexture = o.cubeTexture;
|
|
354
354
|
}
|
|
355
|
-
e.meshes.forEach((
|
|
356
|
-
const
|
|
357
|
-
|
|
355
|
+
e.meshes.forEach((a) => {
|
|
356
|
+
const n = a.metadata;
|
|
357
|
+
n && (n.mirrorTexture && i(a, n.mirrorTexture), n.reflectionProbe && r(a));
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
360
|
}
|
|
@@ -373,29 +373,29 @@ class _e {
|
|
|
373
373
|
}), this.meshCount === 0 && (this.glowLayer.dispose(), this.glowLayer = void 0));
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
async function fe(
|
|
378
|
-
return new Promise((i,
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
return i(
|
|
376
|
+
const ae = /* @__PURE__ */ new Map();
|
|
377
|
+
async function fe(s, e, t) {
|
|
378
|
+
return new Promise((i, r) => {
|
|
379
|
+
const a = ae.get(s);
|
|
380
|
+
if (a && a.scene.uid === e.uid)
|
|
381
|
+
return i(a);
|
|
382
382
|
pe.LoadAssetContainerAsync(
|
|
383
|
-
|
|
383
|
+
s,
|
|
384
384
|
void 0,
|
|
385
385
|
e,
|
|
386
386
|
t
|
|
387
|
-
).then((
|
|
388
|
-
|
|
389
|
-
}).catch(
|
|
387
|
+
).then((n) => {
|
|
388
|
+
ae.set(s, n), i(n);
|
|
389
|
+
}).catch(r);
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function qe(
|
|
393
|
-
t.forEach((
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
const u = i.get(
|
|
392
|
+
function qe(s, e, t, i, r = "") {
|
|
393
|
+
t.forEach((a) => {
|
|
394
|
+
const n = a.getID(), o = a.getName(), l = y.getDynamicTextureResolution();
|
|
395
|
+
s.filter((d) => d.name === r + o).forEach((d) => {
|
|
396
|
+
const u = i.get(n), m = !1;
|
|
397
397
|
if (u)
|
|
398
|
-
|
|
398
|
+
oe(d, u), u.update(m);
|
|
399
399
|
else {
|
|
400
400
|
const p = Ke(
|
|
401
401
|
o,
|
|
@@ -403,77 +403,77 @@ function qe(n, e, t, i, a = "") {
|
|
|
403
403
|
l.width,
|
|
404
404
|
l.height
|
|
405
405
|
);
|
|
406
|
-
i.set(
|
|
406
|
+
i.set(n, p), a.setStaticContext(
|
|
407
407
|
p.getContext()
|
|
408
|
-
),
|
|
408
|
+
), oe(d, p), p.onLoadObservable.addOnce(() => {
|
|
409
409
|
p.update(m);
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
function Ke(
|
|
416
|
-
const
|
|
417
|
-
|
|
415
|
+
function Ke(s, e, t, i) {
|
|
416
|
+
const r = new Fe(
|
|
417
|
+
s,
|
|
418
418
|
{ width: t, height: i },
|
|
419
419
|
e,
|
|
420
|
-
|
|
420
|
+
y.shouldMipMap(),
|
|
421
421
|
Be.TRILINEAR_SAMPLINGMODE,
|
|
422
422
|
me.TEXTUREFORMAT_RGBA
|
|
423
|
-
),
|
|
424
|
-
return
|
|
423
|
+
), a = r.getContext();
|
|
424
|
+
return a && (a.fillStyle = "#f5f5f5", a.fillRect(0, 0, t, i), r.update()), r;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
if (
|
|
428
|
-
const t =
|
|
426
|
+
function oe(s, e) {
|
|
427
|
+
if (s instanceof S) {
|
|
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 {
|
|
431
|
-
const t =
|
|
431
|
+
const t = s, i = t.diffuseTexture;
|
|
432
432
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
function Ue() {
|
|
436
|
-
const
|
|
437
|
-
return
|
|
436
|
+
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
437
|
+
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
438
438
|
}
|
|
439
|
-
const
|
|
440
|
-
function
|
|
441
|
-
return
|
|
439
|
+
const M = 60, le = 1;
|
|
440
|
+
function he(s) {
|
|
441
|
+
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
442
442
|
}
|
|
443
|
-
function We(
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
console.warn(`No animations found for name: ${
|
|
443
|
+
function We(s, e, t, i, r) {
|
|
444
|
+
const a = r ? s.filter((n) => n.name === r) : s;
|
|
445
|
+
if (a.length === 0) {
|
|
446
|
+
console.warn(`No animations found for name: ${r}`);
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
449
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
const o =
|
|
453
|
-
|
|
450
|
+
a.forEach((n) => {
|
|
451
|
+
n.stop();
|
|
452
|
+
const o = he(n), l = i * o;
|
|
453
|
+
n.start(e, le, l, l);
|
|
454
454
|
});
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
const o =
|
|
460
|
-
|
|
457
|
+
a.forEach((n) => {
|
|
458
|
+
n.stop();
|
|
459
|
+
const o = he(n), l = i !== void 0 ? i * o : void 0, c = t !== void 0 ? t * o : void 0;
|
|
460
|
+
n.start(e, le, l, c);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
function be(
|
|
464
|
-
|
|
463
|
+
function be(s) {
|
|
464
|
+
s.forEach((e) => {
|
|
465
465
|
e.stop();
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
-
function Qe(
|
|
469
|
-
const e =
|
|
468
|
+
function Qe(s) {
|
|
469
|
+
const e = s.animationGroups;
|
|
470
470
|
be(e);
|
|
471
471
|
}
|
|
472
|
-
function Ze(
|
|
473
|
-
|
|
474
|
-
const i = [],
|
|
472
|
+
function Ze(s, e, t) {
|
|
473
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = $e(e.alpha, 0, 2 * Math.PI));
|
|
474
|
+
const i = [], r = t.target, a = 0, n = r ? 1 : 0;
|
|
475
475
|
if (t.target && Object.keys(t.target).length > 0 && i.push(
|
|
476
|
-
|
|
476
|
+
P(
|
|
477
477
|
"cameraTargetLerp",
|
|
478
478
|
"target",
|
|
479
479
|
new g().copyFrom(e.target),
|
|
@@ -483,45 +483,45 @@ function Ze(n, e, t) {
|
|
|
483
483
|
t.target.z
|
|
484
484
|
),
|
|
485
485
|
v.ANIMATIONTYPE_VECTOR3,
|
|
486
|
-
|
|
486
|
+
a
|
|
487
487
|
)
|
|
488
488
|
), i.push(
|
|
489
|
-
|
|
489
|
+
P(
|
|
490
490
|
"cameraAlphaLerp",
|
|
491
491
|
"alpha",
|
|
492
492
|
e.alpha,
|
|
493
|
-
|
|
493
|
+
ce(t.lonDeg),
|
|
494
494
|
v.ANIMATIONTYPE_FLOAT,
|
|
495
|
-
|
|
495
|
+
n
|
|
496
496
|
)
|
|
497
497
|
), i.push(
|
|
498
|
-
|
|
498
|
+
P(
|
|
499
499
|
"cameraBetaLerp",
|
|
500
500
|
"beta",
|
|
501
501
|
e.beta,
|
|
502
|
-
|
|
502
|
+
ce(t.latDeg),
|
|
503
503
|
v.ANIMATIONTYPE_FLOAT,
|
|
504
|
-
|
|
504
|
+
n
|
|
505
505
|
)
|
|
506
506
|
), t.radius !== void 0) {
|
|
507
507
|
const c = Math.max(0.01, t.radius);
|
|
508
508
|
i.push(
|
|
509
|
-
|
|
509
|
+
P(
|
|
510
510
|
"cameraRadiusLerp",
|
|
511
511
|
"radius",
|
|
512
512
|
e.radius,
|
|
513
513
|
c,
|
|
514
514
|
v.ANIMATIONTYPE_FLOAT,
|
|
515
|
-
|
|
515
|
+
n
|
|
516
516
|
)
|
|
517
517
|
);
|
|
518
518
|
}
|
|
519
519
|
e.animations.push(...i);
|
|
520
520
|
const l = e.useAutoRotationBehavior;
|
|
521
|
-
e.disableAutoRotationBehavior(),
|
|
521
|
+
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
522
522
|
e,
|
|
523
523
|
0,
|
|
524
|
-
|
|
524
|
+
r ? M * 2 : M,
|
|
525
525
|
!1,
|
|
526
526
|
1,
|
|
527
527
|
() => {
|
|
@@ -529,26 +529,26 @@ function Ze(n, e, t) {
|
|
|
529
529
|
}
|
|
530
530
|
);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
return
|
|
532
|
+
function ce(s) {
|
|
533
|
+
return s * Math.PI / 180;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function P(s, e, t, i, r, a = 0, n = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
536
536
|
const o = new De();
|
|
537
537
|
o.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
538
538
|
const l = new v(
|
|
539
|
-
|
|
539
|
+
s,
|
|
540
540
|
e,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
M,
|
|
542
|
+
r,
|
|
543
|
+
n
|
|
544
544
|
), c = [];
|
|
545
|
-
return
|
|
546
|
-
frame:
|
|
545
|
+
return a > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * a, value: t }), c.push({
|
|
546
|
+
frame: M * (a + 1),
|
|
547
547
|
value: i
|
|
548
548
|
}), l.setKeys(c), l.setEasingFunction(o), l;
|
|
549
549
|
}
|
|
550
|
-
function $e(
|
|
551
|
-
return
|
|
550
|
+
function $e(s, e, t) {
|
|
551
|
+
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
552
552
|
}
|
|
553
553
|
const Ye = {
|
|
554
554
|
albedoTexture: "albedoMap",
|
|
@@ -559,7 +559,7 @@ const Ye = {
|
|
|
559
559
|
metallicTexture: "metallicMap",
|
|
560
560
|
refractionTexture: "refractionMap"
|
|
561
561
|
};
|
|
562
|
-
function je(
|
|
562
|
+
function je(s, e, t, i) {
|
|
563
563
|
[
|
|
564
564
|
"albedoTexture",
|
|
565
565
|
"bumpTexture",
|
|
@@ -568,31 +568,31 @@ function je(n, e, t, i) {
|
|
|
568
568
|
"opacityTexture",
|
|
569
569
|
"metallicTexture",
|
|
570
570
|
"refractionTexture"
|
|
571
|
-
].forEach((
|
|
571
|
+
].forEach((a) => {
|
|
572
572
|
Xe(
|
|
573
|
-
|
|
574
|
-
|
|
573
|
+
a,
|
|
574
|
+
s,
|
|
575
575
|
e,
|
|
576
576
|
t,
|
|
577
577
|
i
|
|
578
578
|
);
|
|
579
|
-
}), tt(
|
|
579
|
+
}), tt(s, e);
|
|
580
580
|
}
|
|
581
|
-
function Xe(
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
581
|
+
function Xe(s, e, t, i, r) {
|
|
582
|
+
const a = Ye[s];
|
|
583
|
+
if (!a)
|
|
584
584
|
throw new Error("Unexpected texture name encountered.");
|
|
585
|
-
const
|
|
586
|
-
o ? i.addTextureTask(
|
|
585
|
+
const n = e[a], o = n == null ? void 0 : n.fileLink;
|
|
586
|
+
o ? i.addTextureTask(s, o, !1, !1) : r && t[s] && (t[s] && t[s].dispose(), t[s] = null, Je(s, t));
|
|
587
587
|
}
|
|
588
|
-
function Je(
|
|
589
|
-
|
|
588
|
+
function Je(s, e) {
|
|
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 et(
|
|
592
|
-
|
|
591
|
+
function et(s, e, t, i) {
|
|
592
|
+
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
593
|
}
|
|
594
|
-
function tt(
|
|
595
|
-
|
|
594
|
+
function tt(s, e) {
|
|
595
|
+
s.clearCoat && (s.clearCoat === I.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === I.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
596
596
|
}
|
|
597
597
|
class it {
|
|
598
598
|
constructor(e, t, i) {
|
|
@@ -607,18 +607,18 @@ class it {
|
|
|
607
607
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
608
608
|
* where we want to undo changes are remove effects from display.
|
|
609
609
|
*/
|
|
610
|
-
async applyMaterial(e, t, i,
|
|
611
|
-
return new Promise((
|
|
612
|
-
const
|
|
610
|
+
async applyMaterial(e, t, i, r) {
|
|
611
|
+
return new Promise((a) => {
|
|
612
|
+
const n = this.materialVariantMap.get(e);
|
|
613
613
|
this.materialVariantMap.set(e, {
|
|
614
|
-
...
|
|
614
|
+
...n,
|
|
615
615
|
...t
|
|
616
616
|
});
|
|
617
617
|
const o = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
618
618
|
(d) => d.name === o
|
|
619
619
|
);
|
|
620
620
|
if (l.length === 0) {
|
|
621
|
-
|
|
621
|
+
a();
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
624
|
const c = new ke(this.scene);
|
|
@@ -627,7 +627,7 @@ class it {
|
|
|
627
627
|
t,
|
|
628
628
|
d,
|
|
629
629
|
c,
|
|
630
|
-
|
|
630
|
+
r
|
|
631
631
|
)
|
|
632
632
|
), c.onProgress = (d, u, m) => {
|
|
633
633
|
i && i(d / u * 100, 100, m.name);
|
|
@@ -642,7 +642,7 @@ class it {
|
|
|
642
642
|
m.texture
|
|
643
643
|
)
|
|
644
644
|
);
|
|
645
|
-
}),
|
|
645
|
+
}), a();
|
|
646
646
|
}, c.loadAsync();
|
|
647
647
|
});
|
|
648
648
|
}
|
|
@@ -653,20 +653,20 @@ class it {
|
|
|
653
653
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
654
654
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
655
655
|
*/
|
|
656
|
-
async applyModel(e, t, i,
|
|
656
|
+
async applyModel(e, t, i, r) {
|
|
657
657
|
var l, c;
|
|
658
658
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
659
659
|
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
660
|
this.loadedContainerForKey.has(e) && ((c = this.loadedContainerForKey.get(e)) == null || c.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && this.setBaseModelEnabled(!1);
|
|
661
|
-
const
|
|
661
|
+
const n = (await fe(i, this.scene, r)).instantiateModelsToScene(
|
|
662
662
|
this.renameClonedAsset,
|
|
663
663
|
!0
|
|
664
664
|
);
|
|
665
|
-
this.loadedContainerForKey.set(e,
|
|
665
|
+
this.loadedContainerForKey.set(e, n), this.loadedMaterialsForKey.set(e, ve(n));
|
|
666
666
|
const o = [];
|
|
667
667
|
return this.materialVariantMap.forEach(async (d, u) => {
|
|
668
668
|
o.push(this.applyMaterial(u, d));
|
|
669
|
-
}), await Promise.all(o),
|
|
669
|
+
}), await Promise.all(o), n;
|
|
670
670
|
}
|
|
671
671
|
dispose() {
|
|
672
672
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -688,19 +688,19 @@ class it {
|
|
|
688
688
|
}), e;
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function ve(
|
|
691
|
+
function ve(s) {
|
|
692
692
|
const e = [];
|
|
693
|
-
return
|
|
693
|
+
return s.rootNodes.forEach((t) => {
|
|
694
694
|
t.getChildMeshes().forEach((i) => {
|
|
695
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
696
|
-
const
|
|
697
|
-
|
|
695
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
696
|
+
const a = r.getMaterial(!1);
|
|
697
|
+
a && !e.includes(a) && e.push(a);
|
|
698
698
|
});
|
|
699
699
|
});
|
|
700
700
|
}), e;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
703
|
-
return
|
|
702
|
+
function de(s, e = "") {
|
|
703
|
+
return s.map((t) => ({
|
|
704
704
|
name: t.name.substring(e.length),
|
|
705
705
|
loop: t.loopAnimation,
|
|
706
706
|
to: t.to,
|
|
@@ -713,37 +713,37 @@ class st {
|
|
|
713
713
|
const {
|
|
714
714
|
enablePicking: t,
|
|
715
715
|
modelDetails: i,
|
|
716
|
-
previewService:
|
|
717
|
-
progressHandler:
|
|
718
|
-
scene:
|
|
716
|
+
previewService: r,
|
|
717
|
+
progressHandler: a,
|
|
718
|
+
scene: n
|
|
719
719
|
} = e;
|
|
720
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService =
|
|
721
|
-
|
|
720
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = r, this.scene = n, this.variantManager = new it(
|
|
721
|
+
n,
|
|
722
722
|
this.renameClonedAsset.bind(this),
|
|
723
|
-
this.
|
|
723
|
+
this.setBaseModelEnabled.bind(this)
|
|
724
724
|
), this.previewService.registerInitializedListener(
|
|
725
725
|
async () => await this.processQueuedEvents()
|
|
726
726
|
), this.transformRoot = new Se("root", this.scene);
|
|
727
727
|
const o = async () => (this.assetContainer = await fe(
|
|
728
728
|
i.model,
|
|
729
|
-
|
|
730
|
-
|
|
729
|
+
n,
|
|
730
|
+
a
|
|
731
731
|
), this.initialized = !0, this.instantiate(), this);
|
|
732
732
|
this.importPromise = o();
|
|
733
733
|
}
|
|
734
734
|
//#region Interface implementation
|
|
735
|
-
async applyMaterialVariant(e, t, i,
|
|
736
|
-
if (
|
|
735
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
736
|
+
if (!this.initialized) {
|
|
737
737
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
738
|
-
const
|
|
739
|
-
|
|
738
|
+
const n = this.materialReadyToLoadCallbacks.get(e);
|
|
739
|
+
n == null || n.set(
|
|
740
740
|
t,
|
|
741
741
|
this.applyMaterialVariant.bind(
|
|
742
742
|
this,
|
|
743
743
|
e,
|
|
744
744
|
t,
|
|
745
745
|
i,
|
|
746
|
-
|
|
746
|
+
r
|
|
747
747
|
)
|
|
748
748
|
);
|
|
749
749
|
} else {
|
|
@@ -751,49 +751,49 @@ class st {
|
|
|
751
751
|
e,
|
|
752
752
|
/* @__PURE__ */ new Map()
|
|
753
753
|
);
|
|
754
|
-
const
|
|
755
|
-
|
|
754
|
+
const n = this.materialReadyToLoadCallbacks.get(e);
|
|
755
|
+
n == null || n.set(
|
|
756
756
|
t,
|
|
757
757
|
this.applyMaterialVariant.bind(
|
|
758
758
|
this,
|
|
759
759
|
e,
|
|
760
760
|
t,
|
|
761
761
|
i,
|
|
762
|
-
|
|
762
|
+
r
|
|
763
763
|
)
|
|
764
764
|
);
|
|
765
765
|
}
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
|
-
const
|
|
768
|
+
const a = async () => {
|
|
769
769
|
await this.variantManager.applyMaterial(
|
|
770
770
|
e,
|
|
771
771
|
i,
|
|
772
|
-
(
|
|
772
|
+
(n, o, l) => {
|
|
773
773
|
this.materialVariantObservable.notifyObservers({
|
|
774
|
-
remainingCount:
|
|
774
|
+
remainingCount: n,
|
|
775
775
|
totalCount: o,
|
|
776
776
|
taskName: l
|
|
777
777
|
});
|
|
778
778
|
},
|
|
779
|
-
|
|
779
|
+
r
|
|
780
780
|
);
|
|
781
781
|
};
|
|
782
782
|
if (this.materialChangesInProgress.includes(e)) {
|
|
783
783
|
if (this.queuedMaterialChanges.has(e)) {
|
|
784
|
-
const
|
|
785
|
-
|
|
784
|
+
const n = this.queuedMaterialChanges.get(e);
|
|
785
|
+
n == null || n.set(t, a);
|
|
786
786
|
} else {
|
|
787
787
|
this.queuedMaterialChanges.set(
|
|
788
788
|
e,
|
|
789
789
|
/* @__PURE__ */ new Map()
|
|
790
790
|
);
|
|
791
|
-
const
|
|
792
|
-
|
|
791
|
+
const n = this.queuedMaterialChanges.get(e);
|
|
792
|
+
n == null || n.set(t, a);
|
|
793
793
|
}
|
|
794
794
|
return;
|
|
795
795
|
}
|
|
796
|
-
this.materialChangesInProgress.push(e), await
|
|
796
|
+
this.materialChangesInProgress.push(e), await a(), this.queuedMaterialChanges.has(e) && (this.queuedMaterialChanges.get(e).forEach(async (o) => {
|
|
797
797
|
await o();
|
|
798
798
|
}), this.queuedMaterialChanges.delete(e)), this.materialChangesInProgress.splice(
|
|
799
799
|
this.materialChangesInProgress.indexOf(e),
|
|
@@ -801,7 +801,7 @@ class st {
|
|
|
801
801
|
), this.configureGlowLayer();
|
|
802
802
|
}
|
|
803
803
|
async applyModelVariant(e, t, i) {
|
|
804
|
-
if (!this.
|
|
804
|
+
if (!this.initialized) {
|
|
805
805
|
this.modelReadyToLoadCallbacks.set(
|
|
806
806
|
e,
|
|
807
807
|
this.applyModelVariant.bind(
|
|
@@ -813,7 +813,7 @@ class st {
|
|
|
813
813
|
);
|
|
814
814
|
return;
|
|
815
815
|
}
|
|
816
|
-
const
|
|
816
|
+
const r = () => this.variantManager.applyModel(
|
|
817
817
|
e,
|
|
818
818
|
i,
|
|
819
819
|
t == null ? void 0 : t.model,
|
|
@@ -825,18 +825,18 @@ class st {
|
|
|
825
825
|
}
|
|
826
826
|
);
|
|
827
827
|
if (this.modelChangesInProgress.includes(e)) {
|
|
828
|
-
this.queuedModelChanges.set(e,
|
|
828
|
+
this.queuedModelChanges.set(e, r);
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
|
-
const
|
|
831
|
+
const n = await (async () => {
|
|
832
832
|
this.modelChangesInProgress.push(e);
|
|
833
|
-
let o = await
|
|
833
|
+
let o = await r();
|
|
834
834
|
return this.queuedModelChanges.has(e) && (o = await this.queuedModelChanges.get(e)(), this.queuedModelChanges.delete(e)), this.modelChangesInProgress.splice(
|
|
835
835
|
this.modelChangesInProgress.indexOf(e),
|
|
836
836
|
1
|
|
837
837
|
), o;
|
|
838
838
|
})();
|
|
839
|
-
this.modelInstance && be(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService),
|
|
839
|
+
this.modelInstance && be(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), n ? this.configureModelInstance(n) : this.configureGlowLayer();
|
|
840
840
|
}
|
|
841
841
|
dispose() {
|
|
842
842
|
var e;
|
|
@@ -861,7 +861,7 @@ class st {
|
|
|
861
861
|
getAnimations(e) {
|
|
862
862
|
return [
|
|
863
863
|
...this.animations,
|
|
864
|
-
...e ?
|
|
864
|
+
...e ? de(
|
|
865
865
|
this.variantManager.getAnimationGroups(),
|
|
866
866
|
this.renameClonedAsset("")
|
|
867
867
|
) : []
|
|
@@ -920,14 +920,14 @@ class st {
|
|
|
920
920
|
e.rootNodes.forEach((t) => {
|
|
921
921
|
t.getChildMeshes(!1).forEach((i) => {
|
|
922
922
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new A(this.scene)), i.actionManager.registerAction(
|
|
923
|
-
new
|
|
924
|
-
|
|
923
|
+
new ne(A.OnPointerOverTrigger, (r) => {
|
|
924
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
925
925
|
id: i.material.id,
|
|
926
926
|
name: this.stripIdFromName(i.material.name)
|
|
927
927
|
});
|
|
928
928
|
})
|
|
929
929
|
), i.actionManager.registerAction(
|
|
930
|
-
new
|
|
930
|
+
new ne(A.OnPointerOutTrigger, () => {
|
|
931
931
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
932
932
|
id: i.material.id,
|
|
933
933
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -956,15 +956,15 @@ class st {
|
|
|
956
956
|
return this.modelReadyToLoadCallbacks.size;
|
|
957
957
|
}
|
|
958
958
|
configureGlowLayer() {
|
|
959
|
-
const e = (i) => i instanceof
|
|
959
|
+
const e = (i) => i instanceof S && i.emissiveTexture !== null;
|
|
960
960
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
961
961
|
}
|
|
962
962
|
configureModelInstance(e) {
|
|
963
|
-
var
|
|
964
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
965
|
-
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = C.Identity(), this.transformRoot.scaling = g.One(), e.rootNodes.forEach((
|
|
966
|
-
|
|
967
|
-
}), this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
963
|
+
var a;
|
|
964
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
965
|
+
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = C.Identity(), this.transformRoot.scaling = g.One(), e.rootNodes.forEach((n) => {
|
|
966
|
+
n.parent = this.transformRoot;
|
|
967
|
+
}), this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((a = this.contextService) == null ? void 0 : a.getAll()) || /* @__PURE__ */ new Map(), qe(
|
|
968
968
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
969
969
|
this.scene,
|
|
970
970
|
this.canvasPanels,
|
|
@@ -989,7 +989,7 @@ class st {
|
|
|
989
989
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
990
990
|
this.renameClonedAsset.bind(this),
|
|
991
991
|
!0
|
|
992
|
-
), this.materials = ve(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations =
|
|
992
|
+
), this.materials = ve(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = de(
|
|
993
993
|
this.modelInstance.animationGroups,
|
|
994
994
|
this.renameClonedAsset("")
|
|
995
995
|
), this.processQueuedEvents();
|
|
@@ -997,15 +997,15 @@ class st {
|
|
|
997
997
|
renameClonedAsset(e) {
|
|
998
998
|
return `${this.id}_${e}`;
|
|
999
999
|
}
|
|
1000
|
-
|
|
1000
|
+
setBaseModelEnabled(e) {
|
|
1001
1001
|
e && !this.modelInstance ? this.instantiate() : !e && this.modelInstance && this.destroyInstance();
|
|
1002
1002
|
}
|
|
1003
1003
|
updateDynamicTextures() {
|
|
1004
1004
|
var e;
|
|
1005
1005
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1006
1006
|
(t, i) => {
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1007
|
+
const r = this.dynamicTextures.get(i);
|
|
1008
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1009
1009
|
}
|
|
1010
1010
|
);
|
|
1011
1011
|
}
|
|
@@ -1039,15 +1039,15 @@ class st {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
//#endregion
|
|
1041
1041
|
}
|
|
1042
|
-
class
|
|
1043
|
-
constructor(e, t, i,
|
|
1042
|
+
class F extends ge {
|
|
1043
|
+
constructor(e, t, i, r, a, n, o, l) {
|
|
1044
1044
|
super(
|
|
1045
1045
|
e,
|
|
1046
1046
|
t,
|
|
1047
1047
|
i,
|
|
1048
|
-
a,
|
|
1049
1048
|
r,
|
|
1050
|
-
|
|
1049
|
+
a,
|
|
1050
|
+
n,
|
|
1051
1051
|
l
|
|
1052
1052
|
), this.lastFocus = new g(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, o.camera.autoOrientation && (this.alpha += Math.PI), o && (o.camera.limits.min.beta && (this.lowerBetaLimit = o.camera.limits.min.beta), o.camera.limits.max.beta && (this.upperBetaLimit = o.camera.limits.max.beta), o.camera.limits.min.alpha && (this.lowerAlphaLimit = o.camera.limits.min.alpha), o.camera.limits.max.alpha && (this.upperAlphaLimit = o.camera.limits.max.alpha), o.camera.limits.min.radius && (this.lowerRadiusLimit = o.camera.limits.min.radius), o.camera.limits.max.radius && (this.upperRadiusLimit = o.camera.limits.max.radius), o.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1053
1053
|
o.camera.autoRotation.idleTimeMs
|
|
@@ -1076,7 +1076,7 @@ class B extends ge {
|
|
|
1076
1076
|
this.useFramingBehavior = !0;
|
|
1077
1077
|
const e = this.getFramingBehavior();
|
|
1078
1078
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1079
|
-
const t =
|
|
1079
|
+
const t = E(this._scene);
|
|
1080
1080
|
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
1081
|
}
|
|
1082
1082
|
/**
|
|
@@ -1087,14 +1087,14 @@ class B extends ge {
|
|
|
1087
1087
|
rerunFramingBehavior(e, t) {
|
|
1088
1088
|
const i = this.getFramingBehavior();
|
|
1089
1089
|
i.framingTime = t || 800;
|
|
1090
|
-
const
|
|
1090
|
+
const r = () => {
|
|
1091
1091
|
e && e();
|
|
1092
|
-
},
|
|
1093
|
-
this.setRadius(
|
|
1094
|
-
|
|
1095
|
-
|
|
1092
|
+
}, a = E(this._scene), n = a.max.subtract(a.min), o = a.min.add(n.scale(0.5));
|
|
1093
|
+
this.setRadius(n.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(o), this.panDenominator = n.length(), i.zoomOnBoundingInfo(
|
|
1094
|
+
a.min,
|
|
1095
|
+
a.max,
|
|
1096
1096
|
void 0,
|
|
1097
|
-
|
|
1097
|
+
r
|
|
1098
1098
|
), i.framingTime = 0;
|
|
1099
1099
|
}
|
|
1100
1100
|
/**
|
|
@@ -1124,28 +1124,28 @@ class B extends ge {
|
|
|
1124
1124
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1125
1125
|
*/
|
|
1126
1126
|
static create(e, t, i) {
|
|
1127
|
-
const
|
|
1127
|
+
const r = E(e), a = r.max.subtract(r.min), n = r.min.add(a.scale(0.5)), o = new F(
|
|
1128
1128
|
"ProductCamera",
|
|
1129
1129
|
-(Math.PI / 2),
|
|
1130
1130
|
Math.PI / 2,
|
|
1131
|
-
|
|
1132
|
-
|
|
1131
|
+
a.length() * 1.5,
|
|
1132
|
+
n,
|
|
1133
1133
|
e,
|
|
1134
1134
|
t
|
|
1135
1135
|
);
|
|
1136
|
-
return o.panningInertia = 0, o.panningOriginTarget.copyFrom(
|
|
1136
|
+
return o.panningInertia = 0, o.panningOriginTarget.copyFrom(n), o.panDenominator = a.length(), o.onAfterCheckInputsObservable.add(() => {
|
|
1137
1137
|
o.panningSensibility = 1e3 / o.panDenominator;
|
|
1138
1138
|
}), i && (e.activeCamera = o), o;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1142
|
-
if (
|
|
1141
|
+
function E(s) {
|
|
1142
|
+
if (s.meshes.length === 0)
|
|
1143
1143
|
return {
|
|
1144
1144
|
min: new g(-1, -1, -1),
|
|
1145
1145
|
max: new g(1, 1, 1)
|
|
1146
1146
|
};
|
|
1147
|
-
const e =
|
|
1148
|
-
return
|
|
1147
|
+
const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1148
|
+
return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1149
1149
|
}
|
|
1150
1150
|
class nt {
|
|
1151
1151
|
constructor(e, t = !1, i = void 0) {
|
|
@@ -1165,98 +1165,106 @@ class nt {
|
|
|
1165
1165
|
return this.currentConfiguration;
|
|
1166
1166
|
}
|
|
1167
1167
|
setConfiguration(e) {
|
|
1168
|
-
var t, i,
|
|
1168
|
+
var t, i, r, a, n, o, l, c, d, u, m, p, B, D, z, k, V, N, G, H, _, q, K, U, W, Q, Z, $, Y, j, X, J, ee;
|
|
1169
1169
|
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 = ((
|
|
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 = ((r = e.bloom) == null ? void 0 : r.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 = ((o = e.bloom) == null ? void 0 : o.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 = (m = e.chromaticAberration) != null && m.direction ? new te(
|
|
1171
1171
|
e.chromaticAberration.direction.x,
|
|
1172
1172
|
e.chromaticAberration.direction.y
|
|
1173
|
-
) : new
|
|
1173
|
+
) : new te(
|
|
1174
1174
|
h.chromaticAberration.direction.x,
|
|
1175
1175
|
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
|
|
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 = ((B = e.depthOfField) == null ? void 0 : B.enabled) ?? h.depthOfField.enabled, e.depthOfField)
|
|
1177
1177
|
switch (e.depthOfField.blurLevel ?? h.depthOfField.blurLevel) {
|
|
1178
1178
|
case "Low":
|
|
1179
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1179
|
+
this.renderingPipeline.depthOfFieldBlurLevel = L.Low;
|
|
1180
1180
|
break;
|
|
1181
1181
|
case "Medium":
|
|
1182
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1182
|
+
this.renderingPipeline.depthOfFieldBlurLevel = L.Medium;
|
|
1183
1183
|
break;
|
|
1184
1184
|
case "High":
|
|
1185
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1185
|
+
this.renderingPipeline.depthOfFieldBlurLevel = L.High;
|
|
1186
1186
|
break;
|
|
1187
1187
|
}
|
|
1188
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
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 = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? h.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((N = e.grain) == null ? void 0 : N.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
1189
|
switch (e.misc.toneMappingType ?? h.misc.toneMappingType) {
|
|
1190
1190
|
case "Standard":
|
|
1191
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1191
|
+
this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_STANDARD;
|
|
1192
1192
|
break;
|
|
1193
1193
|
case "ACES":
|
|
1194
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1194
|
+
this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_ACES;
|
|
1195
1195
|
break;
|
|
1196
1196
|
}
|
|
1197
|
-
if (this.renderingPipeline.sharpenEnabled = ((
|
|
1198
|
-
switch (((
|
|
1197
|
+
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
|
+
switch (((Y = e.vignette) == null ? void 0 : Y.blendMode) ?? h.vignette.blendMode) {
|
|
1199
1199
|
case "Multiply":
|
|
1200
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1200
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_MULTIPLY;
|
|
1201
1201
|
break;
|
|
1202
1202
|
case "Opaque":
|
|
1203
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1203
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_OPAQUE;
|
|
1204
1204
|
break;
|
|
1205
1205
|
}
|
|
1206
|
-
(
|
|
1206
|
+
(j = e.vignette) != null && j.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1207
1207
|
e.vignette.colorRgba.r,
|
|
1208
1208
|
e.vignette.colorRgba.g,
|
|
1209
1209
|
e.vignette.colorRgba.b,
|
|
1210
1210
|
e.vignette.colorRgba.a
|
|
1211
|
-
) : (
|
|
1211
|
+
) : (X = e.vignette) != null && X.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = f.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1212
1212
|
h.vignette.colorRgba.r,
|
|
1213
1213
|
h.vignette.colorRgba.g,
|
|
1214
1214
|
h.vignette.colorRgba.b,
|
|
1215
1215
|
h.vignette.colorRgba.a
|
|
1216
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((
|
|
1216
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((J = e.vignette) == null ? void 0 : J.stretch) ?? h.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ee = e.vignette) == null ? void 0 : ee.weight) ?? h.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1217
1217
|
}
|
|
1218
1218
|
}
|
|
1219
1219
|
updateColorCurve(e) {
|
|
1220
|
-
const t = new
|
|
1220
|
+
const t = new re();
|
|
1221
1221
|
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
1222
|
}
|
|
1223
1223
|
}
|
|
1224
|
-
|
|
1225
|
-
return new He(
|
|
1224
|
+
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1225
|
+
return new He(s);
|
|
1226
1226
|
});
|
|
1227
|
-
pe.OnPluginActivatedObservable.add((
|
|
1228
|
-
if (
|
|
1229
|
-
const e =
|
|
1227
|
+
pe.OnPluginActivatedObservable.add((s) => {
|
|
1228
|
+
if (s.name === "gltf") {
|
|
1229
|
+
const e = s;
|
|
1230
1230
|
e.transparencyAsCoverage = !0;
|
|
1231
1231
|
}
|
|
1232
1232
|
});
|
|
1233
|
-
const
|
|
1234
|
-
function O(
|
|
1235
|
-
return new g(
|
|
1233
|
+
const ue = "initialScene";
|
|
1234
|
+
function O(s) {
|
|
1235
|
+
return new g(s.x, s.y, s.z);
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
return { x:
|
|
1237
|
+
function R(s) {
|
|
1238
|
+
return { x: s.x, y: s.y, z: s.z };
|
|
1239
1239
|
}
|
|
1240
1240
|
class Wt {
|
|
1241
1241
|
constructor(e) {
|
|
1242
|
+
var o;
|
|
1242
1243
|
this.loadProgress = /* @__PURE__ */ new Map([
|
|
1243
|
-
[
|
|
1244
|
-
]), 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.
|
|
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
|
+
this.engine.views && (this.modelContainers.forEach((l) => {
|
|
1247
|
+
l.updateDynamicTextures();
|
|
1248
|
+
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((l) => {
|
|
1249
|
+
const c = this.engine.getRenderingCanvas();
|
|
1250
|
+
l.target.getContext("2d").clearRect(0, 0, c.width, c.height);
|
|
1251
|
+
}), this.scene.render(), !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, 0.1) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0));
|
|
1252
|
+
}, this.configuration = new Ne(e);
|
|
1245
1253
|
const i = (() => {
|
|
1246
1254
|
if (!(e != null && e.noRender))
|
|
1247
1255
|
return this.configuration.createCanvas();
|
|
1248
|
-
})(),
|
|
1249
|
-
|
|
1256
|
+
})(), r = "1.5.6";
|
|
1257
|
+
ye.Configuration = {
|
|
1250
1258
|
decoder: {
|
|
1251
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1252
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1253
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1259
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1260
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1261
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1254
1262
|
}
|
|
1255
1263
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1256
|
-
const
|
|
1264
|
+
const a = console.log;
|
|
1257
1265
|
console.log = () => {
|
|
1258
1266
|
};
|
|
1259
|
-
const
|
|
1267
|
+
const n = i ? new me(i, !0, {
|
|
1260
1268
|
adaptToDeviceRatio: !0,
|
|
1261
1269
|
limitDeviceRatio: 2,
|
|
1262
1270
|
premultipliedAlpha: !1,
|
|
@@ -1265,14 +1273,21 @@ class Wt {
|
|
|
1265
1273
|
stencil: this.configuration.highlights.enabled,
|
|
1266
1274
|
forceSRGBBufferSupportState: !0
|
|
1267
1275
|
}) : new we();
|
|
1268
|
-
console.log =
|
|
1276
|
+
console.log = a, n.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = n, this.scene = new Pe(n), this.camera = F.create(this.scene, this.configuration), this.renderingPipeline = new nt(
|
|
1269
1277
|
this.scene,
|
|
1270
1278
|
!1,
|
|
1271
1279
|
this.camera
|
|
1280
|
+
), this.scene.activeCamera = this.camera, this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture = Me.CreateFromPrefilteredData(
|
|
1281
|
+
this.configuration.scene.environmentFile,
|
|
1282
|
+
this.scene
|
|
1283
|
+
), (o = this.configuration.options) != null && o.renderingPipelineConfiguration && this.renderingPipeline.setConfiguration(
|
|
1284
|
+
this.configuration.options.renderingPipelineConfiguration
|
|
1272
1285
|
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new _e(
|
|
1273
1286
|
this.scene,
|
|
1274
1287
|
this.configuration.emissiveGlowIntensity
|
|
1275
|
-
)
|
|
1288
|
+
), this.engine.onEndFrameObservable.addOnce(() => {
|
|
1289
|
+
this.isInitialized = !0, this.initializedCallbacks.map((l) => l()), this.initializedCallbacks = [];
|
|
1290
|
+
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1276
1291
|
}
|
|
1277
1292
|
getEngineContext() {
|
|
1278
1293
|
return {
|
|
@@ -1314,7 +1329,7 @@ class Wt {
|
|
|
1314
1329
|
}
|
|
1315
1330
|
registerView(e) {
|
|
1316
1331
|
const t = e.height, i = e.width;
|
|
1317
|
-
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1332
|
+
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(T.Pan), this.reattachControls(e);
|
|
1318
1333
|
}
|
|
1319
1334
|
getNumViewports() {
|
|
1320
1335
|
var e;
|
|
@@ -1327,40 +1342,7 @@ class Wt {
|
|
|
1327
1342
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1328
1343
|
}
|
|
1329
1344
|
getSceneInitializationProgress() {
|
|
1330
|
-
return this.loadProgress.get(
|
|
1331
|
-
}
|
|
1332
|
-
async initialize(e) {
|
|
1333
|
-
var i, a;
|
|
1334
|
-
this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture = ye.CreateFromPrefilteredData(
|
|
1335
|
-
this.configuration.scene.environmentFile,
|
|
1336
|
-
this.scene
|
|
1337
|
-
);
|
|
1338
|
-
let t;
|
|
1339
|
-
return e && (t = await this.loadModel(
|
|
1340
|
-
e,
|
|
1341
|
-
(s) => {
|
|
1342
|
-
this.loadProgress.set(
|
|
1343
|
-
L,
|
|
1344
|
-
s.loaded * 100 / s.total
|
|
1345
|
-
), this.notifyLoadHandlers();
|
|
1346
|
-
}
|
|
1347
|
-
).getInitializationPromise()), this.loadProgress.set(L, 100), this.notifyLoadHandlers(), this.scene.activeCamera = this.camera, this.camera.rerunFramingBehavior(void 0, 1), Qe(this.scene), ((i = this.engine.views) == null ? void 0 : i.length) >= 1 && this.reattachControls(
|
|
1348
|
-
this.engine.views[this.engine.views.length - 1].target
|
|
1349
|
-
), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0), this.isInitialized = !0, await Promise.all(this.initializedCallbacks.map((r) => r())), this.initializedCallbacks = [], (a = this.configuration.options) != null && a.renderingPipelineConfiguration && this.renderingPipeline.setConfiguration(
|
|
1350
|
-
this.configuration.options.renderingPipelineConfiguration
|
|
1351
|
-
), this.engine.runRenderLoop(() => {
|
|
1352
|
-
this.engine.views && (this.modelContainers.forEach((r) => {
|
|
1353
|
-
r.updateDynamicTextures();
|
|
1354
|
-
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((r) => {
|
|
1355
|
-
const s = this.engine.getRenderingCanvas();
|
|
1356
|
-
r.target.getContext("2d").clearRect(
|
|
1357
|
-
0,
|
|
1358
|
-
0,
|
|
1359
|
-
s.width,
|
|
1360
|
-
s.height
|
|
1361
|
-
);
|
|
1362
|
-
}), this.scene.render(), !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, 0.1) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0));
|
|
1363
|
-
}), t;
|
|
1345
|
+
return this.loadProgress.get(ue);
|
|
1364
1346
|
}
|
|
1365
1347
|
executeCameraAnimation(e) {
|
|
1366
1348
|
if (this.getSceneInitializationProgress() !== 100 || !this.camera || this.scene.activeCamera !== this.camera) {
|
|
@@ -1399,7 +1381,7 @@ class Wt {
|
|
|
1399
1381
|
throw new Error(
|
|
1400
1382
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1401
1383
|
);
|
|
1402
|
-
e ===
|
|
1384
|
+
e === T.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1403
1385
|
}
|
|
1404
1386
|
animateToLastCameraFocus() {
|
|
1405
1387
|
return new Promise((e) => {
|
|
@@ -1432,9 +1414,9 @@ class Wt {
|
|
|
1432
1414
|
this.scene
|
|
1433
1415
|
);
|
|
1434
1416
|
try {
|
|
1435
|
-
const
|
|
1436
|
-
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha =
|
|
1437
|
-
const
|
|
1417
|
+
const r = t.latDeg * Math.PI / 180, a = t.lonDeg * Math.PI / 180;
|
|
1418
|
+
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = a, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1419
|
+
const n = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1438
1420
|
this.engine,
|
|
1439
1421
|
i,
|
|
1440
1422
|
e,
|
|
@@ -1442,7 +1424,7 @@ class Wt {
|
|
|
1442
1424
|
2,
|
|
1443
1425
|
!0
|
|
1444
1426
|
);
|
|
1445
|
-
return i.dispose(),
|
|
1427
|
+
return i.dispose(), n;
|
|
1446
1428
|
} catch {
|
|
1447
1429
|
throw i.isDisposed() || i.dispose(), new Error("Failed to render screenshot");
|
|
1448
1430
|
}
|
|
@@ -1451,28 +1433,28 @@ class Wt {
|
|
|
1451
1433
|
const e = this.configuration;
|
|
1452
1434
|
if (!e)
|
|
1453
1435
|
return !0;
|
|
1454
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1455
|
-
if (t === void 0 || i === void 0 ||
|
|
1436
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, a = e.camera.limits.max.beta;
|
|
1437
|
+
if (t === void 0 || i === void 0 || r === void 0 || a === void 0)
|
|
1456
1438
|
return !0;
|
|
1457
|
-
const
|
|
1439
|
+
const n = [t, i], o = [r, a], l = n.every((d) => d === t), c = o.every((d) => d === r);
|
|
1458
1440
|
return !l && !c;
|
|
1459
1441
|
}
|
|
1460
1442
|
fireResizeEvent() {
|
|
1461
1443
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1462
1444
|
}
|
|
1463
1445
|
setHighlights(e, t) {
|
|
1464
|
-
var
|
|
1465
|
-
e.length === 0 && ((
|
|
1446
|
+
var r;
|
|
1447
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new Ce("highlights", this.scene, {
|
|
1466
1448
|
isStroke: !0,
|
|
1467
1449
|
blurVerticalSize: 0.85,
|
|
1468
1450
|
blurHorizontalSize: 0.85
|
|
1469
1451
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1470
1452
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1471
|
-
e.forEach((
|
|
1472
|
-
const
|
|
1473
|
-
(o) => o.name ===
|
|
1453
|
+
e.forEach((a) => {
|
|
1454
|
+
const n = this.scene.materials.find(
|
|
1455
|
+
(o) => o.name === a.name && o.id === a.id
|
|
1474
1456
|
);
|
|
1475
|
-
|
|
1457
|
+
n && n.getBindedMeshes().forEach(
|
|
1476
1458
|
(o) => {
|
|
1477
1459
|
var l;
|
|
1478
1460
|
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
@@ -1494,16 +1476,18 @@ class Wt {
|
|
|
1494
1476
|
previewService: this,
|
|
1495
1477
|
progressHandler: t
|
|
1496
1478
|
});
|
|
1497
|
-
return i.
|
|
1498
|
-
(
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1479
|
+
return i.getInitializationPromise().then(() => {
|
|
1480
|
+
this.modelContainers.size <= 1 && this.camera.rerunFramingBehavior(void 0, 1), Qe(this.scene), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0);
|
|
1481
|
+
}), i.registerMaterialVariantListener(
|
|
1482
|
+
(r) => this.handleMaterialProgressCallback(
|
|
1483
|
+
r.remainingCount,
|
|
1484
|
+
r.totalCount,
|
|
1485
|
+
r.taskName
|
|
1502
1486
|
)
|
|
1503
1487
|
), i.registerModelVariantListener(
|
|
1504
|
-
(
|
|
1505
|
-
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1506
|
-
this.setHighlights([
|
|
1488
|
+
(r) => this.handleModelProgressCallback(r, r.key)
|
|
1489
|
+
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((r) => {
|
|
1490
|
+
this.setHighlights([r]);
|
|
1507
1491
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1508
1492
|
this.setHighlights([]);
|
|
1509
1493
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1526,7 +1510,7 @@ class Wt {
|
|
|
1526
1510
|
}
|
|
1527
1511
|
unregisterPlugin(e) {
|
|
1528
1512
|
const t = this.plugins.indexOf(e);
|
|
1529
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1513
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1530
1514
|
}
|
|
1531
1515
|
getGlowLayerManager() {
|
|
1532
1516
|
return this.glowLayerManager;
|
|
@@ -1544,17 +1528,17 @@ class Wt {
|
|
|
1544
1528
|
* Flips a transform around the origin.
|
|
1545
1529
|
*/
|
|
1546
1530
|
flipTransform(e, t, i) {
|
|
1547
|
-
const
|
|
1531
|
+
const r = ie.Compose(
|
|
1548
1532
|
O(i || { x: 1, y: 1, z: 1 }),
|
|
1549
1533
|
C.FromEulerVector(
|
|
1550
1534
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1551
1535
|
),
|
|
1552
1536
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1553
|
-
),
|
|
1554
|
-
return
|
|
1555
|
-
position:
|
|
1556
|
-
rotation:
|
|
1557
|
-
scale:
|
|
1537
|
+
), a = ie.RotationAxis(g.Up(), Math.PI), n = r.multiply(a), o = g.Zero(), l = C.Identity(), c = g.Zero();
|
|
1538
|
+
return n.decompose(c, l, o), l.multiplyInPlace(C.FromEulerAngles(0, Math.PI, 0)), {
|
|
1539
|
+
position: R(o),
|
|
1540
|
+
rotation: R(l.toEulerAngles()),
|
|
1541
|
+
scale: R(c)
|
|
1558
1542
|
};
|
|
1559
1543
|
}
|
|
1560
1544
|
handleMaterialProgressCallback(e, t, i) {
|
|
@@ -1581,8 +1565,8 @@ class Wt {
|
|
|
1581
1565
|
*/
|
|
1582
1566
|
getLoadListenerEvent() {
|
|
1583
1567
|
const e = Array.from(this.loadProgress.values()).filter(
|
|
1584
|
-
(
|
|
1585
|
-
), i = e.reduce((
|
|
1568
|
+
(r) => r < 100
|
|
1569
|
+
), i = e.reduce((r, a) => r + a, 0) / e.length || 0;
|
|
1586
1570
|
return {
|
|
1587
1571
|
loadValue: e.length === 0 ? 100 : i,
|
|
1588
1572
|
sceneInitialized: this.getSceneInitializationProgress() === 100
|
|
@@ -1597,10 +1581,10 @@ class Wt {
|
|
|
1597
1581
|
}
|
|
1598
1582
|
}
|
|
1599
1583
|
export {
|
|
1600
|
-
|
|
1601
|
-
|
|
1584
|
+
I as MaterialEffectMode,
|
|
1585
|
+
T as ProductCameraRig,
|
|
1602
1586
|
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1603
|
-
|
|
1587
|
+
y as RenderingConfiguration,
|
|
1604
1588
|
Wt as SpiffCommerce3DPreviewService,
|
|
1605
1589
|
h as renderingPipelineDefaults
|
|
1606
1590
|
};
|