@ridp/threejs 1.3.3 → 1.4.0

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.
@@ -1,860 +0,0 @@
1
- import { Matrix4 as ct, Vector3 as x, Quaternion as J, Object3D as mt, Controls as ft, MOUSE as z, TOUCH as G, Spherical as st, Vector2 as L, Ray as yt, Plane as gt, MathUtils as Et, CameraHelper as bt, GridHelper as wt, BoxHelper as Pt, Raycaster as St, AxesHelper as Dt, ArrowHelper as Tt, DataTextureLoader as Rt, HalfFloatType as W, FloatType as q, DataUtils as X, LinearSRGBColorSpace as Mt, LinearFilter as ot, EquirectangularReflectionMapping as xt } from "three";
2
- var K = function() {
3
- var i = 0, t = document.createElement("div");
4
- t.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", t.addEventListener("click", function(_) {
5
- _.preventDefault(), n(++i % t.children.length);
6
- }, !1);
7
- function e(_) {
8
- return t.appendChild(_.dom), _;
9
- }
10
- function n(_) {
11
- for (var r = 0; r < t.children.length; r++)
12
- t.children[r].style.display = r === _ ? "block" : "none";
13
- i = _;
14
- }
15
- var l = (performance || Date).now(), p = l, a = 0, y = e(new K.Panel("FPS", "#0ff", "#002")), T = e(new K.Panel("MS", "#0f0", "#020"));
16
- if (self.performance && self.performance.memory)
17
- var b = e(new K.Panel("MB", "#f08", "#201"));
18
- return n(0), {
19
- REVISION: 16,
20
- dom: t,
21
- addPanel: e,
22
- showPanel: n,
23
- begin: function() {
24
- l = (performance || Date).now();
25
- },
26
- end: function() {
27
- a++;
28
- var _ = (performance || Date).now();
29
- if (T.update(_ - l, 200), _ >= p + 1e3 && (y.update(a * 1e3 / (_ - p), 100), p = _, a = 0, b)) {
30
- var r = performance.memory;
31
- b.update(r.usedJSHeapSize / 1048576, r.jsHeapSizeLimit / 1048576);
32
- }
33
- return _;
34
- },
35
- update: function() {
36
- l = this.end();
37
- },
38
- // Backwards Compatibility
39
- domElement: t,
40
- setMode: n
41
- };
42
- };
43
- K.Panel = function(i, t, e) {
44
- var n = 1 / 0, l = 0, p = Math.round, a = p(window.devicePixelRatio || 1), y = 80 * a, T = 48 * a, b = 3 * a, _ = 2 * a, r = 3 * a, O = 15 * a, C = 74 * a, v = 30 * a, k = document.createElement("canvas");
45
- k.width = y, k.height = T, k.style.cssText = "width:80px;height:48px";
46
- var o = k.getContext("2d");
47
- return o.font = "bold " + 9 * a + "px Helvetica,Arial,sans-serif", o.textBaseline = "top", o.fillStyle = e, o.fillRect(0, 0, y, T), o.fillStyle = t, o.fillText(i, b, _), o.fillRect(r, O, C, v), o.fillStyle = e, o.globalAlpha = 0.9, o.fillRect(r, O, C, v), {
48
- dom: k,
49
- update: function(s, D) {
50
- n = Math.min(n, s), l = Math.max(l, s), o.fillStyle = e, o.globalAlpha = 1, o.fillRect(0, 0, y, O), o.fillStyle = t, o.fillText(p(s) + " " + i + " (" + p(n) + "-" + p(l) + ")", b, _), o.drawImage(k, r + a, O, C - a, v, r, O, C - a, v), o.fillRect(r + C - a, O, a, v), o.fillStyle = e, o.globalAlpha = 0.9, o.fillRect(r + C - a, O, a, p((1 - s / D) * v));
51
- }
52
- };
53
- };
54
- const nt = new x(), At = new J(), at = new x();
55
- class Ot extends mt {
56
- /**
57
- * Constructs a new CSS3D object.
58
- *
59
- * @param {DOMElement} [element] - The DOM element.
60
- */
61
- constructor(t = document.createElement("div")) {
62
- super(), this.isCSS3DObject = !0, this.element = t, this.element.style.position = "absolute", this.element.style.pointerEvents = "auto", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.addEventListener("removed", function() {
63
- this.traverse(function(e) {
64
- e.element instanceof e.element.ownerDocument.defaultView.Element && e.element.parentNode !== null && e.element.remove();
65
- });
66
- });
67
- }
68
- copy(t, e) {
69
- return super.copy(t, e), this.element = t.element.cloneNode(!0), this;
70
- }
71
- }
72
- class Vt extends Ot {
73
- /**
74
- * Constructs a new CSS3D sprite object.
75
- *
76
- * @param {DOMElement} [element] - The DOM element.
77
- */
78
- constructor(t) {
79
- super(t), this.isCSS3DSprite = !0, this.rotation2D = 0;
80
- }
81
- copy(t, e) {
82
- return super.copy(t, e), this.rotation2D = t.rotation2D, this;
83
- }
84
- }
85
- const H = new ct(), Lt = new ct();
86
- class qt {
87
- /**
88
- * Constructs a new CSS3D renderer.
89
- *
90
- * @param {CSS3DRenderer~Parameters} [parameters] - The parameters.
91
- */
92
- constructor(t = {}) {
93
- const e = this;
94
- let n, l, p, a;
95
- const y = {
96
- camera: { style: "" },
97
- objects: /* @__PURE__ */ new WeakMap()
98
- }, T = t.element !== void 0 ? t.element : document.createElement("div");
99
- T.style.overflow = "hidden", this.domElement = T;
100
- const b = document.createElement("div");
101
- b.style.transformOrigin = "0 0", b.style.pointerEvents = "none", T.appendChild(b);
102
- const _ = document.createElement("div");
103
- _.style.transformStyle = "preserve-3d", b.appendChild(_), this.getSize = function() {
104
- return {
105
- width: n,
106
- height: l
107
- };
108
- }, this.render = function(o, s) {
109
- const D = s.projectionMatrix.elements[5] * a;
110
- s.view && s.view.enabled ? (b.style.transform = `translate( ${-s.view.offsetX * (n / s.view.width)}px, ${-s.view.offsetY * (l / s.view.height)}px )`, b.style.transform += `scale( ${s.view.fullWidth / s.view.width}, ${s.view.fullHeight / s.view.height} )`) : b.style.transform = "", o.matrixWorldAutoUpdate === !0 && o.updateMatrixWorld(), s.parent === null && s.matrixWorldAutoUpdate === !0 && s.updateMatrixWorld();
111
- let B, R;
112
- s.isOrthographicCamera && (B = -(s.right + s.left) / 2, R = (s.top + s.bottom) / 2);
113
- const A = s.view && s.view.enabled ? s.view.height / s.view.fullHeight : 1, I = s.isOrthographicCamera ? `scale( ${A} )scale(` + D + ")translate(" + r(B) + "px," + r(R) + "px)" + O(s.matrixWorldInverse) : `scale( ${A} )translateZ(` + D + "px)" + O(s.matrixWorldInverse), h = (s.isPerspectiveCamera ? "perspective(" + D + "px) " : "") + I + "translate(" + p + "px," + a + "px)";
114
- y.camera.style !== h && (_.style.transform = h, y.camera.style = h), k(o, o, s);
115
- }, this.setSize = function(o, s) {
116
- n = o, l = s, p = n / 2, a = l / 2, T.style.width = o + "px", T.style.height = s + "px", b.style.width = o + "px", b.style.height = s + "px", _.style.width = o + "px", _.style.height = s + "px";
117
- };
118
- function r(o) {
119
- return Math.abs(o) < 1e-10 ? 0 : o;
120
- }
121
- function O(o) {
122
- const s = o.elements;
123
- return "matrix3d(" + r(s[0]) + "," + r(-s[1]) + "," + r(s[2]) + "," + r(s[3]) + "," + r(s[4]) + "," + r(-s[5]) + "," + r(s[6]) + "," + r(s[7]) + "," + r(s[8]) + "," + r(-s[9]) + "," + r(s[10]) + "," + r(s[11]) + "," + r(s[12]) + "," + r(-s[13]) + "," + r(s[14]) + "," + r(s[15]) + ")";
124
- }
125
- function C(o) {
126
- const s = o.elements;
127
- return "translate(-50%,-50%)" + ("matrix3d(" + r(s[0]) + "," + r(s[1]) + "," + r(s[2]) + "," + r(s[3]) + "," + r(-s[4]) + "," + r(-s[5]) + "," + r(-s[6]) + "," + r(-s[7]) + "," + r(s[8]) + "," + r(s[9]) + "," + r(s[10]) + "," + r(s[11]) + "," + r(s[12]) + "," + r(s[13]) + "," + r(s[14]) + "," + r(s[15]) + ")");
128
- }
129
- function v(o) {
130
- o.isCSS3DObject && (o.element.style.display = "none");
131
- for (let s = 0, D = o.children.length; s < D; s++)
132
- v(o.children[s]);
133
- }
134
- function k(o, s, D, B) {
135
- if (o.visible === !1) {
136
- v(o);
137
- return;
138
- }
139
- if (o.isCSS3DObject) {
140
- const R = o.layers.test(D.layers) === !0, A = o.element;
141
- if (A.style.display = R === !0 ? "" : "none", R === !0) {
142
- o.onBeforeRender(e, s, D);
143
- let I;
144
- o.isCSS3DSprite ? (H.copy(D.matrixWorldInverse), H.transpose(), o.rotation2D !== 0 && H.multiply(Lt.makeRotationZ(o.rotation2D)), o.matrixWorld.decompose(nt, At, at), H.setPosition(nt), H.scale(at), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, I = C(H)) : I = C(o.matrixWorld);
145
- const N = y.objects.get(o);
146
- if (N === void 0 || N.style !== I) {
147
- A.style.transform = I;
148
- const h = { style: I };
149
- y.objects.set(o, h);
150
- }
151
- A.parentNode !== _ && _.appendChild(A), o.onAfterRender(e, s, D);
152
- }
153
- }
154
- for (let R = 0, A = o.children.length; R < A; R++)
155
- k(o.children[R], s, D);
156
- }
157
- }
158
- }
159
- const rt = { type: "change" }, tt = { type: "start" }, pt = { type: "end" }, V = new yt(), ht = new gt(), Ct = Math.cos(70 * Et.DEG2RAD), S = new x(), M = 2 * Math.PI, d = {
160
- NONE: -1,
161
- ROTATE: 0,
162
- DOLLY: 1,
163
- PAN: 2,
164
- TOUCH_ROTATE: 3,
165
- TOUCH_PAN: 4,
166
- TOUCH_DOLLY_PAN: 5,
167
- TOUCH_DOLLY_ROTATE: 6
168
- }, $ = 1e-6;
169
- class dt extends ft {
170
- /**
171
- * Constructs a new controls instance.
172
- *
173
- * @param {Object3D} object - The object that is managed by the controls.
174
- * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
175
- */
176
- constructor(t, e = null) {
177
- super(t, e), this.state = d.NONE, this.target = new x(), this.cursor = new x(), 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.keyRotateSpeed = 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: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.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._lastPosition = new x(), this._lastQuaternion = new J(), this._lastTargetPosition = new x(), this._quat = new J().setFromUnitVectors(t.up, new x(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new st(), this._sphericalDelta = new st(), this._scale = 1, this._panOffset = new x(), this._rotateStart = new L(), this._rotateEnd = new L(), this._rotateDelta = new L(), this._panStart = new L(), this._panEnd = new L(), this._panDelta = new L(), this._dollyStart = new L(), this._dollyEnd = new L(), this._dollyDelta = new L(), this._dollyDirection = new x(), this._mouse = new L(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = kt.bind(this), this._onPointerDown = vt.bind(this), this._onPointerUp = It.bind(this), this._onContextMenu = Gt.bind(this), this._onMouseWheel = jt.bind(this), this._onKeyDown = Yt.bind(this), this._onTouchStart = Ut.bind(this), this._onTouchMove = zt.bind(this), this._onMouseDown = Nt.bind(this), this._onMouseMove = Ht.bind(this), this._interceptControlDown = Bt.bind(this), this._interceptControlUp = Ft.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
178
- }
179
- connect(t) {
180
- super.connect(t), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
181
- }
182
- disconnect() {
183
- this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "auto";
184
- }
185
- dispose() {
186
- this.disconnect();
187
- }
188
- /**
189
- * Get the current vertical rotation, in radians.
190
- *
191
- * @return {number} The current vertical rotation, in radians.
192
- */
193
- getPolarAngle() {
194
- return this._spherical.phi;
195
- }
196
- /**
197
- * Get the current horizontal rotation, in radians.
198
- *
199
- * @return {number} The current horizontal rotation, in radians.
200
- */
201
- getAzimuthalAngle() {
202
- return this._spherical.theta;
203
- }
204
- /**
205
- * Returns the distance from the camera to the target.
206
- *
207
- * @return {number} The distance from the camera to the target.
208
- */
209
- getDistance() {
210
- return this.object.position.distanceTo(this.target);
211
- }
212
- /**
213
- * Adds key event listeners to the given DOM element.
214
- * `window` is a recommended argument for using this method.
215
- *
216
- * @param {HTMLDOMElement} domElement - The DOM element
217
- */
218
- listenToKeyEvents(t) {
219
- t.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = t;
220
- }
221
- /**
222
- * Removes the key event listener previously defined with `listenToKeyEvents()`.
223
- */
224
- stopListenToKeyEvents() {
225
- this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
226
- }
227
- /**
228
- * Save the current state of the controls. This can later be recovered with `reset()`.
229
- */
230
- saveState() {
231
- this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
232
- }
233
- /**
234
- * Reset the controls to their state from either the last time the `saveState()`
235
- * was called, or the initial state.
236
- */
237
- reset() {
238
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(rt), this.update(), this.state = d.NONE;
239
- }
240
- update(t = null) {
241
- const e = this.object.position;
242
- S.copy(e).sub(this.target), S.applyQuaternion(this._quat), this._spherical.setFromVector3(S), this.autoRotate && this.state === d.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
243
- let n = this.minAzimuthAngle, l = this.maxAzimuthAngle;
244
- isFinite(n) && isFinite(l) && (n < -Math.PI ? n += M : n > Math.PI && (n -= M), l < -Math.PI ? l += M : l > Math.PI && (l -= M), n <= l ? this._spherical.theta = Math.max(n, Math.min(l, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + l) / 2 ? Math.max(n, this._spherical.theta) : Math.min(l, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
245
- let p = !1;
246
- if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
247
- this._spherical.radius = this._clampDistance(this._spherical.radius);
248
- else {
249
- const a = this._spherical.radius;
250
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), p = a != this._spherical.radius;
251
- }
252
- if (S.setFromSpherical(this._spherical), S.applyQuaternion(this._quatInverse), e.copy(this.target).add(S), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
253
- let a = null;
254
- if (this.object.isPerspectiveCamera) {
255
- const y = S.length();
256
- a = this._clampDistance(y * this._scale);
257
- const T = y - a;
258
- this.object.position.addScaledVector(this._dollyDirection, T), this.object.updateMatrixWorld(), p = !!T;
259
- } else if (this.object.isOrthographicCamera) {
260
- const y = new x(this._mouse.x, this._mouse.y, 0);
261
- y.unproject(this.object);
262
- const T = this.object.zoom;
263
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), p = T !== this.object.zoom;
264
- const b = new x(this._mouse.x, this._mouse.y, 0);
265
- b.unproject(this.object), this.object.position.sub(b).add(y), this.object.updateMatrixWorld(), a = S.length();
266
- } else
267
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
268
- a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (V.origin.copy(this.object.position), V.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(V.direction)) < Ct ? this.object.lookAt(this.target) : (ht.setFromNormalAndCoplanarPoint(this.object.up, this.target), V.intersectPlane(ht, this.target))));
269
- } else if (this.object.isOrthographicCamera) {
270
- const a = this.object.zoom;
271
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), a !== this.object.zoom && (this.object.updateProjectionMatrix(), p = !0);
272
- }
273
- return this._scale = 1, this._performCursorZoom = !1, p || this._lastPosition.distanceToSquared(this.object.position) > $ || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > $ || this._lastTargetPosition.distanceToSquared(this.target) > $ ? (this.dispatchEvent(rt), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
274
- }
275
- _getAutoRotationAngle(t) {
276
- return t !== null ? M / 60 * this.autoRotateSpeed * t : M / 60 / 60 * this.autoRotateSpeed;
277
- }
278
- _getZoomScale(t) {
279
- const e = Math.abs(t * 0.01);
280
- return Math.pow(0.95, this.zoomSpeed * e);
281
- }
282
- _rotateLeft(t) {
283
- this._sphericalDelta.theta -= t;
284
- }
285
- _rotateUp(t) {
286
- this._sphericalDelta.phi -= t;
287
- }
288
- _panLeft(t, e) {
289
- S.setFromMatrixColumn(e, 0), S.multiplyScalar(-t), this._panOffset.add(S);
290
- }
291
- _panUp(t, e) {
292
- this.screenSpacePanning === !0 ? S.setFromMatrixColumn(e, 1) : (S.setFromMatrixColumn(e, 0), S.crossVectors(this.object.up, S)), S.multiplyScalar(t), this._panOffset.add(S);
293
- }
294
- // deltaX and deltaY are in pixels; right and down are positive
295
- _pan(t, e) {
296
- const n = this.domElement;
297
- if (this.object.isPerspectiveCamera) {
298
- const l = this.object.position;
299
- S.copy(l).sub(this.target);
300
- let p = S.length();
301
- p *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * p / n.clientHeight, this.object.matrix), this._panUp(2 * e * p / n.clientHeight, this.object.matrix);
302
- } else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(e * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
303
- }
304
- _dollyOut(t) {
305
- this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
306
- }
307
- _dollyIn(t) {
308
- this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
309
- }
310
- _updateZoomParameters(t, e) {
311
- if (!this.zoomToCursor)
312
- return;
313
- this._performCursorZoom = !0;
314
- const n = this.domElement.getBoundingClientRect(), l = t - n.left, p = e - n.top, a = n.width, y = n.height;
315
- this._mouse.x = l / a * 2 - 1, this._mouse.y = -(p / y) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
316
- }
317
- _clampDistance(t) {
318
- return Math.max(this.minDistance, Math.min(this.maxDistance, t));
319
- }
320
- //
321
- // event callbacks - update the object state
322
- //
323
- _handleMouseDownRotate(t) {
324
- this._rotateStart.set(t.clientX, t.clientY);
325
- }
326
- _handleMouseDownDolly(t) {
327
- this._updateZoomParameters(t.clientX, t.clientX), this._dollyStart.set(t.clientX, t.clientY);
328
- }
329
- _handleMouseDownPan(t) {
330
- this._panStart.set(t.clientX, t.clientY);
331
- }
332
- _handleMouseMoveRotate(t) {
333
- this._rotateEnd.set(t.clientX, t.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
334
- const e = this.domElement;
335
- this._rotateLeft(M * this._rotateDelta.x / e.clientHeight), this._rotateUp(M * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
336
- }
337
- _handleMouseMoveDolly(t) {
338
- this._dollyEnd.set(t.clientX, t.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
339
- }
340
- _handleMouseMovePan(t) {
341
- this._panEnd.set(t.clientX, t.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
342
- }
343
- _handleMouseWheel(t) {
344
- this._updateZoomParameters(t.clientX, t.clientY), t.deltaY < 0 ? this._dollyIn(this._getZoomScale(t.deltaY)) : t.deltaY > 0 && this._dollyOut(this._getZoomScale(t.deltaY)), this.update();
345
- }
346
- _handleKeyDown(t) {
347
- let e = !1;
348
- switch (t.code) {
349
- case this.keys.UP:
350
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), e = !0;
351
- break;
352
- case this.keys.BOTTOM:
353
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(-M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), e = !0;
354
- break;
355
- case this.keys.LEFT:
356
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), e = !0;
357
- break;
358
- case this.keys.RIGHT:
359
- t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(-M * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), e = !0;
360
- break;
361
- }
362
- e && (t.preventDefault(), this.update());
363
- }
364
- _handleTouchStartRotate(t) {
365
- if (this._pointers.length === 1)
366
- this._rotateStart.set(t.pageX, t.pageY);
367
- else {
368
- const e = this._getSecondPointerPosition(t), n = 0.5 * (t.pageX + e.x), l = 0.5 * (t.pageY + e.y);
369
- this._rotateStart.set(n, l);
370
- }
371
- }
372
- _handleTouchStartPan(t) {
373
- if (this._pointers.length === 1)
374
- this._panStart.set(t.pageX, t.pageY);
375
- else {
376
- const e = this._getSecondPointerPosition(t), n = 0.5 * (t.pageX + e.x), l = 0.5 * (t.pageY + e.y);
377
- this._panStart.set(n, l);
378
- }
379
- }
380
- _handleTouchStartDolly(t) {
381
- const e = this._getSecondPointerPosition(t), n = t.pageX - e.x, l = t.pageY - e.y, p = Math.sqrt(n * n + l * l);
382
- this._dollyStart.set(0, p);
383
- }
384
- _handleTouchStartDollyPan(t) {
385
- this.enableZoom && this._handleTouchStartDolly(t), this.enablePan && this._handleTouchStartPan(t);
386
- }
387
- _handleTouchStartDollyRotate(t) {
388
- this.enableZoom && this._handleTouchStartDolly(t), this.enableRotate && this._handleTouchStartRotate(t);
389
- }
390
- _handleTouchMoveRotate(t) {
391
- if (this._pointers.length == 1)
392
- this._rotateEnd.set(t.pageX, t.pageY);
393
- else {
394
- const n = this._getSecondPointerPosition(t), l = 0.5 * (t.pageX + n.x), p = 0.5 * (t.pageY + n.y);
395
- this._rotateEnd.set(l, p);
396
- }
397
- this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
398
- const e = this.domElement;
399
- this._rotateLeft(M * this._rotateDelta.x / e.clientHeight), this._rotateUp(M * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd);
400
- }
401
- _handleTouchMovePan(t) {
402
- if (this._pointers.length === 1)
403
- this._panEnd.set(t.pageX, t.pageY);
404
- else {
405
- const e = this._getSecondPointerPosition(t), n = 0.5 * (t.pageX + e.x), l = 0.5 * (t.pageY + e.y);
406
- this._panEnd.set(n, l);
407
- }
408
- this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
409
- }
410
- _handleTouchMoveDolly(t) {
411
- const e = this._getSecondPointerPosition(t), n = t.pageX - e.x, l = t.pageY - e.y, p = Math.sqrt(n * n + l * l);
412
- this._dollyEnd.set(0, p), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
413
- const a = (t.pageX + e.x) * 0.5, y = (t.pageY + e.y) * 0.5;
414
- this._updateZoomParameters(a, y);
415
- }
416
- _handleTouchMoveDollyPan(t) {
417
- this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
418
- }
419
- _handleTouchMoveDollyRotate(t) {
420
- this.enableZoom && this._handleTouchMoveDolly(t), this.enableRotate && this._handleTouchMoveRotate(t);
421
- }
422
- // pointers
423
- _addPointer(t) {
424
- this._pointers.push(t.pointerId);
425
- }
426
- _removePointer(t) {
427
- delete this._pointerPositions[t.pointerId];
428
- for (let e = 0; e < this._pointers.length; e++)
429
- if (this._pointers[e] == t.pointerId) {
430
- this._pointers.splice(e, 1);
431
- return;
432
- }
433
- }
434
- _isTrackingPointer(t) {
435
- for (let e = 0; e < this._pointers.length; e++)
436
- if (this._pointers[e] == t.pointerId) return !0;
437
- return !1;
438
- }
439
- _trackPointer(t) {
440
- let e = this._pointerPositions[t.pointerId];
441
- e === void 0 && (e = new L(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
442
- }
443
- _getSecondPointerPosition(t) {
444
- const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
445
- return this._pointerPositions[e];
446
- }
447
- //
448
- _customWheelEvent(t) {
449
- const e = t.deltaMode, n = {
450
- clientX: t.clientX,
451
- clientY: t.clientY,
452
- deltaY: t.deltaY
453
- };
454
- switch (e) {
455
- case 1:
456
- n.deltaY *= 16;
457
- break;
458
- case 2:
459
- n.deltaY *= 100;
460
- break;
461
- }
462
- return t.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
463
- }
464
- }
465
- function vt(i) {
466
- this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
467
- }
468
- function kt(i) {
469
- this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
470
- }
471
- function It(i) {
472
- switch (this._removePointer(i), this._pointers.length) {
473
- case 0:
474
- this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(pt), this.state = d.NONE;
475
- break;
476
- case 1:
477
- const t = this._pointers[0], e = this._pointerPositions[t];
478
- this._onTouchStart({ pointerId: t, pageX: e.x, pageY: e.y });
479
- break;
480
- }
481
- }
482
- function Nt(i) {
483
- let t;
484
- switch (i.button) {
485
- case 0:
486
- t = this.mouseButtons.LEFT;
487
- break;
488
- case 1:
489
- t = this.mouseButtons.MIDDLE;
490
- break;
491
- case 2:
492
- t = this.mouseButtons.RIGHT;
493
- break;
494
- default:
495
- t = -1;
496
- }
497
- switch (t) {
498
- case z.DOLLY:
499
- if (this.enableZoom === !1) return;
500
- this._handleMouseDownDolly(i), this.state = d.DOLLY;
501
- break;
502
- case z.ROTATE:
503
- if (i.ctrlKey || i.metaKey || i.shiftKey) {
504
- if (this.enablePan === !1) return;
505
- this._handleMouseDownPan(i), this.state = d.PAN;
506
- } else {
507
- if (this.enableRotate === !1) return;
508
- this._handleMouseDownRotate(i), this.state = d.ROTATE;
509
- }
510
- break;
511
- case z.PAN:
512
- if (i.ctrlKey || i.metaKey || i.shiftKey) {
513
- if (this.enableRotate === !1) return;
514
- this._handleMouseDownRotate(i), this.state = d.ROTATE;
515
- } else {
516
- if (this.enablePan === !1) return;
517
- this._handleMouseDownPan(i), this.state = d.PAN;
518
- }
519
- break;
520
- default:
521
- this.state = d.NONE;
522
- }
523
- this.state !== d.NONE && this.dispatchEvent(tt);
524
- }
525
- function Ht(i) {
526
- switch (this.state) {
527
- case d.ROTATE:
528
- if (this.enableRotate === !1) return;
529
- this._handleMouseMoveRotate(i);
530
- break;
531
- case d.DOLLY:
532
- if (this.enableZoom === !1) return;
533
- this._handleMouseMoveDolly(i);
534
- break;
535
- case d.PAN:
536
- if (this.enablePan === !1) return;
537
- this._handleMouseMovePan(i);
538
- break;
539
- }
540
- }
541
- function jt(i) {
542
- this.enabled === !1 || this.enableZoom === !1 || this.state !== d.NONE || (i.preventDefault(), this.dispatchEvent(tt), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(pt));
543
- }
544
- function Yt(i) {
545
- this.enabled !== !1 && this._handleKeyDown(i);
546
- }
547
- function Ut(i) {
548
- switch (this._trackPointer(i), this._pointers.length) {
549
- case 1:
550
- switch (this.touches.ONE) {
551
- case G.ROTATE:
552
- if (this.enableRotate === !1) return;
553
- this._handleTouchStartRotate(i), this.state = d.TOUCH_ROTATE;
554
- break;
555
- case G.PAN:
556
- if (this.enablePan === !1) return;
557
- this._handleTouchStartPan(i), this.state = d.TOUCH_PAN;
558
- break;
559
- default:
560
- this.state = d.NONE;
561
- }
562
- break;
563
- case 2:
564
- switch (this.touches.TWO) {
565
- case G.DOLLY_PAN:
566
- if (this.enableZoom === !1 && this.enablePan === !1) return;
567
- this._handleTouchStartDollyPan(i), this.state = d.TOUCH_DOLLY_PAN;
568
- break;
569
- case G.DOLLY_ROTATE:
570
- if (this.enableZoom === !1 && this.enableRotate === !1) return;
571
- this._handleTouchStartDollyRotate(i), this.state = d.TOUCH_DOLLY_ROTATE;
572
- break;
573
- default:
574
- this.state = d.NONE;
575
- }
576
- break;
577
- default:
578
- this.state = d.NONE;
579
- }
580
- this.state !== d.NONE && this.dispatchEvent(tt);
581
- }
582
- function zt(i) {
583
- switch (this._trackPointer(i), this.state) {
584
- case d.TOUCH_ROTATE:
585
- if (this.enableRotate === !1) return;
586
- this._handleTouchMoveRotate(i), this.update();
587
- break;
588
- case d.TOUCH_PAN:
589
- if (this.enablePan === !1) return;
590
- this._handleTouchMovePan(i), this.update();
591
- break;
592
- case d.TOUCH_DOLLY_PAN:
593
- if (this.enableZoom === !1 && this.enablePan === !1) return;
594
- this._handleTouchMoveDollyPan(i), this.update();
595
- break;
596
- case d.TOUCH_DOLLY_ROTATE:
597
- if (this.enableZoom === !1 && this.enableRotate === !1) return;
598
- this._handleTouchMoveDollyRotate(i), this.update();
599
- break;
600
- default:
601
- this.state = d.NONE;
602
- }
603
- }
604
- function Gt(i) {
605
- this.enabled !== !1 && i.preventDefault();
606
- }
607
- function Bt(i) {
608
- i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
609
- }
610
- function Ft(i) {
611
- i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
612
- }
613
- class Zt extends dt {
614
- constructor(t, e) {
615
- super(t, e), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }, this.touches = { ONE: G.PAN, TWO: G.DOLLY_ROTATE };
616
- }
617
- }
618
- function $t(i) {
619
- return new bt(i);
620
- }
621
- function Qt(i = 150, ...t) {
622
- return new wt(i, i / 10, ...t);
623
- }
624
- function Jt(i) {
625
- return new Pt(i, 16776960);
626
- }
627
- function te(i, t) {
628
- return new dt(i, t);
629
- }
630
- function ee(i, t) {
631
- return new Zt(i, t);
632
- }
633
- function ie() {
634
- const i = new St(), t = new L(0, 0);
635
- return {
636
- raycaster: i,
637
- pointer: t
638
- };
639
- }
640
- function se(i = 10) {
641
- return new Dt(i);
642
- }
643
- function oe(i = new x(1, 1, 1), t = new x(10, 10, 10), e = 5, n = 16776960) {
644
- return i.normalize(), new Tt(i, t, e, n);
645
- }
646
- function ne() {
647
- const i = new K();
648
- return i.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", i;
649
- }
650
- class Kt extends Rt {
651
- /**
652
- * Constructs a new RGBE loader.
653
- *
654
- * @param {LoadingManager} [manager] - The loading manager.
655
- */
656
- constructor(t) {
657
- super(t), this.type = W;
658
- }
659
- /**
660
- * Parses the given RGBE texture data.
661
- *
662
- * @param {ArrayBuffer} buffer - The raw texture data.
663
- * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
664
- */
665
- parse(t) {
666
- const a = function(h, u) {
667
- switch (h) {
668
- case 1:
669
- throw new Error("THREE.RGBELoader: Read Error: " + (u || ""));
670
- case 2:
671
- throw new Error("THREE.RGBELoader: Write Error: " + (u || ""));
672
- case 3:
673
- throw new Error("THREE.RGBELoader: Bad File Format: " + (u || ""));
674
- default:
675
- case 4:
676
- throw new Error("THREE.RGBELoader: Memory Error: " + (u || ""));
677
- }
678
- }, _ = `
679
- `, r = function(h, u, f) {
680
- u = u || 1024;
681
- let w = h.pos, E = -1, c = 0, P = "", m = String.fromCharCode.apply(null, new Uint16Array(h.subarray(w, w + 128)));
682
- for (; 0 > (E = m.indexOf(_)) && c < u && w < h.byteLength; )
683
- P += m, c += m.length, w += 128, m += String.fromCharCode.apply(null, new Uint16Array(h.subarray(w, w + 128)));
684
- return -1 < E ? (h.pos += c + E + 1, P + m.slice(0, E)) : !1;
685
- }, O = function(h) {
686
- const u = /^#\?(\S+)/, f = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, g = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, w = /^\s*FORMAT=(\S+)\s*$/, E = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, c = {
687
- valid: 0,
688
- /* indicate which fields are valid */
689
- string: "",
690
- /* the actual header string */
691
- comments: "",
692
- /* comments found in header */
693
- programtype: "RGBE",
694
- /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */
695
- format: "",
696
- /* RGBE format, default 32-bit_rle_rgbe */
697
- gamma: 1,
698
- /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */
699
- exposure: 1,
700
- /* a value of 1.0 in an image corresponds to <exposure> watts/steradian/m^2. defaults to 1.0 */
701
- width: 0,
702
- height: 0
703
- /* image dimensions, width/height */
704
- };
705
- let P, m;
706
- for ((h.pos >= h.byteLength || !(P = r(h))) && a(1, "no header found"), (m = P.match(u)) || a(3, "bad initial token"), c.valid |= 1, c.programtype = m[1], c.string += P + `
707
- `; P = r(h), P !== !1; ) {
708
- if (c.string += P + `
709
- `, P.charAt(0) === "#") {
710
- c.comments += P + `
711
- `;
712
- continue;
713
- }
714
- if ((m = P.match(f)) && (c.gamma = parseFloat(m[1])), (m = P.match(g)) && (c.exposure = parseFloat(m[1])), (m = P.match(w)) && (c.valid |= 2, c.format = m[1]), (m = P.match(E)) && (c.valid |= 4, c.height = parseInt(m[1], 10), c.width = parseInt(m[2], 10)), c.valid & 2 && c.valid & 4) break;
715
- }
716
- return c.valid & 2 || a(3, "missing format specifier"), c.valid & 4 || a(3, "missing image size specifier"), c;
717
- }, C = function(h, u, f) {
718
- const g = u;
719
- if (
720
- // run length encoding is not allowed so read flat
721
- g < 8 || g > 32767 || // this file is not run length encoded
722
- h[0] !== 2 || h[1] !== 2 || h[2] & 128
723
- )
724
- return new Uint8Array(h);
725
- g !== (h[2] << 8 | h[3]) && a(3, "wrong scanline width");
726
- const w = new Uint8Array(4 * u * f);
727
- w.length || a(4, "unable to allocate buffer space");
728
- let E = 0, c = 0;
729
- const P = 4 * g, m = new Uint8Array(4), F = new Uint8Array(P);
730
- let et = f;
731
- for (; et > 0 && c < h.byteLength; ) {
732
- c + 4 > h.byteLength && a(1), m[0] = h[c++], m[1] = h[c++], m[2] = h[c++], m[3] = h[c++], (m[0] != 2 || m[1] != 2 || (m[2] << 8 | m[3]) != g) && a(3, "bad rgbe scanline format");
733
- let Z = 0, j;
734
- for (; Z < P && c < h.byteLength; ) {
735
- j = h[c++];
736
- const Y = j > 128;
737
- if (Y && (j -= 128), (j === 0 || Z + j > P) && a(3, "bad scanline data"), Y) {
738
- const U = h[c++];
739
- for (let it = 0; it < j; it++)
740
- F[Z++] = U;
741
- } else
742
- F.set(h.subarray(c, c + j), Z), Z += j, c += j;
743
- }
744
- const _t = g;
745
- for (let Y = 0; Y < _t; Y++) {
746
- let U = 0;
747
- w[E] = F[Y + U], U += g, w[E + 1] = F[Y + U], U += g, w[E + 2] = F[Y + U], U += g, w[E + 3] = F[Y + U], E += 4;
748
- }
749
- et--;
750
- }
751
- return w;
752
- }, v = function(h, u, f, g) {
753
- const w = h[u + 3], E = Math.pow(2, w - 128) / 255;
754
- f[g + 0] = h[u + 0] * E, f[g + 1] = h[u + 1] * E, f[g + 2] = h[u + 2] * E, f[g + 3] = 1;
755
- }, k = function(h, u, f, g) {
756
- const w = h[u + 3], E = Math.pow(2, w - 128) / 255;
757
- f[g + 0] = X.toHalfFloat(Math.min(h[u + 0] * E, 65504)), f[g + 1] = X.toHalfFloat(Math.min(h[u + 1] * E, 65504)), f[g + 2] = X.toHalfFloat(Math.min(h[u + 2] * E, 65504)), f[g + 3] = X.toHalfFloat(1);
758
- }, o = new Uint8Array(t);
759
- o.pos = 0;
760
- const s = O(o), D = s.width, B = s.height, R = C(o.subarray(o.pos), D, B);
761
- let A, I, N;
762
- switch (this.type) {
763
- case q:
764
- N = R.length / 4;
765
- const h = new Float32Array(N * 4);
766
- for (let f = 0; f < N; f++)
767
- v(R, f * 4, h, f * 4);
768
- A = h, I = q;
769
- break;
770
- case W:
771
- N = R.length / 4;
772
- const u = new Uint16Array(N * 4);
773
- for (let f = 0; f < N; f++)
774
- k(R, f * 4, u, f * 4);
775
- A = u, I = W;
776
- break;
777
- default:
778
- throw new Error("THREE.RGBELoader: Unsupported type: " + this.type);
779
- }
780
- return {
781
- width: D,
782
- height: B,
783
- data: A,
784
- header: s.string,
785
- gamma: s.gamma,
786
- exposure: s.exposure,
787
- type: I
788
- };
789
- }
790
- /**
791
- * Sets the texture type.
792
- *
793
- * @param {(HalfFloatType|FloatType)} value - The texture type to set.
794
- * @return {RGBELoader} A reference to this loader.
795
- */
796
- setDataType(t) {
797
- return this.type = t, this;
798
- }
799
- load(t, e, n, l) {
800
- function p(a, y) {
801
- switch (a.type) {
802
- case q:
803
- case W:
804
- a.colorSpace = Mt, a.minFilter = ot, a.magFilter = ot, a.generateMipmaps = !1, a.flipY = !0;
805
- break;
806
- }
807
- e && e(a, y);
808
- }
809
- return super.load(t, p, n, l);
810
- }
811
- }
812
- const Wt = (i) => {
813
- i.geometry && i.geometry.dispose(), i.material && (Array.isArray(i.material) ? i.material.forEach((t) => {
814
- lt(t);
815
- }) : lt(i.material)), i.children && i.children.forEach((t) => Wt(t));
816
- };
817
- function lt(i) {
818
- for (const t in i)
819
- i[t] && i[t].isTexture && i[t].dispose();
820
- i.dispose();
821
- }
822
- const Q = {}, ut = new Kt();
823
- async function ae(i, t) {
824
- if (t) {
825
- if (Q[t]) {
826
- const e = Q[t];
827
- i.environment = e;
828
- return;
829
- }
830
- return new Promise((e, n) => {
831
- ut.load(t, e, void 0, n);
832
- }).then((e) => {
833
- e.mapping = xt, i.environment = e, Q[t] = e;
834
- }).catch((e) => {
835
- console.log(" =====> e:", e);
836
- });
837
- }
838
- }
839
- async function re(i) {
840
- return new Promise((t, e) => {
841
- ut.load(i, t, void 0, e);
842
- });
843
- }
844
- export {
845
- qt as C,
846
- re as I,
847
- K as S,
848
- Qt as a,
849
- Jt as b,
850
- $t as c,
851
- te as d,
852
- ee as e,
853
- ie as f,
854
- se as g,
855
- oe as h,
856
- ne as i,
857
- Wt as j,
858
- ae as k,
859
- Vt as l
860
- };