@spiffcommerce/preview 5.7.8 → 5.7.9-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.esm.js +272 -251
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ArcRotateCamera as fe } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
2
|
import { Engine as be } from "@babylonjs/core/Engines/engine";
|
|
3
3
|
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
-
import { HighlightLayer as
|
|
4
|
+
import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
5
|
import { SceneLoader as S } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
6
|
import { CubeTexture as ne } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as p, Quaternion as
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as p, Quaternion as y, Vector2 as se, Matrix as re } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as Ae } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as C } from "@babylonjs/core/Misc/observable";
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
11
|
+
import { Tools as Me } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as xe } from "@babylonjs/core/scene";
|
|
13
13
|
import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { GLTFLoaderAnimationStartMode as Re } from "@babylonjs/loaders/glTF/glTFFileLoader";
|
|
15
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 Ne } 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 E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
33
33
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
@@ -40,29 +40,29 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
40
40
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
41
41
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
42
42
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
43
|
-
var I = /* @__PURE__ */ ((
|
|
43
|
+
var I = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(I || {}), F = /* @__PURE__ */ ((r) => (r.None = "None", r.RemoveWhenSelected = "RemoveWhenSelected", r.ApplyWhenSelected = "ApplyWhenSelected", r))(F || {});
|
|
44
44
|
const he = /* @__PURE__ */ new Map();
|
|
45
|
-
async function D(
|
|
46
|
-
const i = await he.get(
|
|
45
|
+
async function D(r, e, t) {
|
|
46
|
+
const i = await he.get(r);
|
|
47
47
|
if (i && i.scene.uid === e.uid)
|
|
48
48
|
return i;
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
const n = S.LoadAssetContainerAsync(
|
|
50
|
+
r,
|
|
51
51
|
void 0,
|
|
52
52
|
e,
|
|
53
53
|
t
|
|
54
54
|
);
|
|
55
|
-
return he.set(
|
|
55
|
+
return he.set(r, n), n;
|
|
56
56
|
}
|
|
57
|
-
S.OnPluginActivatedObservable.add((
|
|
58
|
-
|
|
57
|
+
S.OnPluginActivatedObservable.add((r) => {
|
|
58
|
+
r.name === "gltf" && (r.animationStartMode = Re.NONE);
|
|
59
59
|
});
|
|
60
60
|
class ce {
|
|
61
61
|
constructor(e) {
|
|
62
62
|
this.getSceneClearColor = () => {
|
|
63
|
-
var i,
|
|
64
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
65
|
-
if (this.customOptions && ((
|
|
63
|
+
var i, n, s, o;
|
|
64
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (n = this.customOptions) != null && n.backgroundImage ? 0 : 1;
|
|
65
|
+
if (this.customOptions && ((s = this.customOptions) != null && s.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
66
66
|
return new b(0, 0, 0, t).toLinearSpace();
|
|
67
67
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
68
68
|
const a = w.FromHexString(
|
|
@@ -77,11 +77,11 @@ class ce {
|
|
|
77
77
|
}
|
|
78
78
|
return new b(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
79
79
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new b(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
80
|
-
const
|
|
80
|
+
const n = w.FromHexString(t);
|
|
81
81
|
return new b(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
n.r,
|
|
83
|
+
n.g,
|
|
84
|
+
n.b,
|
|
85
85
|
i
|
|
86
86
|
).toLinearSpace();
|
|
87
87
|
}, this.customOptions = e;
|
|
@@ -97,14 +97,14 @@ class ce {
|
|
|
97
97
|
* Configuration related to the scene
|
|
98
98
|
*/
|
|
99
99
|
get scene() {
|
|
100
|
-
var e, t, i,
|
|
100
|
+
var e, t, i, n, s;
|
|
101
101
|
return {
|
|
102
102
|
clearColor: this.getSceneClearColor(),
|
|
103
103
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
104
104
|
environment: {
|
|
105
105
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
106
|
-
intensity: ((
|
|
107
|
-
rotationY: (((
|
|
106
|
+
intensity: ((n = this.customOptions) == null ? void 0 : n.environmentIntensity) ?? 1,
|
|
107
|
+
rotationY: (((s = this.customOptions) == null ? void 0 : s.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
108
108
|
// Convert to radians
|
|
109
109
|
}
|
|
110
110
|
};
|
|
@@ -113,7 +113,7 @@ class ce {
|
|
|
113
113
|
* Configuration related to the camera used to view and interact with the scene.
|
|
114
114
|
*/
|
|
115
115
|
get camera() {
|
|
116
|
-
var e, t, i,
|
|
116
|
+
var e, t, i, n, s, o, a, h, l, c, m, u, g;
|
|
117
117
|
return {
|
|
118
118
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
119
119
|
autoRotation: {
|
|
@@ -122,7 +122,7 @@ class ce {
|
|
|
122
122
|
},
|
|
123
123
|
limits: {
|
|
124
124
|
min: {
|
|
125
|
-
alpha: (
|
|
125
|
+
alpha: (n = this.customOptions) != null && n.lowerAlphaLimitDeg ? ((s = this.customOptions) == null ? void 0 : s.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
126
126
|
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
127
127
|
radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
|
|
128
128
|
},
|
|
@@ -146,10 +146,10 @@ class ce {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
get lighting() {
|
|
149
|
-
var e, t, i,
|
|
149
|
+
var e, t, i, n;
|
|
150
150
|
return {
|
|
151
151
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
152
|
-
contrast: ((
|
|
152
|
+
contrast: ((n = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : n.contrast) ?? 1.6
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
get emissiveGlowIntensity() {
|
|
@@ -157,12 +157,12 @@ class ce {
|
|
|
157
157
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
class
|
|
160
|
+
class M {
|
|
161
161
|
/**
|
|
162
162
|
* Returns the resolution expected for generated textures.
|
|
163
163
|
*/
|
|
164
164
|
static getDynamicTextureResolution() {
|
|
165
|
-
return this.getIsMobile() || !
|
|
165
|
+
return this.getIsMobile() || !M.offscreenRenderingSupported() ? {
|
|
166
166
|
width: 1024,
|
|
167
167
|
height: 1024
|
|
168
168
|
} : {
|
|
@@ -270,11 +270,11 @@ class _e {
|
|
|
270
270
|
return this.loader.loadNodeAsync(
|
|
271
271
|
e,
|
|
272
272
|
t,
|
|
273
|
-
function(
|
|
274
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
275
|
-
const o = t.extras[
|
|
276
|
-
|
|
277
|
-
}), i(
|
|
273
|
+
function(n) {
|
|
274
|
+
t.extras && Object.keys(t.extras).forEach((s) => {
|
|
275
|
+
const o = t.extras[s];
|
|
276
|
+
n.metadata[s] = o;
|
|
277
|
+
}), i(n);
|
|
278
278
|
}
|
|
279
279
|
);
|
|
280
280
|
}
|
|
@@ -332,51 +332,51 @@ class _e {
|
|
|
332
332
|
* @param scene The scene to parse.
|
|
333
333
|
*/
|
|
334
334
|
applyReflections(e) {
|
|
335
|
-
function t(
|
|
335
|
+
function t(s) {
|
|
336
336
|
const o = [];
|
|
337
|
-
return
|
|
337
|
+
return s.transformNodes.forEach((a) => {
|
|
338
338
|
a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
|
|
339
|
-
}),
|
|
339
|
+
}), s.meshes.forEach((a) => {
|
|
340
340
|
a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
|
|
341
341
|
}), o;
|
|
342
342
|
}
|
|
343
|
-
function i(
|
|
344
|
-
const a =
|
|
343
|
+
function i(s, o = 1) {
|
|
344
|
+
const a = s.material;
|
|
345
345
|
if (!a)
|
|
346
346
|
return;
|
|
347
347
|
const h = new Ee(
|
|
348
348
|
"mirror",
|
|
349
|
-
|
|
349
|
+
M.getMirrorTextureResolution(),
|
|
350
350
|
e,
|
|
351
351
|
!0
|
|
352
352
|
);
|
|
353
353
|
h.renderList = t(e);
|
|
354
|
-
const l =
|
|
354
|
+
const l = s.getVerticesData("normal");
|
|
355
355
|
if (!l)
|
|
356
356
|
throw new Error(
|
|
357
|
-
"Mirror attribute specified on: " +
|
|
357
|
+
"Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
|
|
358
358
|
);
|
|
359
|
-
|
|
360
|
-
const c =
|
|
359
|
+
s.computeWorldMatrix(!0);
|
|
360
|
+
const c = s.getWorldMatrix(), m = ae.TransformNormal(
|
|
361
361
|
new ae(l[0], l[1], l[2]),
|
|
362
362
|
c
|
|
363
363
|
).normalize(), u = Oe.FromPositionAndNormal(
|
|
364
|
-
|
|
364
|
+
s.position,
|
|
365
365
|
m.scale(-1)
|
|
366
366
|
);
|
|
367
367
|
h.mirrorPlane = u, h.level = o, a.reflectionTexture = h;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
const o =
|
|
369
|
+
function n(s) {
|
|
370
|
+
const o = s.material, a = new Le(
|
|
371
371
|
"probe-" + o.name,
|
|
372
372
|
Ve,
|
|
373
373
|
e
|
|
374
374
|
);
|
|
375
|
-
a.attachToMesh(
|
|
375
|
+
a.attachToMesh(s), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
|
|
376
376
|
}
|
|
377
|
-
e.meshes.forEach((
|
|
378
|
-
const o =
|
|
379
|
-
o && (o.mirrorTexture && i(
|
|
377
|
+
e.meshes.forEach((s) => {
|
|
378
|
+
const o = s.metadata;
|
|
379
|
+
o && (o.mirrorTexture && i(s, o.mirrorTexture), o.reflectionProbe && n(s));
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
382
|
}
|
|
@@ -402,68 +402,89 @@ class Ge {
|
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function He(
|
|
406
|
-
t.forEach((
|
|
407
|
-
const o =
|
|
408
|
-
|
|
405
|
+
function He(r, e, t, i, n = "") {
|
|
406
|
+
t.forEach((s) => {
|
|
407
|
+
const o = s.getID(), a = s.getName(), h = M.getDynamicTextureResolution();
|
|
408
|
+
r.filter((c) => c.name === n + a).forEach((c) => {
|
|
409
409
|
const m = i.get(o), u = !1;
|
|
410
410
|
if (m)
|
|
411
411
|
de(c, m), m.update(u);
|
|
412
412
|
else {
|
|
413
|
-
const g =
|
|
413
|
+
const g = Ke(
|
|
414
414
|
a,
|
|
415
415
|
e,
|
|
416
416
|
h.width,
|
|
417
417
|
h.height
|
|
418
418
|
);
|
|
419
|
-
i.set(o, g),
|
|
419
|
+
i.set(o, g), s.setStaticContext(
|
|
420
420
|
g.getContext()
|
|
421
421
|
), de(c, g), g.onLoadObservable.addOnce(() => {
|
|
422
422
|
g.update(u);
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
|
-
});
|
|
426
|
+
}), Ue(e);
|
|
427
427
|
}
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
428
|
+
const Ue = (r) => {
|
|
429
|
+
const e = () => r.textures.reduce((i, n) => {
|
|
430
|
+
var o;
|
|
431
|
+
return !r.meshes.some(
|
|
432
|
+
(a) => a.material && a.material.hasTexture(n)
|
|
433
|
+
) && !((o = n == null ? void 0 : n.url) != null && o.includes("data:")) && i.push(n), i;
|
|
434
|
+
}, []), t = () => r.materials.reduce((i, n) => (n.getBindedMeshes().length == 0 && i.push(n), i), []);
|
|
435
|
+
e().forEach((i) => {
|
|
436
|
+
try {
|
|
437
|
+
i.dispose();
|
|
438
|
+
} catch {
|
|
439
|
+
console.log(`Failed to dispose texture ${i.name}`);
|
|
440
|
+
}
|
|
441
|
+
}), t().forEach((i) => {
|
|
442
|
+
try {
|
|
443
|
+
i.dispose(!0, !0);
|
|
444
|
+
} catch {
|
|
445
|
+
console.log(`Failed to dispose material ${i.name}`);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
function Ke(r, e, t, i) {
|
|
450
|
+
const n = new Be(
|
|
451
|
+
r,
|
|
431
452
|
{ width: t, height: i },
|
|
432
453
|
e,
|
|
433
|
-
|
|
454
|
+
M.shouldMipMap(),
|
|
434
455
|
De.TRILINEAR_SAMPLINGMODE,
|
|
435
456
|
be.TEXTUREFORMAT_RGBA
|
|
436
|
-
),
|
|
437
|
-
return
|
|
457
|
+
), s = n.getContext();
|
|
458
|
+
return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), n.update()), n;
|
|
438
459
|
}
|
|
439
|
-
function de(
|
|
440
|
-
if (
|
|
441
|
-
const t =
|
|
460
|
+
function de(r, e) {
|
|
461
|
+
if (r instanceof B) {
|
|
462
|
+
const t = r, i = t.albedoTexture;
|
|
442
463
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
443
464
|
} else {
|
|
444
|
-
const t =
|
|
465
|
+
const t = r, i = t.diffuseTexture;
|
|
445
466
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
446
467
|
}
|
|
447
468
|
}
|
|
448
|
-
function
|
|
449
|
-
const
|
|
450
|
-
return
|
|
469
|
+
function We() {
|
|
470
|
+
const r = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
471
|
+
return r() + r() + "-" + r() + "-" + r() + "-" + r() + "-" + r() + r() + r();
|
|
451
472
|
}
|
|
452
|
-
const
|
|
453
|
-
function me(
|
|
454
|
-
return
|
|
473
|
+
const A = 60, ue = 1;
|
|
474
|
+
function me(r) {
|
|
475
|
+
return r.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / r.targetedAnimations.length || 0;
|
|
455
476
|
}
|
|
456
|
-
function ve(
|
|
457
|
-
const o =
|
|
477
|
+
function ve(r, e, t, i, n, s) {
|
|
478
|
+
const o = n ? r.filter((c) => c.name === n) : r;
|
|
458
479
|
if (o.length === 0) {
|
|
459
|
-
console.warn(`No animations found for name: ${
|
|
480
|
+
console.warn(`No animations found for name: ${n}`);
|
|
460
481
|
return;
|
|
461
482
|
}
|
|
462
483
|
let a = 0;
|
|
463
484
|
const h = () => {
|
|
464
|
-
a++, a === o.length &&
|
|
485
|
+
a++, a === o.length && s && s();
|
|
465
486
|
}, l = (c, m, u, g, f) => {
|
|
466
|
-
c.stop(), c.start(m, u, g, f),
|
|
487
|
+
c.stop(), c.start(m, u, g, f), s && (m == !1 || m === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
|
|
467
488
|
h();
|
|
468
489
|
}) : c.onAnimationLoopObservable.addOnce(() => {
|
|
469
490
|
h();
|
|
@@ -481,11 +502,11 @@ function ve(s, e, t, i, r, n) {
|
|
|
481
502
|
l(c, e, ue, u, g);
|
|
482
503
|
});
|
|
483
504
|
}
|
|
484
|
-
function
|
|
505
|
+
function Ye(r, e, t) {
|
|
485
506
|
return new Promise((i) => {
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
if (t.target && Object.keys(t.target).length > 0 &&
|
|
507
|
+
r.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
|
|
508
|
+
const n = [], s = t.target, o = 0, a = s ? 1 : 0;
|
|
509
|
+
if (t.target && Object.keys(t.target).length > 0 && n.push(
|
|
489
510
|
P(
|
|
490
511
|
"cameraTargetLerp",
|
|
491
512
|
"target",
|
|
@@ -498,7 +519,7 @@ function We(s, e, t) {
|
|
|
498
519
|
v.ANIMATIONTYPE_VECTOR3,
|
|
499
520
|
o
|
|
500
521
|
)
|
|
501
|
-
),
|
|
522
|
+
), n.push(
|
|
502
523
|
P(
|
|
503
524
|
"cameraAlphaLerp",
|
|
504
525
|
"alpha",
|
|
@@ -507,7 +528,7 @@ function We(s, e, t) {
|
|
|
507
528
|
v.ANIMATIONTYPE_FLOAT,
|
|
508
529
|
a
|
|
509
530
|
)
|
|
510
|
-
),
|
|
531
|
+
), n.push(
|
|
511
532
|
P(
|
|
512
533
|
"cameraBetaLerp",
|
|
513
534
|
"beta",
|
|
@@ -518,7 +539,7 @@ function We(s, e, t) {
|
|
|
518
539
|
)
|
|
519
540
|
), t.radius !== void 0) {
|
|
520
541
|
const c = Math.max(0.01, t.radius);
|
|
521
|
-
|
|
542
|
+
n.push(
|
|
522
543
|
P(
|
|
523
544
|
"cameraRadiusLerp",
|
|
524
545
|
"radius",
|
|
@@ -529,12 +550,12 @@ function We(s, e, t) {
|
|
|
529
550
|
)
|
|
530
551
|
);
|
|
531
552
|
}
|
|
532
|
-
e.animations.push(...
|
|
553
|
+
e.animations.push(...n);
|
|
533
554
|
const l = e.useAutoRotationBehavior;
|
|
534
|
-
e.disableAutoRotationBehavior(),
|
|
555
|
+
e.disableAutoRotationBehavior(), r.beginAnimation(
|
|
535
556
|
e,
|
|
536
557
|
0,
|
|
537
|
-
|
|
558
|
+
s ? A * 2 : A,
|
|
538
559
|
!1,
|
|
539
560
|
1,
|
|
540
561
|
() => {
|
|
@@ -543,29 +564,29 @@ function We(s, e, t) {
|
|
|
543
564
|
);
|
|
544
565
|
});
|
|
545
566
|
}
|
|
546
|
-
function ge(
|
|
547
|
-
return
|
|
567
|
+
function ge(r) {
|
|
568
|
+
return r * Math.PI / 180;
|
|
548
569
|
}
|
|
549
|
-
function P(
|
|
570
|
+
function P(r, e, t, i, n, s = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
550
571
|
const a = new ke();
|
|
551
572
|
a.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
552
573
|
const h = new v(
|
|
553
|
-
s,
|
|
554
|
-
e,
|
|
555
|
-
y,
|
|
556
574
|
r,
|
|
575
|
+
e,
|
|
576
|
+
A,
|
|
577
|
+
n,
|
|
557
578
|
o
|
|
558
579
|
), l = [];
|
|
559
|
-
return
|
|
560
|
-
frame:
|
|
580
|
+
return s > 0 && l.push({ frame: 0, value: t }), l.push({ frame: A * s, value: t }), l.push({
|
|
581
|
+
frame: A * (s + 1),
|
|
561
582
|
value: i
|
|
562
583
|
}), h.setKeys(l), h.setEasingFunction(a), h;
|
|
563
584
|
}
|
|
564
|
-
function
|
|
565
|
-
return
|
|
585
|
+
function Qe(r, e, t) {
|
|
586
|
+
return r < e ? r = t - (e - r) % (t - e) : r = e + (r - e) % (t - e);
|
|
566
587
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
588
|
+
function $e(r, e, t) {
|
|
589
|
+
r.forEach((i) => {
|
|
569
590
|
t && i.name !== t || i.goToFrame(e);
|
|
570
591
|
});
|
|
571
592
|
}
|
|
@@ -579,7 +600,7 @@ const Ze = {
|
|
|
579
600
|
refractionTexture: "refractionMap",
|
|
580
601
|
reflectionTexture: "reflectionMap"
|
|
581
602
|
};
|
|
582
|
-
function
|
|
603
|
+
function je(r, e, t, i) {
|
|
583
604
|
[
|
|
584
605
|
"albedoTexture",
|
|
585
606
|
"bumpTexture",
|
|
@@ -589,51 +610,51 @@ function $e(s, e, t, i) {
|
|
|
589
610
|
"metallicTexture",
|
|
590
611
|
"refractionTexture",
|
|
591
612
|
"reflectionTexture"
|
|
592
|
-
].forEach((
|
|
593
|
-
|
|
594
|
-
n,
|
|
613
|
+
].forEach((s) => {
|
|
614
|
+
Xe(
|
|
595
615
|
s,
|
|
616
|
+
r,
|
|
596
617
|
e,
|
|
597
618
|
t,
|
|
598
619
|
i
|
|
599
620
|
);
|
|
600
|
-
}),
|
|
621
|
+
}), tt(r, e);
|
|
601
622
|
}
|
|
602
|
-
function
|
|
603
|
-
const
|
|
604
|
-
if (!
|
|
623
|
+
function Xe(r, e, t, i, n) {
|
|
624
|
+
const s = Ze[r];
|
|
625
|
+
if (!s)
|
|
605
626
|
throw new Error("Unexpected texture name encountered.");
|
|
606
|
-
const o = e[
|
|
607
|
-
a ?
|
|
608
|
-
|
|
627
|
+
const o = e[s], a = o == null ? void 0 : o.fileLink;
|
|
628
|
+
a ? r === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
|
|
629
|
+
r,
|
|
609
630
|
a,
|
|
610
631
|
void 0,
|
|
611
632
|
!1,
|
|
612
633
|
void 0,
|
|
613
634
|
!0
|
|
614
635
|
) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
615
|
-
|
|
636
|
+
r,
|
|
616
637
|
a,
|
|
617
638
|
128,
|
|
618
639
|
!1,
|
|
619
640
|
!0,
|
|
620
641
|
!1
|
|
621
|
-
) : i.addTextureTask(
|
|
642
|
+
) : i.addTextureTask(r, a, !1, !1) : i.addTextureTask(r, a, !1, !1) : n && t[r] && (t[r] && t[r].dispose(), t[r] = null, Je(r, t));
|
|
622
643
|
}
|
|
623
|
-
function
|
|
624
|
-
|
|
644
|
+
function Je(r, e) {
|
|
645
|
+
r === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), r === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), r === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), r === "reflectionTexture" && (e.environmentIntensity = 1), r === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0), e.reflectionTexture);
|
|
625
646
|
}
|
|
626
|
-
function
|
|
647
|
+
function et(r, e, t, i) {
|
|
627
648
|
if (!e) {
|
|
628
649
|
console.error("Failed to apply texture to material: material is null.");
|
|
629
650
|
return;
|
|
630
651
|
}
|
|
631
|
-
|
|
652
|
+
r === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), r === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), r === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), r === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[r] = i, r === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
632
653
|
}
|
|
633
|
-
function
|
|
634
|
-
|
|
654
|
+
function tt(r, e) {
|
|
655
|
+
r.clearCoat && (r.clearCoat === F.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : r.clearCoat === F.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = r.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
635
656
|
}
|
|
636
|
-
class
|
|
657
|
+
class it {
|
|
637
658
|
constructor(e, t, i) {
|
|
638
659
|
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;
|
|
639
660
|
}
|
|
@@ -646,8 +667,8 @@ class tt {
|
|
|
646
667
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
647
668
|
* where we want to undo changes are remove effects from display.
|
|
648
669
|
*/
|
|
649
|
-
async applyMaterial(e, t, i,
|
|
650
|
-
return new Promise((
|
|
670
|
+
async applyMaterial(e, t, i, n) {
|
|
671
|
+
return new Promise((s) => {
|
|
651
672
|
const o = this.materialVariantMap.get(e);
|
|
652
673
|
this.materialVariantMap.set(e, {
|
|
653
674
|
...o,
|
|
@@ -657,16 +678,16 @@ class tt {
|
|
|
657
678
|
(c) => c.name === a
|
|
658
679
|
);
|
|
659
680
|
if (h.length === 0) {
|
|
660
|
-
|
|
681
|
+
s();
|
|
661
682
|
return;
|
|
662
683
|
}
|
|
663
684
|
const l = new Ne(this.scene);
|
|
664
685
|
l.useDefaultLoadingScreen = !1, h.forEach(
|
|
665
|
-
(c) =>
|
|
686
|
+
(c) => je(
|
|
666
687
|
t,
|
|
667
688
|
c,
|
|
668
689
|
l,
|
|
669
|
-
|
|
690
|
+
n
|
|
670
691
|
)
|
|
671
692
|
), l.onProgress = (c, m, u) => {
|
|
672
693
|
i && i(c / m * 100, 100, u.name);
|
|
@@ -676,14 +697,14 @@ class tt {
|
|
|
676
697
|
i && i(100, 100, m.name), this.scene.materials.filter(
|
|
677
698
|
(f) => f.name === a
|
|
678
699
|
).forEach(
|
|
679
|
-
(f) =>
|
|
700
|
+
(f) => et(
|
|
680
701
|
m.name,
|
|
681
702
|
f,
|
|
682
703
|
t,
|
|
683
704
|
u.texture
|
|
684
705
|
)
|
|
685
706
|
);
|
|
686
|
-
}),
|
|
707
|
+
}), s();
|
|
687
708
|
}, l.loadAsync();
|
|
688
709
|
});
|
|
689
710
|
}
|
|
@@ -697,27 +718,27 @@ class tt {
|
|
|
697
718
|
* @param getCurrentFrame A function that returns the current frame of the animation.
|
|
698
719
|
* @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
|
|
699
720
|
*/
|
|
700
|
-
async applyModel(e, t, i,
|
|
721
|
+
async applyModel(e, t, i, n, s, o, a) {
|
|
701
722
|
var m;
|
|
702
723
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
703
724
|
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (m = this.loadedContainerForKey.get(e)) == null || m.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
704
725
|
(u) => u !== e
|
|
705
726
|
), Promise.resolve(void 0);
|
|
706
|
-
const l = (await D(i, this.scene,
|
|
727
|
+
const l = (await D(i, this.scene, n)).instantiateModelsToScene(
|
|
707
728
|
this.renameClonedAsset,
|
|
708
729
|
!0
|
|
709
730
|
);
|
|
710
|
-
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)),
|
|
711
|
-
const u = o && o(), g =
|
|
731
|
+
if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), s) {
|
|
732
|
+
const u = o && o(), g = s.name ? this.renameClonedAsset(s.name) : void 0;
|
|
712
733
|
if (ve(
|
|
713
734
|
l.animationGroups,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
735
|
+
s.loop,
|
|
736
|
+
s.to,
|
|
737
|
+
s.from,
|
|
717
738
|
g
|
|
718
739
|
), u != null) {
|
|
719
740
|
const f = a && a() || !0;
|
|
720
|
-
|
|
741
|
+
$e(
|
|
721
742
|
l.animationGroups,
|
|
722
743
|
u + (f ? 2 : 0),
|
|
723
744
|
g
|
|
@@ -750,36 +771,36 @@ class tt {
|
|
|
750
771
|
}), e;
|
|
751
772
|
}
|
|
752
773
|
}
|
|
753
|
-
function we(
|
|
774
|
+
function we(r) {
|
|
754
775
|
const e = [];
|
|
755
|
-
return
|
|
776
|
+
return r.rootNodes.forEach((t) => {
|
|
756
777
|
t.getChildMeshes().forEach((i) => {
|
|
757
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
758
|
-
const
|
|
759
|
-
|
|
778
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((n) => {
|
|
779
|
+
const s = n.getMaterial(!1);
|
|
780
|
+
s && !e.includes(s) && e.push(s);
|
|
760
781
|
});
|
|
761
782
|
});
|
|
762
783
|
}), e;
|
|
763
784
|
}
|
|
764
|
-
function pe(
|
|
765
|
-
return
|
|
785
|
+
function pe(r, e = "") {
|
|
786
|
+
return r.map((t) => ({
|
|
766
787
|
name: t.name.substring(e.length),
|
|
767
788
|
loop: t.loopAnimation,
|
|
768
789
|
to: t.to,
|
|
769
790
|
from: t.from
|
|
770
791
|
}));
|
|
771
792
|
}
|
|
772
|
-
class
|
|
793
|
+
class nt {
|
|
773
794
|
constructor(e) {
|
|
774
795
|
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new C(), this.materialDeselectedObservable = new C(), this.materialVariantObservable = new C(), this.modelVariantObservable = new C(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
|
|
775
796
|
const {
|
|
776
797
|
enablePicking: t,
|
|
777
798
|
modelDetails: i,
|
|
778
|
-
previewService:
|
|
779
|
-
progressHandler:
|
|
799
|
+
previewService: n,
|
|
800
|
+
progressHandler: s,
|
|
780
801
|
scene: o
|
|
781
802
|
} = e;
|
|
782
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
803
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = n, this.scene = o, this.variantManager = new it(
|
|
783
804
|
o,
|
|
784
805
|
this.renameClonedAsset.bind(this),
|
|
785
806
|
this.setBaseModelEnabled.bind(this)
|
|
@@ -792,13 +813,13 @@ class it {
|
|
|
792
813
|
return this.assetContainer = await D(
|
|
793
814
|
i.model,
|
|
794
815
|
o,
|
|
795
|
-
|
|
816
|
+
s
|
|
796
817
|
), await this.instantiate(), this;
|
|
797
818
|
};
|
|
798
819
|
this.importPromise = a();
|
|
799
820
|
}
|
|
800
821
|
//#region Interface implementation
|
|
801
|
-
async applyMaterialVariant(e, t, i,
|
|
822
|
+
async applyMaterialVariant(e, t, i, n) {
|
|
802
823
|
if (!this.initialized) {
|
|
803
824
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
804
825
|
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -809,7 +830,7 @@ class it {
|
|
|
809
830
|
e,
|
|
810
831
|
t,
|
|
811
832
|
i,
|
|
812
|
-
|
|
833
|
+
n
|
|
813
834
|
)
|
|
814
835
|
);
|
|
815
836
|
} else {
|
|
@@ -825,13 +846,13 @@ class it {
|
|
|
825
846
|
e,
|
|
826
847
|
t,
|
|
827
848
|
i,
|
|
828
|
-
|
|
849
|
+
n
|
|
829
850
|
)
|
|
830
851
|
);
|
|
831
852
|
}
|
|
832
853
|
return;
|
|
833
854
|
}
|
|
834
|
-
const
|
|
855
|
+
const s = async () => {
|
|
835
856
|
await this.variantManager.applyMaterial(
|
|
836
857
|
e,
|
|
837
858
|
i,
|
|
@@ -842,24 +863,24 @@ class it {
|
|
|
842
863
|
taskName: h
|
|
843
864
|
});
|
|
844
865
|
},
|
|
845
|
-
|
|
866
|
+
n
|
|
846
867
|
);
|
|
847
868
|
};
|
|
848
869
|
if (this.materialChangesInProgress.includes(e)) {
|
|
849
870
|
if (this.queuedMaterialChanges.has(e)) {
|
|
850
871
|
const o = this.queuedMaterialChanges.get(e);
|
|
851
|
-
o == null || o.set(t,
|
|
872
|
+
o == null || o.set(t, s);
|
|
852
873
|
} else {
|
|
853
874
|
this.queuedMaterialChanges.set(
|
|
854
875
|
e,
|
|
855
876
|
/* @__PURE__ */ new Map()
|
|
856
877
|
);
|
|
857
878
|
const o = this.queuedMaterialChanges.get(e);
|
|
858
|
-
o == null || o.set(t,
|
|
879
|
+
o == null || o.set(t, s);
|
|
859
880
|
}
|
|
860
881
|
return;
|
|
861
882
|
}
|
|
862
|
-
if (this.materialChangesInProgress.push(e), await
|
|
883
|
+
if (this.materialChangesInProgress.push(e), await s(), this.queuedMaterialChanges.has(e)) {
|
|
863
884
|
const o = this.queuedMaterialChanges.get(e);
|
|
864
885
|
if (!o)
|
|
865
886
|
throw new Error("Target material is undefined");
|
|
@@ -885,7 +906,7 @@ class it {
|
|
|
885
906
|
);
|
|
886
907
|
return;
|
|
887
908
|
}
|
|
888
|
-
const
|
|
909
|
+
const n = () => this.variantManager.applyModel(
|
|
889
910
|
e,
|
|
890
911
|
i,
|
|
891
912
|
t == null ? void 0 : t.model,
|
|
@@ -900,12 +921,12 @@ class it {
|
|
|
900
921
|
this.getAnimationIsPlaying.bind(this)
|
|
901
922
|
);
|
|
902
923
|
if (this.modelChangesInProgress.includes(e)) {
|
|
903
|
-
this.queuedModelChanges.set(e,
|
|
924
|
+
this.queuedModelChanges.set(e, n);
|
|
904
925
|
return;
|
|
905
926
|
}
|
|
906
927
|
const o = await (async () => {
|
|
907
928
|
this.modelChangesInProgress.push(e);
|
|
908
|
-
let a = await
|
|
929
|
+
let a = await n();
|
|
909
930
|
if (this.queuedModelChanges.has(e)) {
|
|
910
931
|
const h = this.queuedModelChanges.get(e);
|
|
911
932
|
if (!h)
|
|
@@ -929,24 +950,24 @@ class it {
|
|
|
929
950
|
let t = () => {
|
|
930
951
|
};
|
|
931
952
|
const i = async () => {
|
|
932
|
-
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((
|
|
953
|
+
this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((n) => {
|
|
933
954
|
var o;
|
|
934
|
-
const
|
|
955
|
+
const s = [
|
|
935
956
|
...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
|
|
936
957
|
...this.variantManager.getAnimationGroups()
|
|
937
958
|
];
|
|
938
959
|
ve(
|
|
939
|
-
|
|
960
|
+
s,
|
|
940
961
|
e.loop,
|
|
941
962
|
e.to,
|
|
942
963
|
e.from,
|
|
943
964
|
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
944
|
-
|
|
965
|
+
n
|
|
945
966
|
);
|
|
946
967
|
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
947
968
|
};
|
|
948
|
-
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((
|
|
949
|
-
t =
|
|
969
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((n) => {
|
|
970
|
+
t = n;
|
|
950
971
|
})) : i();
|
|
951
972
|
}
|
|
952
973
|
getAnimations(e) {
|
|
@@ -956,7 +977,7 @@ class it {
|
|
|
956
977
|
this.variantManager.getAnimationGroups(),
|
|
957
978
|
this.renameClonedAsset("")
|
|
958
979
|
) : []
|
|
959
|
-
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i,
|
|
980
|
+
].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, n) => n.indexOf(n.find((s) => s.name === t.name)) == i);
|
|
960
981
|
}
|
|
961
982
|
getId() {
|
|
962
983
|
return this.id;
|
|
@@ -1002,7 +1023,7 @@ class it {
|
|
|
1002
1023
|
set rotation(e) {
|
|
1003
1024
|
if (!this.transformRoot)
|
|
1004
1025
|
throw new Error("ModelContainer disposed prior to setting rotation!");
|
|
1005
|
-
this.transformRoot.rotationQuaternion =
|
|
1026
|
+
this.transformRoot.rotationQuaternion = y.FromEulerAngles(
|
|
1006
1027
|
e.x,
|
|
1007
1028
|
e.y,
|
|
1008
1029
|
e.z
|
|
@@ -1024,8 +1045,8 @@ class it {
|
|
|
1024
1045
|
e.rootNodes.forEach((t) => {
|
|
1025
1046
|
t.getChildMeshes(!1).forEach((i) => {
|
|
1026
1047
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
|
|
1027
|
-
new oe(R.OnPointerOverTrigger, (
|
|
1028
|
-
|
|
1048
|
+
new oe(R.OnPointerOverTrigger, (n) => {
|
|
1049
|
+
n.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
1029
1050
|
id: i.material.id,
|
|
1030
1051
|
name: this.stripIdFromName(i.material.name)
|
|
1031
1052
|
});
|
|
@@ -1064,19 +1085,19 @@ class it {
|
|
|
1064
1085
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1065
1086
|
}
|
|
1066
1087
|
configureModelInstance(e) {
|
|
1067
|
-
var
|
|
1088
|
+
var s;
|
|
1068
1089
|
if (!this.transformRoot)
|
|
1069
1090
|
throw new Error(
|
|
1070
1091
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1071
1092
|
);
|
|
1072
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1073
|
-
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion =
|
|
1093
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, n = this.transformRoot.scaling;
|
|
1094
|
+
this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
|
|
1074
1095
|
for (const o of e.rootNodes) {
|
|
1075
1096
|
o.parent = this.transformRoot;
|
|
1076
1097
|
for (const a of o.getChildMeshes(!1))
|
|
1077
1098
|
a.alwaysSelectAsActiveMesh = !0;
|
|
1078
1099
|
}
|
|
1079
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1100
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = n, this.canvasPanels = ((s = this.contextService) == null ? void 0 : s.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1080
1101
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1081
1102
|
this.scene,
|
|
1082
1103
|
this.canvasPanels,
|
|
@@ -1120,8 +1141,8 @@ class it {
|
|
|
1120
1141
|
var e;
|
|
1121
1142
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1122
1143
|
(t, i) => {
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1144
|
+
const n = this.dynamicTextures.get(i);
|
|
1145
|
+
n && t.getStaticContextDirty() && n.isReady() && (n.update(!1), t.setStaticContextDirty(!1));
|
|
1125
1146
|
}
|
|
1126
1147
|
);
|
|
1127
1148
|
}
|
|
@@ -1180,13 +1201,13 @@ class it {
|
|
|
1180
1201
|
//#endregion
|
|
1181
1202
|
}
|
|
1182
1203
|
class k extends fe {
|
|
1183
|
-
constructor(e, t, i,
|
|
1204
|
+
constructor(e, t, i, n, s, o, a, h) {
|
|
1184
1205
|
super(
|
|
1185
1206
|
e,
|
|
1186
1207
|
t,
|
|
1187
1208
|
i,
|
|
1188
|
-
r,
|
|
1189
1209
|
n,
|
|
1210
|
+
s,
|
|
1190
1211
|
o,
|
|
1191
1212
|
h
|
|
1192
1213
|
), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, a.camera.autoOrientation && (this.alpha += Math.PI), a && (a.camera.limits.min.beta && (this.lowerBetaLimit = a.camera.limits.min.beta), a.camera.limits.max.beta && (this.upperBetaLimit = a.camera.limits.max.beta), a.camera.limits.min.alpha && (this.lowerAlphaLimit = a.camera.limits.min.alpha), a.camera.limits.max.alpha && (this.upperAlphaLimit = a.camera.limits.max.alpha), a.camera.limits.min.radius && (this.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.upperRadiusLimit = a.camera.limits.max.radius), a.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
@@ -1242,14 +1263,14 @@ class k extends fe {
|
|
|
1242
1263
|
this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
|
|
1243
1264
|
const i = this.getFramingBehavior();
|
|
1244
1265
|
i.framingTime = t || 800;
|
|
1245
|
-
const
|
|
1266
|
+
const n = () => {
|
|
1246
1267
|
this.isRunningFramingBehavior = !1;
|
|
1247
|
-
},
|
|
1268
|
+
}, s = T(this._scene), o = s.max.subtract(s.min), a = s.min.add(o.scale(0.5));
|
|
1248
1269
|
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(
|
|
1249
|
-
|
|
1250
|
-
|
|
1270
|
+
s.min,
|
|
1271
|
+
s.max,
|
|
1251
1272
|
void 0,
|
|
1252
|
-
|
|
1273
|
+
n
|
|
1253
1274
|
), i.framingTime = 0;
|
|
1254
1275
|
}
|
|
1255
1276
|
/**
|
|
@@ -1281,32 +1302,32 @@ class k extends fe {
|
|
|
1281
1302
|
*/
|
|
1282
1303
|
static create(e, t, i) {
|
|
1283
1304
|
var h;
|
|
1284
|
-
const
|
|
1305
|
+
const n = T(e), s = n.max.subtract(n.min), o = n.min.add(s.scale(0.5)), a = new k(
|
|
1285
1306
|
"ProductCamera",
|
|
1286
1307
|
-(Math.PI / 2),
|
|
1287
1308
|
Math.PI / 2,
|
|
1288
|
-
|
|
1309
|
+
s.length() * 1.5,
|
|
1289
1310
|
o,
|
|
1290
1311
|
e,
|
|
1291
1312
|
t
|
|
1292
1313
|
);
|
|
1293
1314
|
return a.setPanEnabled(
|
|
1294
1315
|
((h = t.options) == null ? void 0 : h.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1295
|
-
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator =
|
|
1316
|
+
), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = s.length(), a.onAfterCheckInputsObservable.addOnce(() => {
|
|
1296
1317
|
a.setPanEnabled(a.panEnabled);
|
|
1297
1318
|
}), i && (e.activeCamera = a), a;
|
|
1298
1319
|
}
|
|
1299
1320
|
}
|
|
1300
|
-
function T(
|
|
1301
|
-
if (
|
|
1321
|
+
function T(r) {
|
|
1322
|
+
if (r.meshes.length === 0)
|
|
1302
1323
|
return {
|
|
1303
1324
|
min: new p(-1, -1, -1),
|
|
1304
1325
|
max: new p(1, 1, 1)
|
|
1305
1326
|
};
|
|
1306
|
-
const e =
|
|
1307
|
-
return
|
|
1327
|
+
const e = r.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1328
|
+
return r.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1308
1329
|
}
|
|
1309
|
-
class
|
|
1330
|
+
class st {
|
|
1310
1331
|
constructor(e, t = !1, i = void 0) {
|
|
1311
1332
|
this.renderingPipeline = new qe(
|
|
1312
1333
|
"default",
|
|
@@ -1324,9 +1345,9 @@ class nt {
|
|
|
1324
1345
|
return this.currentConfiguration;
|
|
1325
1346
|
}
|
|
1326
1347
|
setConfiguration(e) {
|
|
1327
|
-
var t, i,
|
|
1348
|
+
var t, i, n, s, o, a, h, l, c, m, u, g, f, z, N, q, V, _, G, H, U, K, W, Y, Q, $, Z, j, X, J, ee, te, ie;
|
|
1328
1349
|
if (this.renderingPipeline.isSupported) {
|
|
1329
|
-
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 = ((
|
|
1350
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((n = e.bloom) == null ? void 0 : n.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 = ((h = e.bloom) == null ? void 0 : h.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((l = e.chromaticAberration) == null ? void 0 : l.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((m = e.chromaticAberration) == null ? void 0 : m.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (u = e.chromaticAberration) != null && u.direction ? new se(
|
|
1330
1351
|
e.chromaticAberration.direction.x,
|
|
1331
1352
|
e.chromaticAberration.direction.y
|
|
1332
1353
|
) : new se(
|
|
@@ -1347,19 +1368,19 @@ class nt {
|
|
|
1347
1368
|
if (this.renderingPipeline.depthOfField.focalLength = ((z = e.depthOfField) == null ? void 0 : z.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((N = e.depthOfField) == null ? void 0 : N.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((q = e.depthOfField) == null ? void 0 : q.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((H = e.grain) == null ? void 0 : H.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((U = e.misc) == null ? void 0 : U.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((W = e.misc) == null ? void 0 : W.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1348
1369
|
switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
|
|
1349
1370
|
case "Standard":
|
|
1350
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1371
|
+
this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_STANDARD;
|
|
1351
1372
|
break;
|
|
1352
1373
|
case "ACES":
|
|
1353
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1374
|
+
this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_ACES;
|
|
1354
1375
|
break;
|
|
1355
1376
|
}
|
|
1356
|
-
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 = ((
|
|
1377
|
+
if (this.renderingPipeline.sharpenEnabled = ((Y = e.sharpen) == null ? void 0 : Y.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = (($ = e.sharpen) == null ? void 0 : $.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.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)
|
|
1357
1378
|
switch (((X = e.vignette) == null ? void 0 : X.blendMode) ?? d.vignette.blendMode) {
|
|
1358
1379
|
case "Multiply":
|
|
1359
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1380
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_MULTIPLY;
|
|
1360
1381
|
break;
|
|
1361
1382
|
case "Opaque":
|
|
1362
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1383
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_OPAQUE;
|
|
1363
1384
|
break;
|
|
1364
1385
|
}
|
|
1365
1386
|
(J = e.vignette) != null && J.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
@@ -1380,22 +1401,22 @@ class nt {
|
|
|
1380
1401
|
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;
|
|
1381
1402
|
}
|
|
1382
1403
|
}
|
|
1383
|
-
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1384
|
-
return new _e(
|
|
1404
|
+
Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(r) {
|
|
1405
|
+
return new _e(r);
|
|
1385
1406
|
});
|
|
1386
|
-
S.OnPluginActivatedObservable.add((
|
|
1387
|
-
if (
|
|
1388
|
-
const e =
|
|
1407
|
+
S.OnPluginActivatedObservable.add((r) => {
|
|
1408
|
+
if (r.name === "gltf") {
|
|
1409
|
+
const e = r;
|
|
1389
1410
|
e.transparencyAsCoverage = !0;
|
|
1390
1411
|
}
|
|
1391
1412
|
});
|
|
1392
|
-
function O(
|
|
1393
|
-
return new p(
|
|
1413
|
+
function O(r) {
|
|
1414
|
+
return new p(r.x, r.y, r.z);
|
|
1394
1415
|
}
|
|
1395
|
-
function L(
|
|
1396
|
-
return { x:
|
|
1416
|
+
function L(r) {
|
|
1417
|
+
return { x: r.x, y: r.y, z: r.z };
|
|
1397
1418
|
}
|
|
1398
|
-
class
|
|
1419
|
+
class Yt {
|
|
1399
1420
|
constructor(e) {
|
|
1400
1421
|
var h;
|
|
1401
1422
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
@@ -1422,15 +1443,15 @@ class Wt {
|
|
|
1422
1443
|
const i = (() => {
|
|
1423
1444
|
if (!(e != null && e.noRender))
|
|
1424
1445
|
return this.configuration.createCanvas();
|
|
1425
|
-
})(),
|
|
1426
|
-
|
|
1446
|
+
})(), n = "1.5.6";
|
|
1447
|
+
Ae.Configuration = {
|
|
1427
1448
|
decoder: {
|
|
1428
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1429
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1430
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1449
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${n}/draco_wasm_wrapper_gltf.js`,
|
|
1450
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${n}/draco_decoder_gltf.wasm`,
|
|
1451
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${n}/draco_decoder_gltf.js`
|
|
1431
1452
|
}
|
|
1432
1453
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1433
|
-
const
|
|
1454
|
+
const s = console.log;
|
|
1434
1455
|
console.log = () => {
|
|
1435
1456
|
};
|
|
1436
1457
|
const o = i ? new be(i, !0, {
|
|
@@ -1442,7 +1463,7 @@ class Wt {
|
|
|
1442
1463
|
stencil: this.configuration.highlights.enabled,
|
|
1443
1464
|
forceSRGBBufferSupportState: !0
|
|
1444
1465
|
}) : new Ce();
|
|
1445
|
-
console.log =
|
|
1466
|
+
console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
|
|
1446
1467
|
this.scene,
|
|
1447
1468
|
!1,
|
|
1448
1469
|
this.camera
|
|
@@ -1503,19 +1524,19 @@ class Wt {
|
|
|
1503
1524
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1504
1525
|
}
|
|
1505
1526
|
executeCameraAnimation(e) {
|
|
1506
|
-
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((
|
|
1527
|
+
if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((n) => n.getIsInitialized()))
|
|
1507
1528
|
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1508
1529
|
let t = () => {
|
|
1509
1530
|
};
|
|
1510
1531
|
const i = async () => {
|
|
1511
|
-
this.isAnimatingCamera = !0, await
|
|
1532
|
+
this.isAnimatingCamera = !0, await Ye(
|
|
1512
1533
|
this.scene,
|
|
1513
1534
|
this.scene.activeCamera,
|
|
1514
1535
|
e
|
|
1515
1536
|
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1516
1537
|
};
|
|
1517
|
-
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((
|
|
1518
|
-
t =
|
|
1538
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((n) => {
|
|
1539
|
+
t = n;
|
|
1519
1540
|
})) : i();
|
|
1520
1541
|
}
|
|
1521
1542
|
getCameraPose() {
|
|
@@ -1552,13 +1573,13 @@ class Wt {
|
|
|
1552
1573
|
const t = async () => {
|
|
1553
1574
|
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1554
1575
|
this.focusLostNotified = !1;
|
|
1555
|
-
const
|
|
1556
|
-
const
|
|
1576
|
+
const n = () => {
|
|
1577
|
+
const s = this.configuration;
|
|
1557
1578
|
this.camera.rerunFramingBehavior(() => {
|
|
1558
|
-
|
|
1579
|
+
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();
|
|
1559
1580
|
});
|
|
1560
1581
|
};
|
|
1561
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1582
|
+
this.scene.onAfterRenderObservable.addOnce(n);
|
|
1562
1583
|
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1563
1584
|
};
|
|
1564
1585
|
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
@@ -1589,9 +1610,9 @@ class Wt {
|
|
|
1589
1610
|
this.scene
|
|
1590
1611
|
);
|
|
1591
1612
|
try {
|
|
1592
|
-
const
|
|
1593
|
-
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha =
|
|
1594
|
-
const o = await
|
|
1613
|
+
const n = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
|
|
1614
|
+
i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = s, i.beta = n, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1615
|
+
const o = await Me.CreateScreenshotUsingRenderTargetAsync(
|
|
1595
1616
|
this.engine,
|
|
1596
1617
|
i,
|
|
1597
1618
|
e,
|
|
@@ -1608,26 +1629,26 @@ class Wt {
|
|
|
1608
1629
|
const e = this.configuration;
|
|
1609
1630
|
if (!e)
|
|
1610
1631
|
return !0;
|
|
1611
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1612
|
-
if (t === void 0 || i === void 0 ||
|
|
1632
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, n = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
|
|
1633
|
+
if (t === void 0 || i === void 0 || n === void 0 || s === void 0)
|
|
1613
1634
|
return !0;
|
|
1614
|
-
const o = [t, i], a = [
|
|
1635
|
+
const o = [t, i], a = [n, s], h = o.every((c) => c === t), l = a.every((c) => c === n);
|
|
1615
1636
|
return !h && !l;
|
|
1616
1637
|
}
|
|
1617
1638
|
fireResizeEvent() {
|
|
1618
1639
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1619
1640
|
}
|
|
1620
1641
|
setHighlights(e, t) {
|
|
1621
|
-
var
|
|
1622
|
-
e.length === 0 && ((
|
|
1642
|
+
var n;
|
|
1643
|
+
e.length === 0 && ((n = this.highlightLayer) == null || n.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1623
1644
|
isStroke: !0,
|
|
1624
1645
|
blurVerticalSize: 0.85,
|
|
1625
1646
|
blurHorizontalSize: 0.85
|
|
1626
1647
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1627
1648
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1628
|
-
e.forEach((
|
|
1649
|
+
e.forEach((s) => {
|
|
1629
1650
|
const o = this.scene.materials.find(
|
|
1630
|
-
(a) => a.name ===
|
|
1651
|
+
(a) => a.name === s.name && a.id === s.id
|
|
1631
1652
|
);
|
|
1632
1653
|
o && o.getBindedMeshes().forEach(
|
|
1633
1654
|
(a) => {
|
|
@@ -1644,14 +1665,14 @@ class Wt {
|
|
|
1644
1665
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1645
1666
|
}
|
|
1646
1667
|
loadModel(e, t) {
|
|
1647
|
-
const { refocusCamera: i = !0, progressHandler:
|
|
1668
|
+
const { refocusCamera: i = !0, progressHandler: n } = t ?? {}, s = new nt({
|
|
1648
1669
|
enablePicking: this.configuration.highlights.enabled,
|
|
1649
1670
|
modelDetails: e,
|
|
1650
1671
|
scene: this.scene,
|
|
1651
1672
|
previewService: this,
|
|
1652
|
-
progressHandler:
|
|
1673
|
+
progressHandler: n
|
|
1653
1674
|
});
|
|
1654
|
-
return
|
|
1675
|
+
return s.getInitializationPromise().then(() => {
|
|
1655
1676
|
if (this.modelContainers.size <= 1 && i) {
|
|
1656
1677
|
const o = this.queuedCameraAnimation;
|
|
1657
1678
|
this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
|
|
@@ -1660,14 +1681,14 @@ class Wt {
|
|
|
1660
1681
|
});
|
|
1661
1682
|
}, 1);
|
|
1662
1683
|
}
|
|
1663
|
-
}), this.configuration.highlights.enabled && (
|
|
1684
|
+
}), this.configuration.highlights.enabled && (s.registerMaterialSelectedCallback((o) => {
|
|
1664
1685
|
this.setHighlights([o]);
|
|
1665
|
-
}),
|
|
1686
|
+
}), s.registerMaterialDeselectedCallback(() => {
|
|
1666
1687
|
this.setHighlights([]);
|
|
1667
|
-
})), this.modelContainers.set(
|
|
1688
|
+
})), this.modelContainers.set(s.getId(), s), this.triggerModelLoadEvent({
|
|
1668
1689
|
eventType: "load",
|
|
1669
|
-
modelContainer:
|
|
1670
|
-
}),
|
|
1690
|
+
modelContainer: s
|
|
1691
|
+
}), s;
|
|
1671
1692
|
}
|
|
1672
1693
|
async preloadModel(e) {
|
|
1673
1694
|
await D(e, this.scene);
|
|
@@ -1687,7 +1708,7 @@ class Wt {
|
|
|
1687
1708
|
}
|
|
1688
1709
|
unregisterPlugin(e) {
|
|
1689
1710
|
const t = this.plugins.indexOf(e);
|
|
1690
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1711
|
+
t > -1 && this.plugins.splice(t, 1).forEach((n) => n.dispose(!1));
|
|
1691
1712
|
}
|
|
1692
1713
|
getGlowLayerManager() {
|
|
1693
1714
|
return this.glowLayerManager;
|
|
@@ -1705,31 +1726,31 @@ class Wt {
|
|
|
1705
1726
|
* Flips a transform around the origin.
|
|
1706
1727
|
*/
|
|
1707
1728
|
flipTransform(e, t, i) {
|
|
1708
|
-
const
|
|
1729
|
+
const n = re.Compose(
|
|
1709
1730
|
O(i || { x: 1, y: 1, z: 1 }),
|
|
1710
|
-
|
|
1731
|
+
y.FromEulerVector(
|
|
1711
1732
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1712
1733
|
),
|
|
1713
1734
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1714
|
-
),
|
|
1715
|
-
return o.decompose(l, h, a), h.multiplyInPlace(
|
|
1735
|
+
), s = re.RotationAxis(p.Up(), Math.PI), o = n.multiply(s), a = p.Zero(), h = y.Identity(), l = p.Zero();
|
|
1736
|
+
return o.decompose(l, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1716
1737
|
position: L(a),
|
|
1717
1738
|
rotation: L(h.toEulerAngles()),
|
|
1718
1739
|
scale: L(l)
|
|
1719
1740
|
};
|
|
1720
1741
|
}
|
|
1721
1742
|
updatePreviewOptions(e) {
|
|
1722
|
-
var
|
|
1743
|
+
var n, s;
|
|
1723
1744
|
const t = new ce(e);
|
|
1724
1745
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1725
1746
|
let i = this.scene.environmentTexture;
|
|
1726
1747
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = ne.CreateFromPrefilteredData(
|
|
1727
1748
|
t.scene.environment.file,
|
|
1728
1749
|
this.scene
|
|
1729
|
-
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (
|
|
1750
|
+
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (n = t.options) != null && n.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1730
1751
|
t.options.renderingPipelineConfiguration
|
|
1731
1752
|
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
|
|
1732
|
-
((
|
|
1753
|
+
((s = t.options) == null ? void 0 : s.noPan) !== void 0 ? !t.options.noPan : !0
|
|
1733
1754
|
), this.configuration = t;
|
|
1734
1755
|
}
|
|
1735
1756
|
/**
|
|
@@ -1750,7 +1771,7 @@ export {
|
|
|
1750
1771
|
F as MaterialEffectMode,
|
|
1751
1772
|
I as ProductCameraRig,
|
|
1752
1773
|
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1753
|
-
|
|
1754
|
-
|
|
1774
|
+
M as RenderingConfiguration,
|
|
1775
|
+
Yt as SpiffCommerce3DPreviewService,
|
|
1755
1776
|
d as renderingPipelineDefaults
|
|
1756
1777
|
};
|