@shopware-ag/dive 2.2.15 → 2.2.17
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/build/chunks/{AssetCache-CQgIwNwG.mjs → AssetCache-Ba-m-7zA.mjs} +1 -1
- package/build/chunks/{AssetCache-BdosDtkN.cjs → AssetCache-CpKF1NzV.cjs} +1 -1
- package/build/chunks/AssetLoader-B03j7xvX.cjs +4 -0
- package/build/chunks/{AssetLoader-BCFFDoEG.mjs → AssetLoader-C2NGPDLw.mjs} +705 -677
- package/build/chunks/FileTypes-D5A0_pG_.cjs +29 -0
- package/build/chunks/{FileTypes-DTT9oIRm.mjs → FileTypes-Djlx9wth.mjs} +101 -99
- package/build/chunks/HDREnvorinment-CP2Uvq4_.cjs +5 -0
- package/build/chunks/HDREnvorinment-DKzwfsKr.mjs +257 -0
- package/build/chunks/{SelectTool-kFQjecRm.cjs → SelectTool-ClSKQ893.cjs} +1 -1
- package/build/chunks/{SelectTool-BIzbqC0O.mjs → SelectTool-D-StWurg.mjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +1 -1
- package/build/engine/scene/Scene.d.ts +1 -0
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/assetloader/src/loader/AssetLoader.d.ts +8 -1
- package/build/plugins/hdr/index.cjs +1 -1
- package/build/plugins/hdr/index.mjs +1 -1
- package/build/plugins/hdr/src/HDREnvorinment.d.ts +2 -0
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +21 -19
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +2 -2
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +1 -1
- package/build/chunks/AssetLoader-DnrCdOgm.cjs +0 -4
- package/build/chunks/FileTypes-D5y7I8ff.cjs +0 -29
- package/build/chunks/HDREnvorinment-BB0e9RQL.mjs +0 -255
- package/build/chunks/HDREnvorinment-BBSbZzgm.cjs +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var q = Object.defineProperty;
|
|
2
2
|
var K = (o, s, t) => s in o ? q(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
3
|
var i = (o, s, t) => K(o, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { WebGLRenderer as Q, PCFSoftShadowMap as J, PCFShadowMap as $, BasicShadowMap as j, MathUtils as
|
|
5
|
-
import { P as
|
|
4
|
+
import { WebGLRenderer as Q, PCFSoftShadowMap as J, PCFShadowMap as $, BasicShadowMap as j, MathUtils as I, Object3D as g, AmbientLight as tt, PointLight as et, SphereGeometry as T, MeshBasicMaterial as F, FrontSide as U, Mesh as S, HemisphereLight as it, DirectionalLight as st, Vector3 as h, Box3 as f, Box3Helper as at, Sphere as nt, MeshStandardMaterial as k, Raycaster as rt, CylinderGeometry as ot, BufferGeometry as Y, BufferAttribute as A, BoxGeometry as M, ConeGeometry as ht, LineDashedMaterial as lt, Line as dt, PlaneGeometry as ct, Color as E, GridHelper as ut, Scene as pt, TOUCH as p, MOUSE as u, EventDispatcher as mt, Spherical as C, Vector2 as c, Quaternion as O } from "three";
|
|
5
|
+
import { P as m, U as ft, H as gt, a as _t, D as z } from "./PerspectiveCamera-BFzE2TQU.mjs";
|
|
6
6
|
class wt {
|
|
7
7
|
constructor() {
|
|
8
8
|
i(this, "isDIVEClock", !0);
|
|
@@ -113,7 +113,7 @@ class yt {
|
|
|
113
113
|
class B {
|
|
114
114
|
constructor(s, t, e) {
|
|
115
115
|
i(this, "isDIVEView", !0);
|
|
116
|
-
i(this, "uuid",
|
|
116
|
+
i(this, "uuid", I.generateUUID());
|
|
117
117
|
i(this, "_paused", !1);
|
|
118
118
|
i(this, "_renderer");
|
|
119
119
|
i(this, "_resizeManager");
|
|
@@ -158,14 +158,14 @@ class B {
|
|
|
158
158
|
this._paused = !1;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
class bt extends
|
|
161
|
+
class bt extends g {
|
|
162
162
|
constructor() {
|
|
163
163
|
super();
|
|
164
164
|
i(this, "isDIVELight", !0);
|
|
165
165
|
i(this, "isDIVEAmbientLight", !0);
|
|
166
166
|
i(this, "isSelectable", !0);
|
|
167
167
|
i(this, "_light");
|
|
168
|
-
this.name = "DIVEAmbientLight", this._light = new tt(16777215, 1), this._light.layers.mask =
|
|
168
|
+
this.name = "DIVEAmbientLight", this._light = new tt(16777215, 1), this._light.layers.mask = m, this.add(this._light);
|
|
169
169
|
}
|
|
170
170
|
setColor(t) {
|
|
171
171
|
this._light.color = t;
|
|
@@ -177,7 +177,7 @@ class bt extends _ {
|
|
|
177
177
|
this._light.visible = t;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
class Dt extends
|
|
180
|
+
class Dt extends g {
|
|
181
181
|
constructor() {
|
|
182
182
|
super();
|
|
183
183
|
i(this, "isDIVELight", !0);
|
|
@@ -187,8 +187,8 @@ class Dt extends _ {
|
|
|
187
187
|
i(this, "gizmo", null);
|
|
188
188
|
i(this, "light");
|
|
189
189
|
i(this, "mesh");
|
|
190
|
-
this.name = "DIVEPointLight", this.light = new et(16777215, 1), this.light.layers.mask =
|
|
191
|
-
const t = 0.1, e = new
|
|
190
|
+
this.name = "DIVEPointLight", this.light = new et(16777215, 1), this.light.layers.mask = m, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
191
|
+
const t = 0.1, e = new T(
|
|
192
192
|
t,
|
|
193
193
|
t * 320,
|
|
194
194
|
t * 320
|
|
@@ -198,7 +198,7 @@ class Dt extends _ {
|
|
|
198
198
|
opacity: 0.8,
|
|
199
199
|
side: U
|
|
200
200
|
});
|
|
201
|
-
this.mesh = new
|
|
201
|
+
this.mesh = new S(e, a), this.mesh.layers.mask = ft, this.add(this.mesh);
|
|
202
202
|
}
|
|
203
203
|
setColor(t) {
|
|
204
204
|
this.light.color = t, this.mesh.material.color = t;
|
|
@@ -235,7 +235,7 @@ class Dt extends _ {
|
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
class Et extends
|
|
238
|
+
class Et extends g {
|
|
239
239
|
constructor() {
|
|
240
240
|
super();
|
|
241
241
|
i(this, "isDIVELight", !0);
|
|
@@ -243,7 +243,7 @@ class Et extends _ {
|
|
|
243
243
|
i(this, "isSelectable", !0);
|
|
244
244
|
i(this, "_hemiLight");
|
|
245
245
|
i(this, "_dirLight");
|
|
246
|
-
this.name = "DIVESceneLight", this._hemiLight = new it(16777215, 16777215, 2), this._hemiLight.layers.mask =
|
|
246
|
+
this.name = "DIVESceneLight", this._hemiLight = new it(16777215, 16777215, 2), this._hemiLight.layers.mask = m, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new st(16777215, 3), this._dirLight.layers.mask = m, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
|
|
247
247
|
const t = 5;
|
|
248
248
|
this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = t, this._dirLight.shadow.camera.top = t, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
|
|
249
249
|
}
|
|
@@ -258,7 +258,7 @@ class Et extends _ {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
const Z = (o) => o.parent ? Z(o.parent) : o;
|
|
261
|
-
class
|
|
261
|
+
class x extends g {
|
|
262
262
|
constructor() {
|
|
263
263
|
super();
|
|
264
264
|
i(this, "isSelectable", !0);
|
|
@@ -267,7 +267,7 @@ class V extends _ {
|
|
|
267
267
|
i(this, "gizmo", null);
|
|
268
268
|
i(this, "_positionWorldBuffer");
|
|
269
269
|
i(this, "_boundingBox");
|
|
270
|
-
this.layers.mask =
|
|
270
|
+
this.layers.mask = m, this._positionWorldBuffer = new h(), this._boundingBox = new f();
|
|
271
271
|
}
|
|
272
272
|
setPosition(t) {
|
|
273
273
|
if (!this.parent) {
|
|
@@ -328,7 +328,7 @@ class V extends _ {
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
class
|
|
331
|
+
class L extends x {
|
|
332
332
|
/**
|
|
333
333
|
* Creates a new BoundingBox instance for the specified 3D object.
|
|
334
334
|
*
|
|
@@ -367,17 +367,16 @@ class T extends V {
|
|
|
367
367
|
i(this, "_sphereHelper");
|
|
368
368
|
/** The dimensions (width, height, depth) of the bounding box */
|
|
369
369
|
i(this, "_size");
|
|
370
|
-
const n = new
|
|
370
|
+
const n = new f();
|
|
371
371
|
e ? n.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
|
|
372
|
-
if (l.isMesh)
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
372
|
+
if (!("isMesh" in l) || !l.isMesh) return;
|
|
373
|
+
const d = l;
|
|
374
|
+
d.geometry.computeBoundingBox(), d.geometry.boundingBox && n.union(
|
|
375
|
+
d.geometry.boundingBox.clone().applyMatrix4(d.matrixWorld)
|
|
376
|
+
);
|
|
378
377
|
})), this.rotation.copy(t.rotation), this._box = n, this._size = n.getSize(new h()), this._center = n.getCenter(new h()), this._boxHelper = new at(this._box, a), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = n.getBoundingSphere(new nt()), this._radius = this._sphere.radius;
|
|
379
|
-
const r = new
|
|
380
|
-
r.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new
|
|
378
|
+
const r = new T(this._radius, 32, 32);
|
|
379
|
+
r.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new S(
|
|
381
380
|
r,
|
|
382
381
|
new F({ color: a, wireframe: !0 })
|
|
383
382
|
), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
|
|
@@ -456,7 +455,7 @@ class T extends V {
|
|
|
456
455
|
this._sphereHelper.visible = t;
|
|
457
456
|
}
|
|
458
457
|
}
|
|
459
|
-
class N extends
|
|
458
|
+
class N extends x {
|
|
460
459
|
constructor() {
|
|
461
460
|
super();
|
|
462
461
|
i(this, "isDIVEModel", !0);
|
|
@@ -484,13 +483,13 @@ class N extends V {
|
|
|
484
483
|
}), this.add(this._gltf), this;
|
|
485
484
|
}
|
|
486
485
|
setMaterial(t) {
|
|
487
|
-
this._material || (this._material = new
|
|
486
|
+
this._material || (this._material = new k()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
488
487
|
}
|
|
489
488
|
placeOnFloor() {
|
|
490
489
|
this.updateWorldMatrix(!0, !0);
|
|
491
|
-
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new
|
|
490
|
+
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new f();
|
|
492
491
|
this.children.forEach((r) => {
|
|
493
|
-
r instanceof
|
|
492
|
+
r instanceof L || a.expandByObject(r, !0);
|
|
494
493
|
});
|
|
495
494
|
const n = -a.min.y;
|
|
496
495
|
Math.abs(n) < 1e-9 || (t.y += n, t.y !== e.y && (this.setPosition(t), import("../plugins/state/index.mjs").then(({ State: r }) => {
|
|
@@ -511,24 +510,24 @@ class N extends V {
|
|
|
511
510
|
);
|
|
512
511
|
return;
|
|
513
512
|
}
|
|
514
|
-
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new
|
|
513
|
+
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new f();
|
|
515
514
|
this.children.forEach((d) => {
|
|
516
|
-
d instanceof
|
|
515
|
+
d instanceof L || a.expandByObject(d, !0);
|
|
517
516
|
});
|
|
518
517
|
const n = a.getCenter(new h());
|
|
519
518
|
n.y = a.min.y;
|
|
520
519
|
const r = new rt(n, new h(0, -1, 0));
|
|
521
|
-
r.layers.mask =
|
|
520
|
+
r.layers.mask = m;
|
|
522
521
|
const l = r.intersectObjects(
|
|
523
522
|
Z(this).root.children,
|
|
524
523
|
!0
|
|
525
524
|
);
|
|
526
525
|
if (l.length > 0) {
|
|
527
|
-
const d = l[0].object,
|
|
528
|
-
if (Math.abs(
|
|
529
|
-
this.setPosition(t), import("../plugins/state/index.mjs").then(({ State:
|
|
530
|
-
var
|
|
531
|
-
(
|
|
526
|
+
const d = l[0].object, w = new f().setFromObject(d).max.y - a.min.y;
|
|
527
|
+
if (Math.abs(w) < 1e-9 || (t.y += w, t.y === e.y)) return;
|
|
528
|
+
this.setPosition(t), import("../plugins/state/index.mjs").then(({ State: v }) => {
|
|
529
|
+
var y;
|
|
530
|
+
(y = v.get(this.userData.id)) == null || y.performAction("UPDATE_OBJECT", {
|
|
532
531
|
id: this.userData.id,
|
|
533
532
|
position: t,
|
|
534
533
|
rotation: this.rotation,
|
|
@@ -545,7 +544,7 @@ class St extends N {
|
|
|
545
544
|
i(this, "isDIVEPrimitive", !0);
|
|
546
545
|
i(this, "_mesh");
|
|
547
546
|
i(this, "_material");
|
|
548
|
-
this._mesh = new
|
|
547
|
+
this._mesh = new S(), this._mesh.name = "PrimitiveMesh", this._mesh.layers.mask = m, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this.add(this._mesh), this._material = new k(), this._mesh.material = this._material;
|
|
549
548
|
}
|
|
550
549
|
setGeometry(t) {
|
|
551
550
|
const e = this.assembleGeometry(t);
|
|
@@ -585,7 +584,7 @@ class St extends N {
|
|
|
585
584
|
return e.translate(0, t.height / 2, 0), e;
|
|
586
585
|
}
|
|
587
586
|
createSphereGeometry(t) {
|
|
588
|
-
return new
|
|
587
|
+
return new T(t.width / 2, 256, 256);
|
|
589
588
|
}
|
|
590
589
|
createPyramidGeometry(t) {
|
|
591
590
|
const e = new Float32Array([
|
|
@@ -630,11 +629,11 @@ class St extends N {
|
|
|
630
629
|
]), n = new Y();
|
|
631
630
|
return n.setAttribute(
|
|
632
631
|
"position",
|
|
633
|
-
new
|
|
634
|
-
), n.setIndex(new
|
|
632
|
+
new A(e, 3)
|
|
633
|
+
), n.setIndex(new A(a, 1)), n;
|
|
635
634
|
}
|
|
636
635
|
createBoxGeometry(t) {
|
|
637
|
-
const e = new
|
|
636
|
+
const e = new M(
|
|
638
637
|
t.width,
|
|
639
638
|
t.height,
|
|
640
639
|
t.depth
|
|
@@ -646,7 +645,7 @@ class St extends N {
|
|
|
646
645
|
return e.translate(0, t.height / 2, 0), e;
|
|
647
646
|
}
|
|
648
647
|
createWallGeometry(t) {
|
|
649
|
-
const e = new
|
|
648
|
+
const e = new M(
|
|
650
649
|
t.width,
|
|
651
650
|
t.height,
|
|
652
651
|
t.depth || 0.05,
|
|
@@ -655,7 +654,7 @@ class St extends N {
|
|
|
655
654
|
return e.translate(0, t.height / 2, 0), e;
|
|
656
655
|
}
|
|
657
656
|
createPlaneGeometry(t) {
|
|
658
|
-
const e = new
|
|
657
|
+
const e = new M(
|
|
659
658
|
t.width,
|
|
660
659
|
t.height,
|
|
661
660
|
t.depth
|
|
@@ -663,7 +662,7 @@ class St extends N {
|
|
|
663
662
|
return e.translate(0, t.height / 2, 0), e;
|
|
664
663
|
}
|
|
665
664
|
}
|
|
666
|
-
class Pt extends
|
|
665
|
+
class Pt extends x {
|
|
667
666
|
// lines to children
|
|
668
667
|
constructor() {
|
|
669
668
|
super();
|
|
@@ -782,26 +781,26 @@ class Pt extends V {
|
|
|
782
781
|
// this._boxMesh.visible = true;
|
|
783
782
|
// }
|
|
784
783
|
}
|
|
785
|
-
class vt extends
|
|
784
|
+
class vt extends S {
|
|
786
785
|
constructor() {
|
|
787
786
|
const t = new ct(1, 1);
|
|
788
787
|
t.scale(1e3, 1e3, 1), t.rotateX(-Math.PI / 2);
|
|
789
|
-
const e = new
|
|
790
|
-
color: new
|
|
788
|
+
const e = new k({
|
|
789
|
+
color: new E(16777215),
|
|
791
790
|
side: U
|
|
792
791
|
});
|
|
793
792
|
super(t, e);
|
|
794
793
|
i(this, "isDIVEFloor", !0);
|
|
795
|
-
this.name = "Floor", this.layers.mask =
|
|
794
|
+
this.name = "Floor", this.layers.mask = m, this.receiveShadow = !0;
|
|
796
795
|
}
|
|
797
796
|
setVisibility(t) {
|
|
798
797
|
this.visible = t;
|
|
799
798
|
}
|
|
800
799
|
setColor(t) {
|
|
801
|
-
this.material.color = new
|
|
800
|
+
this.material.color = new E(t);
|
|
802
801
|
}
|
|
803
802
|
}
|
|
804
|
-
class Mt extends
|
|
803
|
+
class Mt extends g {
|
|
805
804
|
constructor() {
|
|
806
805
|
super();
|
|
807
806
|
i(this, "isDIVERoot", !0);
|
|
@@ -812,7 +811,7 @@ class Mt extends _ {
|
|
|
812
811
|
return this._floor;
|
|
813
812
|
}
|
|
814
813
|
computeSceneBB() {
|
|
815
|
-
const t = new
|
|
814
|
+
const t = new f();
|
|
816
815
|
return this.children.forEach((e) => {
|
|
817
816
|
"isDIVEFloor" in e || e.traverse((a) => {
|
|
818
817
|
"isObject3D" in a && t.expandByObject(a);
|
|
@@ -946,7 +945,7 @@ class Mt extends _ {
|
|
|
946
945
|
e.position.x,
|
|
947
946
|
e.position.y,
|
|
948
947
|
e.position.z
|
|
949
|
-
), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new
|
|
948
|
+
), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new E(e.color)), e.visible !== void 0 && e.visible !== null && (t.visible = e.visible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
|
|
950
949
|
}
|
|
951
950
|
_updateModel(t, e) {
|
|
952
951
|
e.uri !== void 0 && t.setFromURL(e.uri), e.name !== void 0 && (t.name = e.name), e.position !== void 0 && t.setPosition(e.position), e.rotation !== void 0 && t.setRotation(e.rotation), e.scale !== void 0 && t.setScale(e.scale), e.visible !== void 0 && t.setVisibility(e.visible), e.material !== void 0 && t.setMaterial(e.material), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
|
|
@@ -994,7 +993,7 @@ class Mt extends _ {
|
|
|
994
993
|
}
|
|
995
994
|
}
|
|
996
995
|
const Lt = "#888888", It = "#dddddd";
|
|
997
|
-
class Tt extends
|
|
996
|
+
class Tt extends g {
|
|
998
997
|
constructor() {
|
|
999
998
|
super(), this.name = "Grid";
|
|
1000
999
|
const s = new ut(
|
|
@@ -1009,7 +1008,7 @@ class Tt extends _ {
|
|
|
1009
1008
|
this.visible = s;
|
|
1010
1009
|
}
|
|
1011
1010
|
}
|
|
1012
|
-
const
|
|
1011
|
+
const D = {
|
|
1013
1012
|
displayFloor: !1,
|
|
1014
1013
|
displayGrid: !1,
|
|
1015
1014
|
backgroundColor: "#ffffff"
|
|
@@ -1021,11 +1020,11 @@ class kt extends pt {
|
|
|
1021
1020
|
i(this, "_root");
|
|
1022
1021
|
i(this, "_grid");
|
|
1023
1022
|
this.setBackground(
|
|
1024
|
-
(t == null ? void 0 : t.backgroundColor) ??
|
|
1023
|
+
(t == null ? void 0 : t.backgroundColor) ?? D.backgroundColor
|
|
1025
1024
|
), this._root = new Mt(), this._root.floor.setVisibility(
|
|
1026
|
-
(t == null ? void 0 : t.displayFloor) ??
|
|
1025
|
+
(t == null ? void 0 : t.displayFloor) ?? D.displayFloor
|
|
1027
1026
|
), this.add(this._root), this._grid = new Tt(), this._grid.setVisibility(
|
|
1028
|
-
(t == null ? void 0 : t.displayGrid) ??
|
|
1027
|
+
(t == null ? void 0 : t.displayGrid) ?? D.displayGrid
|
|
1029
1028
|
), this.add(this._grid);
|
|
1030
1029
|
}
|
|
1031
1030
|
get root() {
|
|
@@ -1035,11 +1034,14 @@ class kt extends pt {
|
|
|
1035
1034
|
return this._grid;
|
|
1036
1035
|
}
|
|
1037
1036
|
setBackground(t) {
|
|
1038
|
-
this.background = new
|
|
1037
|
+
this.background = new E(t);
|
|
1039
1038
|
}
|
|
1040
1039
|
computeSceneBB() {
|
|
1041
1040
|
return this._root.computeSceneBB();
|
|
1042
1041
|
}
|
|
1042
|
+
dispose() {
|
|
1043
|
+
this.remove(this._root), this.remove(this._grid);
|
|
1044
|
+
}
|
|
1043
1045
|
}
|
|
1044
1046
|
const xt = {
|
|
1045
1047
|
enableDamping: !0,
|
|
@@ -1071,15 +1073,15 @@ const xt = {
|
|
|
1071
1073
|
BOTTOM: "ArrowDown"
|
|
1072
1074
|
},
|
|
1073
1075
|
mouseButtons: {
|
|
1074
|
-
LEFT:
|
|
1075
|
-
MIDDLE:
|
|
1076
|
-
RIGHT:
|
|
1076
|
+
LEFT: u.ROTATE,
|
|
1077
|
+
MIDDLE: u.DOLLY,
|
|
1078
|
+
RIGHT: u.PAN
|
|
1077
1079
|
},
|
|
1078
1080
|
touches: {
|
|
1079
|
-
ONE:
|
|
1080
|
-
TWO:
|
|
1081
|
+
ONE: p.ROTATE,
|
|
1082
|
+
TWO: p.DOLLY_PAN
|
|
1081
1083
|
}
|
|
1082
|
-
},
|
|
1084
|
+
}, _ = class _ extends mt {
|
|
1083
1085
|
constructor(t, e, a) {
|
|
1084
1086
|
super();
|
|
1085
1087
|
// public API
|
|
@@ -1118,20 +1120,20 @@ const xt = {
|
|
|
1118
1120
|
BOTTOM: "ArrowDown"
|
|
1119
1121
|
});
|
|
1120
1122
|
i(this, "mouseButtons", {
|
|
1121
|
-
LEFT:
|
|
1122
|
-
MIDDLE:
|
|
1123
|
-
RIGHT:
|
|
1123
|
+
LEFT: u.ROTATE,
|
|
1124
|
+
MIDDLE: u.DOLLY,
|
|
1125
|
+
RIGHT: u.PAN
|
|
1124
1126
|
});
|
|
1125
|
-
i(this, "touches", { ONE:
|
|
1127
|
+
i(this, "touches", { ONE: p.ROTATE, TWO: p.DOLLY_PAN });
|
|
1126
1128
|
i(this, "target0");
|
|
1127
1129
|
i(this, "position0");
|
|
1128
1130
|
i(this, "zoom0");
|
|
1129
|
-
i(this, "uuid",
|
|
1131
|
+
i(this, "uuid", I.generateUUID());
|
|
1130
1132
|
// private state
|
|
1131
1133
|
i(this, "state", -1);
|
|
1132
1134
|
i(this, "EPS", 1e-6);
|
|
1133
|
-
i(this, "spherical", new
|
|
1134
|
-
i(this, "sphericalDelta", new
|
|
1135
|
+
i(this, "spherical", new C());
|
|
1136
|
+
i(this, "sphericalDelta", new C());
|
|
1135
1137
|
i(this, "scale", 1);
|
|
1136
1138
|
i(this, "panOffset", new h());
|
|
1137
1139
|
i(this, "zoomChanged", !1);
|
|
@@ -1151,7 +1153,7 @@ const xt = {
|
|
|
1151
1153
|
i(this, "quat");
|
|
1152
1154
|
i(this, "quatInverse");
|
|
1153
1155
|
i(this, "lastPosition", new h());
|
|
1154
|
-
i(this, "lastQuaternion", new
|
|
1156
|
+
i(this, "lastQuaternion", new O());
|
|
1155
1157
|
i(this, "lastTarget", new h());
|
|
1156
1158
|
i(this, "panLeft", (() => {
|
|
1157
1159
|
const t = new h();
|
|
@@ -1181,11 +1183,11 @@ const xt = {
|
|
|
1181
1183
|
e = -1;
|
|
1182
1184
|
}
|
|
1183
1185
|
switch (e) {
|
|
1184
|
-
case
|
|
1186
|
+
case u.DOLLY:
|
|
1185
1187
|
if (this.enableZoom === !1) return;
|
|
1186
1188
|
this.handleMouseDownDolly(t), this.state = 1;
|
|
1187
1189
|
break;
|
|
1188
|
-
case
|
|
1190
|
+
case u.ROTATE:
|
|
1189
1191
|
if (t.ctrlKey || t.metaKey || t.shiftKey) {
|
|
1190
1192
|
if (this.enablePan === !1) return;
|
|
1191
1193
|
this.handleMouseDownPan(t), this.state = 2;
|
|
@@ -1194,7 +1196,7 @@ const xt = {
|
|
|
1194
1196
|
this.handleMouseDownRotate(t), this.state = 0;
|
|
1195
1197
|
}
|
|
1196
1198
|
break;
|
|
1197
|
-
case
|
|
1199
|
+
case u.PAN:
|
|
1198
1200
|
if (t.ctrlKey || t.metaKey || t.shiftKey) {
|
|
1199
1201
|
if (this.enableRotate === !1) return;
|
|
1200
1202
|
this.handleMouseDownRotate(t), this.state = 0;
|
|
@@ -1235,11 +1237,11 @@ const xt = {
|
|
|
1235
1237
|
switch (this.trackPointer(t), this.pointers.length) {
|
|
1236
1238
|
case 1:
|
|
1237
1239
|
switch (this.touches.ONE) {
|
|
1238
|
-
case
|
|
1240
|
+
case p.ROTATE:
|
|
1239
1241
|
if (this.enableRotate === !1) return;
|
|
1240
1242
|
this.handleTouchStartRotate(t), this.state = 3;
|
|
1241
1243
|
break;
|
|
1242
|
-
case
|
|
1244
|
+
case p.PAN:
|
|
1243
1245
|
if (this.enablePan === !1) return;
|
|
1244
1246
|
this.handleTouchStartPan(t), this.state = 4;
|
|
1245
1247
|
break;
|
|
@@ -1249,12 +1251,12 @@ const xt = {
|
|
|
1249
1251
|
break;
|
|
1250
1252
|
case 2:
|
|
1251
1253
|
switch (this.touches.TWO) {
|
|
1252
|
-
case
|
|
1254
|
+
case p.DOLLY_PAN:
|
|
1253
1255
|
if (this.enableZoom === !1 && this.enablePan === !1)
|
|
1254
1256
|
return;
|
|
1255
1257
|
this.handleTouchStartDollyPan(t), this.state = 5;
|
|
1256
1258
|
break;
|
|
1257
|
-
case
|
|
1259
|
+
case p.DOLLY_ROTATE:
|
|
1258
1260
|
if (this.enableZoom === !1 && this.enableRotate === !1)
|
|
1259
1261
|
return;
|
|
1260
1262
|
this.handleTouchStartDollyRotate(t), this.state = 6;
|
|
@@ -1316,7 +1318,7 @@ const xt = {
|
|
|
1316
1318
|
i(this, "onContextMenu", (t) => {
|
|
1317
1319
|
this.enabled !== !1 && t.preventDefault();
|
|
1318
1320
|
});
|
|
1319
|
-
this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new
|
|
1321
|
+
this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new O().setFromUnitVectors(
|
|
1320
1322
|
t.up,
|
|
1321
1323
|
new h(0, 1, 0)
|
|
1322
1324
|
), this.quatInverse = this.quat.clone().invert(), this.domElements.forEach((n) => this.addEventListeners(n)), this.update();
|
|
@@ -1374,22 +1376,22 @@ const xt = {
|
|
|
1374
1376
|
this.removeDomElements(...this.domElements), this.domElements = [], this.addDomElements(...t);
|
|
1375
1377
|
}
|
|
1376
1378
|
computeEncompassingView(t, e = 0) {
|
|
1377
|
-
const a = t.center, r = t.sphere.radius, l = this.object.fov * (Math.PI / 180), d = this.object.aspect,
|
|
1379
|
+
const a = t.center, r = t.sphere.radius, l = this.object.fov * (Math.PI / 180), d = this.object.aspect, P = l / 2, R = Math.atan(Math.tan(P) * d), w = r / Math.sin(P), v = r / Math.sin(R), y = Math.max(w, v) * (1 + e), V = this.object.position.clone().sub(this.target).normalize(), X = V.length() > 1e-3 ? V : new h(0, 0, 1);
|
|
1378
1380
|
return {
|
|
1379
|
-
position: a.clone().add(X.multiplyScalar(
|
|
1381
|
+
position: a.clone().add(X.multiplyScalar(y)),
|
|
1380
1382
|
target: a
|
|
1381
1383
|
};
|
|
1382
1384
|
}
|
|
1383
1385
|
focusObject(t, e = 0) {
|
|
1384
|
-
const a = new
|
|
1386
|
+
const a = new L(t), n = this.computeEncompassingView(a, e);
|
|
1385
1387
|
this.object.position.copy(n.position), this.target.copy(n.target), this.update();
|
|
1386
1388
|
}
|
|
1387
1389
|
zoomIn(t) {
|
|
1388
|
-
this.dollyIn(Math.pow(0.95, t ??
|
|
1390
|
+
this.dollyIn(Math.pow(0.95, t ?? _.DEFAULT_ZOOM_FACTOR)), this.update();
|
|
1389
1391
|
}
|
|
1390
1392
|
zoomOut(t) {
|
|
1391
1393
|
this.dollyOut(
|
|
1392
|
-
Math.pow(0.95, t ??
|
|
1394
|
+
Math.pow(0.95, t ?? _.DEFAULT_ZOOM_FACTOR)
|
|
1393
1395
|
), this.update();
|
|
1394
1396
|
}
|
|
1395
1397
|
getState() {
|
|
@@ -1598,8 +1600,8 @@ const xt = {
|
|
|
1598
1600
|
);
|
|
1599
1601
|
}
|
|
1600
1602
|
};
|
|
1601
|
-
i(
|
|
1602
|
-
let G =
|
|
1603
|
+
i(_, "DEFAULT_ZOOM_FACTOR", 1);
|
|
1604
|
+
let G = _;
|
|
1603
1605
|
const Rt = `
|
|
1604
1606
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
1605
1607
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
@@ -1635,10 +1637,10 @@ window.DIVE = {
|
|
|
1635
1637
|
return window.DIVE.instances[0];
|
|
1636
1638
|
}
|
|
1637
1639
|
};
|
|
1638
|
-
const
|
|
1640
|
+
const b = {
|
|
1639
1641
|
autoStart: !0,
|
|
1640
1642
|
displayAxes: !1,
|
|
1641
|
-
...
|
|
1643
|
+
...D,
|
|
1642
1644
|
..._t,
|
|
1643
1645
|
...W,
|
|
1644
1646
|
...xt
|
|
@@ -1646,7 +1648,7 @@ const E = {
|
|
|
1646
1648
|
class Vt {
|
|
1647
1649
|
constructor(s) {
|
|
1648
1650
|
// descriptive members
|
|
1649
|
-
i(this, "_instanceId",
|
|
1651
|
+
i(this, "_instanceId", I.generateUUID());
|
|
1650
1652
|
i(this, "_settings");
|
|
1651
1653
|
i(this, "_views");
|
|
1652
1654
|
i(this, "_mainView");
|
|
@@ -1654,12 +1656,12 @@ class Vt {
|
|
|
1654
1656
|
i(this, "_clock");
|
|
1655
1657
|
i(this, "_orientationDisplay", null);
|
|
1656
1658
|
this._settings = {
|
|
1657
|
-
...
|
|
1659
|
+
...b,
|
|
1658
1660
|
...s ?? {}
|
|
1659
1661
|
}, this._clock = new wt(), this._scene = new kt({
|
|
1660
|
-
backgroundColor: (s == null ? void 0 : s.backgroundColor) ??
|
|
1661
|
-
displayGrid: (s == null ? void 0 : s.displayGrid) ??
|
|
1662
|
-
displayFloor: (s == null ? void 0 : s.displayFloor) ??
|
|
1662
|
+
backgroundColor: (s == null ? void 0 : s.backgroundColor) ?? b.backgroundColor,
|
|
1663
|
+
displayGrid: (s == null ? void 0 : s.displayGrid) ?? b.displayGrid,
|
|
1664
|
+
displayFloor: (s == null ? void 0 : s.displayFloor) ?? b.displayFloor
|
|
1663
1665
|
});
|
|
1664
1666
|
const t = new B(
|
|
1665
1667
|
this._scene,
|
|
@@ -1674,7 +1676,7 @@ class Vt {
|
|
|
1674
1676
|
this.mainView.camera
|
|
1675
1677
|
), this._clock.addTicker(this._orientationDisplay);
|
|
1676
1678
|
}
|
|
1677
|
-
), this._settings.autoStart && this.start(), console.log("DIVE 2.2.
|
|
1679
|
+
), this._settings.autoStart && this.start(), console.log("DIVE 2.2.17 initialized successfully!"), console.log(Rt), window.DIVE.instances.push(this);
|
|
1678
1680
|
}
|
|
1679
1681
|
/**
|
|
1680
1682
|
* @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
|
|
@@ -1732,7 +1734,7 @@ class Vt {
|
|
|
1732
1734
|
return new Promise((s) => {
|
|
1733
1735
|
this._views.forEach((t) => {
|
|
1734
1736
|
t.dispose();
|
|
1735
|
-
}), this._views = [], this._orientationDisplay && (this._clock.removeTicker(this._orientationDisplay), this._orientationDisplay.dispose()), window.DIVE.instances = window.DIVE.instances.filter(
|
|
1737
|
+
}), this._views = [], this._orientationDisplay && (this._clock.removeTicker(this._orientationDisplay), this._orientationDisplay.dispose()), this.scene.dispose(), window.DIVE.instances = window.DIVE.instances.filter(
|
|
1736
1738
|
(t) => t._instanceId !== this._instanceId
|
|
1737
1739
|
), s();
|
|
1738
1740
|
});
|
|
@@ -1770,8 +1772,8 @@ const Ft = Vt, At = {
|
|
|
1770
1772
|
(o) => o.extension
|
|
1771
1773
|
);
|
|
1772
1774
|
export {
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
+
L as B,
|
|
1776
|
+
b as D,
|
|
1775
1777
|
At as F,
|
|
1776
1778
|
Lt as G,
|
|
1777
1779
|
xt as O,
|
|
@@ -1786,7 +1788,7 @@ export {
|
|
|
1786
1788
|
H as h,
|
|
1787
1789
|
Gt as i,
|
|
1788
1790
|
yt as j,
|
|
1789
|
-
|
|
1791
|
+
D as k,
|
|
1790
1792
|
kt as l,
|
|
1791
1793
|
B as m,
|
|
1792
1794
|
It as n,
|
|
@@ -1795,7 +1797,7 @@ export {
|
|
|
1795
1797
|
Pt as q,
|
|
1796
1798
|
bt as r,
|
|
1797
1799
|
Dt as s,
|
|
1798
|
-
|
|
1800
|
+
x as t,
|
|
1799
1801
|
St as u,
|
|
1800
1802
|
Mt as v,
|
|
1801
1803
|
Z as w
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var z=Object.defineProperty;var O=(b,t,c)=>t in b?z(b,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):b[t]=c;var m=(b,t,c)=>O(b,typeof t!="symbol"?t+"":t,c);const r=require("three");class H extends r.DataTextureLoader{constructor(t){super(t),this.type=r.HalfFloatType}parse(t){const o=function(e,i){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(i||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(i||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(i||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(i||""))}},C=`
|
|
2
|
+
`,I=function(e,i,s){i=i||1024;let p=e.pos,h=-1,n=0,g="",a=String.fromCharCode.apply(null,new Uint16Array(e.subarray(p,p+128)));for(;0>(h=a.indexOf(C))&&n<i&&p<e.byteLength;)g+=a,n+=a.length,p+=128,a+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(p,p+128)));return-1<h?(e.pos+=n+h+1,g+a.slice(0,h)):!1},N=function(e){const i=/^#\?(\S+)/,s=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,l=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,p=/^\s*FORMAT=(\S+)\s*$/,h=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,n={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let g,a;for((e.pos>=e.byteLength||!(g=I(e)))&&o(1,"no header found"),(a=g.match(i))||o(3,"bad initial token"),n.valid|=1,n.programtype=a[1],n.string+=g+`
|
|
3
|
+
`;g=I(e),g!==!1;){if(n.string+=g+`
|
|
4
|
+
`,g.charAt(0)==="#"){n.comments+=g+`
|
|
5
|
+
`;continue}if((a=g.match(s))&&(n.gamma=parseFloat(a[1])),(a=g.match(l))&&(n.exposure=parseFloat(a[1])),(a=g.match(p))&&(n.valid|=2,n.format=a[1]),(a=g.match(h))&&(n.valid|=4,n.height=parseInt(a[1],10),n.width=parseInt(a[2],10)),n.valid&2&&n.valid&4)break}return n.valid&2||o(3,"missing format specifier"),n.valid&4||o(3,"missing image size specifier"),n},V=function(e,i,s){const l=i;if(l<8||l>32767||e[0]!==2||e[1]!==2||e[2]&128)return new Uint8Array(e);l!==(e[2]<<8|e[3])&&o(3,"wrong scanline width");const p=new Uint8Array(4*i*s);p.length||o(4,"unable to allocate buffer space");let h=0,n=0;const g=4*l,a=new Uint8Array(4),k=new Uint8Array(g);let U=s;for(;U>0&&n<e.byteLength;){n+4>e.byteLength&&o(1),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],(a[0]!=2||a[1]!=2||(a[2]<<8|a[3])!=l)&&o(3,"bad rgbe scanline format");let M=0,R;for(;M<g&&n<e.byteLength;){R=e[n++];const y=R>128;if(y&&(R-=128),(R===0||M+R>g)&&o(3,"bad scanline data"),y){const _=e[n++];for(let x=0;x<R;x++)k[M++]=_}else k.set(e.subarray(n,n+R),M),M+=R,n+=R}const j=l;for(let y=0;y<j;y++){let _=0;p[h]=k[y+_],_+=l,p[h+1]=k[y+_],_+=l,p[h+2]=k[y+_],_+=l,p[h+3]=k[y+_],h+=4}U--}return p},Y=function(e,i,s,l){const p=e[i+3],h=Math.pow(2,p-128)/255;s[l+0]=e[i+0]*h,s[l+1]=e[i+1]*h,s[l+2]=e[i+2]*h,s[l+3]=1},P=function(e,i,s,l){const p=e[i+3],h=Math.pow(2,p-128)/255;s[l+0]=r.DataUtils.toHalfFloat(Math.min(e[i+0]*h,65504)),s[l+1]=r.DataUtils.toHalfFloat(Math.min(e[i+1]*h,65504)),s[l+2]=r.DataUtils.toHalfFloat(Math.min(e[i+2]*h,65504)),s[l+3]=r.DataUtils.toHalfFloat(1)},T=new Uint8Array(t);T.pos=0;const S=N(T),F=S.width,D=S.height,L=V(T.subarray(T.pos),F,D);let G,A,w;switch(this.type){case r.FloatType:w=L.length/4;const e=new Float32Array(w*4);for(let s=0;s<w;s++)Y(L,s*4,e,s*4);G=e,A=r.FloatType;break;case r.HalfFloatType:w=L.length/4;const i=new Uint16Array(w*4);for(let s=0;s<w;s++)P(L,s*4,i,s*4);G=i,A=r.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:F,height:D,data:G,header:S.string,gamma:S.gamma,exposure:S.exposure,type:A}}setDataType(t){return this.type=t,this}load(t,c,u,v){function E(o,f){switch(o.type){case r.FloatType:case r.HalfFloatType:o.colorSpace=r.LinearSRGBColorSpace,o.minFilter=r.LinearFilter,o.magFilter=r.LinearFilter,o.generateMipmaps=!1,o.flipY=!0;break}c&&c(o,f)}return super.load(t,E,u,v)}}const q={enabled:!0,imageUrl:void 0,useAsBackground:!0,globalEnvIntensity:1,exposure:1,rotateY:0,replaceLights:!0};class ${constructor(t,c,u={}){m(this,"originalBackground",null);m(this,"isBackgroundReplaced",!1);m(this,"renderer");m(this,"scene");m(this,"pmrem");m(this,"currentEnvRT",null);m(this,"currentBackgroundCube",null);m(this,"sourceImage",null);m(this,"originalLights",[]);m(this,"options");this.renderer=t,this.scene=c,this.pmrem=new r.PMREMGenerator(t),this.options=u,this.options.imageUrl&&(this.sourceImage=new H().loadAsync(this.options.imageUrl)),this.options.enabled&&this.enable()}async enable(t){if(this.options={...this.options,enabled:!0,...t},!this.options.imageUrl)return;this.renderer.outputColorSpace=r.SRGBColorSpace,this.renderer.toneMapping=r.ACESFilmicToneMapping,this.options.exposure!=null&&(this.renderer.toneMappingExposure=this.options.exposure),this.sourceImage||(this.sourceImage=new H().loadAsync(this.options.imageUrl));const c=await this.sourceImage;if(c.mapping=r.EquirectangularReflectionMapping,this.options.useAsBackground?(this.isBackgroundReplaced||(this.originalBackground=this.scene.background,this.isBackgroundReplaced=!0),this.scene.background=c):this.isBackgroundReplaced&&(this.scene.background=this.originalBackground,this.isBackgroundReplaced=!1),this.options.rotateY)await this.applyRotationAndSetEnvironment(this.options.rotateY);else{const u=this.pmrem.fromEquirectangular(c);this.cleanupEnv(),this.currentEnvRT=u,this.scene.environment=u.texture}this.applyEnvIntensity(this.scene,this.options.globalEnvIntensity??1),this.options.replaceLights&&this.disableExistingLights()}async setImageUrl(t){this.options.imageUrl=t,this.sourceImage=null,this.options.enabled&&await this.enable()}async setRotationY(t){this.options.rotateY=t,this.sourceImage&&await this.applyRotationAndSetEnvironment(t)}setExposure(t){this.options.exposure=t,this.renderer.toneMappingExposure=t}setGlobalEnvIntensity(t){this.options.globalEnvIntensity=t,this.applyEnvIntensity(this.scene,t)}disable(){this.options.enabled=!1,this.scene.environment=null,this.isBackgroundReplaced&&(this.scene.background=this.originalBackground,this.isBackgroundReplaced=!1),this.restoreLights(),this.cleanupEnv()}async dispose(){this.disable(),this.pmrem.dispose(),this.sourceImage&&((await this.sourceImage).dispose(),this.sourceImage=null)}async applyRotationAndSetEnvironment(t){if(!this.sourceImage)return;const c=await this.sourceImage,u=new r.Scene,v=new r.SphereGeometry(10,60,40);c.mapping=r.EquirectangularReflectionMapping;const E=new r.MeshBasicMaterial({map:c,side:r.BackSide}),o=new r.Mesh(v,E);o.scale.set(1,1,-1),o.rotation.y=t,u.add(o);const f=this.renderer.toneMapping,d=this.renderer.outputColorSpace;this.renderer.toneMapping=r.NoToneMapping,this.renderer.outputColorSpace=r.LinearSRGBColorSpace;const B=new r.WebGLCubeRenderTarget(1024,{type:r.HalfFloatType});new r.CubeCamera(.1,1e3,B).update(this.renderer,u),this.renderer.toneMapping=f,this.renderer.outputColorSpace=d;const I=this.pmrem.fromCubemap(B.texture);this.cleanupEnv(),this.currentEnvRT=I,this.scene.environment=I.texture,this.options.useAsBackground?(this.scene.background=B.texture,this.currentBackgroundCube&&(this.currentBackgroundCube.texture.dispose(),this.currentBackgroundCube.dispose()),this.currentBackgroundCube=B):(B.texture.dispose(),B.dispose(),this.isBackgroundReplaced&&(this.scene.background=this.originalBackground,this.isBackgroundReplaced=!1)),this.applyEnvIntensity(this.scene,this.options.globalEnvIntensity??1)}applyEnvIntensity(t,c){t.traverse(u=>{const E=u.material;if(!E)return;const o=Array.isArray(E)?E:[E];for(const f of o){const d=f;d&&"envMapIntensity"in d&&(d.envMapIntensity=c,d.needsUpdate=!0),d&&d.map&&"colorSpace"in d.map&&(d.map.colorSpace=r.SRGBColorSpace)}})}disableExistingLights(){const t=[];this.scene.traverse(c=>{const u=c;u.isLight&&(u.visible=!1,t.push(u))}),this.originalLights=t}restoreLights(){for(const t of this.originalLights)t.visible=!0;this.originalLights=[]}cleanupEnv(){this.currentEnvRT&&(this.currentEnvRT.texture.dispose(),this.currentEnvRT.dispose(),this.currentEnvRT=null),this.currentBackgroundCube&&(this.currentBackgroundCube.texture.dispose(),this.currentBackgroundCube.dispose(),this.currentBackgroundCube=null)}}exports.HDREnvironment=$;exports.HDREnvironmentDefaultSettings=q;
|