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