@spiffcommerce/preview 5.3.7 → 5.3.8-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -5
- package/dist/index.esm.js +425 -399
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4,16 +4,16 @@ import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
|
4
4
|
import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
5
|
import { SceneLoader as fe } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
6
|
import { CubeTexture as te } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
|
-
import { Color4 as
|
|
8
|
-
import { Vector3 as
|
|
7
|
+
import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
+
import { Vector3 as g, Quaternion as y, Vector2 as ie, Matrix as ne } 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 xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as Pe } from "@babylonjs/core/scene";
|
|
13
13
|
import { GLTF2 as Ae } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { PBRMaterial as F } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
15
|
import { MirrorTexture as Re } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
-
import { Color3 as Te, Vector3 as
|
|
16
|
+
import { Color3 as Te, Vector3 as se, Plane as Ee } from "@babylonjs/core/Maths/math";
|
|
17
17
|
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
18
|
import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
|
|
19
19
|
import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
|
|
@@ -26,7 +26,7 @@ import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
|
26
26
|
import { QuadraticEase as De, EasingFunction as ke } from "@babylonjs/core/Animations/easing";
|
|
27
27
|
import { AssetsManager as ze } from "@babylonjs/core/Misc/assetsManager";
|
|
28
28
|
import { ColorCurves as ae } from "@babylonjs/core/Materials/colorCurves";
|
|
29
|
-
import { ImageProcessingConfiguration as
|
|
29
|
+
import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
30
30
|
import { DefaultRenderingPipeline as Ve } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
31
|
import { DepthOfFieldEffectBlurLevel as T } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
32
32
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
@@ -39,32 +39,32 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
39
39
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
40
40
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
41
41
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
42
|
-
var I = /* @__PURE__ */ ((
|
|
42
|
+
var I = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(I || {}), S = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(S || {});
|
|
43
43
|
class oe {
|
|
44
44
|
constructor(e) {
|
|
45
45
|
this.getSceneClearColor = () => {
|
|
46
|
-
var i,
|
|
47
|
-
const t = (i = this.customOptions) != null && i.transparentBackground || (
|
|
48
|
-
if (this.customOptions && ((
|
|
49
|
-
return new
|
|
46
|
+
var i, s, a, o;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (s = this.customOptions) != null && s.backgroundImage ? 0 : 1;
|
|
48
|
+
if (this.customOptions && ((a = this.customOptions) != null && a.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
|
|
49
|
+
return new b(0, 0, 0, t).toLinearSpace();
|
|
50
50
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
51
|
-
const
|
|
51
|
+
const r = w.FromHexString(
|
|
52
52
|
this.customOptions.backgroundColor
|
|
53
53
|
);
|
|
54
|
-
return new
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
return new b(
|
|
55
|
+
r.r,
|
|
56
|
+
r.g,
|
|
57
|
+
r.b,
|
|
58
58
|
t
|
|
59
59
|
).toLinearSpace();
|
|
60
60
|
}
|
|
61
|
-
return new
|
|
62
|
-
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new
|
|
63
|
-
const
|
|
64
|
-
return new
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
return new b(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
62
|
+
}, 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) => {
|
|
63
|
+
const s = w.FromHexString(t);
|
|
64
|
+
return new b(
|
|
65
|
+
s.r,
|
|
66
|
+
s.g,
|
|
67
|
+
s.b,
|
|
68
68
|
i
|
|
69
69
|
).toLinearSpace();
|
|
70
70
|
}, this.customOptions = e;
|
|
@@ -80,14 +80,14 @@ class oe {
|
|
|
80
80
|
* Configuration related to the scene
|
|
81
81
|
*/
|
|
82
82
|
get scene() {
|
|
83
|
-
var e, t, i,
|
|
83
|
+
var e, t, i, s, a;
|
|
84
84
|
return {
|
|
85
85
|
clearColor: this.getSceneClearColor(),
|
|
86
86
|
transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
|
|
87
87
|
environment: {
|
|
88
88
|
file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
|
|
89
|
-
intensity: ((
|
|
90
|
-
rotationY: (((
|
|
89
|
+
intensity: ((s = this.customOptions) == null ? void 0 : s.environmentIntensity) ?? 1,
|
|
90
|
+
rotationY: (((a = this.customOptions) == null ? void 0 : a.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
91
91
|
// Convert to radians
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -96,7 +96,7 @@ class oe {
|
|
|
96
96
|
* Configuration related to the camera used to view and interact with the scene.
|
|
97
97
|
*/
|
|
98
98
|
get camera() {
|
|
99
|
-
var e, t, i,
|
|
99
|
+
var e, t, i, s, a, o, r, l, d, h, u, m, p;
|
|
100
100
|
return {
|
|
101
101
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
102
102
|
autoRotation: {
|
|
@@ -105,13 +105,13 @@ class oe {
|
|
|
105
105
|
},
|
|
106
106
|
limits: {
|
|
107
107
|
min: {
|
|
108
|
-
alpha: (
|
|
109
|
-
beta: (
|
|
108
|
+
alpha: (s = this.customOptions) != null && s.lowerAlphaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
109
|
+
beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
110
110
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
111
111
|
},
|
|
112
112
|
max: {
|
|
113
|
-
alpha: (
|
|
114
|
-
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((
|
|
113
|
+
alpha: (d = this.customOptions) != null && d.upperAlphaLimitDeg ? ((h = this.customOptions) == null ? void 0 : h.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
114
|
+
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
115
115
|
radius: (p = this.customOptions) == null ? void 0 : p.maxZoomOverride
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -129,10 +129,10 @@ class oe {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
get lighting() {
|
|
132
|
-
var e, t, i,
|
|
132
|
+
var e, t, i, s;
|
|
133
133
|
return {
|
|
134
134
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
135
|
-
contrast: ((
|
|
135
|
+
contrast: ((s = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : s.contrast) ?? 1.6
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
get emissiveGlowIntensity() {
|
|
@@ -140,12 +140,12 @@ class oe {
|
|
|
140
140
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
class
|
|
143
|
+
class x {
|
|
144
144
|
/**
|
|
145
145
|
* Returns the resolution expected for generated textures.
|
|
146
146
|
*/
|
|
147
147
|
static getDynamicTextureResolution() {
|
|
148
|
-
return this.getIsMobile() || !
|
|
148
|
+
return this.getIsMobile() || !x.offscreenRenderingSupported() ? {
|
|
149
149
|
width: 1024,
|
|
150
150
|
height: 1024
|
|
151
151
|
} : {
|
|
@@ -181,7 +181,7 @@ class P {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const qe = 128, c = {
|
|
185
185
|
antiAliasing: {
|
|
186
186
|
samples: 4,
|
|
187
187
|
fxaaEnabled: !1
|
|
@@ -253,11 +253,11 @@ class Ne {
|
|
|
253
253
|
return this.loader.loadNodeAsync(
|
|
254
254
|
e,
|
|
255
255
|
t,
|
|
256
|
-
function(
|
|
257
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
}), i(
|
|
256
|
+
function(s) {
|
|
257
|
+
t.extras && Object.keys(t.extras).forEach((a) => {
|
|
258
|
+
const o = t.extras[a];
|
|
259
|
+
s.metadata[a] = o;
|
|
260
|
+
}), i(s);
|
|
261
261
|
}
|
|
262
262
|
);
|
|
263
263
|
}
|
|
@@ -315,55 +315,55 @@ class Ne {
|
|
|
315
315
|
* @param scene The scene to parse.
|
|
316
316
|
*/
|
|
317
317
|
applyReflections(e) {
|
|
318
|
-
function t(
|
|
319
|
-
const
|
|
320
|
-
return
|
|
321
|
-
|
|
322
|
-
}),
|
|
323
|
-
|
|
324
|
-
}),
|
|
318
|
+
function t(a) {
|
|
319
|
+
const o = [];
|
|
320
|
+
return a.transformNodes.forEach((r) => {
|
|
321
|
+
r.metadata && r.metadata.reflective && o.push(...r.getChildMeshes());
|
|
322
|
+
}), a.meshes.forEach((r) => {
|
|
323
|
+
r.metadata && r.metadata.reflective && !o.includes(r) && o.push(r);
|
|
324
|
+
}), o;
|
|
325
325
|
}
|
|
326
|
-
function i(
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
326
|
+
function i(a, o = 1) {
|
|
327
|
+
const r = a.material;
|
|
328
|
+
if (!r)
|
|
329
329
|
return;
|
|
330
330
|
const l = new Re(
|
|
331
331
|
"mirror",
|
|
332
|
-
|
|
332
|
+
x.getMirrorTextureResolution(),
|
|
333
333
|
e,
|
|
334
334
|
!0
|
|
335
335
|
);
|
|
336
336
|
l.renderList = t(e);
|
|
337
|
-
const
|
|
338
|
-
if (!
|
|
337
|
+
const d = a.getVerticesData("normal");
|
|
338
|
+
if (!d)
|
|
339
339
|
throw new Error(
|
|
340
|
-
"Mirror attribute specified on: " +
|
|
340
|
+
"Mirror attribute specified on: " + a.name + "But no normals exist to generate a mirror from!"
|
|
341
341
|
);
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
new
|
|
345
|
-
|
|
346
|
-
).normalize(),
|
|
347
|
-
|
|
342
|
+
a.computeWorldMatrix(!0);
|
|
343
|
+
const h = a.getWorldMatrix(), u = se.TransformNormal(
|
|
344
|
+
new se(d[0], d[1], d[2]),
|
|
345
|
+
h
|
|
346
|
+
).normalize(), m = Ee.FromPositionAndNormal(
|
|
347
|
+
a.position,
|
|
348
348
|
u.scale(-1)
|
|
349
349
|
);
|
|
350
|
-
l.mirrorPlane =
|
|
350
|
+
l.mirrorPlane = m, l.level = o, r.reflectionTexture = l;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
const
|
|
354
|
-
"probe-" +
|
|
355
|
-
|
|
352
|
+
function s(a) {
|
|
353
|
+
const o = a.material, r = new Oe(
|
|
354
|
+
"probe-" + o.name,
|
|
355
|
+
qe,
|
|
356
356
|
e
|
|
357
357
|
);
|
|
358
|
-
|
|
358
|
+
r.attachToMesh(a), r.renderList && r.renderList.push(...t(e)), o.reflectionTexture = r.cubeTexture;
|
|
359
359
|
}
|
|
360
|
-
e.meshes.forEach((
|
|
361
|
-
const
|
|
362
|
-
|
|
360
|
+
e.meshes.forEach((a) => {
|
|
361
|
+
const o = a.metadata;
|
|
362
|
+
o && (o.mirrorTexture && i(a, o.mirrorTexture), o.reflectionProbe && s(a));
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
class
|
|
366
|
+
class Ge {
|
|
367
367
|
constructor(e, t) {
|
|
368
368
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
369
369
|
}
|
|
@@ -386,182 +386,190 @@ class He {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
const le = /* @__PURE__ */ new Map();
|
|
389
|
-
async function be(
|
|
390
|
-
const i = le.get(
|
|
389
|
+
async function be(n, e, t) {
|
|
390
|
+
const i = le.get(n);
|
|
391
391
|
if (i && i.scene.uid === e.uid)
|
|
392
392
|
return i;
|
|
393
393
|
{
|
|
394
|
-
const
|
|
395
|
-
|
|
394
|
+
const s = await fe.LoadAssetContainerAsync(
|
|
395
|
+
n,
|
|
396
396
|
void 0,
|
|
397
397
|
e,
|
|
398
398
|
t
|
|
399
399
|
);
|
|
400
|
-
return le.set(
|
|
400
|
+
return le.set(n, s), s;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
t.forEach((
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
const u = i.get(
|
|
403
|
+
function He(n, e, t, i, s = "") {
|
|
404
|
+
t.forEach((a) => {
|
|
405
|
+
const o = a.getID(), r = a.getName(), l = x.getDynamicTextureResolution();
|
|
406
|
+
n.filter((h) => h.name === s + r).forEach((h) => {
|
|
407
|
+
const u = i.get(o), m = !1;
|
|
408
408
|
if (u)
|
|
409
|
-
he(
|
|
409
|
+
he(h, u), u.update(m);
|
|
410
410
|
else {
|
|
411
411
|
const p = _e(
|
|
412
|
-
|
|
412
|
+
r,
|
|
413
413
|
e,
|
|
414
414
|
l.width,
|
|
415
415
|
l.height
|
|
416
416
|
);
|
|
417
|
-
i.set(
|
|
417
|
+
i.set(o, p), a.setStaticContext(
|
|
418
418
|
p.getContext()
|
|
419
|
-
), he(
|
|
420
|
-
p.update(
|
|
419
|
+
), he(h, p), p.onLoadObservable.addOnce(() => {
|
|
420
|
+
p.update(m);
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
|
-
function _e(
|
|
427
|
-
const
|
|
428
|
-
|
|
426
|
+
function _e(n, e, t, i) {
|
|
427
|
+
const s = new Fe(
|
|
428
|
+
n,
|
|
429
429
|
{ width: t, height: i },
|
|
430
430
|
e,
|
|
431
|
-
|
|
431
|
+
x.shouldMipMap(),
|
|
432
432
|
Be.TRILINEAR_SAMPLINGMODE,
|
|
433
433
|
pe.TEXTUREFORMAT_RGBA
|
|
434
|
-
),
|
|
435
|
-
return
|
|
434
|
+
), a = s.getContext();
|
|
435
|
+
return a && (a.fillStyle = "#f5f5f5", a.fillRect(0, 0, t, i), s.update()), s;
|
|
436
436
|
}
|
|
437
|
-
function he(
|
|
438
|
-
if (
|
|
439
|
-
const t =
|
|
437
|
+
function he(n, e) {
|
|
438
|
+
if (n instanceof F) {
|
|
439
|
+
const t = n, i = t.albedoTexture;
|
|
440
440
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
441
441
|
} else {
|
|
442
|
-
const t =
|
|
442
|
+
const t = n, i = t.diffuseTexture;
|
|
443
443
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
function Ke() {
|
|
447
|
-
const
|
|
448
|
-
return
|
|
447
|
+
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
448
|
+
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
449
449
|
}
|
|
450
450
|
const M = 60, ce = 1;
|
|
451
|
-
function de(
|
|
452
|
-
return
|
|
451
|
+
function de(n) {
|
|
452
|
+
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
453
453
|
}
|
|
454
|
-
function We(
|
|
455
|
-
const o =
|
|
454
|
+
function We(n, e, t, i, s, a) {
|
|
455
|
+
const o = s ? n.filter((h) => h.name === s) : n;
|
|
456
456
|
if (o.length === 0) {
|
|
457
|
-
console.warn(`No animations found for name: ${
|
|
457
|
+
console.warn(`No animations found for name: ${s}`);
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
|
+
let r = 0;
|
|
461
|
+
const l = () => {
|
|
462
|
+
r++, r === o.length && a && a();
|
|
463
|
+
}, d = (h, u, m, p, f) => {
|
|
464
|
+
h.stop(), h.start(u, m, p, f), a && (u == !1 || u === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
|
|
465
|
+
l();
|
|
466
|
+
}) : h.onAnimationLoopObservable.addOnce(() => {
|
|
467
|
+
l();
|
|
468
|
+
}));
|
|
469
|
+
};
|
|
460
470
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
461
|
-
o.forEach((
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
a.start(e, ce, l, l);
|
|
471
|
+
o.forEach((h) => {
|
|
472
|
+
const u = de(h), m = i * u;
|
|
473
|
+
d(h, !1, ce, m, m);
|
|
465
474
|
});
|
|
466
475
|
return;
|
|
467
476
|
}
|
|
468
|
-
o.forEach((
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
a.start(e, ce, l, c);
|
|
477
|
+
o.forEach((h) => {
|
|
478
|
+
const u = de(h), m = i !== void 0 ? i * u : void 0, p = t !== void 0 ? t * u : void 0;
|
|
479
|
+
d(h, e, ce, m, p);
|
|
472
480
|
});
|
|
473
481
|
}
|
|
474
|
-
function ve(
|
|
475
|
-
|
|
482
|
+
function ve(n) {
|
|
483
|
+
n.forEach((e) => {
|
|
476
484
|
e.stop();
|
|
477
485
|
});
|
|
478
486
|
}
|
|
479
|
-
function Ue(
|
|
480
|
-
const e =
|
|
487
|
+
function Ue(n) {
|
|
488
|
+
const e = n.animationGroups;
|
|
481
489
|
ve(e);
|
|
482
490
|
}
|
|
483
|
-
function Ye(
|
|
491
|
+
function Ye(n, e, t) {
|
|
484
492
|
return new Promise((i) => {
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
if (t.target && Object.keys(t.target).length > 0 &&
|
|
493
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
|
|
494
|
+
const s = [], a = t.target, o = 0, r = a ? 1 : 0;
|
|
495
|
+
if (t.target && Object.keys(t.target).length > 0 && s.push(
|
|
488
496
|
A(
|
|
489
497
|
"cameraTargetLerp",
|
|
490
498
|
"target",
|
|
491
|
-
new
|
|
492
|
-
new
|
|
499
|
+
new g().copyFrom(e.target),
|
|
500
|
+
new g(
|
|
493
501
|
t.target.x,
|
|
494
502
|
t.target.y,
|
|
495
503
|
t.target.z
|
|
496
504
|
),
|
|
497
505
|
v.ANIMATIONTYPE_VECTOR3,
|
|
498
|
-
|
|
506
|
+
o
|
|
499
507
|
)
|
|
500
|
-
),
|
|
508
|
+
), s.push(
|
|
501
509
|
A(
|
|
502
510
|
"cameraAlphaLerp",
|
|
503
511
|
"alpha",
|
|
504
512
|
e.alpha,
|
|
505
513
|
ue(t.lonDeg),
|
|
506
514
|
v.ANIMATIONTYPE_FLOAT,
|
|
507
|
-
|
|
515
|
+
r
|
|
508
516
|
)
|
|
509
|
-
),
|
|
517
|
+
), s.push(
|
|
510
518
|
A(
|
|
511
519
|
"cameraBetaLerp",
|
|
512
520
|
"beta",
|
|
513
521
|
e.beta,
|
|
514
522
|
ue(t.latDeg),
|
|
515
523
|
v.ANIMATIONTYPE_FLOAT,
|
|
516
|
-
|
|
524
|
+
r
|
|
517
525
|
)
|
|
518
526
|
), t.radius !== void 0) {
|
|
519
|
-
const
|
|
520
|
-
|
|
527
|
+
const h = Math.max(0.01, t.radius);
|
|
528
|
+
s.push(
|
|
521
529
|
A(
|
|
522
530
|
"cameraRadiusLerp",
|
|
523
531
|
"radius",
|
|
524
532
|
e.radius,
|
|
525
|
-
|
|
533
|
+
h,
|
|
526
534
|
v.ANIMATIONTYPE_FLOAT,
|
|
527
|
-
|
|
535
|
+
r
|
|
528
536
|
)
|
|
529
537
|
);
|
|
530
538
|
}
|
|
531
|
-
e.animations.push(...
|
|
532
|
-
const
|
|
533
|
-
e.disableAutoRotationBehavior(),
|
|
539
|
+
e.animations.push(...s);
|
|
540
|
+
const d = e.useAutoRotationBehavior;
|
|
541
|
+
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
534
542
|
e,
|
|
535
543
|
0,
|
|
536
|
-
|
|
544
|
+
a ? M * 2 : M,
|
|
537
545
|
!1,
|
|
538
546
|
1,
|
|
539
547
|
() => {
|
|
540
|
-
e.animations = [],
|
|
548
|
+
e.animations = [], d && e.enableAutoRotationBehavior(), i();
|
|
541
549
|
}
|
|
542
550
|
);
|
|
543
551
|
});
|
|
544
552
|
}
|
|
545
|
-
function ue(
|
|
546
|
-
return
|
|
553
|
+
function ue(n) {
|
|
554
|
+
return n * Math.PI / 180;
|
|
547
555
|
}
|
|
548
|
-
function A(
|
|
549
|
-
const
|
|
550
|
-
|
|
556
|
+
function A(n, e, t, i, s, a = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
557
|
+
const r = new De();
|
|
558
|
+
r.setEasingMode(ke.EASINGMODE_EASEINOUT);
|
|
551
559
|
const l = new v(
|
|
552
|
-
|
|
560
|
+
n,
|
|
553
561
|
e,
|
|
554
562
|
M,
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
),
|
|
558
|
-
return
|
|
559
|
-
frame: M * (
|
|
563
|
+
s,
|
|
564
|
+
o
|
|
565
|
+
), d = [];
|
|
566
|
+
return a > 0 && d.push({ frame: 0, value: t }), d.push({ frame: M * a, value: t }), d.push({
|
|
567
|
+
frame: M * (a + 1),
|
|
560
568
|
value: i
|
|
561
|
-
}), l.setKeys(
|
|
569
|
+
}), l.setKeys(d), l.setEasingFunction(r), l;
|
|
562
570
|
}
|
|
563
|
-
function Qe(
|
|
564
|
-
return
|
|
571
|
+
function Qe(n, e, t) {
|
|
572
|
+
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
565
573
|
}
|
|
566
574
|
const Ze = {
|
|
567
575
|
albedoTexture: "albedoMap",
|
|
@@ -573,7 +581,7 @@ const Ze = {
|
|
|
573
581
|
refractionTexture: "refractionMap",
|
|
574
582
|
reflectionTexture: "reflectionMap"
|
|
575
583
|
};
|
|
576
|
-
function $e(
|
|
584
|
+
function $e(n, e, t, i) {
|
|
577
585
|
[
|
|
578
586
|
"albedoTexture",
|
|
579
587
|
"bumpTexture",
|
|
@@ -583,49 +591,49 @@ function $e(s, e, t, i) {
|
|
|
583
591
|
"metallicTexture",
|
|
584
592
|
"refractionTexture",
|
|
585
593
|
"reflectionTexture"
|
|
586
|
-
].forEach((
|
|
594
|
+
].forEach((a) => {
|
|
587
595
|
je(
|
|
588
|
-
|
|
589
|
-
|
|
596
|
+
a,
|
|
597
|
+
n,
|
|
590
598
|
e,
|
|
591
599
|
t,
|
|
592
600
|
i
|
|
593
601
|
);
|
|
594
|
-
}), et(
|
|
602
|
+
}), et(n, e);
|
|
595
603
|
}
|
|
596
|
-
function je(
|
|
597
|
-
const
|
|
598
|
-
if (!
|
|
604
|
+
function je(n, e, t, i, s) {
|
|
605
|
+
const a = Ze[n];
|
|
606
|
+
if (!a)
|
|
599
607
|
throw new Error("Unexpected texture name encountered.");
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
s,
|
|
608
|
+
const o = e[a], r = o == null ? void 0 : o.fileLink;
|
|
609
|
+
r ? n === "reflectionTexture" ? r.endsWith(".env") || r.endsWith(".dds") ? i.addCubeTextureTask(
|
|
603
610
|
n,
|
|
611
|
+
r,
|
|
604
612
|
void 0,
|
|
605
613
|
!1,
|
|
606
614
|
void 0,
|
|
607
615
|
!0
|
|
608
|
-
) :
|
|
609
|
-
s,
|
|
616
|
+
) : r.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
610
617
|
n,
|
|
618
|
+
r,
|
|
611
619
|
128,
|
|
612
620
|
!1,
|
|
613
621
|
!0,
|
|
614
622
|
!1
|
|
615
|
-
) : i.addTextureTask(
|
|
623
|
+
) : i.addTextureTask(n, r, !1, !1) : i.addTextureTask(n, r, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Xe(n, t));
|
|
616
624
|
}
|
|
617
|
-
function Xe(
|
|
618
|
-
|
|
625
|
+
function Xe(n, e) {
|
|
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);
|
|
619
627
|
}
|
|
620
|
-
function Je(
|
|
628
|
+
function Je(n, e, t, i) {
|
|
621
629
|
if (!e) {
|
|
622
630
|
console.error("Failed to apply texture to material: material is null.");
|
|
623
631
|
return;
|
|
624
632
|
}
|
|
625
|
-
|
|
633
|
+
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), n === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
626
634
|
}
|
|
627
|
-
function et(
|
|
628
|
-
|
|
635
|
+
function et(n, e) {
|
|
636
|
+
n.clearCoat && (n.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
629
637
|
}
|
|
630
638
|
class tt {
|
|
631
639
|
constructor(e, t, i) {
|
|
@@ -640,45 +648,45 @@ class tt {
|
|
|
640
648
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
641
649
|
* where we want to undo changes are remove effects from display.
|
|
642
650
|
*/
|
|
643
|
-
async applyMaterial(e, t, i,
|
|
644
|
-
return new Promise((
|
|
645
|
-
const
|
|
651
|
+
async applyMaterial(e, t, i, s) {
|
|
652
|
+
return new Promise((a) => {
|
|
653
|
+
const o = this.materialVariantMap.get(e);
|
|
646
654
|
this.materialVariantMap.set(e, {
|
|
647
|
-
...
|
|
655
|
+
...o,
|
|
648
656
|
...t
|
|
649
657
|
});
|
|
650
|
-
const
|
|
651
|
-
(
|
|
658
|
+
const r = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
659
|
+
(h) => h.name === r
|
|
652
660
|
);
|
|
653
661
|
if (l.length === 0) {
|
|
654
|
-
|
|
662
|
+
a();
|
|
655
663
|
return;
|
|
656
664
|
}
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
(
|
|
665
|
+
const d = new ze(this.scene);
|
|
666
|
+
d.useDefaultLoadingScreen = !1, l.forEach(
|
|
667
|
+
(h) => $e(
|
|
660
668
|
t,
|
|
669
|
+
h,
|
|
661
670
|
d,
|
|
662
|
-
|
|
663
|
-
r
|
|
671
|
+
s
|
|
664
672
|
)
|
|
665
|
-
),
|
|
666
|
-
i && i(
|
|
667
|
-
},
|
|
668
|
-
|
|
669
|
-
const
|
|
673
|
+
), d.onProgress = (h, u, m) => {
|
|
674
|
+
i && i(h / u * 100, 100, m.name);
|
|
675
|
+
}, d.onFinish = (h) => {
|
|
676
|
+
h.forEach((u) => {
|
|
677
|
+
const m = u;
|
|
670
678
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
671
|
-
(
|
|
679
|
+
(f) => f.name === r
|
|
672
680
|
).forEach(
|
|
673
|
-
(
|
|
681
|
+
(f) => Je(
|
|
674
682
|
u.name,
|
|
675
|
-
|
|
683
|
+
f,
|
|
676
684
|
t,
|
|
677
|
-
|
|
685
|
+
m.texture
|
|
678
686
|
)
|
|
679
687
|
);
|
|
680
|
-
}),
|
|
681
|
-
},
|
|
688
|
+
}), a();
|
|
689
|
+
}, d.loadAsync();
|
|
682
690
|
});
|
|
683
691
|
}
|
|
684
692
|
/**
|
|
@@ -688,21 +696,21 @@ class tt {
|
|
|
688
696
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
689
697
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
690
698
|
*/
|
|
691
|
-
async applyModel(e, t, i,
|
|
692
|
-
var l,
|
|
699
|
+
async applyModel(e, t, i, s) {
|
|
700
|
+
var l, d;
|
|
693
701
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
694
702
|
return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (l = this.loadedContainerForKey.get(e)) == null || l.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
|
|
695
|
-
(
|
|
703
|
+
(h) => h !== e
|
|
696
704
|
), Promise.resolve(void 0);
|
|
697
|
-
const
|
|
705
|
+
const o = (await be(i, this.scene, s)).instantiateModelsToScene(
|
|
698
706
|
this.renameClonedAsset,
|
|
699
707
|
!0
|
|
700
708
|
);
|
|
701
|
-
this.loadedContainerForKey.has(e) && ((
|
|
702
|
-
const
|
|
703
|
-
return this.materialVariantMap.forEach(async (
|
|
704
|
-
|
|
705
|
-
}), await Promise.all(
|
|
709
|
+
this.loadedContainerForKey.has(e) && ((d = this.loadedContainerForKey.get(e)) == null || d.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, o), this.loadedMaterialsForKey.set(e, we(o));
|
|
710
|
+
const r = [];
|
|
711
|
+
return this.materialVariantMap.forEach(async (h, u) => {
|
|
712
|
+
r.push(this.applyMaterial(u, h));
|
|
713
|
+
}), await Promise.all(r), o;
|
|
706
714
|
}
|
|
707
715
|
dispose() {
|
|
708
716
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -724,19 +732,19 @@ class tt {
|
|
|
724
732
|
}), e;
|
|
725
733
|
}
|
|
726
734
|
}
|
|
727
|
-
function we(
|
|
735
|
+
function we(n) {
|
|
728
736
|
const e = [];
|
|
729
|
-
return
|
|
737
|
+
return n.rootNodes.forEach((t) => {
|
|
730
738
|
t.getChildMeshes().forEach((i) => {
|
|
731
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
732
|
-
const
|
|
733
|
-
|
|
739
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((s) => {
|
|
740
|
+
const a = s.getMaterial(!1);
|
|
741
|
+
a && !e.includes(a) && e.push(a);
|
|
734
742
|
});
|
|
735
743
|
});
|
|
736
744
|
}), e;
|
|
737
745
|
}
|
|
738
|
-
function me(
|
|
739
|
-
return
|
|
746
|
+
function me(n, e = "") {
|
|
747
|
+
return n.map((t) => ({
|
|
740
748
|
name: t.name.substring(e.length),
|
|
741
749
|
loop: t.loopAnimation,
|
|
742
750
|
to: t.to,
|
|
@@ -745,45 +753,45 @@ function me(s, e = "") {
|
|
|
745
753
|
}
|
|
746
754
|
class it {
|
|
747
755
|
constructor(e) {
|
|
748
|
-
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new C(), this.materialDeselectedObservable = new C(), this.materialVariantObservable = new C(), this.modelVariantObservable = new C(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.animations = [], this.initialized = !1, this.materials = [];
|
|
756
|
+
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 = [];
|
|
749
757
|
const {
|
|
750
758
|
enablePicking: t,
|
|
751
759
|
modelDetails: i,
|
|
752
|
-
previewService:
|
|
753
|
-
progressHandler:
|
|
754
|
-
scene:
|
|
760
|
+
previewService: s,
|
|
761
|
+
progressHandler: a,
|
|
762
|
+
scene: o
|
|
755
763
|
} = e;
|
|
756
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService =
|
|
757
|
-
|
|
764
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = s, this.scene = o, this.variantManager = new tt(
|
|
765
|
+
o,
|
|
758
766
|
this.renameClonedAsset.bind(this),
|
|
759
767
|
this.setBaseModelEnabled.bind(this)
|
|
760
768
|
), this.transformRoot = new Se("root", this.scene);
|
|
761
|
-
const
|
|
769
|
+
const r = async () => {
|
|
762
770
|
if (!i.model)
|
|
763
771
|
throw new Error(
|
|
764
772
|
"Model container constructed with no URL. This is currently unsupported."
|
|
765
773
|
);
|
|
766
774
|
return this.assetContainer = await be(
|
|
767
775
|
i.model,
|
|
768
|
-
|
|
769
|
-
|
|
776
|
+
o,
|
|
777
|
+
a
|
|
770
778
|
), this.initialized = !0, await this.instantiate(), this;
|
|
771
779
|
};
|
|
772
|
-
this.importPromise =
|
|
780
|
+
this.importPromise = r();
|
|
773
781
|
}
|
|
774
782
|
//#region Interface implementation
|
|
775
|
-
async applyMaterialVariant(e, t, i,
|
|
783
|
+
async applyMaterialVariant(e, t, i, s) {
|
|
776
784
|
if (!this.initialized) {
|
|
777
785
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
778
|
-
const
|
|
779
|
-
|
|
786
|
+
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
787
|
+
o == null || o.set(
|
|
780
788
|
t,
|
|
781
789
|
this.applyMaterialVariant.bind(
|
|
782
790
|
this,
|
|
783
791
|
e,
|
|
784
792
|
t,
|
|
785
793
|
i,
|
|
786
|
-
|
|
794
|
+
s
|
|
787
795
|
)
|
|
788
796
|
);
|
|
789
797
|
} else {
|
|
@@ -791,54 +799,54 @@ class it {
|
|
|
791
799
|
e,
|
|
792
800
|
/* @__PURE__ */ new Map()
|
|
793
801
|
);
|
|
794
|
-
const
|
|
795
|
-
|
|
802
|
+
const o = this.materialReadyToLoadCallbacks.get(e);
|
|
803
|
+
o == null || o.set(
|
|
796
804
|
t,
|
|
797
805
|
this.applyMaterialVariant.bind(
|
|
798
806
|
this,
|
|
799
807
|
e,
|
|
800
808
|
t,
|
|
801
809
|
i,
|
|
802
|
-
|
|
810
|
+
s
|
|
803
811
|
)
|
|
804
812
|
);
|
|
805
813
|
}
|
|
806
814
|
return;
|
|
807
815
|
}
|
|
808
|
-
const
|
|
816
|
+
const a = async () => {
|
|
809
817
|
await this.variantManager.applyMaterial(
|
|
810
818
|
e,
|
|
811
819
|
i,
|
|
812
|
-
(
|
|
820
|
+
(o, r, l) => {
|
|
813
821
|
this.materialVariantObservable.notifyObservers({
|
|
814
|
-
remainingCount:
|
|
815
|
-
totalCount:
|
|
822
|
+
remainingCount: o,
|
|
823
|
+
totalCount: r,
|
|
816
824
|
taskName: l
|
|
817
825
|
});
|
|
818
826
|
},
|
|
819
|
-
|
|
827
|
+
s
|
|
820
828
|
);
|
|
821
829
|
};
|
|
822
830
|
if (this.materialChangesInProgress.includes(e)) {
|
|
823
831
|
if (this.queuedMaterialChanges.has(e)) {
|
|
824
|
-
const
|
|
825
|
-
|
|
832
|
+
const o = this.queuedMaterialChanges.get(e);
|
|
833
|
+
o == null || o.set(t, a);
|
|
826
834
|
} else {
|
|
827
835
|
this.queuedMaterialChanges.set(
|
|
828
836
|
e,
|
|
829
837
|
/* @__PURE__ */ new Map()
|
|
830
838
|
);
|
|
831
|
-
const
|
|
832
|
-
|
|
839
|
+
const o = this.queuedMaterialChanges.get(e);
|
|
840
|
+
o == null || o.set(t, a);
|
|
833
841
|
}
|
|
834
842
|
return;
|
|
835
843
|
}
|
|
836
|
-
if (this.materialChangesInProgress.push(e), await
|
|
837
|
-
const
|
|
838
|
-
if (!
|
|
844
|
+
if (this.materialChangesInProgress.push(e), await a(), this.queuedMaterialChanges.has(e)) {
|
|
845
|
+
const o = this.queuedMaterialChanges.get(e);
|
|
846
|
+
if (!o)
|
|
839
847
|
throw new Error("Target material is undefined");
|
|
840
|
-
|
|
841
|
-
await
|
|
848
|
+
o.forEach(async (r) => {
|
|
849
|
+
await r();
|
|
842
850
|
}), this.queuedMaterialChanges.delete(e);
|
|
843
851
|
}
|
|
844
852
|
this.materialChangesInProgress.splice(
|
|
@@ -859,56 +867,66 @@ class it {
|
|
|
859
867
|
);
|
|
860
868
|
return;
|
|
861
869
|
}
|
|
862
|
-
const
|
|
870
|
+
const s = () => this.variantManager.applyModel(
|
|
863
871
|
e,
|
|
864
872
|
i,
|
|
865
873
|
t == null ? void 0 : t.model,
|
|
866
|
-
(
|
|
874
|
+
(r) => {
|
|
867
875
|
this.modelVariantObservable.notifyObservers({
|
|
868
|
-
...
|
|
876
|
+
...r,
|
|
869
877
|
key: e
|
|
870
878
|
});
|
|
871
879
|
}
|
|
872
880
|
);
|
|
873
881
|
if (this.modelChangesInProgress.includes(e)) {
|
|
874
|
-
this.queuedModelChanges.set(e,
|
|
882
|
+
this.queuedModelChanges.set(e, s);
|
|
875
883
|
return;
|
|
876
884
|
}
|
|
877
|
-
const
|
|
885
|
+
const o = await (async () => {
|
|
878
886
|
this.modelChangesInProgress.push(e);
|
|
879
|
-
let
|
|
887
|
+
let r = await s();
|
|
880
888
|
if (this.queuedModelChanges.has(e)) {
|
|
881
889
|
const l = this.queuedModelChanges.get(e);
|
|
882
890
|
if (!l)
|
|
883
891
|
throw new Error("Queued change resolved undefined");
|
|
884
|
-
|
|
892
|
+
r = await l(), this.queuedModelChanges.delete(e);
|
|
885
893
|
}
|
|
886
894
|
return this.modelChangesInProgress.splice(
|
|
887
895
|
this.modelChangesInProgress.indexOf(e),
|
|
888
896
|
1
|
|
889
|
-
),
|
|
897
|
+
), r;
|
|
890
898
|
})();
|
|
891
|
-
this.modelInstance && ve(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService),
|
|
899
|
+
this.modelInstance && ve(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
|
|
892
900
|
}
|
|
893
901
|
dispose() {
|
|
894
902
|
var e;
|
|
895
903
|
this.destroyInstance(), this.variantManager.dispose(), this.dynamicTextures.forEach((t) => t == null ? void 0 : t.dispose()), this.dynamicTextures.clear(), this.materials.forEach((t) => t && (t == null ? void 0 : t.dispose())), this.materials = [], (e = this.transformRoot) == null || e.dispose(), this.transformRoot = void 0, this.previewService.modelUnloaded(this);
|
|
896
904
|
}
|
|
897
905
|
executeAnimation(e) {
|
|
898
|
-
if (!this.previewService.getInitializationComplete())
|
|
899
|
-
this.queuedModelAnimation = e;
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
906
|
+
if (!this.previewService.getInitializationComplete())
|
|
907
|
+
return this.queuedModelAnimation = e, Promise.resolve();
|
|
908
|
+
if (!this.modelInstance)
|
|
909
|
+
return Promise.resolve();
|
|
910
|
+
let t = () => {
|
|
911
|
+
};
|
|
912
|
+
const i = async () => {
|
|
913
|
+
this.isExecutingAnimation = !0, await new Promise((s) => {
|
|
914
|
+
We(
|
|
915
|
+
[
|
|
916
|
+
...this.modelInstance.animationGroups,
|
|
917
|
+
...this.variantManager.getAnimationGroups()
|
|
918
|
+
],
|
|
919
|
+
e.loop,
|
|
920
|
+
e.to,
|
|
921
|
+
e.from,
|
|
922
|
+
e.name ? this.renameClonedAsset(e.name) : void 0,
|
|
923
|
+
s
|
|
924
|
+
);
|
|
925
|
+
}), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
926
|
+
};
|
|
927
|
+
return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((s) => {
|
|
928
|
+
t = s;
|
|
929
|
+
})) : i();
|
|
912
930
|
}
|
|
913
931
|
getAnimations(e) {
|
|
914
932
|
return [
|
|
@@ -952,7 +970,7 @@ class it {
|
|
|
952
970
|
set position(e) {
|
|
953
971
|
if (!this.transformRoot)
|
|
954
972
|
throw new Error("ModelContainer disposed prior to setting position!");
|
|
955
|
-
this.transformRoot.position = new
|
|
973
|
+
this.transformRoot.position = new g(e.x, e.y, e.z);
|
|
956
974
|
}
|
|
957
975
|
get rotation() {
|
|
958
976
|
var e;
|
|
@@ -977,7 +995,7 @@ class it {
|
|
|
977
995
|
set scale(e) {
|
|
978
996
|
if (!this.transformRoot)
|
|
979
997
|
throw new Error("ModelContainer disposed prior to setting scale!");
|
|
980
|
-
this.transformRoot.scaling = new
|
|
998
|
+
this.transformRoot.scaling = new g(e.x, e.y, e.z);
|
|
981
999
|
}
|
|
982
1000
|
//#endregion
|
|
983
1001
|
//#region Custom implementation functions
|
|
@@ -985,8 +1003,8 @@ class it {
|
|
|
985
1003
|
e.rootNodes.forEach((t) => {
|
|
986
1004
|
t.getChildMeshes(!1).forEach((i) => {
|
|
987
1005
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
|
|
988
|
-
new re(R.OnPointerOverTrigger, (
|
|
989
|
-
|
|
1006
|
+
new re(R.OnPointerOverTrigger, (s) => {
|
|
1007
|
+
s.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
990
1008
|
id: i.material.id,
|
|
991
1009
|
name: this.stripIdFromName(i.material.name)
|
|
992
1010
|
});
|
|
@@ -1025,16 +1043,16 @@ class it {
|
|
|
1025
1043
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1026
1044
|
}
|
|
1027
1045
|
configureModelInstance(e) {
|
|
1028
|
-
var
|
|
1046
|
+
var a;
|
|
1029
1047
|
if (!this.transformRoot)
|
|
1030
1048
|
throw new Error(
|
|
1031
1049
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1032
1050
|
);
|
|
1033
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1034
|
-
this.transformRoot.position =
|
|
1035
|
-
for (const
|
|
1036
|
-
|
|
1037
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1051
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, s = this.transformRoot.scaling;
|
|
1052
|
+
this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = g.One();
|
|
1053
|
+
for (const o of e.rootNodes)
|
|
1054
|
+
o.parent = this.transformRoot;
|
|
1055
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((a = this.contextService) == null ? void 0 : a.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1038
1056
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1039
1057
|
this.scene,
|
|
1040
1058
|
this.canvasPanels,
|
|
@@ -1078,8 +1096,8 @@ class it {
|
|
|
1078
1096
|
var e;
|
|
1079
1097
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1080
1098
|
(t, i) => {
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1099
|
+
const s = this.dynamicTextures.get(i);
|
|
1100
|
+
s && t.getStaticContextDirty() && s.isReady() && (s.update(!1), t.setStaticContextDirty(!1));
|
|
1083
1101
|
}
|
|
1084
1102
|
);
|
|
1085
1103
|
}
|
|
@@ -1114,17 +1132,17 @@ class it {
|
|
|
1114
1132
|
//#endregion
|
|
1115
1133
|
}
|
|
1116
1134
|
class B extends ge {
|
|
1117
|
-
constructor(e, t, i,
|
|
1135
|
+
constructor(e, t, i, s, a, o, r, l) {
|
|
1118
1136
|
super(
|
|
1119
1137
|
e,
|
|
1120
1138
|
t,
|
|
1121
1139
|
i,
|
|
1122
|
-
|
|
1123
|
-
o,
|
|
1140
|
+
s,
|
|
1124
1141
|
a,
|
|
1142
|
+
o,
|
|
1125
1143
|
l
|
|
1126
|
-
), this.lastFocus = new
|
|
1127
|
-
|
|
1144
|
+
), this.lastFocus = new g(0, 0, 0), this.panDenominator = 1, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, r.camera.autoOrientation && (this.alpha += Math.PI), r && (r.camera.limits.min.beta && (this.lowerBetaLimit = r.camera.limits.min.beta), r.camera.limits.max.beta && (this.upperBetaLimit = r.camera.limits.max.beta), r.camera.limits.min.alpha && (this.lowerAlphaLimit = r.camera.limits.min.alpha), r.camera.limits.max.alpha && (this.upperAlphaLimit = r.camera.limits.max.alpha), r.camera.limits.min.radius && (this.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.upperRadiusLimit = r.camera.limits.max.radius), r.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1145
|
+
r.camera.autoRotation.idleTimeMs
|
|
1128
1146
|
));
|
|
1129
1147
|
}
|
|
1130
1148
|
/**
|
|
@@ -1161,14 +1179,14 @@ class B extends ge {
|
|
|
1161
1179
|
rerunFramingBehavior(e, t) {
|
|
1162
1180
|
const i = this.getFramingBehavior();
|
|
1163
1181
|
i.framingTime = t || 800;
|
|
1164
|
-
const
|
|
1182
|
+
const s = () => {
|
|
1165
1183
|
e && e();
|
|
1166
|
-
},
|
|
1167
|
-
this.
|
|
1168
|
-
|
|
1169
|
-
|
|
1184
|
+
}, a = E(this._scene), o = a.max.subtract(a.min), r = a.min.add(o.scale(0.5));
|
|
1185
|
+
this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(r), this.panDenominator = o.length(), i.zoomOnBoundingInfo(
|
|
1186
|
+
a.min,
|
|
1187
|
+
a.max,
|
|
1170
1188
|
void 0,
|
|
1171
|
-
|
|
1189
|
+
s
|
|
1172
1190
|
), i.framingTime = 0;
|
|
1173
1191
|
}
|
|
1174
1192
|
/**
|
|
@@ -1187,8 +1205,8 @@ class B extends ge {
|
|
|
1187
1205
|
disableAutoRotationBehavior() {
|
|
1188
1206
|
this.useAutoRotationBehavior = !1;
|
|
1189
1207
|
}
|
|
1190
|
-
|
|
1191
|
-
this.
|
|
1208
|
+
updateRadiusBounds(e) {
|
|
1209
|
+
this.maxZ = e * 1e3, this.lowerRadiusLimit = e * 0.01, this.upperRadiusLimit = 1.5 * e, this.wheelPrecision = 100 / e, this.pinchPrecision = 300 / e;
|
|
1192
1210
|
}
|
|
1193
1211
|
/**
|
|
1194
1212
|
* A static function used to instantiate a single product camera instance on a scene. This camera will assume
|
|
@@ -1198,30 +1216,30 @@ class B extends ge {
|
|
|
1198
1216
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1199
1217
|
*/
|
|
1200
1218
|
static create(e, t, i) {
|
|
1201
|
-
const
|
|
1219
|
+
const s = E(e), a = s.max.subtract(s.min), o = s.min.add(a.scale(0.5)), r = new B(
|
|
1202
1220
|
"ProductCamera",
|
|
1203
1221
|
-(Math.PI / 2),
|
|
1204
1222
|
Math.PI / 2,
|
|
1205
|
-
|
|
1206
|
-
|
|
1223
|
+
a.length() * 1.5,
|
|
1224
|
+
o,
|
|
1207
1225
|
e,
|
|
1208
1226
|
t
|
|
1209
1227
|
);
|
|
1210
|
-
return
|
|
1211
|
-
|
|
1212
|
-
}), i && (e.activeCamera =
|
|
1228
|
+
return r.panningInertia = 0, r.panningOriginTarget.copyFrom(o), r.panDenominator = a.length(), r.onAfterCheckInputsObservable.add(() => {
|
|
1229
|
+
r.panningSensibility = 1e3 / r.panDenominator;
|
|
1230
|
+
}), i && (e.activeCamera = r), r;
|
|
1213
1231
|
}
|
|
1214
1232
|
}
|
|
1215
|
-
function E(
|
|
1216
|
-
if (
|
|
1233
|
+
function E(n) {
|
|
1234
|
+
if (n.meshes.length === 0)
|
|
1217
1235
|
return {
|
|
1218
|
-
min: new
|
|
1219
|
-
max: new
|
|
1236
|
+
min: new g(-1, -1, -1),
|
|
1237
|
+
max: new g(1, 1, 1)
|
|
1220
1238
|
};
|
|
1221
|
-
const e =
|
|
1222
|
-
return
|
|
1239
|
+
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1240
|
+
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1223
1241
|
}
|
|
1224
|
-
class
|
|
1242
|
+
class nt {
|
|
1225
1243
|
constructor(e, t = !1, i = void 0) {
|
|
1226
1244
|
this.renderingPipeline = new Ve(
|
|
1227
1245
|
"default",
|
|
@@ -1230,7 +1248,7 @@ class st {
|
|
|
1230
1248
|
i ? [i] : void 0,
|
|
1231
1249
|
!1
|
|
1232
1250
|
// Disable automatic build
|
|
1233
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1251
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(c));
|
|
1234
1252
|
}
|
|
1235
1253
|
dispose() {
|
|
1236
1254
|
this.renderingPipeline.dispose();
|
|
@@ -1239,16 +1257,16 @@ class st {
|
|
|
1239
1257
|
return this.currentConfiguration;
|
|
1240
1258
|
}
|
|
1241
1259
|
setConfiguration(e) {
|
|
1242
|
-
var t, i,
|
|
1260
|
+
var t, i, s, a, o, r, l, d, h, u, m, p, f, D, k, z, V, q, N, G, H, _, K, W, U, Y, Q, Z, $, j, X, J, ee;
|
|
1243
1261
|
if (this.renderingPipeline.isSupported) {
|
|
1244
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ??
|
|
1262
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? c.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? c.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((s = e.bloom) == null ? void 0 : s.enabled) ?? c.bloom.enabled, this.renderingPipeline.bloomKernel = ((a = e.bloom) == null ? void 0 : a.kernel) ?? c.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? c.bloom.scale, this.renderingPipeline.bloomThreshold = ((r = e.bloom) == null ? void 0 : r.threshold) ?? c.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? c.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((d = e.chromaticAberration) == null ? void 0 : d.enabled) ?? c.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? c.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? c.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ie(
|
|
1245
1263
|
e.chromaticAberration.direction.x,
|
|
1246
1264
|
e.chromaticAberration.direction.y
|
|
1247
1265
|
) : new ie(
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ??
|
|
1251
|
-
switch (e.depthOfField.blurLevel ??
|
|
1266
|
+
c.chromaticAberration.direction.x,
|
|
1267
|
+
c.chromaticAberration.direction.y
|
|
1268
|
+
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? c.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new ae(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? c.depthOfField.enabled, e.depthOfField)
|
|
1269
|
+
switch (e.depthOfField.blurLevel ?? c.depthOfField.blurLevel) {
|
|
1252
1270
|
case "Low":
|
|
1253
1271
|
this.renderingPipeline.depthOfFieldBlurLevel = T.Low;
|
|
1254
1272
|
break;
|
|
@@ -1259,35 +1277,35 @@ class st {
|
|
|
1259
1277
|
this.renderingPipeline.depthOfFieldBlurLevel = T.High;
|
|
1260
1278
|
break;
|
|
1261
1279
|
}
|
|
1262
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ??
|
|
1263
|
-
switch (e.misc.toneMappingType ??
|
|
1280
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ?? c.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((k = e.depthOfField) == null ? void 0 : k.fStop) ?? c.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((z = e.depthOfField) == null ? void 0 : z.focusDistance) ?? c.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? c.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((q = e.grain) == null ? void 0 : q.enabled) ?? c.grain.enabled, this.renderingPipeline.grain.animated = ((N = e.grain) == null ? void 0 : N.animated) ?? c.grain.animated, this.renderingPipeline.grain.intensity = ((G = e.grain) == null ? void 0 : G.intensity) ?? c.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? c.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((_ = e.misc) == null ? void 0 : _.exposure) ?? c.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((K = e.misc) == null ? void 0 : K.toneMappingEnabled) ?? c.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1281
|
+
switch (e.misc.toneMappingType ?? c.misc.toneMappingType) {
|
|
1264
1282
|
case "Standard":
|
|
1265
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1283
|
+
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1266
1284
|
break;
|
|
1267
1285
|
case "ACES":
|
|
1268
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1286
|
+
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1269
1287
|
break;
|
|
1270
1288
|
}
|
|
1271
|
-
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ??
|
|
1272
|
-
switch ((($ = e.vignette) == null ? void 0 : $.blendMode) ??
|
|
1289
|
+
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? c.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((U = e.sharpen) == null ? void 0 : U.colorAmount) ?? c.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Y = e.sharpen) == null ? void 0 : Y.edgeAmount) ?? c.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Q = e.vignette) == null ? void 0 : Q.enabled) ?? c.vignette.enabled, (Z = e.vignette) != null && Z.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = c.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = c.vignette.center.y), e.vignette)
|
|
1290
|
+
switch ((($ = e.vignette) == null ? void 0 : $.blendMode) ?? c.vignette.blendMode) {
|
|
1273
1291
|
case "Multiply":
|
|
1274
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1292
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1275
1293
|
break;
|
|
1276
1294
|
case "Opaque":
|
|
1277
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1295
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_OPAQUE;
|
|
1278
1296
|
break;
|
|
1279
1297
|
}
|
|
1280
|
-
(j = e.vignette) != null && j.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new
|
|
1298
|
+
(j = e.vignette) != null && j.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1281
1299
|
e.vignette.colorRgba.r,
|
|
1282
1300
|
e.vignette.colorRgba.g,
|
|
1283
1301
|
e.vignette.colorRgba.b,
|
|
1284
1302
|
e.vignette.colorRgba.a
|
|
1285
|
-
) : (X = e.vignette) != null && X.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor =
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((J = e.vignette) == null ? void 0 : J.stretch) ??
|
|
1303
|
+
) : (X = e.vignette) != null && X.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
|
|
1304
|
+
c.vignette.colorRgba.r,
|
|
1305
|
+
c.vignette.colorRgba.g,
|
|
1306
|
+
c.vignette.colorRgba.b,
|
|
1307
|
+
c.vignette.colorRgba.a
|
|
1308
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((J = e.vignette) == null ? void 0 : J.stretch) ?? c.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ee = e.vignette) == null ? void 0 : ee.weight) ?? c.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1291
1309
|
}
|
|
1292
1310
|
}
|
|
1293
1311
|
updateColorCurve(e) {
|
|
@@ -1295,44 +1313,44 @@ class st {
|
|
|
1295
1313
|
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;
|
|
1296
1314
|
}
|
|
1297
1315
|
}
|
|
1298
|
-
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(
|
|
1299
|
-
return new Ne(
|
|
1316
|
+
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1317
|
+
return new Ne(n);
|
|
1300
1318
|
});
|
|
1301
|
-
fe.OnPluginActivatedObservable.add((
|
|
1302
|
-
if (
|
|
1303
|
-
const e =
|
|
1319
|
+
fe.OnPluginActivatedObservable.add((n) => {
|
|
1320
|
+
if (n.name === "gltf") {
|
|
1321
|
+
const e = n;
|
|
1304
1322
|
e.transparencyAsCoverage = !0;
|
|
1305
1323
|
}
|
|
1306
1324
|
});
|
|
1307
|
-
function O(
|
|
1308
|
-
return new
|
|
1325
|
+
function O(n) {
|
|
1326
|
+
return new g(n.x, n.y, n.z);
|
|
1309
1327
|
}
|
|
1310
|
-
function L(
|
|
1311
|
-
return { x:
|
|
1328
|
+
function L(n) {
|
|
1329
|
+
return { x: n.x, y: n.y, z: n.z };
|
|
1312
1330
|
}
|
|
1313
1331
|
class Wt {
|
|
1314
1332
|
constructor(e) {
|
|
1315
1333
|
var l;
|
|
1316
|
-
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.
|
|
1317
|
-
this.engine.views && (this.modelContainers.forEach((
|
|
1318
|
-
|
|
1334
|
+
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
|
|
1335
|
+
this.engine.views && (this.modelContainers.forEach((d) => {
|
|
1336
|
+
d.updateDynamicTextures();
|
|
1319
1337
|
}), this.scene.render(), !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, 0.1) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0));
|
|
1320
1338
|
}, this.configuration = new oe(e);
|
|
1321
1339
|
const i = (() => {
|
|
1322
1340
|
if (!(e != null && e.noRender))
|
|
1323
1341
|
return this.configuration.createCanvas();
|
|
1324
|
-
})(),
|
|
1342
|
+
})(), s = "1.5.6";
|
|
1325
1343
|
Me.Configuration = {
|
|
1326
1344
|
decoder: {
|
|
1327
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1328
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1329
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1345
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_wasm_wrapper_gltf.js`,
|
|
1346
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.wasm`,
|
|
1347
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.js`
|
|
1330
1348
|
}
|
|
1331
1349
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1332
|
-
const
|
|
1350
|
+
const a = console.log;
|
|
1333
1351
|
console.log = () => {
|
|
1334
1352
|
};
|
|
1335
|
-
const
|
|
1353
|
+
const o = i ? new pe(i, !0, {
|
|
1336
1354
|
adaptToDeviceRatio: !0,
|
|
1337
1355
|
limitDeviceRatio: 2,
|
|
1338
1356
|
premultipliedAlpha: !1,
|
|
@@ -1341,23 +1359,23 @@ class Wt {
|
|
|
1341
1359
|
stencil: this.configuration.highlights.enabled,
|
|
1342
1360
|
forceSRGBBufferSupportState: !0
|
|
1343
1361
|
}) : new Ce();
|
|
1344
|
-
console.log =
|
|
1362
|
+
console.log = a, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Pe(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = B.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
|
|
1345
1363
|
this.scene,
|
|
1346
1364
|
!1,
|
|
1347
1365
|
this.camera
|
|
1348
1366
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1349
|
-
const
|
|
1367
|
+
const r = te.CreateFromPrefilteredData(
|
|
1350
1368
|
this.configuration.scene.environment.file,
|
|
1351
1369
|
this.scene
|
|
1352
1370
|
);
|
|
1353
|
-
|
|
1371
|
+
r.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = r, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1354
1372
|
this.configuration.options.renderingPipelineConfiguration
|
|
1355
|
-
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new
|
|
1373
|
+
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
|
|
1356
1374
|
this.scene,
|
|
1357
1375
|
this.configuration.emissiveGlowIntensity
|
|
1358
|
-
), this.initPromise = new Promise((
|
|
1376
|
+
), this.initPromise = new Promise((d) => {
|
|
1359
1377
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1360
|
-
this.initComplete = !0,
|
|
1378
|
+
this.initComplete = !0, d();
|
|
1361
1379
|
});
|
|
1362
1380
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1363
1381
|
}
|
|
@@ -1402,18 +1420,20 @@ class Wt {
|
|
|
1402
1420
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1403
1421
|
}
|
|
1404
1422
|
executeCameraAnimation(e) {
|
|
1405
|
-
if (!this.camera || this.scene.activeCamera !== this.camera)
|
|
1406
|
-
this.queuedCameraAnimation = e;
|
|
1407
|
-
|
|
1408
|
-
}
|
|
1409
|
-
const
|
|
1410
|
-
this.
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1423
|
+
if (!this.camera || this.scene.activeCamera !== this.camera)
|
|
1424
|
+
return this.queuedCameraAnimation = e, Promise.resolve();
|
|
1425
|
+
let t = () => {
|
|
1426
|
+
};
|
|
1427
|
+
const i = async () => {
|
|
1428
|
+
this.isAnimatingCamera = !0, await Ye(
|
|
1429
|
+
this.scene,
|
|
1430
|
+
this.scene.activeCamera,
|
|
1431
|
+
e
|
|
1432
|
+
), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
|
|
1433
|
+
};
|
|
1434
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((s) => {
|
|
1435
|
+
t = s;
|
|
1436
|
+
})) : i();
|
|
1417
1437
|
}
|
|
1418
1438
|
getCameraPose() {
|
|
1419
1439
|
if (this.scene && this.camera)
|
|
@@ -1429,7 +1449,7 @@ class Wt {
|
|
|
1429
1449
|
};
|
|
1430
1450
|
}
|
|
1431
1451
|
setCameraPose(e) {
|
|
1432
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1452
|
+
this.scene && this.camera && (this.camera.target = new g(
|
|
1433
1453
|
e.target.x,
|
|
1434
1454
|
e.target.y,
|
|
1435
1455
|
e.target.z
|
|
@@ -1444,16 +1464,22 @@ class Wt {
|
|
|
1444
1464
|
e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1445
1465
|
}
|
|
1446
1466
|
animateToLastCameraFocus() {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1467
|
+
let e = () => {
|
|
1468
|
+
};
|
|
1469
|
+
const t = async () => {
|
|
1470
|
+
this.isAnimatingCamera = !0, await new Promise((i) => {
|
|
1471
|
+
const s = () => {
|
|
1472
|
+
const a = this.configuration;
|
|
1473
|
+
this.camera.rerunFramingBehavior(() => {
|
|
1474
|
+
this.focusLostNotified = !1, a.camera.limits.min.radius && (this.camera.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.camera.upperRadiusLimit = a.camera.limits.max.radius), i();
|
|
1475
|
+
});
|
|
1476
|
+
};
|
|
1477
|
+
this.scene.onAfterRenderObservable.addOnce(s);
|
|
1478
|
+
}), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
|
|
1479
|
+
};
|
|
1480
|
+
return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
|
|
1481
|
+
e = i;
|
|
1482
|
+
})) : t();
|
|
1457
1483
|
}
|
|
1458
1484
|
setAutoRotation(e) {
|
|
1459
1485
|
!this.configuration.camera.autoRotation.enabled || !this.camera || (e ? this.camera.enableAutoRotationBehavior(
|
|
@@ -1471,13 +1497,13 @@ class Wt {
|
|
|
1471
1497
|
0,
|
|
1472
1498
|
0,
|
|
1473
1499
|
0,
|
|
1474
|
-
|
|
1500
|
+
g.Zero(),
|
|
1475
1501
|
this.scene
|
|
1476
1502
|
);
|
|
1477
1503
|
try {
|
|
1478
|
-
const
|
|
1479
|
-
i.target = t.target ? new
|
|
1480
|
-
const
|
|
1504
|
+
const s = t.latDeg * Math.PI / 180, a = t.lonDeg * Math.PI / 180;
|
|
1505
|
+
i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = a, i.beta = s, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1506
|
+
const o = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1481
1507
|
this.engine,
|
|
1482
1508
|
i,
|
|
1483
1509
|
e,
|
|
@@ -1485,7 +1511,7 @@ class Wt {
|
|
|
1485
1511
|
2,
|
|
1486
1512
|
!0
|
|
1487
1513
|
);
|
|
1488
|
-
return i.dispose(),
|
|
1514
|
+
return i.dispose(), o;
|
|
1489
1515
|
} catch {
|
|
1490
1516
|
throw i.isDisposed() || i.dispose(), new Error("Failed to render screenshot");
|
|
1491
1517
|
}
|
|
@@ -1494,32 +1520,32 @@ class Wt {
|
|
|
1494
1520
|
const e = this.configuration;
|
|
1495
1521
|
if (!e)
|
|
1496
1522
|
return !0;
|
|
1497
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1498
|
-
if (t === void 0 || i === void 0 ||
|
|
1523
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, s = e.camera.limits.min.beta, a = e.camera.limits.max.beta;
|
|
1524
|
+
if (t === void 0 || i === void 0 || s === void 0 || a === void 0)
|
|
1499
1525
|
return !0;
|
|
1500
|
-
const
|
|
1501
|
-
return !l && !
|
|
1526
|
+
const o = [t, i], r = [s, a], l = o.every((h) => h === t), d = r.every((h) => h === s);
|
|
1527
|
+
return !l && !d;
|
|
1502
1528
|
}
|
|
1503
1529
|
fireResizeEvent() {
|
|
1504
1530
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1505
1531
|
}
|
|
1506
1532
|
setHighlights(e, t) {
|
|
1507
|
-
var
|
|
1508
|
-
e.length === 0 && ((
|
|
1533
|
+
var s;
|
|
1534
|
+
e.length === 0 && ((s = this.highlightLayer) == null || s.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1509
1535
|
isStroke: !0,
|
|
1510
1536
|
blurVerticalSize: 0.85,
|
|
1511
1537
|
blurHorizontalSize: 0.85
|
|
1512
1538
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1513
1539
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1514
|
-
e.forEach((
|
|
1515
|
-
const
|
|
1516
|
-
(
|
|
1540
|
+
e.forEach((a) => {
|
|
1541
|
+
const o = this.scene.materials.find(
|
|
1542
|
+
(r) => r.name === a.name && r.id === a.id
|
|
1517
1543
|
);
|
|
1518
|
-
|
|
1519
|
-
(
|
|
1544
|
+
o && o.getBindedMeshes().forEach(
|
|
1545
|
+
(r) => {
|
|
1520
1546
|
var l;
|
|
1521
1547
|
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1522
|
-
|
|
1548
|
+
r,
|
|
1523
1549
|
i || w.FromHexString("#fcba03")
|
|
1524
1550
|
);
|
|
1525
1551
|
}
|
|
@@ -1539,8 +1565,8 @@ class Wt {
|
|
|
1539
1565
|
});
|
|
1540
1566
|
return i.getInitializationPromise().then(() => {
|
|
1541
1567
|
this.modelContainers.size <= 1 && this.camera.rerunFramingBehavior(void 0, 1), Ue(this.scene), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0);
|
|
1542
|
-
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1543
|
-
this.setHighlights([
|
|
1568
|
+
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((s) => {
|
|
1569
|
+
this.setHighlights([s]);
|
|
1544
1570
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1545
1571
|
this.setHighlights([]);
|
|
1546
1572
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1563,7 +1589,7 @@ class Wt {
|
|
|
1563
1589
|
}
|
|
1564
1590
|
unregisterPlugin(e) {
|
|
1565
1591
|
const t = this.plugins.indexOf(e);
|
|
1566
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1592
|
+
t > -1 && this.plugins.splice(t, 1).forEach((s) => s.dispose(!1));
|
|
1567
1593
|
}
|
|
1568
1594
|
getGlowLayerManager() {
|
|
1569
1595
|
return this.glowLayerManager;
|
|
@@ -1581,28 +1607,28 @@ class Wt {
|
|
|
1581
1607
|
* Flips a transform around the origin.
|
|
1582
1608
|
*/
|
|
1583
1609
|
flipTransform(e, t, i) {
|
|
1584
|
-
const
|
|
1610
|
+
const s = ne.Compose(
|
|
1585
1611
|
O(i || { x: 1, y: 1, z: 1 }),
|
|
1586
1612
|
y.FromEulerVector(
|
|
1587
1613
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1588
1614
|
),
|
|
1589
1615
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1590
|
-
),
|
|
1591
|
-
return
|
|
1592
|
-
position: L(
|
|
1616
|
+
), a = ne.RotationAxis(g.Up(), Math.PI), o = s.multiply(a), r = g.Zero(), l = y.Identity(), d = g.Zero();
|
|
1617
|
+
return o.decompose(d, l, r), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1618
|
+
position: L(r),
|
|
1593
1619
|
rotation: L(l.toEulerAngles()),
|
|
1594
|
-
scale: L(
|
|
1620
|
+
scale: L(d)
|
|
1595
1621
|
};
|
|
1596
1622
|
}
|
|
1597
1623
|
updatePreviewOptions(e) {
|
|
1598
|
-
var
|
|
1624
|
+
var s;
|
|
1599
1625
|
const t = new oe(e);
|
|
1600
1626
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1601
1627
|
let i = this.scene.environmentTexture;
|
|
1602
1628
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = te.CreateFromPrefilteredData(
|
|
1603
1629
|
t.scene.environment.file,
|
|
1604
1630
|
this.scene
|
|
1605
|
-
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (
|
|
1631
|
+
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (s = t.options) != null && s.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1606
1632
|
t.options.renderingPipelineConfiguration
|
|
1607
1633
|
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.configuration = t;
|
|
1608
1634
|
}
|
|
@@ -1623,8 +1649,8 @@ class Wt {
|
|
|
1623
1649
|
export {
|
|
1624
1650
|
S as MaterialEffectMode,
|
|
1625
1651
|
I as ProductCameraRig,
|
|
1626
|
-
|
|
1627
|
-
|
|
1652
|
+
qe as REFLECTION_PROBE_RESOLUTION,
|
|
1653
|
+
x as RenderingConfiguration,
|
|
1628
1654
|
Wt as SpiffCommerce3DPreviewService,
|
|
1629
|
-
|
|
1655
|
+
c as renderingPipelineDefaults
|
|
1630
1656
|
};
|