@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.
Files changed (92) hide show
  1. package/README.md +7 -9
  2. package/build/chunks/AssetCache-CiC4wZkh.mjs +79 -0
  3. package/build/chunks/AssetCache-CuVztq_7.cjs +1 -0
  4. package/build/chunks/{AssetExporter-Ds2dAfxL.cjs → AssetExporter-DsbC2rqv.cjs} +18 -18
  5. package/build/chunks/{AssetExporter-CcSkkmZL.mjs → AssetExporter-brT7ogoM.mjs} +3 -4
  6. package/build/chunks/AssetLoader-DUhBw4FF.cjs +4 -0
  7. package/build/chunks/{AssetLoader-DjHz5xWK.mjs → AssetLoader-o_4syRGj.mjs} +32 -26
  8. package/build/chunks/FileTypes-B2VTJIm5.cjs +30 -0
  9. package/build/chunks/{FileTypes-Cu4s3c_0.mjs → FileTypes-C8pTXmiC.mjs} +155 -205
  10. package/build/chunks/OrbitController-BQ6SV1O_.mjs +1159 -0
  11. package/build/chunks/OrbitController-CpFQ3A1H.cjs +1 -0
  12. package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
  13. package/build/chunks/PerspectiveCamera-PMJPzAn3.mjs +34 -0
  14. package/build/chunks/{SelectTool-w7sF1obN.mjs → SelectTool-6ZRGPwYE.mjs} +4 -4
  15. package/build/chunks/SelectTool-B1awJ9PA.cjs +1 -0
  16. package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
  17. package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
  18. package/build/chunks/package-AmvzOXm_.cjs +1 -0
  19. package/build/chunks/package-BrpVRfq7.mjs +39 -0
  20. package/build/chunks/parse-error-DfOPyLWM.mjs +14 -0
  21. package/build/chunks/parse-error-Dy_EE4rL.cjs +1 -0
  22. package/build/dive.cjs +1 -1
  23. package/build/dive.mjs +293 -223
  24. package/build/plugins/ar/index.cjs +1 -1
  25. package/build/plugins/ar/index.mjs +2 -2
  26. package/build/plugins/assetcache/index.cjs +1 -1
  27. package/build/plugins/assetcache/index.mjs +1 -1
  28. package/build/plugins/assetexporter/index.cjs +1 -1
  29. package/build/plugins/assetexporter/index.mjs +1 -1
  30. package/build/plugins/assetloader/index.cjs +1 -1
  31. package/build/plugins/assetloader/index.mjs +1 -1
  32. package/build/plugins/mediacreator/index.cjs +1 -1
  33. package/build/plugins/mediacreator/index.mjs +13 -13
  34. package/build/plugins/orbitcontroller/index.cjs +1 -1
  35. package/build/plugins/orbitcontroller/index.mjs +1 -1
  36. package/build/plugins/orientationdisplay/index.cjs +1 -0
  37. package/build/plugins/orientationdisplay/index.d.ts +2 -0
  38. package/build/plugins/orientationdisplay/index.mjs +5 -0
  39. package/build/plugins/state/index.cjs +6 -6
  40. package/build/plugins/state/index.mjs +728 -728
  41. package/build/plugins/toolbox/index.cjs +1 -1
  42. package/build/plugins/toolbox/index.mjs +12 -12
  43. package/build/src/components/boundingbox/BoundingBox.d.ts +136 -0
  44. package/build/src/components/light/AmbientLight.d.ts +3 -1
  45. package/build/src/components/light/SceneLight.d.ts +3 -1
  46. package/build/src/core/Dive.d.ts +1 -1
  47. package/build/src/helpers/deepClone/deepClone.d.ts +34 -0
  48. package/build/src/helpers/index.d.ts +5 -4
  49. package/build/src/plugins/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +2 -2
  50. package/build/src/plugins/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +2 -2
  51. package/build/src/plugins/assetcache/src/cache/AssetCache.d.ts +5 -4
  52. package/build/src/plugins/assetcache/src/chunk/Chunk.d.ts +4 -7
  53. package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +7 -0
  54. package/build/src/plugins/mediacreator/index.d.ts +1 -0
  55. package/build/src/plugins/mediacreator/src/MediaCreator.d.ts +2 -2
  56. package/build/src/plugins/mediacreator/types/MediaGenerationById.d.ts +5 -0
  57. package/build/src/plugins/mediacreator/types/MediaGenerationByPosition.d.ts +7 -0
  58. package/build/src/plugins/mediacreator/types/MediaGenerationResolution.d.ts +4 -0
  59. package/build/src/plugins/mediacreator/types/index.d.ts +3 -0
  60. package/build/src/plugins/orbitcontroller/src/OrbitController.d.ts +17 -2
  61. package/build/src/plugins/orientationdisplay/index.d.ts +2 -0
  62. package/build/src/plugins/{axiscamera/src/AxisCamera.d.ts → orientationdisplay/src/OrientationDisplay.d.ts} +5 -5
  63. package/build/src/plugins/orientationdisplay/src/axes/Axes.d.ts +6 -0
  64. package/build/src/plugins/state/src/actions/action.d.ts +4 -4
  65. package/build/src/plugins/state/src/actions/media/generatemedia.d.ts +2 -18
  66. package/build/src/plugins/state/src/actions/toolbox/setgizmovisible.d.ts +2 -2
  67. package/build/src/plugins/state/types/index.d.ts +2 -0
  68. package/build/src/plugins/toolbox/index.d.ts +1 -0
  69. package/build/src/plugins/toolbox/src/Toolbox.d.ts +2 -2
  70. package/build/src/plugins/toolbox/src/transform/TransformTool.d.ts +1 -1
  71. package/build/src/plugins/toolbox/types/ToolType.d.ts +1 -0
  72. package/build/src/plugins/toolbox/types/index.d.ts +1 -0
  73. package/package.json +7 -9
  74. package/build/chunks/AssetCache-CWeKL4PT.cjs +0 -1
  75. package/build/chunks/AssetCache-Y5G3mQU1.mjs +0 -84
  76. package/build/chunks/AssetLoader-CMKzMJ1u.cjs +0 -4
  77. package/build/chunks/FileTypes-CKOjpHjz.cjs +0 -30
  78. package/build/chunks/OrbitController-D-WNei2f.mjs +0 -940
  79. package/build/chunks/OrbitController-rMX8EHvJ.cjs +0 -1
  80. package/build/chunks/PerspectiveCamera-CONx93im.cjs +0 -1
  81. package/build/chunks/PerspectiveCamera-DUiWJJIj.mjs +0 -38
  82. package/build/chunks/SelectTool-BD6Ccy_2.cjs +0 -1
  83. package/build/chunks/file-type-error-BsK7IJt7.cjs +0 -1
  84. package/build/chunks/file-type-error-aWHfMumr.mjs +0 -8
  85. package/build/chunks/package-DXbIn_zz.mjs +0 -39
  86. package/build/chunks/package-DaKgG9tF.cjs +0 -1
  87. package/build/chunks/parse-error-IryNa_oq.mjs +0 -8
  88. package/build/chunks/parse-error-m5cNt1UV.cjs +0 -1
  89. package/build/plugins/axiscamera/index.cjs +0 -1
  90. package/build/plugins/axiscamera/index.d.ts +0 -2
  91. package/build/plugins/axiscamera/index.mjs +0 -4
  92. package/build/src/plugins/axiscamera/index.d.ts +0 -1
