@shopware-ag/dive 2.0.1-beta.0 → 2.0.1-beta.1
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/{SelectTool-BRKko7uz.cjs → SelectTool-BAXTVyWs.cjs} +1 -1
- package/build/chunks/{SelectTool-mTRiZYaC.mjs → SelectTool-Bd8cC9nb.mjs} +15 -15
- package/build/chunks/{package-BvoZkrge.mjs → package-BHjZWYD6.mjs} +1 -1
- package/build/chunks/{package-BFpY3sIj.cjs → package-JHvTSNgQ.cjs} +1 -1
- package/build/dive.cjs +2 -2
- package/build/dive.mjs +471 -565
- package/build/src/components/floor/Floor.d.ts +2 -2
- package/build/src/components/grid/Grid.d.ts +1 -1
- package/build/src/components/light/AmbientLight.d.ts +3 -3
- package/build/src/components/light/PointLight.d.ts +3 -3
- package/build/src/components/light/SceneLight.d.ts +3 -3
- package/build/src/components/model/Model.d.ts +7 -4
- package/build/src/components/node/Node.d.ts +2 -2
- package/build/src/components/primitive/Primitive.d.ts +3 -3
- package/build/src/components/root/Root.d.ts +19 -29
- package/build/src/core/Dive.d.ts +4 -4
- package/build/src/engine/Engine.d.ts +2 -6
- package/build/src/engine/scene/Scene.d.ts +4 -22
- package/build/src/modules/asset/draco/README.md +32 -0
- package/build/src/modules/asset/draco/draco_decoder.js +33 -0
- package/build/src/modules/asset/draco/draco_decoder.wasm +0 -0
- package/build/src/modules/asset/draco/draco_encoder.js +33 -0
- package/build/src/modules/asset/draco/draco_wasm_wrapper.js +116 -0
- package/build/src/modules/asset/draco/gltf/draco_decoder.js +33 -0
- package/build/src/modules/asset/draco/gltf/draco_decoder.wasm +0 -0
- package/build/src/modules/asset/draco/gltf/draco_encoder.js +33 -0
- package/build/src/modules/asset/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/build/src/modules/asset/loader/AssetLoader.cjs +3 -2
- package/build/src/modules/asset/loader/AssetLoader.mjs +1274 -1039
- package/build/src/modules/state/State.cjs +9 -9
- package/build/src/modules/state/State.mjs +579 -554
- package/build/src/modules/state/actions/camera/movecamera.d.ts +2 -2
- package/build/src/modules/state/actions/object/addobject.d.ts +1 -1
- package/build/src/modules/state/actions/object/deleteobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/deselectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/dropit.d.ts +2 -2
- package/build/src/modules/state/actions/object/getobjects.d.ts +2 -2
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +2 -2
- package/build/src/modules/state/actions/object/selectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/setparent.d.ts +2 -2
- package/build/src/modules/state/actions/object/updateobject.d.ts +2 -2
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +5 -0
- package/build/src/modules/state/types/COMGroup.d.ts +1 -0
- package/build/src/modules/state/types/COMLight.d.ts +18 -2
- package/build/src/modules/state/types/COMModel.d.ts +1 -0
- package/build/src/modules/state/types/COMPov.d.ts +1 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +1 -0
- package/build/src/modules/toolbox/Toolbox.cjs +1 -1
- package/build/src/modules/toolbox/Toolbox.mjs +1 -1
- package/build/src/types/SceneObjects.d.ts +3 -1
- package/package.json +2 -1
package/build/dive.mjs
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
4
|
-
import { Ray as
|
|
1
|
+
var Dt = Object.defineProperty;
|
|
2
|
+
var xt = (h, s, t) => s in h ? Dt(h, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[s] = t;
|
|
3
|
+
var a = (h, s, t) => xt(h, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { Ray as St, Plane as Tt, MathUtils as C, EventDispatcher as Lt, Vector3 as m, MOUSE as U, TOUCH as G, Spherical as Ne, Quaternion as Fe, Vector2 as E, OrthographicCamera as Pt, Vector4 as Mt, AxesHelper as It, Color as D, Matrix4 as Ct, Object3D as j, AmbientLight as vt, PointLight as Ot, SphereGeometry as Ke, MeshBasicMaterial as At, FrontSide as kt, Mesh as pe, HemisphereLight as Rt, DirectionalLight as Vt, Box3 as Ze, MeshStandardMaterial as fe, Raycaster as Xe, CylinderGeometry as Bt, BufferGeometry as qe, BufferAttribute as Ye, BoxGeometry as de, ConeGeometry as zt, LineDashedMaterial as Nt, Line as Ft, PlaneGeometry as Yt, GridHelper as Ut, Scene as Gt, WebGLRenderer as Ue } from "three";
|
|
5
5
|
import ue from "three-spritetext";
|
|
6
|
-
import { C as
|
|
7
|
-
import { A as
|
|
8
|
-
import { f as
|
|
9
|
-
import { g as
|
|
10
|
-
import { D as
|
|
11
|
-
import { F as
|
|
6
|
+
import { C as q, P, U as jt, H as Ht } from "./chunks/VisibilityLayerMask-CXgt1fJc.mjs";
|
|
7
|
+
import { A as Wt, a as Kt, b as Zt, c as Xt, d as qt, e as Jt } from "./chunks/findInterface-OrXgmwxj.mjs";
|
|
8
|
+
import { f as Fi, i as Yi } from "./chunks/findInterface-OrXgmwxj.mjs";
|
|
9
|
+
import { g as w } from "./chunks/ModuleRegistry-RSub8W0G.mjs";
|
|
10
|
+
import { D as $t, a as Qt } from "./chunks/PerspectiveCamera-sm4_81KJ.mjs";
|
|
11
|
+
import { F as Gi, S as ji, g as Hi, i as Wi } from "./chunks/FileTypes-qgYnI0Jg.mjs";
|
|
12
12
|
import { E as Zi, a as Xi } from "./chunks/index-C_uFFwT2.mjs";
|
|
13
|
-
const
|
|
14
|
-
class
|
|
13
|
+
const Ge = { type: "change" }, me = { type: "start" }, je = { type: "end" }, ie = new St(), He = new Tt(), ei = Math.cos(70 * C.DEG2RAD);
|
|
14
|
+
class ti extends Lt {
|
|
15
15
|
constructor(s, t) {
|
|
16
|
-
super(), this.object = s, this.domElement = t, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new m(), this.cursor = new m(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT:
|
|
16
|
+
super(), this.object = s, this.domElement = t, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new m(), this.cursor = new m(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: U.ROTATE, MIDDLE: U.DOLLY, RIGHT: U.PAN }, this.touches = { ONE: G.ROTATE, TWO: G.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() {
|
|
17
17
|
return l.phi;
|
|
18
18
|
}, this.getAzimuthalAngle = function() {
|
|
19
19
|
return l.theta;
|
|
20
20
|
}, this.getDistance = function() {
|
|
21
21
|
return this.object.position.distanceTo(this.target);
|
|
22
22
|
}, this.listenToKeyEvents = function(i) {
|
|
23
|
-
i.addEventListener("keydown",
|
|
23
|
+
i.addEventListener("keydown", ce), this._domElementKeyEvents = i;
|
|
24
24
|
}, this.stopListenToKeyEvents = function() {
|
|
25
|
-
this._domElementKeyEvents.removeEventListener("keydown",
|
|
25
|
+
this._domElementKeyEvents.removeEventListener("keydown", ce), this._domElementKeyEvents = null;
|
|
26
26
|
}, this.saveState = function() {
|
|
27
27
|
e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom;
|
|
28
28
|
}, this.reset = function() {
|
|
29
|
-
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(
|
|
29
|
+
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(Ge), e.update(), o = n.NONE;
|
|
30
30
|
}, this.update = function() {
|
|
31
|
-
const i = new m(), r = new
|
|
32
|
-
return function(
|
|
33
|
-
const
|
|
34
|
-
i.copy(
|
|
35
|
-
let S = e.minAzimuthAngle,
|
|
36
|
-
isFinite(S) && isFinite(
|
|
31
|
+
const i = new m(), r = new Fe().setFromUnitVectors(s.up, new m(0, 1, 0)), d = r.clone().invert(), u = new m(), y = new Fe(), I = new m(), b = 2 * Math.PI;
|
|
32
|
+
return function(Et = null) {
|
|
33
|
+
const Be = e.object.position;
|
|
34
|
+
i.copy(Be).sub(e.target), i.applyQuaternion(r), l.setFromVector3(i), e.autoRotate && o === n.NONE && W(st(Et)), e.enableDamping ? (l.theta += p.theta * e.dampingFactor, l.phi += p.phi * e.dampingFactor) : (l.theta += p.theta, l.phi += p.phi);
|
|
35
|
+
let S = e.minAzimuthAngle, T = e.maxAzimuthAngle;
|
|
36
|
+
isFinite(S) && isFinite(T) && (S < -Math.PI ? S += b : S > Math.PI && (S -= b), T < -Math.PI ? T += b : T > Math.PI && (T -= b), S <= T ? l.theta = Math.max(S, Math.min(T, l.theta)) : l.theta = l.theta > (S + T) / 2 ? Math.max(S, l.theta) : Math.min(T, l.theta)), l.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, l.phi)), l.makeSafe(), e.enableDamping === !0 ? e.target.addScaledVector(_, e.dampingFactor) : e.target.add(_), e.target.sub(e.cursor), e.target.clampLength(e.minTargetRadius, e.maxTargetRadius), e.target.add(e.cursor);
|
|
37
37
|
let Z = !1;
|
|
38
38
|
if (e.zoomToCursor && $ || e.object.isOrthographicCamera)
|
|
39
|
-
l.radius =
|
|
39
|
+
l.radius = he(l.radius);
|
|
40
40
|
else {
|
|
41
|
-
const
|
|
42
|
-
l.radius =
|
|
41
|
+
const L = l.radius;
|
|
42
|
+
l.radius = he(l.radius * f), Z = L != l.radius;
|
|
43
43
|
}
|
|
44
|
-
if (i.setFromSpherical(l), i.applyQuaternion(d),
|
|
45
|
-
let
|
|
44
|
+
if (i.setFromSpherical(l), i.applyQuaternion(d), Be.copy(e.target).add(i), e.object.lookAt(e.target), e.enableDamping === !0 ? (p.theta *= 1 - e.dampingFactor, p.phi *= 1 - e.dampingFactor, _.multiplyScalar(1 - e.dampingFactor)) : (p.set(0, 0, 0), _.set(0, 0, 0)), e.zoomToCursor && $) {
|
|
45
|
+
let L = null;
|
|
46
46
|
if (e.object.isPerspectiveCamera) {
|
|
47
47
|
const X = i.length();
|
|
48
|
-
|
|
49
|
-
const te = X -
|
|
50
|
-
e.object.position.addScaledVector(
|
|
48
|
+
L = he(X * f);
|
|
49
|
+
const te = X - L;
|
|
50
|
+
e.object.position.addScaledVector(ye, te), e.object.updateMatrixWorld(), Z = !!te;
|
|
51
51
|
} else if (e.object.isOrthographicCamera) {
|
|
52
52
|
const X = new m(M.x, M.y, 0);
|
|
53
53
|
X.unproject(e.object);
|
|
54
54
|
const te = e.object.zoom;
|
|
55
55
|
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / f)), e.object.updateProjectionMatrix(), Z = te !== e.object.zoom;
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const ze = new m(M.x, M.y, 0);
|
|
57
|
+
ze.unproject(e.object), e.object.position.sub(ze).add(X), e.object.updateMatrixWorld(), L = i.length();
|
|
58
58
|
} else
|
|
59
59
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), e.zoomToCursor = !1;
|
|
60
|
-
|
|
60
|
+
L !== null && (this.screenSpacePanning ? e.target.set(0, 0, -1).transformDirection(e.object.matrix).multiplyScalar(L).add(e.object.position) : (ie.origin.copy(e.object.position), ie.direction.set(0, 0, -1).transformDirection(e.object.matrix), Math.abs(e.object.up.dot(ie.direction)) < ei ? s.lookAt(e.target) : (He.setFromNormalAndCoplanarPoint(e.object.up, e.target), ie.intersectPlane(He, e.target))));
|
|
61
61
|
} else if (e.object.isOrthographicCamera) {
|
|
62
|
-
const
|
|
63
|
-
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / f)),
|
|
62
|
+
const L = e.object.zoom;
|
|
63
|
+
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / f)), L !== e.object.zoom && (e.object.updateProjectionMatrix(), Z = !0);
|
|
64
64
|
}
|
|
65
|
-
return f = 1, $ = !1, Z || u.distanceToSquared(e.object.position) >
|
|
65
|
+
return f = 1, $ = !1, Z || u.distanceToSquared(e.object.position) > c || 8 * (1 - y.dot(e.object.quaternion)) > c || I.distanceToSquared(e.target) > c ? (e.dispatchEvent(Ge), u.copy(e.object.position), y.copy(e.object.quaternion), I.copy(e.target), !0) : !1;
|
|
66
66
|
};
|
|
67
67
|
}(), this.dispose = function() {
|
|
68
|
-
e.domElement.removeEventListener("contextmenu",
|
|
68
|
+
e.domElement.removeEventListener("contextmenu", Re), e.domElement.removeEventListener("pointerdown", Ce), e.domElement.removeEventListener("pointercancel", K), e.domElement.removeEventListener("wheel", ve), e.domElement.removeEventListener("pointermove", le), e.domElement.removeEventListener("pointerup", K), e.domElement.getRootNode().removeEventListener("keydown", Oe, { capture: !0 }), e._domElementKeyEvents !== null && (e._domElementKeyEvents.removeEventListener("keydown", ce), e._domElementKeyEvents = null);
|
|
69
69
|
};
|
|
70
70
|
const e = this, n = {
|
|
71
71
|
NONE: -1,
|
|
@@ -78,13 +78,13 @@ class Qt extends Ot {
|
|
|
78
78
|
TOUCH_DOLLY_ROTATE: 6
|
|
79
79
|
};
|
|
80
80
|
let o = n.NONE;
|
|
81
|
-
const
|
|
81
|
+
const c = 1e-6, l = new Ne(), p = new Ne();
|
|
82
82
|
let f = 1;
|
|
83
|
-
const
|
|
83
|
+
const _ = new m(), v = new E(), O = new E(), V = new E(), A = new E(), k = new E(), B = new E(), z = new E(), N = new E(), R = new E(), ye = new m(), M = new E();
|
|
84
84
|
let $ = !1;
|
|
85
85
|
const g = [], H = {};
|
|
86
86
|
let oe = !1;
|
|
87
|
-
function
|
|
87
|
+
function st(i) {
|
|
88
88
|
return i !== null ? 2 * Math.PI / 60 * e.autoRotateSpeed * i : 2 * Math.PI / 60 / 60 * e.autoRotateSpeed;
|
|
89
89
|
}
|
|
90
90
|
function Q(i) {
|
|
@@ -97,161 +97,161 @@ class Qt extends Ot {
|
|
|
97
97
|
function ee(i) {
|
|
98
98
|
p.phi -= i;
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const be = function() {
|
|
101
101
|
const i = new m();
|
|
102
102
|
return function(d, u) {
|
|
103
|
-
i.setFromMatrixColumn(u, 0), i.multiplyScalar(-d),
|
|
103
|
+
i.setFromMatrixColumn(u, 0), i.multiplyScalar(-d), _.add(i);
|
|
104
104
|
};
|
|
105
|
-
}(),
|
|
105
|
+
}(), we = function() {
|
|
106
106
|
const i = new m();
|
|
107
107
|
return function(d, u) {
|
|
108
|
-
e.screenSpacePanning === !0 ? i.setFromMatrixColumn(u, 1) : (i.setFromMatrixColumn(u, 0), i.crossVectors(e.object.up, i)), i.multiplyScalar(d),
|
|
108
|
+
e.screenSpacePanning === !0 ? i.setFromMatrixColumn(u, 1) : (i.setFromMatrixColumn(u, 0), i.crossVectors(e.object.up, i)), i.multiplyScalar(d), _.add(i);
|
|
109
109
|
};
|
|
110
|
-
}(),
|
|
110
|
+
}(), F = function() {
|
|
111
111
|
const i = new m();
|
|
112
112
|
return function(d, u) {
|
|
113
|
-
const
|
|
113
|
+
const y = e.domElement;
|
|
114
114
|
if (e.object.isPerspectiveCamera) {
|
|
115
|
-
const
|
|
116
|
-
i.copy(
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
} else e.object.isOrthographicCamera ? (
|
|
115
|
+
const I = e.object.position;
|
|
116
|
+
i.copy(I).sub(e.target);
|
|
117
|
+
let b = i.length();
|
|
118
|
+
b *= Math.tan(e.object.fov / 2 * Math.PI / 180), be(2 * d * b / y.clientHeight, e.object.matrix), we(2 * u * b / y.clientHeight, e.object.matrix);
|
|
119
|
+
} else e.object.isOrthographicCamera ? (be(d * (e.object.right - e.object.left) / e.object.zoom / y.clientWidth, e.object.matrix), we(u * (e.object.top - e.object.bottom) / e.object.zoom / y.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1);
|
|
120
120
|
};
|
|
121
121
|
}();
|
|
122
122
|
function re(i) {
|
|
123
123
|
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? f /= i : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Ee(i) {
|
|
126
126
|
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? f *= i : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
127
127
|
}
|
|
128
128
|
function ae(i, r) {
|
|
129
129
|
if (!e.zoomToCursor)
|
|
130
130
|
return;
|
|
131
131
|
$ = !0;
|
|
132
|
-
const d = e.domElement.getBoundingClientRect(), u = i - d.left,
|
|
133
|
-
M.x = u /
|
|
132
|
+
const d = e.domElement.getBoundingClientRect(), u = i - d.left, y = r - d.top, I = d.width, b = d.height;
|
|
133
|
+
M.x = u / I * 2 - 1, M.y = -(y / b) * 2 + 1, ye.set(M.x, M.y, 1).unproject(e.object).sub(e.object.position).normalize();
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function he(i) {
|
|
136
136
|
return Math.max(e.minDistance, Math.min(e.maxDistance, i));
|
|
137
137
|
}
|
|
138
138
|
function De(i) {
|
|
139
|
-
I.set(i.clientX, i.clientY);
|
|
140
|
-
}
|
|
141
|
-
function it(i) {
|
|
142
|
-
ae(i.clientX, i.clientX), B.set(i.clientX, i.clientY);
|
|
143
|
-
}
|
|
144
|
-
function Se(i) {
|
|
145
139
|
v.set(i.clientX, i.clientY);
|
|
146
140
|
}
|
|
147
|
-
function st(i) {
|
|
148
|
-
A.set(i.clientX, i.clientY), j.subVectors(A, I).multiplyScalar(e.rotateSpeed);
|
|
149
|
-
const r = e.domElement;
|
|
150
|
-
W(2 * Math.PI * j.x / r.clientHeight), ee(2 * Math.PI * j.y / r.clientHeight), I.copy(A), e.update();
|
|
151
|
-
}
|
|
152
141
|
function nt(i) {
|
|
153
|
-
|
|
142
|
+
ae(i.clientX, i.clientX), z.set(i.clientX, i.clientY);
|
|
143
|
+
}
|
|
144
|
+
function xe(i) {
|
|
145
|
+
A.set(i.clientX, i.clientY);
|
|
154
146
|
}
|
|
155
147
|
function ot(i) {
|
|
156
|
-
|
|
148
|
+
O.set(i.clientX, i.clientY), V.subVectors(O, v).multiplyScalar(e.rotateSpeed);
|
|
149
|
+
const r = e.domElement;
|
|
150
|
+
W(2 * Math.PI * V.x / r.clientHeight), ee(2 * Math.PI * V.y / r.clientHeight), v.copy(O), e.update();
|
|
157
151
|
}
|
|
158
152
|
function rt(i) {
|
|
159
|
-
|
|
153
|
+
N.set(i.clientX, i.clientY), R.subVectors(N, z), R.y > 0 ? re(Q(R.y)) : R.y < 0 && Ee(Q(R.y)), z.copy(N), e.update();
|
|
160
154
|
}
|
|
161
155
|
function at(i) {
|
|
156
|
+
k.set(i.clientX, i.clientY), B.subVectors(k, A).multiplyScalar(e.panSpeed), F(B.x, B.y), A.copy(k), e.update();
|
|
157
|
+
}
|
|
158
|
+
function ht(i) {
|
|
159
|
+
ae(i.clientX, i.clientY), i.deltaY < 0 ? Ee(Q(i.deltaY)) : i.deltaY > 0 && re(Q(i.deltaY)), e.update();
|
|
160
|
+
}
|
|
161
|
+
function lt(i) {
|
|
162
162
|
let r = !1;
|
|
163
163
|
switch (i.code) {
|
|
164
164
|
case e.keys.UP:
|
|
165
|
-
i.ctrlKey || i.metaKey || i.shiftKey ? ee(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) :
|
|
165
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? ee(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : F(0, e.keyPanSpeed), r = !0;
|
|
166
166
|
break;
|
|
167
167
|
case e.keys.BOTTOM:
|
|
168
|
-
i.ctrlKey || i.metaKey || i.shiftKey ? ee(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) :
|
|
168
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? ee(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : F(0, -e.keyPanSpeed), r = !0;
|
|
169
169
|
break;
|
|
170
170
|
case e.keys.LEFT:
|
|
171
|
-
i.ctrlKey || i.metaKey || i.shiftKey ? W(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) :
|
|
171
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? W(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : F(e.keyPanSpeed, 0), r = !0;
|
|
172
172
|
break;
|
|
173
173
|
case e.keys.RIGHT:
|
|
174
|
-
i.ctrlKey || i.metaKey || i.shiftKey ? W(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) :
|
|
174
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? W(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : F(-e.keyPanSpeed, 0), r = !0;
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
r && (i.preventDefault(), e.update());
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function Se(i) {
|
|
180
180
|
if (g.length === 1)
|
|
181
|
-
|
|
181
|
+
v.set(i.pageX, i.pageY);
|
|
182
182
|
else {
|
|
183
|
-
const r =
|
|
184
|
-
|
|
183
|
+
const r = Y(i), d = 0.5 * (i.pageX + r.x), u = 0.5 * (i.pageY + r.y);
|
|
184
|
+
v.set(d, u);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
function Te(i) {
|
|
188
188
|
if (g.length === 1)
|
|
189
|
-
|
|
189
|
+
A.set(i.pageX, i.pageY);
|
|
190
190
|
else {
|
|
191
|
-
const r =
|
|
192
|
-
|
|
191
|
+
const r = Y(i), d = 0.5 * (i.pageX + r.x), u = 0.5 * (i.pageY + r.y);
|
|
192
|
+
A.set(d, u);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
const r =
|
|
197
|
-
|
|
195
|
+
function Le(i) {
|
|
196
|
+
const r = Y(i), d = i.pageX - r.x, u = i.pageY - r.y, y = Math.sqrt(d * d + u * u);
|
|
197
|
+
z.set(0, y);
|
|
198
198
|
}
|
|
199
199
|
function ct(i) {
|
|
200
|
-
e.enableZoom &&
|
|
200
|
+
e.enableZoom && Le(i), e.enablePan && Te(i);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
e.enableZoom &&
|
|
202
|
+
function dt(i) {
|
|
203
|
+
e.enableZoom && Le(i), e.enableRotate && Se(i);
|
|
204
204
|
}
|
|
205
205
|
function Pe(i) {
|
|
206
206
|
if (g.length == 1)
|
|
207
|
-
|
|
207
|
+
O.set(i.pageX, i.pageY);
|
|
208
208
|
else {
|
|
209
|
-
const d =
|
|
210
|
-
|
|
209
|
+
const d = Y(i), u = 0.5 * (i.pageX + d.x), y = 0.5 * (i.pageY + d.y);
|
|
210
|
+
O.set(u, y);
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
V.subVectors(O, v).multiplyScalar(e.rotateSpeed);
|
|
213
213
|
const r = e.domElement;
|
|
214
|
-
W(2 * Math.PI *
|
|
214
|
+
W(2 * Math.PI * V.x / r.clientHeight), ee(2 * Math.PI * V.y / r.clientHeight), v.copy(O);
|
|
215
215
|
}
|
|
216
216
|
function Me(i) {
|
|
217
217
|
if (g.length === 1)
|
|
218
|
-
|
|
218
|
+
k.set(i.pageX, i.pageY);
|
|
219
219
|
else {
|
|
220
|
-
const r =
|
|
221
|
-
|
|
220
|
+
const r = Y(i), d = 0.5 * (i.pageX + r.x), u = 0.5 * (i.pageY + r.y);
|
|
221
|
+
k.set(d, u);
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
B.subVectors(k, A).multiplyScalar(e.panSpeed), F(B.x, B.y), A.copy(k);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
const r =
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
ae(
|
|
225
|
+
function Ie(i) {
|
|
226
|
+
const r = Y(i), d = i.pageX - r.x, u = i.pageY - r.y, y = Math.sqrt(d * d + u * u);
|
|
227
|
+
N.set(0, y), R.set(0, Math.pow(N.y / z.y, e.zoomSpeed)), re(R.y), z.copy(N);
|
|
228
|
+
const I = (i.pageX + r.x) * 0.5, b = (i.pageY + r.y) * 0.5;
|
|
229
|
+
ae(I, b);
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
e.enableZoom &&
|
|
231
|
+
function ut(i) {
|
|
232
|
+
e.enableZoom && Ie(i), e.enablePan && Me(i);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
235
|
-
e.enableZoom &&
|
|
234
|
+
function mt(i) {
|
|
235
|
+
e.enableZoom && Ie(i), e.enableRotate && Pe(i);
|
|
236
236
|
}
|
|
237
237
|
function Ce(i) {
|
|
238
|
-
e.enabled !== !1 && (g.length === 0 && (e.domElement.setPointerCapture(i.pointerId), e.domElement.addEventListener("pointermove", le), e.domElement.addEventListener("pointerup", K)), !
|
|
238
|
+
e.enabled !== !1 && (g.length === 0 && (e.domElement.setPointerCapture(i.pointerId), e.domElement.addEventListener("pointermove", le), e.domElement.addEventListener("pointerup", K)), !wt(i) && (yt(i), i.pointerType === "touch" ? ke(i) : pt(i)));
|
|
239
239
|
}
|
|
240
240
|
function le(i) {
|
|
241
|
-
e.enabled !== !1 && (i.pointerType === "touch" ?
|
|
241
|
+
e.enabled !== !1 && (i.pointerType === "touch" ? _t(i) : ft(i));
|
|
242
242
|
}
|
|
243
243
|
function K(i) {
|
|
244
244
|
switch (bt(i), g.length) {
|
|
245
245
|
case 0:
|
|
246
|
-
e.domElement.releasePointerCapture(i.pointerId), e.domElement.removeEventListener("pointermove", le), e.domElement.removeEventListener("pointerup", K), e.dispatchEvent(
|
|
246
|
+
e.domElement.releasePointerCapture(i.pointerId), e.domElement.removeEventListener("pointermove", le), e.domElement.removeEventListener("pointerup", K), e.dispatchEvent(je), o = n.NONE;
|
|
247
247
|
break;
|
|
248
248
|
case 1:
|
|
249
249
|
const r = g[0], d = H[r];
|
|
250
|
-
|
|
250
|
+
ke({ pointerId: r, pageX: d.x, pageY: d.y });
|
|
251
251
|
break;
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function pt(i) {
|
|
255
255
|
let r;
|
|
256
256
|
switch (i.button) {
|
|
257
257
|
case 0:
|
|
@@ -267,53 +267,53 @@ class Qt extends Ot {
|
|
|
267
267
|
r = -1;
|
|
268
268
|
}
|
|
269
269
|
switch (r) {
|
|
270
|
-
case
|
|
270
|
+
case U.DOLLY:
|
|
271
271
|
if (e.enableZoom === !1) return;
|
|
272
|
-
|
|
272
|
+
nt(i), o = n.DOLLY;
|
|
273
273
|
break;
|
|
274
|
-
case
|
|
274
|
+
case U.ROTATE:
|
|
275
275
|
if (i.ctrlKey || i.metaKey || i.shiftKey) {
|
|
276
276
|
if (e.enablePan === !1) return;
|
|
277
|
-
|
|
277
|
+
xe(i), o = n.PAN;
|
|
278
278
|
} else {
|
|
279
279
|
if (e.enableRotate === !1) return;
|
|
280
280
|
De(i), o = n.ROTATE;
|
|
281
281
|
}
|
|
282
282
|
break;
|
|
283
|
-
case
|
|
283
|
+
case U.PAN:
|
|
284
284
|
if (i.ctrlKey || i.metaKey || i.shiftKey) {
|
|
285
285
|
if (e.enableRotate === !1) return;
|
|
286
286
|
De(i), o = n.ROTATE;
|
|
287
287
|
} else {
|
|
288
288
|
if (e.enablePan === !1) return;
|
|
289
|
-
|
|
289
|
+
xe(i), o = n.PAN;
|
|
290
290
|
}
|
|
291
291
|
break;
|
|
292
292
|
default:
|
|
293
293
|
o = n.NONE;
|
|
294
294
|
}
|
|
295
|
-
o !== n.NONE && e.dispatchEvent(
|
|
295
|
+
o !== n.NONE && e.dispatchEvent(me);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function ft(i) {
|
|
298
298
|
switch (o) {
|
|
299
299
|
case n.ROTATE:
|
|
300
300
|
if (e.enableRotate === !1) return;
|
|
301
|
-
|
|
301
|
+
ot(i);
|
|
302
302
|
break;
|
|
303
303
|
case n.DOLLY:
|
|
304
304
|
if (e.enableZoom === !1) return;
|
|
305
|
-
|
|
305
|
+
rt(i);
|
|
306
306
|
break;
|
|
307
307
|
case n.PAN:
|
|
308
308
|
if (e.enablePan === !1) return;
|
|
309
|
-
|
|
309
|
+
at(i);
|
|
310
310
|
break;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
e.enabled === !1 || e.enableZoom === !1 || o !== n.NONE || (i.preventDefault(), e.dispatchEvent(
|
|
313
|
+
function ve(i) {
|
|
314
|
+
e.enabled === !1 || e.enableZoom === !1 || o !== n.NONE || (i.preventDefault(), e.dispatchEvent(me), ht(gt(i)), e.dispatchEvent(je));
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function gt(i) {
|
|
317
317
|
const r = i.deltaMode, d = {
|
|
318
318
|
clientX: i.clientX,
|
|
319
319
|
clientY: i.clientY,
|
|
@@ -329,24 +329,24 @@ class Qt extends Ot {
|
|
|
329
329
|
}
|
|
330
330
|
return i.ctrlKey && !oe && (d.deltaY *= 10), d;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
i.key === "Control" && (oe = !0, e.domElement.getRootNode().addEventListener("keyup",
|
|
332
|
+
function Oe(i) {
|
|
333
|
+
i.key === "Control" && (oe = !0, e.domElement.getRootNode().addEventListener("keyup", Ae, { passive: !0, capture: !0 }));
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
i.key === "Control" && (oe = !1, e.domElement.getRootNode().removeEventListener("keyup",
|
|
335
|
+
function Ae(i) {
|
|
336
|
+
i.key === "Control" && (oe = !1, e.domElement.getRootNode().removeEventListener("keyup", Ae, { passive: !0, capture: !0 }));
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
e.enabled === !1 || e.enablePan === !1 ||
|
|
338
|
+
function ce(i) {
|
|
339
|
+
e.enabled === !1 || e.enablePan === !1 || lt(i);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
switch (
|
|
341
|
+
function ke(i) {
|
|
342
|
+
switch (Ve(i), g.length) {
|
|
343
343
|
case 1:
|
|
344
344
|
switch (e.touches.ONE) {
|
|
345
|
-
case
|
|
345
|
+
case G.ROTATE:
|
|
346
346
|
if (e.enableRotate === !1) return;
|
|
347
|
-
|
|
347
|
+
Se(i), o = n.TOUCH_ROTATE;
|
|
348
348
|
break;
|
|
349
|
-
case
|
|
349
|
+
case G.PAN:
|
|
350
350
|
if (e.enablePan === !1) return;
|
|
351
351
|
Te(i), o = n.TOUCH_PAN;
|
|
352
352
|
break;
|
|
@@ -356,13 +356,13 @@ class Qt extends Ot {
|
|
|
356
356
|
break;
|
|
357
357
|
case 2:
|
|
358
358
|
switch (e.touches.TWO) {
|
|
359
|
-
case
|
|
359
|
+
case G.DOLLY_PAN:
|
|
360
360
|
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
361
361
|
ct(i), o = n.TOUCH_DOLLY_PAN;
|
|
362
362
|
break;
|
|
363
|
-
case
|
|
363
|
+
case G.DOLLY_ROTATE:
|
|
364
364
|
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
365
|
-
|
|
365
|
+
dt(i), o = n.TOUCH_DOLLY_ROTATE;
|
|
366
366
|
break;
|
|
367
367
|
default:
|
|
368
368
|
o = n.NONE;
|
|
@@ -371,10 +371,10 @@ class Qt extends Ot {
|
|
|
371
371
|
default:
|
|
372
372
|
o = n.NONE;
|
|
373
373
|
}
|
|
374
|
-
o !== n.NONE && e.dispatchEvent(
|
|
374
|
+
o !== n.NONE && e.dispatchEvent(me);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
switch (
|
|
376
|
+
function _t(i) {
|
|
377
|
+
switch (Ve(i), o) {
|
|
378
378
|
case n.TOUCH_ROTATE:
|
|
379
379
|
if (e.enableRotate === !1) return;
|
|
380
380
|
Pe(i), e.update();
|
|
@@ -385,20 +385,20 @@ class Qt extends Ot {
|
|
|
385
385
|
break;
|
|
386
386
|
case n.TOUCH_DOLLY_PAN:
|
|
387
387
|
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
388
|
-
|
|
388
|
+
ut(i), e.update();
|
|
389
389
|
break;
|
|
390
390
|
case n.TOUCH_DOLLY_ROTATE:
|
|
391
391
|
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
392
|
-
|
|
392
|
+
mt(i), e.update();
|
|
393
393
|
break;
|
|
394
394
|
default:
|
|
395
395
|
o = n.NONE;
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Re(i) {
|
|
399
399
|
e.enabled !== !1 && i.preventDefault();
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function yt(i) {
|
|
402
402
|
g.push(i.pointerId);
|
|
403
403
|
}
|
|
404
404
|
function bt(i) {
|
|
@@ -409,26 +409,26 @@ class Qt extends Ot {
|
|
|
409
409
|
return;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function wt(i) {
|
|
413
413
|
for (let r = 0; r < g.length; r++)
|
|
414
414
|
if (g[r] == i.pointerId) return !0;
|
|
415
415
|
return !1;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Ve(i) {
|
|
418
418
|
let r = H[i.pointerId];
|
|
419
|
-
r === void 0 && (r = new
|
|
419
|
+
r === void 0 && (r = new E(), H[i.pointerId] = r), r.set(i.pageX, i.pageY);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function Y(i) {
|
|
422
422
|
const r = i.pointerId === g[0] ? g[1] : g[0];
|
|
423
423
|
return H[r];
|
|
424
424
|
}
|
|
425
|
-
e.domElement.addEventListener("contextmenu",
|
|
425
|
+
e.domElement.addEventListener("contextmenu", Re), e.domElement.addEventListener("pointerdown", Ce), e.domElement.addEventListener("pointercancel", K), e.domElement.addEventListener("wheel", ve, { passive: !1 }), e.domElement.getRootNode().addEventListener("keydown", Oe, { passive: !0, capture: !0 }), this.update();
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
const se = {
|
|
429
429
|
enableDamping: !0,
|
|
430
430
|
dampingFactor: 0.05
|
|
431
|
-
},
|
|
431
|
+
}, J = class J extends ti {
|
|
432
432
|
constructor(t, e, n = se) {
|
|
433
433
|
super(t, e);
|
|
434
434
|
a(this, "uuid", C.generateUUID());
|
|
@@ -446,7 +446,7 @@ const se = {
|
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
448
|
zoomIn(t) {
|
|
449
|
-
const e = t ||
|
|
449
|
+
const e = t || J.DEFAULT_ZOOM_FACTOR, { minDistance: n, maxDistance: o } = this;
|
|
450
450
|
this.minDistance = this.maxDistance = C.clamp(
|
|
451
451
|
this.getDistance() - e,
|
|
452
452
|
n + e,
|
|
@@ -454,7 +454,7 @@ const se = {
|
|
|
454
454
|
), this.update(), this.minDistance = n, this.maxDistance = o;
|
|
455
455
|
}
|
|
456
456
|
zoomOut(t) {
|
|
457
|
-
const e = t ||
|
|
457
|
+
const e = t || J.DEFAULT_ZOOM_FACTOR, { minDistance: n, maxDistance: o } = this;
|
|
458
458
|
this.minDistance = this.maxDistance = C.clamp(
|
|
459
459
|
this.getDistance() + e,
|
|
460
460
|
n + e,
|
|
@@ -462,23 +462,23 @@ const se = {
|
|
|
462
462
|
), this.update(), this.minDistance = n, this.maxDistance = o;
|
|
463
463
|
}
|
|
464
464
|
};
|
|
465
|
-
a(
|
|
466
|
-
let ne =
|
|
467
|
-
class
|
|
465
|
+
a(J, "DEFAULT_ZOOM_FACTOR", 1);
|
|
466
|
+
let ne = J;
|
|
467
|
+
class ii extends Pt {
|
|
468
468
|
constructor(t, e, n) {
|
|
469
469
|
super(-1, 1, 1, -1, 0.1, 100);
|
|
470
470
|
a(this, "axesHelper");
|
|
471
471
|
a(this, "_renderer");
|
|
472
472
|
a(this, "_scene");
|
|
473
473
|
a(this, "_camera");
|
|
474
|
-
a(this, "_restoreViewport", new
|
|
475
|
-
this.layers.mask =
|
|
476
|
-
new
|
|
477
|
-
new
|
|
478
|
-
new
|
|
474
|
+
a(this, "_restoreViewport", new Mt());
|
|
475
|
+
this.layers.mask = q, this.axesHelper = new It(0.5), this.axesHelper.layers.mask = q, this.axesHelper.material.depthTest = !1, this.axesHelper.position.set(0, 0, -1), this.axesHelper.setColors(
|
|
476
|
+
new D(Wt),
|
|
477
|
+
new D(Kt),
|
|
478
|
+
new D(Zt)
|
|
479
479
|
);
|
|
480
|
-
const o = new ue("X", 0.2,
|
|
481
|
-
o.layers.mask =
|
|
480
|
+
const o = new ue("X", 0.2, Xt), c = new ue("Y", 0.2, qt), l = new ue("Z", 0.2, Jt);
|
|
481
|
+
o.layers.mask = q, c.layers.mask = q, l.layers.mask = q, o.position.set(0.7, 0, 0), c.position.set(0, 0.7, 0), l.position.set(0, 0, 0.7), this.axesHelper.add(o), this.axesHelper.add(c), this.axesHelper.add(l), this.add(this.axesHelper), this._renderer = t, this._scene = e, this._camera = n, this._scene.add(this);
|
|
482
482
|
}
|
|
483
483
|
tick() {
|
|
484
484
|
const t = this._scene.background;
|
|
@@ -489,29 +489,29 @@ class ei extends Tt {
|
|
|
489
489
|
}
|
|
490
490
|
SetFromCameraMatrix(t) {
|
|
491
491
|
this.axesHelper.rotation.setFromRotationMatrix(
|
|
492
|
-
new
|
|
492
|
+
new Ct().extractRotation(t).invert()
|
|
493
493
|
);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
class
|
|
496
|
+
class si extends j {
|
|
497
497
|
constructor() {
|
|
498
498
|
super();
|
|
499
499
|
a(this, "isDIVELight", !0);
|
|
500
500
|
a(this, "isDIVEAmbientLight", !0);
|
|
501
501
|
a(this, "_light");
|
|
502
|
-
this.name = "DIVEAmbientLight", this._light = new
|
|
502
|
+
this.name = "DIVEAmbientLight", this._light = new vt(16777215, 1), this._light.layers.mask = P, this.add(this._light);
|
|
503
503
|
}
|
|
504
|
-
|
|
504
|
+
setColor(t) {
|
|
505
505
|
this._light.color = t;
|
|
506
506
|
}
|
|
507
|
-
|
|
507
|
+
setIntensity(t) {
|
|
508
508
|
this._light.intensity = t;
|
|
509
509
|
}
|
|
510
|
-
|
|
510
|
+
setEnabled(t) {
|
|
511
511
|
this._light.visible = t;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
class
|
|
514
|
+
class ni extends j {
|
|
515
515
|
constructor() {
|
|
516
516
|
super();
|
|
517
517
|
a(this, "isDIVELight", !0);
|
|
@@ -521,30 +521,30 @@ class ii extends Y {
|
|
|
521
521
|
a(this, "gizmo", null);
|
|
522
522
|
a(this, "light");
|
|
523
523
|
a(this, "mesh");
|
|
524
|
-
this.name = "DIVEPointLight", this.light = new
|
|
524
|
+
this.name = "DIVEPointLight", this.light = new Ot(16777215, 1), this.light.layers.mask = P, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
525
525
|
const t = 0.1, e = new Ke(
|
|
526
526
|
t,
|
|
527
527
|
t * 320,
|
|
528
528
|
t * 320
|
|
529
|
-
), n = new
|
|
529
|
+
), n = new At({
|
|
530
530
|
color: this.light.color,
|
|
531
531
|
transparent: !0,
|
|
532
532
|
opacity: 0.8,
|
|
533
|
-
side:
|
|
533
|
+
side: kt
|
|
534
534
|
});
|
|
535
|
-
this.mesh = new
|
|
535
|
+
this.mesh = new pe(e, n), this.mesh.layers.mask = jt, this.add(this.mesh);
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
setColor(t) {
|
|
538
538
|
this.light.color = t, this.mesh.material.color = t;
|
|
539
539
|
}
|
|
540
|
-
|
|
540
|
+
setIntensity(t) {
|
|
541
541
|
this.light.intensity = t, this.mesh.material.opacity = t > 0.8 ? 0.8 : t * 0.8;
|
|
542
542
|
}
|
|
543
|
-
|
|
543
|
+
setEnabled(t) {
|
|
544
544
|
this.light.visible = t;
|
|
545
545
|
}
|
|
546
546
|
onMove() {
|
|
547
|
-
|
|
547
|
+
w("State").then((t) => {
|
|
548
548
|
var e;
|
|
549
549
|
(e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
|
|
550
550
|
id: this.userData.id,
|
|
@@ -553,7 +553,7 @@ class ii extends Y {
|
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
onSelect() {
|
|
556
|
-
|
|
556
|
+
w("State").then((t) => {
|
|
557
557
|
var e;
|
|
558
558
|
(e = t.get(this.userData.id)) == null || e.performAction("SELECT_OBJECT", {
|
|
559
559
|
id: this.userData.id
|
|
@@ -561,7 +561,7 @@ class ii extends Y {
|
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
onDeselect() {
|
|
564
|
-
|
|
564
|
+
w("State").then((t) => {
|
|
565
565
|
var e;
|
|
566
566
|
(e = t.get(this.userData.id)) == null || e.performAction("DESELECT_OBJECT", {
|
|
567
567
|
id: this.userData.id
|
|
@@ -569,52 +569,52 @@ class ii extends Y {
|
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
class
|
|
572
|
+
class Je extends j {
|
|
573
573
|
constructor() {
|
|
574
574
|
super();
|
|
575
575
|
a(this, "isDIVELight", !0);
|
|
576
576
|
a(this, "isDIVESceneLight", !0);
|
|
577
577
|
a(this, "_hemiLight");
|
|
578
578
|
a(this, "_dirLight");
|
|
579
|
-
this.name = "DIVESceneLight", this._hemiLight = new
|
|
579
|
+
this.name = "DIVESceneLight", this._hemiLight = new Rt(16777215, 16777215, 2), this._hemiLight.layers.mask = P, this._hemiLight.position.set(0, 50, 0), this.add(this._hemiLight), this._dirLight = new Vt(16777215, 3), this._dirLight.layers.mask = P, 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;
|
|
580
580
|
const t = 5;
|
|
581
581
|
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);
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
setColor(t) {
|
|
584
584
|
this._hemiLight.color = t, this._dirLight.color = t;
|
|
585
585
|
}
|
|
586
|
-
|
|
586
|
+
setIntensity(t) {
|
|
587
587
|
this._hemiLight.intensity = t * 2, this._dirLight.intensity = t * 3;
|
|
588
588
|
}
|
|
589
|
-
|
|
589
|
+
setEnabled(t) {
|
|
590
590
|
this._hemiLight.visible = t, this._dirLight.visible = t;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
const ge = (
|
|
594
|
-
class
|
|
593
|
+
const ge = (h) => h.parent ? ge(h.parent) : h;
|
|
594
|
+
class oi {
|
|
595
595
|
constructor() {
|
|
596
596
|
a(this, "isMovable", !0);
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
class
|
|
599
|
+
class ri {
|
|
600
600
|
constructor() {
|
|
601
601
|
a(this, "isSelectable", !0);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function ai(h, s) {
|
|
605
605
|
return s.forEach((t) => {
|
|
606
606
|
Object.getOwnPropertyNames(t.prototype).forEach((e) => {
|
|
607
607
|
Object.defineProperty(
|
|
608
|
-
|
|
608
|
+
h.prototype,
|
|
609
609
|
e,
|
|
610
610
|
Object.getOwnPropertyDescriptor(t.prototype, e)
|
|
611
611
|
);
|
|
612
612
|
});
|
|
613
|
-
}),
|
|
613
|
+
}), h;
|
|
614
614
|
}
|
|
615
|
-
class
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
class _e extends ai(j, [
|
|
616
|
+
ri,
|
|
617
|
+
oi
|
|
618
618
|
]) {
|
|
619
619
|
constructor() {
|
|
620
620
|
super();
|
|
@@ -638,11 +638,11 @@ class be extends ri(Y, [
|
|
|
638
638
|
SetScale(t) {
|
|
639
639
|
this.scale.set(t.x, t.y, t.z);
|
|
640
640
|
}
|
|
641
|
-
|
|
641
|
+
setVisibility(t) {
|
|
642
642
|
this.visible = t;
|
|
643
643
|
}
|
|
644
644
|
SetToWorldOrigin() {
|
|
645
|
-
this.position.set(0, 0, 0),
|
|
645
|
+
this.position.set(0, 0, 0), w("State").then((t) => {
|
|
646
646
|
var e;
|
|
647
647
|
(e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
|
|
648
648
|
id: this.userData.id,
|
|
@@ -656,7 +656,7 @@ class be extends ri(Y, [
|
|
|
656
656
|
* Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
|
|
657
657
|
*/
|
|
658
658
|
onMove() {
|
|
659
|
-
|
|
659
|
+
w("State").then((t) => {
|
|
660
660
|
var e;
|
|
661
661
|
(e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
|
|
662
662
|
id: this.userData.id,
|
|
@@ -667,7 +667,7 @@ class be extends ri(Y, [
|
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
669
|
onSelect() {
|
|
670
|
-
|
|
670
|
+
w("State").then((t) => {
|
|
671
671
|
var e;
|
|
672
672
|
(e = t.get(this.userData.id)) == null || e.performAction("SELECT_OBJECT", {
|
|
673
673
|
id: this.userData.id
|
|
@@ -675,7 +675,7 @@ class be extends ri(Y, [
|
|
|
675
675
|
});
|
|
676
676
|
}
|
|
677
677
|
onDeselect() {
|
|
678
|
-
|
|
678
|
+
w("State").then((t) => {
|
|
679
679
|
var e;
|
|
680
680
|
(e = t.get(this.userData.id)) == null || e.performAction("DESELECT_OBJECT", {
|
|
681
681
|
id: this.userData.id
|
|
@@ -683,29 +683,42 @@ class be extends ri(Y, [
|
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
class
|
|
686
|
+
class $e extends _e {
|
|
687
687
|
constructor() {
|
|
688
688
|
super(...arguments);
|
|
689
689
|
a(this, "isDIVEModel", !0);
|
|
690
690
|
a(this, "_mesh", null);
|
|
691
691
|
a(this, "_material", null);
|
|
692
|
+
a(this, "_assetLoader", null);
|
|
693
|
+
}
|
|
694
|
+
async _getAssetLoader() {
|
|
695
|
+
return this._assetLoader || (this._assetLoader = new (await w("AssetLoader"))()), this._assetLoader;
|
|
692
696
|
}
|
|
693
|
-
|
|
697
|
+
async setFromURL(t) {
|
|
698
|
+
const n = await (await this._getAssetLoader()).load(t);
|
|
699
|
+
this.setFromGLTF(n), w("State").then((o) => {
|
|
700
|
+
var c;
|
|
701
|
+
(c = o.get(this.userData.id)) == null || c.performAction("MODEL_LOADED", {
|
|
702
|
+
id: this.userData.id
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
setFromGLTF(t) {
|
|
694
707
|
this.clear(), this._boundingBox.makeEmpty(), t.traverse((e) => {
|
|
695
708
|
e.castShadow = !0, e.receiveShadow = !0, e.layers.mask = this.layers.mask, this._boundingBox.expandByObject(e), !this._mesh && "isMesh" in e && (this._mesh = e, this._material ? this._mesh.material = this._material : this._material = e.material);
|
|
696
709
|
}), this.add(t);
|
|
697
710
|
}
|
|
698
|
-
|
|
711
|
+
setMaterial(t) {
|
|
699
712
|
this._material || (this._material = new fe()), 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);
|
|
700
713
|
}
|
|
701
|
-
|
|
702
|
-
var o,
|
|
714
|
+
placeOnFloor() {
|
|
715
|
+
var o, c, l, p;
|
|
703
716
|
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
704
|
-
(
|
|
717
|
+
(c = (o = this._mesh) == null ? void 0 : o.geometry) == null || c.computeBoundingBox();
|
|
705
718
|
const n = (p = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : p.boundingBox;
|
|
706
|
-
!n || !this._mesh || (t.y = t.y - this._mesh.localToWorld(n.min.clone()).y, t.y !== e.y &&
|
|
707
|
-
var
|
|
708
|
-
(
|
|
719
|
+
!n || !this._mesh || (t.y = t.y - this._mesh.localToWorld(n.min.clone()).y, t.y !== e.y && w("State").then((f) => {
|
|
720
|
+
var _;
|
|
721
|
+
(_ = f.get(this.userData.id)) == null || _.performAction("UPDATE_OBJECT", {
|
|
709
722
|
id: this.userData.id,
|
|
710
723
|
position: t,
|
|
711
724
|
rotation: this.rotation,
|
|
@@ -713,10 +726,10 @@ class ai extends be {
|
|
|
713
726
|
});
|
|
714
727
|
}));
|
|
715
728
|
}
|
|
716
|
-
|
|
729
|
+
dropIt() {
|
|
717
730
|
if (!this.parent) {
|
|
718
731
|
console.warn(
|
|
719
|
-
"DIVEModel:
|
|
732
|
+
"DIVEModel: dropIt() called on a model that is not in the scene.",
|
|
720
733
|
this
|
|
721
734
|
);
|
|
722
735
|
return;
|
|
@@ -728,41 +741,41 @@ class ai extends be {
|
|
|
728
741
|
const n = new Xe(e, new m(0, -1, 0));
|
|
729
742
|
n.layers.mask = P;
|
|
730
743
|
const o = n.intersectObjects(
|
|
731
|
-
ge(this).
|
|
744
|
+
ge(this).root.children,
|
|
732
745
|
!0
|
|
733
746
|
);
|
|
734
747
|
if (o.length > 0) {
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
const l =
|
|
738
|
-
if (this.position.copy(
|
|
748
|
+
const c = o[0].object;
|
|
749
|
+
c.geometry.computeBoundingBox();
|
|
750
|
+
const l = c.geometry.boundingBox, p = c.localToWorld(l.max.clone()), f = this.position.clone(), _ = this.position.clone().setY(p.y).sub(new m(0, t, 0));
|
|
751
|
+
if (this.position.copy(_), this.position.y === f.y) return;
|
|
739
752
|
this.onMove();
|
|
740
753
|
}
|
|
741
754
|
}
|
|
742
755
|
}
|
|
743
|
-
class
|
|
756
|
+
class hi extends _e {
|
|
744
757
|
constructor() {
|
|
745
758
|
super();
|
|
746
759
|
a(this, "isDIVEPrimitive", !0);
|
|
747
760
|
a(this, "_mesh");
|
|
748
|
-
this._mesh = new
|
|
761
|
+
this._mesh = new pe(), this._mesh.layers.mask = P, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new fe(), this.add(this._mesh);
|
|
749
762
|
}
|
|
750
763
|
SetGeometry(t) {
|
|
751
764
|
const e = this.assembleGeometry(t);
|
|
752
765
|
e && (this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
|
|
753
766
|
}
|
|
754
|
-
|
|
767
|
+
setMaterial(t) {
|
|
755
768
|
const e = this._mesh.material;
|
|
756
|
-
t.vertexColors !== void 0 && (e.vertexColors = t.vertexColors), t.color !== void 0 && (e.color = new
|
|
769
|
+
t.vertexColors !== void 0 && (e.vertexColors = t.vertexColors), t.color !== void 0 && (e.color = new D(t.color)), t.map !== void 0 && (e.map = t.map), t.normalMap !== void 0 && (e.normalMap = t.normalMap), t.roughness !== void 0 && (e.roughness = t.roughness), t.roughnessMap !== void 0 && (e.roughnessMap = t.roughnessMap, e.roughnessMap && (e.roughness = 1)), t.metalness !== void 0 && (e.metalness = t.metalness), t.metalnessMap !== void 0 && (e.metalnessMap = t.metalnessMap, e.metalnessMap && (e.metalness = 0)), this._mesh && (this._mesh.material = e);
|
|
757
770
|
}
|
|
758
|
-
|
|
759
|
-
var o,
|
|
771
|
+
placeOnFloor() {
|
|
772
|
+
var o, c, l, p;
|
|
760
773
|
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
761
|
-
(
|
|
774
|
+
(c = (o = this._mesh) == null ? void 0 : o.geometry) == null || c.computeBoundingBox();
|
|
762
775
|
const n = (p = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : p.boundingBox;
|
|
763
|
-
!n || !this._mesh || (t.y = t.y - this._mesh.localToWorld(n.min.clone()).y, t.y !== e.y &&
|
|
764
|
-
var
|
|
765
|
-
(
|
|
776
|
+
!n || !this._mesh || (t.y = t.y - this._mesh.localToWorld(n.min.clone()).y, t.y !== e.y && w("State").then((f) => {
|
|
777
|
+
var _;
|
|
778
|
+
(_ = f.get(this.userData.id)) == null || _.performAction("UPDATE_OBJECT", {
|
|
766
779
|
id: this.userData.id,
|
|
767
780
|
position: t,
|
|
768
781
|
rotation: this.rotation,
|
|
@@ -770,10 +783,10 @@ class ci extends be {
|
|
|
770
783
|
});
|
|
771
784
|
}));
|
|
772
785
|
}
|
|
773
|
-
|
|
786
|
+
dropIt() {
|
|
774
787
|
if (!this.parent) {
|
|
775
788
|
console.warn(
|
|
776
|
-
"DIVEPrimitive:
|
|
789
|
+
"DIVEPrimitive: dropIt() called on a model that is not in the scene.",
|
|
777
790
|
this
|
|
778
791
|
);
|
|
779
792
|
return;
|
|
@@ -785,14 +798,14 @@ class ci extends be {
|
|
|
785
798
|
const n = new Xe(e, new m(0, -1, 0));
|
|
786
799
|
n.layers.mask = P;
|
|
787
800
|
const o = n.intersectObjects(
|
|
788
|
-
ge(this).
|
|
801
|
+
ge(this).root.children,
|
|
789
802
|
!0
|
|
790
803
|
);
|
|
791
804
|
if (o.length > 0) {
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
const l =
|
|
795
|
-
if (this.position.copy(
|
|
805
|
+
const c = o[0].object;
|
|
806
|
+
c.geometry.computeBoundingBox();
|
|
807
|
+
const l = c.geometry.boundingBox, p = c.localToWorld(l.max.clone()), f = this.position.clone(), _ = this.position.clone().setY(p.y).sub(new m(0, t, 0));
|
|
808
|
+
if (this.position.copy(_), this.position.y === f.y) return;
|
|
796
809
|
this.onMove();
|
|
797
810
|
}
|
|
798
811
|
}
|
|
@@ -821,7 +834,7 @@ class ci extends be {
|
|
|
821
834
|
}
|
|
822
835
|
}
|
|
823
836
|
createCylinderGeometry(t) {
|
|
824
|
-
const e = new
|
|
837
|
+
const e = new Bt(
|
|
825
838
|
t.width / 2,
|
|
826
839
|
t.width / 2,
|
|
827
840
|
t.height,
|
|
@@ -872,11 +885,11 @@ class ci extends be {
|
|
|
872
885
|
3,
|
|
873
886
|
4,
|
|
874
887
|
0
|
|
875
|
-
]), o = new
|
|
888
|
+
]), o = new qe();
|
|
876
889
|
return o.setAttribute(
|
|
877
890
|
"position",
|
|
878
|
-
new
|
|
879
|
-
), o.setIndex(new
|
|
891
|
+
new Ye(e, 3)
|
|
892
|
+
), o.setIndex(new Ye(n, 1)), o.computeVertexNormals(), o.computeBoundingBox(), o.computeBoundingSphere(), o;
|
|
880
893
|
}
|
|
881
894
|
createBoxGeometry(t) {
|
|
882
895
|
const e = new de(
|
|
@@ -887,7 +900,7 @@ class ci extends be {
|
|
|
887
900
|
return e.translate(0, t.height / 2, 0), e;
|
|
888
901
|
}
|
|
889
902
|
createConeGeometry(t) {
|
|
890
|
-
const e = new
|
|
903
|
+
const e = new zt(t.width / 2, t.height, 256);
|
|
891
904
|
return e.translate(0, t.height / 2, 0), e;
|
|
892
905
|
}
|
|
893
906
|
createWallGeometry(t) {
|
|
@@ -908,7 +921,7 @@ class ci extends be {
|
|
|
908
921
|
return e.translate(0, t.height / 2, 0), e;
|
|
909
922
|
}
|
|
910
923
|
}
|
|
911
|
-
class li extends
|
|
924
|
+
class li extends _e {
|
|
912
925
|
// lines to children
|
|
913
926
|
constructor() {
|
|
914
927
|
super();
|
|
@@ -962,11 +975,11 @@ class li extends be {
|
|
|
962
975
|
* Creates a line for visualization.
|
|
963
976
|
*/
|
|
964
977
|
createLine() {
|
|
965
|
-
const t = new
|
|
978
|
+
const t = new qe(), e = new Nt({
|
|
966
979
|
color: 6710886,
|
|
967
980
|
dashSize: 0.05,
|
|
968
981
|
gapSize: 0.025
|
|
969
|
-
}), n = new
|
|
982
|
+
}), n = new Ft(t, e);
|
|
970
983
|
return n.visible = !1, n;
|
|
971
984
|
}
|
|
972
985
|
/**
|
|
@@ -1027,39 +1040,39 @@ class li extends be {
|
|
|
1027
1040
|
// this._boxMesh.visible = true;
|
|
1028
1041
|
// }
|
|
1029
1042
|
}
|
|
1030
|
-
class
|
|
1043
|
+
class ci extends pe {
|
|
1031
1044
|
constructor() {
|
|
1032
1045
|
super(
|
|
1033
|
-
new
|
|
1046
|
+
new Yt(1e4, 1e4),
|
|
1034
1047
|
new fe({
|
|
1035
|
-
color: new
|
|
1048
|
+
color: new D(150 / 255, 150 / 255, 150 / 255)
|
|
1036
1049
|
})
|
|
1037
1050
|
);
|
|
1038
1051
|
a(this, "isDIVEFloor", !0);
|
|
1039
1052
|
this.name = "Floor", this.layers.mask = P, this.receiveShadow = !0, this.rotateX(-Math.PI / 2);
|
|
1040
1053
|
}
|
|
1041
|
-
|
|
1054
|
+
setVisibility(t) {
|
|
1042
1055
|
this.visible = t;
|
|
1043
1056
|
}
|
|
1044
|
-
|
|
1045
|
-
this.material.color = new
|
|
1057
|
+
setColor(t) {
|
|
1058
|
+
this.material.color = new D(t);
|
|
1046
1059
|
}
|
|
1047
1060
|
}
|
|
1048
|
-
class di extends
|
|
1061
|
+
class di extends j {
|
|
1049
1062
|
constructor() {
|
|
1050
1063
|
super();
|
|
1051
1064
|
a(this, "isDIVERoot", !0);
|
|
1052
1065
|
a(this, "_floor");
|
|
1053
1066
|
a(this, "_assetLoader", null);
|
|
1054
|
-
this.name = "Root", this._floor = new
|
|
1067
|
+
this.name = "Root", this._floor = new ci(), this.add(this._floor);
|
|
1055
1068
|
}
|
|
1056
1069
|
get floor() {
|
|
1057
1070
|
return this._floor;
|
|
1058
1071
|
}
|
|
1059
1072
|
async _getAssetLoader() {
|
|
1060
|
-
return this._assetLoader || (this._assetLoader = new (await
|
|
1073
|
+
return this._assetLoader || (this._assetLoader = new (await w("AssetLoader"))()), this._assetLoader;
|
|
1061
1074
|
}
|
|
1062
|
-
|
|
1075
|
+
computeSceneBB() {
|
|
1063
1076
|
const t = new Ze();
|
|
1064
1077
|
return this.children.forEach((e) => {
|
|
1065
1078
|
"isDIVEFloor" in e || e.traverse((n) => {
|
|
@@ -1067,242 +1080,193 @@ class di extends Y {
|
|
|
1067
1080
|
});
|
|
1068
1081
|
}), t;
|
|
1069
1082
|
}
|
|
1070
|
-
|
|
1083
|
+
getSceneObject(t) {
|
|
1071
1084
|
let e;
|
|
1072
1085
|
return this.traverse((n) => {
|
|
1073
1086
|
e || n.userData.id === t.id && (e = n);
|
|
1074
1087
|
}), e;
|
|
1075
1088
|
}
|
|
1076
|
-
|
|
1089
|
+
addSceneObject(t) {
|
|
1090
|
+
let e = this.getSceneObject(t);
|
|
1091
|
+
if (e)
|
|
1092
|
+
return console.warn(
|
|
1093
|
+
`DIVERoot.addSceneObject: Scene object with id ${t.id} already exists`
|
|
1094
|
+
), e;
|
|
1077
1095
|
switch (t.entityType) {
|
|
1078
1096
|
case "pov":
|
|
1079
1097
|
break;
|
|
1080
1098
|
case "light": {
|
|
1081
|
-
|
|
1099
|
+
switch (t.type) {
|
|
1100
|
+
case "scene": {
|
|
1101
|
+
e = new Je();
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1104
|
+
case "ambient": {
|
|
1105
|
+
e = new si();
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
case "point": {
|
|
1109
|
+
e = new ni();
|
|
1110
|
+
break;
|
|
1111
|
+
}
|
|
1112
|
+
default:
|
|
1113
|
+
throw new Error(
|
|
1114
|
+
`DIVERoot.addSceneObject: Unknown light type: ${t.type}`
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
e.name = t.name, e.userData.id = t.id, this.add(e), this._updateLight(e, t);
|
|
1082
1118
|
break;
|
|
1083
1119
|
}
|
|
1084
1120
|
case "model": {
|
|
1085
|
-
this.
|
|
1121
|
+
e = new $e(), e.name = t.name, e.userData.id = t.id, e.userData.uri = t.uri, this.add(e), this._updateModel(e, t);
|
|
1086
1122
|
break;
|
|
1087
1123
|
}
|
|
1088
1124
|
case "primitive": {
|
|
1089
|
-
this.
|
|
1125
|
+
e = new hi(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updatePrimitive(e, t);
|
|
1090
1126
|
break;
|
|
1091
1127
|
}
|
|
1092
1128
|
case "group": {
|
|
1093
|
-
this.
|
|
1129
|
+
e = new li(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updateGroup(e, t);
|
|
1094
1130
|
break;
|
|
1095
1131
|
}
|
|
1096
1132
|
default:
|
|
1097
|
-
|
|
1098
|
-
`DIVERoot.
|
|
1133
|
+
throw new Error(
|
|
1134
|
+
`DIVERoot.addSceneObject: Unknown entity type: ${t.entityType}`
|
|
1099
1135
|
);
|
|
1100
1136
|
}
|
|
1137
|
+
return e;
|
|
1101
1138
|
}
|
|
1102
|
-
|
|
1139
|
+
updateSceneObject(t) {
|
|
1140
|
+
const e = this.getSceneObject(t);
|
|
1141
|
+
if (!e) {
|
|
1142
|
+
console.warn(
|
|
1143
|
+
`DIVERoot.updateSceneObject: Scene object with id ${t.id} does not exist`
|
|
1144
|
+
);
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1103
1147
|
switch (t.entityType) {
|
|
1104
1148
|
case "pov":
|
|
1105
1149
|
break;
|
|
1106
1150
|
case "light": {
|
|
1107
|
-
this.
|
|
1151
|
+
this._updateLight(e, t);
|
|
1108
1152
|
break;
|
|
1109
1153
|
}
|
|
1110
1154
|
case "model": {
|
|
1111
|
-
this.
|
|
1155
|
+
this._updateModel(e, t);
|
|
1112
1156
|
break;
|
|
1113
1157
|
}
|
|
1114
1158
|
case "primitive": {
|
|
1115
|
-
this.
|
|
1159
|
+
this._updatePrimitive(e, t);
|
|
1116
1160
|
break;
|
|
1117
1161
|
}
|
|
1118
1162
|
case "group": {
|
|
1119
|
-
this.
|
|
1163
|
+
this._updateGroup(e, t);
|
|
1120
1164
|
break;
|
|
1121
1165
|
}
|
|
1122
1166
|
default:
|
|
1123
|
-
|
|
1124
|
-
`DIVERoot.
|
|
1167
|
+
throw new Error(
|
|
1168
|
+
`DIVERoot.updateSceneObject: Unknown entity type: ${t.entityType}`
|
|
1125
1169
|
);
|
|
1126
1170
|
}
|
|
1127
1171
|
}
|
|
1128
|
-
|
|
1172
|
+
deleteSceneObject(t) {
|
|
1173
|
+
const e = this.getSceneObject(t);
|
|
1174
|
+
if (!e) {
|
|
1175
|
+
console.warn(
|
|
1176
|
+
`DIVERoot.deleteSceneObject: Object with id ${t.id} not found`
|
|
1177
|
+
);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1129
1180
|
switch (t.entityType) {
|
|
1130
1181
|
case "pov":
|
|
1131
1182
|
break;
|
|
1132
1183
|
case "light": {
|
|
1133
|
-
this.
|
|
1184
|
+
this._deleteLight(e);
|
|
1134
1185
|
break;
|
|
1135
1186
|
}
|
|
1136
1187
|
case "model": {
|
|
1137
|
-
this.
|
|
1188
|
+
this._deleteModel(e);
|
|
1138
1189
|
break;
|
|
1139
1190
|
}
|
|
1140
1191
|
case "primitive": {
|
|
1141
|
-
this.
|
|
1192
|
+
this._deletePrimitive(e);
|
|
1142
1193
|
break;
|
|
1143
1194
|
}
|
|
1144
1195
|
case "group": {
|
|
1145
|
-
this.
|
|
1146
|
-
break;
|
|
1147
|
-
}
|
|
1148
|
-
default:
|
|
1149
|
-
console.warn(
|
|
1150
|
-
`DIVERoot.DeleteSceneObject: Unknown entity type: ${t.entityType}`
|
|
1151
|
-
);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
PlaceOnFloor(t) {
|
|
1155
|
-
switch (t.entityType) {
|
|
1156
|
-
case "pov":
|
|
1157
|
-
case "light":
|
|
1158
|
-
break;
|
|
1159
|
-
case "model":
|
|
1160
|
-
case "primitive": {
|
|
1161
|
-
this.placeOnFloor(t);
|
|
1196
|
+
this._deleteGroup(e);
|
|
1162
1197
|
break;
|
|
1163
1198
|
}
|
|
1164
1199
|
default:
|
|
1165
|
-
|
|
1166
|
-
`DIVERoot.
|
|
1200
|
+
throw new Error(
|
|
1201
|
+
`DIVERoot.deleteSceneObject: Unknown entity type: ${t.entityType}`
|
|
1167
1202
|
);
|
|
1168
1203
|
}
|
|
1169
1204
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
break;
|
|
1177
|
-
}
|
|
1178
|
-
case "ambient": {
|
|
1179
|
-
e = new ti();
|
|
1180
|
-
break;
|
|
1181
|
-
}
|
|
1182
|
-
case "point": {
|
|
1183
|
-
e = new ii();
|
|
1184
|
-
break;
|
|
1185
|
-
}
|
|
1186
|
-
default: {
|
|
1187
|
-
console.warn(
|
|
1188
|
-
`DIVERoot.updateLight: Unknown light type: ${t.type}`
|
|
1189
|
-
);
|
|
1190
|
-
return;
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
e.userData.id = t.id, this.add(e);
|
|
1194
|
-
}
|
|
1195
|
-
t.name !== void 0 && t.name !== null && (e.name = t.name), t.position !== void 0 && t.position !== null && e.position.set(
|
|
1196
|
-
t.position.x,
|
|
1197
|
-
t.position.y,
|
|
1198
|
-
t.position.z
|
|
1199
|
-
), t.intensity !== void 0 && t.intensity !== null && e.SetIntensity(
|
|
1200
|
-
t.intensity
|
|
1201
|
-
), t.enabled !== void 0 && t.enabled !== null && e.SetEnabled(
|
|
1202
|
-
t.enabled
|
|
1203
|
-
), t.color !== void 0 && t.color !== null && e.SetColor(
|
|
1204
|
-
new x(t.color)
|
|
1205
|
-
), t.visible !== void 0 && t.visible !== null && (e.visible = t.visible), t.parentId !== void 0 && this.setParent({ ...t, parentId: t.parentId });
|
|
1206
|
-
}
|
|
1207
|
-
updateModel(t) {
|
|
1208
|
-
let e = this.GetSceneObject(t);
|
|
1209
|
-
e || (e = new ai(), e.userData.id = t.id, e.userData.uri = t.uri, this.add(e)), t.uri !== void 0 && this._getAssetLoader().then((n) => n.load(t.uri)).then((n) => {
|
|
1210
|
-
e.SetModel(n), E("State").then((o) => {
|
|
1211
|
-
var h;
|
|
1212
|
-
(h = o.get(t.id)) == null || h.performAction("MODEL_LOADED", {
|
|
1213
|
-
id: t.id
|
|
1214
|
-
});
|
|
1215
|
-
});
|
|
1216
|
-
}), t.name !== void 0 && (e.name = t.name), t.position !== void 0 && e.SetPosition(t.position), t.rotation !== void 0 && e.SetRotation(t.rotation), t.scale !== void 0 && e.SetScale(t.scale), t.visible !== void 0 && e.SetVisibility(t.visible), t.material !== void 0 && e.SetMaterial(t.material), t.parentId !== void 0 && this.setParent({ ...t, parentId: t.parentId });
|
|
1205
|
+
_updateLight(t, e) {
|
|
1206
|
+
e.name !== void 0 && e.name !== null && (t.name = e.name), e.position !== void 0 && e.position !== null && t.position.set(
|
|
1207
|
+
e.position.x,
|
|
1208
|
+
e.position.y,
|
|
1209
|
+
e.position.z
|
|
1210
|
+
), 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 D(e.color)), e.visible !== void 0 && e.visible !== null && (t.visible = e.visible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
|
|
1217
1211
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
e || (e = new ci(), e.userData.id = t.id, this.add(e)), t.name !== void 0 && (e.name = t.name), t.geometry !== void 0 && e.SetGeometry(t.geometry), t.position !== void 0 && e.SetPosition(t.position), t.rotation !== void 0 && e.SetRotation(t.rotation), t.scale !== void 0 && e.SetScale(t.scale), t.visible !== void 0 && e.SetVisibility(t.visible), t.material !== void 0 && e.SetMaterial(t.material), t.parentId !== void 0 && this.setParent({ ...t, parentId: t.parentId });
|
|
1212
|
+
_updateModel(t, e) {
|
|
1213
|
+
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 });
|
|
1221
1214
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
e || (e = new li(), e.userData.id = t.id, this.add(e)), t.name !== void 0 && (e.name = t.name), t.position !== void 0 && e.SetPosition(t.position), t.rotation !== void 0 && e.SetRotation(t.rotation), t.scale !== void 0 && e.SetScale(t.scale), t.visible !== void 0 && e.SetVisibility(t.visible), t.bbVisible !== void 0 && e.SetLinesVisibility(t.bbVisible), t.parentId !== void 0 && this.setParent({ ...t, parentId: t.parentId });
|
|
1215
|
+
_updatePrimitive(t, e) {
|
|
1216
|
+
e.name !== void 0 && (t.name = e.name), e.geometry !== void 0 && t.SetGeometry(e.geometry), 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 });
|
|
1225
1217
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
if (!e) {
|
|
1229
|
-
console.warn(
|
|
1230
|
-
`DIVERoot.deleteLight: Light with id ${t.id} not found`
|
|
1231
|
-
);
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
this.detachTransformControls(e), e.parent.remove(e);
|
|
1218
|
+
_updateGroup(t, e) {
|
|
1219
|
+
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.bbVisible !== void 0 && t.SetLinesVisibility(e.bbVisible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
|
|
1235
1220
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
if (!e) {
|
|
1239
|
-
console.warn(
|
|
1240
|
-
`DIVERoot.deleteModel: Model with id ${t.id} not found`
|
|
1241
|
-
);
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
this.detachTransformControls(e), e.parent.remove(e);
|
|
1221
|
+
_deleteLight(t) {
|
|
1222
|
+
this._detachTransformControls(t), t.parent.remove(t);
|
|
1245
1223
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
if (!e) {
|
|
1249
|
-
console.warn(
|
|
1250
|
-
`DIVERoot.deletePrimitive: Primitive with id ${t.id} not found`
|
|
1251
|
-
);
|
|
1252
|
-
return;
|
|
1253
|
-
}
|
|
1254
|
-
this.detachTransformControls(e), e.parent.remove(e);
|
|
1224
|
+
_deleteModel(t) {
|
|
1225
|
+
this._detachTransformControls(t), t.parent.remove(t);
|
|
1255
1226
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
if (!e) {
|
|
1259
|
-
console.warn(
|
|
1260
|
-
`DIVERoot.deleteGroup: Group with id ${t.id} not found`
|
|
1261
|
-
);
|
|
1262
|
-
return;
|
|
1263
|
-
}
|
|
1264
|
-
this.detachTransformControls(e);
|
|
1265
|
-
for (let n = e.members.length - 1; n >= 0; n--)
|
|
1266
|
-
this.attach(e.members[n]);
|
|
1267
|
-
e.parent.remove(e);
|
|
1227
|
+
_deletePrimitive(t) {
|
|
1228
|
+
this._detachTransformControls(t), t.parent.remove(t);
|
|
1268
1229
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
e
|
|
1230
|
+
_deleteGroup(t) {
|
|
1231
|
+
this._detachTransformControls(t);
|
|
1232
|
+
for (let e = t.members.length - 1; e >= 0; e--)
|
|
1233
|
+
this.attach(t.members[e]);
|
|
1234
|
+
t.parent.remove(t);
|
|
1272
1235
|
}
|
|
1273
|
-
|
|
1274
|
-
const e = this.
|
|
1236
|
+
_setParent(t) {
|
|
1237
|
+
const e = this.getSceneObject(t);
|
|
1275
1238
|
if (t.parentId !== null) {
|
|
1276
|
-
const n = this.
|
|
1277
|
-
id: t.parentId
|
|
1239
|
+
const n = this.getSceneObject({
|
|
1240
|
+
id: t.parentId,
|
|
1241
|
+
entityType: t.entityType
|
|
1278
1242
|
});
|
|
1279
1243
|
if (!n) return;
|
|
1280
1244
|
n.attach(e);
|
|
1281
1245
|
} else
|
|
1282
1246
|
this.attach(e);
|
|
1283
1247
|
}
|
|
1284
|
-
|
|
1285
|
-
this.
|
|
1248
|
+
_detachTransformControls(t) {
|
|
1249
|
+
this._findScene(t).children.find((e) => {
|
|
1286
1250
|
"isTransformControls" in e && e.detach();
|
|
1287
1251
|
});
|
|
1288
1252
|
}
|
|
1289
|
-
|
|
1290
|
-
return t.parent !== null ? this.
|
|
1253
|
+
_findScene(t) {
|
|
1254
|
+
return t.parent !== null ? this._findScene(t.parent) : t;
|
|
1291
1255
|
}
|
|
1292
1256
|
}
|
|
1293
|
-
const ui = "#888888",
|
|
1294
|
-
class
|
|
1257
|
+
const ui = "#888888", mi = "#dddddd";
|
|
1258
|
+
class pi extends j {
|
|
1295
1259
|
constructor() {
|
|
1296
1260
|
super(), this.name = "Grid";
|
|
1297
|
-
const s = new
|
|
1261
|
+
const s = new Ut(
|
|
1298
1262
|
100,
|
|
1299
1263
|
100,
|
|
1300
1264
|
ui,
|
|
1301
|
-
|
|
1265
|
+
mi
|
|
1302
1266
|
);
|
|
1303
|
-
s.material.depthTest = !1, s.layers.mask =
|
|
1267
|
+
s.material.depthTest = !1, s.layers.mask = Ht, this.add(s);
|
|
1304
1268
|
}
|
|
1305
|
-
|
|
1269
|
+
setVisibility(s) {
|
|
1306
1270
|
this.visible = s;
|
|
1307
1271
|
}
|
|
1308
1272
|
}
|
|
@@ -1311,37 +1275,22 @@ class fi extends Gt {
|
|
|
1311
1275
|
super();
|
|
1312
1276
|
a(this, "_root");
|
|
1313
1277
|
a(this, "_grid");
|
|
1314
|
-
this.background = new
|
|
1278
|
+
this.background = new D(16777215), this._root = new di(), this.add(this._root), this._grid = new pi(), this.add(this._grid);
|
|
1315
1279
|
}
|
|
1316
|
-
get
|
|
1280
|
+
get root() {
|
|
1317
1281
|
return this._root;
|
|
1318
1282
|
}
|
|
1319
|
-
get
|
|
1283
|
+
get grid() {
|
|
1320
1284
|
return this._grid;
|
|
1321
1285
|
}
|
|
1322
|
-
|
|
1323
|
-
this.background = new
|
|
1324
|
-
}
|
|
1325
|
-
ComputeSceneBB() {
|
|
1326
|
-
return this.Root.ComputeSceneBB();
|
|
1327
|
-
}
|
|
1328
|
-
GetSceneObject(t) {
|
|
1329
|
-
return this.Root.GetSceneObject(t);
|
|
1330
|
-
}
|
|
1331
|
-
AddSceneObject(t) {
|
|
1332
|
-
this.Root.AddSceneObject(t);
|
|
1286
|
+
setBackground(t) {
|
|
1287
|
+
this.background = new D(t);
|
|
1333
1288
|
}
|
|
1334
|
-
|
|
1335
|
-
this.
|
|
1336
|
-
}
|
|
1337
|
-
DeleteSceneObject(t) {
|
|
1338
|
-
this.Root.DeleteSceneObject(t);
|
|
1339
|
-
}
|
|
1340
|
-
PlaceOnFloor(t) {
|
|
1341
|
-
this.Root.PlaceOnFloor(t);
|
|
1289
|
+
computeSceneBB() {
|
|
1290
|
+
return this.root.computeSceneBB();
|
|
1342
1291
|
}
|
|
1343
1292
|
}
|
|
1344
|
-
const
|
|
1293
|
+
const Qe = {
|
|
1345
1294
|
canvas: void 0,
|
|
1346
1295
|
antialias: !0,
|
|
1347
1296
|
alpha: !0,
|
|
@@ -1356,9 +1305,9 @@ class gi {
|
|
|
1356
1305
|
a(this, "_webglrenderer");
|
|
1357
1306
|
a(this, "_settings");
|
|
1358
1307
|
this._scene = s, this._camera = t, this._settings = {
|
|
1359
|
-
...
|
|
1308
|
+
...Qe,
|
|
1360
1309
|
...e ?? {}
|
|
1361
|
-
}, this._webglrenderer = new
|
|
1310
|
+
}, this._webglrenderer = new Ue({
|
|
1362
1311
|
canvas: this._settings.canvas,
|
|
1363
1312
|
antialias: this._settings.antialias,
|
|
1364
1313
|
alpha: this._settings.alpha,
|
|
@@ -1373,7 +1322,7 @@ class gi {
|
|
|
1373
1322
|
return this._webglrenderer;
|
|
1374
1323
|
}
|
|
1375
1324
|
setCanvas(s) {
|
|
1376
|
-
this._webglrenderer.dispose(), this._settings.canvas = s, this._webglrenderer = new
|
|
1325
|
+
this._webglrenderer.dispose(), this._settings.canvas = s, this._webglrenderer = new Ue(this._settings);
|
|
1377
1326
|
}
|
|
1378
1327
|
render() {
|
|
1379
1328
|
this._webglrenderer.render(this._scene, this._camera);
|
|
@@ -1385,7 +1334,7 @@ class gi {
|
|
|
1385
1334
|
this._webglrenderer.dispose();
|
|
1386
1335
|
}
|
|
1387
1336
|
}
|
|
1388
|
-
class
|
|
1337
|
+
class _i {
|
|
1389
1338
|
constructor() {
|
|
1390
1339
|
a(this, "_renderer", null);
|
|
1391
1340
|
a(this, "_lastTime", 0);
|
|
@@ -1421,15 +1370,15 @@ class bi {
|
|
|
1421
1370
|
this._lastTime = s, this._tickers.forEach((n) => n.tick(t)), (e = this._renderer) == null || e.render(), requestAnimationFrame(this._tick.bind(this));
|
|
1422
1371
|
}
|
|
1423
1372
|
}
|
|
1424
|
-
class
|
|
1373
|
+
class yi {
|
|
1425
1374
|
constructor(s, t) {
|
|
1426
1375
|
a(this, "_resizeObserver");
|
|
1427
1376
|
a(this, "_width", 0);
|
|
1428
1377
|
a(this, "_height", 0);
|
|
1429
1378
|
this._resizeObserver = new ResizeObserver((e) => {
|
|
1430
1379
|
for (const n of e) {
|
|
1431
|
-
const { width: o, height:
|
|
1432
|
-
o === this._width &&
|
|
1380
|
+
const { width: o, height: c } = n.contentRect;
|
|
1381
|
+
o === this._width && c === this._height || (s.onResize(o, c), t.onResize(o, c), this._width = o, this._height = c);
|
|
1433
1382
|
}
|
|
1434
1383
|
}), this._observeCanvas(s.webglrenderer.domElement);
|
|
1435
1384
|
}
|
|
@@ -1449,13 +1398,13 @@ class _i {
|
|
|
1449
1398
|
}
|
|
1450
1399
|
}
|
|
1451
1400
|
}
|
|
1452
|
-
const
|
|
1401
|
+
const et = {
|
|
1453
1402
|
autoStart: !0,
|
|
1454
1403
|
displayAxes: !1,
|
|
1455
|
-
|
|
1456
|
-
|
|
1404
|
+
...$t,
|
|
1405
|
+
...Qe
|
|
1457
1406
|
};
|
|
1458
|
-
class
|
|
1407
|
+
class bi {
|
|
1459
1408
|
constructor(s) {
|
|
1460
1409
|
a(this, "_renderer");
|
|
1461
1410
|
a(this, "_scene");
|
|
@@ -1464,18 +1413,16 @@ class yi {
|
|
|
1464
1413
|
a(this, "_clock");
|
|
1465
1414
|
a(this, "_settings");
|
|
1466
1415
|
this._settings = {
|
|
1467
|
-
|
|
1416
|
+
...et,
|
|
1468
1417
|
...s ?? {}
|
|
1469
|
-
}, this._scene = new fi(), this._camera = new
|
|
1470
|
-
this._settings.perspectiveCamera
|
|
1471
|
-
), this._renderer = new gi(
|
|
1418
|
+
}, this._scene = new fi(), this._camera = new Qt(this._settings), this._renderer = new gi(
|
|
1472
1419
|
this._scene,
|
|
1473
1420
|
this._camera,
|
|
1474
|
-
this._settings
|
|
1475
|
-
), this._resizeManager = new
|
|
1421
|
+
this._settings
|
|
1422
|
+
), this._resizeManager = new yi(
|
|
1476
1423
|
this._renderer,
|
|
1477
1424
|
this._camera
|
|
1478
|
-
), this._clock = new
|
|
1425
|
+
), this._clock = new _i(), this._clock.setRenderer(this._renderer), this._settings.autoStart && this.start();
|
|
1479
1426
|
}
|
|
1480
1427
|
get scene() {
|
|
1481
1428
|
return this._scene;
|
|
@@ -1502,17 +1449,64 @@ class yi {
|
|
|
1502
1449
|
this._clock.dispose(), this._resizeManager.dispose(), this._renderer.dispose();
|
|
1503
1450
|
}
|
|
1504
1451
|
}
|
|
1452
|
+
function x(h, s) {
|
|
1453
|
+
const t = (h + "e").split("e");
|
|
1454
|
+
return +(t[0] + "e" + (+t[1] + (s || 0)));
|
|
1455
|
+
}
|
|
1456
|
+
function wi(h, s = 0) {
|
|
1457
|
+
const t = x(h, +s);
|
|
1458
|
+
return x(Math.ceil(t), -s);
|
|
1459
|
+
}
|
|
1460
|
+
function Ei(h, s = 0) {
|
|
1461
|
+
const t = x(h, +s);
|
|
1462
|
+
return x(Math.floor(t), -s);
|
|
1463
|
+
}
|
|
1464
|
+
function tt(h, s = 0) {
|
|
1465
|
+
if (h < 0) return -tt(-h, s);
|
|
1466
|
+
const t = x(h, +s);
|
|
1467
|
+
return x(Math.round(t), -s);
|
|
1468
|
+
}
|
|
1469
|
+
function Di(h, s, t) {
|
|
1470
|
+
return Math.atan2(
|
|
1471
|
+
h.clone().cross(s).dot(t),
|
|
1472
|
+
s.clone().dot(h)
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
function xi(h, s = 0) {
|
|
1476
|
+
const t = x(h, +s);
|
|
1477
|
+
return x(Math.round(t), -s).toFixed(s);
|
|
1478
|
+
}
|
|
1479
|
+
function Si(h, s = 0) {
|
|
1480
|
+
const t = x(h, +s);
|
|
1481
|
+
return x(Math.trunc(t), -s);
|
|
1482
|
+
}
|
|
1483
|
+
function Ti(h) {
|
|
1484
|
+
return (C.radToDeg(h) + 360) % 360;
|
|
1485
|
+
}
|
|
1486
|
+
function Li(h) {
|
|
1487
|
+
return C.degToRad(h);
|
|
1488
|
+
}
|
|
1489
|
+
const Bi = {
|
|
1490
|
+
ceilExp: wi,
|
|
1491
|
+
floorExp: Ei,
|
|
1492
|
+
roundExp: tt,
|
|
1493
|
+
toFixedExp: xi,
|
|
1494
|
+
truncateExp: Si,
|
|
1495
|
+
signedAngleTo: Di,
|
|
1496
|
+
radToDeg: Ti,
|
|
1497
|
+
degToRad: Li
|
|
1498
|
+
};
|
|
1505
1499
|
window.DIVE = {
|
|
1506
1500
|
instances: [],
|
|
1507
1501
|
get instance() {
|
|
1508
1502
|
return window.DIVE.instances[0];
|
|
1509
1503
|
}
|
|
1510
1504
|
};
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1513
|
-
|
|
1505
|
+
const Pi = {
|
|
1506
|
+
...et,
|
|
1507
|
+
...se
|
|
1514
1508
|
};
|
|
1515
|
-
class
|
|
1509
|
+
class it {
|
|
1516
1510
|
constructor(s) {
|
|
1517
1511
|
// descriptive members
|
|
1518
1512
|
a(this, "_settings");
|
|
@@ -1520,17 +1514,17 @@ class Qe {
|
|
|
1520
1514
|
a(this, "orbitController");
|
|
1521
1515
|
a(this, "axisCamera");
|
|
1522
1516
|
this._settings = {
|
|
1523
|
-
...
|
|
1517
|
+
...Pi,
|
|
1524
1518
|
...s ?? {}
|
|
1525
|
-
}, this._engine = new
|
|
1519
|
+
}, this._engine = new bi(s), this.orbitController = new ne(
|
|
1526
1520
|
this._engine.camera,
|
|
1527
1521
|
this._engine.renderer.webglrenderer.domElement,
|
|
1528
|
-
this._settings
|
|
1529
|
-
), this._engine.clock.addTicker(this.orbitController), this._settings.displayAxes ? (this.axisCamera = new
|
|
1522
|
+
this._settings
|
|
1523
|
+
), this._engine.clock.addTicker(this.orbitController), this._settings.displayAxes ? (this.axisCamera = new ii(
|
|
1530
1524
|
this._engine.renderer,
|
|
1531
1525
|
this._engine.scene,
|
|
1532
1526
|
this._engine.camera
|
|
1533
|
-
), this._engine.clock.addTicker(this.axisCamera)) : this.axisCamera = null, import("./chunks/package-
|
|
1527
|
+
), this._engine.clock.addTicker(this.axisCamera)) : this.axisCamera = null, import("./chunks/package-BHjZWYD6.mjs").then((t) => {
|
|
1534
1528
|
console.log(
|
|
1535
1529
|
`DIVE ${t.default.version} initialized successfully!`
|
|
1536
1530
|
), console.log(`
|
|
@@ -1567,55 +1561,14 @@ class Qe {
|
|
|
1567
1561
|
}
|
|
1568
1562
|
// static members
|
|
1569
1563
|
static async QuickView(s, t) {
|
|
1570
|
-
const e = new
|
|
1571
|
-
window.DIVE.instances.push(e);
|
|
1572
|
-
const n = new (
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
);
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
gridEnabled: !1,
|
|
1579
|
-
floorEnabled: !0,
|
|
1580
|
-
floorColor: 16777215
|
|
1581
|
-
}), n.performAction("SET_CAMERA_TRANSFORM", {
|
|
1582
|
-
position: { x: 0, y: 2, z: 2 },
|
|
1583
|
-
target: { x: 0, y: 0.5, z: 0 }
|
|
1584
|
-
});
|
|
1585
|
-
const o = C.generateUUID();
|
|
1586
|
-
n.performAction("ADD_OBJECT", {
|
|
1587
|
-
entityType: "light",
|
|
1588
|
-
type: "scene",
|
|
1589
|
-
name: "light",
|
|
1590
|
-
id: o,
|
|
1591
|
-
enabled: !0,
|
|
1592
|
-
visible: !0,
|
|
1593
|
-
intensity: (t == null ? void 0 : t.lightIntensity) ?? 1,
|
|
1594
|
-
color: 16777215
|
|
1595
|
-
});
|
|
1596
|
-
const h = C.generateUUID();
|
|
1597
|
-
return new Promise((l) => {
|
|
1598
|
-
n.subscribe("MODEL_LOADED", (p) => {
|
|
1599
|
-
if (p.id !== h) return;
|
|
1600
|
-
const f = n.performAction(
|
|
1601
|
-
"COMPUTE_ENCOMPASSING_VIEW"
|
|
1602
|
-
);
|
|
1603
|
-
n.performAction("SET_CAMERA_TRANSFORM", {
|
|
1604
|
-
position: f.position,
|
|
1605
|
-
target: f.target
|
|
1606
|
-
}), l(e);
|
|
1607
|
-
}), n.performAction("ADD_OBJECT", {
|
|
1608
|
-
entityType: "model",
|
|
1609
|
-
name: "object",
|
|
1610
|
-
id: h,
|
|
1611
|
-
position: { x: 0, y: 0, z: 0 },
|
|
1612
|
-
rotation: { x: 0, y: 0, z: 0 },
|
|
1613
|
-
scale: { x: 1, y: 1, z: 1 },
|
|
1614
|
-
uri: s,
|
|
1615
|
-
visible: !0,
|
|
1616
|
-
loaded: !1
|
|
1617
|
-
});
|
|
1618
|
-
});
|
|
1564
|
+
const e = new it(t);
|
|
1565
|
+
window.DIVE.instances.push(e), e.engine.scene.background = new D(16777215), e.engine.scene.grid.setVisibility(!1), e.engine.scene.root.floor.setVisibility(!1), e.engine.scene.root.floor.setColor(16777215), e.engine.camera.position.set(0, 2, 2), e.orbitController.target.set(0, 0.5, 0);
|
|
1566
|
+
const n = new Je();
|
|
1567
|
+
n.name = "SceneLight", n.userData.id = C.generateUUID(), n.setEnabled(!0), n.visible = !0, n.setIntensity((t == null ? void 0 : t.lightIntensity) ?? 1), n.setColor(new D(16777215)), e.engine.scene.root.add(n);
|
|
1568
|
+
const o = new $e();
|
|
1569
|
+
o.name = "object", o.userData.id = C.generateUUID(), o.userData.uri = s, o.visible = !0, e.engine.scene.root.add(o), await o.setFromURL(s);
|
|
1570
|
+
const c = e.engine.scene.computeSceneBB(), l = e.orbitController.computeEncompassingView(c);
|
|
1571
|
+
return e.engine.camera.position.copy(l.position), e.orbitController.target.copy(l.target), e;
|
|
1619
1572
|
}
|
|
1620
1573
|
get engine() {
|
|
1621
1574
|
return this._engine;
|
|
@@ -1627,7 +1580,7 @@ class Qe {
|
|
|
1627
1580
|
this._engine.setCanvas(s), this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.orbitController = new ne(
|
|
1628
1581
|
this._engine.camera,
|
|
1629
1582
|
s,
|
|
1630
|
-
this._settings
|
|
1583
|
+
this._settings
|
|
1631
1584
|
), this._engine.clock.addTicker(this.orbitController);
|
|
1632
1585
|
}
|
|
1633
1586
|
async Dispose() {
|
|
@@ -1636,23 +1589,23 @@ class Qe {
|
|
|
1636
1589
|
});
|
|
1637
1590
|
}
|
|
1638
1591
|
}
|
|
1639
|
-
const We = (
|
|
1640
|
-
if (Object.keys(
|
|
1592
|
+
const We = (h, s) => {
|
|
1593
|
+
if (Object.keys(h).length === 0 && Object.keys(s).length === 0)
|
|
1641
1594
|
return {};
|
|
1642
|
-
if (typeof
|
|
1595
|
+
if (typeof h != "object" || typeof s != "object")
|
|
1643
1596
|
return s;
|
|
1644
1597
|
let t = {};
|
|
1645
1598
|
return Object.keys(s).forEach((e) => {
|
|
1646
|
-
if (!Object.keys(
|
|
1599
|
+
if (!Object.keys(h).includes(e)) {
|
|
1647
1600
|
t = { ...t, [e]: s[e] };
|
|
1648
1601
|
return;
|
|
1649
1602
|
}
|
|
1650
1603
|
if (Array.isArray(s[e])) {
|
|
1651
|
-
if (!Array.isArray(
|
|
1604
|
+
if (!Array.isArray(h[e])) {
|
|
1652
1605
|
t = { ...t, [e]: s[e] };
|
|
1653
1606
|
return;
|
|
1654
1607
|
}
|
|
1655
|
-
const n =
|
|
1608
|
+
const n = h[e], o = s[e];
|
|
1656
1609
|
if (n.length === 0 && o.length === 0) {
|
|
1657
1610
|
t = { ...t };
|
|
1658
1611
|
return;
|
|
@@ -1661,26 +1614,26 @@ const We = (c, s) => {
|
|
|
1661
1614
|
t = { ...t, [e]: s[e] };
|
|
1662
1615
|
return;
|
|
1663
1616
|
}
|
|
1664
|
-
const
|
|
1617
|
+
const c = [];
|
|
1665
1618
|
if (o.forEach((l, p) => {
|
|
1666
1619
|
const f = We(
|
|
1667
1620
|
n[p],
|
|
1668
1621
|
o[p]
|
|
1669
1622
|
);
|
|
1670
|
-
Object.keys(f).length &&
|
|
1671
|
-
}), Object.keys(
|
|
1672
|
-
t = { ...t, [e]:
|
|
1623
|
+
Object.keys(f).length && c.push(o[p]);
|
|
1624
|
+
}), Object.keys(c).length) {
|
|
1625
|
+
t = { ...t, [e]: c };
|
|
1673
1626
|
return;
|
|
1674
1627
|
}
|
|
1675
1628
|
return;
|
|
1676
1629
|
}
|
|
1677
1630
|
if (typeof s[e] == "object") {
|
|
1678
|
-
if (typeof
|
|
1631
|
+
if (typeof h[e] != "object") {
|
|
1679
1632
|
t = { ...t, [e]: s[e] };
|
|
1680
1633
|
return;
|
|
1681
1634
|
}
|
|
1682
1635
|
const n = We(
|
|
1683
|
-
|
|
1636
|
+
h[e],
|
|
1684
1637
|
s[e]
|
|
1685
1638
|
);
|
|
1686
1639
|
if (Object.keys(n).length) {
|
|
@@ -1688,70 +1641,23 @@ const We = (c, s) => {
|
|
|
1688
1641
|
return;
|
|
1689
1642
|
}
|
|
1690
1643
|
}
|
|
1691
|
-
|
|
1644
|
+
h[e] !== s[e] && (t = { ...t, [e]: s[e] });
|
|
1692
1645
|
}), t;
|
|
1693
1646
|
};
|
|
1694
|
-
function D(c, s) {
|
|
1695
|
-
const t = (c + "e").split("e");
|
|
1696
|
-
return +(t[0] + "e" + (+t[1] + (s || 0)));
|
|
1697
|
-
}
|
|
1698
|
-
function wi(c, s = 0) {
|
|
1699
|
-
const t = D(c, +s);
|
|
1700
|
-
return D(Math.ceil(t), -s);
|
|
1701
|
-
}
|
|
1702
|
-
function Di(c, s = 0) {
|
|
1703
|
-
const t = D(c, +s);
|
|
1704
|
-
return D(Math.floor(t), -s);
|
|
1705
|
-
}
|
|
1706
|
-
function et(c, s = 0) {
|
|
1707
|
-
if (c < 0) return -et(-c, s);
|
|
1708
|
-
const t = D(c, +s);
|
|
1709
|
-
return D(Math.round(t), -s);
|
|
1710
|
-
}
|
|
1711
|
-
function Si(c, s, t) {
|
|
1712
|
-
return Math.atan2(
|
|
1713
|
-
c.clone().cross(s).dot(t),
|
|
1714
|
-
s.clone().dot(c)
|
|
1715
|
-
);
|
|
1716
|
-
}
|
|
1717
|
-
function Oi(c, s = 0) {
|
|
1718
|
-
const t = D(c, +s);
|
|
1719
|
-
return D(Math.round(t), -s).toFixed(s);
|
|
1720
|
-
}
|
|
1721
|
-
function Ti(c, s = 0) {
|
|
1722
|
-
const t = D(c, +s);
|
|
1723
|
-
return D(Math.trunc(t), -s);
|
|
1724
|
-
}
|
|
1725
|
-
function xi(c) {
|
|
1726
|
-
return (C.radToDeg(c) + 360) % 360;
|
|
1727
|
-
}
|
|
1728
|
-
function Pi(c) {
|
|
1729
|
-
return C.degToRad(c);
|
|
1730
|
-
}
|
|
1731
|
-
const Vi = {
|
|
1732
|
-
ceilExp: wi,
|
|
1733
|
-
floorExp: Di,
|
|
1734
|
-
roundExp: et,
|
|
1735
|
-
toFixedExp: Oi,
|
|
1736
|
-
truncateExp: Ti,
|
|
1737
|
-
signedAngleTo: Si,
|
|
1738
|
-
radToDeg: xi,
|
|
1739
|
-
degToRad: Pi
|
|
1740
|
-
};
|
|
1741
1647
|
export {
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1648
|
+
it as DIVE,
|
|
1649
|
+
Pi as DIVEDefaultSettings,
|
|
1650
|
+
Bi as DIVEMath,
|
|
1745
1651
|
Zi as ESystem,
|
|
1746
1652
|
Xi as EWebXRUnsupportedReason,
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1653
|
+
Gi as FILE_TYPES,
|
|
1654
|
+
ji as SUPPORTED_FILE_TYPES,
|
|
1655
|
+
ai as applyMixins,
|
|
1656
|
+
Fi as findInterface,
|
|
1751
1657
|
ge as findSceneRecursive,
|
|
1752
1658
|
Hi as getFileTypeFromUri,
|
|
1753
|
-
|
|
1659
|
+
w as getModule,
|
|
1754
1660
|
We as getObjectDelta,
|
|
1755
|
-
|
|
1661
|
+
Yi as implementsInterface,
|
|
1756
1662
|
Wi as isFileTypeSupported
|
|
1757
1663
|
};
|