@spiffcommerce/preview 5.3.5-3 → 5.3.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -0
- package/dist/index.esm.js +289 -280
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -13,22 +13,22 @@ 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 Te } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
-
import { Color3 as
|
|
16
|
+
import { Color3 as Re, Vector3 as ne, Plane as Ee } from "@babylonjs/core/Maths/math";
|
|
17
17
|
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
|
-
import { GlowLayer as
|
|
18
|
+
import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
|
|
19
19
|
import { ActionManager as T } from "@babylonjs/core/Actions/actionManager";
|
|
20
20
|
import { ExecuteCodeAction as re } from "@babylonjs/core/Actions/directActions";
|
|
21
|
-
import { Mesh as
|
|
21
|
+
import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
|
|
22
22
|
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
23
23
|
import { DynamicTexture as Fe } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
24
24
|
import { Texture as Be } from "@babylonjs/core/Materials/Textures/texture";
|
|
25
25
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
26
|
-
import { QuadraticEase as De, EasingFunction as
|
|
27
|
-
import { AssetsManager as
|
|
26
|
+
import { QuadraticEase as De, EasingFunction as ke } from "@babylonjs/core/Animations/easing";
|
|
27
|
+
import { AssetsManager as ze } from "@babylonjs/core/Misc/assetsManager";
|
|
28
28
|
import { ColorCurves as ae } from "@babylonjs/core/Materials/colorCurves";
|
|
29
29
|
import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
30
|
-
import { DefaultRenderingPipeline as
|
|
31
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
30
|
+
import { DefaultRenderingPipeline as Ve } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
|
+
import { DepthOfFieldEffectBlurLevel as R } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
|
|
32
32
|
import "@babylonjs/core/Rendering/depthRendererSceneComponent";
|
|
33
33
|
import "@babylonjs/core/Engines/Extensions/engine.views";
|
|
34
34
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
@@ -39,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
|
|
42
|
+
var I = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(I || {}), S = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(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 && ((o = this.customOptions) != null && o.transparentBackground) || (
|
|
46
|
+
var i, r, o, a;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
|
|
48
|
+
if (this.customOptions && ((o = this.customOptions) != null && o.transparentBackground) || (a = this.customOptions) != null && a.backgroundImage)
|
|
49
49
|
return new f(0, 0, 0, t).toLinearSpace();
|
|
50
50
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
51
|
-
const
|
|
51
|
+
const n = w.FromHexString(
|
|
52
52
|
this.customOptions.backgroundColor
|
|
53
53
|
);
|
|
54
54
|
return new f(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
n.r,
|
|
56
|
+
n.g,
|
|
57
|
+
n.b,
|
|
58
58
|
t
|
|
59
59
|
).toLinearSpace();
|
|
60
60
|
}
|
|
61
61
|
return new f(0.98, 0.98, 0.98, t).toLinearSpace();
|
|
62
62
|
}, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new f(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
|
|
63
|
-
const
|
|
63
|
+
const r = w.FromHexString(t);
|
|
64
64
|
return new f(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
r.r,
|
|
66
|
+
r.g,
|
|
67
|
+
r.b,
|
|
68
68
|
i
|
|
69
69
|
).toLinearSpace();
|
|
70
70
|
}, this.customOptions = e;
|
|
@@ -80,13 +80,13 @@ 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, r, o;
|
|
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: ((
|
|
89
|
+
intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
|
|
90
90
|
rotationY: (((o = this.customOptions) == null ? void 0 : o.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
91
91
|
// Convert to radians
|
|
92
92
|
}
|
|
@@ -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, r, o, a, n, l, c, d, u, g, p;
|
|
100
100
|
return {
|
|
101
101
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
102
102
|
autoRotation: {
|
|
@@ -105,8 +105,8 @@ class oe {
|
|
|
105
105
|
},
|
|
106
106
|
limits: {
|
|
107
107
|
min: {
|
|
108
|
-
alpha: (
|
|
109
|
-
beta: (
|
|
108
|
+
alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((o = this.customOptions) == null ? void 0 : o.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
109
|
+
beta: (a = this.customOptions) != null && a.lowerBetaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
110
110
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
111
111
|
},
|
|
112
112
|
max: {
|
|
@@ -129,10 +129,10 @@ class oe {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
get lighting() {
|
|
132
|
-
var e, t, i,
|
|
132
|
+
var e, t, i, r;
|
|
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: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
get emissiveGlowIntensity() {
|
|
@@ -181,7 +181,7 @@ class x {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const Ge = 128, h = {
|
|
185
185
|
antiAliasing: {
|
|
186
186
|
samples: 4,
|
|
187
187
|
fxaaEnabled: !1
|
|
@@ -238,7 +238,7 @@ const ze = 128, h = {
|
|
|
238
238
|
weight: 1
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
|
-
class
|
|
241
|
+
class Ne {
|
|
242
242
|
constructor(e) {
|
|
243
243
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
244
244
|
}
|
|
@@ -253,11 +253,11 @@ class Ve {
|
|
|
253
253
|
return this.loader.loadNodeAsync(
|
|
254
254
|
e,
|
|
255
255
|
t,
|
|
256
|
-
function(
|
|
256
|
+
function(r) {
|
|
257
257
|
t.extras && Object.keys(t.extras).forEach((o) => {
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
}), i(
|
|
258
|
+
const a = t.extras[o];
|
|
259
|
+
r.metadata[o] = a;
|
|
260
|
+
}), i(r);
|
|
261
261
|
}
|
|
262
262
|
);
|
|
263
263
|
}
|
|
@@ -289,7 +289,7 @@ class Ve {
|
|
|
289
289
|
}
|
|
290
290
|
if (e.extras.translucency) {
|
|
291
291
|
const i = t;
|
|
292
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
292
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new Re(
|
|
293
293
|
e.extras.translucencyR,
|
|
294
294
|
e.extras.translucencyG,
|
|
295
295
|
e.extras.translucencyB
|
|
@@ -316,16 +316,16 @@ class Ve {
|
|
|
316
316
|
*/
|
|
317
317
|
applyReflections(e) {
|
|
318
318
|
function t(o) {
|
|
319
|
-
const
|
|
320
|
-
return o.transformNodes.forEach((
|
|
321
|
-
|
|
322
|
-
}), o.meshes.forEach((
|
|
323
|
-
|
|
324
|
-
}),
|
|
319
|
+
const a = [];
|
|
320
|
+
return o.transformNodes.forEach((n) => {
|
|
321
|
+
n.metadata && n.metadata.reflective && a.push(...n.getChildMeshes());
|
|
322
|
+
}), o.meshes.forEach((n) => {
|
|
323
|
+
n.metadata && n.metadata.reflective && !a.includes(n) && a.push(n);
|
|
324
|
+
}), a;
|
|
325
325
|
}
|
|
326
|
-
function i(o,
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
326
|
+
function i(o, a = 1) {
|
|
327
|
+
const n = o.material;
|
|
328
|
+
if (!n)
|
|
329
329
|
return;
|
|
330
330
|
const l = new Te(
|
|
331
331
|
"mirror",
|
|
@@ -343,27 +343,27 @@ class Ve {
|
|
|
343
343
|
const d = o.getWorldMatrix(), u = ne.TransformNormal(
|
|
344
344
|
new ne(c[0], c[1], c[2]),
|
|
345
345
|
d
|
|
346
|
-
).normalize(), g =
|
|
346
|
+
).normalize(), g = Ee.FromPositionAndNormal(
|
|
347
347
|
o.position,
|
|
348
348
|
u.scale(-1)
|
|
349
349
|
);
|
|
350
|
-
l.mirrorPlane = g, l.level =
|
|
350
|
+
l.mirrorPlane = g, l.level = a, n.reflectionTexture = l;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
const
|
|
354
|
-
"probe-" +
|
|
355
|
-
|
|
352
|
+
function r(o) {
|
|
353
|
+
const a = o.material, n = new Oe(
|
|
354
|
+
"probe-" + a.name,
|
|
355
|
+
Ge,
|
|
356
356
|
e
|
|
357
357
|
);
|
|
358
|
-
|
|
358
|
+
n.attachToMesh(o), n.renderList && n.renderList.push(...t(e)), a.reflectionTexture = n.cubeTexture;
|
|
359
359
|
}
|
|
360
360
|
e.meshes.forEach((o) => {
|
|
361
|
-
const
|
|
362
|
-
|
|
361
|
+
const a = o.metadata;
|
|
362
|
+
a && (a.mirrorTexture && i(o, a.mirrorTexture), a.reflectionProbe && r(o));
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
class
|
|
366
|
+
class He {
|
|
367
367
|
constructor(e, t) {
|
|
368
368
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
369
369
|
}
|
|
@@ -372,7 +372,7 @@ class qe {
|
|
|
372
372
|
}
|
|
373
373
|
includeMeshes(e) {
|
|
374
374
|
if (e) {
|
|
375
|
-
this.glowLayer || (this.glowLayer = new
|
|
375
|
+
this.glowLayer || (this.glowLayer = new Le("glow", this.scene), this.glowLayer.intensity = this.intensity);
|
|
376
376
|
for (const t of e)
|
|
377
377
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
378
378
|
}
|
|
@@ -391,30 +391,30 @@ async function be(s, e, t) {
|
|
|
391
391
|
if (i && i.scene.uid === e.uid)
|
|
392
392
|
return i;
|
|
393
393
|
{
|
|
394
|
-
const
|
|
394
|
+
const r = await fe.LoadAssetContainerAsync(
|
|
395
395
|
s,
|
|
396
396
|
void 0,
|
|
397
397
|
e,
|
|
398
398
|
t
|
|
399
399
|
);
|
|
400
|
-
return le.set(s,
|
|
400
|
+
return le.set(s, r), r;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function qe(s, e, t, i, r = "") {
|
|
404
404
|
t.forEach((o) => {
|
|
405
|
-
const
|
|
406
|
-
s.filter((d) => d.name ===
|
|
407
|
-
const u = i.get(
|
|
405
|
+
const a = o.getID(), n = o.getName(), l = x.getDynamicTextureResolution();
|
|
406
|
+
s.filter((d) => d.name === r + n).forEach((d) => {
|
|
407
|
+
const u = i.get(a), g = !1;
|
|
408
408
|
if (u)
|
|
409
409
|
he(d, u), u.update(g);
|
|
410
410
|
else {
|
|
411
411
|
const p = _e(
|
|
412
|
-
|
|
412
|
+
n,
|
|
413
413
|
e,
|
|
414
414
|
l.width,
|
|
415
415
|
l.height
|
|
416
416
|
);
|
|
417
|
-
i.set(
|
|
417
|
+
i.set(a, p), o.setStaticContext(
|
|
418
418
|
p.getContext()
|
|
419
419
|
), he(d, p), p.onLoadObservable.addOnce(() => {
|
|
420
420
|
p.update(g);
|
|
@@ -424,15 +424,15 @@ function He(s, e, t, i, a = "") {
|
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
426
|
function _e(s, e, t, i) {
|
|
427
|
-
const
|
|
427
|
+
const r = new Fe(
|
|
428
428
|
s,
|
|
429
429
|
{ width: t, height: i },
|
|
430
430
|
e,
|
|
431
431
|
x.shouldMipMap(),
|
|
432
432
|
Be.TRILINEAR_SAMPLINGMODE,
|
|
433
433
|
pe.TEXTUREFORMAT_RGBA
|
|
434
|
-
), o =
|
|
435
|
-
return o && (o.fillStyle = "#f5f5f5", o.fillRect(0, 0, t, i),
|
|
434
|
+
), o = r.getContext();
|
|
435
|
+
return o && (o.fillStyle = "#f5f5f5", o.fillRect(0, 0, t, i), r.update()), r;
|
|
436
436
|
}
|
|
437
437
|
function he(s, e) {
|
|
438
438
|
if (s instanceof F) {
|
|
@@ -443,7 +443,7 @@ function he(s, e) {
|
|
|
443
443
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function Ke() {
|
|
447
447
|
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
448
448
|
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
449
449
|
}
|
|
@@ -451,24 +451,24 @@ const M = 60, ce = 1;
|
|
|
451
451
|
function de(s) {
|
|
452
452
|
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
455
|
-
const o =
|
|
454
|
+
function We(s, e, t, i, r) {
|
|
455
|
+
const o = r ? s.filter((a) => a.name === r) : s;
|
|
456
456
|
if (o.length === 0) {
|
|
457
|
-
console.warn(`No animations found for name: ${
|
|
457
|
+
console.warn(`No animations found for name: ${r}`);
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
461
|
-
o.forEach((
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
|
|
461
|
+
o.forEach((a) => {
|
|
462
|
+
a.stop();
|
|
463
|
+
const n = de(a), l = i * n;
|
|
464
|
+
a.start(e, ce, l, l);
|
|
465
465
|
});
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
|
-
o.forEach((
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
468
|
+
o.forEach((a) => {
|
|
469
|
+
a.stop();
|
|
470
|
+
const n = de(a), l = i !== void 0 ? i * n : void 0, c = t !== void 0 ? t * n : void 0;
|
|
471
|
+
a.start(e, ce, l, c);
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
474
|
function ve(s) {
|
|
@@ -476,87 +476,89 @@ function ve(s) {
|
|
|
476
476
|
e.stop();
|
|
477
477
|
});
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function Ue(s) {
|
|
480
480
|
const e = s.animationGroups;
|
|
481
481
|
ve(e);
|
|
482
482
|
}
|
|
483
483
|
function Ye(s, e, t) {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
"cameraAlphaLerp",
|
|
502
|
-
"alpha",
|
|
503
|
-
e.alpha,
|
|
504
|
-
ue(t.lonDeg),
|
|
505
|
-
v.ANIMATIONTYPE_FLOAT,
|
|
506
|
-
n
|
|
507
|
-
)
|
|
508
|
-
), i.push(
|
|
509
|
-
A(
|
|
510
|
-
"cameraBetaLerp",
|
|
511
|
-
"beta",
|
|
512
|
-
e.beta,
|
|
513
|
-
ue(t.latDeg),
|
|
514
|
-
v.ANIMATIONTYPE_FLOAT,
|
|
515
|
-
n
|
|
516
|
-
)
|
|
517
|
-
), t.radius !== void 0) {
|
|
518
|
-
const c = Math.max(0.01, t.radius);
|
|
519
|
-
i.push(
|
|
484
|
+
return new Promise((i) => {
|
|
485
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
|
|
486
|
+
const r = [], o = t.target, a = 0, n = o ? 1 : 0;
|
|
487
|
+
if (t.target && Object.keys(t.target).length > 0 && r.push(
|
|
488
|
+
A(
|
|
489
|
+
"cameraTargetLerp",
|
|
490
|
+
"target",
|
|
491
|
+
new m().copyFrom(e.target),
|
|
492
|
+
new m(
|
|
493
|
+
t.target.x,
|
|
494
|
+
t.target.y,
|
|
495
|
+
t.target.z
|
|
496
|
+
),
|
|
497
|
+
v.ANIMATIONTYPE_VECTOR3,
|
|
498
|
+
a
|
|
499
|
+
)
|
|
500
|
+
), r.push(
|
|
520
501
|
A(
|
|
521
|
-
"
|
|
522
|
-
"
|
|
523
|
-
e.
|
|
524
|
-
|
|
502
|
+
"cameraAlphaLerp",
|
|
503
|
+
"alpha",
|
|
504
|
+
e.alpha,
|
|
505
|
+
ue(t.lonDeg),
|
|
525
506
|
v.ANIMATIONTYPE_FLOAT,
|
|
526
507
|
n
|
|
527
508
|
)
|
|
528
|
-
)
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
509
|
+
), r.push(
|
|
510
|
+
A(
|
|
511
|
+
"cameraBetaLerp",
|
|
512
|
+
"beta",
|
|
513
|
+
e.beta,
|
|
514
|
+
ue(t.latDeg),
|
|
515
|
+
v.ANIMATIONTYPE_FLOAT,
|
|
516
|
+
n
|
|
517
|
+
)
|
|
518
|
+
), t.radius !== void 0) {
|
|
519
|
+
const d = Math.max(0.01, t.radius);
|
|
520
|
+
r.push(
|
|
521
|
+
A(
|
|
522
|
+
"cameraRadiusLerp",
|
|
523
|
+
"radius",
|
|
524
|
+
e.radius,
|
|
525
|
+
d,
|
|
526
|
+
v.ANIMATIONTYPE_FLOAT,
|
|
527
|
+
n
|
|
528
|
+
)
|
|
529
|
+
);
|
|
540
530
|
}
|
|
541
|
-
|
|
531
|
+
e.animations.push(...r);
|
|
532
|
+
const c = e.useAutoRotationBehavior;
|
|
533
|
+
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
534
|
+
e,
|
|
535
|
+
0,
|
|
536
|
+
o ? M * 2 : M,
|
|
537
|
+
!1,
|
|
538
|
+
1,
|
|
539
|
+
() => {
|
|
540
|
+
e.animations = [], c && e.enableAutoRotationBehavior(), i();
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
});
|
|
542
544
|
}
|
|
543
545
|
function ue(s) {
|
|
544
546
|
return s * Math.PI / 180;
|
|
545
547
|
}
|
|
546
|
-
function A(s, e, t, i,
|
|
547
|
-
const
|
|
548
|
-
|
|
548
|
+
function A(s, e, t, i, r, o = 0, a = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
549
|
+
const n = new De();
|
|
550
|
+
n.setEasingMode(ke.EASINGMODE_EASEINOUT);
|
|
549
551
|
const l = new v(
|
|
550
552
|
s,
|
|
551
553
|
e,
|
|
552
554
|
M,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
r,
|
|
556
|
+
a
|
|
555
557
|
), c = [];
|
|
556
558
|
return o > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * o, value: t }), c.push({
|
|
557
559
|
frame: M * (o + 1),
|
|
558
560
|
value: i
|
|
559
|
-
}), l.setKeys(c), l.setEasingFunction(
|
|
561
|
+
}), l.setKeys(c), l.setEasingFunction(n), l;
|
|
560
562
|
}
|
|
561
563
|
function Qe(s, e, t) {
|
|
562
564
|
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
@@ -591,26 +593,26 @@ function $e(s, e, t, i) {
|
|
|
591
593
|
);
|
|
592
594
|
}), et(s, e);
|
|
593
595
|
}
|
|
594
|
-
function je(s, e, t, i,
|
|
596
|
+
function je(s, e, t, i, r) {
|
|
595
597
|
const o = Ze[s];
|
|
596
598
|
if (!o)
|
|
597
599
|
throw new Error("Unexpected texture name encountered.");
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
+
const a = e[o], n = a == null ? void 0 : a.fileLink;
|
|
601
|
+
n ? s === "reflectionTexture" ? n.endsWith(".env") || n.endsWith(".dds") ? i.addCubeTextureTask(
|
|
600
602
|
s,
|
|
601
|
-
|
|
603
|
+
n,
|
|
602
604
|
void 0,
|
|
603
605
|
!1,
|
|
604
606
|
void 0,
|
|
605
607
|
!0
|
|
606
|
-
) :
|
|
608
|
+
) : n.endsWith(".hdr") ? i.addHDRCubeTextureTask(
|
|
607
609
|
s,
|
|
608
|
-
|
|
610
|
+
n,
|
|
609
611
|
128,
|
|
610
612
|
!1,
|
|
611
613
|
!0,
|
|
612
614
|
!1
|
|
613
|
-
) : i.addTextureTask(s,
|
|
615
|
+
) : i.addTextureTask(s, n, !1, !1) : i.addTextureTask(s, n, !1, !1) : r && t[s] && (t[s] && t[s].dispose(), t[s] = null, Xe(s, t));
|
|
614
616
|
}
|
|
615
617
|
function Xe(s, e) {
|
|
616
618
|
s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), s === "reflectionTexture" && (e.environmentIntensity = 1), s === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0), e.reflectionTexture);
|
|
@@ -638,27 +640,27 @@ class tt {
|
|
|
638
640
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
639
641
|
* where we want to undo changes are remove effects from display.
|
|
640
642
|
*/
|
|
641
|
-
async applyMaterial(e, t, i,
|
|
643
|
+
async applyMaterial(e, t, i, r) {
|
|
642
644
|
return new Promise((o) => {
|
|
643
|
-
const
|
|
645
|
+
const a = this.materialVariantMap.get(e);
|
|
644
646
|
this.materialVariantMap.set(e, {
|
|
645
|
-
...
|
|
647
|
+
...a,
|
|
646
648
|
...t
|
|
647
649
|
});
|
|
648
|
-
const
|
|
649
|
-
(d) => d.name ===
|
|
650
|
+
const n = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
651
|
+
(d) => d.name === n
|
|
650
652
|
);
|
|
651
653
|
if (l.length === 0) {
|
|
652
654
|
o();
|
|
653
655
|
return;
|
|
654
656
|
}
|
|
655
|
-
const c = new
|
|
657
|
+
const c = new ze(this.scene);
|
|
656
658
|
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
657
659
|
(d) => $e(
|
|
658
660
|
t,
|
|
659
661
|
d,
|
|
660
662
|
c,
|
|
661
|
-
|
|
663
|
+
r
|
|
662
664
|
)
|
|
663
665
|
), c.onProgress = (d, u, g) => {
|
|
664
666
|
i && i(d / u * 100, 100, g.name);
|
|
@@ -666,7 +668,7 @@ class tt {
|
|
|
666
668
|
d.forEach((u) => {
|
|
667
669
|
const g = u;
|
|
668
670
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
669
|
-
(b) => b.name ===
|
|
671
|
+
(b) => b.name === n
|
|
670
672
|
).forEach(
|
|
671
673
|
(b) => Je(
|
|
672
674
|
u.name,
|
|
@@ -686,21 +688,21 @@ class tt {
|
|
|
686
688
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
687
689
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
688
690
|
*/
|
|
689
|
-
async applyModel(e, t, i,
|
|
691
|
+
async applyModel(e, t, i, r) {
|
|
690
692
|
var l, c;
|
|
691
693
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
692
694
|
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(
|
|
693
695
|
(d) => d !== e
|
|
694
696
|
), Promise.resolve(void 0);
|
|
695
|
-
const
|
|
697
|
+
const a = (await be(i, this.scene, r)).instantiateModelsToScene(
|
|
696
698
|
this.renameClonedAsset,
|
|
697
699
|
!0
|
|
698
700
|
);
|
|
699
|
-
this.loadedContainerForKey.has(e) && ((c = this.loadedContainerForKey.get(e)) == null || c.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e,
|
|
700
|
-
const
|
|
701
|
+
this.loadedContainerForKey.has(e) && ((c = this.loadedContainerForKey.get(e)) == null || c.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, a), this.loadedMaterialsForKey.set(e, we(a));
|
|
702
|
+
const n = [];
|
|
701
703
|
return this.materialVariantMap.forEach(async (d, u) => {
|
|
702
|
-
|
|
703
|
-
}), await Promise.all(
|
|
704
|
+
n.push(this.applyMaterial(u, d));
|
|
705
|
+
}), await Promise.all(n), a;
|
|
704
706
|
}
|
|
705
707
|
dispose() {
|
|
706
708
|
this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
|
|
@@ -726,8 +728,8 @@ function we(s) {
|
|
|
726
728
|
const e = [];
|
|
727
729
|
return s.rootNodes.forEach((t) => {
|
|
728
730
|
t.getChildMeshes().forEach((i) => {
|
|
729
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
730
|
-
const o =
|
|
731
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
|
|
732
|
+
const o = r.getMaterial(!1);
|
|
731
733
|
o && !e.includes(o) && e.push(o);
|
|
732
734
|
});
|
|
733
735
|
});
|
|
@@ -747,41 +749,41 @@ class it {
|
|
|
747
749
|
const {
|
|
748
750
|
enablePicking: t,
|
|
749
751
|
modelDetails: i,
|
|
750
|
-
previewService:
|
|
752
|
+
previewService: r,
|
|
751
753
|
progressHandler: o,
|
|
752
|
-
scene:
|
|
754
|
+
scene: a
|
|
753
755
|
} = e;
|
|
754
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
755
|
-
|
|
756
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = a, this.variantManager = new tt(
|
|
757
|
+
a,
|
|
756
758
|
this.renameClonedAsset.bind(this),
|
|
757
759
|
this.setBaseModelEnabled.bind(this)
|
|
758
760
|
), this.transformRoot = new Se("root", this.scene);
|
|
759
|
-
const
|
|
761
|
+
const n = async () => {
|
|
760
762
|
if (!i.model)
|
|
761
763
|
throw new Error(
|
|
762
764
|
"Model container constructed with no URL. This is currently unsupported."
|
|
763
765
|
);
|
|
764
766
|
return this.assetContainer = await be(
|
|
765
767
|
i.model,
|
|
766
|
-
|
|
768
|
+
a,
|
|
767
769
|
o
|
|
768
770
|
), this.initialized = !0, await this.instantiate(), this;
|
|
769
771
|
};
|
|
770
|
-
this.importPromise =
|
|
772
|
+
this.importPromise = n();
|
|
771
773
|
}
|
|
772
774
|
//#region Interface implementation
|
|
773
|
-
async applyMaterialVariant(e, t, i,
|
|
775
|
+
async applyMaterialVariant(e, t, i, r) {
|
|
774
776
|
if (!this.initialized) {
|
|
775
777
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
+
const a = this.materialReadyToLoadCallbacks.get(e);
|
|
779
|
+
a == null || a.set(
|
|
778
780
|
t,
|
|
779
781
|
this.applyMaterialVariant.bind(
|
|
780
782
|
this,
|
|
781
783
|
e,
|
|
782
784
|
t,
|
|
783
785
|
i,
|
|
784
|
-
|
|
786
|
+
r
|
|
785
787
|
)
|
|
786
788
|
);
|
|
787
789
|
} else {
|
|
@@ -789,15 +791,15 @@ class it {
|
|
|
789
791
|
e,
|
|
790
792
|
/* @__PURE__ */ new Map()
|
|
791
793
|
);
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
+
const a = this.materialReadyToLoadCallbacks.get(e);
|
|
795
|
+
a == null || a.set(
|
|
794
796
|
t,
|
|
795
797
|
this.applyMaterialVariant.bind(
|
|
796
798
|
this,
|
|
797
799
|
e,
|
|
798
800
|
t,
|
|
799
801
|
i,
|
|
800
|
-
|
|
802
|
+
r
|
|
801
803
|
)
|
|
802
804
|
);
|
|
803
805
|
}
|
|
@@ -807,36 +809,36 @@ class it {
|
|
|
807
809
|
await this.variantManager.applyMaterial(
|
|
808
810
|
e,
|
|
809
811
|
i,
|
|
810
|
-
(
|
|
812
|
+
(a, n, l) => {
|
|
811
813
|
this.materialVariantObservable.notifyObservers({
|
|
812
|
-
remainingCount:
|
|
813
|
-
totalCount:
|
|
814
|
+
remainingCount: a,
|
|
815
|
+
totalCount: n,
|
|
814
816
|
taskName: l
|
|
815
817
|
});
|
|
816
818
|
},
|
|
817
|
-
|
|
819
|
+
r
|
|
818
820
|
);
|
|
819
821
|
};
|
|
820
822
|
if (this.materialChangesInProgress.includes(e)) {
|
|
821
823
|
if (this.queuedMaterialChanges.has(e)) {
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
+
const a = this.queuedMaterialChanges.get(e);
|
|
825
|
+
a == null || a.set(t, o);
|
|
824
826
|
} else {
|
|
825
827
|
this.queuedMaterialChanges.set(
|
|
826
828
|
e,
|
|
827
829
|
/* @__PURE__ */ new Map()
|
|
828
830
|
);
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
+
const a = this.queuedMaterialChanges.get(e);
|
|
832
|
+
a == null || a.set(t, o);
|
|
831
833
|
}
|
|
832
834
|
return;
|
|
833
835
|
}
|
|
834
836
|
if (this.materialChangesInProgress.push(e), await o(), this.queuedMaterialChanges.has(e)) {
|
|
835
|
-
const
|
|
836
|
-
if (!
|
|
837
|
+
const a = this.queuedMaterialChanges.get(e);
|
|
838
|
+
if (!a)
|
|
837
839
|
throw new Error("Target material is undefined");
|
|
838
|
-
|
|
839
|
-
await
|
|
840
|
+
a.forEach(async (n) => {
|
|
841
|
+
await n();
|
|
840
842
|
}), this.queuedMaterialChanges.delete(e);
|
|
841
843
|
}
|
|
842
844
|
this.materialChangesInProgress.splice(
|
|
@@ -857,36 +859,36 @@ class it {
|
|
|
857
859
|
);
|
|
858
860
|
return;
|
|
859
861
|
}
|
|
860
|
-
const
|
|
862
|
+
const r = () => this.variantManager.applyModel(
|
|
861
863
|
e,
|
|
862
864
|
i,
|
|
863
865
|
t == null ? void 0 : t.model,
|
|
864
|
-
(
|
|
866
|
+
(n) => {
|
|
865
867
|
this.modelVariantObservable.notifyObservers({
|
|
866
|
-
...
|
|
868
|
+
...n,
|
|
867
869
|
key: e
|
|
868
870
|
});
|
|
869
871
|
}
|
|
870
872
|
);
|
|
871
873
|
if (this.modelChangesInProgress.includes(e)) {
|
|
872
|
-
this.queuedModelChanges.set(e,
|
|
874
|
+
this.queuedModelChanges.set(e, r);
|
|
873
875
|
return;
|
|
874
876
|
}
|
|
875
|
-
const
|
|
877
|
+
const a = await (async () => {
|
|
876
878
|
this.modelChangesInProgress.push(e);
|
|
877
|
-
let
|
|
879
|
+
let n = await r();
|
|
878
880
|
if (this.queuedModelChanges.has(e)) {
|
|
879
881
|
const l = this.queuedModelChanges.get(e);
|
|
880
882
|
if (!l)
|
|
881
883
|
throw new Error("Queued change resolved undefined");
|
|
882
|
-
|
|
884
|
+
n = await l(), this.queuedModelChanges.delete(e);
|
|
883
885
|
}
|
|
884
886
|
return this.modelChangesInProgress.splice(
|
|
885
887
|
this.modelChangesInProgress.indexOf(e),
|
|
886
888
|
1
|
|
887
|
-
),
|
|
889
|
+
), n;
|
|
888
890
|
})();
|
|
889
|
-
this.modelInstance && ve(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService),
|
|
891
|
+
this.modelInstance && ve(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), a ? this.configureModelInstance(a) : this.configureGlowLayer();
|
|
890
892
|
}
|
|
891
893
|
dispose() {
|
|
892
894
|
var e;
|
|
@@ -897,7 +899,7 @@ class it {
|
|
|
897
899
|
this.queuedModelAnimation = e;
|
|
898
900
|
return;
|
|
899
901
|
}
|
|
900
|
-
this.modelInstance &&
|
|
902
|
+
this.modelInstance && We(
|
|
901
903
|
[
|
|
902
904
|
...this.modelInstance.animationGroups,
|
|
903
905
|
...this.variantManager.getAnimationGroups()
|
|
@@ -983,8 +985,8 @@ class it {
|
|
|
983
985
|
e.rootNodes.forEach((t) => {
|
|
984
986
|
t.getChildMeshes(!1).forEach((i) => {
|
|
985
987
|
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new T(this.scene)), i.actionManager.registerAction(
|
|
986
|
-
new re(T.OnPointerOverTrigger, (
|
|
987
|
-
|
|
988
|
+
new re(T.OnPointerOverTrigger, (r) => {
|
|
989
|
+
r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
988
990
|
id: i.material.id,
|
|
989
991
|
name: this.stripIdFromName(i.material.name)
|
|
990
992
|
});
|
|
@@ -1028,11 +1030,11 @@ class it {
|
|
|
1028
1030
|
throw new Error(
|
|
1029
1031
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1030
1032
|
);
|
|
1031
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1033
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
|
|
1032
1034
|
this.transformRoot.position = m.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = m.One();
|
|
1033
|
-
for (const
|
|
1034
|
-
|
|
1035
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1035
|
+
for (const a of e.rootNodes)
|
|
1036
|
+
a.parent = this.transformRoot;
|
|
1037
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((o = this.contextService) == null ? void 0 : o.getAll()) || /* @__PURE__ */ new Map(), qe(
|
|
1036
1038
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1037
1039
|
this.scene,
|
|
1038
1040
|
this.canvasPanels,
|
|
@@ -1050,7 +1052,7 @@ class it {
|
|
|
1050
1052
|
getAllMeshes() {
|
|
1051
1053
|
var e;
|
|
1052
1054
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1053
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1055
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
1054
1056
|
).flat();
|
|
1055
1057
|
}
|
|
1056
1058
|
async instantiate() {
|
|
@@ -1076,8 +1078,8 @@ class it {
|
|
|
1076
1078
|
var e;
|
|
1077
1079
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1078
1080
|
(t, i) => {
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
+
const r = this.dynamicTextures.get(i);
|
|
1082
|
+
r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
|
|
1081
1083
|
}
|
|
1082
1084
|
);
|
|
1083
1085
|
}
|
|
@@ -1112,17 +1114,17 @@ class it {
|
|
|
1112
1114
|
//#endregion
|
|
1113
1115
|
}
|
|
1114
1116
|
class B extends ge {
|
|
1115
|
-
constructor(e, t, i,
|
|
1117
|
+
constructor(e, t, i, r, o, a, n, l) {
|
|
1116
1118
|
super(
|
|
1117
1119
|
e,
|
|
1118
1120
|
t,
|
|
1119
1121
|
i,
|
|
1120
|
-
|
|
1122
|
+
r,
|
|
1121
1123
|
o,
|
|
1122
|
-
|
|
1124
|
+
a,
|
|
1123
1125
|
l
|
|
1124
|
-
), this.lastFocus = new m(0, 0, 0), this.panDenominator = 1, this.minZ = 0.01, this.setRadius(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0,
|
|
1125
|
-
|
|
1126
|
+
), this.lastFocus = new m(0, 0, 0), this.panDenominator = 1, this.minZ = 0.01, this.setRadius(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, n.camera.autoOrientation && (this.alpha += Math.PI), n && (n.camera.limits.min.beta && (this.lowerBetaLimit = n.camera.limits.min.beta), n.camera.limits.max.beta && (this.upperBetaLimit = n.camera.limits.max.beta), n.camera.limits.min.alpha && (this.lowerAlphaLimit = n.camera.limits.min.alpha), n.camera.limits.max.alpha && (this.upperAlphaLimit = n.camera.limits.max.alpha), n.camera.limits.min.radius && (this.lowerRadiusLimit = n.camera.limits.min.radius), n.camera.limits.max.radius && (this.upperRadiusLimit = n.camera.limits.max.radius), n.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1127
|
+
n.camera.autoRotation.idleTimeMs
|
|
1126
1128
|
));
|
|
1127
1129
|
}
|
|
1128
1130
|
/**
|
|
@@ -1148,7 +1150,7 @@ class B extends ge {
|
|
|
1148
1150
|
this.useFramingBehavior = !0;
|
|
1149
1151
|
const e = this.getFramingBehavior();
|
|
1150
1152
|
e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
|
|
1151
|
-
const t =
|
|
1153
|
+
const t = E(this._scene);
|
|
1152
1154
|
return e.zoomOnBoundingInfo(t.min, t.max), this.wheelPrecision = 100 / this.radius, this.lowerRadiusLimit === null && (this.lowerRadiusLimit = 0.1), this.lastFocus.copyFrom(this.target), e;
|
|
1153
1155
|
}
|
|
1154
1156
|
/**
|
|
@@ -1159,14 +1161,14 @@ class B extends ge {
|
|
|
1159
1161
|
rerunFramingBehavior(e, t) {
|
|
1160
1162
|
const i = this.getFramingBehavior();
|
|
1161
1163
|
i.framingTime = t || 800;
|
|
1162
|
-
const
|
|
1164
|
+
const r = () => {
|
|
1163
1165
|
e && e();
|
|
1164
|
-
}, o =
|
|
1165
|
-
this.setRadius(
|
|
1166
|
+
}, o = E(this._scene), a = o.max.subtract(o.min), n = o.min.add(a.scale(0.5));
|
|
1167
|
+
this.setRadius(a.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(n), this.panDenominator = a.length(), i.zoomOnBoundingInfo(
|
|
1166
1168
|
o.min,
|
|
1167
1169
|
o.max,
|
|
1168
1170
|
void 0,
|
|
1169
|
-
|
|
1171
|
+
r
|
|
1170
1172
|
), i.framingTime = 0;
|
|
1171
1173
|
}
|
|
1172
1174
|
/**
|
|
@@ -1196,21 +1198,21 @@ class B extends ge {
|
|
|
1196
1198
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1197
1199
|
*/
|
|
1198
1200
|
static create(e, t, i) {
|
|
1199
|
-
const
|
|
1201
|
+
const r = E(e), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5)), n = new B(
|
|
1200
1202
|
"ProductCamera",
|
|
1201
1203
|
-(Math.PI / 2),
|
|
1202
1204
|
Math.PI / 2,
|
|
1203
1205
|
o.length() * 1.5,
|
|
1204
|
-
|
|
1206
|
+
a,
|
|
1205
1207
|
e,
|
|
1206
1208
|
t
|
|
1207
1209
|
);
|
|
1208
|
-
return
|
|
1209
|
-
|
|
1210
|
-
}), i && (e.activeCamera =
|
|
1210
|
+
return n.panningInertia = 0, n.panningOriginTarget.copyFrom(a), n.panDenominator = o.length(), n.onAfterCheckInputsObservable.add(() => {
|
|
1211
|
+
n.panningSensibility = 1e3 / n.panDenominator;
|
|
1212
|
+
}), i && (e.activeCamera = n), n;
|
|
1211
1213
|
}
|
|
1212
1214
|
}
|
|
1213
|
-
function
|
|
1215
|
+
function E(s) {
|
|
1214
1216
|
if (s.meshes.length === 0)
|
|
1215
1217
|
return {
|
|
1216
1218
|
min: new m(-1, -1, -1),
|
|
@@ -1221,7 +1223,7 @@ function R(s) {
|
|
|
1221
1223
|
}
|
|
1222
1224
|
class st {
|
|
1223
1225
|
constructor(e, t = !1, i = void 0) {
|
|
1224
|
-
this.renderingPipeline = new
|
|
1226
|
+
this.renderingPipeline = new Ve(
|
|
1225
1227
|
"default",
|
|
1226
1228
|
t,
|
|
1227
1229
|
e,
|
|
@@ -1237,9 +1239,9 @@ class st {
|
|
|
1237
1239
|
return this.currentConfiguration;
|
|
1238
1240
|
}
|
|
1239
1241
|
setConfiguration(e) {
|
|
1240
|
-
var t, i,
|
|
1242
|
+
var t, i, r, o, a, n, l, c, d, u, g, p, b, D, k, z, V, G, N, H, q, _, K, W, U, Y, Q, Z, $, j, X, J, ee;
|
|
1241
1243
|
if (this.renderingPipeline.isSupported) {
|
|
1242
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? h.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? h.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((
|
|
1244
|
+
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? h.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? h.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? h.bloom.enabled, this.renderingPipeline.bloomKernel = ((o = e.bloom) == null ? void 0 : o.kernel) ?? h.bloom.kernel, this.renderingPipeline.bloomScale = ((a = e.bloom) == null ? void 0 : a.scale) ?? h.bloom.scale, this.renderingPipeline.bloomThreshold = ((n = e.bloom) == null ? void 0 : n.threshold) ?? h.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? h.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? h.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((d = e.chromaticAberration) == null ? void 0 : d.aberrationAmount) ?? h.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? h.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (g = e.chromaticAberration) != null && g.direction ? new ie(
|
|
1243
1245
|
e.chromaticAberration.direction.x,
|
|
1244
1246
|
e.chromaticAberration.direction.y
|
|
1245
1247
|
) : new ie(
|
|
@@ -1248,16 +1250,16 @@ class st {
|
|
|
1248
1250
|
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ?? h.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new ae(), this.renderingPipeline.depthOfFieldEnabled = ((b = e.depthOfField) == null ? void 0 : b.enabled) ?? h.depthOfField.enabled, e.depthOfField)
|
|
1249
1251
|
switch (e.depthOfField.blurLevel ?? h.depthOfField.blurLevel) {
|
|
1250
1252
|
case "Low":
|
|
1251
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1253
|
+
this.renderingPipeline.depthOfFieldBlurLevel = R.Low;
|
|
1252
1254
|
break;
|
|
1253
1255
|
case "Medium":
|
|
1254
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1256
|
+
this.renderingPipeline.depthOfFieldBlurLevel = R.Medium;
|
|
1255
1257
|
break;
|
|
1256
1258
|
case "High":
|
|
1257
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1259
|
+
this.renderingPipeline.depthOfFieldBlurLevel = R.High;
|
|
1258
1260
|
break;
|
|
1259
1261
|
}
|
|
1260
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((
|
|
1262
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((k = e.depthOfField) == null ? void 0 : k.fStop) ?? h.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((z = e.depthOfField) == null ? void 0 : z.focusDistance) ?? h.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? h.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? h.grain.enabled, this.renderingPipeline.grain.animated = ((N = e.grain) == null ? void 0 : N.animated) ?? h.grain.animated, this.renderingPipeline.grain.intensity = ((H = e.grain) == null ? void 0 : H.intensity) ?? h.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((q = e.misc) == null ? void 0 : q.contrast) ?? h.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((_ = e.misc) == null ? void 0 : _.exposure) ?? h.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((K = e.misc) == null ? void 0 : K.toneMappingEnabled) ?? h.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1261
1263
|
switch (e.misc.toneMappingType ?? h.misc.toneMappingType) {
|
|
1262
1264
|
case "Standard":
|
|
1263
1265
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
@@ -1266,7 +1268,7 @@ class st {
|
|
|
1266
1268
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1267
1269
|
break;
|
|
1268
1270
|
}
|
|
1269
|
-
if (this.renderingPipeline.sharpenEnabled = ((
|
|
1271
|
+
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? h.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((U = e.sharpen) == null ? void 0 : U.colorAmount) ?? h.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Y = e.sharpen) == null ? void 0 : Y.edgeAmount) ?? h.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Q = e.vignette) == null ? void 0 : Q.enabled) ?? h.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 = h.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = h.vignette.center.y), e.vignette)
|
|
1270
1272
|
switch ((($ = e.vignette) == null ? void 0 : $.blendMode) ?? h.vignette.blendMode) {
|
|
1271
1273
|
case "Multiply":
|
|
1272
1274
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
@@ -1294,7 +1296,7 @@ class st {
|
|
|
1294
1296
|
}
|
|
1295
1297
|
}
|
|
1296
1298
|
Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1297
|
-
return new
|
|
1299
|
+
return new Ne(s);
|
|
1298
1300
|
});
|
|
1299
1301
|
fe.OnPluginActivatedObservable.add((s) => {
|
|
1300
1302
|
if (s.name === "gltf") {
|
|
@@ -1305,13 +1307,13 @@ fe.OnPluginActivatedObservable.add((s) => {
|
|
|
1305
1307
|
function O(s) {
|
|
1306
1308
|
return new m(s.x, s.y, s.z);
|
|
1307
1309
|
}
|
|
1308
|
-
function
|
|
1310
|
+
function L(s) {
|
|
1309
1311
|
return { x: s.x, y: s.y, z: s.z };
|
|
1310
1312
|
}
|
|
1311
|
-
class
|
|
1313
|
+
class Wt {
|
|
1312
1314
|
constructor(e) {
|
|
1313
1315
|
var l;
|
|
1314
|
-
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.renderLoop = () => {
|
|
1316
|
+
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.currentCameraAnimationPromise = Promise.resolve(), this.renderLoop = () => {
|
|
1315
1317
|
this.engine.views && (this.modelContainers.forEach((c) => {
|
|
1316
1318
|
c.updateDynamicTextures();
|
|
1317
1319
|
}), 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));
|
|
@@ -1319,15 +1321,18 @@ class Kt {
|
|
|
1319
1321
|
const i = (() => {
|
|
1320
1322
|
if (!(e != null && e.noRender))
|
|
1321
1323
|
return this.configuration.createCanvas();
|
|
1322
|
-
})(),
|
|
1324
|
+
})(), r = "1.5.6";
|
|
1323
1325
|
Me.Configuration = {
|
|
1324
1326
|
decoder: {
|
|
1325
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1326
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1327
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1327
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
|
|
1328
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
|
|
1329
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
|
|
1328
1330
|
}
|
|
1329
1331
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1330
|
-
const o = console.log
|
|
1332
|
+
const o = console.log;
|
|
1333
|
+
console.log = () => {
|
|
1334
|
+
};
|
|
1335
|
+
const a = i ? new pe(i, !0, {
|
|
1331
1336
|
adaptToDeviceRatio: !0,
|
|
1332
1337
|
limitDeviceRatio: 2,
|
|
1333
1338
|
premultipliedAlpha: !1,
|
|
@@ -1336,18 +1341,18 @@ class Kt {
|
|
|
1336
1341
|
stencil: this.configuration.highlights.enabled,
|
|
1337
1342
|
forceSRGBBufferSupportState: !0
|
|
1338
1343
|
}) : new Ce();
|
|
1339
|
-
console.log = o,
|
|
1344
|
+
console.log = o, a.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = a, this.scene = new Pe(a), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = B.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
|
|
1340
1345
|
this.scene,
|
|
1341
1346
|
!1,
|
|
1342
1347
|
this.camera
|
|
1343
1348
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1344
|
-
const
|
|
1349
|
+
const n = te.CreateFromPrefilteredData(
|
|
1345
1350
|
this.configuration.scene.environment.file,
|
|
1346
1351
|
this.scene
|
|
1347
1352
|
);
|
|
1348
|
-
|
|
1353
|
+
n.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = n, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1349
1354
|
this.configuration.options.renderingPipelineConfiguration
|
|
1350
|
-
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new
|
|
1355
|
+
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new He(
|
|
1351
1356
|
this.scene,
|
|
1352
1357
|
this.configuration.emissiveGlowIntensity
|
|
1353
1358
|
), this.initPromise = new Promise((c) => {
|
|
@@ -1384,7 +1389,7 @@ class Kt {
|
|
|
1384
1389
|
}
|
|
1385
1390
|
registerView(e) {
|
|
1386
1391
|
const t = e.height, i = e.width;
|
|
1387
|
-
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1392
|
+
this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
|
|
1388
1393
|
}
|
|
1389
1394
|
getNumViewports() {
|
|
1390
1395
|
var e;
|
|
@@ -1398,14 +1403,17 @@ class Kt {
|
|
|
1398
1403
|
}
|
|
1399
1404
|
executeCameraAnimation(e) {
|
|
1400
1405
|
if (!this.camera || this.scene.activeCamera !== this.camera) {
|
|
1401
|
-
this.
|
|
1406
|
+
this.queuedCameraAnimation = e;
|
|
1402
1407
|
return;
|
|
1403
1408
|
}
|
|
1404
|
-
|
|
1409
|
+
const t = () => Ye(
|
|
1405
1410
|
this.scene,
|
|
1406
1411
|
this.scene.activeCamera,
|
|
1407
1412
|
e
|
|
1408
|
-
)
|
|
1413
|
+
);
|
|
1414
|
+
this.currentCameraAnimationPromise.then(() => {
|
|
1415
|
+
this.currentCameraAnimationPromise = t();
|
|
1416
|
+
});
|
|
1409
1417
|
}
|
|
1410
1418
|
getCameraPose() {
|
|
1411
1419
|
if (this.scene && this.camera)
|
|
@@ -1433,18 +1441,19 @@ class Kt {
|
|
|
1433
1441
|
throw new Error(
|
|
1434
1442
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1435
1443
|
);
|
|
1436
|
-
e ===
|
|
1444
|
+
e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1437
1445
|
}
|
|
1438
1446
|
animateToLastCameraFocus() {
|
|
1439
|
-
|
|
1440
|
-
const
|
|
1441
|
-
const
|
|
1447
|
+
const e = () => new Promise((t) => {
|
|
1448
|
+
const i = () => {
|
|
1449
|
+
const r = this.configuration;
|
|
1442
1450
|
this.camera.rerunFramingBehavior(() => {
|
|
1443
|
-
this.focusLostNotified = !1,
|
|
1451
|
+
this.focusLostNotified = !1, r.camera.limits.min.radius && (this.camera.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.camera.upperRadiusLimit = r.camera.limits.max.radius), t();
|
|
1444
1452
|
});
|
|
1445
1453
|
};
|
|
1446
|
-
this.scene.onAfterRenderObservable.addOnce(
|
|
1454
|
+
this.scene.onAfterRenderObservable.addOnce(i);
|
|
1447
1455
|
});
|
|
1456
|
+
return this.currentCameraAnimationPromise.then(() => (this.currentCameraAnimationPromise = e(), this.currentCameraAnimationPromise));
|
|
1448
1457
|
}
|
|
1449
1458
|
setAutoRotation(e) {
|
|
1450
1459
|
!this.configuration.camera.autoRotation.enabled || !this.camera || (e ? this.camera.enableAutoRotationBehavior(
|
|
@@ -1466,9 +1475,9 @@ class Kt {
|
|
|
1466
1475
|
this.scene
|
|
1467
1476
|
);
|
|
1468
1477
|
try {
|
|
1469
|
-
const
|
|
1470
|
-
i.target = t.target ? new m(t.target.x, t.target.y, t.target.z) : m.Zero(), i.alpha = o, i.beta =
|
|
1471
|
-
const
|
|
1478
|
+
const r = t.latDeg * Math.PI / 180, o = t.lonDeg * Math.PI / 180;
|
|
1479
|
+
i.target = t.target ? new m(t.target.x, t.target.y, t.target.z) : m.Zero(), i.alpha = o, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1480
|
+
const a = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1472
1481
|
this.engine,
|
|
1473
1482
|
i,
|
|
1474
1483
|
e,
|
|
@@ -1476,7 +1485,7 @@ class Kt {
|
|
|
1476
1485
|
2,
|
|
1477
1486
|
!0
|
|
1478
1487
|
);
|
|
1479
|
-
return i.dispose(),
|
|
1488
|
+
return i.dispose(), a;
|
|
1480
1489
|
} catch {
|
|
1481
1490
|
throw i.isDisposed() || i.dispose(), new Error("Failed to render screenshot");
|
|
1482
1491
|
}
|
|
@@ -1485,32 +1494,32 @@ class Kt {
|
|
|
1485
1494
|
const e = this.configuration;
|
|
1486
1495
|
if (!e)
|
|
1487
1496
|
return !0;
|
|
1488
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1489
|
-
if (t === void 0 || i === void 0 ||
|
|
1497
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, o = e.camera.limits.max.beta;
|
|
1498
|
+
if (t === void 0 || i === void 0 || r === void 0 || o === void 0)
|
|
1490
1499
|
return !0;
|
|
1491
|
-
const
|
|
1500
|
+
const a = [t, i], n = [r, o], l = a.every((d) => d === t), c = n.every((d) => d === r);
|
|
1492
1501
|
return !l && !c;
|
|
1493
1502
|
}
|
|
1494
1503
|
fireResizeEvent() {
|
|
1495
1504
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1496
1505
|
}
|
|
1497
1506
|
setHighlights(e, t) {
|
|
1498
|
-
var
|
|
1499
|
-
e.length === 0 && ((
|
|
1507
|
+
var r;
|
|
1508
|
+
e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1500
1509
|
isStroke: !0,
|
|
1501
1510
|
blurVerticalSize: 0.85,
|
|
1502
1511
|
blurHorizontalSize: 0.85
|
|
1503
1512
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1504
1513
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1505
1514
|
e.forEach((o) => {
|
|
1506
|
-
const
|
|
1507
|
-
(
|
|
1515
|
+
const a = this.scene.materials.find(
|
|
1516
|
+
(n) => n.name === o.name && n.id === o.id
|
|
1508
1517
|
);
|
|
1509
|
-
|
|
1510
|
-
(
|
|
1518
|
+
a && a.getBindedMeshes().forEach(
|
|
1519
|
+
(n) => {
|
|
1511
1520
|
var l;
|
|
1512
1521
|
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1513
|
-
|
|
1522
|
+
n,
|
|
1514
1523
|
i || w.FromHexString("#fcba03")
|
|
1515
1524
|
);
|
|
1516
1525
|
}
|
|
@@ -1529,9 +1538,9 @@ class Kt {
|
|
|
1529
1538
|
progressHandler: t
|
|
1530
1539
|
});
|
|
1531
1540
|
return i.getInitializationPromise().then(() => {
|
|
1532
|
-
this.modelContainers.size <= 1 && this.camera.rerunFramingBehavior(void 0, 1),
|
|
1533
|
-
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1534
|
-
this.setHighlights([
|
|
1541
|
+
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((r) => {
|
|
1543
|
+
this.setHighlights([r]);
|
|
1535
1544
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1536
1545
|
this.setHighlights([]);
|
|
1537
1546
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1554,7 +1563,7 @@ class Kt {
|
|
|
1554
1563
|
}
|
|
1555
1564
|
unregisterPlugin(e) {
|
|
1556
1565
|
const t = this.plugins.indexOf(e);
|
|
1557
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1566
|
+
t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
|
|
1558
1567
|
}
|
|
1559
1568
|
getGlowLayerManager() {
|
|
1560
1569
|
return this.glowLayerManager;
|
|
@@ -1572,28 +1581,28 @@ class Kt {
|
|
|
1572
1581
|
* Flips a transform around the origin.
|
|
1573
1582
|
*/
|
|
1574
1583
|
flipTransform(e, t, i) {
|
|
1575
|
-
const
|
|
1584
|
+
const r = se.Compose(
|
|
1576
1585
|
O(i || { x: 1, y: 1, z: 1 }),
|
|
1577
1586
|
y.FromEulerVector(
|
|
1578
1587
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1579
1588
|
),
|
|
1580
1589
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1581
|
-
), o = se.RotationAxis(m.Up(), Math.PI),
|
|
1582
|
-
return
|
|
1583
|
-
position:
|
|
1584
|
-
rotation:
|
|
1585
|
-
scale:
|
|
1590
|
+
), o = se.RotationAxis(m.Up(), Math.PI), a = r.multiply(o), n = m.Zero(), l = y.Identity(), c = m.Zero();
|
|
1591
|
+
return a.decompose(c, l, n), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1592
|
+
position: L(n),
|
|
1593
|
+
rotation: L(l.toEulerAngles()),
|
|
1594
|
+
scale: L(c)
|
|
1586
1595
|
};
|
|
1587
1596
|
}
|
|
1588
1597
|
updatePreviewOptions(e) {
|
|
1589
|
-
var
|
|
1598
|
+
var r;
|
|
1590
1599
|
const t = new oe(e);
|
|
1591
1600
|
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1592
1601
|
let i = this.scene.environmentTexture;
|
|
1593
1602
|
this.configuration.scene.environment.file !== t.scene.environment.file && (i = te.CreateFromPrefilteredData(
|
|
1594
1603
|
t.scene.environment.file,
|
|
1595
1604
|
this.scene
|
|
1596
|
-
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (
|
|
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, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1597
1606
|
t.options.renderingPipelineConfiguration
|
|
1598
1607
|
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.configuration = t;
|
|
1599
1608
|
}
|
|
@@ -1613,9 +1622,9 @@ class Kt {
|
|
|
1613
1622
|
}
|
|
1614
1623
|
export {
|
|
1615
1624
|
S as MaterialEffectMode,
|
|
1616
|
-
|
|
1617
|
-
|
|
1625
|
+
I as ProductCameraRig,
|
|
1626
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1618
1627
|
x as RenderingConfiguration,
|
|
1619
|
-
|
|
1628
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1620
1629
|
h as renderingPipelineDefaults
|
|
1621
1630
|
};
|