@spiffcommerce/preview 5.1.0 → 5.2.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 +9 -2
- package/dist/index.esm.js +277 -269
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ArcRotateCamera as
|
|
2
|
-
import { Engine as
|
|
3
|
-
import { NullEngine as
|
|
4
|
-
import { HighlightLayer as
|
|
5
|
-
import { SceneLoader as
|
|
6
|
-
import { CubeTexture as
|
|
7
|
-
import { Color4 as f, Color3 as
|
|
8
|
-
import { Vector3 as m, Quaternion as
|
|
1
|
+
import { ArcRotateCamera as ge } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
|
+
import { Engine as pe } from "@babylonjs/core/Engines/engine";
|
|
3
|
+
import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
+
import { SceneLoader as fe } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as te } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
|
+
import { Color4 as f, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
+
import { Vector3 as m, Quaternion as y, Vector2 as ie, Matrix as se } 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
|
|
13
|
-
import { GLTF2 as
|
|
11
|
+
import { Tools as xe } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as Pe } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Re } from "@babylonjs/loaders/glTF";
|
|
14
14
|
import { PBRMaterial as F } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
|
-
import { MirrorTexture as
|
|
16
|
-
import { Color3 as Ee, Vector3 as
|
|
17
|
-
import { ReflectionProbe as
|
|
18
|
-
import { GlowLayer as
|
|
19
|
-
import { ActionManager as
|
|
20
|
-
import { ExecuteCodeAction as
|
|
21
|
-
import { Mesh as
|
|
22
|
-
import { TransformNode as
|
|
23
|
-
import { DynamicTexture as
|
|
24
|
-
import { Texture as
|
|
25
|
-
import { Animation as
|
|
26
|
-
import { QuadraticEase as
|
|
15
|
+
import { MirrorTexture as Ae } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Ee, Vector3 as ne, Plane as Te } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
|
+
import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
|
|
19
|
+
import { ActionManager as A } from "@babylonjs/core/Actions/actionManager";
|
|
20
|
+
import { ExecuteCodeAction as re } from "@babylonjs/core/Actions/directActions";
|
|
21
|
+
import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
|
|
22
|
+
import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
|
|
23
|
+
import { DynamicTexture as Fe } from "@babylonjs/core/Materials/Textures/dynamicTexture";
|
|
24
|
+
import { Texture as Be } from "@babylonjs/core/Materials/Textures/texture";
|
|
25
|
+
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
26
|
+
import { QuadraticEase as De, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
27
27
|
import { AssetsManager as ke } from "@babylonjs/core/Misc/assetsManager";
|
|
28
|
-
import { ColorCurves as
|
|
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 Ne } from "@babylonjs/core/PostProcesses/RenderPipeline";
|
|
31
|
+
import { DepthOfFieldEffectBlurLevel as E } 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";
|
|
@@ -40,15 +40,15 @@ import "@babylonjs/core/Misc/screenshotTools";
|
|
|
40
40
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
41
41
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
42
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
|
-
class
|
|
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 && ((
|
|
46
|
+
var i, a, o, n;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (a = this.customOptions) != null && a.backgroundImage ? 0 : 1;
|
|
48
|
+
if (this.customOptions && ((o = this.customOptions) != null && o.transparentBackground) || (n = this.customOptions) != null && n.backgroundImage)
|
|
49
49
|
return new f(0, 0, 0, t).toLinearSpace();
|
|
50
50
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
51
|
-
const r =
|
|
51
|
+
const r = w.FromHexString(
|
|
52
52
|
this.customOptions.backgroundColor
|
|
53
53
|
);
|
|
54
54
|
return new f(
|
|
@@ -60,11 +60,11 @@ class Ne {
|
|
|
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 a = w.FromHexString(t);
|
|
64
64
|
return new f(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
a.r,
|
|
66
|
+
a.g,
|
|
67
|
+
a.b,
|
|
68
68
|
i
|
|
69
69
|
).toLinearSpace();
|
|
70
70
|
}, this.customOptions = e;
|
|
@@ -80,14 +80,14 @@ class Ne {
|
|
|
80
80
|
* Configuration related to the scene
|
|
81
81
|
*/
|
|
82
82
|
get scene() {
|
|
83
|
-
var e, t, i,
|
|
83
|
+
var e, t, i, a, 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: ((
|
|
90
|
-
rotationY: (((
|
|
89
|
+
intensity: ((a = this.customOptions) == null ? void 0 : a.environmentIntensity) ?? 1,
|
|
90
|
+
rotationY: (((o = this.customOptions) == null ? void 0 : o.environmentRotationY) ?? 0) * (Math.PI / 180)
|
|
91
91
|
// Convert to radians
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -96,7 +96,7 @@ class Ne {
|
|
|
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, a, o, n, r, 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,12 +105,12 @@ class Ne {
|
|
|
105
105
|
},
|
|
106
106
|
limits: {
|
|
107
107
|
min: {
|
|
108
|
-
alpha: (
|
|
108
|
+
alpha: (a = this.customOptions) != null && a.lowerAlphaLimitDeg ? ((o = this.customOptions) == null ? void 0 : o.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
109
109
|
beta: (n = this.customOptions) != null && n.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: (
|
|
113
|
+
alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((d = this.customOptions) == null ? void 0 : d.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
114
114
|
beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((g = this.customOptions) == null ? void 0 : g.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
115
115
|
radius: (p = this.customOptions) == null ? void 0 : p.maxZoomOverride
|
|
116
116
|
}
|
|
@@ -129,10 +129,10 @@ class Ne {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
get lighting() {
|
|
132
|
-
var e, t, i,
|
|
132
|
+
var e, t, i, a;
|
|
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: ((a = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : a.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 Ve = 128,
|
|
184
|
+
const Ve = 128, h = {
|
|
185
185
|
antiAliasing: {
|
|
186
186
|
samples: 4,
|
|
187
187
|
fxaaEnabled: !1
|
|
@@ -253,11 +253,11 @@ class Ge {
|
|
|
253
253
|
return this.loader.loadNodeAsync(
|
|
254
254
|
e,
|
|
255
255
|
t,
|
|
256
|
-
function(
|
|
257
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
258
|
-
const n = t.extras[
|
|
259
|
-
|
|
260
|
-
}), i(
|
|
256
|
+
function(a) {
|
|
257
|
+
t.extras && Object.keys(t.extras).forEach((o) => {
|
|
258
|
+
const n = t.extras[o];
|
|
259
|
+
a.metadata[o] = n;
|
|
260
|
+
}), i(a);
|
|
261
261
|
}
|
|
262
262
|
);
|
|
263
263
|
}
|
|
@@ -315,51 +315,51 @@ class Ge {
|
|
|
315
315
|
* @param scene The scene to parse.
|
|
316
316
|
*/
|
|
317
317
|
applyReflections(e) {
|
|
318
|
-
function t(
|
|
318
|
+
function t(o) {
|
|
319
319
|
const n = [];
|
|
320
|
-
return
|
|
320
|
+
return o.transformNodes.forEach((r) => {
|
|
321
321
|
r.metadata && r.metadata.reflective && n.push(...r.getChildMeshes());
|
|
322
|
-
}),
|
|
322
|
+
}), o.meshes.forEach((r) => {
|
|
323
323
|
r.metadata && r.metadata.reflective && !n.includes(r) && n.push(r);
|
|
324
324
|
}), n;
|
|
325
325
|
}
|
|
326
|
-
function i(
|
|
327
|
-
const r =
|
|
326
|
+
function i(o, n = 1) {
|
|
327
|
+
const r = o.material;
|
|
328
328
|
if (!r)
|
|
329
329
|
return;
|
|
330
|
-
const l = new
|
|
330
|
+
const l = new Ae(
|
|
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 c = o.getVerticesData("normal");
|
|
338
|
+
if (!c)
|
|
339
339
|
throw new Error(
|
|
340
|
-
"Mirror attribute specified on: " +
|
|
340
|
+
"Mirror attribute specified on: " + o.name + "But no normals exist to generate a mirror from!"
|
|
341
341
|
);
|
|
342
|
-
|
|
343
|
-
const d =
|
|
344
|
-
new
|
|
342
|
+
o.computeWorldMatrix(!0);
|
|
343
|
+
const d = o.getWorldMatrix(), u = ne.TransformNormal(
|
|
344
|
+
new ne(c[0], c[1], c[2]),
|
|
345
345
|
d
|
|
346
|
-
).normalize(), g =
|
|
347
|
-
|
|
346
|
+
).normalize(), g = Te.FromPositionAndNormal(
|
|
347
|
+
o.position,
|
|
348
348
|
u.scale(-1)
|
|
349
349
|
);
|
|
350
350
|
l.mirrorPlane = g, l.level = n, r.reflectionTexture = l;
|
|
351
351
|
}
|
|
352
|
-
function o
|
|
353
|
-
const n =
|
|
352
|
+
function a(o) {
|
|
353
|
+
const n = o.material, r = new Oe(
|
|
354
354
|
"probe-" + n.name,
|
|
355
355
|
Ve,
|
|
356
356
|
e
|
|
357
357
|
);
|
|
358
|
-
r.attachToMesh(
|
|
358
|
+
r.attachToMesh(o), r.renderList && r.renderList.push(...t(e)), n.reflectionTexture = r.cubeTexture;
|
|
359
359
|
}
|
|
360
|
-
e.meshes.forEach((
|
|
361
|
-
const n =
|
|
362
|
-
n && (n.mirrorTexture && i(
|
|
360
|
+
e.meshes.forEach((o) => {
|
|
361
|
+
const n = o.metadata;
|
|
362
|
+
n && (n.mirrorTexture && i(o, n.mirrorTexture), n.reflectionProbe && a(o));
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
}
|
|
@@ -367,9 +367,12 @@ class qe {
|
|
|
367
367
|
constructor(e, t) {
|
|
368
368
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
369
369
|
}
|
|
370
|
+
setIntensity(e) {
|
|
371
|
+
this.intensity = e, this.glowLayer && (this.glowLayer.intensity = e);
|
|
372
|
+
}
|
|
370
373
|
includeMeshes(e) {
|
|
371
374
|
if (e) {
|
|
372
|
-
this.glowLayer || (this.glowLayer = new
|
|
375
|
+
this.glowLayer || (this.glowLayer = new Le("glow", this.scene), this.glowLayer.intensity = this.intensity);
|
|
373
376
|
for (const t of e)
|
|
374
377
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
375
378
|
}
|
|
@@ -382,28 +385,28 @@ class qe {
|
|
|
382
385
|
}
|
|
383
386
|
}
|
|
384
387
|
}
|
|
385
|
-
const
|
|
386
|
-
async function
|
|
387
|
-
const i =
|
|
388
|
+
const le = /* @__PURE__ */ new Map();
|
|
389
|
+
async function be(s, e, t) {
|
|
390
|
+
const i = le.get(s);
|
|
388
391
|
if (i && i.scene.uid === e.uid)
|
|
389
392
|
return i;
|
|
390
393
|
{
|
|
391
|
-
const
|
|
394
|
+
const a = await fe.LoadAssetContainerAsync(
|
|
392
395
|
s,
|
|
393
396
|
void 0,
|
|
394
397
|
e,
|
|
395
398
|
t
|
|
396
399
|
);
|
|
397
|
-
return
|
|
400
|
+
return le.set(s, a), a;
|
|
398
401
|
}
|
|
399
402
|
}
|
|
400
|
-
function He(s, e, t, i,
|
|
401
|
-
t.forEach((
|
|
402
|
-
const n =
|
|
403
|
-
s.filter((d) => d.name ===
|
|
403
|
+
function He(s, e, t, i, a = "") {
|
|
404
|
+
t.forEach((o) => {
|
|
405
|
+
const n = o.getID(), r = o.getName(), l = x.getDynamicTextureResolution();
|
|
406
|
+
s.filter((d) => d.name === a + r).forEach((d) => {
|
|
404
407
|
const u = i.get(n), g = !1;
|
|
405
408
|
if (u)
|
|
406
|
-
|
|
409
|
+
he(d, u), u.update(g);
|
|
407
410
|
else {
|
|
408
411
|
const p = _e(
|
|
409
412
|
r,
|
|
@@ -411,9 +414,9 @@ function He(s, e, t, i, o = "") {
|
|
|
411
414
|
l.width,
|
|
412
415
|
l.height
|
|
413
416
|
);
|
|
414
|
-
i.set(n, p),
|
|
417
|
+
i.set(n, p), o.setStaticContext(
|
|
415
418
|
p.getContext()
|
|
416
|
-
),
|
|
419
|
+
), he(d, p), p.onLoadObservable.addOnce(() => {
|
|
417
420
|
p.update(g);
|
|
418
421
|
});
|
|
419
422
|
}
|
|
@@ -421,17 +424,17 @@ function He(s, e, t, i, o = "") {
|
|
|
421
424
|
});
|
|
422
425
|
}
|
|
423
426
|
function _e(s, e, t, i) {
|
|
424
|
-
const
|
|
427
|
+
const a = new Fe(
|
|
425
428
|
s,
|
|
426
429
|
{ width: t, height: i },
|
|
427
430
|
e,
|
|
428
431
|
x.shouldMipMap(),
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
),
|
|
432
|
-
return
|
|
432
|
+
Be.TRILINEAR_SAMPLINGMODE,
|
|
433
|
+
pe.TEXTUREFORMAT_RGBA
|
|
434
|
+
), o = a.getContext();
|
|
435
|
+
return o && (o.fillStyle = "#f5f5f5", o.fillRect(0, 0, t, i), a.update()), a;
|
|
433
436
|
}
|
|
434
|
-
function
|
|
437
|
+
function he(s, e) {
|
|
435
438
|
if (s instanceof F) {
|
|
436
439
|
const t = s, i = t.albedoTexture;
|
|
437
440
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
@@ -444,42 +447,42 @@ function Ke() {
|
|
|
444
447
|
const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
445
448
|
return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
|
|
446
449
|
}
|
|
447
|
-
const
|
|
448
|
-
function
|
|
450
|
+
const M = 60, ce = 1;
|
|
451
|
+
function de(s) {
|
|
449
452
|
return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
|
|
450
453
|
}
|
|
451
|
-
function Ue(s, e, t, i,
|
|
452
|
-
const
|
|
453
|
-
if (
|
|
454
|
-
console.warn(`No animations found for name: ${
|
|
454
|
+
function Ue(s, e, t, i, a) {
|
|
455
|
+
const o = a ? s.filter((n) => n.name === a) : s;
|
|
456
|
+
if (o.length === 0) {
|
|
457
|
+
console.warn(`No animations found for name: ${a}`);
|
|
455
458
|
return;
|
|
456
459
|
}
|
|
457
460
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
458
|
-
|
|
461
|
+
o.forEach((n) => {
|
|
459
462
|
n.stop();
|
|
460
|
-
const r =
|
|
461
|
-
n.start(e,
|
|
463
|
+
const r = de(n), l = i * r;
|
|
464
|
+
n.start(e, ce, l, l);
|
|
462
465
|
});
|
|
463
466
|
return;
|
|
464
467
|
}
|
|
465
|
-
|
|
468
|
+
o.forEach((n) => {
|
|
466
469
|
n.stop();
|
|
467
|
-
const r =
|
|
468
|
-
n.start(e,
|
|
470
|
+
const r = de(n), l = i !== void 0 ? i * r : void 0, c = t !== void 0 ? t * r : void 0;
|
|
471
|
+
n.start(e, ce, l, c);
|
|
469
472
|
});
|
|
470
473
|
}
|
|
471
|
-
function
|
|
474
|
+
function ve(s) {
|
|
472
475
|
s.forEach((e) => {
|
|
473
476
|
e.stop();
|
|
474
477
|
});
|
|
475
478
|
}
|
|
476
479
|
function We(s) {
|
|
477
480
|
const e = s.animationGroups;
|
|
478
|
-
|
|
481
|
+
ve(e);
|
|
479
482
|
}
|
|
480
|
-
function
|
|
481
|
-
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha =
|
|
482
|
-
const i = [],
|
|
483
|
+
function Ye(s, e, t) {
|
|
484
|
+
s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
|
|
485
|
+
const i = [], a = t.target, o = 0, n = a ? 1 : 0;
|
|
483
486
|
if (t.target && Object.keys(t.target).length > 0 && i.push(
|
|
484
487
|
R(
|
|
485
488
|
"cameraTargetLerp",
|
|
@@ -490,16 +493,16 @@ function Qe(s, e, t) {
|
|
|
490
493
|
t.target.y,
|
|
491
494
|
t.target.z
|
|
492
495
|
),
|
|
493
|
-
|
|
494
|
-
|
|
496
|
+
v.ANIMATIONTYPE_VECTOR3,
|
|
497
|
+
o
|
|
495
498
|
)
|
|
496
499
|
), i.push(
|
|
497
500
|
R(
|
|
498
501
|
"cameraAlphaLerp",
|
|
499
502
|
"alpha",
|
|
500
503
|
e.alpha,
|
|
501
|
-
|
|
502
|
-
|
|
504
|
+
ue(t.lonDeg),
|
|
505
|
+
v.ANIMATIONTYPE_FLOAT,
|
|
503
506
|
n
|
|
504
507
|
)
|
|
505
508
|
), i.push(
|
|
@@ -507,19 +510,19 @@ function Qe(s, e, t) {
|
|
|
507
510
|
"cameraBetaLerp",
|
|
508
511
|
"beta",
|
|
509
512
|
e.beta,
|
|
510
|
-
|
|
511
|
-
|
|
513
|
+
ue(t.latDeg),
|
|
514
|
+
v.ANIMATIONTYPE_FLOAT,
|
|
512
515
|
n
|
|
513
516
|
)
|
|
514
517
|
), t.radius !== void 0) {
|
|
515
|
-
const
|
|
518
|
+
const c = Math.max(0.01, t.radius);
|
|
516
519
|
i.push(
|
|
517
520
|
R(
|
|
518
521
|
"cameraRadiusLerp",
|
|
519
522
|
"radius",
|
|
520
523
|
e.radius,
|
|
521
|
-
|
|
522
|
-
|
|
524
|
+
c,
|
|
525
|
+
v.ANIMATIONTYPE_FLOAT,
|
|
523
526
|
n
|
|
524
527
|
)
|
|
525
528
|
);
|
|
@@ -529,7 +532,7 @@ function Qe(s, e, t) {
|
|
|
529
532
|
e.disableAutoRotationBehavior(), s.beginAnimation(
|
|
530
533
|
e,
|
|
531
534
|
0,
|
|
532
|
-
|
|
535
|
+
a ? M * 2 : M,
|
|
533
536
|
!1,
|
|
534
537
|
1,
|
|
535
538
|
() => {
|
|
@@ -537,25 +540,25 @@ function Qe(s, e, t) {
|
|
|
537
540
|
}
|
|
538
541
|
);
|
|
539
542
|
}
|
|
540
|
-
function
|
|
543
|
+
function ue(s) {
|
|
541
544
|
return s * Math.PI / 180;
|
|
542
545
|
}
|
|
543
|
-
function R(s, e, t, i,
|
|
544
|
-
const r = new
|
|
545
|
-
r.setEasingMode(
|
|
546
|
-
const l = new
|
|
546
|
+
function R(s, e, t, i, a, o = 0, n = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
547
|
+
const r = new De();
|
|
548
|
+
r.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
549
|
+
const l = new v(
|
|
547
550
|
s,
|
|
548
551
|
e,
|
|
549
|
-
|
|
550
|
-
|
|
552
|
+
M,
|
|
553
|
+
a,
|
|
551
554
|
n
|
|
552
|
-
),
|
|
553
|
-
return
|
|
554
|
-
frame:
|
|
555
|
+
), c = [];
|
|
556
|
+
return o > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * o, value: t }), c.push({
|
|
557
|
+
frame: M * (o + 1),
|
|
555
558
|
value: i
|
|
556
|
-
}), l.setKeys(
|
|
559
|
+
}), l.setKeys(c), l.setEasingFunction(r), l;
|
|
557
560
|
}
|
|
558
|
-
function
|
|
561
|
+
function Qe(s, e, t) {
|
|
559
562
|
return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
|
|
560
563
|
}
|
|
561
564
|
const Ze = {
|
|
@@ -576,9 +579,9 @@ function $e(s, e, t, i) {
|
|
|
576
579
|
"opacityTexture",
|
|
577
580
|
"metallicTexture",
|
|
578
581
|
"refractionTexture"
|
|
579
|
-
].forEach((
|
|
582
|
+
].forEach((o) => {
|
|
580
583
|
je(
|
|
581
|
-
|
|
584
|
+
o,
|
|
582
585
|
s,
|
|
583
586
|
e,
|
|
584
587
|
t,
|
|
@@ -586,22 +589,22 @@ function $e(s, e, t, i) {
|
|
|
586
589
|
);
|
|
587
590
|
}), et(s, e);
|
|
588
591
|
}
|
|
589
|
-
function je(s, e, t, i,
|
|
590
|
-
const
|
|
591
|
-
if (!
|
|
592
|
+
function je(s, e, t, i, a) {
|
|
593
|
+
const o = Ze[s];
|
|
594
|
+
if (!o)
|
|
592
595
|
throw new Error("Unexpected texture name encountered.");
|
|
593
|
-
const n = e[
|
|
594
|
-
r ? i.addTextureTask(s, r, !1, !1) :
|
|
596
|
+
const n = e[o], r = n == null ? void 0 : n.fileLink;
|
|
597
|
+
r ? i.addTextureTask(s, r, !1, !1) : a && t[s] && (t[s] && t[s].dispose(), t[s] = null, Xe(s, t));
|
|
595
598
|
}
|
|
596
599
|
function Xe(s, e) {
|
|
597
|
-
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 === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new
|
|
600
|
+
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 === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0));
|
|
598
601
|
}
|
|
599
602
|
function Je(s, e, t, i) {
|
|
600
603
|
if (!e) {
|
|
601
604
|
console.error("Failed to apply texture to material: material is null.");
|
|
602
605
|
return;
|
|
603
606
|
}
|
|
604
|
-
s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), e[s] = i, s === "emissiveTexture" && (e.emissiveColor = new
|
|
607
|
+
s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), e[s] = i, s === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
605
608
|
}
|
|
606
609
|
function et(s, e) {
|
|
607
610
|
s.clearCoat && (s.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
@@ -619,8 +622,8 @@ class tt {
|
|
|
619
622
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
620
623
|
* where we want to undo changes are remove effects from display.
|
|
621
624
|
*/
|
|
622
|
-
async applyMaterial(e, t, i,
|
|
623
|
-
return new Promise((
|
|
625
|
+
async applyMaterial(e, t, i, a) {
|
|
626
|
+
return new Promise((o) => {
|
|
624
627
|
const n = this.materialVariantMap.get(e);
|
|
625
628
|
this.materialVariantMap.set(e, {
|
|
626
629
|
...n,
|
|
@@ -630,20 +633,20 @@ class tt {
|
|
|
630
633
|
(d) => d.name === r
|
|
631
634
|
);
|
|
632
635
|
if (l.length === 0) {
|
|
633
|
-
|
|
636
|
+
o();
|
|
634
637
|
return;
|
|
635
638
|
}
|
|
636
|
-
const
|
|
637
|
-
|
|
639
|
+
const c = new ke(this.scene);
|
|
640
|
+
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
638
641
|
(d) => $e(
|
|
639
642
|
t,
|
|
640
643
|
d,
|
|
641
|
-
|
|
642
|
-
|
|
644
|
+
c,
|
|
645
|
+
a
|
|
643
646
|
)
|
|
644
|
-
),
|
|
647
|
+
), c.onProgress = (d, u, g) => {
|
|
645
648
|
i && i(d / u * 100, 100, g.name);
|
|
646
|
-
},
|
|
649
|
+
}, c.onFinish = (d) => {
|
|
647
650
|
d.forEach((u) => {
|
|
648
651
|
const g = u;
|
|
649
652
|
i && i(100, 100, u.name), this.scene.materials.filter(
|
|
@@ -656,8 +659,8 @@ class tt {
|
|
|
656
659
|
g.texture
|
|
657
660
|
)
|
|
658
661
|
);
|
|
659
|
-
}),
|
|
660
|
-
},
|
|
662
|
+
}), o();
|
|
663
|
+
}, c.loadAsync();
|
|
661
664
|
});
|
|
662
665
|
}
|
|
663
666
|
/**
|
|
@@ -667,17 +670,17 @@ class tt {
|
|
|
667
670
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
668
671
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
669
672
|
*/
|
|
670
|
-
async applyModel(e, t, i,
|
|
671
|
-
var l,
|
|
673
|
+
async applyModel(e, t, i, a) {
|
|
674
|
+
var l, c;
|
|
672
675
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
673
676
|
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(
|
|
674
677
|
(d) => d !== e
|
|
675
678
|
), Promise.resolve(void 0);
|
|
676
|
-
const n = (await
|
|
679
|
+
const n = (await be(i, this.scene, a)).instantiateModelsToScene(
|
|
677
680
|
this.renameClonedAsset,
|
|
678
681
|
!0
|
|
679
682
|
);
|
|
680
|
-
this.loadedContainerForKey.has(e) && ((
|
|
683
|
+
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, n), this.loadedMaterialsForKey.set(e, we(n));
|
|
681
684
|
const r = [];
|
|
682
685
|
return this.materialVariantMap.forEach(async (d, u) => {
|
|
683
686
|
r.push(this.applyMaterial(u, d));
|
|
@@ -703,18 +706,18 @@ class tt {
|
|
|
703
706
|
}), e;
|
|
704
707
|
}
|
|
705
708
|
}
|
|
706
|
-
function
|
|
709
|
+
function we(s) {
|
|
707
710
|
const e = [];
|
|
708
711
|
return s.rootNodes.forEach((t) => {
|
|
709
712
|
t.getChildMeshes().forEach((i) => {
|
|
710
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((a) => {
|
|
714
|
+
const o = a.getMaterial(!1);
|
|
715
|
+
o && !e.includes(o) && e.push(o);
|
|
713
716
|
});
|
|
714
717
|
});
|
|
715
718
|
}), e;
|
|
716
719
|
}
|
|
717
|
-
function
|
|
720
|
+
function me(s, e = "") {
|
|
718
721
|
return s.map((t) => ({
|
|
719
722
|
name: t.name.substring(e.length),
|
|
720
723
|
loop: t.loopAnimation,
|
|
@@ -728,30 +731,30 @@ class it {
|
|
|
728
731
|
const {
|
|
729
732
|
enablePicking: t,
|
|
730
733
|
modelDetails: i,
|
|
731
|
-
previewService:
|
|
732
|
-
progressHandler:
|
|
734
|
+
previewService: a,
|
|
735
|
+
progressHandler: o,
|
|
733
736
|
scene: n
|
|
734
737
|
} = e;
|
|
735
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService =
|
|
738
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = a, this.scene = n, this.variantManager = new tt(
|
|
736
739
|
n,
|
|
737
740
|
this.renameClonedAsset.bind(this),
|
|
738
741
|
this.setBaseModelEnabled.bind(this)
|
|
739
|
-
), this.transformRoot = new
|
|
742
|
+
), this.transformRoot = new Se("root", this.scene);
|
|
740
743
|
const r = async () => {
|
|
741
744
|
if (!i.model)
|
|
742
745
|
throw new Error(
|
|
743
746
|
"Model container constructed with no URL. This is currently unsupported."
|
|
744
747
|
);
|
|
745
|
-
return this.assetContainer = await
|
|
748
|
+
return this.assetContainer = await be(
|
|
746
749
|
i.model,
|
|
747
750
|
n,
|
|
748
|
-
|
|
751
|
+
o
|
|
749
752
|
), this.initialized = !0, await this.instantiate(), this;
|
|
750
753
|
};
|
|
751
754
|
this.importPromise = r();
|
|
752
755
|
}
|
|
753
756
|
//#region Interface implementation
|
|
754
|
-
async applyMaterialVariant(e, t, i,
|
|
757
|
+
async applyMaterialVariant(e, t, i, a) {
|
|
755
758
|
if (!this.initialized) {
|
|
756
759
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
757
760
|
const n = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -762,7 +765,7 @@ class it {
|
|
|
762
765
|
e,
|
|
763
766
|
t,
|
|
764
767
|
i,
|
|
765
|
-
|
|
768
|
+
a
|
|
766
769
|
)
|
|
767
770
|
);
|
|
768
771
|
} else {
|
|
@@ -778,13 +781,13 @@ class it {
|
|
|
778
781
|
e,
|
|
779
782
|
t,
|
|
780
783
|
i,
|
|
781
|
-
|
|
784
|
+
a
|
|
782
785
|
)
|
|
783
786
|
);
|
|
784
787
|
}
|
|
785
788
|
return;
|
|
786
789
|
}
|
|
787
|
-
const
|
|
790
|
+
const o = async () => {
|
|
788
791
|
await this.variantManager.applyMaterial(
|
|
789
792
|
e,
|
|
790
793
|
i,
|
|
@@ -795,24 +798,24 @@ class it {
|
|
|
795
798
|
taskName: l
|
|
796
799
|
});
|
|
797
800
|
},
|
|
798
|
-
|
|
801
|
+
a
|
|
799
802
|
);
|
|
800
803
|
};
|
|
801
804
|
if (this.materialChangesInProgress.includes(e)) {
|
|
802
805
|
if (this.queuedMaterialChanges.has(e)) {
|
|
803
806
|
const n = this.queuedMaterialChanges.get(e);
|
|
804
|
-
n == null || n.set(t,
|
|
807
|
+
n == null || n.set(t, o);
|
|
805
808
|
} else {
|
|
806
809
|
this.queuedMaterialChanges.set(
|
|
807
810
|
e,
|
|
808
811
|
/* @__PURE__ */ new Map()
|
|
809
812
|
);
|
|
810
813
|
const n = this.queuedMaterialChanges.get(e);
|
|
811
|
-
n == null || n.set(t,
|
|
814
|
+
n == null || n.set(t, o);
|
|
812
815
|
}
|
|
813
816
|
return;
|
|
814
817
|
}
|
|
815
|
-
if (this.materialChangesInProgress.push(e), await
|
|
818
|
+
if (this.materialChangesInProgress.push(e), await o(), this.queuedMaterialChanges.has(e)) {
|
|
816
819
|
const n = this.queuedMaterialChanges.get(e);
|
|
817
820
|
if (!n)
|
|
818
821
|
throw new Error("Target material is undefined");
|
|
@@ -838,7 +841,7 @@ class it {
|
|
|
838
841
|
);
|
|
839
842
|
return;
|
|
840
843
|
}
|
|
841
|
-
const
|
|
844
|
+
const a = () => this.variantManager.applyModel(
|
|
842
845
|
e,
|
|
843
846
|
i,
|
|
844
847
|
t == null ? void 0 : t.model,
|
|
@@ -850,12 +853,12 @@ class it {
|
|
|
850
853
|
}
|
|
851
854
|
);
|
|
852
855
|
if (this.modelChangesInProgress.includes(e)) {
|
|
853
|
-
this.queuedModelChanges.set(e,
|
|
856
|
+
this.queuedModelChanges.set(e, a);
|
|
854
857
|
return;
|
|
855
858
|
}
|
|
856
859
|
const n = await (async () => {
|
|
857
860
|
this.modelChangesInProgress.push(e);
|
|
858
|
-
let r = await
|
|
861
|
+
let r = await a();
|
|
859
862
|
if (this.queuedModelChanges.has(e)) {
|
|
860
863
|
const l = this.queuedModelChanges.get(e);
|
|
861
864
|
if (!l)
|
|
@@ -867,7 +870,7 @@ class it {
|
|
|
867
870
|
1
|
|
868
871
|
), r;
|
|
869
872
|
})();
|
|
870
|
-
this.modelInstance &&
|
|
873
|
+
this.modelInstance && ve(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), n ? this.configureModelInstance(n) : this.configureGlowLayer();
|
|
871
874
|
}
|
|
872
875
|
dispose() {
|
|
873
876
|
var e;
|
|
@@ -892,7 +895,7 @@ class it {
|
|
|
892
895
|
getAnimations(e) {
|
|
893
896
|
return [
|
|
894
897
|
...this.animations,
|
|
895
|
-
...e ?
|
|
898
|
+
...e ? me(
|
|
896
899
|
this.variantManager.getAnimationGroups(),
|
|
897
900
|
this.renameClonedAsset("")
|
|
898
901
|
) : []
|
|
@@ -942,7 +945,7 @@ class it {
|
|
|
942
945
|
set rotation(e) {
|
|
943
946
|
if (!this.transformRoot)
|
|
944
947
|
throw new Error("ModelContainer disposed prior to setting rotation!");
|
|
945
|
-
this.transformRoot.rotationQuaternion =
|
|
948
|
+
this.transformRoot.rotationQuaternion = y.FromEulerAngles(
|
|
946
949
|
e.x,
|
|
947
950
|
e.y,
|
|
948
951
|
e.z
|
|
@@ -963,15 +966,15 @@ class it {
|
|
|
963
966
|
attachPickingHandler(e) {
|
|
964
967
|
e.rootNodes.forEach((t) => {
|
|
965
968
|
t.getChildMeshes(!1).forEach((i) => {
|
|
966
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
967
|
-
new
|
|
968
|
-
|
|
969
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new A(this.scene)), i.actionManager.registerAction(
|
|
970
|
+
new re(A.OnPointerOverTrigger, (a) => {
|
|
971
|
+
a.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
969
972
|
id: i.material.id,
|
|
970
973
|
name: this.stripIdFromName(i.material.name)
|
|
971
974
|
});
|
|
972
975
|
})
|
|
973
976
|
), i.actionManager.registerAction(
|
|
974
|
-
new
|
|
977
|
+
new re(A.OnPointerOutTrigger, () => {
|
|
975
978
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
976
979
|
id: i.material.id,
|
|
977
980
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -1004,16 +1007,16 @@ class it {
|
|
|
1004
1007
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
1005
1008
|
}
|
|
1006
1009
|
configureModelInstance(e) {
|
|
1007
|
-
var
|
|
1010
|
+
var o;
|
|
1008
1011
|
if (!this.transformRoot)
|
|
1009
1012
|
throw new Error(
|
|
1010
1013
|
"Transform disposed! This should never happen unless there is a race condition present!"
|
|
1011
1014
|
);
|
|
1012
|
-
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion,
|
|
1013
|
-
this.transformRoot.position = m.Zero(), this.transformRoot.rotationQuaternion =
|
|
1015
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, a = this.transformRoot.scaling;
|
|
1016
|
+
this.transformRoot.position = m.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = m.One();
|
|
1014
1017
|
for (const n of e.rootNodes)
|
|
1015
1018
|
n.parent = this.transformRoot;
|
|
1016
|
-
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling =
|
|
1019
|
+
this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = ((o = this.contextService) == null ? void 0 : o.getAll()) || /* @__PURE__ */ new Map(), He(
|
|
1017
1020
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
1018
1021
|
this.scene,
|
|
1019
1022
|
this.canvasPanels,
|
|
@@ -1031,7 +1034,7 @@ class it {
|
|
|
1031
1034
|
getAllMeshes() {
|
|
1032
1035
|
var e;
|
|
1033
1036
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
1034
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
1037
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
1035
1038
|
).flat();
|
|
1036
1039
|
}
|
|
1037
1040
|
async instantiate() {
|
|
@@ -1042,7 +1045,7 @@ class it {
|
|
|
1042
1045
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
1043
1046
|
this.renameClonedAsset.bind(this),
|
|
1044
1047
|
!0
|
|
1045
|
-
), this.materials =
|
|
1048
|
+
), this.materials = we(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = me(
|
|
1046
1049
|
this.modelInstance.animationGroups,
|
|
1047
1050
|
this.renameClonedAsset("")
|
|
1048
1051
|
), await this.processQueuedEvents();
|
|
@@ -1057,8 +1060,8 @@ class it {
|
|
|
1057
1060
|
var e;
|
|
1058
1061
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1059
1062
|
(t, i) => {
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1063
|
+
const a = this.dynamicTextures.get(i);
|
|
1064
|
+
a && t.getStaticContextDirty() && a.isReady() && (a.update(!1), t.setStaticContextDirty(!1));
|
|
1062
1065
|
}
|
|
1063
1066
|
);
|
|
1064
1067
|
}
|
|
@@ -1092,14 +1095,14 @@ class it {
|
|
|
1092
1095
|
}
|
|
1093
1096
|
//#endregion
|
|
1094
1097
|
}
|
|
1095
|
-
class B extends
|
|
1096
|
-
constructor(e, t, i,
|
|
1098
|
+
class B extends ge {
|
|
1099
|
+
constructor(e, t, i, a, o, n, r, l) {
|
|
1097
1100
|
super(
|
|
1098
1101
|
e,
|
|
1099
1102
|
t,
|
|
1100
1103
|
i,
|
|
1101
|
-
o,
|
|
1102
1104
|
a,
|
|
1105
|
+
o,
|
|
1103
1106
|
n,
|
|
1104
1107
|
l
|
|
1105
1108
|
), 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, 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(
|
|
@@ -1140,14 +1143,14 @@ class B extends ue {
|
|
|
1140
1143
|
rerunFramingBehavior(e, t) {
|
|
1141
1144
|
const i = this.getFramingBehavior();
|
|
1142
1145
|
i.framingTime = t || 800;
|
|
1143
|
-
const
|
|
1146
|
+
const a = () => {
|
|
1144
1147
|
e && e();
|
|
1145
|
-
},
|
|
1148
|
+
}, o = T(this._scene), n = o.max.subtract(o.min), r = o.min.add(n.scale(0.5));
|
|
1146
1149
|
this.setRadius(n.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(r), this.panDenominator = n.length(), i.zoomOnBoundingInfo(
|
|
1147
|
-
|
|
1148
|
-
|
|
1150
|
+
o.min,
|
|
1151
|
+
o.max,
|
|
1149
1152
|
void 0,
|
|
1150
|
-
|
|
1153
|
+
a
|
|
1151
1154
|
), i.framingTime = 0;
|
|
1152
1155
|
}
|
|
1153
1156
|
/**
|
|
@@ -1177,16 +1180,16 @@ class B extends ue {
|
|
|
1177
1180
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1178
1181
|
*/
|
|
1179
1182
|
static create(e, t, i) {
|
|
1180
|
-
const
|
|
1183
|
+
const a = T(e), o = a.max.subtract(a.min), n = a.min.add(o.scale(0.5)), r = new B(
|
|
1181
1184
|
"ProductCamera",
|
|
1182
1185
|
-(Math.PI / 2),
|
|
1183
1186
|
Math.PI / 2,
|
|
1184
|
-
|
|
1187
|
+
o.length() * 1.5,
|
|
1185
1188
|
n,
|
|
1186
1189
|
e,
|
|
1187
1190
|
t
|
|
1188
1191
|
);
|
|
1189
|
-
return r.panningInertia = 0, r.panningOriginTarget.copyFrom(n), r.panDenominator =
|
|
1192
|
+
return r.panningInertia = 0, r.panningOriginTarget.copyFrom(n), r.panDenominator = o.length(), r.onAfterCheckInputsObservable.add(() => {
|
|
1190
1193
|
r.panningSensibility = 1e3 / r.panDenominator;
|
|
1191
1194
|
}), i && (e.activeCamera = r), r;
|
|
1192
1195
|
}
|
|
@@ -1202,14 +1205,14 @@ function T(s) {
|
|
|
1202
1205
|
}
|
|
1203
1206
|
class st {
|
|
1204
1207
|
constructor(e, t = !1, i = void 0) {
|
|
1205
|
-
this.renderingPipeline = new
|
|
1208
|
+
this.renderingPipeline = new Ne(
|
|
1206
1209
|
"default",
|
|
1207
1210
|
t,
|
|
1208
1211
|
e,
|
|
1209
1212
|
i ? [i] : void 0,
|
|
1210
1213
|
!1
|
|
1211
1214
|
// Disable automatic build
|
|
1212
|
-
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(
|
|
1215
|
+
), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(h));
|
|
1213
1216
|
}
|
|
1214
1217
|
dispose() {
|
|
1215
1218
|
this.renderingPipeline.dispose();
|
|
@@ -1218,28 +1221,28 @@ class st {
|
|
|
1218
1221
|
return this.currentConfiguration;
|
|
1219
1222
|
}
|
|
1220
1223
|
setConfiguration(e) {
|
|
1221
|
-
var t, i,
|
|
1224
|
+
var t, i, a, o, n, r, l, c, d, u, g, p, b, D, z, k, N, V, G, q, H, _, K, U, W, Y, Q, Z, $, j, X, J, ee;
|
|
1222
1225
|
if (this.renderingPipeline.isSupported) {
|
|
1223
|
-
if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ??
|
|
1226
|
+
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 = ((a = e.bloom) == null ? void 0 : a.enabled) ?? h.bloom.enabled, this.renderingPipeline.bloomKernel = ((o = e.bloom) == null ? void 0 : o.kernel) ?? h.bloom.kernel, this.renderingPipeline.bloomScale = ((n = e.bloom) == null ? void 0 : n.scale) ?? h.bloom.scale, this.renderingPipeline.bloomThreshold = ((r = e.bloom) == null ? void 0 : r.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(
|
|
1224
1227
|
e.chromaticAberration.direction.x,
|
|
1225
1228
|
e.chromaticAberration.direction.y
|
|
1226
|
-
) : new
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((p = e.colorCurves) == null ? void 0 : p.enabled) ??
|
|
1230
|
-
switch (e.depthOfField.blurLevel ??
|
|
1229
|
+
) : new ie(
|
|
1230
|
+
h.chromaticAberration.direction.x,
|
|
1231
|
+
h.chromaticAberration.direction.y
|
|
1232
|
+
), 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)
|
|
1233
|
+
switch (e.depthOfField.blurLevel ?? h.depthOfField.blurLevel) {
|
|
1231
1234
|
case "Low":
|
|
1232
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1235
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
1233
1236
|
break;
|
|
1234
1237
|
case "Medium":
|
|
1235
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1238
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
|
|
1236
1239
|
break;
|
|
1237
1240
|
case "High":
|
|
1238
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1241
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1239
1242
|
break;
|
|
1240
1243
|
}
|
|
1241
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ??
|
|
1242
|
-
switch (e.misc.toneMappingType ??
|
|
1244
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((D = e.depthOfField) == null ? void 0 : D.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? h.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((k = e.depthOfField) == null ? void 0 : k.focusDistance) ?? h.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((N = e.depthOfField) == null ? void 0 : N.lensSize) ?? h.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((V = e.grain) == null ? void 0 : V.enabled) ?? h.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? h.grain.animated, this.renderingPipeline.grain.intensity = ((q = e.grain) == null ? void 0 : q.intensity) ?? h.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.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)
|
|
1245
|
+
switch (e.misc.toneMappingType ?? h.misc.toneMappingType) {
|
|
1243
1246
|
case "Standard":
|
|
1244
1247
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
|
|
1245
1248
|
break;
|
|
@@ -1247,8 +1250,8 @@ class st {
|
|
|
1247
1250
|
this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
|
|
1248
1251
|
break;
|
|
1249
1252
|
}
|
|
1250
|
-
if (this.renderingPipeline.sharpenEnabled = ((U = e.sharpen) == null ? void 0 : U.enabled) ??
|
|
1251
|
-
switch ((($ = e.vignette) == null ? void 0 : $.blendMode) ??
|
|
1253
|
+
if (this.renderingPipeline.sharpenEnabled = ((U = e.sharpen) == null ? void 0 : U.enabled) ?? h.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((W = e.sharpen) == null ? void 0 : W.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)
|
|
1254
|
+
switch ((($ = e.vignette) == null ? void 0 : $.blendMode) ?? h.vignette.blendMode) {
|
|
1252
1255
|
case "Multiply":
|
|
1253
1256
|
this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
|
|
1254
1257
|
break;
|
|
@@ -1262,22 +1265,22 @@ class st {
|
|
|
1262
1265
|
e.vignette.colorRgba.b,
|
|
1263
1266
|
e.vignette.colorRgba.a
|
|
1264
1267
|
) : (X = e.vignette) != null && X.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = f.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((J = e.vignette) == null ? void 0 : J.stretch) ??
|
|
1268
|
+
h.vignette.colorRgba.r,
|
|
1269
|
+
h.vignette.colorRgba.g,
|
|
1270
|
+
h.vignette.colorRgba.b,
|
|
1271
|
+
h.vignette.colorRgba.a
|
|
1272
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((J = e.vignette) == null ? void 0 : J.stretch) ?? h.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ee = e.vignette) == null ? void 0 : ee.weight) ?? h.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1270
1273
|
}
|
|
1271
1274
|
}
|
|
1272
1275
|
updateColorCurve(e) {
|
|
1273
|
-
const t = new
|
|
1276
|
+
const t = new ae();
|
|
1274
1277
|
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;
|
|
1275
1278
|
}
|
|
1276
1279
|
}
|
|
1277
|
-
|
|
1280
|
+
Re.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
|
|
1278
1281
|
return new Ge(s);
|
|
1279
1282
|
});
|
|
1280
|
-
|
|
1283
|
+
fe.OnPluginActivatedObservable.add((s) => {
|
|
1281
1284
|
if (s.name === "gltf") {
|
|
1282
1285
|
const e = s;
|
|
1283
1286
|
e.transparencyAsCoverage = !0;
|
|
@@ -1293,32 +1296,25 @@ class Ut {
|
|
|
1293
1296
|
constructor(e) {
|
|
1294
1297
|
var l;
|
|
1295
1298
|
this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.renderLoop = () => {
|
|
1296
|
-
this.engine.views && (this.modelContainers.forEach((
|
|
1297
|
-
|
|
1298
|
-
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((h) => {
|
|
1299
|
-
const d = this.engine.getRenderingCanvas(), u = h.target.getContext("2d");
|
|
1300
|
-
if (!d)
|
|
1301
|
-
throw new Error("Could not access rendering canvas");
|
|
1302
|
-
if (!u)
|
|
1303
|
-
throw new Error("Could not access 2D context for view target");
|
|
1304
|
-
u.clearRect(0, 0, d.width, d.height);
|
|
1299
|
+
this.engine.views && (this.modelContainers.forEach((c) => {
|
|
1300
|
+
c.updateDynamicTextures();
|
|
1305
1301
|
}), 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));
|
|
1306
|
-
}, this.configuration = new
|
|
1302
|
+
}, this.configuration = new oe(e);
|
|
1307
1303
|
const i = (() => {
|
|
1308
1304
|
if (!(e != null && e.noRender))
|
|
1309
1305
|
return this.configuration.createCanvas();
|
|
1310
|
-
})(),
|
|
1306
|
+
})(), a = "1.5.6";
|
|
1311
1307
|
Me.Configuration = {
|
|
1312
1308
|
decoder: {
|
|
1313
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1314
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1315
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1309
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_wasm_wrapper_gltf.js`,
|
|
1310
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.wasm`,
|
|
1311
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.js`
|
|
1316
1312
|
}
|
|
1317
1313
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1318
|
-
const
|
|
1314
|
+
const o = console.log;
|
|
1319
1315
|
console.log = () => {
|
|
1320
1316
|
};
|
|
1321
|
-
const n = i ? new
|
|
1317
|
+
const n = i ? new pe(i, !0, {
|
|
1322
1318
|
adaptToDeviceRatio: !0,
|
|
1323
1319
|
limitDeviceRatio: 2,
|
|
1324
1320
|
premultipliedAlpha: !1,
|
|
@@ -1326,13 +1322,13 @@ class Ut {
|
|
|
1326
1322
|
audioEngine: !1,
|
|
1327
1323
|
stencil: this.configuration.highlights.enabled,
|
|
1328
1324
|
forceSRGBBufferSupportState: !0
|
|
1329
|
-
}) : new
|
|
1330
|
-
console.log =
|
|
1325
|
+
}) : new Ce();
|
|
1326
|
+
console.log = o, n.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = n, this.scene = new Pe(n), 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(
|
|
1331
1327
|
this.scene,
|
|
1332
1328
|
!1,
|
|
1333
1329
|
this.camera
|
|
1334
1330
|
), this.scene.clearColor = this.configuration.scene.clearColor;
|
|
1335
|
-
const r =
|
|
1331
|
+
const r = te.CreateFromPrefilteredData(
|
|
1336
1332
|
this.configuration.scene.environment.file,
|
|
1337
1333
|
this.scene
|
|
1338
1334
|
);
|
|
@@ -1341,9 +1337,9 @@ class Ut {
|
|
|
1341
1337
|
) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new qe(
|
|
1342
1338
|
this.scene,
|
|
1343
1339
|
this.configuration.emissiveGlowIntensity
|
|
1344
|
-
), this.initPromise = new Promise((
|
|
1340
|
+
), this.initPromise = new Promise((c) => {
|
|
1345
1341
|
this.scene.onReadyObservable.addOnce(() => {
|
|
1346
|
-
this.initComplete = !0,
|
|
1342
|
+
this.initComplete = !0, c();
|
|
1347
1343
|
});
|
|
1348
1344
|
}), this.engine.runRenderLoop(this.renderLoop);
|
|
1349
1345
|
}
|
|
@@ -1375,7 +1371,7 @@ class Ut {
|
|
|
1375
1371
|
}
|
|
1376
1372
|
registerView(e) {
|
|
1377
1373
|
const t = e.height, i = e.width;
|
|
1378
|
-
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
|
|
1374
|
+
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);
|
|
1379
1375
|
}
|
|
1380
1376
|
getNumViewports() {
|
|
1381
1377
|
var e;
|
|
@@ -1392,7 +1388,7 @@ class Ut {
|
|
|
1392
1388
|
this.queuedCameraAnimation = e;
|
|
1393
1389
|
return;
|
|
1394
1390
|
}
|
|
1395
|
-
|
|
1391
|
+
Ye(
|
|
1396
1392
|
this.scene,
|
|
1397
1393
|
this.scene.activeCamera,
|
|
1398
1394
|
e
|
|
@@ -1448,7 +1444,7 @@ class Ut {
|
|
|
1448
1444
|
async renderSceneScreenshot(e, t) {
|
|
1449
1445
|
if (!this.camera)
|
|
1450
1446
|
throw new Error("Missing product camera, cannot render screenshot!");
|
|
1451
|
-
const i = new
|
|
1447
|
+
const i = new ge(
|
|
1452
1448
|
"screenshotCamera",
|
|
1453
1449
|
0,
|
|
1454
1450
|
0,
|
|
@@ -1457,9 +1453,9 @@ class Ut {
|
|
|
1457
1453
|
this.scene
|
|
1458
1454
|
);
|
|
1459
1455
|
try {
|
|
1460
|
-
const
|
|
1461
|
-
i.target = t.target ? new m(t.target.x, t.target.y, t.target.z) : m.Zero(), i.alpha =
|
|
1462
|
-
const n = await
|
|
1456
|
+
const a = t.latDeg * Math.PI / 180, o = t.lonDeg * Math.PI / 180;
|
|
1457
|
+
i.target = t.target ? new m(t.target.x, t.target.y, t.target.z) : m.Zero(), i.alpha = o, i.beta = a, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1458
|
+
const n = await xe.CreateScreenshotUsingRenderTargetAsync(
|
|
1463
1459
|
this.engine,
|
|
1464
1460
|
i,
|
|
1465
1461
|
e,
|
|
@@ -1476,33 +1472,33 @@ class Ut {
|
|
|
1476
1472
|
const e = this.configuration;
|
|
1477
1473
|
if (!e)
|
|
1478
1474
|
return !0;
|
|
1479
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1480
|
-
if (t === void 0 || i === void 0 ||
|
|
1475
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, a = e.camera.limits.min.beta, o = e.camera.limits.max.beta;
|
|
1476
|
+
if (t === void 0 || i === void 0 || a === void 0 || o === void 0)
|
|
1481
1477
|
return !0;
|
|
1482
|
-
const n = [t, i], r = [
|
|
1483
|
-
return !l && !
|
|
1478
|
+
const n = [t, i], r = [a, o], l = n.every((d) => d === t), c = r.every((d) => d === a);
|
|
1479
|
+
return !l && !c;
|
|
1484
1480
|
}
|
|
1485
1481
|
fireResizeEvent() {
|
|
1486
1482
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1487
1483
|
}
|
|
1488
1484
|
setHighlights(e, t) {
|
|
1489
|
-
var
|
|
1490
|
-
e.length === 0 && ((
|
|
1485
|
+
var a;
|
|
1486
|
+
e.length === 0 && ((a = this.highlightLayer) == null || a.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
|
|
1491
1487
|
isStroke: !0,
|
|
1492
1488
|
blurVerticalSize: 0.85,
|
|
1493
1489
|
blurHorizontalSize: 0.85
|
|
1494
1490
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1495
|
-
const i = t ? new
|
|
1496
|
-
e.forEach((
|
|
1491
|
+
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1492
|
+
e.forEach((o) => {
|
|
1497
1493
|
const n = this.scene.materials.find(
|
|
1498
|
-
(r) => r.name ===
|
|
1494
|
+
(r) => r.name === o.name && r.id === o.id
|
|
1499
1495
|
);
|
|
1500
1496
|
n && n.getBindedMeshes().forEach(
|
|
1501
1497
|
(r) => {
|
|
1502
1498
|
var l;
|
|
1503
1499
|
return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
|
|
1504
1500
|
r,
|
|
1505
|
-
i ||
|
|
1501
|
+
i || w.FromHexString("#fcba03")
|
|
1506
1502
|
);
|
|
1507
1503
|
}
|
|
1508
1504
|
);
|
|
@@ -1521,8 +1517,8 @@ class Ut {
|
|
|
1521
1517
|
});
|
|
1522
1518
|
return i.getInitializationPromise().then(() => {
|
|
1523
1519
|
this.modelContainers.size <= 1 && this.camera.rerunFramingBehavior(void 0, 1), We(this.scene), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0);
|
|
1524
|
-
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1525
|
-
this.setHighlights([
|
|
1520
|
+
}), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((a) => {
|
|
1521
|
+
this.setHighlights([a]);
|
|
1526
1522
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1527
1523
|
this.setHighlights([]);
|
|
1528
1524
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1545,7 +1541,7 @@ class Ut {
|
|
|
1545
1541
|
}
|
|
1546
1542
|
unregisterPlugin(e) {
|
|
1547
1543
|
const t = this.plugins.indexOf(e);
|
|
1548
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1544
|
+
t > -1 && this.plugins.splice(t, 1).forEach((a) => a.dispose(!1));
|
|
1549
1545
|
}
|
|
1550
1546
|
getGlowLayerManager() {
|
|
1551
1547
|
return this.glowLayerManager;
|
|
@@ -1563,19 +1559,31 @@ class Ut {
|
|
|
1563
1559
|
* Flips a transform around the origin.
|
|
1564
1560
|
*/
|
|
1565
1561
|
flipTransform(e, t, i) {
|
|
1566
|
-
const
|
|
1562
|
+
const a = se.Compose(
|
|
1567
1563
|
O(i || { x: 1, y: 1, z: 1 }),
|
|
1568
|
-
|
|
1564
|
+
y.FromEulerVector(
|
|
1569
1565
|
O(t || { x: 0, y: 0, z: 0 })
|
|
1570
1566
|
),
|
|
1571
1567
|
O(e || { x: 0, y: 0, z: 0 })
|
|
1572
|
-
),
|
|
1573
|
-
return n.decompose(
|
|
1568
|
+
), o = se.RotationAxis(m.Up(), Math.PI), n = a.multiply(o), r = m.Zero(), l = y.Identity(), c = m.Zero();
|
|
1569
|
+
return n.decompose(c, l, r), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
|
|
1574
1570
|
position: L(r),
|
|
1575
1571
|
rotation: L(l.toEulerAngles()),
|
|
1576
|
-
scale: L(
|
|
1572
|
+
scale: L(c)
|
|
1577
1573
|
};
|
|
1578
1574
|
}
|
|
1575
|
+
updatePreviewOptions(e) {
|
|
1576
|
+
var a;
|
|
1577
|
+
const t = new oe(e);
|
|
1578
|
+
this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
|
|
1579
|
+
let i = this.scene.environmentTexture;
|
|
1580
|
+
this.configuration.scene.environment.file !== t.scene.environment.file && (i = te.CreateFromPrefilteredData(
|
|
1581
|
+
this.configuration.scene.environment.file,
|
|
1582
|
+
this.scene
|
|
1583
|
+
), i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (a = t.options) != null && a.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
|
|
1584
|
+
t.options.renderingPipelineConfiguration
|
|
1585
|
+
) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.configuration = t;
|
|
1586
|
+
}
|
|
1579
1587
|
/**
|
|
1580
1588
|
* Given a valid canvas element, will remove any existing input controls
|
|
1581
1589
|
* and re-attach them to the given canvas. The pan mouse button can be set
|
|
@@ -1596,5 +1604,5 @@ export {
|
|
|
1596
1604
|
Ve as REFLECTION_PROBE_RESOLUTION,
|
|
1597
1605
|
x as RenderingConfiguration,
|
|
1598
1606
|
Ut as SpiffCommerce3DPreviewService,
|
|
1599
|
-
|
|
1607
|
+
h as renderingPipelineDefaults
|
|
1600
1608
|
};
|