@shopware-ag/dive 2.0.1-beta.9 → 2.0.2
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/README.md +7 -9
- package/build/chunks/AssetCache-CiC4wZkh.mjs +79 -0
- package/build/chunks/AssetCache-CuVztq_7.cjs +1 -0
- package/build/chunks/{AssetExporter-Ds2dAfxL.cjs → AssetExporter-DsbC2rqv.cjs} +18 -18
- package/build/chunks/{AssetExporter-CcSkkmZL.mjs → AssetExporter-brT7ogoM.mjs} +3 -4
- package/build/chunks/AssetLoader-DUhBw4FF.cjs +4 -0
- package/build/chunks/{AssetLoader-DjHz5xWK.mjs → AssetLoader-o_4syRGj.mjs} +32 -26
- package/build/chunks/FileTypes-B2VTJIm5.cjs +30 -0
- package/build/chunks/{FileTypes-Cu4s3c_0.mjs → FileTypes-C8pTXmiC.mjs} +155 -205
- package/build/chunks/OrbitController-BQ6SV1O_.mjs +1159 -0
- package/build/chunks/OrbitController-CpFQ3A1H.cjs +1 -0
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
- package/build/chunks/PerspectiveCamera-PMJPzAn3.mjs +34 -0
- package/build/chunks/{SelectTool-w7sF1obN.mjs → SelectTool-6ZRGPwYE.mjs} +4 -4
- package/build/chunks/SelectTool-B1awJ9PA.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
- package/build/chunks/package-AmvzOXm_.cjs +1 -0
- package/build/chunks/package-BrpVRfq7.mjs +39 -0
- package/build/chunks/parse-error-DfOPyLWM.mjs +14 -0
- package/build/chunks/parse-error-Dy_EE4rL.cjs +1 -0
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +293 -223
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +2 -2
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetexporter/index.cjs +1 -1
- package/build/plugins/assetexporter/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/mediacreator/index.cjs +1 -1
- package/build/plugins/mediacreator/index.mjs +13 -13
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -0
- package/build/plugins/orientationdisplay/index.d.ts +2 -0
- package/build/plugins/orientationdisplay/index.mjs +5 -0
- package/build/plugins/state/index.cjs +6 -6
- package/build/plugins/state/index.mjs +728 -728
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +12 -12
- package/build/src/components/boundingbox/BoundingBox.d.ts +136 -0
- package/build/src/components/light/AmbientLight.d.ts +3 -1
- package/build/src/components/light/SceneLight.d.ts +3 -1
- package/build/src/core/Dive.d.ts +1 -1
- package/build/src/helpers/deepClone/deepClone.d.ts +34 -0
- package/build/src/helpers/index.d.ts +5 -4
- package/build/src/plugins/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +2 -2
- package/build/src/plugins/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +2 -2
- package/build/src/plugins/assetcache/src/cache/AssetCache.d.ts +5 -4
- package/build/src/plugins/assetcache/src/chunk/Chunk.d.ts +4 -7
- package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +7 -0
- package/build/src/plugins/mediacreator/index.d.ts +1 -0
- package/build/src/plugins/mediacreator/src/MediaCreator.d.ts +2 -2
- package/build/src/plugins/mediacreator/types/MediaGenerationById.d.ts +5 -0
- package/build/src/plugins/mediacreator/types/MediaGenerationByPosition.d.ts +7 -0
- package/build/src/plugins/mediacreator/types/MediaGenerationResolution.d.ts +4 -0
- package/build/src/plugins/mediacreator/types/index.d.ts +3 -0
- package/build/src/plugins/orbitcontroller/src/OrbitController.d.ts +17 -2
- package/build/src/plugins/orientationdisplay/index.d.ts +2 -0
- package/build/src/plugins/{axiscamera/src/AxisCamera.d.ts → orientationdisplay/src/OrientationDisplay.d.ts} +5 -5
- package/build/src/plugins/orientationdisplay/src/axes/Axes.d.ts +6 -0
- package/build/src/plugins/state/src/actions/action.d.ts +4 -4
- package/build/src/plugins/state/src/actions/media/generatemedia.d.ts +2 -18
- package/build/src/plugins/state/src/actions/toolbox/setgizmovisible.d.ts +2 -2
- package/build/src/plugins/state/types/index.d.ts +2 -0
- package/build/src/plugins/toolbox/index.d.ts +1 -0
- package/build/src/plugins/toolbox/src/Toolbox.d.ts +2 -2
- package/build/src/plugins/toolbox/src/transform/TransformTool.d.ts +1 -1
- package/build/src/plugins/toolbox/types/ToolType.d.ts +1 -0
- package/build/src/plugins/toolbox/types/index.d.ts +1 -0
- package/package.json +7 -9
- package/build/chunks/AssetCache-CWeKL4PT.cjs +0 -1
- package/build/chunks/AssetCache-Y5G3mQU1.mjs +0 -84
- package/build/chunks/AssetLoader-CMKzMJ1u.cjs +0 -4
- package/build/chunks/FileTypes-CKOjpHjz.cjs +0 -30
- package/build/chunks/OrbitController-D-WNei2f.mjs +0 -940
- package/build/chunks/OrbitController-rMX8EHvJ.cjs +0 -1
- package/build/chunks/PerspectiveCamera-CONx93im.cjs +0 -1
- package/build/chunks/PerspectiveCamera-DUiWJJIj.mjs +0 -38
- package/build/chunks/SelectTool-BD6Ccy_2.cjs +0 -1
- package/build/chunks/file-type-error-BsK7IJt7.cjs +0 -1
- package/build/chunks/file-type-error-aWHfMumr.mjs +0 -8
- package/build/chunks/package-DXbIn_zz.mjs +0 -39
- package/build/chunks/package-DaKgG9tF.cjs +0 -1
- package/build/chunks/parse-error-IryNa_oq.mjs +0 -8
- package/build/chunks/parse-error-m5cNt1UV.cjs +0 -1
- package/build/plugins/axiscamera/index.cjs +0 -1
- package/build/plugins/axiscamera/index.d.ts +0 -2
- package/build/plugins/axiscamera/index.mjs +0 -4
- package/build/src/plugins/axiscamera/index.d.ts +0 -1
|
@@ -1,46 +1,63 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (o, i, e) =>
|
|
4
|
-
import { O as
|
|
5
|
-
import {
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var F = (o, i, e) => i in o ? z(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e;
|
|
3
|
+
var s = (o, i, e) => F(o, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import { D as v, O as U, B as H, a as I } from "./OrbitController-BQ6SV1O_.mjs";
|
|
5
|
+
import { Object3D as g, AxesHelper as W, Color as l, Matrix4 as Y, OrthographicCamera as $, MathUtils as w, Vector4 as N, AmbientLight as J, PointLight as K, SphereGeometry as C, MeshBasicMaterial as Q, FrontSide as k, Mesh as b, HemisphereLight as q, DirectionalLight as X, MeshStandardMaterial as D, Vector3 as m, Raycaster as S, CylinderGeometry as Z, BufferGeometry as V, BufferAttribute as x, BoxGeometry as f, ConeGeometry as j, LineDashedMaterial as ee, Line as te, PlaneGeometry as ie, Box3 as se, GridHelper as re, Scene as ne, WebGLRenderer as L, PCFSoftShadowMap as oe, PCFShadowMap as ae, BasicShadowMap as he } from "three";
|
|
6
|
+
import { C as p, P as _, U as le, H as de } from "./VisibilityLayerMask-CXgt1fJc.mjs";
|
|
7
|
+
import { a as ce, D as _e } from "./PerspectiveCamera-PMJPzAn3.mjs";
|
|
6
8
|
import y from "three-spritetext";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
s(this, "_renderer");
|
|
13
|
-
s(this, "_scene");
|
|
14
|
-
s(this, "_camera");
|
|
15
|
-
s(this, "_restoreViewport", new Y());
|
|
16
|
-
this.layers.mask = p, this.axesHelper = new J(0.5), this.axesHelper.layers.mask = p, this.axesHelper.material.depthTest = !1, this.axesHelper.position.set(0, 0, -1), this.axesHelper.setColors(
|
|
17
|
-
new l(Le),
|
|
9
|
+
class ue extends g {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
s(this, "_axesHelper");
|
|
13
|
+
this._axesHelper = new W(0.5), this._axesHelper.layers.mask = p, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
|
|
18
14
|
new l(Se),
|
|
19
|
-
new l(
|
|
15
|
+
new l(Ve),
|
|
16
|
+
new l(Me)
|
|
20
17
|
);
|
|
21
|
-
const
|
|
22
|
-
|
|
18
|
+
const e = new y("X", 0.2, R), t = new y("Y", 0.2, G), r = new y("Z", 0.2, A);
|
|
19
|
+
e.layers.mask = p, t.layers.mask = p, r.layers.mask = p, e.position.set(0.7, 0, 0), t.position.set(0, 0.7, 0), r.position.set(0, 0, 0.7), this._axesHelper.add(e), this._axesHelper.add(t), this._axesHelper.add(r);
|
|
20
|
+
}
|
|
21
|
+
setFromCameraMatrix(e) {
|
|
22
|
+
this._axesHelper.rotation.setFromRotationMatrix(
|
|
23
|
+
new Y().extractRotation(e).invert()
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
class me {
|
|
28
|
+
constructor(i, e, t) {
|
|
29
|
+
s(this, "uuid", w.generateUUID());
|
|
30
|
+
s(this, "_axes");
|
|
31
|
+
s(this, "_orthographicCamera");
|
|
32
|
+
s(this, "_restoreViewport", new N());
|
|
33
|
+
this._renderer = i, this._scene = e, this._camera = t, this._orthographicCamera = new $(
|
|
34
|
+
-1,
|
|
35
|
+
1,
|
|
36
|
+
1,
|
|
37
|
+
-1,
|
|
38
|
+
0.1,
|
|
39
|
+
100
|
|
40
|
+
), this._orthographicCamera.layers.mask = p, this._scene.add(this._orthographicCamera), this._axes = new ue(), this._scene.add(this._axes);
|
|
23
41
|
}
|
|
24
42
|
tick() {
|
|
25
|
-
const
|
|
26
|
-
this._scene.background = null, this._renderer.webglrenderer.getViewport(this._restoreViewport), this._renderer.webglrenderer.setViewport(0, 0, 150, 150), this._renderer.webglrenderer.autoClear = !1, this.setFromCameraMatrix(this._camera.matrix), this._renderer.webglrenderer.render(
|
|
43
|
+
const i = this._scene.background;
|
|
44
|
+
this._scene.background = null, this._renderer.webglrenderer.getViewport(this._restoreViewport), this._renderer.webglrenderer.setViewport(0, 0, 150, 150), this._renderer.webglrenderer.autoClear = !1, this._axes.setFromCameraMatrix(this._camera.matrix), this._renderer.webglrenderer.render(
|
|
45
|
+
this._scene,
|
|
46
|
+
this._orthographicCamera
|
|
47
|
+
), this._renderer.webglrenderer.setViewport(this._restoreViewport), this._renderer.webglrenderer.autoClear = !0, this._scene.background = i;
|
|
27
48
|
}
|
|
28
49
|
dispose() {
|
|
29
|
-
this._scene.remove(this);
|
|
30
|
-
}
|
|
31
|
-
setFromCameraMatrix(e) {
|
|
32
|
-
this.axesHelper.rotation.setFromRotationMatrix(
|
|
33
|
-
new N().extractRotation(e).invert()
|
|
34
|
-
);
|
|
50
|
+
this._scene.remove(this._axes), this._scene.remove(this._orthographicCamera);
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
|
-
class
|
|
53
|
+
class ge extends g {
|
|
38
54
|
constructor() {
|
|
39
55
|
super();
|
|
40
56
|
s(this, "isDIVELight", !0);
|
|
41
57
|
s(this, "isDIVEAmbientLight", !0);
|
|
58
|
+
s(this, "isSelectable", !0);
|
|
42
59
|
s(this, "_light");
|
|
43
|
-
this.name = "DIVEAmbientLight", this._light = new
|
|
60
|
+
this.name = "DIVEAmbientLight", this._light = new J(16777215, 1), this._light.layers.mask = _, this.add(this._light);
|
|
44
61
|
}
|
|
45
62
|
setColor(e) {
|
|
46
63
|
this._light.color = e;
|
|
@@ -52,7 +69,7 @@ class _e extends g {
|
|
|
52
69
|
this._light.visible = e;
|
|
53
70
|
}
|
|
54
71
|
}
|
|
55
|
-
class
|
|
72
|
+
class pe extends g {
|
|
56
73
|
constructor() {
|
|
57
74
|
super();
|
|
58
75
|
s(this, "isDIVELight", !0);
|
|
@@ -63,7 +80,7 @@ class me extends g {
|
|
|
63
80
|
s(this, "light");
|
|
64
81
|
s(this, "mesh");
|
|
65
82
|
this.name = "DIVEPointLight", this.light = new K(16777215, 1), this.light.layers.mask = _, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
66
|
-
const e = 0.1, t = new
|
|
83
|
+
const e = 0.1, t = new C(
|
|
67
84
|
e,
|
|
68
85
|
e * 320,
|
|
69
86
|
e * 320
|
|
@@ -71,9 +88,9 @@ class me extends g {
|
|
|
71
88
|
color: this.light.color,
|
|
72
89
|
transparent: !0,
|
|
73
90
|
opacity: 0.8,
|
|
74
|
-
side:
|
|
91
|
+
side: k
|
|
75
92
|
});
|
|
76
|
-
this.mesh = new b(t, r), this.mesh.layers.mask =
|
|
93
|
+
this.mesh = new b(t, r), this.mesh.layers.mask = le, this.add(this.mesh);
|
|
77
94
|
}
|
|
78
95
|
setColor(e) {
|
|
79
96
|
this.light.color = e, this.mesh.material.color = e;
|
|
@@ -115,6 +132,7 @@ class M extends g {
|
|
|
115
132
|
super();
|
|
116
133
|
s(this, "isDIVELight", !0);
|
|
117
134
|
s(this, "isDIVESceneLight", !0);
|
|
135
|
+
s(this, "isSelectable", !0);
|
|
118
136
|
s(this, "_hemiLight");
|
|
119
137
|
s(this, "_dirLight");
|
|
120
138
|
this.name = "DIVESceneLight", this._hemiLight = new q(16777215, 16777215, 2), this._hemiLight.layers.mask = _, this._hemiLight.position.set(0, 50, 0), this.add(this._hemiLight), this._dirLight = new X(16777215, 3), this._dirLight.layers.mask = _, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
|
|
@@ -132,77 +150,7 @@ class M extends g {
|
|
|
132
150
|
}
|
|
133
151
|
}
|
|
134
152
|
const E = (o) => o.parent ? E(o.parent) : o;
|
|
135
|
-
class
|
|
136
|
-
constructor() {
|
|
137
|
-
super();
|
|
138
|
-
s(this, "isSelectable", !0);
|
|
139
|
-
s(this, "isMovable", !0);
|
|
140
|
-
s(this, "isDIVENode", !0);
|
|
141
|
-
s(this, "gizmo", null);
|
|
142
|
-
s(this, "_positionWorldBuffer");
|
|
143
|
-
s(this, "_boundingBox");
|
|
144
|
-
this.layers.mask = _, this._positionWorldBuffer = new u(), this._boundingBox = new k();
|
|
145
|
-
}
|
|
146
|
-
setPosition(e) {
|
|
147
|
-
if (!this.parent) {
|
|
148
|
-
this.position.set(e.x, e.y, e.z);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const t = new u(e.x, e.y, e.z);
|
|
152
|
-
this.position.copy(this.parent.worldToLocal(t)), "isDIVEGroup" in this.parent && this.parent.updateLineTo(this);
|
|
153
|
-
}
|
|
154
|
-
setRotation(e) {
|
|
155
|
-
this.rotation.set(e.x, e.y, e.z);
|
|
156
|
-
}
|
|
157
|
-
setScale(e) {
|
|
158
|
-
this.scale.set(e.x, e.y, e.z);
|
|
159
|
-
}
|
|
160
|
-
setVisibility(e) {
|
|
161
|
-
this.visible = e;
|
|
162
|
-
}
|
|
163
|
-
setToWorldOrigin() {
|
|
164
|
-
this.position.set(0, 0, 0), import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
165
|
-
var t;
|
|
166
|
-
(t = e.get(this.userData.id)) == null || t.performAction("UPDATE_OBJECT", {
|
|
167
|
-
id: this.userData.id,
|
|
168
|
-
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
169
|
-
rotation: this.rotation,
|
|
170
|
-
scale: this.scale
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
|
|
176
|
-
*/
|
|
177
|
-
onMove() {
|
|
178
|
-
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
179
|
-
var t;
|
|
180
|
-
(t = e.get(this.userData.id)) == null || t.performAction("UPDATE_OBJECT", {
|
|
181
|
-
id: this.userData.id,
|
|
182
|
-
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
183
|
-
rotation: this.rotation,
|
|
184
|
-
scale: this.scale
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
onSelect() {
|
|
189
|
-
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
190
|
-
var t;
|
|
191
|
-
(t = e.get(this.userData.id)) == null || t.performAction("SELECT_OBJECT", {
|
|
192
|
-
id: this.userData.id
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
onDeselect() {
|
|
197
|
-
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
198
|
-
var t;
|
|
199
|
-
(t = e.get(this.userData.id)) == null || t.performAction("DESELECT_OBJECT", {
|
|
200
|
-
id: this.userData.id
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
class T extends D {
|
|
153
|
+
class B extends v {
|
|
206
154
|
constructor() {
|
|
207
155
|
super(...arguments);
|
|
208
156
|
s(this, "isDIVEModel", !0);
|
|
@@ -228,16 +176,16 @@ class T extends D {
|
|
|
228
176
|
}), this.add(e);
|
|
229
177
|
}
|
|
230
178
|
setMaterial(e) {
|
|
231
|
-
this._material || (this._material = new
|
|
179
|
+
this._material || (this._material = new D()), e.vertexColors !== void 0 && (this._material.vertexColors = e.vertexColors), e.color !== void 0 && this._material.color.set(e.color), e.map !== void 0 && (this._material.map = e.map), e.normalMap !== void 0 && (this._material.normalMap = e.normalMap), e.roughness !== void 0 && (this._material.roughness = e.roughness), e.roughnessMap !== void 0 && (this._material.roughnessMap = e.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), e.metalness !== void 0 && (this._material.metalness = e.metalness), e.metalnessMap !== void 0 && (this._material.metalnessMap = e.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
232
180
|
}
|
|
233
181
|
placeOnFloor() {
|
|
234
182
|
var n, a, h, d;
|
|
235
183
|
const e = this.getWorldPosition(this._positionWorldBuffer), t = e.clone();
|
|
236
184
|
(a = (n = this._mesh) == null ? void 0 : n.geometry) == null || a.computeBoundingBox();
|
|
237
185
|
const r = (d = (h = this._mesh) == null ? void 0 : h.geometry) == null ? void 0 : d.boundingBox;
|
|
238
|
-
!r || !this._mesh || (e.y = e.y - this._mesh.localToWorld(r.min.clone()).y, e.y !== t.y && import("../plugins/state/index.mjs").then(({ State:
|
|
186
|
+
!r || !this._mesh || (e.y = e.y - this._mesh.localToWorld(r.min.clone()).y, e.y !== t.y && import("../plugins/state/index.mjs").then(({ State: u }) => {
|
|
239
187
|
var c;
|
|
240
|
-
(c =
|
|
188
|
+
(c = u.get(this.userData.id)) == null || c.performAction("UPDATE_OBJECT", {
|
|
241
189
|
id: this.userData.id,
|
|
242
190
|
position: e,
|
|
243
191
|
rotation: this.rotation,
|
|
@@ -254,10 +202,10 @@ class T extends D {
|
|
|
254
202
|
return;
|
|
255
203
|
}
|
|
256
204
|
const e = this._boundingBox.min.y * this.scale.y, t = this.localToWorld(
|
|
257
|
-
this._boundingBox.getCenter(new
|
|
205
|
+
this._boundingBox.getCenter(new m()).multiply(this.scale)
|
|
258
206
|
);
|
|
259
207
|
t.y = e + this.position.y;
|
|
260
|
-
const r = new
|
|
208
|
+
const r = new S(t, new m(0, -1, 0));
|
|
261
209
|
r.layers.mask = _;
|
|
262
210
|
const n = r.intersectObjects(
|
|
263
211
|
E(this).root.children,
|
|
@@ -266,18 +214,18 @@ class T extends D {
|
|
|
266
214
|
if (n.length > 0) {
|
|
267
215
|
const a = n[0].object;
|
|
268
216
|
a.geometry.computeBoundingBox();
|
|
269
|
-
const h = a.geometry.boundingBox, d = a.localToWorld(h.max.clone()),
|
|
270
|
-
if (this.position.copy(c), this.position.y ===
|
|
217
|
+
const h = a.geometry.boundingBox, d = a.localToWorld(h.max.clone()), u = this.position.clone(), c = this.position.clone().setY(d.y).sub(new m(0, e, 0));
|
|
218
|
+
if (this.position.copy(c), this.position.y === u.y) return;
|
|
271
219
|
this.onMove();
|
|
272
220
|
}
|
|
273
221
|
}
|
|
274
222
|
}
|
|
275
|
-
class
|
|
223
|
+
class we extends v {
|
|
276
224
|
constructor() {
|
|
277
225
|
super();
|
|
278
226
|
s(this, "isDIVEPrimitive", !0);
|
|
279
227
|
s(this, "_mesh");
|
|
280
|
-
this._mesh = new b(), this._mesh.layers.mask = _, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new
|
|
228
|
+
this._mesh = new b(), this._mesh.layers.mask = _, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new D(), this.add(this._mesh);
|
|
281
229
|
}
|
|
282
230
|
setGeometry(e) {
|
|
283
231
|
const t = this.assembleGeometry(e);
|
|
@@ -292,9 +240,9 @@ class ge extends D {
|
|
|
292
240
|
const e = this.getWorldPosition(this._positionWorldBuffer), t = e.clone();
|
|
293
241
|
(a = (n = this._mesh) == null ? void 0 : n.geometry) == null || a.computeBoundingBox();
|
|
294
242
|
const r = (d = (h = this._mesh) == null ? void 0 : h.geometry) == null ? void 0 : d.boundingBox;
|
|
295
|
-
!r || !this._mesh || (e.y = e.y - this._mesh.localToWorld(r.min.clone()).y, e.y !== t.y && import("../plugins/state/index.mjs").then(({ State:
|
|
243
|
+
!r || !this._mesh || (e.y = e.y - this._mesh.localToWorld(r.min.clone()).y, e.y !== t.y && import("../plugins/state/index.mjs").then(({ State: u }) => {
|
|
296
244
|
var c;
|
|
297
|
-
(c =
|
|
245
|
+
(c = u.get(this.userData.id)) == null || c.performAction("UPDATE_OBJECT", {
|
|
298
246
|
id: this.userData.id,
|
|
299
247
|
position: e,
|
|
300
248
|
rotation: this.rotation,
|
|
@@ -311,10 +259,10 @@ class ge extends D {
|
|
|
311
259
|
return;
|
|
312
260
|
}
|
|
313
261
|
const e = this._boundingBox.min.y * this.scale.y, t = this.localToWorld(
|
|
314
|
-
this._boundingBox.getCenter(new
|
|
262
|
+
this._boundingBox.getCenter(new m()).multiply(this.scale)
|
|
315
263
|
);
|
|
316
264
|
t.y = e + this.position.y;
|
|
317
|
-
const r = new
|
|
265
|
+
const r = new S(t, new m(0, -1, 0));
|
|
318
266
|
r.layers.mask = _;
|
|
319
267
|
const n = r.intersectObjects(
|
|
320
268
|
E(this).root.children,
|
|
@@ -323,8 +271,8 @@ class ge extends D {
|
|
|
323
271
|
if (n.length > 0) {
|
|
324
272
|
const a = n[0].object;
|
|
325
273
|
a.geometry.computeBoundingBox();
|
|
326
|
-
const h = a.geometry.boundingBox, d = a.localToWorld(h.max.clone()),
|
|
327
|
-
if (this.position.copy(c), this.position.y ===
|
|
274
|
+
const h = a.geometry.boundingBox, d = a.localToWorld(h.max.clone()), u = this.position.clone(), c = this.position.clone().setY(d.y).sub(new m(0, e, 0));
|
|
275
|
+
if (this.position.copy(c), this.position.y === u.y) return;
|
|
328
276
|
this.onMove();
|
|
329
277
|
}
|
|
330
278
|
}
|
|
@@ -362,7 +310,7 @@ class ge extends D {
|
|
|
362
310
|
return t.translate(0, e.height / 2, 0), t;
|
|
363
311
|
}
|
|
364
312
|
createSphereGeometry(e) {
|
|
365
|
-
return new
|
|
313
|
+
return new C(e.width / 2, 256, 256);
|
|
366
314
|
}
|
|
367
315
|
createPyramidGeometry(e) {
|
|
368
316
|
const t = new Float32Array([
|
|
@@ -404,14 +352,14 @@ class ge extends D {
|
|
|
404
352
|
3,
|
|
405
353
|
4,
|
|
406
354
|
0
|
|
407
|
-
]), n = new
|
|
355
|
+
]), n = new V();
|
|
408
356
|
return n.setAttribute(
|
|
409
357
|
"position",
|
|
410
|
-
new
|
|
411
|
-
), n.setIndex(new
|
|
358
|
+
new x(t, 3)
|
|
359
|
+
), n.setIndex(new x(r, 1)), n.computeVertexNormals(), n.computeBoundingBox(), n.computeBoundingSphere(), n;
|
|
412
360
|
}
|
|
413
361
|
createBoxGeometry(e) {
|
|
414
|
-
const t = new
|
|
362
|
+
const t = new f(
|
|
415
363
|
e.width,
|
|
416
364
|
e.height,
|
|
417
365
|
e.depth
|
|
@@ -423,7 +371,7 @@ class ge extends D {
|
|
|
423
371
|
return t.translate(0, e.height / 2, 0), t;
|
|
424
372
|
}
|
|
425
373
|
createWallGeometry(e) {
|
|
426
|
-
const t = new
|
|
374
|
+
const t = new f(
|
|
427
375
|
e.width,
|
|
428
376
|
e.height,
|
|
429
377
|
e.depth || 0.05,
|
|
@@ -432,7 +380,7 @@ class ge extends D {
|
|
|
432
380
|
return t.translate(0, e.height / 2, 0), t;
|
|
433
381
|
}
|
|
434
382
|
createPlaneGeometry(e) {
|
|
435
|
-
const t = new
|
|
383
|
+
const t = new f(
|
|
436
384
|
e.width,
|
|
437
385
|
e.height,
|
|
438
386
|
e.depth
|
|
@@ -440,7 +388,7 @@ class ge extends D {
|
|
|
440
388
|
return t.translate(0, e.height / 2, 0), t;
|
|
441
389
|
}
|
|
442
390
|
}
|
|
443
|
-
class
|
|
391
|
+
class fe extends v {
|
|
444
392
|
// lines to children
|
|
445
393
|
constructor() {
|
|
446
394
|
super();
|
|
@@ -494,7 +442,7 @@ class pe extends D {
|
|
|
494
442
|
* Creates a line for visualization.
|
|
495
443
|
*/
|
|
496
444
|
createLine() {
|
|
497
|
-
const e = new
|
|
445
|
+
const e = new V(), t = new ee({
|
|
498
446
|
color: 6710886,
|
|
499
447
|
dashSize: 0.05,
|
|
500
448
|
gapSize: 0.025
|
|
@@ -506,7 +454,7 @@ class pe extends D {
|
|
|
506
454
|
*/
|
|
507
455
|
_updateLineTo(e, t) {
|
|
508
456
|
const r = [
|
|
509
|
-
new
|
|
457
|
+
new m(0, 0, 0),
|
|
510
458
|
t.position.clone()
|
|
511
459
|
];
|
|
512
460
|
e.geometry.setFromPoints(r), e.computeLineDistances();
|
|
@@ -559,13 +507,13 @@ class pe extends D {
|
|
|
559
507
|
// this._boxMesh.visible = true;
|
|
560
508
|
// }
|
|
561
509
|
}
|
|
562
|
-
class
|
|
510
|
+
class ye extends b {
|
|
563
511
|
constructor() {
|
|
564
512
|
const e = new ie(1, 1);
|
|
565
513
|
e.scale(1e3, 1e3, 1), e.rotateX(-Math.PI / 2);
|
|
566
|
-
const t = new
|
|
514
|
+
const t = new D({
|
|
567
515
|
color: new l(16777215),
|
|
568
|
-
side:
|
|
516
|
+
side: k
|
|
569
517
|
});
|
|
570
518
|
super(e, t);
|
|
571
519
|
s(this, "isDIVEFloor", !0);
|
|
@@ -578,18 +526,18 @@ class we extends b {
|
|
|
578
526
|
this.material.color = new l(e);
|
|
579
527
|
}
|
|
580
528
|
}
|
|
581
|
-
class
|
|
529
|
+
class ve extends g {
|
|
582
530
|
constructor() {
|
|
583
531
|
super();
|
|
584
532
|
s(this, "isDIVERoot", !0);
|
|
585
533
|
s(this, "_floor");
|
|
586
|
-
this.name = "Root", this._floor = new
|
|
534
|
+
this.name = "Root", this._floor = new ye(), this.add(this._floor);
|
|
587
535
|
}
|
|
588
536
|
get floor() {
|
|
589
537
|
return this._floor;
|
|
590
538
|
}
|
|
591
539
|
computeSceneBB() {
|
|
592
|
-
const e = new
|
|
540
|
+
const e = new se();
|
|
593
541
|
return this.children.forEach((t) => {
|
|
594
542
|
"isDIVEFloor" in t || t.traverse((r) => {
|
|
595
543
|
"isObject3D" in r && e.expandByObject(r);
|
|
@@ -618,11 +566,11 @@ class fe extends g {
|
|
|
618
566
|
break;
|
|
619
567
|
}
|
|
620
568
|
case "ambient": {
|
|
621
|
-
t = new
|
|
569
|
+
t = new ge();
|
|
622
570
|
break;
|
|
623
571
|
}
|
|
624
572
|
case "point": {
|
|
625
|
-
t = new
|
|
573
|
+
t = new pe();
|
|
626
574
|
break;
|
|
627
575
|
}
|
|
628
576
|
default:
|
|
@@ -634,15 +582,15 @@ class fe extends g {
|
|
|
634
582
|
break;
|
|
635
583
|
}
|
|
636
584
|
case "model": {
|
|
637
|
-
t = new
|
|
585
|
+
t = new B(), t.name = e.name, t.userData.id = e.id, t.userData.uri = e.uri, this.add(t), this._updateModel(t, e);
|
|
638
586
|
break;
|
|
639
587
|
}
|
|
640
588
|
case "primitive": {
|
|
641
|
-
t = new
|
|
589
|
+
t = new we(), t.name = e.name, t.userData.id = e.id, this.add(t), this._updatePrimitive(t, e);
|
|
642
590
|
break;
|
|
643
591
|
}
|
|
644
592
|
case "group": {
|
|
645
|
-
t = new
|
|
593
|
+
t = new fe(), t.name = e.name, t.userData.id = e.id, this.add(t), this._updateGroup(t, e);
|
|
646
594
|
break;
|
|
647
595
|
}
|
|
648
596
|
default:
|
|
@@ -770,28 +718,28 @@ class fe extends g {
|
|
|
770
718
|
return e.parent !== null ? this._findScene(e.parent) : e;
|
|
771
719
|
}
|
|
772
720
|
}
|
|
773
|
-
const
|
|
774
|
-
class
|
|
721
|
+
const be = "#888888", De = "#dddddd";
|
|
722
|
+
class Ee extends g {
|
|
775
723
|
constructor() {
|
|
776
724
|
super(), this.name = "Grid";
|
|
777
|
-
const i = new
|
|
725
|
+
const i = new re(
|
|
778
726
|
100,
|
|
779
727
|
100,
|
|
780
|
-
|
|
781
|
-
|
|
728
|
+
be,
|
|
729
|
+
De
|
|
782
730
|
);
|
|
783
|
-
i.material.depthTest = !1, i.layers.mask =
|
|
731
|
+
i.material.depthTest = !1, i.layers.mask = de, this.add(i);
|
|
784
732
|
}
|
|
785
733
|
setVisibility(i) {
|
|
786
734
|
this.visible = i;
|
|
787
735
|
}
|
|
788
736
|
}
|
|
789
|
-
class
|
|
737
|
+
class Ie extends ne {
|
|
790
738
|
constructor() {
|
|
791
739
|
super();
|
|
792
740
|
s(this, "_root");
|
|
793
741
|
s(this, "_grid");
|
|
794
|
-
this.background = new l(16777215), this._root = new
|
|
742
|
+
this.background = new l(16777215), this._root = new ve(), this.add(this._root), this._grid = new Ee(), this.add(this._grid);
|
|
795
743
|
}
|
|
796
744
|
get root() {
|
|
797
745
|
return this._root;
|
|
@@ -818,20 +766,20 @@ const P = {
|
|
|
818
766
|
shadows: !0,
|
|
819
767
|
shadowQuality: "high"
|
|
820
768
|
};
|
|
821
|
-
class
|
|
769
|
+
class xe {
|
|
822
770
|
constructor(i, e, t) {
|
|
823
771
|
s(this, "_webglrenderer");
|
|
824
772
|
s(this, "_settings");
|
|
825
773
|
this._scene = i, this._camera = e, this._settings = {
|
|
826
774
|
...P,
|
|
827
775
|
...t ?? {}
|
|
828
|
-
}, this._webglrenderer = new
|
|
776
|
+
}, this._webglrenderer = new L(this._settings), this._webglrenderer.shadowMap.enabled = this._settings.shadows, this._webglrenderer.shadowMap.type = this._settings.shadowQuality === "high" ? oe : this._settings.shadowQuality === "medium" ? ae : he;
|
|
829
777
|
}
|
|
830
778
|
get webglrenderer() {
|
|
831
779
|
return this._webglrenderer;
|
|
832
780
|
}
|
|
833
781
|
setCanvas(i) {
|
|
834
|
-
this._webglrenderer.dispose(), this._settings.canvas = i, this._webglrenderer = new
|
|
782
|
+
this._webglrenderer.dispose(), this._settings.canvas = i, this._webglrenderer = new L(this._settings);
|
|
835
783
|
}
|
|
836
784
|
render() {
|
|
837
785
|
this._webglrenderer.render(this._scene, this._camera);
|
|
@@ -843,7 +791,7 @@ class De {
|
|
|
843
791
|
this._webglrenderer.dispose();
|
|
844
792
|
}
|
|
845
793
|
}
|
|
846
|
-
class
|
|
794
|
+
class Le {
|
|
847
795
|
constructor() {
|
|
848
796
|
s(this, "_renderer", null);
|
|
849
797
|
s(this, "_lastTime", 0);
|
|
@@ -882,7 +830,7 @@ class xe {
|
|
|
882
830
|
this._lastTime = i, this._tickers.forEach((r) => r.tick(e)), (t = this._renderer) == null || t.render(), requestAnimationFrame(this._tick.bind(this));
|
|
883
831
|
}
|
|
884
832
|
}
|
|
885
|
-
class
|
|
833
|
+
class Ce {
|
|
886
834
|
constructor(i, e) {
|
|
887
835
|
s(this, "_resizeObserver");
|
|
888
836
|
s(this, "_width", 0);
|
|
@@ -910,13 +858,13 @@ class Ie {
|
|
|
910
858
|
}
|
|
911
859
|
}
|
|
912
860
|
}
|
|
913
|
-
const
|
|
861
|
+
const T = {
|
|
914
862
|
autoStart: !0,
|
|
915
863
|
displayAxes: !1,
|
|
916
|
-
...
|
|
864
|
+
...ce,
|
|
917
865
|
...P
|
|
918
866
|
};
|
|
919
|
-
class
|
|
867
|
+
class ke {
|
|
920
868
|
constructor(i) {
|
|
921
869
|
s(this, "_renderer");
|
|
922
870
|
s(this, "_scene");
|
|
@@ -925,16 +873,16 @@ class Ce {
|
|
|
925
873
|
s(this, "_clock");
|
|
926
874
|
s(this, "_settings");
|
|
927
875
|
this._settings = {
|
|
928
|
-
...
|
|
876
|
+
...T,
|
|
929
877
|
...i ?? {}
|
|
930
|
-
}, this._scene = new
|
|
878
|
+
}, this._scene = new Ie(), this._camera = new _e(this._settings), this._renderer = new xe(
|
|
931
879
|
this._scene,
|
|
932
880
|
this._camera,
|
|
933
881
|
this._settings
|
|
934
|
-
), this._resizeManager = new
|
|
882
|
+
), this._resizeManager = new Ce(
|
|
935
883
|
this._renderer,
|
|
936
884
|
this._camera
|
|
937
|
-
), this._clock = new
|
|
885
|
+
), this._clock = new Le(), this._clock.setRenderer(this._renderer), this._settings.autoStart && this.start();
|
|
938
886
|
}
|
|
939
887
|
get scene() {
|
|
940
888
|
return this._scene;
|
|
@@ -961,37 +909,37 @@ class Ce {
|
|
|
961
909
|
this._clock.dispose(), this._resizeManager.dispose(), this._renderer.dispose();
|
|
962
910
|
}
|
|
963
911
|
}
|
|
964
|
-
const
|
|
912
|
+
const R = "#c20017", G = "#00ab26", A = "#0081d4", Se = R, Ve = G, Me = A;
|
|
965
913
|
window.DIVE = {
|
|
966
914
|
instances: [],
|
|
967
915
|
get instance() {
|
|
968
916
|
return window.DIVE.instances[0];
|
|
969
917
|
}
|
|
970
918
|
};
|
|
971
|
-
const
|
|
972
|
-
...
|
|
973
|
-
...
|
|
919
|
+
const Be = {
|
|
920
|
+
...T,
|
|
921
|
+
...U
|
|
974
922
|
};
|
|
975
923
|
class O {
|
|
976
924
|
constructor(i) {
|
|
977
925
|
// descriptive members
|
|
978
|
-
s(this, "_instanceId",
|
|
926
|
+
s(this, "_instanceId", w.generateUUID());
|
|
979
927
|
s(this, "_settings");
|
|
980
928
|
s(this, "_engine");
|
|
981
929
|
s(this, "orbitController");
|
|
982
|
-
s(this, "
|
|
930
|
+
s(this, "orientationDisplay");
|
|
983
931
|
this._settings = {
|
|
984
|
-
...
|
|
932
|
+
...Be,
|
|
985
933
|
...i ?? {}
|
|
986
|
-
}, this._engine = new
|
|
934
|
+
}, this._engine = new ke(i), this.orbitController = new I(
|
|
987
935
|
this._engine.camera,
|
|
988
936
|
this._engine.renderer.webglrenderer.domElement,
|
|
989
937
|
this._settings
|
|
990
|
-
), this._engine.clock.addTicker(this.orbitController), this._settings.displayAxes ? (this.
|
|
938
|
+
), this._engine.clock.addTicker(this.orbitController), this._settings.displayAxes ? (this.orientationDisplay = new me(
|
|
991
939
|
this._engine.renderer,
|
|
992
940
|
this._engine.scene,
|
|
993
941
|
this._engine.camera
|
|
994
|
-
), this._engine.clock.addTicker(this.
|
|
942
|
+
), this._engine.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, import("./package-BrpVRfq7.mjs").then((e) => {
|
|
995
943
|
console.log(
|
|
996
944
|
`DIVE ${e.default.version} initialized successfully!`
|
|
997
945
|
), console.log(`
|
|
@@ -1031,10 +979,12 @@ class O {
|
|
|
1031
979
|
const t = new O(e);
|
|
1032
980
|
t.engine.scene.background = new l(16777215), t.engine.scene.grid.setVisibility(!1), t.engine.scene.root.floor.setVisibility(!0), t.engine.camera.position.set(0, 2, 2), t.orbitController.target.set(0, 0.5, 0);
|
|
1033
981
|
const r = new M();
|
|
1034
|
-
r.name = "SceneLight", r.userData.id =
|
|
1035
|
-
const n = new
|
|
1036
|
-
n.name = "object", n.userData.id =
|
|
1037
|
-
const a =
|
|
982
|
+
r.name = "SceneLight", r.userData.id = w.generateUUID(), r.setEnabled(!0), r.visible = !0, r.setIntensity((e == null ? void 0 : e.lightIntensity) ?? 1), r.setColor(new l(16777215)), t.engine.scene.root.add(r);
|
|
983
|
+
const n = new B();
|
|
984
|
+
n.name = "object", n.userData.id = w.generateUUID(), n.userData.uri = i, n.visible = !0, t.engine.scene.root.add(n), await n.setFromURL(i);
|
|
985
|
+
const a = new H(n);
|
|
986
|
+
t.engine.scene.add(a);
|
|
987
|
+
const h = t.orbitController.computeEncompassingView(a);
|
|
1038
988
|
return t.engine.camera.position.copy(h.position), t.orbitController.target.copy(h.target), t;
|
|
1039
989
|
}
|
|
1040
990
|
get engine() {
|
|
@@ -1044,7 +994,7 @@ class O {
|
|
|
1044
994
|
return this._engine.renderer.webglrenderer.domElement;
|
|
1045
995
|
}
|
|
1046
996
|
setCanvas(i) {
|
|
1047
|
-
this._engine.setCanvas(i), this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.orbitController = new
|
|
997
|
+
this._engine.setCanvas(i), this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.orbitController = new I(
|
|
1048
998
|
this._engine.camera,
|
|
1049
999
|
i,
|
|
1050
1000
|
this._settings
|
|
@@ -1052,13 +1002,13 @@ class O {
|
|
|
1052
1002
|
}
|
|
1053
1003
|
async dispose() {
|
|
1054
1004
|
return new Promise((i) => {
|
|
1055
|
-
this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.
|
|
1005
|
+
this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.orientationDisplay && (this._engine.clock.removeTicker(this.orientationDisplay), this.orientationDisplay.dispose()), window.DIVE.instances = window.DIVE.instances.filter(
|
|
1056
1006
|
(e) => e._instanceId !== this._instanceId
|
|
1057
1007
|
), i();
|
|
1058
1008
|
});
|
|
1059
1009
|
}
|
|
1060
1010
|
}
|
|
1061
|
-
const
|
|
1011
|
+
const Pe = {
|
|
1062
1012
|
glb: {
|
|
1063
1013
|
key: "glb",
|
|
1064
1014
|
extension: "glb"
|
|
@@ -1071,39 +1021,39 @@ const Be = {
|
|
|
1071
1021
|
key: "usdz",
|
|
1072
1022
|
extension: "usdz"
|
|
1073
1023
|
}
|
|
1074
|
-
},
|
|
1024
|
+
}, Fe = Object.values(Pe).map(
|
|
1075
1025
|
(o) => o.extension
|
|
1076
1026
|
);
|
|
1077
1027
|
export {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
Ve as
|
|
1028
|
+
Se as A,
|
|
1029
|
+
Be as D,
|
|
1030
|
+
T as E,
|
|
1031
|
+
Pe as F,
|
|
1032
|
+
be as G,
|
|
1033
|
+
me as O,
|
|
1034
|
+
Fe as S,
|
|
1035
|
+
ue as a,
|
|
1036
|
+
Ve as b,
|
|
1037
|
+
Me as c,
|
|
1087
1038
|
O as d,
|
|
1088
|
-
|
|
1039
|
+
R as e,
|
|
1089
1040
|
G as f,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1041
|
+
A as g,
|
|
1042
|
+
De as h,
|
|
1043
|
+
ye as i,
|
|
1044
|
+
Ee as j,
|
|
1045
|
+
fe as k,
|
|
1046
|
+
ge as l,
|
|
1047
|
+
pe as m,
|
|
1097
1048
|
M as n,
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1049
|
+
B as o,
|
|
1050
|
+
we as p,
|
|
1051
|
+
ve as q,
|
|
1052
|
+
Le as r,
|
|
1053
|
+
P as s,
|
|
1054
|
+
xe as t,
|
|
1055
|
+
Ce as u,
|
|
1105
1056
|
Ie as v,
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
E as y
|
|
1057
|
+
ke as w,
|
|
1058
|
+
E as x
|
|
1109
1059
|
};
|