gl-draw 0.16.0-beta.26 → 0.16.0-beta.27
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/dist/index.module.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, St = Object.defineProperties;
|
|
2
|
+
var At = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Me = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Re = (c, e, t) => e in c ?
|
|
4
|
+
var Mt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Re = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, U = (c, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
Mt.call(e, t) && Re(c, t, e[t]);
|
|
8
8
|
if (Me)
|
|
9
9
|
for (var t of Me(e))
|
|
10
|
-
|
|
10
|
+
Rt.call(e, t) && Re(c, t, e[t]);
|
|
11
11
|
return c;
|
|
12
|
-
}, te = (c, e) =>
|
|
12
|
+
}, te = (c, e) => St(c, At(e));
|
|
13
13
|
var se = (c, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (a) => {
|
|
15
15
|
try {
|
|
@@ -27,14 +27,14 @@ var se = (c, e, t) => new Promise((s, i) => {
|
|
|
27
27
|
n((t = t.apply(c, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as Ce from "@tweenjs/tween.js";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import { Vector3 as
|
|
33
|
-
import { M as
|
|
34
|
-
import { EffectComposer as
|
|
35
|
-
import { RenderPass as
|
|
36
|
-
import { SSAOPass as
|
|
37
|
-
import { UnrealBloomPass as
|
|
30
|
+
import Dt from "deepmerge";
|
|
31
|
+
import Ut from "stats-gl";
|
|
32
|
+
import { Vector3 as H, PerspectiveCamera as zt, Matrix4 as W, ShaderMaterial as kt, UniformsUtils as Ft, RawShaderMaterial as Nt, MeshBasicMaterial as It, PointsMaterial as nt, SpriteMaterial as at, Color as Ht, Layers as jt, Vector2 as B, WebGLRenderTarget as Bt, HalfFloatType as Vt, MathUtils as Yt, Vector4 as Zt, Quaternion as lt, Spherical as Wt, Box3 as ht, Sphere as Kt, Raycaster as ct, AxesHelper as De, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as Ue, Scene as dt, Group as ze, Camera as Jt, Loader as pt, FileLoader as Se, Texture as fe, VideoTexture as es, LoadingManager as ts, DataTexture as ss, WebGLRenderer as is, REVISION as rs, Object3D as os, Timer as ns } from "three";
|
|
33
|
+
import { M as mt, B as Oe, a as as, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
|
|
34
|
+
import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
|
+
import { RenderPass as ls } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
|
+
import { SSAOPass as hs } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
|
+
import { UnrealBloomPass as cs } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
38
38
|
import "three/examples/jsm/lines/LineMaterial";
|
|
39
39
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
40
40
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
@@ -45,15 +45,15 @@ import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
|
45
45
|
import "three-bvh-csg";
|
|
46
46
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
47
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
48
|
-
import { ShaderPass as
|
|
49
|
-
import { OutputPass as
|
|
48
|
+
import { ShaderPass as ds } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
49
|
+
import { OutputPass as ps } from "three/examples/jsm/postprocessing/OutputPass";
|
|
50
50
|
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
51
|
-
import { RectAreaLightHelper as
|
|
51
|
+
import { RectAreaLightHelper as ms } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
52
|
import { ViewHelper as us } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
|
-
import { generateUUID as
|
|
53
|
+
import { generateUUID as fs, makePromiseCreator as _s } from "esus-lite";
|
|
54
54
|
import { DRACOLoader as gs } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
55
|
import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
|
-
import { GLTFLoader as
|
|
56
|
+
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
57
|
import { LottieLoader as vs } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
58
|
import { a as Cs, C as Os, i as Es } from "./isPlainObject.module.js";
|
|
59
59
|
import { TransformControls as Ts } from "three/examples/jsm/controls/TransformControls";
|
|
@@ -91,11 +91,11 @@ const M = {
|
|
|
91
91
|
function Y(c) {
|
|
92
92
|
return c.isPerspectiveCamera;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function j(c) {
|
|
95
95
|
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2,
|
|
98
|
-
function
|
|
97
|
+
const $ = Math.PI * 2, Ie = Math.PI / 2, ut = 1e-5, ie = Math.PI / 180;
|
|
98
|
+
function k(c, e, t) {
|
|
99
99
|
return Math.max(e, Math.min(t, c));
|
|
100
100
|
}
|
|
101
101
|
function A(c, e = ut) {
|
|
@@ -118,26 +118,26 @@ function ce(c, e, t, s, i = 1 / 0, r) {
|
|
|
118
118
|
const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
119
119
|
let h = c - e;
|
|
120
120
|
const m = e, p = i * s;
|
|
121
|
-
h =
|
|
121
|
+
h = k(h, -p, p), e = c - h;
|
|
122
122
|
const v = (t.value + o * h) * r;
|
|
123
123
|
t.value = (t.value - o * v) * a;
|
|
124
124
|
let _ = e + (h + v) * a;
|
|
125
125
|
return m - c > 0 == _ > m && (_ = m, t.value = (_ - m) / r), _;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function je(c, e, t, s, i = 1 / 0, r, o) {
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
129
|
const n = 2 / s, a = n * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
|
-
let m = e.x, p = e.y, v = e.z, _ = c.x - m,
|
|
131
|
-
const y = m, l = p,
|
|
130
|
+
let m = e.x, p = e.y, v = e.z, _ = c.x - m, u = c.y - p, g = c.z - v;
|
|
131
|
+
const y = m, l = p, f = v, O = i * s, C = O * O, w = _ * _ + u * u + g * g;
|
|
132
132
|
if (w > C) {
|
|
133
133
|
const ve = Math.sqrt(w);
|
|
134
|
-
_ = _ / ve * O,
|
|
134
|
+
_ = _ / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
135
|
}
|
|
136
|
-
m = c.x - _, p = c.y -
|
|
137
|
-
const E = (t.x + n * _) * r,
|
|
138
|
-
t.x = (t.x - n * E) * h, t.y = (t.y - n *
|
|
139
|
-
const V = y - c.x, le = l - c.y,
|
|
140
|
-
return V * xt + le *
|
|
136
|
+
m = c.x - _, p = c.y - u, v = c.z - g;
|
|
137
|
+
const E = (t.x + n * _) * r, b = (t.y + n * u) * r, R = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * h, t.y = (t.y - n * b) * h, t.z = (t.z - n * R) * h, o.x = m + (_ + E) * h, o.y = p + (u + b) * h, o.z = v + (g + R) * h;
|
|
139
|
+
const V = y - c.x, le = l - c.y, wt = f - c.z, xt = o.x - y, bt = o.y - l, Lt = o.z - f;
|
|
140
|
+
return V * xt + le * bt + wt * Lt > 0 && (o.x = y, o.y = l, o.z = f, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - f) / r), o;
|
|
141
141
|
}
|
|
142
142
|
function Ee(c, e) {
|
|
143
143
|
e.set(0, 0), c.forEach((t) => {
|
|
@@ -145,7 +145,7 @@ function Ee(c, e) {
|
|
|
145
145
|
}), e.x /= c.length, e.y /= c.length;
|
|
146
146
|
}
|
|
147
147
|
function Te(c, e) {
|
|
148
|
-
return
|
|
148
|
+
return j(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
150
|
class ws {
|
|
151
151
|
constructor() {
|
|
@@ -211,11 +211,11 @@ class ws {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const de = 1 / 8,
|
|
215
|
-
let T,
|
|
214
|
+
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
+
let T, Be, pe, we, D, x, L, G, ne, F, N, Z, Ve, Ye, z, ae, X, Ze, xe, We, be, Le, me;
|
|
216
216
|
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE,
|
|
218
|
+
T = e.THREE, Be = Object.freeze(new T.Vector3(0, 0, 0)), pe = Object.freeze(new T.Vector3(0, 1, 0)), we = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), x = new T.Vector3(), L = new T.Vector3(), G = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Ve = new T.Vector3(), Ye = new T.Vector3(), z = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), Ze = new T.Box3(), xe = new T.Sphere(), We = new T.Quaternion(), be = new T.Quaternion(), Le = new T.Matrix4(), me = new T.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -243,14 +243,14 @@ class J extends ws {
|
|
|
243
243
|
*/
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
246
|
-
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l,
|
|
246
|
+
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, f, O, C) => {
|
|
247
247
|
let w, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const
|
|
250
|
-
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed *
|
|
251
|
-
} else if (
|
|
252
|
-
const
|
|
253
|
-
w = this.truckSpeed * l * (
|
|
249
|
+
const b = x.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = b.length() * Math.tan(R * 0.5);
|
|
250
|
+
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * f * V / this._elementRect.height;
|
|
251
|
+
} else if (j(this._camera)) {
|
|
252
|
+
const b = this._camera;
|
|
253
|
+
w = this.truckSpeed * l * (b.right - b.left) / b.zoom / this._elementRect.width, E = this.truckSpeed * f * (b.top - b.bottom) / b.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
256
|
C ? (O ? this.setFocalOffset(
|
|
@@ -264,26 +264,26 @@ class J extends ws {
|
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
266
|
) : this.truck(w, E, !0);
|
|
267
|
-
}, this._rotateInternal = (l,
|
|
268
|
-
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed *
|
|
267
|
+
}, this._rotateInternal = (l, f) => {
|
|
268
|
+
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * f / this._elementRect.height;
|
|
269
269
|
this.rotate(O, C, !0);
|
|
270
|
-
}, this._dollyInternal = (l,
|
|
271
|
-
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C,
|
|
270
|
+
}, this._dollyInternal = (l, f, O) => {
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, b = k(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
|
-
), R =
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(
|
|
277
|
-
}, this._zoomInternal = (l,
|
|
275
|
+
), R = b - E;
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(b, !0)) : this._dollyToNoClamp(b, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : b) - w, this._dollyControlCoord.set(f, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
|
+
}, this._zoomInternal = (l, f, O) => {
|
|
278
278
|
const C = Math.pow(0.95, l * this.dollySpeed), w = this._zoom, E = this._zoom * C;
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(f, O));
|
|
280
280
|
}, typeof T == "undefined" && console.error(
|
|
281
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
282
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
285
|
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
286
|
-
|
|
286
|
+
x.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
288
|
new T.Vector3(),
|
|
289
289
|
new T.Vector3(),
|
|
@@ -296,10 +296,10 @@ class J extends ws {
|
|
|
296
296
|
left: d.ROTATE,
|
|
297
297
|
middle: d.DOLLY,
|
|
298
298
|
right: d.TRUCK,
|
|
299
|
-
wheel: Y(this._camera) ? d.DOLLY :
|
|
299
|
+
wheel: Y(this._camera) ? d.DOLLY : j(this._camera) ? d.ZOOM : d.NONE
|
|
300
300
|
}, this.touches = {
|
|
301
301
|
one: d.TOUCH_ROTATE,
|
|
302
|
-
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK :
|
|
302
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : j(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
303
303
|
three: d.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
@@ -309,9 +309,9 @@ class J extends ws {
|
|
|
309
309
|
if (w < this._interactiveArea.left || w > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
const C = this._findPointerByMouseButton(
|
|
312
|
+
const f = l.pointerType !== "mouse" ? null : (l.buttons & M.LEFT) === M.LEFT ? M.LEFT : (l.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (l.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
|
|
313
|
+
if (f !== null) {
|
|
314
|
+
const C = this._findPointerByMouseButton(f);
|
|
315
315
|
C && this._disposePointer(C);
|
|
316
316
|
}
|
|
317
317
|
if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
@@ -322,7 +322,7 @@ class J extends ws {
|
|
|
322
322
|
clientY: l.clientY,
|
|
323
323
|
deltaX: 0,
|
|
324
324
|
deltaY: 0,
|
|
325
|
-
mouseButton:
|
|
325
|
+
mouseButton: f
|
|
326
326
|
};
|
|
327
327
|
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener(
|
|
328
328
|
"pointermove",
|
|
@@ -338,7 +338,7 @@ class J extends ws {
|
|
|
338
338
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, v(l);
|
|
339
339
|
}, n = (l) => {
|
|
340
340
|
l.cancelable && l.preventDefault();
|
|
341
|
-
const
|
|
341
|
+
const f = l.pointerId, O = this._lockedPointer || this._findPointerById(f);
|
|
342
342
|
if (O) {
|
|
343
343
|
if (O.clientX = l.clientX, O.clientY = l.clientY, O.deltaX = l.movementX, O.deltaY = l.movementY, this._state = 0, l.pointerType === "touch")
|
|
344
344
|
switch (this._activePointers.length) {
|
|
@@ -357,9 +357,9 @@ class J extends ws {
|
|
|
357
357
|
_();
|
|
358
358
|
}
|
|
359
359
|
}, a = (l) => {
|
|
360
|
-
const
|
|
361
|
-
if (!(
|
|
362
|
-
if (
|
|
360
|
+
const f = this._findPointerById(l.pointerId);
|
|
361
|
+
if (!(f && f === this._lockedPointer)) {
|
|
362
|
+
if (f && this._disposePointer(f), l.pointerType === "touch")
|
|
363
363
|
switch (this._activePointers.length) {
|
|
364
364
|
case 0:
|
|
365
365
|
this._state = d.NONE;
|
|
@@ -376,22 +376,22 @@ class J extends ws {
|
|
|
376
376
|
}
|
|
377
377
|
else
|
|
378
378
|
this._state = d.NONE;
|
|
379
|
-
|
|
379
|
+
u();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
let h = -1;
|
|
383
383
|
const m = (l) => {
|
|
384
384
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
385
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
386
|
-
const E = this._domElement.getBoundingClientRect(),
|
|
387
|
-
if (
|
|
386
|
+
const E = this._domElement.getBoundingClientRect(), b = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
387
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
|
|
391
391
|
const E = performance.now();
|
|
392
392
|
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const f = xs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / f : l.deltaY / (f * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
396
|
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -422,7 +422,7 @@ class J extends ws {
|
|
|
422
422
|
}, p = (l) => {
|
|
423
423
|
if (!(!this._domElement || !this._enabled)) {
|
|
424
424
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
425
|
-
const
|
|
425
|
+
const f = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(f);
|
|
426
426
|
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener(
|
|
427
427
|
"pointermove",
|
|
428
428
|
n,
|
|
@@ -440,8 +440,8 @@ class J extends ws {
|
|
|
440
440
|
if (Ee(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
441
441
|
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
|
|
442
442
|
r.set(0, w);
|
|
443
|
-
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
444
|
-
i.set(E,
|
|
443
|
+
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, b = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
444
|
+
i.set(E, b);
|
|
445
445
|
}
|
|
446
446
|
if (this._state = 0, !l)
|
|
447
447
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
@@ -463,27 +463,27 @@ class J extends ws {
|
|
|
463
463
|
}, _ = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
465
|
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
466
|
-
const
|
|
466
|
+
const f = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = f ? -f.deltaX : i.x - D.x, C = f ? -f.deltaY : i.y - D.y;
|
|
467
467
|
if (i.copy(D), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
-
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0,
|
|
468
|
+
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, b = this.dollyDragInverted ? -1 : 1;
|
|
469
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
470
|
-
|
|
470
|
+
b * C * de,
|
|
471
471
|
w,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
|
-
|
|
474
|
+
b * C * de,
|
|
475
475
|
w,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
479
|
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
480
|
-
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY,
|
|
481
|
-
r.set(0,
|
|
480
|
+
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, b = Math.sqrt(w * w + E * E), R = r.y - b;
|
|
481
|
+
r.set(0, b);
|
|
482
482
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
483
483
|
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
485
485
|
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
|
-
},
|
|
486
|
+
}, u = () => {
|
|
487
487
|
Ee(this._activePointers, D), i.copy(D), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
|
|
488
488
|
"pointermove",
|
|
489
489
|
n,
|
|
@@ -520,8 +520,8 @@ class J extends ws {
|
|
|
520
520
|
{ passive: !1 }
|
|
521
521
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), v());
|
|
522
522
|
}, this.unlockPointer = () => {
|
|
523
|
-
var l,
|
|
524
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (
|
|
523
|
+
var l, f, O;
|
|
524
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (f = this._domElement) === null || f === void 0 || f.ownerDocument.removeEventListener(
|
|
525
525
|
"pointerlockchange",
|
|
526
526
|
g
|
|
527
527
|
), (O = this._domElement) === null || O === void 0 || O.ownerDocument.removeEventListener(
|
|
@@ -556,7 +556,7 @@ class J extends ws {
|
|
|
556
556
|
y
|
|
557
557
|
));
|
|
558
558
|
}, this.cancel = () => {
|
|
559
|
-
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0,
|
|
559
|
+
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
|
|
560
560
|
}, t && this.connect(t), this.update(0);
|
|
561
561
|
}
|
|
562
562
|
/**
|
|
@@ -646,11 +646,11 @@ class J extends ws {
|
|
|
646
646
|
* @category Properties
|
|
647
647
|
*/
|
|
648
648
|
set interactiveArea(e) {
|
|
649
|
-
this._interactiveArea.width =
|
|
649
|
+
this._interactiveArea.width = k(e.width, 0, 1), this._interactiveArea.height = k(e.height, 0, 1), this._interactiveArea.x = k(
|
|
650
650
|
e.x,
|
|
651
651
|
0,
|
|
652
652
|
1 - this._interactiveArea.width
|
|
653
|
-
), this._interactiveArea.y =
|
|
653
|
+
), this._interactiveArea.y = k(
|
|
654
654
|
e.y,
|
|
655
655
|
0,
|
|
656
656
|
1 - this._interactiveArea.height
|
|
@@ -788,11 +788,11 @@ class J extends ws {
|
|
|
788
788
|
*/
|
|
789
789
|
rotateTo(e, t, s = !1) {
|
|
790
790
|
this._isUserControllingRotate = !1;
|
|
791
|
-
const i =
|
|
791
|
+
const i = k(
|
|
792
792
|
e,
|
|
793
793
|
this.minAzimuthAngle,
|
|
794
794
|
this.maxAzimuthAngle
|
|
795
|
-
), r =
|
|
795
|
+
), r = k(t, this.minPolarAngle, this.maxPolarAngle);
|
|
796
796
|
this._sphericalEnd.theta = i, this._sphericalEnd.phi = r, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, s || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi);
|
|
797
797
|
const o = !s || P(
|
|
798
798
|
this._spherical.theta,
|
|
@@ -822,7 +822,7 @@ class J extends ws {
|
|
|
822
822
|
*/
|
|
823
823
|
dollyTo(e, t = !1) {
|
|
824
824
|
return this._isUserControllingDolly = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0, this._dollyToNoClamp(
|
|
825
|
-
|
|
825
|
+
k(e, this.minDistance, this.maxDistance),
|
|
826
826
|
t
|
|
827
827
|
);
|
|
828
828
|
}
|
|
@@ -880,7 +880,7 @@ class J extends ws {
|
|
|
880
880
|
* @category Methods
|
|
881
881
|
*/
|
|
882
882
|
zoomTo(e, t = !1) {
|
|
883
|
-
this._isUserControllingZoom = !1, this._zoomEnd =
|
|
883
|
+
this._isUserControllingZoom = !1, this._zoomEnd = k(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
|
|
884
884
|
const s = !t || P(this._zoom, this._zoomEnd, this.restThreshold);
|
|
885
885
|
return this._changedZoom = 0, this._createOnRestPromise(s);
|
|
886
886
|
}
|
|
@@ -900,7 +900,7 @@ class J extends ws {
|
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
902
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
903
|
-
const i =
|
|
903
|
+
const i = x.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -910,8 +910,8 @@ class J extends ws {
|
|
|
910
910
|
* @category Methods
|
|
911
911
|
*/
|
|
912
912
|
forward(e, t = !1) {
|
|
913
|
-
|
|
914
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
x.setFromMatrixColumn(this._camera.matrix, 0), x.crossVectors(this._camera.up, x), x.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(x);
|
|
915
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -921,10 +921,10 @@ class J extends ws {
|
|
|
921
921
|
* @category Methods
|
|
922
922
|
*/
|
|
923
923
|
elevate(e, t = !1) {
|
|
924
|
-
return
|
|
925
|
-
this._targetEnd.x +
|
|
926
|
-
this._targetEnd.y +
|
|
927
|
-
this._targetEnd.z +
|
|
924
|
+
return x.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
925
|
+
this._targetEnd.x + x.x,
|
|
926
|
+
this._targetEnd.y + x.y,
|
|
927
|
+
this._targetEnd.z + x.z,
|
|
928
928
|
t
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -938,7 +938,7 @@ class J extends ws {
|
|
|
938
938
|
*/
|
|
939
939
|
moveTo(e, t, s, i = !1) {
|
|
940
940
|
this._isUserControllingTruck = !1;
|
|
941
|
-
const r =
|
|
941
|
+
const r = x.set(e, t, s).sub(this._targetEnd);
|
|
942
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
943
943
|
const o = !i || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
944
944
|
return this._createOnRestPromise(o);
|
|
@@ -953,7 +953,7 @@ class J extends ws {
|
|
|
953
953
|
* @category Methods
|
|
954
954
|
*/
|
|
955
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
956
|
-
const n =
|
|
956
|
+
const n = x.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
957
957
|
return this.setPosition(
|
|
958
958
|
n.x,
|
|
959
959
|
n.y,
|
|
@@ -985,15 +985,15 @@ class J extends ws {
|
|
|
985
985
|
h.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const m = He(this._sphericalEnd.theta,
|
|
988
|
+
const m = He(this._sphericalEnd.theta, Ie), p = He(this._sphericalEnd.phi, Ie);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const v =
|
|
991
|
-
|
|
992
|
-
const g =
|
|
993
|
-
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(we, v),
|
|
994
|
-
const y = g.getSize(
|
|
990
|
+
const v = x.setFromSpherical(this._sphericalEnd).normalize(), _ = We.setFromUnitVectors(v, we), u = P(Math.abs(v.y), 1);
|
|
991
|
+
u && _.multiply(be.setFromAxisAngle(pe, m)), _.multiply(this._yAxisUpSpaceInverse);
|
|
992
|
+
const g = Ze.makeEmpty();
|
|
993
|
+
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(we, v), u && _.premultiply(be.invert()), _.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(x), l = g.getCenter(L).applyQuaternion(_);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
|
-
const
|
|
996
|
+
const f = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
998
998
|
y.y,
|
|
999
999
|
y.z,
|
|
@@ -1001,9 +1001,9 @@ class J extends ws {
|
|
|
1001
1001
|
);
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
|
-
), a.push(this.dollyTo(
|
|
1005
|
-
} else if (
|
|
1006
|
-
const
|
|
1004
|
+
), a.push(this.dollyTo(f, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
|
+
} else if (j(this._camera)) {
|
|
1006
|
+
const f = this._camera, O = f.right - f.left, C = f.top - f.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1009
1009
|
), a.push(this.zoomTo(w, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
@@ -1017,7 +1017,7 @@ class J extends ws {
|
|
|
1017
1017
|
* @category Methods
|
|
1018
1018
|
*/
|
|
1019
1019
|
fitToSphere(e, t) {
|
|
1020
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1020
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, xe) : xe.copy(e);
|
|
1021
1021
|
if (s.push(
|
|
1022
1022
|
this.moveTo(
|
|
1023
1023
|
r.center.x,
|
|
@@ -1028,7 +1028,7 @@ class J extends ws {
|
|
|
1028
1028
|
), Y(this._camera)) {
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
|
-
} else if (
|
|
1031
|
+
} else if (j(this._camera)) {
|
|
1032
1032
|
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, h = Math.min(o / a, n / a);
|
|
1033
1033
|
s.push(this.zoomTo(h, t));
|
|
1034
1034
|
}
|
|
@@ -1047,7 +1047,7 @@ class J extends ws {
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1049
1049
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1050
|
-
const a = L.set(i, r, o), h =
|
|
1050
|
+
const a = L.set(i, r, o), h = x.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
1052
|
h.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -1084,23 +1084,23 @@ class J extends ws {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, _,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, _, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g =
|
|
1090
|
-
|
|
1089
|
+
const g = x.set(i, r, o), y = L.set(e, t, s);
|
|
1090
|
+
z.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(m, p, v),
|
|
1093
|
+
const l = G.set(m, p, v), f = L.set(n, a, h);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
|
-
|
|
1095
|
+
f.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
1096
|
), this._targetEnd.copy(g.lerp(l, _));
|
|
1097
|
-
const O = ae.theta -
|
|
1097
|
+
const O = ae.theta - z.theta, C = ae.phi - z.phi, w = ae.radius - z.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1103
|
-
const E = !
|
|
1099
|
+
z.radius + w * _,
|
|
1100
|
+
z.phi + C * _,
|
|
1101
|
+
z.theta + O * _
|
|
1102
|
+
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
|
+
const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
1105
1105
|
this._sphericalEnd.theta,
|
|
1106
1106
|
this.restThreshold
|
|
@@ -1145,7 +1145,7 @@ class J extends ws {
|
|
|
1145
1145
|
* @category Methods
|
|
1146
1146
|
*/
|
|
1147
1147
|
setTarget(e, t, s, i = !1) {
|
|
1148
|
-
const r = this.getPosition(
|
|
1148
|
+
const r = this.getPosition(x), o = this.setLookAt(
|
|
1149
1149
|
r.x,
|
|
1150
1150
|
r.y,
|
|
1151
1151
|
r.z,
|
|
@@ -1154,7 +1154,7 @@ class J extends ws {
|
|
|
1154
1154
|
s,
|
|
1155
1155
|
i
|
|
1156
1156
|
);
|
|
1157
|
-
return this._sphericalEnd.phi =
|
|
1157
|
+
return this._sphericalEnd.phi = k(
|
|
1158
1158
|
this._sphericalEnd.phi,
|
|
1159
1159
|
this.minPolarAngle,
|
|
1160
1160
|
this.maxPolarAngle
|
|
@@ -1195,8 +1195,8 @@ class J extends ws {
|
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
1197
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1198
|
-
const i =
|
|
1199
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1198
|
+
const i = x.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1199
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), x.copy(F).add(N).add(Z), x.z = x.z + r, this.dollyTo(r, !1), this.setFocalOffset(-x.x, x.y, -x.z, !1), this.moveTo(e, t, s, !1);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1311,7 +1311,7 @@ class J extends ws {
|
|
|
1311
1311
|
reset(e = !1) {
|
|
1312
1312
|
if (!P(this._camera.up.x, this._cameraUp0.x) || !P(this._camera.up.y, this._cameraUp0.y) || !P(this._camera.up.z, this._cameraUp0.z)) {
|
|
1313
1313
|
this._camera.up.copy(this._cameraUp0);
|
|
1314
|
-
const s = this.getPosition(
|
|
1314
|
+
const s = this.getPosition(x);
|
|
1315
1315
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1316
1316
|
}
|
|
1317
1317
|
const t = [
|
|
@@ -1355,9 +1355,9 @@ class J extends ws {
|
|
|
1355
1355
|
* @category Methods
|
|
1356
1356
|
*/
|
|
1357
1357
|
applyCameraUp() {
|
|
1358
|
-
const e =
|
|
1358
|
+
const e = x.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1359
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1360
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(x);
|
|
1361
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
@@ -1368,7 +1368,7 @@ class J extends ws {
|
|
|
1368
1368
|
* @category Methods
|
|
1369
1369
|
*/
|
|
1370
1370
|
update(e) {
|
|
1371
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r =
|
|
1371
|
+
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r = Ve.subVectors(this._targetEnd, this._target), o = Ye.subVectors(
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
@@ -1415,7 +1415,7 @@ class J extends ws {
|
|
|
1415
1415
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1416
1416
|
else {
|
|
1417
1417
|
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1418
|
-
|
|
1418
|
+
je(
|
|
1419
1419
|
this._target,
|
|
1420
1420
|
this._targetEnd,
|
|
1421
1421
|
this._targetVelocity,
|
|
@@ -1429,7 +1429,7 @@ class J extends ws {
|
|
|
1429
1429
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1430
1430
|
else {
|
|
1431
1431
|
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1432
|
-
|
|
1432
|
+
je(
|
|
1433
1433
|
this._focalOffset,
|
|
1434
1434
|
this._focalOffsetEnd,
|
|
1435
1435
|
this._focalOffsetVelocity,
|
|
@@ -1454,41 +1454,41 @@ class J extends ws {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne),
|
|
1458
|
-
|
|
1459
|
-
const g = L.crossVectors(
|
|
1460
|
-
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne), u = x.copy(_).cross(v.up).normalize();
|
|
1458
|
+
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
+
const g = L.crossVectors(u, _), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), f = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
|
+
u.multiplyScalar(
|
|
1461
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
), C =
|
|
1465
|
+
), C = x.copy(this._targetEnd).lerp(O, f), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
1466
|
if (this.infinityDolly && (w || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
1468
|
const R = L.copy(_).multiplyScalar(-p);
|
|
1469
1469
|
C.add(R);
|
|
1470
1470
|
}
|
|
1471
1471
|
this._boundary.clampPoint(C, C);
|
|
1472
|
-
const
|
|
1473
|
-
this._targetEnd.copy(C), this._target.add(
|
|
1474
|
-
} else if (
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera, _ =
|
|
1472
|
+
const b = L.subVectors(C, this._targetEnd);
|
|
1473
|
+
this._targetEnd.copy(C), this._target.add(b), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
|
+
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, _ = x.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v),
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(u.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, f = this._getCameraDirection(ne), O = this._targetEnd.dot(f), C = x.copy(this._targetEnd).lerp(g, l), w = C.dot(f), E = f.multiplyScalar(
|
|
1480
1480
|
w - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1483
|
-
const
|
|
1484
|
-
this._targetEnd.copy(C), this._target.add(
|
|
1483
|
+
const b = L.subVectors(C, this._targetEnd);
|
|
1484
|
+
this._targetEnd.copy(C), this._target.add(b), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1488
1488
|
const a = this._collisionTest();
|
|
1489
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z),
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), x.copy(F).add(N).add(Z), this._camera.position.add(x), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
|
-
|
|
1491
|
+
x.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const m = this._needsUpdate;
|
|
@@ -1515,7 +1515,7 @@ class J extends ws {
|
|
|
1515
1515
|
truckSpeed: this.truckSpeed,
|
|
1516
1516
|
dollyToCursor: this.dollyToCursor,
|
|
1517
1517
|
target: this._targetEnd.toArray(),
|
|
1518
|
-
position:
|
|
1518
|
+
position: x.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1519
1519
|
zoom: this._zoomEnd,
|
|
1520
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1521
1521
|
target0: this._target0.toArray(),
|
|
@@ -1532,9 +1532,9 @@ class J extends ws {
|
|
|
1532
1532
|
*/
|
|
1533
1533
|
fromJSON(e, t = !1) {
|
|
1534
1534
|
const s = JSON.parse(e);
|
|
1535
|
-
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t),
|
|
1536
|
-
|
|
1537
|
-
), this.rotateTo(
|
|
1535
|
+
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), z.setFromVector3(
|
|
1536
|
+
x.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1537
|
+
), this.rotateTo(z.theta, z.phi, t), this.dollyTo(z.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1538
1538
|
s.focalOffset[0],
|
|
1539
1539
|
s.focalOffset[1],
|
|
1540
1540
|
s.focalOffset[2],
|
|
@@ -1606,7 +1606,7 @@ class J extends ws {
|
|
|
1606
1606
|
if (Y(this._camera)) {
|
|
1607
1607
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1608
1608
|
this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
|
|
1609
|
-
} else if (
|
|
1609
|
+
} else if (j(this._camera)) {
|
|
1610
1610
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
1611
1611
|
this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
|
|
1612
1612
|
}
|
|
@@ -1617,7 +1617,7 @@ class J extends ws {
|
|
|
1617
1617
|
if (!(this.colliderMeshes.length >= 1) || Te(this._camera, "_collisionTest"))
|
|
1618
1618
|
return e;
|
|
1619
1619
|
const s = this._getTargetDirection(ne);
|
|
1620
|
-
Le.lookAt(
|
|
1620
|
+
Le.lookAt(Be, s, this._camera.up);
|
|
1621
1621
|
for (let i = 0; i < 4; i++) {
|
|
1622
1622
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1623
1623
|
r.applyMatrix4(Le);
|
|
@@ -1703,22 +1703,22 @@ class J extends ws {
|
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
1704
|
const m = a.attributes.position;
|
|
1705
1705
|
for (let p = 0, v = m.count; p < v; p++)
|
|
1706
|
-
|
|
1706
|
+
x.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(x));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null,
|
|
1710
|
+
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ke = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1711
1711
|
return Function.prototype.apply.call(e, t, s);
|
|
1712
|
-
},
|
|
1713
|
-
Q && typeof Q.ownKeys == "function" ?
|
|
1712
|
+
}, ue;
|
|
1713
|
+
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
1714
1714
|
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
1715
|
-
} :
|
|
1715
|
+
} : ue = function(e) {
|
|
1716
1716
|
return Object.getOwnPropertyNames(e);
|
|
1717
1717
|
};
|
|
1718
|
-
function
|
|
1718
|
+
function bs(c) {
|
|
1719
1719
|
console && console.warn && console.warn(c);
|
|
1720
1720
|
}
|
|
1721
|
-
var
|
|
1721
|
+
var ft = Number.isNaN || function(e) {
|
|
1722
1722
|
return e !== e;
|
|
1723
1723
|
};
|
|
1724
1724
|
function S() {
|
|
@@ -1730,7 +1730,7 @@ S.EventEmitter = S;
|
|
|
1730
1730
|
S.prototype._events = void 0;
|
|
1731
1731
|
S.prototype._eventsCount = 0;
|
|
1732
1732
|
S.prototype._maxListeners = void 0;
|
|
1733
|
-
var
|
|
1733
|
+
var $e = 10;
|
|
1734
1734
|
function ge(c) {
|
|
1735
1735
|
if (typeof c != "function")
|
|
1736
1736
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof c);
|
|
@@ -1738,27 +1738,27 @@ function ge(c) {
|
|
|
1738
1738
|
Object.defineProperty(S, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
|
-
return
|
|
1741
|
+
return $e;
|
|
1742
1742
|
},
|
|
1743
1743
|
set: function(c) {
|
|
1744
|
-
if (typeof c != "number" || c < 0 ||
|
|
1744
|
+
if (typeof c != "number" || c < 0 || ft(c))
|
|
1745
1745
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + c + ".");
|
|
1746
|
-
|
|
1746
|
+
$e = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
S.init = function() {
|
|
1750
1750
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
1751
1751
|
};
|
|
1752
1752
|
S.prototype.setMaxListeners = function(e) {
|
|
1753
|
-
if (typeof e != "number" || e < 0 ||
|
|
1753
|
+
if (typeof e != "number" || e < 0 || ft(e))
|
|
1754
1754
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1755
1755
|
return this._maxListeners = e, this;
|
|
1756
1756
|
};
|
|
1757
|
-
function
|
|
1757
|
+
function _t(c) {
|
|
1758
1758
|
return c._maxListeners === void 0 ? S.defaultMaxListeners : c._maxListeners;
|
|
1759
1759
|
}
|
|
1760
1760
|
S.prototype.getMaxListeners = function() {
|
|
1761
|
-
return
|
|
1761
|
+
return _t(this);
|
|
1762
1762
|
};
|
|
1763
1763
|
S.prototype.emit = function(e) {
|
|
1764
1764
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
@@ -1778,13 +1778,13 @@ S.prototype.emit = function(e) {
|
|
|
1778
1778
|
if (a === void 0)
|
|
1779
1779
|
return !1;
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
|
-
|
|
1781
|
+
Ke(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var h = a.length, m =
|
|
1784
|
-
|
|
1783
|
+
for (var h = a.length, m = Ot(a, h), s = 0; s < h; ++s)
|
|
1784
|
+
Ke(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
|
-
function
|
|
1787
|
+
function gt(c, e, t, s) {
|
|
1788
1788
|
var i, r, o;
|
|
1789
1789
|
if (ge(t), r = c._events, r === void 0 ? (r = c._events = /* @__PURE__ */ Object.create(null), c._eventsCount = 0) : (r.newListener !== void 0 && (c.emit(
|
|
1790
1790
|
"newListener",
|
|
@@ -1792,33 +1792,33 @@ function yt(c, e, t, s) {
|
|
|
1792
1792
|
t.listener ? t.listener : t
|
|
1793
1793
|
), r = c._events), o = r[e]), o === void 0)
|
|
1794
1794
|
o = r[e] = t, ++c._eventsCount;
|
|
1795
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i =
|
|
1795
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = _t(c), i > 0 && o.length > i && !o.warned) {
|
|
1796
1796
|
o.warned = !0;
|
|
1797
1797
|
var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1798
|
-
n.name = "MaxListenersExceededWarning", n.emitter = c, n.type = e, n.count = o.length,
|
|
1798
|
+
n.name = "MaxListenersExceededWarning", n.emitter = c, n.type = e, n.count = o.length, bs(n);
|
|
1799
1799
|
}
|
|
1800
1800
|
return c;
|
|
1801
1801
|
}
|
|
1802
1802
|
S.prototype.addListener = function(e, t) {
|
|
1803
|
-
return
|
|
1803
|
+
return gt(this, e, t, !1);
|
|
1804
1804
|
};
|
|
1805
1805
|
S.prototype.on = S.prototype.addListener;
|
|
1806
1806
|
S.prototype.prependListener = function(e, t) {
|
|
1807
|
-
return
|
|
1807
|
+
return gt(this, e, t, !0);
|
|
1808
1808
|
};
|
|
1809
1809
|
function Ls() {
|
|
1810
1810
|
if (!this.fired)
|
|
1811
1811
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1813
|
+
function yt(c, e, t) {
|
|
1814
1814
|
var s = { fired: !1, wrapFn: void 0, target: c, type: e, listener: t }, i = Ls.bind(s);
|
|
1815
1815
|
return i.listener = t, s.wrapFn = i, i;
|
|
1816
1816
|
}
|
|
1817
1817
|
S.prototype.once = function(e, t) {
|
|
1818
|
-
return ge(t), this.on(e,
|
|
1818
|
+
return ge(t), this.on(e, yt(this, e, t)), this;
|
|
1819
1819
|
};
|
|
1820
1820
|
S.prototype.prependOnceListener = function(e, t) {
|
|
1821
|
-
return ge(t), this.prependListener(e,
|
|
1821
|
+
return ge(t), this.prependListener(e, yt(this, e, t)), this;
|
|
1822
1822
|
};
|
|
1823
1823
|
S.prototype.removeListener = function(e, t) {
|
|
1824
1824
|
var s, i, r, o, n;
|
|
@@ -1860,24 +1860,24 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1863
|
+
function vt(c, e, t) {
|
|
1864
1864
|
var s = c._events;
|
|
1865
1865
|
if (s === void 0)
|
|
1866
1866
|
return [];
|
|
1867
1867
|
var i = s[e];
|
|
1868
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ss(i) :
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ss(i) : Ot(i, i.length);
|
|
1869
1869
|
}
|
|
1870
1870
|
S.prototype.listeners = function(e) {
|
|
1871
|
-
return
|
|
1871
|
+
return vt(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
1873
|
S.prototype.rawListeners = function(e) {
|
|
1874
|
-
return
|
|
1874
|
+
return vt(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
1876
|
S.listenerCount = function(c, e) {
|
|
1877
|
-
return typeof c.listenerCount == "function" ? c.listenerCount(e) :
|
|
1877
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(e) : Ct.call(c, e);
|
|
1878
1878
|
};
|
|
1879
|
-
S.prototype.listenerCount =
|
|
1880
|
-
function
|
|
1879
|
+
S.prototype.listenerCount = Ct;
|
|
1880
|
+
function Ct(c) {
|
|
1881
1881
|
var e = this._events;
|
|
1882
1882
|
if (e !== void 0) {
|
|
1883
1883
|
var t = e[c];
|
|
@@ -1889,9 +1889,9 @@ function Ot(c) {
|
|
|
1889
1889
|
return 0;
|
|
1890
1890
|
}
|
|
1891
1891
|
S.prototype.eventNames = function() {
|
|
1892
|
-
return this._eventsCount > 0 ?
|
|
1892
|
+
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function Ot(c, e) {
|
|
1895
1895
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1896
1896
|
t[s] = c[s];
|
|
1897
1897
|
return t;
|
|
@@ -1914,13 +1914,13 @@ function As(c, e) {
|
|
|
1914
1914
|
function r() {
|
|
1915
1915
|
typeof c.removeListener == "function" && c.removeListener("error", i), t([].slice.call(arguments));
|
|
1916
1916
|
}
|
|
1917
|
-
|
|
1917
|
+
Et(c, e, r, { once: !0 }), e !== "error" && Ms(c, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
1920
|
function Ms(c, e, t) {
|
|
1921
|
-
typeof c.on == "function" &&
|
|
1921
|
+
typeof c.on == "function" && Et(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Et(c, e, t, s) {
|
|
1924
1924
|
if (typeof c.on == "function")
|
|
1925
1925
|
s.once ? c.once(e, t) : c.on(e, t);
|
|
1926
1926
|
else if (typeof c.addEventListener == "function")
|
|
@@ -1991,11 +1991,11 @@ class ee {
|
|
|
1991
1991
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
1992
1992
|
}
|
|
1993
1993
|
}
|
|
1994
|
-
const
|
|
1994
|
+
const Tt = {
|
|
1995
1995
|
fov: 45,
|
|
1996
1996
|
near: 1,
|
|
1997
1997
|
far: 1e3,
|
|
1998
|
-
up: new
|
|
1998
|
+
up: new H(0, 1, 0)
|
|
1999
1999
|
};
|
|
2000
2000
|
class Ds extends ee {
|
|
2001
2001
|
constructor(e) {
|
|
@@ -2004,7 +2004,7 @@ class Ds extends ee {
|
|
|
2004
2004
|
get camera() {
|
|
2005
2005
|
return this.controller;
|
|
2006
2006
|
}
|
|
2007
|
-
addPerspectiveCamera(e =
|
|
2007
|
+
addPerspectiveCamera(e = Tt, t) {
|
|
2008
2008
|
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, h = new zt(s, a, r, i);
|
|
2009
2009
|
return h.up = o, this.addController(h, t);
|
|
2010
2010
|
}
|
|
@@ -2078,8 +2078,8 @@ class Ds extends ee {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
2080
|
const Us = (c) => {
|
|
2081
|
-
const e = new
|
|
2082
|
-
new
|
|
2081
|
+
const e = new ds(
|
|
2082
|
+
new kt({
|
|
2083
2083
|
uniforms: {
|
|
2084
2084
|
baseTexture: { value: null },
|
|
2085
2085
|
bloomTexture: { value: c.renderTarget2.texture },
|
|
@@ -2113,7 +2113,7 @@ const Us = (c) => {
|
|
|
2113
2113
|
"baseTexture"
|
|
2114
2114
|
);
|
|
2115
2115
|
return e.needsSwap = !0, e;
|
|
2116
|
-
},
|
|
2116
|
+
}, zs = {
|
|
2117
2117
|
name: "OutputShader",
|
|
2118
2118
|
uniforms: {
|
|
2119
2119
|
tDiffuse: { value: null },
|
|
@@ -2207,11 +2207,11 @@ const Us = (c) => {
|
|
|
2207
2207
|
}`
|
|
2208
2208
|
)
|
|
2209
2209
|
};
|
|
2210
|
-
class
|
|
2210
|
+
class ks extends ps {
|
|
2211
2211
|
constructor() {
|
|
2212
2212
|
super();
|
|
2213
|
-
const e =
|
|
2214
|
-
this.uniforms =
|
|
2213
|
+
const e = zs;
|
|
2214
|
+
this.uniforms = Ft.clone(e.uniforms), this.material = new Nt({
|
|
2215
2215
|
name: e.name,
|
|
2216
2216
|
uniforms: this.uniforms,
|
|
2217
2217
|
vertexShader: e.vertexShader,
|
|
@@ -2219,23 +2219,23 @@ class zs extends ms {
|
|
|
2219
2219
|
}), this.fsQuad ? this.fsQuad = new Fe(this.material) : this._fsQuad && (this._fsQuad = new Fe(this.material));
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
|
-
const Fs = new
|
|
2222
|
+
const Fs = new It({ color: "black" }), Ns = new nt({
|
|
2223
2223
|
color: "black",
|
|
2224
2224
|
sizeAttenuation: !1
|
|
2225
|
-
}), Is = new
|
|
2225
|
+
}), Is = new nt({
|
|
2226
2226
|
color: "black",
|
|
2227
2227
|
sizeAttenuation: !0
|
|
2228
|
-
}),
|
|
2228
|
+
}), Hs = new at({
|
|
2229
2229
|
color: "black",
|
|
2230
2230
|
sizeAttenuation: !0
|
|
2231
|
-
}),
|
|
2231
|
+
}), js = new at({
|
|
2232
2232
|
color: "black",
|
|
2233
2233
|
sizeAttenuation: !1
|
|
2234
|
-
}), Bs = new
|
|
2234
|
+
}), Bs = new mt({
|
|
2235
2235
|
color: "black",
|
|
2236
2236
|
sizeAttenuation: !1,
|
|
2237
2237
|
lineWidth: 0
|
|
2238
|
-
}),
|
|
2238
|
+
}), Ge = new Ht(0), Vs = {
|
|
2239
2239
|
kernelRadius: 8,
|
|
2240
2240
|
minDistance: 5e-3,
|
|
2241
2241
|
maxDistance: 0.1
|
|
@@ -2250,7 +2250,7 @@ const Fs = new jt({ color: "black" }), Ns = new at({
|
|
|
2250
2250
|
};
|
|
2251
2251
|
class Ws {
|
|
2252
2252
|
constructor(e) {
|
|
2253
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2253
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new jt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2254
2254
|
const {
|
|
2255
2255
|
rendererController: t,
|
|
2256
2256
|
sceneController: s,
|
|
@@ -2258,23 +2258,23 @@ class Ws {
|
|
|
2258
2258
|
composerParams: r
|
|
2259
2259
|
} = e, { renderer: o } = t;
|
|
2260
2260
|
this.renderer = o;
|
|
2261
|
-
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, h = o.getDrawingBufferSize(new B()), m = new
|
|
2261
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, h = o.getDrawingBufferSize(new B()), m = new Bt(
|
|
2262
2262
|
h.width,
|
|
2263
2263
|
h.height,
|
|
2264
2264
|
{
|
|
2265
2265
|
samples: Math.min(n, a),
|
|
2266
|
-
type:
|
|
2266
|
+
type: Vt
|
|
2267
2267
|
}
|
|
2268
|
-
), p = new
|
|
2268
|
+
), p = new ke(o, m), v = this.getSize();
|
|
2269
2269
|
p.setSize(v.width, v.height);
|
|
2270
|
-
const _ = new
|
|
2270
|
+
const _ = new ls(
|
|
2271
2271
|
s.scene,
|
|
2272
2272
|
i.camera
|
|
2273
2273
|
);
|
|
2274
|
-
p.addPass(_), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = _, i.event.on("pageChange", (
|
|
2275
|
-
this.changeCamera(
|
|
2276
|
-
}), s.event.on("pageChange", (
|
|
2277
|
-
this.changeScene(
|
|
2274
|
+
p.addPass(_), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = _, i.event.on("pageChange", (u) => {
|
|
2275
|
+
this.changeCamera(u);
|
|
2276
|
+
}), s.event.on("pageChange", (u) => {
|
|
2277
|
+
this.changeScene(u);
|
|
2278
2278
|
});
|
|
2279
2279
|
}
|
|
2280
2280
|
changeCamera(e) {
|
|
@@ -2284,25 +2284,25 @@ class Ws {
|
|
|
2284
2284
|
this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
|
|
2285
2285
|
}
|
|
2286
2286
|
addOutputPass() {
|
|
2287
|
-
const { premultiplieAlpha: e } = this.options.composerParams, t = new
|
|
2287
|
+
const { premultiplieAlpha: e } = this.options.composerParams, t = new ks();
|
|
2288
2288
|
this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
|
|
2289
2289
|
}
|
|
2290
2290
|
setPremultiplieAlpha(e) {
|
|
2291
2291
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2292
2292
|
}
|
|
2293
2293
|
addSSAOPass(e) {
|
|
2294
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new
|
|
2294
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new hs(t, s, o, n);
|
|
2295
2295
|
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2296
2296
|
}
|
|
2297
2297
|
addBloomPass(e) {
|
|
2298
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new
|
|
2298
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new cs(
|
|
2299
2299
|
new B(window.innerWidth, window.innerHeight),
|
|
2300
2300
|
i,
|
|
2301
2301
|
r,
|
|
2302
2302
|
s
|
|
2303
2303
|
);
|
|
2304
2304
|
this.bloomPass = n;
|
|
2305
|
-
const a = new
|
|
2305
|
+
const a = new ke(t);
|
|
2306
2306
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2307
2307
|
const h = Us(a);
|
|
2308
2308
|
h.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(h), this.mixPass = h, this.bloomLayer.set(Oe);
|
|
@@ -2346,20 +2346,20 @@ class Ws {
|
|
|
2346
2346
|
e.push(o);
|
|
2347
2347
|
return;
|
|
2348
2348
|
}
|
|
2349
|
-
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material =
|
|
2349
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Hs : n.material = js : o.material instanceof mt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = Is : a.material = Ns : o.material = Fs;
|
|
2350
2350
|
}
|
|
2351
2351
|
});
|
|
2352
2352
|
}), e.forEach((i) => {
|
|
2353
2353
|
this.bloomVisible[i.uuid] = i.visible, i.visible = !1;
|
|
2354
2354
|
});
|
|
2355
2355
|
const s = this.scene.background;
|
|
2356
|
-
s != null && s.isTexture && (this.scene.userData._backgroundOriginal = s, this.scene.background =
|
|
2356
|
+
s != null && s.isTexture && (this.scene.userData._backgroundOriginal = s, this.scene.background = Ge);
|
|
2357
2357
|
}
|
|
2358
2358
|
restoreNonBloomed() {
|
|
2359
2359
|
if (this.scene.traverse((e) => {
|
|
2360
2360
|
const t = e;
|
|
2361
2361
|
this.bloomMaterials[t.uuid] ? (t.material = this.bloomMaterials[t.uuid], delete this.bloomMaterials[t.uuid]) : this.bloomVisible[t.uuid] !== void 0 && (t.visible = this.bloomVisible[t.uuid], delete this.bloomVisible[t.uuid]);
|
|
2362
|
-
}), this.scene.background ===
|
|
2362
|
+
}), this.scene.background === Ge) {
|
|
2363
2363
|
const e = this.scene.userData._backgroundOriginal;
|
|
2364
2364
|
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2365
2365
|
}
|
|
@@ -2401,14 +2401,14 @@ class Ks extends ee {
|
|
|
2401
2401
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2402
2402
|
const t = {
|
|
2403
2403
|
Vector2: B,
|
|
2404
|
-
Vector3:
|
|
2405
|
-
Vector4:
|
|
2406
|
-
Quaternion:
|
|
2404
|
+
Vector3: H,
|
|
2405
|
+
Vector4: Zt,
|
|
2406
|
+
Quaternion: lt,
|
|
2407
2407
|
Matrix4: W,
|
|
2408
|
-
Spherical:
|
|
2409
|
-
Box3:
|
|
2410
|
-
Sphere:
|
|
2411
|
-
Raycaster:
|
|
2408
|
+
Spherical: Wt,
|
|
2409
|
+
Box3: ht,
|
|
2410
|
+
Sphere: Kt,
|
|
2411
|
+
Raycaster: ct
|
|
2412
2412
|
};
|
|
2413
2413
|
J.install({ THREE: t });
|
|
2414
2414
|
}
|
|
@@ -2440,10 +2440,10 @@ class Ks extends ee {
|
|
|
2440
2440
|
});
|
|
2441
2441
|
}
|
|
2442
2442
|
update(e, t) {
|
|
2443
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2443
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Yt.DEG2RAD);
|
|
2444
2444
|
}
|
|
2445
2445
|
}
|
|
2446
|
-
const
|
|
2446
|
+
const Xe = new H(), $s = new lt(), qe = new H(), I = new W(), Gs = new W();
|
|
2447
2447
|
class Xs {
|
|
2448
2448
|
/**
|
|
2449
2449
|
* Constructs a new CSS3D renderer.
|
|
@@ -2467,11 +2467,11 @@ class Xs {
|
|
|
2467
2467
|
height: i
|
|
2468
2468
|
};
|
|
2469
2469
|
}, this.render = function(y, l) {
|
|
2470
|
-
const
|
|
2470
|
+
const f = l.projectionMatrix.elements[5] * o;
|
|
2471
2471
|
l.view && l.view.enabled ? (h.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, h.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : h.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2472
2472
|
let O, C;
|
|
2473
2473
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2474
|
-
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` +
|
|
2474
|
+
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + f + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + f + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + f + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2475
2475
|
n.camera.style !== R && (m.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2476
2476
|
}, this.setSize = function(y, l) {
|
|
2477
2477
|
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", h.style.width = y + "px", h.style.height = l + "px", m.style.width = y + "px", m.style.height = l + "px";
|
|
@@ -2487,37 +2487,37 @@ class Xs {
|
|
|
2487
2487
|
const l = y.elements;
|
|
2488
2488
|
return "translate(-50%,-50%)" + ("matrix3d(" + p(l[0]) + "," + p(l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(-l[4]) + "," + p(-l[5]) + "," + p(-l[6]) + "," + p(-l[7]) + "," + p(l[8]) + "," + p(l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")");
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function u(y) {
|
|
2491
2491
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2492
|
-
for (let l = 0,
|
|
2493
|
-
|
|
2492
|
+
for (let l = 0, f = y.children.length; l < f; l++)
|
|
2493
|
+
u(y.children[l]);
|
|
2494
2494
|
}
|
|
2495
|
-
function g(y, l,
|
|
2495
|
+
function g(y, l, f, O) {
|
|
2496
2496
|
if (y.visible === !1) {
|
|
2497
|
-
|
|
2497
|
+
u(y);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
if (y.isCSS3DObject) {
|
|
2501
|
-
const C = y.layers.test(
|
|
2501
|
+
const C = y.layers.test(f.layers) === !0, w = y.element;
|
|
2502
2502
|
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2503
|
-
y.onBeforeRender(t, l,
|
|
2503
|
+
y.onBeforeRender(t, l, f);
|
|
2504
2504
|
let E;
|
|
2505
|
-
y.isCSS3DSprite ? (I.copy(
|
|
2506
|
-
const
|
|
2507
|
-
if (
|
|
2505
|
+
y.isCSS3DSprite ? (I.copy(f.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Gs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(Xe, $s, qe), I.setPosition(Xe), I.scale(qe), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, E = _(I)) : E = _(y.matrixWorld);
|
|
2506
|
+
const b = n.objects.get(y);
|
|
2507
|
+
if (b === void 0 || b.style !== E) {
|
|
2508
2508
|
w.style.transform = E;
|
|
2509
2509
|
const R = { style: E };
|
|
2510
2510
|
n.objects.set(y, R);
|
|
2511
2511
|
}
|
|
2512
|
-
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l,
|
|
2512
|
+
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l, f);
|
|
2513
2513
|
}
|
|
2514
2514
|
}
|
|
2515
2515
|
for (let C = 0, w = y.children.length; C < w; C++)
|
|
2516
|
-
g(y.children[C], l,
|
|
2516
|
+
g(y.children[C], l, f);
|
|
2517
2517
|
}
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
const q = new
|
|
2520
|
+
const q = new H(), Qe = new W(), Je = new W(), et = new H(), tt = new H();
|
|
2521
2521
|
class qs {
|
|
2522
2522
|
/**
|
|
2523
2523
|
* Constructs a new CSS2D renderer.
|
|
@@ -2535,55 +2535,55 @@ class qs {
|
|
|
2535
2535
|
width: s,
|
|
2536
2536
|
height: i
|
|
2537
2537
|
};
|
|
2538
|
-
}, this.render = function(
|
|
2539
|
-
|
|
2540
|
-
}, this.setSize = function(
|
|
2541
|
-
s =
|
|
2538
|
+
}, this.render = function(u, g) {
|
|
2539
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Qe.copy(g.matrixWorldInverse), Je.multiplyMatrices(g.projectionMatrix, Qe), m(u, u, g), _(u);
|
|
2540
|
+
}, this.setSize = function(u, g) {
|
|
2541
|
+
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2542
2542
|
};
|
|
2543
|
-
function h(
|
|
2544
|
-
|
|
2545
|
-
for (let g = 0, y =
|
|
2546
|
-
h(
|
|
2543
|
+
function h(u) {
|
|
2544
|
+
u.isCSS2DObject && (u.element.style.display = "none");
|
|
2545
|
+
for (let g = 0, y = u.children.length; g < y; g++)
|
|
2546
|
+
h(u.children[g]);
|
|
2547
2547
|
}
|
|
2548
|
-
function m(
|
|
2549
|
-
if (
|
|
2550
|
-
h(
|
|
2548
|
+
function m(u, g, y) {
|
|
2549
|
+
if (u.visible === !1) {
|
|
2550
|
+
h(u);
|
|
2551
2551
|
return;
|
|
2552
2552
|
}
|
|
2553
|
-
if (
|
|
2554
|
-
q.setFromMatrixPosition(
|
|
2555
|
-
const l = q.z >= -1 && q.z <= 1 &&
|
|
2556
|
-
|
|
2553
|
+
if (u.isCSS2DObject) {
|
|
2554
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Je);
|
|
2555
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, f = u.element;
|
|
2556
|
+
f.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), f.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", f.parentNode !== a && a.appendChild(f), u.onAfterRender(t, g, y));
|
|
2557
2557
|
const O = {
|
|
2558
|
-
distanceToCameraSquared: p(y,
|
|
2558
|
+
distanceToCameraSquared: p(y, u)
|
|
2559
2559
|
};
|
|
2560
|
-
n.objects.set(
|
|
2560
|
+
n.objects.set(u, O);
|
|
2561
2561
|
}
|
|
2562
|
-
for (let l = 0,
|
|
2563
|
-
m(
|
|
2562
|
+
for (let l = 0, f = u.children.length; l < f; l++)
|
|
2563
|
+
m(u.children[l], g, y);
|
|
2564
2564
|
}
|
|
2565
|
-
function p(
|
|
2566
|
-
return
|
|
2565
|
+
function p(u, g) {
|
|
2566
|
+
return et.setFromMatrixPosition(u.matrixWorld), tt.setFromMatrixPosition(g.matrixWorld), et.distanceToSquared(tt);
|
|
2567
2567
|
}
|
|
2568
|
-
function v(
|
|
2568
|
+
function v(u) {
|
|
2569
2569
|
const g = [];
|
|
2570
|
-
return
|
|
2570
|
+
return u.traverseVisible(function(y) {
|
|
2571
2571
|
y.isCSS2DObject && g.push(y);
|
|
2572
2572
|
}), g;
|
|
2573
2573
|
}
|
|
2574
|
-
function _(
|
|
2575
|
-
const g = v(
|
|
2576
|
-
if (l.renderOrder !==
|
|
2577
|
-
return
|
|
2578
|
-
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(
|
|
2574
|
+
function _(u) {
|
|
2575
|
+
const g = v(u).sort(function(l, f) {
|
|
2576
|
+
if (l.renderOrder !== f.renderOrder)
|
|
2577
|
+
return f.renderOrder - l.renderOrder;
|
|
2578
|
+
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(f).distanceToCameraSquared;
|
|
2579
2579
|
return O - C;
|
|
2580
2580
|
}), y = g.length;
|
|
2581
|
-
for (let l = 0,
|
|
2581
|
+
for (let l = 0, f = g.length; l < f; l++)
|
|
2582
2582
|
g[l].element.style.zIndex = y - l;
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
const
|
|
2586
|
+
const st = {
|
|
2587
2587
|
zIndex: "auto"
|
|
2588
2588
|
};
|
|
2589
2589
|
class Qs {
|
|
@@ -2618,19 +2618,19 @@ class Js {
|
|
|
2618
2618
|
if (e.isScene)
|
|
2619
2619
|
i = new De(100);
|
|
2620
2620
|
else if (e.isCamera)
|
|
2621
|
-
i = new
|
|
2621
|
+
i = new $t(e);
|
|
2622
2622
|
else if (e.isPointLight)
|
|
2623
|
-
i = new
|
|
2623
|
+
i = new Gt(e, 1);
|
|
2624
2624
|
else if (e.isDirectionalLight)
|
|
2625
|
-
i = new
|
|
2625
|
+
i = new Xt(e, 1);
|
|
2626
2626
|
else if (e.isSpotLight)
|
|
2627
|
-
i = new
|
|
2627
|
+
i = new qt(e);
|
|
2628
2628
|
else if (e.isHemisphereLight)
|
|
2629
|
-
i = new
|
|
2629
|
+
i = new Qt(e, 10);
|
|
2630
2630
|
else if (e.isRectAreaLight)
|
|
2631
|
-
i = new
|
|
2631
|
+
i = new ms(e);
|
|
2632
2632
|
else {
|
|
2633
|
-
const r = new
|
|
2633
|
+
const r = new ht();
|
|
2634
2634
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2635
2635
|
i = new Ue(r);
|
|
2636
2636
|
const o = i.material;
|
|
@@ -2692,7 +2692,7 @@ class Js {
|
|
|
2692
2692
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
|
-
function
|
|
2695
|
+
function it(c) {
|
|
2696
2696
|
let e = !1, t = [];
|
|
2697
2697
|
return function(...s) {
|
|
2698
2698
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
@@ -2723,10 +2723,10 @@ class ei {
|
|
|
2723
2723
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2724
2724
|
const a = this.objCallbackMap;
|
|
2725
2725
|
for (const _ of n)
|
|
2726
|
-
for (const
|
|
2727
|
-
if (!
|
|
2728
|
-
a.has(
|
|
2729
|
-
const g = a.get(
|
|
2726
|
+
for (const u of _.objArr) {
|
|
2727
|
+
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
2728
|
+
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
2729
|
+
const g = a.get(u);
|
|
2730
2730
|
g.has(_.type) || g.set(_.type, []), g.get(_.type).push(_.cb);
|
|
2731
2731
|
}
|
|
2732
2732
|
if (a.size === 0) return;
|
|
@@ -2742,7 +2742,7 @@ class ei {
|
|
|
2742
2742
|
};
|
|
2743
2743
|
this.domElement.addEventListener(
|
|
2744
2744
|
`pointer${e}`,
|
|
2745
|
-
|
|
2745
|
+
it(i),
|
|
2746
2746
|
{ passive: !1 }
|
|
2747
2747
|
);
|
|
2748
2748
|
}
|
|
@@ -2803,8 +2803,8 @@ class ei {
|
|
|
2803
2803
|
v.preventDefault();
|
|
2804
2804
|
const _ = 5;
|
|
2805
2805
|
if (!r && Math.abs(v.clientX - e.clientX) <= _ && Math.abs(v.clientY - e.clientY) <= _)
|
|
2806
|
-
for (const
|
|
2807
|
-
|
|
2806
|
+
for (const u of m)
|
|
2807
|
+
u({
|
|
2808
2808
|
baseObject: n,
|
|
2809
2809
|
realBaseObject: this.activeObject,
|
|
2810
2810
|
mouseEvent: e,
|
|
@@ -2867,7 +2867,7 @@ class ei {
|
|
|
2867
2867
|
mouseEvent: p
|
|
2868
2868
|
}));
|
|
2869
2869
|
}, m = `pointer${t}`;
|
|
2870
|
-
a.element.addEventListener(m,
|
|
2870
|
+
a.element.addEventListener(m, it(h), !1), o.push({ arr: a, type: m, listener: h });
|
|
2871
2871
|
}
|
|
2872
2872
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2873
2873
|
}
|
|
@@ -2889,16 +2889,16 @@ class ei {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
class ti extends ei {
|
|
2891
2891
|
constructor(e, t) {
|
|
2892
|
-
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new
|
|
2892
|
+
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new dt(), {
|
|
2893
2893
|
key: "@Scene",
|
|
2894
2894
|
name: "场景",
|
|
2895
2895
|
mList: !1
|
|
2896
|
-
}), this.group = this.createBaseObject(new
|
|
2896
|
+
}), this.group = this.createBaseObject(new ze(), {
|
|
2897
2897
|
key: "@Group",
|
|
2898
2898
|
name: "物体组",
|
|
2899
2899
|
target: this.scene,
|
|
2900
2900
|
mList: !1
|
|
2901
|
-
}), this.prefabGroup = this.createBaseObject(new
|
|
2901
|
+
}), this.prefabGroup = this.createBaseObject(new ze(), {
|
|
2902
2902
|
key: "@PrefabGroup",
|
|
2903
2903
|
name: "预制组",
|
|
2904
2904
|
target: this.scene,
|
|
@@ -2911,16 +2911,16 @@ class ti extends ei {
|
|
|
2911
2911
|
createBaseObject(e, t = {}) {
|
|
2912
2912
|
const s = U({
|
|
2913
2913
|
mList: !0
|
|
2914
|
-
}, t), i = new
|
|
2914
|
+
}, t), i = new as();
|
|
2915
2915
|
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key && (i.key = s.key), !s.key && s.target)
|
|
2916
|
-
if (s.target.key === "@Scene" && e instanceof
|
|
2916
|
+
if (s.target.key === "@Scene" && e instanceof Jt)
|
|
2917
2917
|
i.key = "@Camera";
|
|
2918
2918
|
else {
|
|
2919
2919
|
const o = this.objectWrapChindIdMap.get(s.target), n = o !== void 0 ? o + 1 : 0;
|
|
2920
2920
|
this.objectWrapChindIdMap.set(s.target, n), this.setBaseObjectKey(
|
|
2921
2921
|
i,
|
|
2922
|
-
`$
|
|
2923
|
-
s.target
|
|
2922
|
+
{ type: `$p:__c__${n}`, id: "$p:", name: "$p:" },
|
|
2923
|
+
s.target
|
|
2924
2924
|
);
|
|
2925
2925
|
}
|
|
2926
2926
|
return s.name && (e.name = s.name), s.target && !s.target.object3d.getObjectById(e.id) && s.target.object3d.add(e), this.objects.set(i.key, i), this.objMap.set(i.object3d, i), s.mList && (this.mList.proxyBaseObject(i), this.mList.addBaseObjectMap(i)), e.children && e.children.forEach((r) => {
|
|
@@ -2964,18 +2964,21 @@ class ti extends ei {
|
|
|
2964
2964
|
if (r === null)
|
|
2965
2965
|
m = null;
|
|
2966
2966
|
else if (typeof r == "string") {
|
|
2967
|
-
const
|
|
2968
|
-
if (!
|
|
2967
|
+
const u = this.objects.get(r);
|
|
2968
|
+
if (!u)
|
|
2969
2969
|
throw new Error(`Object with key "${r}" not found`);
|
|
2970
|
-
m =
|
|
2970
|
+
m = u;
|
|
2971
2971
|
} else r != null && r.isBaseObject || r ? m = r : n ? m = this.prefabGroup : m = this.group;
|
|
2972
2972
|
return a === !1 ? h.create = () => {
|
|
2973
2973
|
} : a !== !0 && (h.create = () => {
|
|
2974
2974
|
a(h);
|
|
2975
2975
|
}), h.pencil = this.pencil, h.lead = this, h.mList = this.mList, h.isPrefab = n, h.objectType = `${e}`, h.objectOptions = t, this.setBaseObjectKey(
|
|
2976
2976
|
h,
|
|
2977
|
-
|
|
2978
|
-
|
|
2977
|
+
{
|
|
2978
|
+
type: h.keyType,
|
|
2979
|
+
name: t.key
|
|
2980
|
+
},
|
|
2981
|
+
m
|
|
2979
2982
|
), this.objectsPm.set(
|
|
2980
2983
|
h,
|
|
2981
2984
|
this.addBaseObject(h, m, o)
|
|
@@ -2983,28 +2986,30 @@ class ti extends ei {
|
|
|
2983
2986
|
});
|
|
2984
2987
|
}
|
|
2985
2988
|
setBaseObjectKey(e, t, s) {
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2989
|
+
let i = "", r = t.name, o = t.type || e.objectType, n = t.id;
|
|
2990
|
+
return s && (r != null && r.includes("$p:") && (r = r.replace("$p:", s.keyName || "")), o != null && o.includes("$p:") && (o = o.replace("$p:", s.keyType || "")), n != null && n.includes("$p:") && (n = n.replace("$p:", s.keyUId || ""))), i = `${o}`, r && n ? i += `#${r}-${n}` : (r || n) && (i += `#${r || n}`), this.objects.has(i) ? this.setBaseObjectKey(
|
|
2991
|
+
e,
|
|
2992
|
+
{
|
|
2993
|
+
name: t.name,
|
|
2994
|
+
type: t.type,
|
|
2995
|
+
id: fs()
|
|
2996
|
+
},
|
|
2997
|
+
s
|
|
2998
|
+
) : (e.key = i, e.keyType = o, e.keyUId = n, e.keyName = r, this.objects.set(i, e), i);
|
|
2993
2999
|
}
|
|
2994
3000
|
updateBaseObjectKey(e, t) {
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
typeof h != "undefined" && this.updateBaseObjectKey(n, `$pt:__c__${h}$pk:`);
|
|
3001
|
+
const s = e.key;
|
|
3002
|
+
this.objects.delete(s);
|
|
3003
|
+
const i = e.parent, r = this.setBaseObjectKey(e, t, i);
|
|
3004
|
+
return this.pencil.event.emit("lead.updateKey", { baseObject: e, key: r, oldKey: s }), e.children.forEach((o) => {
|
|
3005
|
+
var n;
|
|
3006
|
+
if (o.key.includes("__c__")) {
|
|
3007
|
+
const a = (n = /__c__(\d+)/.exec(o.key)) == null ? void 0 : n[1];
|
|
3008
|
+
typeof a != "undefined" && this.updateBaseObjectKey(o, {
|
|
3009
|
+
type: `$p:__c__${a}`,
|
|
3010
|
+
id: "$p:",
|
|
3011
|
+
name: "$p:"
|
|
3012
|
+
});
|
|
3008
3013
|
}
|
|
3009
3014
|
}), r;
|
|
3010
3015
|
}
|
|
@@ -3091,7 +3096,7 @@ class si extends ee {
|
|
|
3091
3096
|
});
|
|
3092
3097
|
}
|
|
3093
3098
|
}
|
|
3094
|
-
class ii extends
|
|
3099
|
+
class ii extends pt {
|
|
3095
3100
|
constructor(e) {
|
|
3096
3101
|
super(e);
|
|
3097
3102
|
}
|
|
@@ -3112,7 +3117,7 @@ class ii extends mt {
|
|
|
3112
3117
|
);
|
|
3113
3118
|
}
|
|
3114
3119
|
}
|
|
3115
|
-
class
|
|
3120
|
+
class rt extends pt {
|
|
3116
3121
|
constructor(e) {
|
|
3117
3122
|
super(e), this.options = { type: "image" };
|
|
3118
3123
|
}
|
|
@@ -3121,7 +3126,7 @@ class ot extends mt {
|
|
|
3121
3126
|
}
|
|
3122
3127
|
load(e, t, s, i) {
|
|
3123
3128
|
let r, o;
|
|
3124
|
-
this.options.type === "image" ? (o = document.createElement("img"), r = new
|
|
3129
|
+
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new es(o)) : r = new fe();
|
|
3125
3130
|
const n = new Se(this.manager);
|
|
3126
3131
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3127
3132
|
e,
|
|
@@ -3130,13 +3135,13 @@ class ot extends mt {
|
|
|
3130
3135
|
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3131
3136
|
h = h.slice(0, a.size, p);
|
|
3132
3137
|
const v = () => {
|
|
3133
|
-
o.removeEventListener("load", _, !1), o.removeEventListener("error",
|
|
3138
|
+
o.removeEventListener("load", _, !1), o.removeEventListener("error", u, !1);
|
|
3134
3139
|
}, _ = () => {
|
|
3135
3140
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3136
|
-
},
|
|
3141
|
+
}, u = (y) => {
|
|
3137
3142
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3138
3143
|
};
|
|
3139
|
-
o.addEventListener("load", _, !1), o.addEventListener("error",
|
|
3144
|
+
o.addEventListener("load", _, !1), o.addEventListener("error", u, !1);
|
|
3140
3145
|
const g = window.URL.createObjectURL(h);
|
|
3141
3146
|
o.src = g;
|
|
3142
3147
|
},
|
|
@@ -3159,7 +3164,7 @@ class oi {
|
|
|
3159
3164
|
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
|
|
3160
3165
|
simpleTexture4deleted: !1,
|
|
3161
3166
|
prefix: ""
|
|
3162
|
-
}, e), this.loadingManager = new
|
|
3167
|
+
}, e), this.loadingManager = new ts(
|
|
3163
3168
|
() => {
|
|
3164
3169
|
},
|
|
3165
3170
|
(t, s, i) => {
|
|
@@ -3183,7 +3188,7 @@ class oi {
|
|
|
3183
3188
|
const s = this.assets.get(e);
|
|
3184
3189
|
if (!s) {
|
|
3185
3190
|
if ((t === "images" || t === "media" || t === "exr") && this.options.simpleTexture4deleted && this.delLoadArr.includes(e))
|
|
3186
|
-
return new
|
|
3191
|
+
return new fe();
|
|
3187
3192
|
console.warn(`Asset ${e} not found`);
|
|
3188
3193
|
}
|
|
3189
3194
|
return s;
|
|
@@ -3203,13 +3208,13 @@ class oi {
|
|
|
3203
3208
|
}
|
|
3204
3209
|
getLoader(e, t) {
|
|
3205
3210
|
if (e === "images")
|
|
3206
|
-
return this.textureLoader || (this.textureLoader = new
|
|
3211
|
+
return this.textureLoader || (this.textureLoader = new rt(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
3207
3212
|
if (e === "media")
|
|
3208
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
3213
|
+
return this.videoTextureLoader || (this.videoTextureLoader = new rt(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3209
3214
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3210
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3215
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new gs(), this.dracoLoader.setDecoderPath(t == null ? void 0 : t.dracoPath), this.dracoGltfLoader.setDRACOLoader(this.dracoLoader), this.options.prefix && this.dracoGltfLoader.setPath(this.options.prefix)), this.dracoGltfLoader;
|
|
3211
3216
|
if (e === "gltf")
|
|
3212
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3217
|
+
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3213
3218
|
if (e === "lottie")
|
|
3214
3219
|
return this.lottieLoader || (this.lottieLoader = new vs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3215
3220
|
if (e === "gzipJson")
|
|
@@ -3236,7 +3241,7 @@ class oi {
|
|
|
3236
3241
|
get textureAssets() {
|
|
3237
3242
|
const e = /* @__PURE__ */ new Map();
|
|
3238
3243
|
return this.assets.forEach((t, s) => {
|
|
3239
|
-
(t instanceof
|
|
3244
|
+
(t instanceof fe || t instanceof ss || t.isVideoTexture) && e.set(s, t);
|
|
3240
3245
|
}), e;
|
|
3241
3246
|
}
|
|
3242
3247
|
loadAll() {
|
|
@@ -3597,15 +3602,15 @@ class di {
|
|
|
3597
3602
|
logarithmicDepthBuffer: p,
|
|
3598
3603
|
preserveDrawingBuffer: v,
|
|
3599
3604
|
stencil: _,
|
|
3600
|
-
depth:
|
|
3601
|
-
} = i, g = new
|
|
3605
|
+
depth: u
|
|
3606
|
+
} = i, g = new is({
|
|
3602
3607
|
alpha: r,
|
|
3603
3608
|
antialias: n,
|
|
3604
3609
|
powerPreference: a,
|
|
3605
3610
|
logarithmicDepthBuffer: p,
|
|
3606
3611
|
preserveDrawingBuffer: v,
|
|
3607
3612
|
stencil: _,
|
|
3608
|
-
depth:
|
|
3613
|
+
depth: u
|
|
3609
3614
|
});
|
|
3610
3615
|
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = h, g.outputColorSpace = m, this.renderer = g;
|
|
3611
3616
|
}
|
|
@@ -3639,7 +3644,7 @@ class mi extends ee {
|
|
|
3639
3644
|
super(), this.options = e;
|
|
3640
3645
|
}
|
|
3641
3646
|
addScene(e, t) {
|
|
3642
|
-
const s = new
|
|
3647
|
+
const s = new dt();
|
|
3643
3648
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
3644
3649
|
}
|
|
3645
3650
|
removePage(e) {
|
|
@@ -3654,7 +3659,7 @@ class mi extends ee {
|
|
|
3654
3659
|
});
|
|
3655
3660
|
}
|
|
3656
3661
|
}
|
|
3657
|
-
class
|
|
3662
|
+
class ui {
|
|
3658
3663
|
constructor(e) {
|
|
3659
3664
|
this.event = new ye.EventEmitter();
|
|
3660
3665
|
const { renderer: t, scene: s, camera: i } = e, r = new Ts(
|
|
@@ -3663,7 +3668,7 @@ class fi {
|
|
|
3663
3668
|
);
|
|
3664
3669
|
if (r.getHelper) {
|
|
3665
3670
|
const o = r.getHelper();
|
|
3666
|
-
if (s.add(o), +
|
|
3671
|
+
if (s.add(o), +rs < 170) {
|
|
3667
3672
|
const n = r._root;
|
|
3668
3673
|
n.dispose = () => {
|
|
3669
3674
|
n.traverse((a) => {
|
|
@@ -3673,7 +3678,7 @@ class fi {
|
|
|
3673
3678
|
r.disconnect(), n.dispose();
|
|
3674
3679
|
};
|
|
3675
3680
|
}
|
|
3676
|
-
} else r instanceof
|
|
3681
|
+
} else r instanceof os && s.add(r);
|
|
3677
3682
|
this.controls = r, this.addEvent();
|
|
3678
3683
|
}
|
|
3679
3684
|
get detach() {
|
|
@@ -3723,7 +3728,7 @@ class fi {
|
|
|
3723
3728
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3724
3729
|
}
|
|
3725
3730
|
}
|
|
3726
|
-
const
|
|
3731
|
+
const fi = {
|
|
3727
3732
|
antialias: !0,
|
|
3728
3733
|
devicePixelRatio: window.devicePixelRatio
|
|
3729
3734
|
};
|
|
@@ -3749,7 +3754,7 @@ class _i {
|
|
|
3749
3754
|
const _e = class _e {
|
|
3750
3755
|
constructor(e) {
|
|
3751
3756
|
var r, o;
|
|
3752
|
-
this.raycaster = new
|
|
3757
|
+
this.raycaster = new ct(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new H(), this._cameraTarget = new H(), this.event = new ye.EventEmitter(), this.timer = new ns(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this._isDispose = !1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = Dt(_e.options, e, {
|
|
3753
3758
|
isMergeableObject: Es
|
|
3754
3759
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3755
3760
|
const {
|
|
@@ -3758,7 +3763,7 @@ const _e = class _e {
|
|
|
3758
3763
|
transformControls: i
|
|
3759
3764
|
} = this.options;
|
|
3760
3765
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3761
|
-
const n = new
|
|
3766
|
+
const n = new Ut({
|
|
3762
3767
|
horizontal: !1
|
|
3763
3768
|
});
|
|
3764
3769
|
n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
|
|
@@ -3826,7 +3831,7 @@ const _e = class _e {
|
|
|
3826
3831
|
this.sceneController.setPageActive(e), t && ((s = this.cssRendererController) == null || s.render(t, this.camera)), this.cameraController.setPageActive(e), this.controlsController.setPageActive(e), this.loaderController.setPageActive(e), this.mListController.setPageActive(e), this.leadController.setPageActive(e), this.pageActiveIndex = e;
|
|
3827
3832
|
}
|
|
3828
3833
|
init() {
|
|
3829
|
-
var
|
|
3834
|
+
var f;
|
|
3830
3835
|
const {
|
|
3831
3836
|
container: e,
|
|
3832
3837
|
WebGPUTHREE: t,
|
|
@@ -3840,7 +3845,7 @@ const _e = class _e {
|
|
|
3840
3845
|
height: h,
|
|
3841
3846
|
//@ts-ignore
|
|
3842
3847
|
renderer: this.options.WebGPURenderer,
|
|
3843
|
-
rendererParams:
|
|
3848
|
+
rendererParams: fi
|
|
3844
3849
|
}) : new di({
|
|
3845
3850
|
width: a,
|
|
3846
3851
|
height: h,
|
|
@@ -3854,9 +3859,9 @@ const _e = class _e {
|
|
|
3854
3859
|
height: h
|
|
3855
3860
|
}), v = new mi({}), _ = new Ks({
|
|
3856
3861
|
controlsParams: {
|
|
3857
|
-
domElement: (
|
|
3862
|
+
domElement: (f = o == null ? void 0 : o.domElement) != null ? f : m.renderer.domElement
|
|
3858
3863
|
}
|
|
3859
|
-
}),
|
|
3864
|
+
}), u = new ai({
|
|
3860
3865
|
loaderParams: U({
|
|
3861
3866
|
anisotropy: this.maxAnisotropy
|
|
3862
3867
|
}, n)
|
|
@@ -3865,7 +3870,7 @@ const _e = class _e {
|
|
|
3865
3870
|
}), y = new si({
|
|
3866
3871
|
pencil: this
|
|
3867
3872
|
});
|
|
3868
|
-
this.sceneController = v, this.cameraController = p, this.controlsController = _, this.loaderController =
|
|
3873
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = _, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3869
3874
|
const l = this.addPage({
|
|
3870
3875
|
sceneOptions: this.options.scene,
|
|
3871
3876
|
cameraOptions: this.options.camera
|
|
@@ -3909,7 +3914,7 @@ const _e = class _e {
|
|
|
3909
3914
|
}
|
|
3910
3915
|
}
|
|
3911
3916
|
initTransformControls() {
|
|
3912
|
-
const e = new
|
|
3917
|
+
const e = new ui({
|
|
3913
3918
|
camera: this.camera,
|
|
3914
3919
|
renderer: this.renderer,
|
|
3915
3920
|
scene: this.scene
|
|
@@ -4047,11 +4052,11 @@ const _e = class _e {
|
|
|
4047
4052
|
}
|
|
4048
4053
|
}
|
|
4049
4054
|
dispose() {
|
|
4050
|
-
var e, t, s, i, r, o, n, a, h, m, p, v, _,
|
|
4055
|
+
var e, t, s, i, r, o, n, a, h, m, p, v, _, u;
|
|
4051
4056
|
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4052
4057
|
var y;
|
|
4053
4058
|
(y = g.dispose) == null || y.call(g);
|
|
4054
|
-
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (_ = this.stats) == null || _.dom.remove(), (
|
|
4059
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (_ = this.stats) == null || _.dom.remove(), (u = this.renderer) == null || u.domElement.remove(), this._isDispose = !0;
|
|
4055
4060
|
}
|
|
4056
4061
|
};
|
|
4057
4062
|
_e.options = {
|
|
@@ -4063,23 +4068,23 @@ _e.options = {
|
|
|
4063
4068
|
renderer: ci,
|
|
4064
4069
|
composer: Zs,
|
|
4065
4070
|
scene: pi,
|
|
4066
|
-
camera:
|
|
4071
|
+
camera: Tt,
|
|
4067
4072
|
bloom: !1,
|
|
4068
4073
|
bloomParams: Ys,
|
|
4069
4074
|
ssao: !1,
|
|
4070
4075
|
loader: ni,
|
|
4071
4076
|
ssaoParams: Vs,
|
|
4072
4077
|
css2DRenderer: !1,
|
|
4073
|
-
css2DRendererParams: U({},
|
|
4078
|
+
css2DRendererParams: U({}, st),
|
|
4074
4079
|
css3DRenderer: !1,
|
|
4075
|
-
css3DRendererParams: U({},
|
|
4080
|
+
css3DRendererParams: U({}, st)
|
|
4076
4081
|
};
|
|
4077
|
-
let
|
|
4082
|
+
let ot = _e;
|
|
4078
4083
|
const Xi = J.ACTION;
|
|
4079
4084
|
export {
|
|
4080
|
-
|
|
4081
|
-
|
|
4085
|
+
as as BaseObject,
|
|
4086
|
+
ot as Pencil,
|
|
4082
4087
|
Pe as ResourceTracker,
|
|
4083
4088
|
Xi as cameraControlsAction,
|
|
4084
|
-
|
|
4089
|
+
ot as default
|
|
4085
4090
|
};
|