@spiffcommerce/preview 4.1.0-alpha.11 → 4.1.0-alpha.13
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 +13 -5
- package/dist/index.esm.js +378 -355
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
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
|
|
1
|
+
import { ArcRotateCamera as ge } from "@babylonjs/core/Cameras/arcRotateCamera";
|
|
2
|
+
import { Engine as me } from "@babylonjs/core/Engines/engine";
|
|
3
|
+
import { NullEngine as we } from "@babylonjs/core/Engines/nullEngine";
|
|
4
|
+
import { HighlightLayer as Ce } from "@babylonjs/core/Layers/highlightLayer";
|
|
5
|
+
import { SceneLoader as pe } from "@babylonjs/core/Loading/sceneLoader";
|
|
6
|
+
import { CubeTexture as Pe } from "@babylonjs/core/Materials/Textures/cubeTexture";
|
|
7
7
|
import { Color4 as f, Color3 as w } from "@babylonjs/core/Maths/math.color";
|
|
8
|
-
import { Vector3 as
|
|
9
|
-
import { DracoCompression as
|
|
8
|
+
import { Vector3 as u, Quaternion as C, Vector2 as ie, Matrix as se } from "@babylonjs/core/Maths/math.vector";
|
|
9
|
+
import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
|
10
10
|
import { Observable as b } from "@babylonjs/core/Misc/observable";
|
|
11
|
-
import { Tools as
|
|
12
|
-
import { Scene as
|
|
13
|
-
import { GLTF2 as
|
|
14
|
-
import { PBRMaterial as
|
|
15
|
-
import { MirrorTexture as
|
|
16
|
-
import { Color3 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
|
|
11
|
+
import { Tools as ye } from "@babylonjs/core/Misc/tools";
|
|
12
|
+
import { Scene as xe } from "@babylonjs/core/scene";
|
|
13
|
+
import { GLTF2 as Le } from "@babylonjs/loaders/glTF";
|
|
14
|
+
import { PBRMaterial as F } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
|
15
|
+
import { MirrorTexture as Ae } from "@babylonjs/core/Materials/Textures/mirrorTexture";
|
|
16
|
+
import { Color3 as Ee, Vector3 as ne, Plane as Re } from "@babylonjs/core/Maths/math";
|
|
17
|
+
import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
|
|
18
|
+
import { GlowLayer as Te } 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
25
|
import { Animation as v } from "@babylonjs/core/Animations/animation";
|
|
26
|
-
import { QuadraticEase as
|
|
27
|
-
import { AssetsManager as
|
|
28
|
-
import { ColorCurves as
|
|
29
|
-
import { ImageProcessingConfiguration as
|
|
30
|
-
import { DefaultRenderingPipeline as
|
|
31
|
-
import { DepthOfFieldEffectBlurLevel as
|
|
26
|
+
import { QuadraticEase as De, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
|
|
27
|
+
import { AssetsManager as ke } from "@babylonjs/core/Misc/assetsManager";
|
|
28
|
+
import { ColorCurves as ae } from "@babylonjs/core/Materials/colorCurves";
|
|
29
|
+
import { ImageProcessingConfiguration as y } from "@babylonjs/core/Materials/imageProcessingConfiguration";
|
|
30
|
+
import { DefaultRenderingPipeline as Ve } 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";
|
|
@@ -39,13 +39,13 @@ import "@babylonjs/core/Animations/animatable";
|
|
|
39
39
|
import "@babylonjs/core/Misc/screenshotTools";
|
|
40
40
|
import "@babylonjs/core/Rendering/boundingBoxRenderer";
|
|
41
41
|
import "@babylonjs/loaders/glTF/2.0/Extensions";
|
|
42
|
-
var
|
|
43
|
-
class
|
|
42
|
+
var I = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(I || {}), S = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(S || {});
|
|
43
|
+
class Ne {
|
|
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, r, s;
|
|
47
|
+
const t = (i = this.customOptions) != null && i.transparentBackground || (a = this.customOptions) != null && a.backgroundImage ? 0 : 1;
|
|
48
|
+
if (this.customOptions && ((r = this.customOptions) != null && r.transparentBackground) || (s = this.customOptions) != null && s.backgroundImage)
|
|
49
49
|
return new f(0, 0, 0, t).toLinearSpace();
|
|
50
50
|
if (this.customOptions && this.customOptions.backgroundColor) {
|
|
51
51
|
const o = w.FromHexString(
|
|
@@ -60,11 +60,11 @@ class De {
|
|
|
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;
|
|
@@ -91,7 +91,7 @@ class De {
|
|
|
91
91
|
* Configuration related to the camera used to view and interact with the scene.
|
|
92
92
|
*/
|
|
93
93
|
get camera() {
|
|
94
|
-
var e, t, i,
|
|
94
|
+
var e, t, i, a, r, s, o, l, c, d, g, m, p;
|
|
95
95
|
return {
|
|
96
96
|
autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
|
|
97
97
|
autoRotation: {
|
|
@@ -100,13 +100,13 @@ class De {
|
|
|
100
100
|
},
|
|
101
101
|
limits: {
|
|
102
102
|
min: {
|
|
103
|
-
alpha: (
|
|
103
|
+
alpha: (a = this.customOptions) != null && a.lowerAlphaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
104
104
|
beta: (s = this.customOptions) != null && s.lowerBetaLimitDeg ? ((o = this.customOptions) == null ? void 0 : o.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
105
105
|
radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
|
|
106
106
|
},
|
|
107
107
|
max: {
|
|
108
|
-
alpha: (
|
|
109
|
-
beta: (
|
|
108
|
+
alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((d = this.customOptions) == null ? void 0 : d.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
|
|
109
|
+
beta: (g = this.customOptions) != null && g.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
|
|
110
110
|
radius: (p = this.customOptions) == null ? void 0 : p.maxZoomOverride
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -124,10 +124,10 @@ class De {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
get lighting() {
|
|
127
|
-
var e, t, i,
|
|
127
|
+
var e, t, i, a;
|
|
128
128
|
return {
|
|
129
129
|
exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
|
|
130
|
-
contrast: ((
|
|
130
|
+
contrast: ((a = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : a.contrast) ?? 1.6
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
get emissiveGlowIntensity() {
|
|
@@ -135,12 +135,12 @@ class De {
|
|
|
135
135
|
return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
class
|
|
138
|
+
class M {
|
|
139
139
|
/**
|
|
140
140
|
* Returns the resolution expected for generated textures.
|
|
141
141
|
*/
|
|
142
142
|
static getDynamicTextureResolution() {
|
|
143
|
-
return this.getIsMobile() || !
|
|
143
|
+
return this.getIsMobile() || !M.offscreenRenderingSupported() ? {
|
|
144
144
|
width: 1024,
|
|
145
145
|
height: 1024
|
|
146
146
|
} : {
|
|
@@ -176,7 +176,7 @@ class P {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const Ge = 128, h = {
|
|
180
180
|
antiAliasing: {
|
|
181
181
|
samples: 4,
|
|
182
182
|
fxaaEnabled: !1
|
|
@@ -233,7 +233,7 @@ const ze = 128, h = {
|
|
|
233
233
|
weight: 1
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
class
|
|
236
|
+
class He {
|
|
237
237
|
constructor(e) {
|
|
238
238
|
this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
|
|
239
239
|
}
|
|
@@ -248,11 +248,11 @@ class ke {
|
|
|
248
248
|
return this.loader.loadNodeAsync(
|
|
249
249
|
e,
|
|
250
250
|
t,
|
|
251
|
-
function(
|
|
252
|
-
t.extras && Object.keys(t.extras).forEach((
|
|
253
|
-
const s = t.extras[
|
|
254
|
-
|
|
255
|
-
}), i(
|
|
251
|
+
function(a) {
|
|
252
|
+
t.extras && Object.keys(t.extras).forEach((r) => {
|
|
253
|
+
const s = t.extras[r];
|
|
254
|
+
a.metadata[r] = s;
|
|
255
|
+
}), i(a);
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
258
|
}
|
|
@@ -277,14 +277,14 @@ class ke {
|
|
|
277
277
|
* @param babylonMaterial An instance of a material representation in babylon.
|
|
278
278
|
*/
|
|
279
279
|
enableMaterialExtrasIfRequired(e, t) {
|
|
280
|
-
if (!(!e.extras || !(t instanceof
|
|
280
|
+
if (!(!e.extras || !(t instanceof F))) {
|
|
281
281
|
if (e.extras.sheen) {
|
|
282
282
|
const i = t;
|
|
283
283
|
i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
|
|
284
284
|
}
|
|
285
285
|
if (e.extras.translucency) {
|
|
286
286
|
const i = t;
|
|
287
|
-
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new
|
|
287
|
+
i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new Ee(
|
|
288
288
|
e.extras.translucencyR,
|
|
289
289
|
e.extras.translucencyG,
|
|
290
290
|
e.extras.translucencyB
|
|
@@ -310,60 +310,60 @@ class ke {
|
|
|
310
310
|
* @param scene The scene to parse.
|
|
311
311
|
*/
|
|
312
312
|
applyReflections(e) {
|
|
313
|
-
function t(
|
|
313
|
+
function t(r) {
|
|
314
314
|
const s = [];
|
|
315
|
-
return
|
|
315
|
+
return r.transformNodes.forEach((o) => {
|
|
316
316
|
o.metadata && o.metadata.reflective && s.push(...o.getChildMeshes());
|
|
317
|
-
}),
|
|
317
|
+
}), r.meshes.forEach((o) => {
|
|
318
318
|
o.metadata && o.metadata.reflective && !s.includes(o) && s.push(o);
|
|
319
319
|
}), s;
|
|
320
320
|
}
|
|
321
|
-
function i(
|
|
322
|
-
const o =
|
|
321
|
+
function i(r, s = 1) {
|
|
322
|
+
const o = r.material;
|
|
323
323
|
if (!o)
|
|
324
324
|
return;
|
|
325
|
-
const l = new
|
|
325
|
+
const l = new Ae(
|
|
326
326
|
"mirror",
|
|
327
|
-
|
|
327
|
+
M.getMirrorTextureResolution(),
|
|
328
328
|
e,
|
|
329
329
|
!0
|
|
330
330
|
);
|
|
331
331
|
l.renderList = t(e);
|
|
332
|
-
const
|
|
333
|
-
if (!
|
|
332
|
+
const c = r.getVerticesData("normal");
|
|
333
|
+
if (!c)
|
|
334
334
|
throw new Error(
|
|
335
|
-
"Mirror attribute specified on: " +
|
|
335
|
+
"Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
|
|
336
336
|
);
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
new
|
|
340
|
-
|
|
341
|
-
).normalize(), m =
|
|
342
|
-
|
|
343
|
-
|
|
337
|
+
r.computeWorldMatrix(!0);
|
|
338
|
+
const d = r.getWorldMatrix(), g = ne.TransformNormal(
|
|
339
|
+
new ne(c[0], c[1], c[2]),
|
|
340
|
+
d
|
|
341
|
+
).normalize(), m = Re.FromPositionAndNormal(
|
|
342
|
+
r.position,
|
|
343
|
+
g.scale(-1)
|
|
344
344
|
);
|
|
345
345
|
l.mirrorPlane = m, l.level = s, o.reflectionTexture = l;
|
|
346
346
|
}
|
|
347
|
-
function r
|
|
348
|
-
const s =
|
|
347
|
+
function a(r) {
|
|
348
|
+
const s = r.material, o = new Oe(
|
|
349
349
|
"probe-" + s.name,
|
|
350
|
-
|
|
350
|
+
Ge,
|
|
351
351
|
e
|
|
352
352
|
);
|
|
353
|
-
o.attachToMesh(
|
|
353
|
+
o.attachToMesh(r), o.renderList && o.renderList.push(...t(e)), s.reflectionTexture = o.cubeTexture;
|
|
354
354
|
}
|
|
355
|
-
e.meshes.forEach((
|
|
356
|
-
const s =
|
|
357
|
-
s && (s.mirrorTexture && i(
|
|
355
|
+
e.meshes.forEach((r) => {
|
|
356
|
+
const s = r.metadata;
|
|
357
|
+
s && (s.mirrorTexture && i(r, s.mirrorTexture), s.reflectionProbe && a(r));
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class _e {
|
|
362
362
|
constructor(e, t) {
|
|
363
363
|
this.scene = e, this.intensity = t, this.meshCount = 0;
|
|
364
364
|
}
|
|
365
365
|
includeMeshes(e) {
|
|
366
|
-
this.glowLayer || (this.glowLayer = new
|
|
366
|
+
this.glowLayer || (this.glowLayer = new Te("glow", this.scene), this.glowLayer.intensity = this.intensity), e.forEach((t) => {
|
|
367
367
|
this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
|
|
368
368
|
});
|
|
369
369
|
}
|
|
@@ -373,144 +373,144 @@ class Ne {
|
|
|
373
373
|
}), this.meshCount === 0 && (this.glowLayer.dispose(), this.glowLayer = void 0));
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
async function
|
|
378
|
-
return new Promise((i,
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
return i(
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
const oe = /* @__PURE__ */ new Map();
|
|
377
|
+
async function fe(n, e, t) {
|
|
378
|
+
return new Promise((i, a) => {
|
|
379
|
+
const r = oe.get(n);
|
|
380
|
+
if (r && r.scene.uid === e.uid)
|
|
381
|
+
return i(r);
|
|
382
|
+
pe.LoadAssetContainerAsync(
|
|
383
|
+
n,
|
|
384
384
|
void 0,
|
|
385
385
|
e,
|
|
386
386
|
t
|
|
387
387
|
).then((s) => {
|
|
388
|
-
|
|
389
|
-
}).catch(
|
|
388
|
+
oe.set(n, s), i(s);
|
|
389
|
+
}).catch(a);
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
t.forEach((
|
|
394
|
-
const s =
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
398
|
-
|
|
392
|
+
function qe(n, e, t, i, a = "") {
|
|
393
|
+
t.forEach((r) => {
|
|
394
|
+
const s = r.getID(), o = r.getName(), l = M.getDynamicTextureResolution();
|
|
395
|
+
n.filter((d) => d.name === a + o).forEach((d) => {
|
|
396
|
+
const g = i.get(s), m = !1;
|
|
397
|
+
if (g)
|
|
398
|
+
le(d, g), g.update(m);
|
|
399
399
|
else {
|
|
400
|
-
const p =
|
|
400
|
+
const p = Ke(
|
|
401
401
|
o,
|
|
402
402
|
e,
|
|
403
403
|
l.width,
|
|
404
404
|
l.height
|
|
405
405
|
);
|
|
406
|
-
i.set(s, p),
|
|
406
|
+
i.set(s, p), r.setStaticContext(
|
|
407
407
|
p.getContext()
|
|
408
|
-
),
|
|
408
|
+
), le(d, p), p.onLoadObservable.addOnce(() => {
|
|
409
409
|
p.update(m);
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
const
|
|
417
|
-
|
|
415
|
+
function Ke(n, e, t, i) {
|
|
416
|
+
const a = new Fe(
|
|
417
|
+
n,
|
|
418
418
|
{ width: t, height: i },
|
|
419
419
|
e,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
),
|
|
424
|
-
return
|
|
420
|
+
M.shouldMipMap(),
|
|
421
|
+
Be.TRILINEAR_SAMPLINGMODE,
|
|
422
|
+
me.TEXTUREFORMAT_RGBA
|
|
423
|
+
), r = a.getContext();
|
|
424
|
+
return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), a.update()), a;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
if (
|
|
428
|
-
const t =
|
|
426
|
+
function le(n, e) {
|
|
427
|
+
if (n instanceof F) {
|
|
428
|
+
const t = n, i = t.albedoTexture;
|
|
429
429
|
i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
|
|
430
430
|
} else {
|
|
431
|
-
const t =
|
|
431
|
+
const t = n, i = t.diffuseTexture;
|
|
432
432
|
i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
const
|
|
437
|
-
return
|
|
435
|
+
function Ue() {
|
|
436
|
+
const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
437
|
+
return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
|
|
438
438
|
}
|
|
439
|
-
const
|
|
440
|
-
function
|
|
441
|
-
return
|
|
439
|
+
const P = 60, he = 1;
|
|
440
|
+
function ce(n) {
|
|
441
|
+
return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
console.warn(`No animations found for name: ${
|
|
443
|
+
function We(n, e, t, i, a) {
|
|
444
|
+
const r = a ? n.filter((s) => s.name === a) : n;
|
|
445
|
+
if (r.length === 0) {
|
|
446
|
+
console.warn(`No animations found for name: ${a}`);
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
449
|
if (i !== void 0 && t !== void 0 && i === t) {
|
|
450
|
-
|
|
450
|
+
r.forEach((s) => {
|
|
451
451
|
s.stop();
|
|
452
|
-
const o =
|
|
453
|
-
s.start(e,
|
|
452
|
+
const o = ce(s), l = i * o;
|
|
453
|
+
s.start(e, he, l, l);
|
|
454
454
|
});
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
|
|
457
|
+
r.forEach((s) => {
|
|
458
458
|
s.stop();
|
|
459
|
-
const o =
|
|
460
|
-
s.start(e,
|
|
459
|
+
const o = ce(s), l = i !== void 0 ? i * o : void 0, c = t !== void 0 ? t * o : void 0;
|
|
460
|
+
s.start(e, he, l, c);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
|
|
463
|
+
function be(n) {
|
|
464
|
+
n.forEach((e) => {
|
|
465
465
|
e.stop();
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
const e =
|
|
470
|
-
|
|
468
|
+
function Qe(n) {
|
|
469
|
+
const e = n.animationGroups;
|
|
470
|
+
be(e);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
|
|
474
|
-
const i = [],
|
|
472
|
+
function Ze(n, e, t) {
|
|
473
|
+
n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = $e(e.alpha, 0, 2 * Math.PI));
|
|
474
|
+
const i = [], a = t.target, r = 0, s = a ? 1 : 0;
|
|
475
475
|
if (t.target && Object.keys(t.target).length > 0 && i.push(
|
|
476
|
-
|
|
476
|
+
x(
|
|
477
477
|
"cameraTargetLerp",
|
|
478
478
|
"target",
|
|
479
|
-
new
|
|
480
|
-
new
|
|
479
|
+
new u().copyFrom(e.target),
|
|
480
|
+
new u(
|
|
481
481
|
t.target.x,
|
|
482
482
|
t.target.y,
|
|
483
483
|
t.target.z
|
|
484
484
|
),
|
|
485
485
|
v.ANIMATIONTYPE_VECTOR3,
|
|
486
|
-
|
|
486
|
+
r
|
|
487
487
|
)
|
|
488
488
|
), i.push(
|
|
489
|
-
|
|
489
|
+
x(
|
|
490
490
|
"cameraAlphaLerp",
|
|
491
491
|
"alpha",
|
|
492
492
|
e.alpha,
|
|
493
|
-
|
|
493
|
+
de(t.lonDeg),
|
|
494
494
|
v.ANIMATIONTYPE_FLOAT,
|
|
495
495
|
s
|
|
496
496
|
)
|
|
497
497
|
), i.push(
|
|
498
|
-
|
|
498
|
+
x(
|
|
499
499
|
"cameraBetaLerp",
|
|
500
500
|
"beta",
|
|
501
501
|
e.beta,
|
|
502
|
-
|
|
502
|
+
de(t.latDeg),
|
|
503
503
|
v.ANIMATIONTYPE_FLOAT,
|
|
504
504
|
s
|
|
505
505
|
)
|
|
506
506
|
), t.radius !== void 0) {
|
|
507
|
-
const
|
|
507
|
+
const c = Math.max(0.01, t.radius);
|
|
508
508
|
i.push(
|
|
509
|
-
|
|
509
|
+
x(
|
|
510
510
|
"cameraRadiusLerp",
|
|
511
511
|
"radius",
|
|
512
512
|
e.radius,
|
|
513
|
-
|
|
513
|
+
c,
|
|
514
514
|
v.ANIMATIONTYPE_FLOAT,
|
|
515
515
|
s
|
|
516
516
|
)
|
|
@@ -518,10 +518,10 @@ function Ke(a, e, t) {
|
|
|
518
518
|
}
|
|
519
519
|
e.animations.push(...i);
|
|
520
520
|
const l = e.useAutoRotationBehavior;
|
|
521
|
-
e.disableAutoRotationBehavior(),
|
|
521
|
+
e.disableAutoRotationBehavior(), n.beginAnimation(
|
|
522
522
|
e,
|
|
523
523
|
0,
|
|
524
|
-
|
|
524
|
+
a ? P * 2 : P,
|
|
525
525
|
!1,
|
|
526
526
|
1,
|
|
527
527
|
() => {
|
|
@@ -529,28 +529,28 @@ function Ke(a, e, t) {
|
|
|
529
529
|
}
|
|
530
530
|
);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
return
|
|
532
|
+
function de(n) {
|
|
533
|
+
return n * Math.PI / 180;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
const o = new
|
|
537
|
-
o.setEasingMode(
|
|
535
|
+
function x(n, e, t, i, a, r = 0, s = v.ANIMATIONLOOPMODE_CONSTANT) {
|
|
536
|
+
const o = new De();
|
|
537
|
+
o.setEasingMode(ze.EASINGMODE_EASEINOUT);
|
|
538
538
|
const l = new v(
|
|
539
|
-
|
|
539
|
+
n,
|
|
540
540
|
e,
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
P,
|
|
542
|
+
a,
|
|
543
543
|
s
|
|
544
|
-
),
|
|
545
|
-
return
|
|
546
|
-
frame:
|
|
544
|
+
), c = [];
|
|
545
|
+
return r > 0 && c.push({ frame: 0, value: t }), c.push({ frame: P * r, value: t }), c.push({
|
|
546
|
+
frame: P * (r + 1),
|
|
547
547
|
value: i
|
|
548
|
-
}), l.setKeys(
|
|
548
|
+
}), l.setKeys(c), l.setEasingFunction(o), l;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
return
|
|
550
|
+
function $e(n, e, t) {
|
|
551
|
+
return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
|
|
552
552
|
}
|
|
553
|
-
const
|
|
553
|
+
const Ye = {
|
|
554
554
|
albedoTexture: "albedoMap",
|
|
555
555
|
bumpTexture: "normalMap",
|
|
556
556
|
ambientTexture: "ambientMap",
|
|
@@ -559,7 +559,7 @@ const We = {
|
|
|
559
559
|
metallicTexture: "metallicMap",
|
|
560
560
|
refractionTexture: "refractionMap"
|
|
561
561
|
};
|
|
562
|
-
function
|
|
562
|
+
function je(n, e, t, i) {
|
|
563
563
|
[
|
|
564
564
|
"albedoTexture",
|
|
565
565
|
"bumpTexture",
|
|
@@ -568,33 +568,33 @@ function Ze(a, e, t, i) {
|
|
|
568
568
|
"opacityTexture",
|
|
569
569
|
"metallicTexture",
|
|
570
570
|
"refractionTexture"
|
|
571
|
-
].forEach((
|
|
572
|
-
|
|
571
|
+
].forEach((r) => {
|
|
572
|
+
Xe(
|
|
573
|
+
r,
|
|
573
574
|
n,
|
|
574
|
-
a,
|
|
575
575
|
e,
|
|
576
576
|
t,
|
|
577
577
|
i
|
|
578
578
|
);
|
|
579
|
-
}),
|
|
579
|
+
}), tt(n, e);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
581
|
+
function Xe(n, e, t, i, a) {
|
|
582
|
+
const r = Ye[n];
|
|
583
|
+
if (!r)
|
|
584
584
|
throw new Error("Unexpected texture name encountered.");
|
|
585
|
-
const s = e[
|
|
586
|
-
o ? i.addTextureTask(
|
|
585
|
+
const s = e[r], o = s == null ? void 0 : s.fileLink;
|
|
586
|
+
o ? i.addTextureTask(n, o, !1, !1) : a && t[n] && (t[n] && t[n].dispose(), t[n] = null, Je(n, t));
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
588
|
+
function Je(n, e) {
|
|
589
|
+
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0));
|
|
590
590
|
}
|
|
591
|
-
function
|
|
592
|
-
|
|
591
|
+
function et(n, e, t, i) {
|
|
592
|
+
n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
|
|
593
593
|
}
|
|
594
|
-
function
|
|
595
|
-
|
|
594
|
+
function tt(n, e) {
|
|
595
|
+
n.clearCoat && (n.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
|
|
596
596
|
}
|
|
597
|
-
class
|
|
597
|
+
class it {
|
|
598
598
|
constructor(e, t, i) {
|
|
599
599
|
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;
|
|
600
600
|
}
|
|
@@ -607,43 +607,43 @@ class Xe {
|
|
|
607
607
|
* instead remove material textures when they aren't defined. this is useful for material editor applications
|
|
608
608
|
* where we want to undo changes are remove effects from display.
|
|
609
609
|
*/
|
|
610
|
-
async applyMaterial(e, t, i,
|
|
611
|
-
return new Promise((
|
|
610
|
+
async applyMaterial(e, t, i, a) {
|
|
611
|
+
return new Promise((r) => {
|
|
612
612
|
const s = this.materialVariantMap.get(e);
|
|
613
613
|
this.materialVariantMap.set(e, {
|
|
614
614
|
...s,
|
|
615
615
|
...t
|
|
616
616
|
});
|
|
617
617
|
const o = this.renameClonedAsset(e), l = this.scene.materials.filter(
|
|
618
|
-
(
|
|
618
|
+
(d) => d.name === o
|
|
619
619
|
);
|
|
620
620
|
if (l.length === 0) {
|
|
621
|
-
|
|
621
|
+
r();
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
(
|
|
624
|
+
const c = new ke(this.scene);
|
|
625
|
+
c.useDefaultLoadingScreen = !1, l.forEach(
|
|
626
|
+
(d) => je(
|
|
627
627
|
t,
|
|
628
|
-
c,
|
|
629
628
|
d,
|
|
630
|
-
|
|
629
|
+
c,
|
|
630
|
+
a
|
|
631
631
|
)
|
|
632
|
-
),
|
|
633
|
-
i && i(
|
|
634
|
-
},
|
|
635
|
-
|
|
636
|
-
const m =
|
|
637
|
-
i && i(100, 100,
|
|
638
|
-
(p) =>
|
|
639
|
-
|
|
632
|
+
), c.onProgress = (d, g, m) => {
|
|
633
|
+
i && i(d / g * 100, 100, m.name);
|
|
634
|
+
}, c.onFinish = (d) => {
|
|
635
|
+
d.forEach((g) => {
|
|
636
|
+
const m = g;
|
|
637
|
+
i && i(100, 100, g.name), l.forEach(
|
|
638
|
+
(p) => et(
|
|
639
|
+
g.name,
|
|
640
640
|
p,
|
|
641
641
|
t,
|
|
642
642
|
m.texture
|
|
643
643
|
)
|
|
644
644
|
);
|
|
645
|
-
}),
|
|
646
|
-
},
|
|
645
|
+
}), r();
|
|
646
|
+
}, c.loadAsync();
|
|
647
647
|
});
|
|
648
648
|
}
|
|
649
649
|
/**
|
|
@@ -653,19 +653,19 @@ class Xe {
|
|
|
653
653
|
* @param model The details for the new model, when undefined we should remove the variant associated to the given key.
|
|
654
654
|
* @param onProgress A load progress callback that can be used for loading bars and event timing.
|
|
655
655
|
*/
|
|
656
|
-
async applyModel(e, t, i,
|
|
657
|
-
var l,
|
|
656
|
+
async applyModel(e, t, i, a) {
|
|
657
|
+
var l, c;
|
|
658
658
|
if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
|
|
659
659
|
return this.keysThatRemovedBaseModel.includes(e) && this.setBaseModelEnabled(!0), (l = this.loadedContainerForKey.get(e)) == null || l.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), Promise.resolve(void 0);
|
|
660
|
-
this.loadedContainerForKey.has(e) && ((
|
|
661
|
-
const s = (await
|
|
660
|
+
this.loadedContainerForKey.has(e) && ((c = this.loadedContainerForKey.get(e)) == null || c.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), t && this.setBaseModelEnabled(!1);
|
|
661
|
+
const s = (await fe(i, this.scene, a)).instantiateModelsToScene(
|
|
662
662
|
this.renameClonedAsset,
|
|
663
663
|
!0
|
|
664
664
|
);
|
|
665
|
-
this.loadedContainerForKey.set(e, s), this.loadedMaterialsForKey.set(e,
|
|
665
|
+
this.loadedContainerForKey.set(e, s), this.loadedMaterialsForKey.set(e, ve(s));
|
|
666
666
|
const o = [];
|
|
667
|
-
return this.materialVariantMap.forEach(async (
|
|
668
|
-
o.push(this.applyMaterial(
|
|
667
|
+
return this.materialVariantMap.forEach(async (d, g) => {
|
|
668
|
+
o.push(this.applyMaterial(g, d));
|
|
669
669
|
}), await Promise.all(o), s;
|
|
670
670
|
}
|
|
671
671
|
dispose() {
|
|
@@ -688,51 +688,51 @@ class Xe {
|
|
|
688
688
|
}), e;
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function ve(n) {
|
|
692
692
|
const e = [];
|
|
693
|
-
return
|
|
693
|
+
return n.rootNodes.forEach((t) => {
|
|
694
694
|
t.getChildMeshes().forEach((i) => {
|
|
695
|
-
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((
|
|
696
|
-
const
|
|
697
|
-
|
|
695
|
+
i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((a) => {
|
|
696
|
+
const r = a.getMaterial(!1);
|
|
697
|
+
r && !e.includes(r) && e.push(r);
|
|
698
698
|
});
|
|
699
699
|
});
|
|
700
700
|
}), e;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
703
|
-
return
|
|
702
|
+
function ue(n, e = "") {
|
|
703
|
+
return n.map((t) => ({
|
|
704
704
|
name: t.name.substring(e.length),
|
|
705
705
|
loop: t.loopAnimation,
|
|
706
706
|
to: t.to,
|
|
707
707
|
from: t.from
|
|
708
708
|
}));
|
|
709
709
|
}
|
|
710
|
-
class
|
|
710
|
+
class st {
|
|
711
711
|
constructor(e) {
|
|
712
712
|
this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new b(), this.materialDeselectedObservable = new b(), this.materialVariantObservable = new b(), this.modelVariantObservable = new b(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.animations = [], this.initialized = !1, this.materials = [];
|
|
713
713
|
const {
|
|
714
714
|
enablePicking: t,
|
|
715
715
|
modelDetails: i,
|
|
716
|
-
previewService:
|
|
717
|
-
progressHandler:
|
|
716
|
+
previewService: a,
|
|
717
|
+
progressHandler: r,
|
|
718
718
|
scene: s
|
|
719
719
|
} = e;
|
|
720
|
-
this.enablePicking = t, this.contextService = i.contextService, this.id =
|
|
720
|
+
this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = a, this.scene = s, this.variantManager = new it(
|
|
721
721
|
s,
|
|
722
722
|
this.renameClonedAsset.bind(this),
|
|
723
723
|
this.setEnabled.bind(this)
|
|
724
724
|
), this.previewService.registerInitializedListener(
|
|
725
725
|
async () => await this.processQueuedEvents()
|
|
726
|
-
), this.transformRoot = new
|
|
727
|
-
const o = async () => (this.assetContainer = await
|
|
726
|
+
), this.transformRoot = new Se("root", this.scene);
|
|
727
|
+
const o = async () => (this.assetContainer = await fe(
|
|
728
728
|
i.model,
|
|
729
729
|
s,
|
|
730
|
-
|
|
730
|
+
r
|
|
731
731
|
), this.initialized = !0, this.instantiate(), this);
|
|
732
732
|
this.importPromise = o();
|
|
733
733
|
}
|
|
734
734
|
//#region Interface implementation
|
|
735
|
-
async applyMaterialVariant(e, t, i,
|
|
735
|
+
async applyMaterialVariant(e, t, i, a) {
|
|
736
736
|
if (this.previewService.getSceneInitializationProgress() !== 100 || !this.initialized) {
|
|
737
737
|
if (this.materialReadyToLoadCallbacks.has(e)) {
|
|
738
738
|
const s = this.materialReadyToLoadCallbacks.get(e);
|
|
@@ -743,7 +743,7 @@ class Je {
|
|
|
743
743
|
e,
|
|
744
744
|
t,
|
|
745
745
|
i,
|
|
746
|
-
|
|
746
|
+
a
|
|
747
747
|
)
|
|
748
748
|
);
|
|
749
749
|
} else {
|
|
@@ -759,13 +759,13 @@ class Je {
|
|
|
759
759
|
e,
|
|
760
760
|
t,
|
|
761
761
|
i,
|
|
762
|
-
|
|
762
|
+
a
|
|
763
763
|
)
|
|
764
764
|
);
|
|
765
765
|
}
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
|
-
const
|
|
768
|
+
const r = async () => {
|
|
769
769
|
await this.variantManager.applyMaterial(
|
|
770
770
|
e,
|
|
771
771
|
i,
|
|
@@ -776,24 +776,24 @@ class Je {
|
|
|
776
776
|
taskName: l
|
|
777
777
|
});
|
|
778
778
|
},
|
|
779
|
-
|
|
779
|
+
a
|
|
780
780
|
);
|
|
781
781
|
};
|
|
782
782
|
if (this.materialChangesInProgress.includes(e)) {
|
|
783
783
|
if (this.queuedMaterialChanges.has(e)) {
|
|
784
784
|
const s = this.queuedMaterialChanges.get(e);
|
|
785
|
-
s == null || s.set(t,
|
|
785
|
+
s == null || s.set(t, r);
|
|
786
786
|
} else {
|
|
787
787
|
this.queuedMaterialChanges.set(
|
|
788
788
|
e,
|
|
789
789
|
/* @__PURE__ */ new Map()
|
|
790
790
|
);
|
|
791
791
|
const s = this.queuedMaterialChanges.get(e);
|
|
792
|
-
s == null || s.set(t,
|
|
792
|
+
s == null || s.set(t, r);
|
|
793
793
|
}
|
|
794
794
|
return;
|
|
795
795
|
}
|
|
796
|
-
this.materialChangesInProgress.push(e), await
|
|
796
|
+
this.materialChangesInProgress.push(e), await r(), this.queuedMaterialChanges.has(e) && (this.queuedMaterialChanges.get(e).forEach(async (o) => {
|
|
797
797
|
await o();
|
|
798
798
|
}), this.queuedMaterialChanges.delete(e)), this.materialChangesInProgress.splice(
|
|
799
799
|
this.materialChangesInProgress.indexOf(e),
|
|
@@ -813,7 +813,7 @@ class Je {
|
|
|
813
813
|
);
|
|
814
814
|
return;
|
|
815
815
|
}
|
|
816
|
-
const
|
|
816
|
+
const a = () => this.variantManager.applyModel(
|
|
817
817
|
e,
|
|
818
818
|
i,
|
|
819
819
|
t == null ? void 0 : t.model,
|
|
@@ -825,18 +825,18 @@ class Je {
|
|
|
825
825
|
}
|
|
826
826
|
);
|
|
827
827
|
if (this.modelChangesInProgress.includes(e)) {
|
|
828
|
-
this.queuedModelChanges.set(e,
|
|
828
|
+
this.queuedModelChanges.set(e, a);
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
831
|
const s = await (async () => {
|
|
832
832
|
this.modelChangesInProgress.push(e);
|
|
833
|
-
let o = await
|
|
833
|
+
let o = await a();
|
|
834
834
|
return this.queuedModelChanges.has(e) && (o = await this.queuedModelChanges.get(e)(), this.queuedModelChanges.delete(e)), this.modelChangesInProgress.splice(
|
|
835
835
|
this.modelChangesInProgress.indexOf(e),
|
|
836
836
|
1
|
|
837
837
|
), o;
|
|
838
838
|
})();
|
|
839
|
-
this.modelInstance &&
|
|
839
|
+
this.modelInstance && be(this.modelInstance.animationGroups), this.contextService || (this.contextService = t == null ? void 0 : t.contextService), s ? this.configureModelInstance(s) : this.configureGlowLayer();
|
|
840
840
|
}
|
|
841
841
|
dispose() {
|
|
842
842
|
var e;
|
|
@@ -847,7 +847,7 @@ class Je {
|
|
|
847
847
|
this.queuedModelAnimation = e;
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
|
-
this.modelInstance &&
|
|
850
|
+
this.modelInstance && We(
|
|
851
851
|
[
|
|
852
852
|
...this.modelInstance.animationGroups,
|
|
853
853
|
...this.variantManager.getAnimationGroups()
|
|
@@ -861,7 +861,7 @@ class Je {
|
|
|
861
861
|
getAnimations(e) {
|
|
862
862
|
return [
|
|
863
863
|
...this.animations,
|
|
864
|
-
...e ?
|
|
864
|
+
...e ? ue(
|
|
865
865
|
this.variantManager.getAnimationGroups(),
|
|
866
866
|
this.renameClonedAsset("")
|
|
867
867
|
) : []
|
|
@@ -896,34 +896,38 @@ class Je {
|
|
|
896
896
|
return this.transformRoot.position;
|
|
897
897
|
}
|
|
898
898
|
set position(e) {
|
|
899
|
-
this.transformRoot.position = new
|
|
899
|
+
this.transformRoot.position = new u(e.x, e.y, e.z);
|
|
900
900
|
}
|
|
901
901
|
get rotation() {
|
|
902
|
-
return this.transformRoot.
|
|
902
|
+
return this.transformRoot.rotationQuaternion.toEulerAngles();
|
|
903
903
|
}
|
|
904
904
|
set rotation(e) {
|
|
905
|
-
this.transformRoot.
|
|
905
|
+
this.transformRoot.rotationQuaternion = C.FromEulerAngles(
|
|
906
|
+
e.x,
|
|
907
|
+
e.y,
|
|
908
|
+
e.z
|
|
909
|
+
);
|
|
906
910
|
}
|
|
907
911
|
get scale() {
|
|
908
912
|
return this.transformRoot.scaling;
|
|
909
913
|
}
|
|
910
914
|
set scale(e) {
|
|
911
|
-
this.transformRoot.scaling = new
|
|
915
|
+
this.transformRoot.scaling = new u(e.x, e.y, e.z);
|
|
912
916
|
}
|
|
913
917
|
//#endregion
|
|
914
918
|
//#region Custom implementation functions
|
|
915
919
|
attachPickingHandler(e) {
|
|
916
920
|
e.rootNodes.forEach((t) => {
|
|
917
921
|
t.getChildMeshes(!1).forEach((i) => {
|
|
918
|
-
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new
|
|
919
|
-
new
|
|
920
|
-
|
|
922
|
+
i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new A(this.scene)), i.actionManager.registerAction(
|
|
923
|
+
new re(A.OnPointerOverTrigger, (a) => {
|
|
924
|
+
a.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
|
|
921
925
|
id: i.material.id,
|
|
922
926
|
name: this.stripIdFromName(i.material.name)
|
|
923
927
|
});
|
|
924
928
|
})
|
|
925
929
|
), i.actionManager.registerAction(
|
|
926
|
-
new
|
|
930
|
+
new re(A.OnPointerOutTrigger, () => {
|
|
927
931
|
i.material && this.materialDeselectedObservable.notifyObservers({
|
|
928
932
|
id: i.material.id,
|
|
929
933
|
name: this.stripIdFromName(i.material.name)
|
|
@@ -952,17 +956,15 @@ class Je {
|
|
|
952
956
|
return this.modelReadyToLoadCallbacks.size;
|
|
953
957
|
}
|
|
954
958
|
configureGlowLayer() {
|
|
955
|
-
const e = (i) => i instanceof
|
|
959
|
+
const e = (i) => i instanceof F && i.emissiveTexture !== null;
|
|
956
960
|
this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
|
|
957
961
|
}
|
|
958
962
|
configureModelInstance(e) {
|
|
959
|
-
var
|
|
960
|
-
const t = this.transformRoot.position, i = this.transformRoot.
|
|
961
|
-
this.transformRoot.position =
|
|
962
|
-
s.
|
|
963
|
-
|
|
964
|
-
});
|
|
965
|
-
}), this.transformRoot.position = t, this.transformRoot.rotation = i, this.transformRoot.scaling = r, this.canvasPanels = ((n = this.contextService) == null ? void 0 : n.getAll()) || /* @__PURE__ */ new Map(), Ve(
|
|
963
|
+
var r;
|
|
964
|
+
const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, a = this.transformRoot.scaling;
|
|
965
|
+
this.transformRoot.position = u.Zero(), this.transformRoot.rotationQuaternion = C.Identity(), this.transformRoot.scaling = u.One(), e.rootNodes.forEach((s) => {
|
|
966
|
+
s.parent = this.transformRoot;
|
|
967
|
+
}), this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), qe(
|
|
966
968
|
this.materials.concat(this.variantManager.getAllMaterials()),
|
|
967
969
|
this.scene,
|
|
968
970
|
this.canvasPanels,
|
|
@@ -980,14 +982,14 @@ class Je {
|
|
|
980
982
|
getAllMeshes() {
|
|
981
983
|
var e;
|
|
982
984
|
return (e = this.modelInstance) == null ? void 0 : e.rootNodes.map(
|
|
983
|
-
(t) => t.getChildMeshes(!1).filter((i) => i instanceof
|
|
985
|
+
(t) => t.getChildMeshes(!1).filter((i) => i instanceof Ie)
|
|
984
986
|
).flat();
|
|
985
987
|
}
|
|
986
988
|
instantiate() {
|
|
987
989
|
this.modelInstance = this.assetContainer.instantiateModelsToScene(
|
|
988
990
|
this.renameClonedAsset.bind(this),
|
|
989
991
|
!0
|
|
990
|
-
), this.materials =
|
|
992
|
+
), this.materials = ve(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = ue(
|
|
991
993
|
this.modelInstance.animationGroups,
|
|
992
994
|
this.renameClonedAsset("")
|
|
993
995
|
), this.processQueuedEvents();
|
|
@@ -1002,8 +1004,8 @@ class Je {
|
|
|
1002
1004
|
var e;
|
|
1003
1005
|
(e = this.canvasPanels) == null || e.forEach(
|
|
1004
1006
|
(t, i) => {
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1007
|
+
const a = this.dynamicTextures.get(i);
|
|
1008
|
+
a && t.getStaticContextDirty() && a.isReady() && (a.update(!1), t.setStaticContextDirty(!1));
|
|
1007
1009
|
}
|
|
1008
1010
|
);
|
|
1009
1011
|
}
|
|
@@ -1037,17 +1039,17 @@ class Je {
|
|
|
1037
1039
|
}
|
|
1038
1040
|
//#endregion
|
|
1039
1041
|
}
|
|
1040
|
-
class
|
|
1041
|
-
constructor(e, t, i,
|
|
1042
|
+
class B extends ge {
|
|
1043
|
+
constructor(e, t, i, a, r, s, o, l) {
|
|
1042
1044
|
super(
|
|
1043
1045
|
e,
|
|
1044
1046
|
t,
|
|
1045
1047
|
i,
|
|
1048
|
+
a,
|
|
1046
1049
|
r,
|
|
1047
|
-
n,
|
|
1048
1050
|
s,
|
|
1049
1051
|
l
|
|
1050
|
-
), this.lastFocus = new
|
|
1052
|
+
), this.lastFocus = new u(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, o.camera.autoOrientation && (this.alpha += Math.PI), o && (o.camera.limits.min.beta && (this.lowerBetaLimit = o.camera.limits.min.beta), o.camera.limits.max.beta && (this.upperBetaLimit = o.camera.limits.max.beta), o.camera.limits.min.alpha && (this.lowerAlphaLimit = o.camera.limits.min.alpha), o.camera.limits.max.alpha && (this.upperAlphaLimit = o.camera.limits.max.alpha), o.camera.limits.min.radius && (this.lowerRadiusLimit = o.camera.limits.min.radius), o.camera.limits.max.radius && (this.upperRadiusLimit = o.camera.limits.max.radius), o.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
|
|
1051
1053
|
o.camera.autoRotation.idleTimeMs
|
|
1052
1054
|
));
|
|
1053
1055
|
}
|
|
@@ -1085,14 +1087,14 @@ class I extends he {
|
|
|
1085
1087
|
rerunFramingBehavior(e, t) {
|
|
1086
1088
|
const i = this.getFramingBehavior();
|
|
1087
1089
|
i.framingTime = t || 800;
|
|
1088
|
-
const
|
|
1090
|
+
const a = () => {
|
|
1089
1091
|
e && e();
|
|
1090
|
-
},
|
|
1092
|
+
}, r = R(this._scene), s = r.max.subtract(r.min), o = r.min.add(s.scale(0.5));
|
|
1091
1093
|
this.setRadius(s.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(o), this.panDenominator = s.length(), i.zoomOnBoundingInfo(
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
+
r.min,
|
|
1095
|
+
r.max,
|
|
1094
1096
|
void 0,
|
|
1095
|
-
|
|
1097
|
+
a
|
|
1096
1098
|
), i.framingTime = 0;
|
|
1097
1099
|
}
|
|
1098
1100
|
/**
|
|
@@ -1122,32 +1124,32 @@ class I extends he {
|
|
|
1122
1124
|
* @param assignActive If true the camera will be assigned as the active camera on the scene.
|
|
1123
1125
|
*/
|
|
1124
1126
|
static create(e, t, i) {
|
|
1125
|
-
const
|
|
1127
|
+
const a = R(e), r = a.max.subtract(a.min), s = a.min.add(r.scale(0.5)), o = new B(
|
|
1126
1128
|
"ProductCamera",
|
|
1127
1129
|
-(Math.PI / 2),
|
|
1128
1130
|
Math.PI / 2,
|
|
1129
|
-
|
|
1131
|
+
r.length() * 1.5,
|
|
1130
1132
|
s,
|
|
1131
1133
|
e,
|
|
1132
1134
|
t
|
|
1133
1135
|
);
|
|
1134
|
-
return o.panningInertia = 0, o.panningOriginTarget.copyFrom(s), o.panDenominator =
|
|
1136
|
+
return o.panningInertia = 0, o.panningOriginTarget.copyFrom(s), o.panDenominator = r.length(), o.onAfterCheckInputsObservable.add(() => {
|
|
1135
1137
|
o.panningSensibility = 1e3 / o.panDenominator;
|
|
1136
1138
|
}), i && (e.activeCamera = o), o;
|
|
1137
1139
|
}
|
|
1138
1140
|
}
|
|
1139
|
-
function R(
|
|
1140
|
-
if (
|
|
1141
|
+
function R(n) {
|
|
1142
|
+
if (n.meshes.length === 0)
|
|
1141
1143
|
return {
|
|
1142
|
-
min: new
|
|
1143
|
-
max: new
|
|
1144
|
+
min: new u(-1, -1, -1),
|
|
1145
|
+
max: new u(1, 1, 1)
|
|
1144
1146
|
};
|
|
1145
|
-
const e =
|
|
1146
|
-
return
|
|
1147
|
+
const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
|
|
1148
|
+
return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
|
|
1147
1149
|
}
|
|
1148
|
-
class
|
|
1150
|
+
class nt {
|
|
1149
1151
|
constructor(e, t = !1, i = void 0) {
|
|
1150
|
-
this.renderingPipeline = new
|
|
1152
|
+
this.renderingPipeline = new Ve(
|
|
1151
1153
|
"default",
|
|
1152
1154
|
t,
|
|
1153
1155
|
e,
|
|
@@ -1163,92 +1165,98 @@ class et {
|
|
|
1163
1165
|
return this.currentConfiguration;
|
|
1164
1166
|
}
|
|
1165
1167
|
setConfiguration(e) {
|
|
1166
|
-
var t, i,
|
|
1168
|
+
var t, i, a, r, s, o, l, c, d, g, m, p, D, z, k, V, N, G, H, _, q, K, U, W, Q, Z, $, Y, j, X, J, ee, te;
|
|
1167
1169
|
if (this.renderingPipeline.isSupported) {
|
|
1168
|
-
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 = ((
|
|
1170
|
+
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 = ((r = e.bloom) == null ? void 0 : r.kernel) ?? h.bloom.kernel, this.renderingPipeline.bloomScale = ((s = e.bloom) == null ? void 0 : s.scale) ?? h.bloom.scale, this.renderingPipeline.bloomThreshold = ((o = e.bloom) == null ? void 0 : o.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 = ((g = e.chromaticAberration) == null ? void 0 : g.radialIntensity) ?? h.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ie(
|
|
1169
1171
|
e.chromaticAberration.direction.x,
|
|
1170
1172
|
e.chromaticAberration.direction.y
|
|
1171
|
-
) : new
|
|
1173
|
+
) : new ie(
|
|
1172
1174
|
h.chromaticAberration.direction.x,
|
|
1173
1175
|
h.chromaticAberration.direction.y
|
|
1174
|
-
), 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
|
|
1176
|
+
), 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 = ((D = e.depthOfField) == null ? void 0 : D.enabled) ?? h.depthOfField.enabled, e.depthOfField)
|
|
1175
1177
|
switch (e.depthOfField.blurLevel ?? h.depthOfField.blurLevel) {
|
|
1176
1178
|
case "Low":
|
|
1177
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1179
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
|
|
1178
1180
|
break;
|
|
1179
1181
|
case "Medium":
|
|
1180
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1182
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
|
|
1181
1183
|
break;
|
|
1182
1184
|
case "High":
|
|
1183
|
-
this.renderingPipeline.depthOfFieldBlurLevel =
|
|
1185
|
+
this.renderingPipeline.depthOfFieldBlurLevel = E.High;
|
|
1184
1186
|
break;
|
|
1185
1187
|
}
|
|
1186
|
-
if (this.renderingPipeline.depthOfField.focalLength = ((
|
|
1188
|
+
if (this.renderingPipeline.depthOfField.focalLength = ((z = e.depthOfField) == null ? void 0 : z.focalLength) ?? h.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((k = e.depthOfField) == null ? void 0 : k.fStop) ?? h.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? h.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((N = e.depthOfField) == null ? void 0 : N.lensSize) ?? h.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? h.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? h.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? h.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((q = e.misc) == null ? void 0 : q.contrast) ?? h.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? h.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? h.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
|
|
1187
1189
|
switch (e.misc.toneMappingType ?? h.misc.toneMappingType) {
|
|
1188
1190
|
case "Standard":
|
|
1189
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1191
|
+
this.renderingPipeline.imageProcessing.toneMappingType = y.TONEMAPPING_STANDARD;
|
|
1190
1192
|
break;
|
|
1191
1193
|
case "ACES":
|
|
1192
|
-
this.renderingPipeline.imageProcessing.toneMappingType =
|
|
1194
|
+
this.renderingPipeline.imageProcessing.toneMappingType = y.TONEMAPPING_ACES;
|
|
1193
1195
|
break;
|
|
1194
1196
|
}
|
|
1195
|
-
if (this.renderingPipeline.sharpenEnabled = ((
|
|
1196
|
-
switch (((
|
|
1197
|
+
if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? h.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? h.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? h.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = (($ = e.vignette) == null ? void 0 : $.enabled) ?? h.vignette.enabled, (Y = e.vignette) != null && Y.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)
|
|
1198
|
+
switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? h.vignette.blendMode) {
|
|
1197
1199
|
case "Multiply":
|
|
1198
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1200
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = y.VIGNETTEMODE_MULTIPLY;
|
|
1199
1201
|
break;
|
|
1200
1202
|
case "Opaque":
|
|
1201
|
-
this.renderingPipeline.imageProcessing.vignetteBlendMode =
|
|
1203
|
+
this.renderingPipeline.imageProcessing.vignetteBlendMode = y.VIGNETTEMODE_OPAQUE;
|
|
1202
1204
|
break;
|
|
1203
1205
|
}
|
|
1204
|
-
(
|
|
1206
|
+
(X = e.vignette) != null && X.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1205
1207
|
e.vignette.colorRgba.r,
|
|
1206
1208
|
e.vignette.colorRgba.g,
|
|
1207
1209
|
e.vignette.colorRgba.b,
|
|
1208
1210
|
e.vignette.colorRgba.a
|
|
1209
|
-
) : (
|
|
1211
|
+
) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = f.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new f(
|
|
1210
1212
|
h.vignette.colorRgba.r,
|
|
1211
1213
|
h.vignette.colorRgba.g,
|
|
1212
1214
|
h.vignette.colorRgba.b,
|
|
1213
1215
|
h.vignette.colorRgba.a
|
|
1214
|
-
), this.renderingPipeline.imageProcessing.vignetteStretch = ((
|
|
1216
|
+
), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? h.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? h.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
|
|
1215
1217
|
}
|
|
1216
1218
|
}
|
|
1217
1219
|
updateColorCurve(e) {
|
|
1218
|
-
const t = new
|
|
1220
|
+
const t = new ae();
|
|
1219
1221
|
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;
|
|
1220
1222
|
}
|
|
1221
1223
|
}
|
|
1222
|
-
|
|
1223
|
-
return new
|
|
1224
|
+
Le.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
|
|
1225
|
+
return new He(n);
|
|
1224
1226
|
});
|
|
1225
|
-
|
|
1226
|
-
if (
|
|
1227
|
-
const e =
|
|
1227
|
+
pe.OnPluginActivatedObservable.add((n) => {
|
|
1228
|
+
if (n.name === "gltf") {
|
|
1229
|
+
const e = n;
|
|
1228
1230
|
e.transparencyAsCoverage = !0;
|
|
1229
1231
|
}
|
|
1230
1232
|
});
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1233
|
+
const L = "initialScene";
|
|
1234
|
+
function O(n) {
|
|
1235
|
+
return new u(n.x, n.y, n.z);
|
|
1236
|
+
}
|
|
1237
|
+
function T(n) {
|
|
1238
|
+
return { x: n.x, y: n.y, z: n.z };
|
|
1239
|
+
}
|
|
1240
|
+
class Wt {
|
|
1233
1241
|
constructor(e) {
|
|
1234
1242
|
this.loadProgress = /* @__PURE__ */ new Map([
|
|
1235
|
-
[
|
|
1236
|
-
]), this.focusLostNotified = !1, this.loadObservable = new b(), this.focusLostObservable = new b(), this.initializedCallbacks = [], this.isInitialized = !1, this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.configuration = new
|
|
1243
|
+
[L, 0]
|
|
1244
|
+
]), this.focusLostNotified = !1, this.loadObservable = new b(), this.focusLostObservable = new b(), this.initializedCallbacks = [], this.isInitialized = !1, this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.configuration = new Ne(e);
|
|
1237
1245
|
const i = (() => {
|
|
1238
1246
|
if (!(e != null && e.noRender))
|
|
1239
1247
|
return this.configuration.createCanvas();
|
|
1240
|
-
})(),
|
|
1241
|
-
|
|
1248
|
+
})(), a = "1.5.6";
|
|
1249
|
+
Me.Configuration = {
|
|
1242
1250
|
decoder: {
|
|
1243
|
-
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1244
|
-
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1245
|
-
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${
|
|
1251
|
+
wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_wasm_wrapper_gltf.js`,
|
|
1252
|
+
wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.wasm`,
|
|
1253
|
+
fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.js`
|
|
1246
1254
|
}
|
|
1247
1255
|
}, i && (i.getContext("webgl2") || i.getContext("webgl"));
|
|
1248
|
-
const
|
|
1256
|
+
const r = console.log;
|
|
1249
1257
|
console.log = () => {
|
|
1250
1258
|
};
|
|
1251
|
-
const s = i ? new
|
|
1259
|
+
const s = i ? new me(i, !0, {
|
|
1252
1260
|
adaptToDeviceRatio: !0,
|
|
1253
1261
|
limitDeviceRatio: 2,
|
|
1254
1262
|
premultipliedAlpha: !1,
|
|
@@ -1256,12 +1264,12 @@ class _t {
|
|
|
1256
1264
|
audioEngine: !1,
|
|
1257
1265
|
stencil: this.configuration.highlights.enabled,
|
|
1258
1266
|
forceSRGBBufferSupportState: !0
|
|
1259
|
-
}) : new
|
|
1260
|
-
console.log =
|
|
1267
|
+
}) : new we();
|
|
1268
|
+
console.log = r, s.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = s, this.scene = new xe(s), this.camera = B.create(this.scene, this.configuration), this.renderingPipeline = new nt(
|
|
1261
1269
|
this.scene,
|
|
1262
1270
|
!1,
|
|
1263
1271
|
this.camera
|
|
1264
|
-
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new
|
|
1272
|
+
), this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast, this.glowLayerManager = new _e(
|
|
1265
1273
|
this.scene,
|
|
1266
1274
|
this.configuration.emissiveGlowIntensity
|
|
1267
1275
|
);
|
|
@@ -1306,7 +1314,7 @@ class _t {
|
|
|
1306
1314
|
}
|
|
1307
1315
|
registerView(e) {
|
|
1308
1316
|
const t = e.height, i = e.width;
|
|
1309
|
-
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(
|
|
1317
|
+
this.engine.registerView(e), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
|
|
1310
1318
|
}
|
|
1311
1319
|
getNumViewports() {
|
|
1312
1320
|
var e;
|
|
@@ -1319,11 +1327,11 @@ class _t {
|
|
|
1319
1327
|
this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
|
|
1320
1328
|
}
|
|
1321
1329
|
getSceneInitializationProgress() {
|
|
1322
|
-
return this.loadProgress.get(
|
|
1330
|
+
return this.loadProgress.get(L);
|
|
1323
1331
|
}
|
|
1324
1332
|
async initialize(e) {
|
|
1325
|
-
var i,
|
|
1326
|
-
this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture =
|
|
1333
|
+
var i, a;
|
|
1334
|
+
this.scene.clearColor = this.configuration.scene.clearColor, this.scene.environmentTexture = Pe.CreateFromPrefilteredData(
|
|
1327
1335
|
this.configuration.scene.environmentFile,
|
|
1328
1336
|
this.scene
|
|
1329
1337
|
);
|
|
@@ -1332,20 +1340,20 @@ class _t {
|
|
|
1332
1340
|
e,
|
|
1333
1341
|
(s) => {
|
|
1334
1342
|
this.loadProgress.set(
|
|
1335
|
-
|
|
1343
|
+
L,
|
|
1336
1344
|
s.loaded * 100 / s.total
|
|
1337
1345
|
), this.notifyLoadHandlers();
|
|
1338
1346
|
}
|
|
1339
|
-
).getInitializationPromise()), this.loadProgress.set(
|
|
1347
|
+
).getInitializationPromise()), this.loadProgress.set(L, 100), this.notifyLoadHandlers(), this.scene.activeCamera = this.camera, this.camera.rerunFramingBehavior(void 0, 1), Qe(this.scene), ((i = this.engine.views) == null ? void 0 : i.length) >= 1 && this.reattachControls(
|
|
1340
1348
|
this.engine.views[this.engine.views.length - 1].target
|
|
1341
|
-
), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0), this.isInitialized = !0, await Promise.all(this.initializedCallbacks.map((
|
|
1349
|
+
), this.queuedCameraAnimation && (this.executeCameraAnimation(this.queuedCameraAnimation), this.queuedCameraAnimation = void 0), this.isInitialized = !0, await Promise.all(this.initializedCallbacks.map((r) => r())), this.initializedCallbacks = [], (a = this.configuration.options) != null && a.renderingPipelineConfiguration && this.renderingPipeline.setConfiguration(
|
|
1342
1350
|
this.configuration.options.renderingPipelineConfiguration
|
|
1343
1351
|
), this.engine.runRenderLoop(() => {
|
|
1344
|
-
this.engine.views && (this.modelContainers.forEach((
|
|
1345
|
-
|
|
1346
|
-
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((
|
|
1352
|
+
this.engine.views && (this.modelContainers.forEach((r) => {
|
|
1353
|
+
r.updateDynamicTextures();
|
|
1354
|
+
}), this.configuration.scene.transparentBackground && this.engine.views.forEach((r) => {
|
|
1347
1355
|
const s = this.engine.getRenderingCanvas();
|
|
1348
|
-
|
|
1356
|
+
r.target.getContext("2d").clearRect(
|
|
1349
1357
|
0,
|
|
1350
1358
|
0,
|
|
1351
1359
|
s.width,
|
|
@@ -1359,7 +1367,7 @@ class _t {
|
|
|
1359
1367
|
this.queuedCameraAnimation = e;
|
|
1360
1368
|
return;
|
|
1361
1369
|
}
|
|
1362
|
-
|
|
1370
|
+
Ze(
|
|
1363
1371
|
this.scene,
|
|
1364
1372
|
this.scene.activeCamera,
|
|
1365
1373
|
e
|
|
@@ -1379,7 +1387,7 @@ class _t {
|
|
|
1379
1387
|
};
|
|
1380
1388
|
}
|
|
1381
1389
|
setCameraPose(e) {
|
|
1382
|
-
this.scene && this.camera && (this.camera.target = new
|
|
1390
|
+
this.scene && this.camera && (this.camera.target = new u(
|
|
1383
1391
|
e.target.x,
|
|
1384
1392
|
e.target.y,
|
|
1385
1393
|
e.target.z
|
|
@@ -1391,7 +1399,7 @@ class _t {
|
|
|
1391
1399
|
throw new Error(
|
|
1392
1400
|
"No views attached, camera state requires a view to attach controls onto."
|
|
1393
1401
|
);
|
|
1394
|
-
e ===
|
|
1402
|
+
e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
|
|
1395
1403
|
}
|
|
1396
1404
|
animateToLastCameraFocus() {
|
|
1397
1405
|
return new Promise((e) => {
|
|
@@ -1415,18 +1423,18 @@ class _t {
|
|
|
1415
1423
|
async renderSceneScreenshot(e, t) {
|
|
1416
1424
|
if (!this.camera)
|
|
1417
1425
|
throw new Error("Missing product camera, cannot render screenshot!");
|
|
1418
|
-
const i = new
|
|
1426
|
+
const i = new ge(
|
|
1419
1427
|
"screenshotCamera",
|
|
1420
1428
|
0,
|
|
1421
1429
|
0,
|
|
1422
1430
|
0,
|
|
1423
|
-
|
|
1431
|
+
u.Zero(),
|
|
1424
1432
|
this.scene
|
|
1425
1433
|
);
|
|
1426
1434
|
try {
|
|
1427
|
-
const
|
|
1428
|
-
i.target = t.target ? new
|
|
1429
|
-
const s = await
|
|
1435
|
+
const a = t.latDeg * Math.PI / 180, r = t.lonDeg * Math.PI / 180;
|
|
1436
|
+
i.target = t.target ? new u(t.target.x, t.target.y, t.target.z) : u.Zero(), i.alpha = r, i.beta = a, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
|
|
1437
|
+
const s = await ye.CreateScreenshotUsingRenderTargetAsync(
|
|
1430
1438
|
this.engine,
|
|
1431
1439
|
i,
|
|
1432
1440
|
e,
|
|
@@ -1443,26 +1451,26 @@ class _t {
|
|
|
1443
1451
|
const e = this.configuration;
|
|
1444
1452
|
if (!e)
|
|
1445
1453
|
return !0;
|
|
1446
|
-
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha,
|
|
1447
|
-
if (t === void 0 || i === void 0 ||
|
|
1454
|
+
const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, a = e.camera.limits.min.beta, r = e.camera.limits.max.beta;
|
|
1455
|
+
if (t === void 0 || i === void 0 || a === void 0 || r === void 0)
|
|
1448
1456
|
return !0;
|
|
1449
|
-
const s = [t, i], o = [
|
|
1450
|
-
return !l && !
|
|
1457
|
+
const s = [t, i], o = [a, r], l = s.every((d) => d === t), c = o.every((d) => d === a);
|
|
1458
|
+
return !l && !c;
|
|
1451
1459
|
}
|
|
1452
1460
|
fireResizeEvent() {
|
|
1453
1461
|
this.getNumViewports() > 0 && this.engine.resize();
|
|
1454
1462
|
}
|
|
1455
1463
|
setHighlights(e, t) {
|
|
1456
|
-
var
|
|
1457
|
-
e.length === 0 && ((
|
|
1464
|
+
var a;
|
|
1465
|
+
e.length === 0 && ((a = this.highlightLayer) == null || a.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new Ce("highlights", this.scene, {
|
|
1458
1466
|
isStroke: !0,
|
|
1459
1467
|
blurVerticalSize: 0.85,
|
|
1460
1468
|
blurHorizontalSize: 0.85
|
|
1461
1469
|
}), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
|
|
1462
1470
|
const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
|
|
1463
|
-
e.forEach((
|
|
1471
|
+
e.forEach((r) => {
|
|
1464
1472
|
const s = this.scene.materials.find(
|
|
1465
|
-
(o) => o.name ===
|
|
1473
|
+
(o) => o.name === r.name && o.id === r.id
|
|
1466
1474
|
);
|
|
1467
1475
|
s && s.getBindedMeshes().forEach(
|
|
1468
1476
|
(o) => {
|
|
@@ -1479,7 +1487,7 @@ class _t {
|
|
|
1479
1487
|
this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
|
|
1480
1488
|
}
|
|
1481
1489
|
loadModel(e, t) {
|
|
1482
|
-
const i = new
|
|
1490
|
+
const i = new st({
|
|
1483
1491
|
enablePicking: this.configuration.highlights.enabled,
|
|
1484
1492
|
modelDetails: e,
|
|
1485
1493
|
scene: this.scene,
|
|
@@ -1487,15 +1495,15 @@ class _t {
|
|
|
1487
1495
|
progressHandler: t
|
|
1488
1496
|
});
|
|
1489
1497
|
return i.registerMaterialVariantListener(
|
|
1490
|
-
(
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1498
|
+
(a) => this.handleMaterialProgressCallback(
|
|
1499
|
+
a.remainingCount,
|
|
1500
|
+
a.totalCount,
|
|
1501
|
+
a.taskName
|
|
1494
1502
|
)
|
|
1495
1503
|
), i.registerModelVariantListener(
|
|
1496
|
-
(
|
|
1497
|
-
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((
|
|
1498
|
-
this.setHighlights([
|
|
1504
|
+
(a) => this.handleModelProgressCallback(a, a.key)
|
|
1505
|
+
), this.configuration.highlights.enabled && (i.registerMaterialSelectedCallback((a) => {
|
|
1506
|
+
this.setHighlights([a]);
|
|
1499
1507
|
}), i.registerMaterialDeselectedCallback(() => {
|
|
1500
1508
|
this.setHighlights([]);
|
|
1501
1509
|
})), this.modelContainers.set(i.getId(), i), this.triggerModelLoadEvent({
|
|
@@ -1518,7 +1526,7 @@ class _t {
|
|
|
1518
1526
|
}
|
|
1519
1527
|
unregisterPlugin(e) {
|
|
1520
1528
|
const t = this.plugins.indexOf(e);
|
|
1521
|
-
t > -1 && this.plugins.splice(t, 1).forEach((
|
|
1529
|
+
t > -1 && this.plugins.splice(t, 1).forEach((a) => a.dispose(!1));
|
|
1522
1530
|
}
|
|
1523
1531
|
getGlowLayerManager() {
|
|
1524
1532
|
return this.glowLayerManager;
|
|
@@ -1532,6 +1540,21 @@ class _t {
|
|
|
1532
1540
|
triggerModelLoadEvent(e) {
|
|
1533
1541
|
this.modelLoadEventCallbacks.forEach((t) => t(e));
|
|
1534
1542
|
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Flips a transform around the origin.
|
|
1545
|
+
*/
|
|
1546
|
+
flipTransform(e = u.Zero(), t = u.Zero(), i = u.One()) {
|
|
1547
|
+
const a = se.Compose(
|
|
1548
|
+
O(i),
|
|
1549
|
+
C.FromEulerVector(O(t)),
|
|
1550
|
+
O(e)
|
|
1551
|
+
), r = se.RotationAxis(u.Up(), Math.PI), s = a.multiply(r), o = u.Zero(), l = C.Identity(), c = u.Zero();
|
|
1552
|
+
return s.decompose(c, l, o), l.multiplyInPlace(C.FromEulerAngles(0, Math.PI, 0)), {
|
|
1553
|
+
position: T(o),
|
|
1554
|
+
rotation: T(l.toEulerAngles()),
|
|
1555
|
+
scale: T(c)
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1535
1558
|
handleMaterialProgressCallback(e, t, i) {
|
|
1536
1559
|
this.loadProgress.set(`key_${i}`, e / t * 100), this.notifyLoadHandlers();
|
|
1537
1560
|
}
|
|
@@ -1556,8 +1579,8 @@ class _t {
|
|
|
1556
1579
|
*/
|
|
1557
1580
|
getLoadListenerEvent() {
|
|
1558
1581
|
const e = Array.from(this.loadProgress.values()).filter(
|
|
1559
|
-
(
|
|
1560
|
-
), i = e.reduce((
|
|
1582
|
+
(a) => a < 100
|
|
1583
|
+
), i = e.reduce((a, r) => a + r, 0) / e.length || 0;
|
|
1561
1584
|
return {
|
|
1562
1585
|
loadValue: e.length === 0 ? 100 : i,
|
|
1563
1586
|
sceneInitialized: this.getSceneInitializationProgress() === 100
|
|
@@ -1572,10 +1595,10 @@ class _t {
|
|
|
1572
1595
|
}
|
|
1573
1596
|
}
|
|
1574
1597
|
export {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1598
|
+
S as MaterialEffectMode,
|
|
1599
|
+
I as ProductCameraRig,
|
|
1600
|
+
Ge as REFLECTION_PROBE_RESOLUTION,
|
|
1601
|
+
M as RenderingConfiguration,
|
|
1602
|
+
Wt as SpiffCommerce3DPreviewService,
|
|
1580
1603
|
h as renderingPipelineDefaults
|
|
1581
1604
|
};
|