@spiffcommerce/preview 5.4.0 → 5.5.0-beta.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 +6 -0
- package/dist/index.esm.js +229 -220
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8,8 +8,8 @@ import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
|
8
8
|
import { Vector3 as p, Quaternion as y, Vector2 as se, Matrix as re } from "@babylonjs/core/Maths/math.vector";
|
|
9
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
|
|
11
|
+
import { Tools as Pe } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as xe } from "@babylonjs/core/scene";
|
|
13
13
|
import { GLTF2 as Ae } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { GLTFLoaderAnimationStartMode as Re } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
15
|
import { PBRMaterial as B } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
@@ -27,7 +27,7 @@ import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
|
27
27
|
import { QuadraticEase as ke, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
28
28
|
import { AssetsManager as Ve } from "@babylonjs/core/Misc/assetsManager";
|
|
29
29
|
import { ColorCurves as le } from "@babylonjs/core/Materials/colorCurves";
|
|
30
|
-
import { ImageProcessingConfiguration as
|
|
30
|
+
import { ImageProcessingConfiguration as x } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
31
31
|
import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
32
32
|
import { DepthOfFieldEffectBlurLevel as T } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
33
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
@@ -47,13 +47,13 @@ async function D(n, e, t) {
|
|
|
47
47
|
if (i)
|
|
48
48
|
return i;
|
|
49
49
|
{
|
|
50
|
-
const
|
|
50
|
+
const r = S.LoadAssetContainerAsync(
|
|
51
51
|
n,
|
|
52
52
|
void 0,
|
|
53
53
|
e,
|
|
54
54
|
t
|
|
55
55
|
);
|
|
56
|
-
return he.set(n,
|
|
56
|
+
return he.set(n, r), r;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
S.OnPluginActivatedObservable.add((n) => {
|
|
@@ -62,9 +62,9 @@ S.OnPluginActivatedObservable.add((n) => {
|
|
|
62
62
|
class ce {
|
|
63
63
|
constructor(e) {
|
|
64
64
|
this.getSceneClearColor = () => {
|
|
65
|
-
var i,
|
|
66
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
67
|
-
if (this.customOptions && ((
|
|
65
|
+
var i, r, s, o;
|
|
66
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
67
|
+
if (this.customOptions && ((s = this.customOptions) != null && s.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
68
68
|
return new b(0, 0, 0, t).toLinearSpace();
|
|
69
69
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
70
70
|
const a = w.FromHexString(
|
|
@@ -79,11 +79,11 @@ class ce {
|
|
|
79
79
|
}
|
|
80
80
|
return new b(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
81
81
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new b(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
82
|
-
const
|
|
82
|
+
const r = w.FromHexString(t);
|
|
83
83
|
return new b(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
r.r,
|
|
85
|
+
r.g,
|
|
86
|
+
r.b,
|
|
87
87
|
i
|
|
88
88
|
).toLinearSpace();
|
|
89
89
|
}, this.customOptions = e;
|
|
@@ -99,14 +99,14 @@ class ce {
|
|
|
99
99
|
* Configuration related to the scene
|
|
100
100
|
*/
|
|
101
101
|
get scene() {
|
|
102
|
-
var e, t, i,
|
|
102
|
+
var e, t, i, r, s;
|
|
103
103
|
return {
|
|
104
104
|
clearColor: this.getSceneClearColor(),
|
|
105
105
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
106
106
|
environment: {
|
|
107
107
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
108
|
-
intensity: ((
|
|
109
|
-
rotationY: (((
|
|
108
|
+
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
109
|
+
rotationY: (((s = this.customOptions) == null ? void 0 : s.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
110
110
|
// Convert to radians
|
|
111
111
|
}
|
|
112
112
|
};
|
|
@@ -115,7 +115,7 @@ class ce {
|
|
|
115
115
|
* Configuration related to the camera used to view and interact with the scene.
|
|
116
116
|
*/
|
|
117
117
|
get camera() {
|
|
118
|
-
var e, t, i,
|
|
118
|
+
var e, t, i, r, s, o, a, l, c, h, u, m, g;
|
|
119
119
|
return {
|
|
120
120
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
121
121
|
autoRotation: {
|
|
@@ -124,12 +124,12 @@ class ce {
|
|
|
124
124
|
},
|
|
125
125
|
limits: {
|
|
126
126
|
min: {
|
|
127
|
-
alpha: (
|
|
127
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((s = this.customOptions) == null ? void 0 : s.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
128
128
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
129
|
-
radius: (
|
|
129
|
+
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
130
130
|
},
|
|
131
131
|
max: {
|
|
132
|
-
alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((
|
|
132
|
+
alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((h = this.customOptions) == null ? void 0 : h.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
133
133
|
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
134
134
|
radius: (g = this.customOptions) == null ? void 0 : g.maxZoomOverride
|
|
135
135
|
}
|
|
@@ -148,10 +148,10 @@ class ce {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
get lighting() {
|
|
151
|
-
var e, t, i,
|
|
151
|
+
var e, t, i, r;
|
|
152
152
|
return {
|
|
153
153
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
154
|
-
contrast: ((
|
|
154
|
+
contrast: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
get emissiveGlowIntensity() {
|
|
@@ -159,12 +159,12 @@ class ce {
|
|
|
159
159
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
class
|
|
162
|
+
class P {
|
|
163
163
|
/**
|
|
164
164
|
* Returns the resolution expected for generated textures.
|
|
165
165
|
*/
|
|
166
166
|
static getDynamicTextureResolution() {
|
|
167
|
-
return this.getIsMobile() || !
|
|
167
|
+
return this.getIsMobile() || !P.offscreenRenderingSupported() ? {
|
|
168
168
|
width: 1024,
|
|
169
169
|
height: 1024
|
|
170
170
|
} : {
|
|
@@ -272,11 +272,11 @@ class Ge {
|
|
|
272
272
|
return this.loader.loadNodeAsync(
|
|
273
273
|
e,
|
|
274
274
|
t,
|
|
275
|
-
function(
|
|
276
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
277
|
-
const o = t.extras[
|
|
278
|
-
|
|
279
|
-
}), i(
|
|
275
|
+
function(r) {
|
|
276
|
+
t.extras && Object.keys(t.extras).forEach((s) => {
|
|
277
|
+
const o = t.extras[s];
|
|
278
|
+
r.metadata[s] = o;
|
|
279
|
+
}), i(r);
|
|
280
280
|
}
|
|
281
281
|
);
|
|
282
282
|
}
|
|
@@ -334,51 +334,51 @@ class Ge {
|
|
|
334
334
|
* @param scene The scene to parse.
|
|
335
335
|
*/
|
|
336
336
|
applyReflections(e) {
|
|
337
|
-
function t(
|
|
337
|
+
function t(s) {
|
|
338
338
|
const o = [];
|
|
339
|
-
return
|
|
339
|
+
return s.transformNodes.forEach((a) => {
|
|
340
340
|
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
341
|
-
}),
|
|
341
|
+
}), s.meshes.forEach((a) => {
|
|
342
342
|
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
343
343
|
}), o;
|
|
344
344
|
}
|
|
345
|
-
function i(
|
|
346
|
-
const a =
|
|
345
|
+
function i(s, o = 1) {
|
|
346
|
+
const a = s.material;
|
|
347
347
|
if (!a)
|
|
348
348
|
return;
|
|
349
|
-
const
|
|
349
|
+
const l = new Te(
|
|
350
350
|
"mirror",
|
|
351
|
-
|
|
351
|
+
P.getMirrorTextureResolution(),
|
|
352
352
|
e,
|
|
353
353
|
!0
|
|
354
354
|
);
|
|
355
|
-
|
|
356
|
-
const c =
|
|
355
|
+
l.renderList = t(e);
|
|
356
|
+
const c = s.getVerticesData("normal");
|
|
357
357
|
if (!c)
|
|
358
358
|
throw new Error(
|
|
359
|
-
"Mirror attribute specified on: " +
|
|
359
|
+
"Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
|
|
360
360
|
);
|
|
361
|
-
|
|
362
|
-
const
|
|
361
|
+
s.computeWorldMatrix(!0);
|
|
362
|
+
const h = s.getWorldMatrix(), u = ae.TransformNormal(
|
|
363
363
|
new ae(c[0], c[1], c[2]),
|
|
364
|
-
|
|
364
|
+
h
|
|
365
365
|
).normalize(), m = Oe.FromPositionAndNormal(
|
|
366
|
-
|
|
366
|
+
s.position,
|
|
367
367
|
u.scale(-1)
|
|
368
368
|
);
|
|
369
|
-
|
|
369
|
+
l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
|
|
370
370
|
}
|
|
371
|
-
function s
|
|
372
|
-
const o =
|
|
371
|
+
function r(s) {
|
|
372
|
+
const o = s.material, a = new Le(
|
|
373
373
|
"probe-" + o.name,
|
|
374
374
|
Ne,
|
|
375
375
|
e
|
|
376
376
|
);
|
|
377
|
-
a.attachToMesh(
|
|
377
|
+
a.attachToMesh(s), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
378
378
|
}
|
|
379
|
-
e.meshes.forEach((
|
|
380
|
-
const o =
|
|
381
|
-
o && (o.mirrorTexture && i(
|
|
379
|
+
e.meshes.forEach((s) => {
|
|
380
|
+
const o = s.metadata;
|
|
381
|
+
o && (o.mirrorTexture && i(s, o.mirrorTexture), o.reflectionProbe && r(s));
|
|
382
382
|
});
|
|
383
383
|
}
|
|
384
384
|
}
|
|
@@ -404,23 +404,23 @@ class _e {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
function He(n, e, t, i,
|
|
408
|
-
t.forEach((
|
|
409
|
-
const o =
|
|
410
|
-
n.filter((
|
|
407
|
+
function He(n, e, t, i, r = "") {
|
|
408
|
+
t.forEach((s) => {
|
|
409
|
+
const o = s.getID(), a = s.getName(), l = P.getDynamicTextureResolution();
|
|
410
|
+
n.filter((h) => h.name === r + a).forEach((h) => {
|
|
411
411
|
const u = i.get(o), m = !1;
|
|
412
412
|
if (u)
|
|
413
|
-
de(
|
|
413
|
+
de(h, u), u.update(m);
|
|
414
414
|
else {
|
|
415
415
|
const g = Ke(
|
|
416
416
|
a,
|
|
417
417
|
e,
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
l.width,
|
|
419
|
+
l.height
|
|
420
420
|
);
|
|
421
|
-
i.set(o, g),
|
|
421
|
+
i.set(o, g), s.setStaticContext(
|
|
422
422
|
g.getContext()
|
|
423
|
-
), de(
|
|
423
|
+
), de(h, g), g.onLoadObservable.addOnce(() => {
|
|
424
424
|
g.update(m);
|
|
425
425
|
});
|
|
426
426
|
}
|
|
@@ -428,15 +428,15 @@ function He(n, e, t, i, s = "") {
|
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
function Ke(n, e, t, i) {
|
|
431
|
-
const
|
|
431
|
+
const r = new Be(
|
|
432
432
|
n,
|
|
433
433
|
{ width: t, height: i },
|
|
434
434
|
e,
|
|
435
|
-
|
|
435
|
+
P.shouldMipMap(),
|
|
436
436
|
De.TRILINEAR_SAMPLINGMODE,
|
|
437
437
|
be.TEXTUREFORMAT_RGBA
|
|
438
|
-
),
|
|
439
|
-
return
|
|
438
|
+
), s = r.getContext();
|
|
439
|
+
return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), r.update()), r;
|
|
440
440
|
}
|
|
441
441
|
function de(n, e) {
|
|
442
442
|
if (n instanceof B) {
|
|
@@ -455,39 +455,39 @@ const M = 60, ue = 1;
|
|
|
455
455
|
function me(n) {
|
|
456
456
|
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
457
457
|
}
|
|
458
|
-
function ve(n, e, t, i,
|
|
459
|
-
const o =
|
|
458
|
+
function ve(n, e, t, i, r, s) {
|
|
459
|
+
const o = r ? n.filter((h) => h.name === r) : n;
|
|
460
460
|
if (o.length === 0) {
|
|
461
|
-
console.warn(`No animations found for name: ${
|
|
461
|
+
console.warn(`No animations found for name: ${r}`);
|
|
462
462
|
return;
|
|
463
463
|
}
|
|
464
464
|
let a = 0;
|
|
465
|
-
const
|
|
466
|
-
a++, a === o.length &&
|
|
467
|
-
}, c = (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}) :
|
|
471
|
-
|
|
465
|
+
const l = () => {
|
|
466
|
+
a++, a === o.length && s && s();
|
|
467
|
+
}, c = (h, u, m, g, f) => {
|
|
468
|
+
h.stop(), h.start(u, m, g, f), s && (u == !1 || u === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
|
|
469
|
+
l();
|
|
470
|
+
}) : h.onAnimationLoopObservable.addOnce(() => {
|
|
471
|
+
l();
|
|
472
472
|
}));
|
|
473
473
|
};
|
|
474
474
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
475
|
-
o.forEach((
|
|
476
|
-
const u = me(
|
|
477
|
-
c(
|
|
475
|
+
o.forEach((h) => {
|
|
476
|
+
const u = me(h), m = i * u;
|
|
477
|
+
c(h, !1, ue, m, m);
|
|
478
478
|
});
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
|
-
o.forEach((
|
|
482
|
-
const u = me(
|
|
483
|
-
c(
|
|
481
|
+
o.forEach((h) => {
|
|
482
|
+
const u = me(h), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
|
|
483
|
+
c(h, e, ue, m, g);
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
function We(n, e, t) {
|
|
487
487
|
return new Promise((i) => {
|
|
488
488
|
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
|
|
489
|
-
const
|
|
490
|
-
if (t.target && Object.keys(t.target).length > 0 &&
|
|
489
|
+
const r = [], s = t.target, o = 0, a = s ? 1 : 0;
|
|
490
|
+
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
491
491
|
A(
|
|
492
492
|
"cameraTargetLerp",
|
|
493
493
|
"target",
|
|
@@ -500,7 +500,7 @@ function We(n, e, t) {
|
|
|
500
500
|
v.ANIMATIONTYPE_VECTOR3,
|
|
501
501
|
o
|
|
502
502
|
)
|
|
503
|
-
),
|
|
503
|
+
), r.push(
|
|
504
504
|
A(
|
|
505
505
|
"cameraAlphaLerp",
|
|
506
506
|
"alpha",
|
|
@@ -509,7 +509,7 @@ function We(n, e, t) {
|
|
|
509
509
|
v.ANIMATIONTYPE_FLOAT,
|
|
510
510
|
a
|
|
511
511
|
)
|
|
512
|
-
),
|
|
512
|
+
), r.push(
|
|
513
513
|
A(
|
|
514
514
|
"cameraBetaLerp",
|
|
515
515
|
"beta",
|
|
@@ -519,24 +519,24 @@ function We(n, e, t) {
|
|
|
519
519
|
a
|
|
520
520
|
)
|
|
521
521
|
), t.radius !== void 0) {
|
|
522
|
-
const
|
|
523
|
-
|
|
522
|
+
const h = Math.max(0.01, t.radius);
|
|
523
|
+
r.push(
|
|
524
524
|
A(
|
|
525
525
|
"cameraRadiusLerp",
|
|
526
526
|
"radius",
|
|
527
527
|
e.radius,
|
|
528
|
-
|
|
528
|
+
h,
|
|
529
529
|
v.ANIMATIONTYPE_FLOAT,
|
|
530
530
|
a
|
|
531
531
|
)
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
|
-
e.animations.push(...
|
|
534
|
+
e.animations.push(...r);
|
|
535
535
|
const c = e.useAutoRotationBehavior;
|
|
536
536
|
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
537
537
|
e,
|
|
538
538
|
0,
|
|
539
|
-
|
|
539
|
+
s ? M * 2 : M,
|
|
540
540
|
!1,
|
|
541
541
|
1,
|
|
542
542
|
() => {
|
|
@@ -548,20 +548,20 @@ function We(n, e, t) {
|
|
|
548
548
|
function ge(n) {
|
|
549
549
|
return n * Math.PI / 180;
|
|
550
550
|
}
|
|
551
|
-
function A(n, e, t, i,
|
|
551
|
+
function A(n, e, t, i, r, s = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
552
552
|
const a = new ke();
|
|
553
553
|
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
554
|
-
const
|
|
554
|
+
const l = new v(
|
|
555
555
|
n,
|
|
556
556
|
e,
|
|
557
557
|
M,
|
|
558
|
-
|
|
558
|
+
r,
|
|
559
559
|
o
|
|
560
560
|
), c = [];
|
|
561
|
-
return
|
|
562
|
-
frame: M * (
|
|
561
|
+
return s > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * s, value: t }), c.push({
|
|
562
|
+
frame: M * (s + 1),
|
|
563
563
|
value: i
|
|
564
|
-
}),
|
|
564
|
+
}), l.setKeys(c), l.setEasingFunction(a), l;
|
|
565
565
|
}
|
|
566
566
|
function Ye(n, e, t) {
|
|
567
567
|
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
@@ -591,9 +591,9 @@ function $e(n, e, t, i) {
|
|
|
591
591
|
"metallicTexture",
|
|
592
592
|
"refractionTexture",
|
|
593
593
|
"reflectionTexture"
|
|
594
|
-
].forEach((
|
|
594
|
+
].forEach((s) => {
|
|
595
595
|
je(
|
|
596
|
-
|
|
596
|
+
s,
|
|
597
597
|
n,
|
|
598
598
|
e,
|
|
599
599
|
t,
|
|
@@ -601,11 +601,11 @@ function $e(n, e, t, i) {
|
|
|
601
601
|
);
|
|
602
602
|
}), et(n, e);
|
|
603
603
|
}
|
|
604
|
-
function je(n, e, t, i,
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
604
|
+
function je(n, e, t, i, r) {
|
|
605
|
+
const s = Ze[n];
|
|
606
|
+
if (!s)
|
|
607
607
|
throw new Error("Unexpected texture name encountered.");
|
|
608
|
-
const o = e[
|
|
608
|
+
const o = e[s], a = o == null ? void 0 : o.fileLink;
|
|
609
609
|
a ? n === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
610
610
|
n,
|
|
611
611
|
a,
|
|
@@ -620,7 +620,7 @@ function je(n, e, t, i, s) {
|
|
|
620
620
|
!1,
|
|
621
621
|
!0,
|
|
622
622
|
!1
|
|
623
|
-
) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) :
|
|
623
|
+
) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : r && t[n] && (t[n] && t[n].dispose(), t[n] = null, Xe(n, t));
|
|
624
624
|
}
|
|
625
625
|
function Xe(n, e) {
|
|
626
626
|
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 w(0, 0, 0), e.reflectionTexture);
|
|
@@ -648,32 +648,32 @@ class tt {
|
|
|
648
648
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
649
649
|
* where we want to undo changes are remove effects from display.
|
|
650
650
|
*/
|
|
651
|
-
async applyMaterial(e, t, i,
|
|
652
|
-
return new Promise((
|
|
651
|
+
async applyMaterial(e, t, i, r) {
|
|
652
|
+
return new Promise((s) => {
|
|
653
653
|
const o = this.materialVariantMap.get(e);
|
|
654
654
|
this.materialVariantMap.set(e, {
|
|
655
655
|
...o,
|
|
656
656
|
...t
|
|
657
657
|
});
|
|
658
|
-
const a = this.renameClonedAsset(e),
|
|
659
|
-
(
|
|
658
|
+
const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
659
|
+
(h) => h.name === a
|
|
660
660
|
);
|
|
661
|
-
if (
|
|
662
|
-
|
|
661
|
+
if (l.length === 0) {
|
|
662
|
+
s();
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
665
|
const c = new Ve(this.scene);
|
|
666
|
-
c.useDefaultLoadingScreen = !1,
|
|
667
|
-
(
|
|
666
|
+
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
667
|
+
(h) => $e(
|
|
668
668
|
t,
|
|
669
|
-
|
|
669
|
+
h,
|
|
670
670
|
c,
|
|
671
|
-
|
|
671
|
+
r
|
|
672
672
|
)
|
|
673
|
-
), c.onProgress = (
|
|
674
|
-
i && i(
|
|
675
|
-
}, c.onFinish = (
|
|
676
|
-
|
|
673
|
+
), c.onProgress = (h, u, m) => {
|
|
674
|
+
i && i(h / u * 100, 100, m.name);
|
|
675
|
+
}, c.onFinish = (h) => {
|
|
676
|
+
h.forEach((u) => {
|
|
677
677
|
const m = u;
|
|
678
678
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
679
679
|
(f) => f.name === a
|
|
@@ -685,7 +685,7 @@ class tt {
|
|
|
685
685
|
m.texture
|
|
686
686
|
)
|
|
687
687
|
);
|
|
688
|
-
}),
|
|
688
|
+
}), s();
|
|
689
689
|
}, c.loadAsync();
|
|
690
690
|
});
|
|
691
691
|
}
|
|
@@ -699,23 +699,23 @@ class tt {
|
|
|
699
699
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
700
700
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
701
701
|
*/
|
|
702
|
-
async applyModel(e, t, i,
|
|
702
|
+
async applyModel(e, t, i, r, s, o, a) {
|
|
703
703
|
var u;
|
|
704
704
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
705
705
|
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (u = this.loadedContainerForKey.get(e)) == null || u.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
706
706
|
(m) => m !== e
|
|
707
707
|
), Promise.resolve(void 0);
|
|
708
|
-
const c = (await D(i, this.scene,
|
|
708
|
+
const c = (await D(i, this.scene, r)).instantiateModelsToScene(
|
|
709
709
|
this.renameClonedAsset,
|
|
710
710
|
!0
|
|
711
711
|
);
|
|
712
|
-
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)),
|
|
713
|
-
const m = o && o(), g =
|
|
712
|
+
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), s) {
|
|
713
|
+
const m = o && o(), g = s.name ? this.renameClonedAsset(s.name) : void 0;
|
|
714
714
|
if (ve(
|
|
715
715
|
c.animationGroups,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
716
|
+
s.loop,
|
|
717
|
+
s.to,
|
|
718
|
+
s.from,
|
|
719
719
|
g
|
|
720
720
|
), m != null) {
|
|
721
721
|
const f = a && a() || !0;
|
|
@@ -727,10 +727,10 @@ class tt {
|
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, we(c));
|
|
730
|
-
const
|
|
730
|
+
const h = [];
|
|
731
731
|
return this.materialVariantMap.forEach(async (m, g) => {
|
|
732
|
-
|
|
733
|
-
}), await Promise.all(
|
|
732
|
+
h.push(this.applyMaterial(g, m));
|
|
733
|
+
}), await Promise.all(h), c;
|
|
734
734
|
}
|
|
735
735
|
dispose() {
|
|
736
736
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -756,9 +756,9 @@ function we(n) {
|
|
|
756
756
|
const e = [];
|
|
757
757
|
return n.rootNodes.forEach((t) => {
|
|
758
758
|
t.getChildMeshes().forEach((i) => {
|
|
759
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
760
|
-
const
|
|
761
|
-
|
|
759
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
760
|
+
const s = r.getMaterial(!1);
|
|
761
|
+
s && !e.includes(s) && e.push(s);
|
|
762
762
|
});
|
|
763
763
|
});
|
|
764
764
|
}), e;
|
|
@@ -777,11 +777,11 @@ class it {
|
|
|
777
777
|
const {
|
|
778
778
|
enablePicking: t,
|
|
779
779
|
modelDetails: i,
|
|
780
|
-
previewService:
|
|
781
|
-
progressHandler:
|
|
780
|
+
previewService: r,
|
|
781
|
+
progressHandler: s,
|
|
782
782
|
scene: o
|
|
783
783
|
} = e;
|
|
784
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService =
|
|
784
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = r, this.scene = o, this.variantManager = new tt(
|
|
785
785
|
o,
|
|
786
786
|
this.renameClonedAsset.bind(this),
|
|
787
787
|
this.setBaseModelEnabled.bind(this)
|
|
@@ -794,13 +794,13 @@ class it {
|
|
|
794
794
|
return this.assetContainer = await D(
|
|
795
795
|
i.model,
|
|
796
796
|
o,
|
|
797
|
-
|
|
797
|
+
s
|
|
798
798
|
), await this.instantiate(), this;
|
|
799
799
|
};
|
|
800
800
|
this.importPromise = a();
|
|
801
801
|
}
|
|
802
802
|
//#region Interface implementation
|
|
803
|
-
async applyMaterialVariant(e, t, i,
|
|
803
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
804
804
|
if (!this.initialized) {
|
|
805
805
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
806
806
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -811,7 +811,7 @@ class it {
|
|
|
811
811
|
e,
|
|
812
812
|
t,
|
|
813
813
|
i,
|
|
814
|
-
|
|
814
|
+
r
|
|
815
815
|
)
|
|
816
816
|
);
|
|
817
817
|
} else {
|
|
@@ -827,41 +827,41 @@ class it {
|
|
|
827
827
|
e,
|
|
828
828
|
t,
|
|
829
829
|
i,
|
|
830
|
-
|
|
830
|
+
r
|
|
831
831
|
)
|
|
832
832
|
);
|
|
833
833
|
}
|
|
834
834
|
return;
|
|
835
835
|
}
|
|
836
|
-
const
|
|
836
|
+
const s = async () => {
|
|
837
837
|
await this.variantManager.applyMaterial(
|
|
838
838
|
e,
|
|
839
839
|
i,
|
|
840
|
-
(o, a,
|
|
840
|
+
(o, a, l) => {
|
|
841
841
|
this.materialVariantObservable.notifyObservers({
|
|
842
842
|
remainingCount: o,
|
|
843
843
|
totalCount: a,
|
|
844
|
-
taskName:
|
|
844
|
+
taskName: l
|
|
845
845
|
});
|
|
846
846
|
},
|
|
847
|
-
|
|
847
|
+
r
|
|
848
848
|
);
|
|
849
849
|
};
|
|
850
850
|
if (this.materialChangesInProgress.includes(e)) {
|
|
851
851
|
if (this.queuedMaterialChanges.has(e)) {
|
|
852
852
|
const o = this.queuedMaterialChanges.get(e);
|
|
853
|
-
o == null || o.set(t,
|
|
853
|
+
o == null || o.set(t, s);
|
|
854
854
|
} else {
|
|
855
855
|
this.queuedMaterialChanges.set(
|
|
856
856
|
e,
|
|
857
857
|
/* @__PURE__ */ new Map()
|
|
858
858
|
);
|
|
859
859
|
const o = this.queuedMaterialChanges.get(e);
|
|
860
|
-
o == null || o.set(t,
|
|
860
|
+
o == null || o.set(t, s);
|
|
861
861
|
}
|
|
862
862
|
return;
|
|
863
863
|
}
|
|
864
|
-
if (this.materialChangesInProgress.push(e), await
|
|
864
|
+
if (this.materialChangesInProgress.push(e), await s(), this.queuedMaterialChanges.has(e)) {
|
|
865
865
|
const o = this.queuedMaterialChanges.get(e);
|
|
866
866
|
if (!o)
|
|
867
867
|
throw new Error("Target material is undefined");
|
|
@@ -887,7 +887,7 @@ class it {
|
|
|
887
887
|
);
|
|
888
888
|
return;
|
|
889
889
|
}
|
|
890
|
-
const
|
|
890
|
+
const r = () => this.variantManager.applyModel(
|
|
891
891
|
e,
|
|
892
892
|
i,
|
|
893
893
|
t == null ? void 0 : t.model,
|
|
@@ -902,17 +902,17 @@ class it {
|
|
|
902
902
|
this.getAnimationIsPlaying.bind(this)
|
|
903
903
|
);
|
|
904
904
|
if (this.modelChangesInProgress.includes(e)) {
|
|
905
|
-
this.queuedModelChanges.set(e,
|
|
905
|
+
this.queuedModelChanges.set(e, r);
|
|
906
906
|
return;
|
|
907
907
|
}
|
|
908
908
|
const o = await (async () => {
|
|
909
909
|
this.modelChangesInProgress.push(e);
|
|
910
|
-
let a = await
|
|
910
|
+
let a = await r();
|
|
911
911
|
if (this.queuedModelChanges.has(e)) {
|
|
912
|
-
const
|
|
913
|
-
if (!
|
|
912
|
+
const l = this.queuedModelChanges.get(e);
|
|
913
|
+
if (!l)
|
|
914
914
|
throw new Error("Queued change resolved undefined");
|
|
915
|
-
a = await
|
|
915
|
+
a = await l(), this.queuedModelChanges.delete(e);
|
|
916
916
|
}
|
|
917
917
|
return this.modelChangesInProgress.splice(
|
|
918
918
|
this.modelChangesInProgress.indexOf(e),
|
|
@@ -931,24 +931,24 @@ class it {
|
|
|
931
931
|
let t = () => {
|
|
932
932
|
};
|
|
933
933
|
const i = async () => {
|
|
934
|
-
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((
|
|
934
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((r) => {
|
|
935
935
|
var o;
|
|
936
|
-
const
|
|
936
|
+
const s = [
|
|
937
937
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
938
938
|
...this.variantManager.getAnimationGroups()
|
|
939
939
|
];
|
|
940
940
|
ve(
|
|
941
|
-
|
|
941
|
+
s,
|
|
942
942
|
e.loop,
|
|
943
943
|
e.to,
|
|
944
944
|
e.from,
|
|
945
945
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
946
|
-
|
|
946
|
+
r
|
|
947
947
|
);
|
|
948
948
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
949
949
|
};
|
|
950
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
951
|
-
t =
|
|
950
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
951
|
+
t = r;
|
|
952
952
|
})) : i();
|
|
953
953
|
}
|
|
954
954
|
getAnimations(e) {
|
|
@@ -1026,8 +1026,8 @@ class it {
|
|
|
1026
1026
|
e.rootNodes.forEach((t) => {
|
|
1027
1027
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1028
1028
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
|
|
1029
|
-
new oe(R.OnPointerOverTrigger, (
|
|
1030
|
-
|
|
1029
|
+
new oe(R.OnPointerOverTrigger, (r) => {
|
|
1030
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1031
1031
|
id: i.material.id,
|
|
1032
1032
|
name: this.stripIdFromName(i.material.name)
|
|
1033
1033
|
});
|
|
@@ -1066,16 +1066,16 @@ class it {
|
|
|
1066
1066
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1067
1067
|
}
|
|
1068
1068
|
configureModelInstance(e) {
|
|
1069
|
-
var
|
|
1069
|
+
var s;
|
|
1070
1070
|
if (!this.transformRoot)
|
|
1071
1071
|
throw new Error(
|
|
1072
1072
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1073
1073
|
);
|
|
1074
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1074
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1075
1075
|
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1076
1076
|
for (const o of e.rootNodes)
|
|
1077
1077
|
o.parent = this.transformRoot;
|
|
1078
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1078
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((s = this.contextService) == null ? void 0 : s.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1079
1079
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1080
1080
|
this.scene,
|
|
1081
1081
|
this.canvasPanels,
|
|
@@ -1119,8 +1119,8 @@ class it {
|
|
|
1119
1119
|
var e;
|
|
1120
1120
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1121
1121
|
(t, i) => {
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1122
|
+
const r = this.dynamicTextures.get(i);
|
|
1123
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1124
1124
|
}
|
|
1125
1125
|
);
|
|
1126
1126
|
}
|
|
@@ -1179,15 +1179,15 @@ class it {
|
|
|
1179
1179
|
//#endregion
|
|
1180
1180
|
}
|
|
1181
1181
|
class k extends fe {
|
|
1182
|
-
constructor(e, t, i,
|
|
1182
|
+
constructor(e, t, i, r, s, o, a, l) {
|
|
1183
1183
|
super(
|
|
1184
1184
|
e,
|
|
1185
1185
|
t,
|
|
1186
1186
|
i,
|
|
1187
|
-
s,
|
|
1188
1187
|
r,
|
|
1188
|
+
s,
|
|
1189
1189
|
o,
|
|
1190
|
-
|
|
1190
|
+
l
|
|
1191
1191
|
), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, a.camera.autoOrientation && (this.alpha += Math.PI), a && (a.camera.limits.min.beta && (this.lowerBetaLimit = a.camera.limits.min.beta), a.camera.limits.max.beta && (this.upperBetaLimit = a.camera.limits.max.beta), a.camera.limits.min.alpha && (this.lowerAlphaLimit = a.camera.limits.min.alpha), a.camera.limits.max.alpha && (this.upperAlphaLimit = a.camera.limits.max.alpha), a.camera.limits.min.radius && (this.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.upperRadiusLimit = a.camera.limits.max.radius), a.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1192
1192
|
a.camera.autoRotation.idleTimeMs
|
|
1193
1193
|
));
|
|
@@ -1198,6 +1198,9 @@ class k extends fe {
|
|
|
1198
1198
|
set isRunningFramingBehavior(e) {
|
|
1199
1199
|
this._isRunningFramingBehavior = e, !e && this.framingBehaviourCallback && (this.framingBehaviourCallback(), this.framingBehaviourCallback = void 0);
|
|
1200
1200
|
}
|
|
1201
|
+
setPanEnabled(e) {
|
|
1202
|
+
this.panningSensibility = e ? 1e3 / this.panDenominator : 0;
|
|
1203
|
+
}
|
|
1201
1204
|
/**
|
|
1202
1205
|
* Returns the framing behavior of this camera.
|
|
1203
1206
|
*/
|
|
@@ -1233,14 +1236,14 @@ class k extends fe {
|
|
|
1233
1236
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1234
1237
|
const i = this.getFramingBehavior();
|
|
1235
1238
|
i.framingTime = t || 800;
|
|
1236
|
-
const
|
|
1239
|
+
const r = () => {
|
|
1237
1240
|
this.isRunningFramingBehavior = !1;
|
|
1238
|
-
},
|
|
1241
|
+
}, s = E(this._scene), o = s.max.subtract(s.min), a = s.min.add(o.scale(0.5));
|
|
1239
1242
|
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(a), this.panDenominator = o.length(), this.lastFocus.copyFrom(a), i.zoomOnBoundingInfo(
|
|
1240
|
-
|
|
1241
|
-
|
|
1243
|
+
s.min,
|
|
1244
|
+
s.max,
|
|
1242
1245
|
void 0,
|
|
1243
|
-
|
|
1246
|
+
r
|
|
1244
1247
|
), i.framingTime = 0;
|
|
1245
1248
|
}
|
|
1246
1249
|
/**
|
|
@@ -1268,19 +1271,23 @@ class k extends fe {
|
|
|
1268
1271
|
* @param scene The scene to attach the camera to.
|
|
1269
1272
|
* @param configuration A configuration object to define the cameras limitations.
|
|
1270
1273
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1274
|
+
* @param disablePan If true the camera will not allow panning.
|
|
1271
1275
|
*/
|
|
1272
1276
|
static create(e, t, i) {
|
|
1273
|
-
const
|
|
1277
|
+
const r = E(e), s = r.max.subtract(r.min), o = r.min.add(s.scale(0.5)), a = new k(
|
|
1274
1278
|
"ProductCamera",
|
|
1275
1279
|
-(Math.PI / 2),
|
|
1276
1280
|
Math.PI / 2,
|
|
1277
|
-
|
|
1281
|
+
s.length() * 1.5,
|
|
1278
1282
|
o,
|
|
1279
1283
|
e,
|
|
1280
1284
|
t
|
|
1281
1285
|
);
|
|
1282
|
-
return a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator =
|
|
1283
|
-
|
|
1286
|
+
return a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = s.length(), a.onAfterCheckInputsObservable.add(() => {
|
|
1287
|
+
var l;
|
|
1288
|
+
a.setPanEnabled(
|
|
1289
|
+
((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1290
|
+
);
|
|
1284
1291
|
}), i && (e.activeCamera = a), a;
|
|
1285
1292
|
}
|
|
1286
1293
|
}
|
|
@@ -1311,9 +1318,9 @@ class nt {
|
|
|
1311
1318
|
return this.currentConfiguration;
|
|
1312
1319
|
}
|
|
1313
1320
|
setConfiguration(e) {
|
|
1314
|
-
var t, i,
|
|
1321
|
+
var t, i, r, s, o, a, l, c, h, u, m, g, f, z, V, q, N, G, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te, ie;
|
|
1315
1322
|
if (this.renderingPipeline.isSupported) {
|
|
1316
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((
|
|
1323
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((s = e.bloom) == null ? void 0 : s.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new se(
|
|
1317
1324
|
e.chromaticAberration.direction.x,
|
|
1318
1325
|
e.chromaticAberration.direction.y
|
|
1319
1326
|
) : new se(
|
|
@@ -1334,19 +1341,19 @@ class nt {
|
|
|
1334
1341
|
if (this.renderingPipeline.depthOfField.focalLength = ((z = e.depthOfField) == null ? void 0 : z.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((V = e.depthOfField) == null ? void 0 : V.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((q = e.depthOfField) == null ? void 0 : q.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((N = e.depthOfField) == null ? void 0 : N.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((_ = e.grain) == null ? void 0 : _.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((H = e.grain) == null ? void 0 : H.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((U = e.misc) == null ? void 0 : U.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((W = e.misc) == null ? void 0 : W.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1335
1342
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1336
1343
|
case "Standard":
|
|
1337
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1344
|
+
this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_STANDARD;
|
|
1338
1345
|
break;
|
|
1339
1346
|
case "ACES":
|
|
1340
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1347
|
+
this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_ACES;
|
|
1341
1348
|
break;
|
|
1342
1349
|
}
|
|
1343
1350
|
if (this.renderingPipeline.sharpenEnabled = ((Y = e.sharpen) == null ? void 0 : Y.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = (($ = e.vignette) == null ? void 0 : $.enabled) ?? d.vignette.enabled, (j = e.vignette) != null && j.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)
|
|
1344
1351
|
switch (((X = e.vignette) == null ? void 0 : X.blendMode) ?? d.vignette.blendMode) {
|
|
1345
1352
|
case "Multiply":
|
|
1346
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1353
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_MULTIPLY;
|
|
1347
1354
|
break;
|
|
1348
1355
|
case "Opaque":
|
|
1349
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1356
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_OPAQUE;
|
|
1350
1357
|
break;
|
|
1351
1358
|
}
|
|
1352
1359
|
(J = e.vignette) != null && J.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
@@ -1384,12 +1391,12 @@ function L(n) {
|
|
|
1384
1391
|
}
|
|
1385
1392
|
class Wt {
|
|
1386
1393
|
constructor(e) {
|
|
1387
|
-
var
|
|
1394
|
+
var l;
|
|
1388
1395
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1389
1396
|
if (!this.engine.views)
|
|
1390
1397
|
return;
|
|
1391
|
-
this.modelContainers.forEach((
|
|
1392
|
-
|
|
1398
|
+
this.modelContainers.forEach((h) => {
|
|
1399
|
+
h.updateDynamicTextures();
|
|
1393
1400
|
}), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
|
|
1394
1401
|
const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
|
|
1395
1402
|
!this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
|
|
@@ -1397,15 +1404,15 @@ class Wt {
|
|
|
1397
1404
|
const i = (() => {
|
|
1398
1405
|
if (!(e != null && e.noRender))
|
|
1399
1406
|
return this.configuration.createCanvas();
|
|
1400
|
-
})(),
|
|
1407
|
+
})(), r = "1.5.6";
|
|
1401
1408
|
Me.Configuration = {
|
|
1402
1409
|
decoder: {
|
|
1403
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1404
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1405
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1410
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1411
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1412
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1406
1413
|
}
|
|
1407
1414
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1408
|
-
const
|
|
1415
|
+
const s = console.log;
|
|
1409
1416
|
console.log = () => {
|
|
1410
1417
|
};
|
|
1411
1418
|
const o = i ? new be(i, !0, {
|
|
@@ -1417,7 +1424,7 @@ class Wt {
|
|
|
1417
1424
|
stencil: this.configuration.highlights.enabled,
|
|
1418
1425
|
forceSRGBBufferSupportState: !0
|
|
1419
1426
|
}) : new Ce();
|
|
1420
|
-
console.log =
|
|
1427
|
+
console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1421
1428
|
this.scene,
|
|
1422
1429
|
!1,
|
|
1423
1430
|
this.camera
|
|
@@ -1426,7 +1433,7 @@ class Wt {
|
|
|
1426
1433
|
this.configuration.scene.environment.file,
|
|
1427
1434
|
this.scene
|
|
1428
1435
|
);
|
|
1429
|
-
a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (
|
|
1436
|
+
a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1430
1437
|
this.configuration.options.renderingPipelineConfiguration
|
|
1431
1438
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
|
|
1432
1439
|
this.scene,
|
|
@@ -1478,7 +1485,7 @@ class Wt {
|
|
|
1478
1485
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1479
1486
|
}
|
|
1480
1487
|
executeCameraAnimation(e) {
|
|
1481
|
-
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((
|
|
1488
|
+
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((r) => r.getIsInitialized()))
|
|
1482
1489
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1483
1490
|
let t = () => {
|
|
1484
1491
|
};
|
|
@@ -1489,8 +1496,8 @@ class Wt {
|
|
|
1489
1496
|
e
|
|
1490
1497
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1491
1498
|
};
|
|
1492
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1493
|
-
t =
|
|
1499
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
|
|
1500
|
+
t = r;
|
|
1494
1501
|
})) : i();
|
|
1495
1502
|
}
|
|
1496
1503
|
getCameraPose() {
|
|
@@ -1527,13 +1534,13 @@ class Wt {
|
|
|
1527
1534
|
const t = async () => {
|
|
1528
1535
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1529
1536
|
this.focusLostNotified = !1;
|
|
1530
|
-
const
|
|
1531
|
-
const
|
|
1537
|
+
const r = () => {
|
|
1538
|
+
const s = this.configuration;
|
|
1532
1539
|
this.camera.rerunFramingBehavior(() => {
|
|
1533
|
-
|
|
1540
|
+
s.camera.limits.min.radius && (this.camera.lowerRadiusLimit = s.camera.limits.min.radius), s.camera.limits.max.radius && (this.camera.upperRadiusLimit = s.camera.limits.max.radius), i();
|
|
1534
1541
|
});
|
|
1535
1542
|
};
|
|
1536
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1543
|
+
this.scene.onAfterRenderObservable.addOnce(r);
|
|
1537
1544
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1538
1545
|
};
|
|
1539
1546
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1560,9 +1567,9 @@ class Wt {
|
|
|
1560
1567
|
this.scene
|
|
1561
1568
|
);
|
|
1562
1569
|
try {
|
|
1563
|
-
const
|
|
1564
|
-
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha =
|
|
1565
|
-
const o = await
|
|
1570
|
+
const r = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
|
|
1571
|
+
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = s, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1572
|
+
const o = await Pe.CreateScreenshotUsingRenderTargetAsync(
|
|
1566
1573
|
this.engine,
|
|
1567
1574
|
i,
|
|
1568
1575
|
e,
|
|
@@ -1579,31 +1586,31 @@ class Wt {
|
|
|
1579
1586
|
const e = this.configuration;
|
|
1580
1587
|
if (!e)
|
|
1581
1588
|
return !0;
|
|
1582
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1583
|
-
if (t === void 0 || i === void 0 ||
|
|
1589
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
|
|
1590
|
+
if (t === void 0 || i === void 0 || r === void 0 || s === void 0)
|
|
1584
1591
|
return !0;
|
|
1585
|
-
const o = [t, i], a = [
|
|
1586
|
-
return !
|
|
1592
|
+
const o = [t, i], a = [r, s], l = o.every((h) => h === t), c = a.every((h) => h === r);
|
|
1593
|
+
return !l && !c;
|
|
1587
1594
|
}
|
|
1588
1595
|
fireResizeEvent() {
|
|
1589
1596
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1590
1597
|
}
|
|
1591
1598
|
setHighlights(e, t) {
|
|
1592
|
-
var
|
|
1593
|
-
e.length === 0 && ((
|
|
1599
|
+
var r;
|
|
1600
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1594
1601
|
isStroke: !0,
|
|
1595
1602
|
blurVerticalSize: 0.85,
|
|
1596
1603
|
blurHorizontalSize: 0.85
|
|
1597
1604
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1598
1605
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1599
|
-
e.forEach((
|
|
1606
|
+
e.forEach((s) => {
|
|
1600
1607
|
const o = this.scene.materials.find(
|
|
1601
|
-
(a) => a.name ===
|
|
1608
|
+
(a) => a.name === s.name && a.id === s.id
|
|
1602
1609
|
);
|
|
1603
1610
|
o && o.getBindedMeshes().forEach(
|
|
1604
1611
|
(a) => {
|
|
1605
|
-
var
|
|
1606
|
-
return (
|
|
1612
|
+
var l;
|
|
1613
|
+
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1607
1614
|
a,
|
|
1608
1615
|
i || w.FromHexString("#fcba03")
|
|
1609
1616
|
);
|
|
@@ -1628,8 +1635,8 @@ class Wt {
|
|
|
1628
1635
|
this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0);
|
|
1629
1636
|
});
|
|
1630
1637
|
}, 1);
|
|
1631
|
-
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1632
|
-
this.setHighlights([
|
|
1638
|
+
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((r) => {
|
|
1639
|
+
this.setHighlights([r]);
|
|
1633
1640
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1634
1641
|
this.setHighlights([]);
|
|
1635
1642
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1655,7 +1662,7 @@ class Wt {
|
|
|
1655
1662
|
}
|
|
1656
1663
|
unregisterPlugin(e) {
|
|
1657
1664
|
const t = this.plugins.indexOf(e);
|
|
1658
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1665
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1659
1666
|
}
|
|
1660
1667
|
getGlowLayerManager() {
|
|
1661
1668
|
return this.glowLayerManager;
|
|
@@ -1673,30 +1680,32 @@ class Wt {
|
|
|
1673
1680
|
* Flips a transform around the origin.
|
|
1674
1681
|
*/
|
|
1675
1682
|
flipTransform(e, t, i) {
|
|
1676
|
-
const
|
|
1683
|
+
const r = re.Compose(
|
|
1677
1684
|
O(i || { x: 1, y: 1, z: 1 }),
|
|
1678
1685
|
y.FromEulerVector(
|
|
1679
1686
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1680
1687
|
),
|
|
1681
1688
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1682
|
-
),
|
|
1683
|
-
return o.decompose(c,
|
|
1689
|
+
), s = re.RotationAxis(p.Up(), Math.PI), o = r.multiply(s), a = p.Zero(), l = y.Identity(), c = p.Zero();
|
|
1690
|
+
return o.decompose(c, l, a), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1684
1691
|
position: L(a),
|
|
1685
|
-
rotation: L(
|
|
1692
|
+
rotation: L(l.toEulerAngles()),
|
|
1686
1693
|
scale: L(c)
|
|
1687
1694
|
};
|
|
1688
1695
|
}
|
|
1689
1696
|
updatePreviewOptions(e) {
|
|
1690
|
-
var s;
|
|
1697
|
+
var r, s;
|
|
1691
1698
|
const t = new ce(e);
|
|
1692
1699
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1693
1700
|
let i = this.scene.environmentTexture;
|
|
1694
1701
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = ne.CreateFromPrefilteredData(
|
|
1695
1702
|
t.scene.environment.file,
|
|
1696
1703
|
this.scene
|
|
1697
|
-
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (
|
|
1704
|
+
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1698
1705
|
t.options.renderingPipelineConfiguration
|
|
1699
|
-
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.
|
|
1706
|
+
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.setPanEnabled(
|
|
1707
|
+
((s = t.options) == null ? void 0 : s.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1708
|
+
), this.configuration = t;
|
|
1700
1709
|
}
|
|
1701
1710
|
/**
|
|
1702
1711
|
* Given a valid canvas element, will remove any existing input controls
|
|
@@ -1716,7 +1725,7 @@ export {
|
|
|
1716
1725
|
F as MaterialEffectMode,
|
|
1717
1726
|
I as ProductCameraRig,
|
|
1718
1727
|
Ne as REFLECTION_PROBE_RESOLUTION,
|
|
1719
|
-
|
|
1728
|
+
P as RenderingConfiguration,
|
|
1720
1729
|
Wt as SpiffCommerce3DPreviewService,
|
|
1721
1730
|
d as renderingPipelineDefaults
|
|
1722
1731
|
};
|