@@ -1,940 +0,0 @@
1
- var ee = Object.defineProperty;
2
- var ie = (L, t, s) => t in L ? ee(L, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : L[t] = s;
3
- var G = (L, t, s) => ie(L, typeof t != "symbol" ? t + "" : t, s);
4
- import { Ray as se, Plane as ne, MathUtils as oe, EventDispatcher as ae, Vector3 as M, MOUSE as Y, TOUCH as F, Spherical as St, Quaternion as Dt, Vector2 as P } from "three";
5
- import { c as Rt, M as nt } from "./MathUtils-CFGjHuVF.mjs";
6
- const At = { type: "change" }, ot = { type: "start" }, kt = { type: "end" }, $ = new se(), jt = new ne(), re = Math.cos(70 * oe.DEG2RAD);
7
- class he extends ae {
8
- constructor(t, s) {
9
- super(), this.object = t, this.domElement = s, 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: Y.ROTATE, MIDDLE: Y.DOLLY, RIGHT: Y.PAN }, this.touches = { ONE: F.ROTATE, TWO: F.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() {
10
- return a.phi;
11
- }, this.getAzimuthalAngle = function() {
12
- return a.theta;
13
- }, this.getDistance = function() {
14
- return this.object.position.distanceTo(this.target);
15
- }, this.listenToKeyEvents = function(i) {
16
- i.addEventListener("keydown", st), this._domElementKeyEvents = i;
17
- }, this.stopListenToKeyEvents = function() {
18
- this._domElementKeyEvents.removeEventListener("keydown", st), this._domElementKeyEvents = null;
19
- }, this.saveState = function() {
20
- e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom;
21
- }, this.reset = function() {
22
- e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(At), e.update(), o = n.NONE;
23
- }, this.update = function() {
24
- const i = new M(), r = new Dt().setFromUnitVectors(t.up, new M(0, 1, 0)), x = r.clone().invert(), _ = new M(), g = new Dt(), j = new M(), E = 2 * Math.PI;
25
- return function(te = null) {
26
- const Pt = e.object.position;
27
- i.copy(Pt).sub(e.target), i.applyQuaternion(r), a.setFromVector3(i), e.autoRotate && o === n.NONE && X(Nt(te)), e.enableDamping ? (a.theta += y.theta * e.dampingFactor, a.phi += y.phi * e.dampingFactor) : (a.theta += y.theta, a.phi += y.phi);
28
- let D = e.minAzimuthAngle, A = e.maxAzimuthAngle;
29
- isFinite(D) && isFinite(A) && (D < -Math.PI ? D += E : D > Math.PI && (D -= E), A < -Math.PI ? A += E : A > Math.PI && (A -= E), D <= A ? a.theta = Math.max(D, Math.min(A, a.theta)) : a.theta = a.theta > (D + A) / 2 ? Math.max(D, a.theta) : Math.min(A, a.theta)), a.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, a.phi)), a.makeSafe(), e.enableDamping === !0 ? e.target.addScaledVector(l, e.dampingFactor) : e.target.add(l), e.target.sub(e.cursor), e.target.clampLength(e.minTargetRadius, e.maxTargetRadius), e.target.add(e.cursor);
30
- let U = !1;
31
- if (e.zoomToCursor && R || e.object.isOrthographicCamera)
32
- a.radius = et(a.radius);
33
- else {
34
- const k = a.radius;
35
- a.radius = et(a.radius * c), U = k != a.radius;
36
- }
37
- if (i.setFromSpherical(a), i.applyQuaternion(x), Pt.copy(e.target).add(i), e.object.lookAt(e.target), e.enableDamping === !0 ? (y.theta *= 1 - e.dampingFactor, y.phi *= 1 - e.dampingFactor, l.multiplyScalar(1 - e.dampingFactor)) : (y.set(0, 0, 0), l.set(0, 0, 0)), e.zoomToCursor && R) {
38
- let k = null;
39
- if (e.object.isPerspectiveCamera) {
40
- const K = i.length();
41
- k = et(K * c);
42
- const B = K - k;
43
- e.object.position.addScaledVector(O, B), e.object.updateMatrixWorld(), U = !!B;
44
- } else if (e.object.isOrthographicCamera) {
45
- const K = new M(z.x, z.y, 0);
46
- K.unproject(e.object);
47
- const B = e.object.zoom;
48
- e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / c)), e.object.updateProjectionMatrix(), U = B !== e.object.zoom;
49
- const Ct = new M(z.x, z.y, 0);
50
- Ct.unproject(e.object), e.object.position.sub(Ct).add(K), e.object.updateMatrixWorld(), k = i.length();
51
- } else
52
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), e.zoomToCursor = !1;
53
- k !== null && (this.screenSpacePanning ? e.target.set(0, 0, -1).transformDirection(e.object.matrix).multiplyScalar(k).add(e.object.position) : ($.origin.copy(e.object.position), $.direction.set(0, 0, -1).transformDirection(e.object.matrix), Math.abs(e.object.up.dot($.direction)) < re ? t.lookAt(e.target) : (jt.setFromNormalAndCoplanarPoint(e.object.up, e.target), $.intersectPlane(jt, e.target))));
54
- } else if (e.object.isOrthographicCamera) {
55
- const k = e.object.zoom;
56
- e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / c)), k !== e.object.zoom && (e.object.updateProjectionMatrix(), U = !0);
57
- }
58
- return c = 1, R = !1, U || _.distanceToSquared(e.object.position) > p || 8 * (1 - g.dot(e.object.quaternion)) > p || j.distanceToSquared(e.target) > p ? (e.dispatchEvent(At), _.copy(e.object.position), g.copy(e.object.quaternion), j.copy(e.target), !0) : !1;
59
- };
60
- }(), this.dispose = function() {
61
- e.domElement.removeEventListener("contextmenu", Et), e.domElement.removeEventListener("pointerdown", ft), e.domElement.removeEventListener("pointercancel", H), e.domElement.removeEventListener("wheel", gt), e.domElement.removeEventListener("pointermove", it), e.domElement.removeEventListener("pointerup", H), e.domElement.getRootNode().removeEventListener("keydown", bt, { capture: !0 }), e._domElementKeyEvents !== null && (e._domElementKeyEvents.removeEventListener("keydown", st), e._domElementKeyEvents = null);
62
- };
63
- const e = this, n = {
64
- NONE: -1,
65
- ROTATE: 0,
66
- DOLLY: 1,
67
- PAN: 2,
68
- TOUCH_ROTATE: 3,
69
- TOUCH_PAN: 4,
70
- TOUCH_DOLLY_PAN: 5,
71
- TOUCH_DOLLY_ROTATE: 6
72
- };
73
- let o = n.NONE;
74
- const p = 1e-6, a = new St(), y = new St();
75
- let c = 1;
76
- const l = new M(), u = new P(), m = new P(), h = new P(), d = new P(), w = new P(), b = new P(), T = new P(), S = new P(), C = new P(), O = new M(), z = new P();
77
- let R = !1;
78
- const f = [], Z = {};
79
- let J = !1;
80
- function Nt(i) {
81
- return i !== null ? 2 * Math.PI / 60 * e.autoRotateSpeed * i : 2 * Math.PI / 60 / 60 * e.autoRotateSpeed;
82
- }
83
- function Q(i) {
84
- const r = Math.abs(i * 0.01);
85
- return Math.pow(0.95, e.zoomSpeed * r);
86
- }
87
- function X(i) {
88
- y.theta -= i;
89
- }
90
- function W(i) {
91
- y.phi -= i;
92
- }
93
- const ht = function() {
94
- const i = new M();
95
- return function(x, _) {
96
- i.setFromMatrixColumn(_, 0), i.multiplyScalar(-x), l.add(i);
97
- };
98
- }(), ct = function() {
99
- const i = new M();
100
- return function(x, _) {
101
- e.screenSpacePanning === !0 ? i.setFromMatrixColumn(_, 1) : (i.setFromMatrixColumn(_, 0), i.crossVectors(e.object.up, i)), i.multiplyScalar(x), l.add(i);
102
- };
103
- }(), N = function() {
104
- const i = new M();
105
- return function(x, _) {
106
- const g = e.domElement;
107
- if (e.object.isPerspectiveCamera) {
108
- const j = e.object.position;
109
- i.copy(j).sub(e.target);
110
- let E = i.length();
111
- E *= Math.tan(e.object.fov / 2 * Math.PI / 180), ht(2 * x * E / g.clientHeight, e.object.matrix), ct(2 * _ * E / g.clientHeight, e.object.matrix);
112
- } else e.object.isOrthographicCamera ? (ht(x * (e.object.right - e.object.left) / e.object.zoom / g.clientWidth, e.object.matrix), ct(_ * (e.object.top - e.object.bottom) / e.object.zoom / g.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1);
113
- };
114
- }();
115
- function v(i) {
116
- e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? c /= i : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
117
- }
118
- function lt(i) {
119
- e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? c *= i : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
120
- }
121
- function tt(i, r) {
122
- if (!e.zoomToCursor)
123
- return;
124
- R = !0;
125
- const x = e.domElement.getBoundingClientRect(), _ = i - x.left, g = r - x.top, j = x.width, E = x.height;
126
- z.x = _ / j * 2 - 1, z.y = -(g / E) * 2 + 1, O.set(z.x, z.y, 1).unproject(e.object).sub(e.object.position).normalize();
127
- }
128
- function et(i) {
129
- return Math.max(e.minDistance, Math.min(e.maxDistance, i));
130
- }
131
- function ut(i) {
132
- u.set(i.clientX, i.clientY);
133
- }
134
- function It(i) {
135
- tt(i.clientX, i.clientX), T.set(i.clientX, i.clientY);
136
- }
137
- function mt(i) {
138
- d.set(i.clientX, i.clientY);
139
- }
140
- function Yt(i) {
141
- m.set(i.clientX, i.clientY), h.subVectors(m, u).multiplyScalar(e.rotateSpeed);
142
- const r = e.domElement;
143
- X(2 * Math.PI * h.x / r.clientHeight), W(2 * Math.PI * h.y / r.clientHeight), u.copy(m), e.update();
144
- }
145
- function Ft(i) {
146
- S.set(i.clientX, i.clientY), C.subVectors(S, T), C.y > 0 ? v(Q(C.y)) : C.y < 0 && lt(Q(C.y)), T.copy(S), e.update();
147
- }
148
- function Zt(i) {
149
- w.set(i.clientX, i.clientY), b.subVectors(w, d).multiplyScalar(e.panSpeed), N(b.x, b.y), d.copy(w), e.update();
150
- }
151
- function Xt(i) {
152
- tt(i.clientX, i.clientY), i.deltaY < 0 ? lt(Q(i.deltaY)) : i.deltaY > 0 && v(Q(i.deltaY)), e.update();
153
- }
154
- function Ht(i) {
155
- let r = !1;
156
- switch (i.code) {
157
- case e.keys.UP:
158
- i.ctrlKey || i.metaKey || i.shiftKey ? W(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(0, e.keyPanSpeed), r = !0;
159
- break;
160
- case e.keys.BOTTOM:
161
- i.ctrlKey || i.metaKey || i.shiftKey ? W(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(0, -e.keyPanSpeed), r = !0;
162
- break;
163
- case e.keys.LEFT:
164
- i.ctrlKey || i.metaKey || i.shiftKey ? X(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(e.keyPanSpeed, 0), r = !0;
165
- break;
166
- case e.keys.RIGHT:
167
- i.ctrlKey || i.metaKey || i.shiftKey ? X(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(-e.keyPanSpeed, 0), r = !0;
168
- break;
169
- }
170
- r && (i.preventDefault(), e.update());
171
- }
172
- function yt(i) {
173
- if (f.length === 1)
174
- u.set(i.pageX, i.pageY);
175
- else {
176
- const r = I(i), x = 0.5 * (i.pageX + r.x), _ = 0.5 * (i.pageY + r.y);
177
- u.set(x, _);
178
- }
179
- }
180
- function pt(i) {
181
- if (f.length === 1)
182
- d.set(i.pageX, i.pageY);
183
- else {
184
- const r = I(i), x = 0.5 * (i.pageX + r.x), _ = 0.5 * (i.pageY + r.y);
185
- d.set(x, _);
186
- }
187
- }
188
- function dt(i) {
189
- const r = I(i), x = i.pageX - r.x, _ = i.pageY - r.y, g = Math.sqrt(x * x + _ * _);
190
- T.set(0, g);
191
- }
192
- function Ut(i) {
193
- e.enableZoom && dt(i), e.enablePan && pt(i);
194
- }
195
- function Kt(i) {
196
- e.enableZoom && dt(i), e.enableRotate && yt(i);
197
- }
198
- function xt(i) {
199
- if (f.length == 1)
200
- m.set(i.pageX, i.pageY);
201
- else {
202
- const x = I(i), _ = 0.5 * (i.pageX + x.x), g = 0.5 * (i.pageY + x.y);
203
- m.set(_, g);
204
- }
205
- h.subVectors(m, u).multiplyScalar(e.rotateSpeed);
206
- const r = e.domElement;
207
- X(2 * Math.PI * h.x / r.clientHeight), W(2 * Math.PI * h.y / r.clientHeight), u.copy(m);
208
- }
209
- function _t(i) {
210
- if (f.length === 1)
211
- w.set(i.pageX, i.pageY);
212
- else {
213
- const r = I(i), x = 0.5 * (i.pageX + r.x), _ = 0.5 * (i.pageY + r.y);
214
- w.set(x, _);
215
- }
216
- b.subVectors(w, d).multiplyScalar(e.panSpeed), N(b.x, b.y), d.copy(w);
217
- }
218
- function zt(i) {
219
- const r = I(i), x = i.pageX - r.x, _ = i.pageY - r.y, g = Math.sqrt(x * x + _ * _);
220
- S.set(0, g), C.set(0, Math.pow(S.y / T.y, e.zoomSpeed)), v(C.y), T.copy(S);
221
- const j = (i.pageX + r.x) * 0.5, E = (i.pageY + r.y) * 0.5;
222
- tt(j, E);
223
- }
224
- function qt(i) {
225
- e.enableZoom && zt(i), e.enablePan && _t(i);
226
- }
227
- function Vt(i) {
228
- e.enableZoom && zt(i), e.enableRotate && xt(i);
229
- }
230
- function ft(i) {
231
- e.enabled !== !1 && (f.length === 0 && (e.domElement.setPointerCapture(i.pointerId), e.domElement.addEventListener("pointermove", it), e.domElement.addEventListener("pointerup", H)), !vt(i) && ($t(i), i.pointerType === "touch" ? wt(i) : Qt(i)));
232
- }
233
- function it(i) {
234
- e.enabled !== !1 && (i.pointerType === "touch" ? Gt(i) : Wt(i));
235
- }
236
- function H(i) {
237
- switch (Jt(i), f.length) {
238
- case 0:
239
- e.domElement.releasePointerCapture(i.pointerId), e.domElement.removeEventListener("pointermove", it), e.domElement.removeEventListener("pointerup", H), e.dispatchEvent(kt), o = n.NONE;
240
- break;
241
- case 1:
242
- const r = f[0], x = Z[r];
243
- wt({ pointerId: r, pageX: x.x, pageY: x.y });
244
- break;
245
- }
246
- }
247
- function Qt(i) {
248
- let r;
249
- switch (i.button) {
250
- case 0:
251
- r = e.mouseButtons.LEFT;
252
- break;
253
- case 1:
254
- r = e.mouseButtons.MIDDLE;
255
- break;
256
- case 2:
257
- r = e.mouseButtons.RIGHT;
258
- break;
259
- default:
260
- r = -1;
261
- }
262
- switch (r) {
263
- case Y.DOLLY:
264
- if (e.enableZoom === !1) return;
265
- It(i), o = n.DOLLY;
266
- break;
267
- case Y.ROTATE:
268
- if (i.ctrlKey || i.metaKey || i.shiftKey) {
269
- if (e.enablePan === !1) return;
270
- mt(i), o = n.PAN;
271
- } else {
272
- if (e.enableRotate === !1) return;
273
- ut(i), o = n.ROTATE;
274
- }
275
- break;
276
- case Y.PAN:
277
- if (i.ctrlKey || i.metaKey || i.shiftKey) {
278
- if (e.enableRotate === !1) return;
279
- ut(i), o = n.ROTATE;
280
- } else {
281
- if (e.enablePan === !1) return;
282
- mt(i), o = n.PAN;
283
- }
284
- break;
285
- default:
286
- o = n.NONE;
287
- }
288
- o !== n.NONE && e.dispatchEvent(ot);
289
- }
290
- function Wt(i) {
291
- switch (o) {
292
- case n.ROTATE:
293
- if (e.enableRotate === !1) return;
294
- Yt(i);
295
- break;
296
- case n.DOLLY:
297
- if (e.enableZoom === !1) return;
298
- Ft(i);
299
- break;
300
- case n.PAN:
301
- if (e.enablePan === !1) return;
302
- Zt(i);
303
- break;
304
- }
305
- }
306
- function gt(i) {
307
- e.enabled === !1 || e.enableZoom === !1 || o !== n.NONE || (i.preventDefault(), e.dispatchEvent(ot), Xt(Bt(i)), e.dispatchEvent(kt));
308
- }
309
- function Bt(i) {
310
- const r = i.deltaMode, x = {
311
- clientX: i.clientX,
312
- clientY: i.clientY,
313
- deltaY: i.deltaY
314
- };
315
- switch (r) {
316
- case 1:
317
- x.deltaY *= 16;
318
- break;
319
- case 2:
320
- x.deltaY *= 100;
321
- break;
322
- }
323
- return i.ctrlKey && !J && (x.deltaY *= 10), x;
324
- }
325
- function bt(i) {
326
- i.key === "Control" && (J = !0, e.domElement.getRootNode().addEventListener("keyup", Mt, { passive: !0, capture: !0 }));
327
- }
328
- function Mt(i) {
329
- i.key === "Control" && (J = !1, e.domElement.getRootNode().removeEventListener("keyup", Mt, { passive: !0, capture: !0 }));
330
- }
331
- function st(i) {
332
- e.enabled === !1 || e.enablePan === !1 || Ht(i);
333
- }
334
- function wt(i) {
335
- switch (Tt(i), f.length) {
336
- case 1:
337
- switch (e.touches.ONE) {
338
- case F.ROTATE:
339
- if (e.enableRotate === !1) return;
340
- yt(i), o = n.TOUCH_ROTATE;
341
- break;
342
- case F.PAN:
343
- if (e.enablePan === !1) return;
344
- pt(i), o = n.TOUCH_PAN;
345
- break;
346
- default:
347
- o = n.NONE;
348
- }
349
- break;
350
- case 2:
351
- switch (e.touches.TWO) {
352
- case F.DOLLY_PAN:
353
- if (e.enableZoom === !1 && e.enablePan === !1) return;
354
- Ut(i), o = n.TOUCH_DOLLY_PAN;
355
- break;
356
- case F.DOLLY_ROTATE:
357
- if (e.enableZoom === !1 && e.enableRotate === !1) return;
358
- Kt(i), o = n.TOUCH_DOLLY_ROTATE;
359
- break;
360
- default:
361
- o = n.NONE;
362
- }
363
- break;
364
- default:
365
- o = n.NONE;
366
- }
367
- o !== n.NONE && e.dispatchEvent(ot);
368
- }
369
- function Gt(i) {
370
- switch (Tt(i), o) {
371
- case n.TOUCH_ROTATE:
372
- if (e.enableRotate === !1) return;
373
- xt(i), e.update();
374
- break;
375
- case n.TOUCH_PAN:
376
- if (e.enablePan === !1) return;
377
- _t(i), e.update();
378
- break;
379
- case n.TOUCH_DOLLY_PAN:
380
- if (e.enableZoom === !1 && e.enablePan === !1) return;
381
- qt(i), e.update();
382
- break;
383
- case n.TOUCH_DOLLY_ROTATE:
384
- if (e.enableZoom === !1 && e.enableRotate === !1) return;
385
- Vt(i), e.update();
386
- break;
387
- default:
388
- o = n.NONE;
389
- }
390
- }
391
- function Et(i) {
392
- e.enabled !== !1 && i.preventDefault();
393
- }
394
- function $t(i) {
395
- f.push(i.pointerId);
396
- }
397
- function Jt(i) {
398
- delete Z[i.pointerId];
399
- for (let r = 0; r < f.length; r++)
400
- if (f[r] == i.pointerId) {
401
- f.splice(r, 1);
402
- return;
403
- }
404
- }
405
- function vt(i) {
406
- for (let r = 0; r < f.length; r++)
407
- if (f[r] == i.pointerId) return !0;
408
- return !1;
409
- }
410
- function Tt(i) {
411
- let r = Z[i.pointerId];
412
- r === void 0 && (r = new P(), Z[i.pointerId] = r), r.set(i.pageX, i.pageY);
413
- }
414
- function I(i) {
415
- const r = i.pointerId === f[0] ? f[1] : f[0];
416
- return Z[r];
417
- }
418
- e.domElement.addEventListener("contextmenu", Et), e.domElement.addEventListener("pointerdown", ft), e.domElement.addEventListener("pointercancel", H), e.domElement.addEventListener("wheel", gt, { passive: !1 }), e.domElement.getRootNode().addEventListener("keydown", bt, { passive: !0, capture: !0 }), this.update();
419
- }
420
- }
421
- class ce {
422
- constructor(t = 0, s = 0, e = 0, n = 1) {
423
- this.isQuaternion = !0, this._x = t, this._y = s, this._z = e, this._w = n;
424
- }
425
- static slerpFlat(t, s, e, n, o, p, a) {
426
- let y = e[n + 0], c = e[n + 1], l = e[n + 2], u = e[n + 3];
427
- const m = o[p + 0], h = o[p + 1], d = o[p + 2], w = o[p + 3];
428
- if (a === 0) {
429
- t[s + 0] = y, t[s + 1] = c, t[s + 2] = l, t[s + 3] = u;
430
- return;
431
- }
432
- if (a === 1) {
433
- t[s + 0] = m, t[s + 1] = h, t[s + 2] = d, t[s + 3] = w;
434
- return;
435
- }
436
- if (u !== w || y !== m || c !== h || l !== d) {
437
- let b = 1 - a;
438
- const T = y * m + c * h + l * d + u * w, S = T >= 0 ? 1 : -1, C = 1 - T * T;
439
- if (C > Number.EPSILON) {
440
- const z = Math.sqrt(C), R = Math.atan2(z, T * S);
441
- b = Math.sin(b * R) / z, a = Math.sin(a * R) / z;
442
- }
443
- const O = a * S;
444
- if (y = y * b + m * O, c = c * b + h * O, l = l * b + d * O, u = u * b + w * O, b === 1 - a) {
445
- const z = 1 / Math.sqrt(y * y + c * c + l * l + u * u);
446
- y *= z, c *= z, l *= z, u *= z;
447
- }
448
- }
449
- t[s] = y, t[s + 1] = c, t[s + 2] = l, t[s + 3] = u;
450
- }
451
- static multiplyQuaternionsFlat(t, s, e, n, o, p) {
452
- const a = e[n], y = e[n + 1], c = e[n + 2], l = e[n + 3], u = o[p], m = o[p + 1], h = o[p + 2], d = o[p + 3];
453
- return t[s] = a * d + l * u + y * h - c * m, t[s + 1] = y * d + l * m + c * u - a * h, t[s + 2] = c * d + l * h + a * m - y * u, t[s + 3] = l * d - a * u - y * m - c * h, t;
454
- }
455
- get x() {
456
- return this._x;
457
- }
458
- set x(t) {
459
- this._x = t, this._onChangeCallback();
460
- }
461
- get y() {
462
- return this._y;
463
- }
464
- set y(t) {
465
- this._y = t, this._onChangeCallback();
466
- }
467
- get z() {
468
- return this._z;
469
- }
470
- set z(t) {
471
- this._z = t, this._onChangeCallback();
472
- }
473
- get w() {
474
- return this._w;
475
- }
476
- set w(t) {
477
- this._w = t, this._onChangeCallback();
478
- }
479
- set(t, s, e, n) {
480
- return this._x = t, this._y = s, this._z = e, this._w = n, this._onChangeCallback(), this;
481
- }
482
- clone() {
483
- return new this.constructor(this._x, this._y, this._z, this._w);
484
- }
485
- copy(t) {
486
- return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
487
- }
488
- setFromEuler(t, s = !0) {
489
- const e = t._x, n = t._y, o = t._z, p = t._order, a = Math.cos, y = Math.sin, c = a(e / 2), l = a(n / 2), u = a(o / 2), m = y(e / 2), h = y(n / 2), d = y(o / 2);
490
- switch (p) {
491
- case "XYZ":
492
- this._x = m * l * u + c * h * d, this._y = c * h * u - m * l * d, this._z = c * l * d + m * h * u, this._w = c * l * u - m * h * d;
493
- break;
494
- case "YXZ":
495
- this._x = m * l * u + c * h * d, this._y = c * h * u - m * l * d, this._z = c * l * d - m * h * u, this._w = c * l * u + m * h * d;
496
- break;
497
- case "ZXY":
498
- this._x = m * l * u - c * h * d, this._y = c * h * u + m * l * d, this._z = c * l * d + m * h * u, this._w = c * l * u - m * h * d;
499
- break;
500
- case "ZYX":
501
- this._x = m * l * u - c * h * d, this._y = c * h * u + m * l * d, this._z = c * l * d - m * h * u, this._w = c * l * u + m * h * d;
502
- break;
503
- case "YZX":
504
- this._x = m * l * u + c * h * d, this._y = c * h * u + m * l * d, this._z = c * l * d - m * h * u, this._w = c * l * u - m * h * d;
505
- break;
506
- case "XZY":
507
- this._x = m * l * u - c * h * d, this._y = c * h * u - m * l * d, this._z = c * l * d + m * h * u, this._w = c * l * u + m * h * d;
508
- break;
509
- default:
510
- console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + p);
511
- }
512
- return s === !0 && this._onChangeCallback(), this;
513
- }
514
- setFromAxisAngle(t, s) {
515
- const e = s / 2, n = Math.sin(e);
516
- return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(e), this._onChangeCallback(), this;
517
- }
518
- setFromRotationMatrix(t) {
519
- const s = t.elements, e = s[0], n = s[4], o = s[8], p = s[1], a = s[5], y = s[9], c = s[2], l = s[6], u = s[10], m = e + a + u;
520
- if (m > 0) {
521
- const h = 0.5 / Math.sqrt(m + 1);
522
- this._w = 0.25 / h, this._x = (l - y) * h, this._y = (o - c) * h, this._z = (p - n) * h;
523
- } else if (e > a && e > u) {
524
- const h = 2 * Math.sqrt(1 + e - a - u);
525
- this._w = (l - y) / h, this._x = 0.25 * h, this._y = (n + p) / h, this._z = (o + c) / h;
526
- } else if (a > u) {
527
- const h = 2 * Math.sqrt(1 + a - e - u);
528
- this._w = (o - c) / h, this._x = (n + p) / h, this._y = 0.25 * h, this._z = (y + l) / h;
529
- } else {
530
- const h = 2 * Math.sqrt(1 + u - e - a);
531
- this._w = (p - n) / h, this._x = (o + c) / h, this._y = (y + l) / h, this._z = 0.25 * h;
532
- }
533
- return this._onChangeCallback(), this;
534
- }
535
- setFromUnitVectors(t, s) {
536
- let e = t.dot(s) + 1;
537
- return e < Number.EPSILON ? (e = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = e) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = e)) : (this._x = t.y * s.z - t.z * s.y, this._y = t.z * s.x - t.x * s.z, this._z = t.x * s.y - t.y * s.x, this._w = e), this.normalize();
538
- }
539
- angleTo(t) {
540
- return 2 * Math.acos(Math.abs(Rt(this.dot(t), -1, 1)));
541
- }
542
- rotateTowards(t, s) {
543
- const e = this.angleTo(t);
544
- if (e === 0) return this;
545
- const n = Math.min(1, s / e);
546
- return this.slerp(t, n), this;
547
- }
548
- identity() {
549
- return this.set(0, 0, 0, 1);
550
- }
551
- invert() {
552
- return this.conjugate();
553
- }
554
- conjugate() {
555
- return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;
556
- }
557
- dot(t) {
558
- return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w;
559
- }
560
- lengthSq() {
561
- return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
562
- }
563
- length() {
564
- return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
565
- }
566
- normalize() {
567
- let t = this.length();
568
- return t === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w = this._w * t), this._onChangeCallback(), this;
569
- }
570
- multiply(t) {
571
- return this.multiplyQuaternions(this, t);
572
- }
573
- premultiply(t) {
574
- return this.multiplyQuaternions(t, this);
575
- }
576
- multiplyQuaternions(t, s) {
577
- const e = t._x, n = t._y, o = t._z, p = t._w, a = s._x, y = s._y, c = s._z, l = s._w;
578
- return this._x = e * l + p * a + n * c - o * y, this._y = n * l + p * y + o * a - e * c, this._z = o * l + p * c + e * y - n * a, this._w = p * l - e * a - n * y - o * c, this._onChangeCallback(), this;
579
- }
580
- slerp(t, s) {
581
- if (s === 0) return this;
582
- if (s === 1) return this.copy(t);
583
- const e = this._x, n = this._y, o = this._z, p = this._w;
584
- let a = p * t._w + e * t._x + n * t._y + o * t._z;
585
- if (a < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, a = -a) : this.copy(t), a >= 1)
586
- return this._w = p, this._x = e, this._y = n, this._z = o, this;
587
- const y = 1 - a * a;
588
- if (y <= Number.EPSILON) {
589
- const h = 1 - s;
590
- return this._w = h * p + s * this._w, this._x = h * e + s * this._x, this._y = h * n + s * this._y, this._z = h * o + s * this._z, this.normalize(), this;
591
- }
592
- const c = Math.sqrt(y), l = Math.atan2(c, a), u = Math.sin((1 - s) * l) / c, m = Math.sin(s * l) / c;
593
- return this._w = p * u + this._w * m, this._x = e * u + this._x * m, this._y = n * u + this._y * m, this._z = o * u + this._z * m, this._onChangeCallback(), this;
594
- }
595
- slerpQuaternions(t, s, e) {
596
- return this.copy(t).slerp(s, e);
597
- }
598
- random() {
599
- const t = 2 * Math.PI * Math.random(), s = 2 * Math.PI * Math.random(), e = Math.random(), n = Math.sqrt(1 - e), o = Math.sqrt(e);
600
- return this.set(
601
- n * Math.sin(t),
602
- n * Math.cos(t),
603
- o * Math.sin(s),
604
- o * Math.cos(s)
605
- );
606
- }
607
- equals(t) {
608
- return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w;
609
- }
610
- fromArray(t, s = 0) {
611
- return this._x = t[s], this._y = t[s + 1], this._z = t[s + 2], this._w = t[s + 3], this._onChangeCallback(), this;
612
- }
613
- toArray(t = [], s = 0) {
614
- return t[s] = this._x, t[s + 1] = this._y, t[s + 2] = this._z, t[s + 3] = this._w, t;
615
- }
616
- fromBufferAttribute(t, s) {
617
- return this._x = t.getX(s), this._y = t.getY(s), this._z = t.getZ(s), this._w = t.getW(s), this._onChangeCallback(), this;
618
- }
619
- toJSON() {
620
- return this.toArray();
621
- }
622
- _onChange(t) {
623
- return this._onChangeCallback = t, this;
624
- }
625
- _onChangeCallback() {
626
- }
627
- *[Symbol.iterator]() {
628
- yield this._x, yield this._y, yield this._z, yield this._w;
629
- }
630
- }
631
- class V {
632
- constructor(t = 0, s = 0, e = 0) {
633
- V.prototype.isVector3 = !0, this.x = t, this.y = s, this.z = e;
634
- }
635
- set(t, s, e) {
636
- return e === void 0 && (e = this.z), this.x = t, this.y = s, this.z = e, this;
637
- }
638
- setScalar(t) {
639
- return this.x = t, this.y = t, this.z = t, this;
640
- }
641
- setX(t) {
642
- return this.x = t, this;
643
- }
644
- setY(t) {
645
- return this.y = t, this;
646
- }
647
- setZ(t) {
648
- return this.z = t, this;
649
- }
650
- setComponent(t, s) {
651
- switch (t) {
652
- case 0:
653
- this.x = s;
654
- break;
655
- case 1:
656
- this.y = s;
657
- break;
658
- case 2:
659
- this.z = s;
660
- break;
661
- default:
662
- throw new Error("index is out of range: " + t);
663
- }
664
- return this;
665
- }
666
- getComponent(t) {
667
- switch (t) {
668
- case 0:
669
- return this.x;
670
- case 1:
671
- return this.y;
672
- case 2:
673
- return this.z;
674
- default:
675
- throw new Error("index is out of range: " + t);
676
- }
677
- }
678
- clone() {
679
- return new this.constructor(this.x, this.y, this.z);
680
- }
681
- copy(t) {
682
- return this.x = t.x, this.y = t.y, this.z = t.z, this;
683
- }
684
- add(t) {
685
- return this.x += t.x, this.y += t.y, this.z += t.z, this;
686
- }
687
- addScalar(t) {
688
- return this.x += t, this.y += t, this.z += t, this;
689
- }
690
- addVectors(t, s) {
691
- return this.x = t.x + s.x, this.y = t.y + s.y, this.z = t.z + s.z, this;
692
- }
693
- addScaledVector(t, s) {
694
- return this.x += t.x * s, this.y += t.y * s, this.z += t.z * s, this;
695
- }
696
- sub(t) {
697
- return this.x -= t.x, this.y -= t.y, this.z -= t.z, this;
698
- }
699
- subScalar(t) {
700
- return this.x -= t, this.y -= t, this.z -= t, this;
701
- }
702
- subVectors(t, s) {
703
- return this.x = t.x - s.x, this.y = t.y - s.y, this.z = t.z - s.z, this;
704
- }
705
- multiply(t) {
706
- return this.x *= t.x, this.y *= t.y, this.z *= t.z, this;
707
- }
708
- multiplyScalar(t) {
709
- return this.x *= t, this.y *= t, this.z *= t, this;
710
- }
711
- multiplyVectors(t, s) {
712
- return this.x = t.x * s.x, this.y = t.y * s.y, this.z = t.z * s.z, this;
713
- }
714
- applyEuler(t) {
715
- return this.applyQuaternion(Lt.setFromEuler(t));
716
- }
717
- applyAxisAngle(t, s) {
718
- return this.applyQuaternion(Lt.setFromAxisAngle(t, s));
719
- }
720
- applyMatrix3(t) {
721
- const s = this.x, e = this.y, n = this.z, o = t.elements;
722
- return this.x = o[0] * s + o[3] * e + o[6] * n, this.y = o[1] * s + o[4] * e + o[7] * n, this.z = o[2] * s + o[5] * e + o[8] * n, this;
723
- }
724
- applyNormalMatrix(t) {
725
- return this.applyMatrix3(t).normalize();
726
- }
727
- applyMatrix4(t) {
728
- const s = this.x, e = this.y, n = this.z, o = t.elements, p = 1 / (o[3] * s + o[7] * e + o[11] * n + o[15]);
729
- return this.x = (o[0] * s + o[4] * e + o[8] * n + o[12]) * p, this.y = (o[1] * s + o[5] * e + o[9] * n + o[13]) * p, this.z = (o[2] * s + o[6] * e + o[10] * n + o[14]) * p, this;
730
- }
731
- applyQuaternion(t) {
732
- const s = this.x, e = this.y, n = this.z, o = t.x, p = t.y, a = t.z, y = t.w, c = 2 * (p * n - a * e), l = 2 * (a * s - o * n), u = 2 * (o * e - p * s);
733
- return this.x = s + y * c + p * u - a * l, this.y = e + y * l + a * c - o * u, this.z = n + y * u + o * l - p * c, this;
734
- }
735
- project(t) {
736
- return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);
737
- }
738
- unproject(t) {
739
- return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);
740
- }
741
- transformDirection(t) {
742
- const s = this.x, e = this.y, n = this.z, o = t.elements;
743
- return this.x = o[0] * s + o[4] * e + o[8] * n, this.y = o[1] * s + o[5] * e + o[9] * n, this.z = o[2] * s + o[6] * e + o[10] * n, this.normalize();
744
- }
745
- divide(t) {
746
- return this.x /= t.x, this.y /= t.y, this.z /= t.z, this;
747
- }
748
- divideScalar(t) {
749
- return this.multiplyScalar(1 / t);
750
- }
751
- min(t) {
752
- return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this;
753
- }
754
- max(t) {
755
- return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this;
756
- }
757
- clamp(t, s) {
758
- return this.x = Math.max(t.x, Math.min(s.x, this.x)), this.y = Math.max(t.y, Math.min(s.y, this.y)), this.z = Math.max(t.z, Math.min(s.z, this.z)), this;
759
- }
760
- clampScalar(t, s) {
761
- return this.x = Math.max(t, Math.min(s, this.x)), this.y = Math.max(t, Math.min(s, this.y)), this.z = Math.max(t, Math.min(s, this.z)), this;
762
- }
763
- clampLength(t, s) {
764
- const e = this.length();
765
- return this.divideScalar(e || 1).multiplyScalar(Math.max(t, Math.min(s, e)));
766
- }
767
- floor() {
768
- return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;
769
- }
770
- ceil() {
771
- return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;
772
- }
773
- round() {
774
- return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;
775
- }
776
- roundToZero() {
777
- return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this;
778
- }
779
- negate() {
780
- return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;
781
- }
782
- dot(t) {
783
- return this.x * t.x + this.y * t.y + this.z * t.z;
784
- }
785
- // TODO lengthSquared?
786
- lengthSq() {
787
- return this.x * this.x + this.y * this.y + this.z * this.z;
788
- }
789
- length() {
790
- return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
791
- }
792
- manhattanLength() {
793
- return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
794
- }
795
- normalize() {
796
- return this.divideScalar(this.length() || 1);
797
- }
798
- setLength(t) {
799
- return this.normalize().multiplyScalar(t);
800
- }
801
- lerp(t, s) {
802
- return this.x += (t.x - this.x) * s, this.y += (t.y - this.y) * s, this.z += (t.z - this.z) * s, this;
803
- }
804
- lerpVectors(t, s, e) {
805
- return this.x = t.x + (s.x - t.x) * e, this.y = t.y + (s.y - t.y) * e, this.z = t.z + (s.z - t.z) * e, this;
806
- }
807
- cross(t) {
808
- return this.crossVectors(this, t);
809
- }
810
- crossVectors(t, s) {
811
- const e = t.x, n = t.y, o = t.z, p = s.x, a = s.y, y = s.z;
812
- return this.x = n * y - o * a, this.y = o * p - e * y, this.z = e * a - n * p, this;
813
- }
814
- projectOnVector(t) {
815
- const s = t.lengthSq();
816
- if (s === 0) return this.set(0, 0, 0);
817
- const e = t.dot(this) / s;
818
- return this.copy(t).multiplyScalar(e);
819
- }
820
- projectOnPlane(t) {
821
- return at.copy(this).projectOnVector(t), this.sub(at);
822
- }
823
- reflect(t) {
824
- return this.sub(at.copy(t).multiplyScalar(2 * this.dot(t)));
825
- }
826
- angleTo(t) {
827
- const s = Math.sqrt(this.lengthSq() * t.lengthSq());
828
- if (s === 0) return Math.PI / 2;
829
- const e = this.dot(t) / s;
830
- return Math.acos(Rt(e, -1, 1));
831
- }
832
- distanceTo(t) {
833
- return Math.sqrt(this.distanceToSquared(t));
834
- }
835
- distanceToSquared(t) {
836
- const s = this.x - t.x, e = this.y - t.y, n = this.z - t.z;
837
- return s * s + e * e + n * n;
838
- }
839
- manhattanDistanceTo(t) {
840
- return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z);
841
- }
842
- setFromSpherical(t) {
843
- return this.setFromSphericalCoords(t.radius, t.phi, t.theta);
844
- }
845
- setFromSphericalCoords(t, s, e) {
846
- const n = Math.sin(s) * t;
847
- return this.x = n * Math.sin(e), this.y = Math.cos(s) * t, this.z = n * Math.cos(e), this;
848
- }
849
- setFromCylindrical(t) {
850
- return this.setFromCylindricalCoords(t.radius, t.theta, t.y);
851
- }
852
- setFromCylindricalCoords(t, s, e) {
853
- return this.x = t * Math.sin(s), this.y = e, this.z = t * Math.cos(s), this;
854
- }
855
- setFromMatrixPosition(t) {
856
- const s = t.elements;
857
- return this.x = s[12], this.y = s[13], this.z = s[14], this;
858
- }
859
- setFromMatrixScale(t) {
860
- const s = this.setFromMatrixColumn(t, 0).length(), e = this.setFromMatrixColumn(t, 1).length(), n = this.setFromMatrixColumn(t, 2).length();
861
- return this.x = s, this.y = e, this.z = n, this;
862
- }
863
- setFromMatrixColumn(t, s) {
864
- return this.fromArray(t.elements, s * 4);
865
- }
866
- setFromMatrix3Column(t, s) {
867
- return this.fromArray(t.elements, s * 3);
868
- }
869
- setFromEuler(t) {
870
- return this.x = t._x, this.y = t._y, this.z = t._z, this;
871
- }
872
- setFromColor(t) {
873
- return this.x = t.r, this.y = t.g, this.z = t.b, this;
874
- }
875
- equals(t) {
876
- return t.x === this.x && t.y === this.y && t.z === this.z;
877
- }
878
- fromArray(t, s = 0) {
879
- return this.x = t[s], this.y = t[s + 1], this.z = t[s + 2], this;
880
- }
881
- toArray(t = [], s = 0) {
882
- return t[s] = this.x, t[s + 1] = this.y, t[s + 2] = this.z, t;
883
- }
884
- fromBufferAttribute(t, s) {
885
- return this.x = t.getX(s), this.y = t.getY(s), this.z = t.getZ(s), this;
886
- }
887
- random() {
888
- return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;
889
- }
890
- randomDirection() {
891
- const t = Math.random() * Math.PI * 2, s = Math.random() * 2 - 1, e = Math.sqrt(1 - s * s);
892
- return this.x = e * Math.cos(t), this.y = s, this.z = e * Math.sin(t), this;
893
- }
894
- *[Symbol.iterator]() {
895
- yield this.x, yield this.y, yield this.z;
896
- }
897
- }
898
- const at = /* @__PURE__ */ new V(), Lt = /* @__PURE__ */ new ce(), rt = {
899
- enableDamping: !0,
900
- dampingFactor: 0.05
901
- }, q = class q extends he {
902
- constructor(s, e, n = rt) {
903
- super(s, e);
904
- G(this, "uuid", nt.generateUUID());
905
- G(this, "object");
906
- this.domElement = e, this.domElement = e, this.object = s, this.enableDamping = n.enableDamping ?? rt.enableDamping, this.dampingFactor = n.dampingFactor ?? rt.dampingFactor, this.object.position.set(0, 2, 2), this.target.copy({ x: 0, y: 0.5, z: 0 }), this.update();
907
- }
908
- tick() {
909
- this.enabled && this.update();
910
- }
911
- computeEncompassingView(s) {
912
- const e = s.getCenter(new V()), n = s.getSize(new V()), o = Math.max(n.x, n.y, n.z) * 1.25;
913
- return {
914
- position: this.object.position.clone().normalize().clone().multiplyScalar(o),
915
- target: e.clone()
916
- };
917
- }
918
- zoomIn(s) {
919
- const e = s || q.DEFAULT_ZOOM_FACTOR, { minDistance: n, maxDistance: o } = this;
920
- this.minDistance = this.maxDistance = nt.clamp(
921
- this.getDistance() - e,
922
- n + e,
923
- o - e
924
- ), this.update(), this.minDistance = n, this.maxDistance = o;
925
- }
926
- zoomOut(s) {
927
- const e = s || q.DEFAULT_ZOOM_FACTOR, { minDistance: n, maxDistance: o } = this;
928
- this.minDistance = this.maxDistance = nt.clamp(
929
- this.getDistance() + e,
930
- n + e,
931
- o - e
932
- ), this.update(), this.minDistance = n, this.maxDistance = o;
933
- }
934
- };
935
- G(q, "DEFAULT_ZOOM_FACTOR", 1);
936
- let Ot = q;
937
- export {
938
- rt as O,
939
- Ot as a
940
- };