@spiffcommerce/preview 5.11.15 → 5.12.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/CHANGELOG.md +8 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.esm.js +278 -230
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { ArcRotateCamera as
|
|
2
|
-
import { Engine as
|
|
3
|
-
import { NullEngine as
|
|
4
|
-
import { HemisphericLight as
|
|
5
|
-
import { SceneLoader as
|
|
6
|
-
import { CubeTexture as
|
|
1
|
+
import { ArcRotateCamera as re } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
|
+
import { Engine as D } from "@babylonjs/core/Engines/engine";
|
|
3
|
+
import { NullEngine as ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HemisphericLight as de } from "@babylonjs/core/Lights/hemisphericLight";
|
|
5
|
+
import { SceneLoader as q } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as ue } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as v, Color3 as b } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as g, Quaternion as A, Vector2 as
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as g, Quaternion as A, Vector2 as U, Matrix as K } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { GLTFLoaderAnimationStartMode as
|
|
15
|
-
import { PBRMaterial as
|
|
16
|
-
import { MirrorTexture as
|
|
17
|
-
import { Color3 as
|
|
18
|
-
import { ReflectionProbe as
|
|
19
|
-
import { GlowLayer as
|
|
20
|
-
import { ActionManager as
|
|
21
|
-
import { ExecuteCodeAction as
|
|
22
|
-
import { Mesh as
|
|
23
|
-
import { TransformNode as
|
|
24
|
-
import { DynamicTexture as
|
|
25
|
-
import { Texture as
|
|
11
|
+
import { Tools as ge } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as pe } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as fe } from "@babylonjs/loaders/glTF";
|
|
14
|
+
import { GLTFLoaderAnimationStartMode as be } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
|
+
import { PBRMaterial as V } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
16
|
+
import { MirrorTexture as ve } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
17
|
+
import { Color3 as we, Vector3 as W, Plane as Ce } from "@babylonjs/core/Maths/math";
|
|
18
|
+
import { ReflectionProbe as Ae } from "@babylonjs/core/Probes/reflectionProbe";
|
|
19
|
+
import { GlowLayer as ye } from "@babylonjs/core/Layers/glowLayer";
|
|
20
|
+
import { ActionManager as L } from "@babylonjs/core/Actions/actionManager";
|
|
21
|
+
import { ExecuteCodeAction as $ } from "@babylonjs/core/Actions/directActions";
|
|
22
|
+
import { Mesh as xe } from "@babylonjs/core/Meshes/mesh";
|
|
23
|
+
import { TransformNode as Me } from "@babylonjs/core/Meshes/transformNode";
|
|
24
|
+
import { DynamicTexture as Pe } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
25
|
+
import { Texture as Ee } from "@babylonjs/core/Materials/Textures/texture";
|
|
26
26
|
import { Animation as w } from "@babylonjs/core/Animations/animation";
|
|
27
|
-
import { QuadraticEase as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
27
|
+
import { QuadraticEase as Re, EasingFunction as Te } from "@babylonjs/core/Animations/easing";
|
|
28
|
+
import { VertexBuffer as Q } from "@babylonjs/core/Buffers/buffer";
|
|
29
|
+
import { MultiMaterial as Le } from "@babylonjs/core/Materials/multiMaterial";
|
|
30
|
+
import { AssetsManager as Oe } from "@babylonjs/core/Misc/assetsManager";
|
|
31
|
+
import { ColorCurves as Y } from "@babylonjs/core/Materials/colorCurves";
|
|
32
|
+
import { ImageProcessingConfiguration as E } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
33
|
+
import { DefaultRenderingPipeline as Ie } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
34
|
+
import { DepthOfFieldEffectBlurLevel as O } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
35
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
34
36
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
35
37
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
@@ -41,23 +43,23 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
41
43
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
42
44
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
43
45
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
+
var k = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(k || {}), N = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(N || {});
|
|
47
|
+
function Fe() {
|
|
46
48
|
const n = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
|
|
47
49
|
return n && e && t;
|
|
48
50
|
}
|
|
49
|
-
const
|
|
50
|
-
async function
|
|
51
|
-
const i = await
|
|
51
|
+
const Z = /* @__PURE__ */ new Map();
|
|
52
|
+
async function z(n, e, t) {
|
|
53
|
+
const i = await Z.get(n);
|
|
52
54
|
if (i && i.scene.uid === e.uid)
|
|
53
55
|
return i;
|
|
54
|
-
const a =
|
|
55
|
-
return !
|
|
56
|
+
const a = q.LoadAssetContainerAsync(n, void 0, e, t);
|
|
57
|
+
return !Fe() && Z.set(n, a), a;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
n.name === "gltf" && (n.animationStartMode =
|
|
59
|
+
q.OnPluginActivatedObservable.add((n) => {
|
|
60
|
+
n.name === "gltf" && (n.animationStartMode = be.NONE);
|
|
59
61
|
});
|
|
60
|
-
class
|
|
62
|
+
class j {
|
|
61
63
|
constructor(e) {
|
|
62
64
|
this.getSceneClearColor = () => {
|
|
63
65
|
const t = this.customOptions?.transparentBackground || this.customOptions?.backgroundImage ? 0 : 1;
|
|
@@ -190,7 +192,7 @@ class x {
|
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
|
-
const
|
|
195
|
+
const Se = 128, d = {
|
|
194
196
|
antiAliasing: {
|
|
195
197
|
samples: 4,
|
|
196
198
|
fxaaEnabled: !1
|
|
@@ -247,7 +249,7 @@ const ye = 128, d = {
|
|
|
247
249
|
weight: 1
|
|
248
250
|
}
|
|
249
251
|
};
|
|
250
|
-
class
|
|
252
|
+
class Be {
|
|
251
253
|
constructor(e) {
|
|
252
254
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
253
255
|
}
|
|
@@ -283,14 +285,14 @@ class xe {
|
|
|
283
285
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
284
286
|
*/
|
|
285
287
|
enableMaterialExtrasIfRequired(e, t) {
|
|
286
|
-
if (!(!e.extras || !(t instanceof
|
|
288
|
+
if (!(!e.extras || !(t instanceof V))) {
|
|
287
289
|
if (e.extras.sheen) {
|
|
288
290
|
const i = t;
|
|
289
291
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
290
292
|
}
|
|
291
293
|
if (e.extras.translucency) {
|
|
292
294
|
const i = t;
|
|
293
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
295
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new we(
|
|
294
296
|
e.extras.translucencyR,
|
|
295
297
|
e.extras.translucencyG,
|
|
296
298
|
e.extras.translucencyB
|
|
@@ -328,27 +330,27 @@ class xe {
|
|
|
328
330
|
const r = s.material;
|
|
329
331
|
if (!r)
|
|
330
332
|
return;
|
|
331
|
-
const
|
|
333
|
+
const c = new ve(
|
|
332
334
|
"mirror",
|
|
333
335
|
x.getMirrorTextureResolution(),
|
|
334
336
|
e,
|
|
335
337
|
!0
|
|
336
338
|
);
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
339
|
+
c.renderList = t(e);
|
|
340
|
+
const l = s.getVerticesData("normal");
|
|
341
|
+
if (!l)
|
|
340
342
|
throw new Error(
|
|
341
343
|
"Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
|
|
342
344
|
);
|
|
343
345
|
s.computeWorldMatrix(!0);
|
|
344
|
-
const
|
|
345
|
-
new
|
|
346
|
-
|
|
347
|
-
).normalize(), u =
|
|
348
|
-
|
|
346
|
+
const h = s.getWorldMatrix(), m = W.TransformNormal(
|
|
347
|
+
new W(l[0], l[1], l[2]),
|
|
348
|
+
h
|
|
349
|
+
).normalize(), u = Ce.FromPositionAndNormal(s.position, m.scale(-1));
|
|
350
|
+
c.mirrorPlane = u, c.level = o, r.reflectionTexture = c;
|
|
349
351
|
}
|
|
350
352
|
function a(s) {
|
|
351
|
-
const o = s.material, r = new
|
|
353
|
+
const o = s.material, r = new Ae("probe-" + o.name, Se, e);
|
|
352
354
|
r.cubeTexture.name = "reflection-probe-cube-texture", r.attachToMesh(s), r.renderList && r.renderList.push(...t(e)), o.reflectionTexture = r.cubeTexture;
|
|
353
355
|
}
|
|
354
356
|
e.meshes.forEach((s) => {
|
|
@@ -357,7 +359,7 @@ class xe {
|
|
|
357
359
|
});
|
|
358
360
|
}
|
|
359
361
|
}
|
|
360
|
-
class
|
|
362
|
+
class De {
|
|
361
363
|
constructor(e, t) {
|
|
362
364
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
363
365
|
}
|
|
@@ -366,7 +368,7 @@ class Me {
|
|
|
366
368
|
}
|
|
367
369
|
includeMeshes(e) {
|
|
368
370
|
if (e) {
|
|
369
|
-
this.glowLayer || (this.glowLayer = new
|
|
371
|
+
this.glowLayer || (this.glowLayer = new ye("glow", this.scene), this.glowLayer.intensity = this.intensity);
|
|
370
372
|
for (const t of e)
|
|
371
373
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
372
374
|
}
|
|
@@ -379,37 +381,37 @@ class Me {
|
|
|
379
381
|
}
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
|
-
function
|
|
384
|
+
function ke(n, e, t, i, a = "") {
|
|
383
385
|
t.forEach((s) => {
|
|
384
|
-
const o = s.getID(), r = s.getName(),
|
|
385
|
-
|
|
386
|
+
const o = s.getID(), r = s.getName(), c = s.getPanelSize && s.getPanelSize(), l = x.getDynamicTextureResolution(
|
|
387
|
+
c?.width === 1 || c?.height === 1
|
|
386
388
|
);
|
|
387
389
|
n.filter((m) => m.name === a + r).forEach((m) => {
|
|
388
390
|
const u = i.get(o), p = !1;
|
|
389
391
|
if (u)
|
|
390
|
-
|
|
392
|
+
X(m, u), u.update(p);
|
|
391
393
|
else {
|
|
392
|
-
const f =
|
|
393
|
-
i.set(o, f), s.setStaticContext(f.getContext()),
|
|
394
|
+
const f = Ne(r, e, l.width, l.height);
|
|
395
|
+
i.set(o, f), s.setStaticContext(f.getContext()), X(m, f), f.onLoadObservable.addOnce(() => {
|
|
394
396
|
f.update(p);
|
|
395
397
|
});
|
|
396
398
|
}
|
|
397
399
|
});
|
|
398
400
|
});
|
|
399
401
|
}
|
|
400
|
-
function
|
|
401
|
-
const a = new
|
|
402
|
+
function Ne(n, e, t, i) {
|
|
403
|
+
const a = new Pe(
|
|
402
404
|
n,
|
|
403
405
|
{ width: t, height: i },
|
|
404
406
|
e,
|
|
405
407
|
x.shouldMipMap(),
|
|
406
|
-
|
|
407
|
-
|
|
408
|
+
Ee.TRILINEAR_SAMPLINGMODE,
|
|
409
|
+
D.TEXTUREFORMAT_RGBA
|
|
408
410
|
), s = a.getContext();
|
|
409
411
|
return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), a.update()), a;
|
|
410
412
|
}
|
|
411
|
-
function
|
|
412
|
-
if (n instanceof
|
|
413
|
+
function X(n, e) {
|
|
414
|
+
if (n instanceof V) {
|
|
413
415
|
const t = n, i = t.albedoTexture;
|
|
414
416
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
415
417
|
} else {
|
|
@@ -417,57 +419,57 @@ function W(n, e) {
|
|
|
417
419
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
418
420
|
}
|
|
419
421
|
}
|
|
420
|
-
function
|
|
422
|
+
function qe() {
|
|
421
423
|
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
422
424
|
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
423
425
|
}
|
|
424
|
-
const y = 60,
|
|
425
|
-
function
|
|
426
|
+
const y = 60, J = 1;
|
|
427
|
+
function ee(n) {
|
|
426
428
|
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
427
429
|
}
|
|
428
|
-
function
|
|
429
|
-
const o = a ? n.filter((
|
|
430
|
+
function ae(n, e, t, i, a, s) {
|
|
431
|
+
const o = a ? n.filter((h) => h.name === a) : n;
|
|
430
432
|
if (o.length === 0) {
|
|
431
433
|
console.warn(`No animations found for name: ${a}`);
|
|
432
434
|
return;
|
|
433
435
|
}
|
|
434
436
|
let r = 0;
|
|
435
|
-
const
|
|
437
|
+
const c = () => {
|
|
436
438
|
r++, r === o.length && s && s();
|
|
437
|
-
},
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}) :
|
|
441
|
-
|
|
439
|
+
}, l = (h, m, u, p, f) => {
|
|
440
|
+
h.stop(), h.start(m, u, p, f), s && (m == !1 || m === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
|
|
441
|
+
c();
|
|
442
|
+
}) : h.onAnimationLoopObservable.addOnce(() => {
|
|
443
|
+
c();
|
|
442
444
|
}));
|
|
443
445
|
};
|
|
444
446
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
445
|
-
o.forEach((
|
|
446
|
-
const m =
|
|
447
|
-
|
|
447
|
+
o.forEach((h) => {
|
|
448
|
+
const m = ee(h), u = i * m;
|
|
449
|
+
l(h, !1, J, u, u);
|
|
448
450
|
});
|
|
449
451
|
return;
|
|
450
452
|
}
|
|
451
|
-
o.forEach((
|
|
452
|
-
const m =
|
|
453
|
-
|
|
453
|
+
o.forEach((h) => {
|
|
454
|
+
const m = ee(h), u = i !== void 0 ? i * m : void 0, p = t !== void 0 ? t * m : void 0;
|
|
455
|
+
l(h, e, J, u, p);
|
|
454
456
|
});
|
|
455
457
|
}
|
|
456
|
-
function
|
|
458
|
+
function Ve(n) {
|
|
457
459
|
n.forEach((e) => {
|
|
458
460
|
e.reset(), e.stop();
|
|
459
461
|
});
|
|
460
462
|
}
|
|
461
|
-
function
|
|
463
|
+
function ze(n) {
|
|
462
464
|
const e = n.animationGroups;
|
|
463
|
-
|
|
465
|
+
Ve(e);
|
|
464
466
|
}
|
|
465
|
-
function
|
|
467
|
+
function _e(n, e, t) {
|
|
466
468
|
return new Promise((i) => {
|
|
467
|
-
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
469
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = He(e.alpha, 0, 2 * Math.PI));
|
|
468
470
|
const a = [], s = t.target;
|
|
469
471
|
if (t.target && Object.keys(t.target).length > 0 && a.push(
|
|
470
|
-
|
|
472
|
+
R(
|
|
471
473
|
"cameraTargetLerp",
|
|
472
474
|
"target",
|
|
473
475
|
new g().copyFrom(e.target),
|
|
@@ -475,29 +477,29 @@ function Oe(n, e, t) {
|
|
|
475
477
|
w.ANIMATIONTYPE_VECTOR3
|
|
476
478
|
)
|
|
477
479
|
), a.push(
|
|
478
|
-
|
|
480
|
+
R(
|
|
479
481
|
"cameraAlphaLerp",
|
|
480
482
|
"alpha",
|
|
481
483
|
e.alpha,
|
|
482
|
-
|
|
484
|
+
te(t.lonDeg),
|
|
483
485
|
w.ANIMATIONTYPE_FLOAT
|
|
484
486
|
)
|
|
485
487
|
), a.push(
|
|
486
|
-
|
|
488
|
+
R(
|
|
487
489
|
"cameraBetaLerp",
|
|
488
490
|
"beta",
|
|
489
491
|
e.beta,
|
|
490
|
-
|
|
492
|
+
te(t.latDeg),
|
|
491
493
|
w.ANIMATIONTYPE_FLOAT
|
|
492
494
|
)
|
|
493
495
|
), t.radius !== void 0) {
|
|
494
|
-
const
|
|
496
|
+
const c = Math.max(0.01, t.radius);
|
|
495
497
|
a.push(
|
|
496
|
-
|
|
498
|
+
R(
|
|
497
499
|
"cameraRadiusLerp",
|
|
498
500
|
"radius",
|
|
499
501
|
e.radius,
|
|
500
|
-
|
|
502
|
+
c,
|
|
501
503
|
w.ANIMATIONTYPE_FLOAT
|
|
502
504
|
)
|
|
503
505
|
);
|
|
@@ -509,27 +511,69 @@ function Oe(n, e, t) {
|
|
|
509
511
|
});
|
|
510
512
|
});
|
|
511
513
|
}
|
|
512
|
-
function
|
|
514
|
+
function te(n) {
|
|
513
515
|
return n * Math.PI / 180;
|
|
514
516
|
}
|
|
515
|
-
function
|
|
516
|
-
const r = new
|
|
517
|
-
r.setEasingMode(
|
|
518
|
-
const
|
|
519
|
-
return s > 0 &&
|
|
517
|
+
function R(n, e, t, i, a, s = 0, o = w.ANIMATIONLOOPMODE_CONSTANT) {
|
|
518
|
+
const r = new Re();
|
|
519
|
+
r.setEasingMode(Te.EASINGMODE_EASEINOUT);
|
|
520
|
+
const c = new w(n, e, y, a, o), l = [];
|
|
521
|
+
return s > 0 && l.push({ frame: 0, value: t }), l.push({ frame: y * s, value: t }), l.push({
|
|
520
522
|
frame: y * (s + 1),
|
|
521
523
|
value: i
|
|
522
|
-
}),
|
|
524
|
+
}), c.setKeys(l), c.setEasingFunction(r), c;
|
|
523
525
|
}
|
|
524
|
-
function
|
|
526
|
+
function He(n, e, t) {
|
|
525
527
|
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
526
528
|
}
|
|
527
|
-
function
|
|
529
|
+
function Ge(n, e, t) {
|
|
528
530
|
n.forEach((i) => {
|
|
529
531
|
t && i.name !== t || i.goToFrame(e);
|
|
530
532
|
});
|
|
531
533
|
}
|
|
532
|
-
const
|
|
534
|
+
const ie = 1e-4;
|
|
535
|
+
function Ue(n, e) {
|
|
536
|
+
if (n.material === e) {
|
|
537
|
+
const i = n.getIndices();
|
|
538
|
+
return i ? [{ start: 0, count: i.length }] : [];
|
|
539
|
+
}
|
|
540
|
+
if (!(n.material instanceof Le) || !n.subMeshes) return [];
|
|
541
|
+
const t = n.material.subMaterials;
|
|
542
|
+
return n.subMeshes.filter((i) => t[i.materialIndex] === e).map((i) => ({ start: i.indexStart, count: i.indexCount }));
|
|
543
|
+
}
|
|
544
|
+
function ne(n, e) {
|
|
545
|
+
return Math.abs(n[0] - e[0]) < ie && Math.abs(n[1] - e[1]) < ie;
|
|
546
|
+
}
|
|
547
|
+
function Ke(n, e, t, i) {
|
|
548
|
+
const a = (l) => Math.round(l * 1e6), s = (l) => `${a(t[l * 3])}_${a(t[l * 3 + 1])}_${a(t[l * 3 + 2])}`, o = (l) => [e[l * 2], e[l * 2 + 1]], r = /* @__PURE__ */ new Map();
|
|
549
|
+
for (const { start: l, count: h } of i)
|
|
550
|
+
for (let m = l; m < l + h; m += 3) {
|
|
551
|
+
const u = [n[m], n[m + 1], n[m + 2]];
|
|
552
|
+
for (let p = 0; p < 3; p++) {
|
|
553
|
+
const f = u[p], T = u[(p + 1) % 3], M = s(f), P = s(T);
|
|
554
|
+
if (M === P) continue;
|
|
555
|
+
const [le, he, H] = M < P ? [f, T, `${M}|${P}`] : [T, f, `${P}|${M}`], G = r.get(H) ?? [];
|
|
556
|
+
G.push({ uvLow: o(le), uvHigh: o(he) }), r.set(H, G);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const c = [];
|
|
560
|
+
return r.forEach((l) => {
|
|
561
|
+
if (!(l.length === 2 && ne(l[0].uvLow, l[1].uvLow) && ne(l[0].uvHigh, l[1].uvHigh)))
|
|
562
|
+
for (const h of l)
|
|
563
|
+
c.push({ u0: h.uvLow[0], v0: h.uvLow[1], u1: h.uvHigh[0], v1: h.uvHigh[1] });
|
|
564
|
+
}), c;
|
|
565
|
+
}
|
|
566
|
+
function We(n, e) {
|
|
567
|
+
const t = [];
|
|
568
|
+
for (const i of n) {
|
|
569
|
+
const a = Ue(i, e);
|
|
570
|
+
if (a.length === 0) continue;
|
|
571
|
+
const s = i.getIndices(), o = i.getVerticesData(Q.UVKind), r = i.getVerticesData(Q.PositionKind);
|
|
572
|
+
!s || !o || !r || t.push(...Ke(s, o, r, a));
|
|
573
|
+
}
|
|
574
|
+
return t;
|
|
575
|
+
}
|
|
576
|
+
const $e = {
|
|
533
577
|
albedoTexture: "albedoMap",
|
|
534
578
|
bumpTexture: "normalMap",
|
|
535
579
|
ambientTexture: "ambientMap",
|
|
@@ -539,7 +583,7 @@ const Se = {
|
|
|
539
583
|
refractionTexture: "refractionMap",
|
|
540
584
|
reflectionTexture: "reflectionMap"
|
|
541
585
|
};
|
|
542
|
-
function
|
|
586
|
+
function Qe(n, e, t, i) {
|
|
543
587
|
[
|
|
544
588
|
"albedoTexture",
|
|
545
589
|
"bumpTexture",
|
|
@@ -550,36 +594,36 @@ function Be(n, e, t, i) {
|
|
|
550
594
|
"refractionTexture",
|
|
551
595
|
"reflectionTexture"
|
|
552
596
|
].forEach((s) => {
|
|
553
|
-
|
|
597
|
+
Ye(
|
|
554
598
|
s,
|
|
555
599
|
n,
|
|
556
600
|
e,
|
|
557
601
|
t,
|
|
558
602
|
i
|
|
559
603
|
);
|
|
560
|
-
}),
|
|
604
|
+
}), Xe(n, e);
|
|
561
605
|
}
|
|
562
|
-
function
|
|
563
|
-
const s =
|
|
606
|
+
function Ye(n, e, t, i, a) {
|
|
607
|
+
const s = $e[n];
|
|
564
608
|
if (!s)
|
|
565
609
|
throw new Error("Unexpected texture name encountered.");
|
|
566
610
|
const r = e[s]?.fileLink;
|
|
567
|
-
r ? n === "reflectionTexture" ? r.endsWith(".env") || r.endsWith(".dds") ? i.addCubeTextureTask(n, r, void 0, !1, void 0, !0) : r.endsWith(".hdr") ? i.addHDRCubeTextureTask(n, r, 128, !1, !0, !1) : i.addTextureTask(n, r, !1, !1) : i.addTextureTask(n, r, !1, !1) : a && t[n] && (t[n] && t[n].dispose(), t[n] = null,
|
|
611
|
+
r ? n === "reflectionTexture" ? r.endsWith(".env") || r.endsWith(".dds") ? i.addCubeTextureTask(n, r, void 0, !1, void 0, !0) : r.endsWith(".hdr") ? i.addHDRCubeTextureTask(n, r, 128, !1, !0, !1) : i.addTextureTask(n, r, !1, !1) : i.addTextureTask(n, r, !1, !1) : a && t[n] && (t[n] && t[n].dispose(), t[n] = null, Ze(n, t));
|
|
568
612
|
}
|
|
569
|
-
function
|
|
613
|
+
function Ze(n, e) {
|
|
570
614
|
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), n === "reflectionTexture" && (e.environmentIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new b(0, 0, 0), e.reflectionTexture);
|
|
571
615
|
}
|
|
572
|
-
function
|
|
616
|
+
function je(n, e, t, i) {
|
|
573
617
|
if (!e) {
|
|
574
618
|
console.error("Failed to apply texture to material: material is null.");
|
|
575
619
|
return;
|
|
576
620
|
}
|
|
577
621
|
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), n === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new b(1, 1, 1), e.emissiveIntensity = 1);
|
|
578
622
|
}
|
|
579
|
-
function
|
|
580
|
-
n.clearCoat && (n.clearCoat ===
|
|
623
|
+
function Xe(n, e) {
|
|
624
|
+
n.clearCoat && (n.clearCoat === N.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === N.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
581
625
|
}
|
|
582
|
-
class
|
|
626
|
+
class Je {
|
|
583
627
|
constructor(e, t, i) {
|
|
584
628
|
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;
|
|
585
629
|
}
|
|
@@ -599,28 +643,28 @@ class ze {
|
|
|
599
643
|
...o,
|
|
600
644
|
...t
|
|
601
645
|
});
|
|
602
|
-
const r = this.renameClonedAsset(e),
|
|
603
|
-
(
|
|
646
|
+
const r = this.renameClonedAsset(e), c = this.scene.materials.filter(
|
|
647
|
+
(h) => h.name === r
|
|
604
648
|
);
|
|
605
|
-
if (
|
|
649
|
+
if (c.length === 0) {
|
|
606
650
|
s();
|
|
607
651
|
return;
|
|
608
652
|
}
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
(
|
|
612
|
-
),
|
|
613
|
-
i && i(
|
|
614
|
-
},
|
|
615
|
-
|
|
653
|
+
const l = new Oe(this.scene);
|
|
654
|
+
l.useDefaultLoadingScreen = !1, c.forEach(
|
|
655
|
+
(h) => Qe(t, h, l, a)
|
|
656
|
+
), l.onProgress = (h, m, u) => {
|
|
657
|
+
i && i(h / m * 100, 100, u.name);
|
|
658
|
+
}, l.onFinish = (h) => {
|
|
659
|
+
h.forEach((m) => {
|
|
616
660
|
const u = m;
|
|
617
661
|
i && i(100, 100, m.name), this.scene.materials.filter(
|
|
618
662
|
(f) => f.name === r
|
|
619
663
|
).forEach((f) => {
|
|
620
|
-
|
|
664
|
+
je(m.name, f, t, u.texture);
|
|
621
665
|
});
|
|
622
666
|
}), s();
|
|
623
|
-
},
|
|
667
|
+
}, l.loadAsync();
|
|
624
668
|
});
|
|
625
669
|
}
|
|
626
670
|
/**
|
|
@@ -636,24 +680,24 @@ class ze {
|
|
|
636
680
|
async applyModel(e, t, i, a, s, o, r) {
|
|
637
681
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
638
682
|
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), this.loadedContainerForKey.get(e)?.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.get(e)?.forEach((u) => u.dispose()), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter((u) => u !== e), Promise.resolve(void 0);
|
|
639
|
-
const
|
|
683
|
+
const l = (await z(i, this.scene, a)).instantiateModelsToScene(this.renameClonedAsset, !0);
|
|
640
684
|
this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.get(e)?.forEach((u) => u.dispose()), this.loadedMaterialsForKey.delete(e));
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
const u = o && o(), p =
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
685
|
+
const h = s && s();
|
|
686
|
+
if (h) {
|
|
687
|
+
const u = o && o(), p = h.name ? this.renameClonedAsset(h.name) : void 0;
|
|
688
|
+
ae(
|
|
689
|
+
l.animationGroups,
|
|
690
|
+
h.loop,
|
|
691
|
+
h.to,
|
|
692
|
+
h.from,
|
|
649
693
|
p
|
|
650
|
-
), u != null && (r && r(),
|
|
694
|
+
), u != null && (r && r(), Ge(l.animationGroups, u + 2, p));
|
|
651
695
|
}
|
|
652
|
-
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e,
|
|
696
|
+
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, l), this.loadedMaterialsForKey.set(e, oe(l));
|
|
653
697
|
const m = [];
|
|
654
698
|
return this.materialVariantMap.forEach(async (u, p) => {
|
|
655
699
|
m.push(this.applyMaterial(p, u));
|
|
656
|
-
}), await Promise.all(m),
|
|
700
|
+
}), await Promise.all(m), l;
|
|
657
701
|
}
|
|
658
702
|
dispose() {
|
|
659
703
|
this.loadedContainerForKey.forEach((e) => e?.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach((e) => e.forEach((t) => t?.dispose())), this.loadedMaterialsForKey.clear(), this.materialVariantMap.clear(), this.keysThatRemovedBaseModel = [];
|
|
@@ -673,7 +717,7 @@ class ze {
|
|
|
673
717
|
}), e;
|
|
674
718
|
}
|
|
675
719
|
}
|
|
676
|
-
function
|
|
720
|
+
function oe(n) {
|
|
677
721
|
const e = [];
|
|
678
722
|
return n.rootNodes.forEach((t) => {
|
|
679
723
|
t.getChildMeshes().forEach((i) => {
|
|
@@ -684,7 +728,7 @@ function J(n) {
|
|
|
684
728
|
});
|
|
685
729
|
}), e;
|
|
686
730
|
}
|
|
687
|
-
function
|
|
731
|
+
function se(n, e = "") {
|
|
688
732
|
return n.map((t) => ({
|
|
689
733
|
name: t.name.substring(e.length),
|
|
690
734
|
loop: t.loopAnimation,
|
|
@@ -692,19 +736,19 @@ function $(n, e = "") {
|
|
|
692
736
|
from: t.from
|
|
693
737
|
}));
|
|
694
738
|
}
|
|
695
|
-
class
|
|
739
|
+
class et {
|
|
696
740
|
constructor(e) {
|
|
697
741
|
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.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
|
|
698
742
|
const { enablePicking: t, modelDetails: i, previewService: a, progressHandler: s, scene: o } = e;
|
|
699
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
743
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = qe(), this.previewService = a, this.scene = o, this.variantManager = new Je(
|
|
700
744
|
o,
|
|
701
745
|
this.renameClonedAsset.bind(this),
|
|
702
746
|
this.setBaseModelEnabled.bind(this)
|
|
703
|
-
), this.transformRoot = new
|
|
747
|
+
), this.transformRoot = new Me("root", this.scene);
|
|
704
748
|
const r = async () => {
|
|
705
749
|
if (!i.model)
|
|
706
750
|
throw new Error("Model container constructed with no URL. This is currently unsupported.");
|
|
707
|
-
return this.assetContainer = await
|
|
751
|
+
return this.assetContainer = await z(i.model, o, s), await this.instantiate(), this;
|
|
708
752
|
};
|
|
709
753
|
this.importPromise = r();
|
|
710
754
|
}
|
|
@@ -724,11 +768,11 @@ class Ge {
|
|
|
724
768
|
await this.variantManager.applyMaterial(
|
|
725
769
|
e,
|
|
726
770
|
i,
|
|
727
|
-
(o, r,
|
|
771
|
+
(o, r, c) => {
|
|
728
772
|
this.materialVariantObservable.notifyObservers({
|
|
729
773
|
remainingCount: o,
|
|
730
774
|
totalCount: r,
|
|
731
|
-
taskName:
|
|
775
|
+
taskName: c
|
|
732
776
|
});
|
|
733
777
|
},
|
|
734
778
|
a
|
|
@@ -765,16 +809,16 @@ class Ge {
|
|
|
765
809
|
this.modelChangesInProgress.push(e);
|
|
766
810
|
let r = await a();
|
|
767
811
|
if (this.queuedModelChanges.has(e)) {
|
|
768
|
-
const
|
|
769
|
-
if (!
|
|
770
|
-
r = await
|
|
812
|
+
const c = this.queuedModelChanges.get(e);
|
|
813
|
+
if (!c) throw new Error("Queued change resolved undefined");
|
|
814
|
+
r = await c(), this.queuedModelChanges.delete(e);
|
|
771
815
|
}
|
|
772
816
|
return this.modelChangesInProgress.splice(this.modelChangesInProgress.indexOf(e), 1), r;
|
|
773
817
|
};
|
|
774
818
|
if (!this.initialized || this.modelChangesInProgress.includes(e)) {
|
|
775
819
|
const r = async () => {
|
|
776
|
-
const
|
|
777
|
-
return
|
|
820
|
+
const c = await a();
|
|
821
|
+
return c ? this.configureModelInstance(c) : this.configureGlowLayer(), c;
|
|
778
822
|
};
|
|
779
823
|
this.queuedModelChanges.set(e, r);
|
|
780
824
|
return;
|
|
@@ -796,7 +840,7 @@ class Ge {
|
|
|
796
840
|
...this.modelInstance?.animationGroups || [],
|
|
797
841
|
...this.variantManager.getAnimationGroups()
|
|
798
842
|
];
|
|
799
|
-
|
|
843
|
+
ae(
|
|
800
844
|
o,
|
|
801
845
|
e.loop,
|
|
802
846
|
e.to,
|
|
@@ -806,14 +850,14 @@ class Ge {
|
|
|
806
850
|
);
|
|
807
851
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, i();
|
|
808
852
|
};
|
|
809
|
-
return t ? (
|
|
853
|
+
return t ? (ze(this.scene), a()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = a, new Promise((s) => {
|
|
810
854
|
i = s;
|
|
811
855
|
})) : a();
|
|
812
856
|
}
|
|
813
857
|
getAnimations(e) {
|
|
814
858
|
return [
|
|
815
859
|
...this.animations,
|
|
816
|
-
...e ?
|
|
860
|
+
...e ? se(this.variantManager.getAnimationGroups(), this.renameClonedAsset("")) : []
|
|
817
861
|
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, a) => a.indexOf(a.find((s) => s.name === t.name)) == i);
|
|
818
862
|
}
|
|
819
863
|
getId() {
|
|
@@ -826,6 +870,10 @@ class Ge {
|
|
|
826
870
|
name: this.stripIdFromName(t.name)
|
|
827
871
|
})) : [];
|
|
828
872
|
}
|
|
873
|
+
getUVIslandOutline(e) {
|
|
874
|
+
const t = this.renameClonedAsset(e), i = this.scene.materials.find((a) => a.name === t);
|
|
875
|
+
return i ? We(this.scene.meshes, i) : [];
|
|
876
|
+
}
|
|
829
877
|
registerMaterialSelectedCallback(e) {
|
|
830
878
|
this.materialSelectedObservable.add(e);
|
|
831
879
|
}
|
|
@@ -868,15 +916,15 @@ class Ge {
|
|
|
868
916
|
attachPickingHandler(e) {
|
|
869
917
|
e.rootNodes.forEach((t) => {
|
|
870
918
|
t.getChildMeshes(!1).forEach((i) => {
|
|
871
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
872
|
-
new
|
|
919
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new L(this.scene)), i.actionManager.registerAction(
|
|
920
|
+
new $(L.OnPointerOverTrigger, (a) => {
|
|
873
921
|
a.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
874
922
|
id: i.material.id,
|
|
875
923
|
name: this.stripIdFromName(i.material.name)
|
|
876
924
|
});
|
|
877
925
|
})
|
|
878
926
|
), i.actionManager.registerAction(
|
|
879
|
-
new
|
|
927
|
+
new $(L.OnPointerOutTrigger, () => {
|
|
880
928
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
881
929
|
id: i.material.id,
|
|
882
930
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -905,7 +953,7 @@ class Ge {
|
|
|
905
953
|
return this.queuedModelChanges.size;
|
|
906
954
|
}
|
|
907
955
|
configureGlowLayer() {
|
|
908
|
-
const e = (i) => i instanceof
|
|
956
|
+
const e = (i) => i instanceof V && i.emissiveTexture !== null;
|
|
909
957
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
910
958
|
}
|
|
911
959
|
configureModelInstance(e) {
|
|
@@ -918,7 +966,7 @@ class Ge {
|
|
|
918
966
|
for (const o of s.getChildMeshes(!1))
|
|
919
967
|
o.alwaysSelectAsActiveMesh = !0;
|
|
920
968
|
}
|
|
921
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = this.contextService?.getAll() || /* @__PURE__ */ new Map(),
|
|
969
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = this.contextService?.getAll() || /* @__PURE__ */ new Map(), ke(
|
|
922
970
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
923
971
|
this.scene,
|
|
924
972
|
this.canvasPanels,
|
|
@@ -933,11 +981,11 @@ class Ge {
|
|
|
933
981
|
this.modelInstance?.dispose(), this.modelInstance = void 0;
|
|
934
982
|
}
|
|
935
983
|
getAllMeshes() {
|
|
936
|
-
return this.modelInstance?.rootNodes.map((e) => e.getChildMeshes(!1).filter((t) => t instanceof
|
|
984
|
+
return this.modelInstance?.rootNodes.map((e) => e.getChildMeshes(!1).filter((t) => t instanceof xe)).flat();
|
|
937
985
|
}
|
|
938
986
|
async instantiate() {
|
|
939
987
|
if (!this.assetContainer) throw new Error("Attempted to instantiate ModelContainer without an AssetContainer");
|
|
940
|
-
this.modelInstance = this.assetContainer.instantiateModelsToScene(this.renameClonedAsset.bind(this), !0), this.materials =
|
|
988
|
+
this.modelInstance = this.assetContainer.instantiateModelsToScene(this.renameClonedAsset.bind(this), !0), this.materials = oe(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = se(this.modelInstance.animationGroups, this.renameClonedAsset("")), this.initialized = !0, await this.processQueuedEvents();
|
|
941
989
|
}
|
|
942
990
|
renameClonedAsset(e) {
|
|
943
991
|
return `${this.id}_${e}`;
|
|
@@ -996,9 +1044,9 @@ class Ge {
|
|
|
996
1044
|
}
|
|
997
1045
|
//#endregion
|
|
998
1046
|
}
|
|
999
|
-
class
|
|
1000
|
-
constructor(e, t, i, a, s, o, r,
|
|
1001
|
-
super(e, t, i, a, s, o,
|
|
1047
|
+
class _ extends re {
|
|
1048
|
+
constructor(e, t, i, a, s, o, r, c) {
|
|
1049
|
+
super(e, t, i, a, s, o, c), this.lastFocus = new g(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, r.camera.autoOrientation && (this.alpha += Math.PI), r && (r.camera.limits.min.beta && (this.lowerBetaLimit = r.camera.limits.min.beta), r.camera.limits.max.beta && (this.upperBetaLimit = r.camera.limits.max.beta), r.camera.limits.min.alpha && (this.lowerAlphaLimit = r.camera.limits.min.alpha), r.camera.limits.max.alpha && (this.upperAlphaLimit = r.camera.limits.max.alpha), r.camera.limits.min.radius && (this.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.upperRadiusLimit = r.camera.limits.max.radius), r.camera.autoRotation.enabled && this.enableAutoRotationBehavior(r.camera.autoRotation.idleTimeMs));
|
|
1002
1050
|
}
|
|
1003
1051
|
updateConfiguration(e) {
|
|
1004
1052
|
e && (this.lowerBetaLimit = e.camera.limits.min.beta ?? null, this.upperBetaLimit = e.camera.limits.max.beta ?? null, this.lowerAlphaLimit = e.camera.limits.min.alpha ?? null, this.upperAlphaLimit = e.camera.limits.max.alpha ?? null, e.camera.autoRotation.enabled ? this.enableAutoRotationBehavior(e.camera.autoRotation.idleTimeMs) : this.disableAutoRotationBehavior());
|
|
@@ -1035,7 +1083,7 @@ class q extends j {
|
|
|
1035
1083
|
this.useFramingBehavior = !0;
|
|
1036
1084
|
const e = this.getFramingBehavior();
|
|
1037
1085
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1038
|
-
const t =
|
|
1086
|
+
const t = I(this._scene);
|
|
1039
1087
|
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;
|
|
1040
1088
|
}
|
|
1041
1089
|
/**
|
|
@@ -1049,7 +1097,7 @@ class q extends j {
|
|
|
1049
1097
|
i.framingTime = t || 800;
|
|
1050
1098
|
const a = () => {
|
|
1051
1099
|
this.isRunningFramingBehavior = !1;
|
|
1052
|
-
}, s =
|
|
1100
|
+
}, s = I(this._scene), o = s.max.subtract(s.min), r = s.min.add(o.scale(0.5));
|
|
1053
1101
|
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(r), this.panDenominator = o.length(), this.lastFocus.copyFrom(r), i.zoomOnBoundingInfo(s.min, s.max, void 0, a), i.framingTime = 0;
|
|
1054
1102
|
}
|
|
1055
1103
|
/**
|
|
@@ -1080,7 +1128,7 @@ class q extends j {
|
|
|
1080
1128
|
* @param disablePan If true the camera will not allow panning.
|
|
1081
1129
|
*/
|
|
1082
1130
|
static create(e, t, i) {
|
|
1083
|
-
const a =
|
|
1131
|
+
const a = I(e), s = a.max.subtract(a.min), o = a.min.add(s.scale(0.5)), r = new _(
|
|
1084
1132
|
"ProductCamera",
|
|
1085
1133
|
-(Math.PI / 2),
|
|
1086
1134
|
Math.PI / 2,
|
|
@@ -1094,7 +1142,7 @@ class q extends j {
|
|
|
1094
1142
|
}), i && (e.activeCamera = r), r;
|
|
1095
1143
|
}
|
|
1096
1144
|
}
|
|
1097
|
-
function
|
|
1145
|
+
function I(n) {
|
|
1098
1146
|
if (n.meshes.length === 0)
|
|
1099
1147
|
return {
|
|
1100
1148
|
min: new g(-1, -1, -1),
|
|
@@ -1103,9 +1151,9 @@ function T(n) {
|
|
|
1103
1151
|
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1104
1152
|
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1105
1153
|
}
|
|
1106
|
-
class
|
|
1154
|
+
class tt {
|
|
1107
1155
|
constructor(e, t = !1, i = void 0) {
|
|
1108
|
-
this.renderingPipeline = new
|
|
1156
|
+
this.renderingPipeline = new Ie(
|
|
1109
1157
|
"default",
|
|
1110
1158
|
t,
|
|
1111
1159
|
e,
|
|
@@ -1122,37 +1170,37 @@ class _e {
|
|
|
1122
1170
|
}
|
|
1123
1171
|
setConfiguration(e) {
|
|
1124
1172
|
if (this.renderingPipeline.isSupported) {
|
|
1125
|
-
if (this.renderingPipeline.samples = e.antiAliasing?.samples ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = e.antiAliasing?.fxaaEnabled ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = e.bloom?.enabled ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = e.bloom?.kernel ?? d.bloom.kernel, this.renderingPipeline.bloomScale = e.bloom?.scale ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = e.bloom?.threshold ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = e.bloom?.weight ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = e.chromaticAberration?.enabled ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = e.chromaticAberration?.aberrationAmount ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = e.chromaticAberration?.radialIntensity ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = e.chromaticAberration?.direction ? new
|
|
1173
|
+
if (this.renderingPipeline.samples = e.antiAliasing?.samples ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = e.antiAliasing?.fxaaEnabled ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = e.bloom?.enabled ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = e.bloom?.kernel ?? d.bloom.kernel, this.renderingPipeline.bloomScale = e.bloom?.scale ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = e.bloom?.threshold ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = e.bloom?.weight ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = e.chromaticAberration?.enabled ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = e.chromaticAberration?.aberrationAmount ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = e.chromaticAberration?.radialIntensity ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = e.chromaticAberration?.direction ? new U(e.chromaticAberration.direction.x, e.chromaticAberration.direction.y) : new U(
|
|
1126
1174
|
d.chromaticAberration.direction.x,
|
|
1127
1175
|
d.chromaticAberration.direction.y
|
|
1128
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = e.colorCurves?.enabled ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new
|
|
1176
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = e.colorCurves?.enabled ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new Y(), this.renderingPipeline.depthOfFieldEnabled = e.depthOfField?.enabled ?? d.depthOfField.enabled, e.depthOfField)
|
|
1129
1177
|
switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
|
|
1130
1178
|
case "Low":
|
|
1131
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1179
|
+
this.renderingPipeline.depthOfFieldBlurLevel = O.Low;
|
|
1132
1180
|
break;
|
|
1133
1181
|
case "Medium":
|
|
1134
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1182
|
+
this.renderingPipeline.depthOfFieldBlurLevel = O.Medium;
|
|
1135
1183
|
break;
|
|
1136
1184
|
case "High":
|
|
1137
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1185
|
+
this.renderingPipeline.depthOfFieldBlurLevel = O.High;
|
|
1138
1186
|
break;
|
|
1139
1187
|
}
|
|
1140
1188
|
if (this.renderingPipeline.depthOfField.focalLength = e.depthOfField?.focalLength ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = e.depthOfField?.fStop ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = e.depthOfField?.focusDistance ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = e.depthOfField?.lensSize ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = e.grain?.enabled ?? d.grain.enabled, this.renderingPipeline.grain.animated = e.grain?.animated ?? d.grain.animated, this.renderingPipeline.grain.intensity = e.grain?.intensity ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = e.misc?.contrast ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = e.misc?.exposure ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = e.misc?.toneMappingEnabled ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1141
1189
|
switch (e.misc?.toneMappingType ?? d.misc.toneMappingType) {
|
|
1142
1190
|
case "Standard":
|
|
1143
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1191
|
+
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
|
|
1144
1192
|
break;
|
|
1145
1193
|
case "ACES":
|
|
1146
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1194
|
+
this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_ACES;
|
|
1147
1195
|
break;
|
|
1148
1196
|
}
|
|
1149
1197
|
if (this.renderingPipeline.sharpenEnabled = e.sharpen?.enabled ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = e.sharpen?.colorAmount ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = e.sharpen?.edgeAmount ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = e.vignette?.enabled ?? d.vignette.enabled, e.vignette?.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
|
|
1150
1198
|
switch (e.vignette?.blendMode ?? d.vignette.blendMode) {
|
|
1151
1199
|
case "Multiply":
|
|
1152
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1200
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = E.VIGNETTEMODE_MULTIPLY;
|
|
1153
1201
|
break;
|
|
1154
1202
|
case "Opaque":
|
|
1155
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1203
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = E.VIGNETTEMODE_OPAQUE;
|
|
1156
1204
|
break;
|
|
1157
1205
|
}
|
|
1158
1206
|
e.vignette?.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new v(
|
|
@@ -1171,49 +1219,49 @@ class _e {
|
|
|
1171
1219
|
}
|
|
1172
1220
|
}
|
|
1173
1221
|
updateColorCurve(e) {
|
|
1174
|
-
const t = new
|
|
1222
|
+
const t = new Y();
|
|
1175
1223
|
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;
|
|
1176
1224
|
}
|
|
1177
1225
|
}
|
|
1178
|
-
|
|
1179
|
-
return new
|
|
1226
|
+
fe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1227
|
+
return new Be(n);
|
|
1180
1228
|
});
|
|
1181
|
-
|
|
1229
|
+
q.OnPluginActivatedObservable.add((n) => {
|
|
1182
1230
|
if (n.name === "gltf") {
|
|
1183
1231
|
const e = n;
|
|
1184
1232
|
e.transparencyAsCoverage = !0;
|
|
1185
1233
|
}
|
|
1186
1234
|
});
|
|
1187
|
-
const
|
|
1188
|
-
function
|
|
1235
|
+
const F = "spiff-fallback-light";
|
|
1236
|
+
function S(n) {
|
|
1189
1237
|
return new g(n.x, n.y, n.z);
|
|
1190
1238
|
}
|
|
1191
|
-
function
|
|
1239
|
+
function B(n) {
|
|
1192
1240
|
return { x: n.x, y: n.y, z: n.z };
|
|
1193
1241
|
}
|
|
1194
|
-
class
|
|
1242
|
+
class $t {
|
|
1195
1243
|
constructor(e) {
|
|
1196
1244
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.validHighlightMaterials = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.environmentLightingAvailable = !1, this.renderLoop = () => {
|
|
1197
1245
|
if (!this.engine.views)
|
|
1198
1246
|
return;
|
|
1199
|
-
this.modelContainers.forEach((
|
|
1200
|
-
|
|
1247
|
+
this.modelContainers.forEach((l) => {
|
|
1248
|
+
l.updateDynamicTextures();
|
|
1201
1249
|
}), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0;
|
|
1202
1250
|
const r = this.engine.getRenderingCanvas();
|
|
1203
1251
|
if (r)
|
|
1204
1252
|
if (r.getContext("webgl2") ?? r.getContext("webgl")) {
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1253
|
+
const l = this.configuration.scene.clearColor, h = r.getContext("webgl2") ?? r.getContext("webgl");
|
|
1254
|
+
h.clearDepth(1), h.depthFunc(h.LEQUAL), h.clearStencil(0), h.clearColor(l.r, l.g, l.b, l.a), h.clear(h.COLOR_BUFFER_BIT | h.DEPTH_BUFFER_BIT | h.STENCIL_BUFFER_BIT);
|
|
1207
1255
|
} else r.getContext("2d") ? r.getContext("2d").clearRect(0, 0, r.width, r.height) : console.error("SpiffCommerce: Failed to get any context on the rendering canvas.");
|
|
1208
1256
|
this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1209
|
-
const
|
|
1210
|
-
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus,
|
|
1211
|
-
}, this.configuration = new
|
|
1257
|
+
const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
|
|
1258
|
+
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0);
|
|
1259
|
+
}, this.configuration = new j(e);
|
|
1212
1260
|
const i = (() => {
|
|
1213
1261
|
if (!e?.noRender)
|
|
1214
1262
|
return this.configuration.createCanvas();
|
|
1215
1263
|
})(), a = "1.5.7";
|
|
1216
|
-
|
|
1264
|
+
me.Configuration = {
|
|
1217
1265
|
decoder: {
|
|
1218
1266
|
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_wasm_wrapper_gltf.js`,
|
|
1219
1267
|
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.wasm`,
|
|
@@ -1223,7 +1271,7 @@ class Ft {
|
|
|
1223
1271
|
const s = console.log;
|
|
1224
1272
|
console.log = () => {
|
|
1225
1273
|
};
|
|
1226
|
-
const o = i ? new
|
|
1274
|
+
const o = i ? new D(i, !0, {
|
|
1227
1275
|
adaptToDeviceRatio: !0,
|
|
1228
1276
|
limitDeviceRatio: 2,
|
|
1229
1277
|
premultipliedAlpha: !1,
|
|
@@ -1231,8 +1279,8 @@ class Ft {
|
|
|
1231
1279
|
audioEngine: !1,
|
|
1232
1280
|
stencil: this.configuration.highlights.enabled,
|
|
1233
1281
|
forceSRGBBufferSupportState: !0
|
|
1234
|
-
}) : new
|
|
1235
|
-
o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new
|
|
1282
|
+
}) : new ce();
|
|
1283
|
+
o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new pe(o), this.camera = _.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new tt(this.scene, !1, this.camera), this.scene.clearColor = this.configuration.scene.clearColor, this.setEnvironmentTexture(this.configuration, "initial-environment-cube"), this.scene.environmentIntensity = this.configuration.scene.environment.intensity, this.configuration.options?.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(this.configuration.options.renderingPipelineConfiguration) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new De(this.scene, this.configuration.emissiveGlowIntensity), this.initPromise = new Promise((r) => {
|
|
1236
1284
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1237
1285
|
this.initComplete = !0, r();
|
|
1238
1286
|
});
|
|
@@ -1266,7 +1314,7 @@ class Ft {
|
|
|
1266
1314
|
}
|
|
1267
1315
|
registerView(e) {
|
|
1268
1316
|
const t = e.height, i = e.width;
|
|
1269
|
-
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1317
|
+
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(k.Pan), this.reattachControls(e), this.engine.activeRenderLoops.length === 0 && this.engine.runRenderLoop(this.renderLoop);
|
|
1270
1318
|
}
|
|
1271
1319
|
unregisterView(e) {
|
|
1272
1320
|
this.engine.unRegisterView(e), this.engine.views && this.engine.views.length === 0 && this.engine.stopRenderLoop(this.renderLoop);
|
|
@@ -1283,7 +1331,7 @@ class Ft {
|
|
|
1283
1331
|
let t = () => {
|
|
1284
1332
|
};
|
|
1285
1333
|
const i = async () => {
|
|
1286
|
-
this.isAnimatingCamera = !0, await
|
|
1334
|
+
this.isAnimatingCamera = !0, await _e(this.scene, this.scene.activeCamera, e), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1287
1335
|
};
|
|
1288
1336
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((a) => {
|
|
1289
1337
|
t = a;
|
|
@@ -1308,7 +1356,7 @@ class Ft {
|
|
|
1308
1356
|
setCameraState(e) {
|
|
1309
1357
|
if (!this.engine?.views || !this.engine?.views[0])
|
|
1310
1358
|
throw new Error("No views attached, camera state requires a view to attach controls onto.");
|
|
1311
|
-
e ===
|
|
1359
|
+
e === k.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1312
1360
|
}
|
|
1313
1361
|
animateToLastCameraFocus() {
|
|
1314
1362
|
let e = () => {
|
|
@@ -1341,13 +1389,13 @@ class Ft {
|
|
|
1341
1389
|
async renderSceneScreenshot(e, t) {
|
|
1342
1390
|
if (!this.camera)
|
|
1343
1391
|
throw new Error("Missing product camera, cannot render screenshot!");
|
|
1344
|
-
const i = new
|
|
1392
|
+
const i = new re("screenshotCamera", 0, 0, 0, g.Zero(), this.scene), a = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
|
|
1345
1393
|
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = s, i.beta = a, i.radius = t.radius || this.camera.radius, i.minZ = 0.01;
|
|
1346
1394
|
try {
|
|
1347
1395
|
return await new Promise((o) => {
|
|
1348
1396
|
const r = this.scene.onBeforeRenderObservable.add(async () => {
|
|
1349
1397
|
this.scene.onBeforeRenderObservable.remove(r);
|
|
1350
|
-
const
|
|
1398
|
+
const c = await ge.CreateScreenshotUsingRenderTargetAsync(
|
|
1351
1399
|
this.engine,
|
|
1352
1400
|
i,
|
|
1353
1401
|
e,
|
|
@@ -1355,7 +1403,7 @@ class Ft {
|
|
|
1355
1403
|
2,
|
|
1356
1404
|
!0
|
|
1357
1405
|
);
|
|
1358
|
-
return i.dispose(), o(
|
|
1406
|
+
return i.dispose(), o(c);
|
|
1359
1407
|
});
|
|
1360
1408
|
this.scene.render(), this.engine.endFrame();
|
|
1361
1409
|
});
|
|
@@ -1370,8 +1418,8 @@ class Ft {
|
|
|
1370
1418
|
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, a = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
|
|
1371
1419
|
if (t === void 0 || i === void 0 || a === void 0 || s === void 0)
|
|
1372
1420
|
return !0;
|
|
1373
|
-
const o = [t, i], r = [a, s],
|
|
1374
|
-
return !
|
|
1421
|
+
const o = [t, i], r = [a, s], c = o.every((h) => h === t), l = r.every((h) => h === a);
|
|
1422
|
+
return !c && !l;
|
|
1375
1423
|
}
|
|
1376
1424
|
fireResizeEvent() {
|
|
1377
1425
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
@@ -1394,7 +1442,7 @@ class Ft {
|
|
|
1394
1442
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1395
1443
|
}
|
|
1396
1444
|
loadModel(e, t) {
|
|
1397
|
-
const { refocusCamera: i = !0, progressHandler: a } = t ?? {}, s = new
|
|
1445
|
+
const { refocusCamera: i = !0, progressHandler: a } = t ?? {}, s = new et({
|
|
1398
1446
|
enablePicking: this.configuration.highlights.enabled,
|
|
1399
1447
|
modelDetails: e,
|
|
1400
1448
|
scene: this.scene,
|
|
@@ -1420,7 +1468,7 @@ class Ft {
|
|
|
1420
1468
|
}), s;
|
|
1421
1469
|
}
|
|
1422
1470
|
async preloadModel(e) {
|
|
1423
|
-
await
|
|
1471
|
+
await z(e, this.scene);
|
|
1424
1472
|
}
|
|
1425
1473
|
getAllModels() {
|
|
1426
1474
|
return Array.from(this.modelContainers.values());
|
|
@@ -1455,19 +1503,19 @@ class Ft {
|
|
|
1455
1503
|
* Flips a transform around the origin.
|
|
1456
1504
|
*/
|
|
1457
1505
|
flipTransform(e, t, i) {
|
|
1458
|
-
const a =
|
|
1459
|
-
|
|
1460
|
-
A.FromEulerVector(
|
|
1461
|
-
|
|
1462
|
-
), s =
|
|
1463
|
-
return o.decompose(
|
|
1464
|
-
position:
|
|
1465
|
-
rotation:
|
|
1466
|
-
scale:
|
|
1506
|
+
const a = K.Compose(
|
|
1507
|
+
S(i || { x: 1, y: 1, z: 1 }),
|
|
1508
|
+
A.FromEulerVector(S(t || { x: 0, y: 0, z: 0 })),
|
|
1509
|
+
S(e || { x: 0, y: 0, z: 0 })
|
|
1510
|
+
), s = K.RotationAxis(g.Up(), Math.PI), o = a.multiply(s), r = g.Zero(), c = A.Identity(), l = g.Zero();
|
|
1511
|
+
return o.decompose(l, c, r), c.multiplyInPlace(A.FromEulerAngles(0, Math.PI, 0)), {
|
|
1512
|
+
position: B(r),
|
|
1513
|
+
rotation: B(c.toEulerAngles()),
|
|
1514
|
+
scale: B(l)
|
|
1467
1515
|
};
|
|
1468
1516
|
}
|
|
1469
1517
|
updatePreviewOptions(e) {
|
|
1470
|
-
const t = new
|
|
1518
|
+
const t = new j(e);
|
|
1471
1519
|
if (this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor, this.configuration.scene.environment.file !== t.scene.environment.file)
|
|
1472
1520
|
this.setEnvironmentTexture(t, "updated-environment-cube");
|
|
1473
1521
|
else {
|
|
@@ -1494,7 +1542,7 @@ class Ft {
|
|
|
1494
1542
|
this.environmentLightingAvailable = !0;
|
|
1495
1543
|
const a = this.scene.useDelayedTextureLoading;
|
|
1496
1544
|
this.scene.useDelayedTextureLoading = !1;
|
|
1497
|
-
const s = new
|
|
1545
|
+
const s = new ue(i, this.scene, {
|
|
1498
1546
|
prefiltered: !0,
|
|
1499
1547
|
createPolynomials: !0,
|
|
1500
1548
|
onError: () => {
|
|
@@ -1510,12 +1558,12 @@ class Ft {
|
|
|
1510
1558
|
* @param configuration The configuration holding the fallback lighting settings to apply.
|
|
1511
1559
|
*/
|
|
1512
1560
|
reconcileFallbackLighting(e) {
|
|
1513
|
-
const t = e.fallbackLighting, i = this.scene.getLightByName(
|
|
1561
|
+
const t = e.fallbackLighting, i = this.scene.getLightByName(F), a = this.scene.lights.some((o) => o.name !== F);
|
|
1514
1562
|
if (!t.enabled || this.environmentLightingAvailable || a) {
|
|
1515
1563
|
i?.dispose();
|
|
1516
1564
|
return;
|
|
1517
1565
|
}
|
|
1518
|
-
const s = i ?? new
|
|
1566
|
+
const s = i ?? new de(F, new g(0, 1, 0), this.scene);
|
|
1519
1567
|
s.intensity = t.intensity, s.diffuse = t.color, s.groundColor = t.groundColor;
|
|
1520
1568
|
}
|
|
1521
1569
|
setHighlightMaterials(e) {
|
|
@@ -1535,15 +1583,15 @@ class Ft {
|
|
|
1535
1583
|
this.scene.attachControl(!0, !0, !0);
|
|
1536
1584
|
}
|
|
1537
1585
|
static isSupported() {
|
|
1538
|
-
return
|
|
1586
|
+
return D.isSupported();
|
|
1539
1587
|
}
|
|
1540
1588
|
}
|
|
1541
1589
|
export {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1590
|
+
N as MaterialEffectMode,
|
|
1591
|
+
k as ProductCameraRig,
|
|
1592
|
+
Se as REFLECTION_PROBE_RESOLUTION,
|
|
1545
1593
|
x as RenderingConfiguration,
|
|
1546
|
-
|
|
1594
|
+
$t as SpiffCommerce3DPreviewService,
|
|
1547
1595
|
d as renderingPipelineDefaults
|
|
1548
1596
|
};
|
|
1549
1597
|
//# sourceMappingURL=index.esm.js.map
|