gl-draw 0.14.41 → 0.15.0-beta.10
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/core/BaseObject.d.ts +5 -3
- package/dist/core/Composer.d.ts +1 -0
- package/dist/core/Lead/Lead.d.ts +4 -1
- package/dist/core/Lead/index.d.ts +2 -1
- package/dist/core/MList/MList.d.ts +25 -0
- package/dist/core/MList/index.d.ts +18 -0
- package/dist/core/Pencil.d.ts +3 -0
- package/dist/core/ResourceTracker.d.ts +4 -6
- package/dist/index.js +3 -3
- package/dist/index.module.js +980 -793
- package/dist/index.module2.js +240 -242
- package/dist/index2.js +6 -6
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var At = Object.defineProperty, St = Object.defineProperties;
|
|
2
|
+
var Mt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Me = Object.getOwnPropertySymbols;
|
|
4
|
+
var Rt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Re = (h, e, t) => e in h ? At(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, U = (h, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
Dt.call(e, t) &&
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var r = (
|
|
7
|
+
Rt.call(e, t) && Re(h, t, e[t]);
|
|
8
|
+
if (Me)
|
|
9
|
+
for (var t of Me(e))
|
|
10
|
+
Dt.call(e, t) && Re(h, t, e[t]);
|
|
11
|
+
return h;
|
|
12
|
+
}, te = (h, e) => St(h, Mt(e));
|
|
13
|
+
var se = (h, e, t) => new Promise((s, i) => {
|
|
14
|
+
var r = (a) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
n(t.next(a));
|
|
17
17
|
} catch (d) {
|
|
18
18
|
i(d);
|
|
19
19
|
}
|
|
20
|
-
}, o = (
|
|
20
|
+
}, o = (a) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
n(t.throw(a));
|
|
23
23
|
} catch (d) {
|
|
24
24
|
i(d);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
27
|
+
n((t = t.apply(h, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import { WebGLRenderer as
|
|
30
|
-
import { Timer as
|
|
29
|
+
import { WebGLRenderer as Ut, Vector2 as B, Vector3 as H, PerspectiveCamera as zt, Matrix4 as W, Scene as nt, AxesHelper as De, CameraHelper as kt, PointLightHelper as Ft, DirectionalLightHelper as Nt, SpotLightHelper as It, HemisphereLightHelper as Ht, Box3 as at, Box3Helper as Ue, MathUtils as jt, Vector4 as Bt, Quaternion as lt, Spherical as Vt, Sphere as Yt, Raycaster as ht, REVISION as Zt, Object3D as Wt, UniformsUtils as Gt, RawShaderMaterial as Kt, ShaderMaterial as Xt, MeshBasicMaterial as $t, PointsMaterial as ct, SpriteMaterial as dt, Layers as qt, WebGLRenderTarget as Qt, HalfFloatType as Jt, Loader as pt, Texture as fe, VideoTexture as mt, FileLoader as Ae, LoadingManager as es, DataTexture as ts, Mesh as ss } from "three";
|
|
30
|
+
import { Timer as is } from "three/examples/jsm/misc/Timer";
|
|
31
31
|
import * as Ce from "@tweenjs/tween.js";
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { C as
|
|
35
|
-
import { R as
|
|
32
|
+
import rs from "deepmerge";
|
|
33
|
+
import os from "stats-gl";
|
|
34
|
+
import { C as ns, c as as, i as ls } from "./isPlainObject.module.js";
|
|
35
|
+
import { R as Pe, M as ut, B as hs, G as ze } from "./index.module2.js";
|
|
36
36
|
import { RectAreaLightHelper as cs } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
37
37
|
import { ViewHelper as ds } from "three/examples/jsm/helpers/ViewHelper";
|
|
38
38
|
import { TransformControls as ps } from "three/examples/jsm/controls/TransformControls";
|
|
39
|
-
import { EffectComposer as
|
|
39
|
+
import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
40
40
|
import { RenderPass as ms } from "three/examples/jsm/postprocessing/RenderPass";
|
|
41
41
|
import { SSAOPass as us } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
42
|
-
import { FullScreenQuad as
|
|
42
|
+
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
43
43
|
import { OutputPass as fs } from "three/examples/jsm/postprocessing/OutputPass";
|
|
44
44
|
import { ShaderPass as _s } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
45
45
|
import { UnrealBloomPass as gs } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
@@ -53,11 +53,11 @@ import "three/examples/jsm/lines/LineSegments2";
|
|
|
53
53
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
54
54
|
import "three/examples/jsm/lines/LineMaterial";
|
|
55
55
|
import "three-bvh-csg";
|
|
56
|
-
import { GLTFLoader as
|
|
57
|
-
import { DRACOLoader as
|
|
58
|
-
import { EXRLoader as
|
|
56
|
+
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
+
import { DRACOLoader as ys } from "three/examples/jsm/loaders/DRACOLoader";
|
|
58
|
+
import { EXRLoader as vs } from "three/examples/jsm/loaders/EXRLoader";
|
|
59
59
|
import { LottieLoader as Cs } from "three/examples/jsm/loaders/LottieLoader";
|
|
60
|
-
import { makePromiseCreator as
|
|
60
|
+
import { makePromiseCreator as Os, generateUUID as Ie } from "esus-lite";
|
|
61
61
|
const M = {
|
|
62
62
|
LEFT: 1,
|
|
63
63
|
RIGHT: 2,
|
|
@@ -89,66 +89,66 @@ const M = {
|
|
|
89
89
|
IN: 1,
|
|
90
90
|
OUT: -1
|
|
91
91
|
};
|
|
92
|
-
function Y(
|
|
93
|
-
return
|
|
92
|
+
function Y(h) {
|
|
93
|
+
return h.isPerspectiveCamera;
|
|
94
94
|
}
|
|
95
|
-
function j(
|
|
96
|
-
return
|
|
95
|
+
function j(h) {
|
|
96
|
+
return h.isOrthographicCamera;
|
|
97
97
|
}
|
|
98
|
-
const K = Math.PI * 2, He = Math.PI / 2,
|
|
99
|
-
function k(
|
|
100
|
-
return Math.max(e, Math.min(t,
|
|
98
|
+
const K = Math.PI * 2, He = Math.PI / 2, ft = 1e-5, ie = Math.PI / 180;
|
|
99
|
+
function k(h, e, t) {
|
|
100
|
+
return Math.max(e, Math.min(t, h));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return Math.abs(
|
|
102
|
+
function S(h, e = ft) {
|
|
103
|
+
return Math.abs(h) < e;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
105
|
+
function P(h, e, t = ft) {
|
|
106
|
+
return S(h - e, t);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return Math.round(
|
|
108
|
+
function je(h, e) {
|
|
109
|
+
return Math.round(h / e) * e;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
return isFinite(
|
|
111
|
+
function re(h) {
|
|
112
|
+
return isFinite(h) ? h : h < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
return Math.abs(
|
|
114
|
+
function oe(h) {
|
|
115
|
+
return Math.abs(h) < Number.MAX_VALUE ? h : h * (1 / 0);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function he(h, e, t, s, i = 1 / 0, r) {
|
|
118
118
|
s = Math.max(1e-4, s);
|
|
119
|
-
const o = 2 / s,
|
|
120
|
-
let d =
|
|
121
|
-
const
|
|
122
|
-
d = k(d, -p, p), e =
|
|
123
|
-
const
|
|
124
|
-
t.value = (t.value - o *
|
|
125
|
-
let
|
|
126
|
-
return
|
|
119
|
+
const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
120
|
+
let d = h - e;
|
|
121
|
+
const _ = e, p = i * s;
|
|
122
|
+
d = k(d, -p, p), e = h - d;
|
|
123
|
+
const O = (t.value + o * d) * r;
|
|
124
|
+
t.value = (t.value - o * O) * a;
|
|
125
|
+
let y = e + (d + O) * a;
|
|
126
|
+
return _ - h > 0 == y > _ && (y = _, t.value = (y - _) / r), y;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Be(h, e, t, s, i = 1 / 0, r, o) {
|
|
129
129
|
s = Math.max(1e-4, s);
|
|
130
|
-
const
|
|
131
|
-
let
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
t.x = (t.x -
|
|
140
|
-
const
|
|
141
|
-
return
|
|
130
|
+
const n = 2 / s, a = n * r, d = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
131
|
+
let _ = e.x, p = e.y, O = e.z, y = h.x - _, m = h.y - p, u = h.z - O;
|
|
132
|
+
const f = _, l = p, g = O, C = i * s, v = C * C, b = y * y + m * m + u * u;
|
|
133
|
+
if (b > v) {
|
|
134
|
+
const ve = Math.sqrt(b);
|
|
135
|
+
y = y / ve * C, m = m / ve * C, u = u / ve * C;
|
|
136
|
+
}
|
|
137
|
+
_ = h.x - y, p = h.y - m, O = h.z - u;
|
|
138
|
+
const E = (t.x + n * y) * r, w = (t.y + n * m) * r, R = (t.z + n * u) * r;
|
|
139
|
+
t.x = (t.x - n * E) * d, t.y = (t.y - n * w) * d, t.z = (t.z - n * R) * d, o.x = _ + (y + E) * d, o.y = p + (m + w) * d, o.z = O + (u + R) * d;
|
|
140
|
+
const V = f - h.x, le = l - h.y, xt = g - h.z, wt = o.x - f, Lt = o.y - l, Pt = o.z - g;
|
|
141
|
+
return V * wt + le * Lt + xt * Pt > 0 && (o.x = f, o.y = l, o.z = g, t.x = (o.x - f) / r, t.y = (o.y - l) / r, t.z = (o.z - g) / r), o;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
e.set(0, 0),
|
|
143
|
+
function Oe(h, e) {
|
|
144
|
+
e.set(0, 0), h.forEach((t) => {
|
|
145
145
|
e.x += t.clientX, e.y += t.clientY;
|
|
146
|
-
}), e.x /=
|
|
146
|
+
}), e.x /= h.length, e.y /= h.length;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return j(
|
|
148
|
+
function Ee(h, e) {
|
|
149
|
+
return j(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
150
150
|
}
|
|
151
|
-
class
|
|
151
|
+
class Es {
|
|
152
152
|
constructor() {
|
|
153
153
|
this._listeners = {};
|
|
154
154
|
}
|
|
@@ -213,10 +213,10 @@ class Os {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
const ce = 1 / 8, Ts = /Mac/.test(navigator.platform);
|
|
216
|
-
let T, Ve, de, Te,
|
|
217
|
-
class J extends
|
|
216
|
+
let T, Ve, de, Te, D, x, L, X, ne, F, N, Z, Ye, Ze, z, ae, $, We, be, Ge, xe, we, pe;
|
|
217
|
+
class J extends Es {
|
|
218
218
|
static install(e) {
|
|
219
|
-
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), de = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)),
|
|
219
|
+
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), de = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), x = new T.Vector3(), L = new T.Vector3(), X = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Ye = new T.Vector3(), Ze = new T.Vector3(), z = new T.Spherical(), ae = new T.Spherical(), $ = new T.Box3(), We = new T.Box3(), be = new T.Sphere(), Ge = new T.Quaternion(), xe = new T.Quaternion(), we = new T.Matrix4(), pe = new T.Raycaster();
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* list all ACTIONs
|
|
@@ -244,40 +244,40 @@ class J extends Os {
|
|
|
244
244
|
*/
|
|
245
245
|
constructor(e, t) {
|
|
246
246
|
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 = () => {
|
|
247
|
-
}, this._enabled = !0, this._state = c.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 = G.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 = (
|
|
248
|
-
let
|
|
247
|
+
}, this._enabled = !0, this._state = c.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 = G.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, g, C, v) => {
|
|
248
|
+
let b, E;
|
|
249
249
|
if (Y(this._camera)) {
|
|
250
|
-
const
|
|
251
|
-
|
|
250
|
+
const w = x.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = w.length() * Math.tan(R * 0.5);
|
|
251
|
+
b = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * g * V / this._elementRect.height;
|
|
252
252
|
} else if (j(this._camera)) {
|
|
253
|
-
const
|
|
254
|
-
|
|
253
|
+
const w = this._camera;
|
|
254
|
+
b = this.truckSpeed * l * (w.right - w.left) / w.zoom / this._elementRect.width, E = this.truckSpeed * g * (w.top - w.bottom) / w.zoom / this._elementRect.height;
|
|
255
255
|
} else
|
|
256
256
|
return;
|
|
257
|
-
|
|
258
|
-
this._focalOffsetEnd.x +
|
|
257
|
+
v ? (C ? this.setFocalOffset(
|
|
258
|
+
this._focalOffsetEnd.x + b,
|
|
259
259
|
this._focalOffsetEnd.y,
|
|
260
260
|
this._focalOffsetEnd.z,
|
|
261
261
|
!0
|
|
262
|
-
) : this.truck(
|
|
263
|
-
this._focalOffsetEnd.x +
|
|
264
|
-
this._focalOffsetEnd.y +
|
|
262
|
+
) : this.truck(b, 0, !0), this.forward(-E, !0)) : C ? this.setFocalOffset(
|
|
263
|
+
this._focalOffsetEnd.x + b,
|
|
264
|
+
this._focalOffsetEnd.y + E,
|
|
265
265
|
this._focalOffsetEnd.z,
|
|
266
266
|
!0
|
|
267
|
-
) : this.truck(
|
|
268
|
-
}, this._rotateInternal = (
|
|
269
|
-
const
|
|
270
|
-
this.rotate(
|
|
271
|
-
}, this._dollyInternal = (
|
|
272
|
-
const
|
|
273
|
-
|
|
267
|
+
) : this.truck(b, E, !0);
|
|
268
|
+
}, this._rotateInternal = (l, g) => {
|
|
269
|
+
const C = K * this.azimuthRotateSpeed * l / this._elementRect.height, v = K * this.polarRotateSpeed * g / this._elementRect.height;
|
|
270
|
+
this.rotate(C, v, !0);
|
|
271
|
+
}, this._dollyInternal = (l, g, C) => {
|
|
272
|
+
const v = Math.pow(0.95, -l * this.dollySpeed), b = this._sphericalEnd.radius, E = this._sphericalEnd.radius * v, w = k(
|
|
273
|
+
E,
|
|
274
274
|
this.minDistance,
|
|
275
275
|
this.maxDistance
|
|
276
|
-
),
|
|
277
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(
|
|
278
|
-
}, this._zoomInternal = (
|
|
279
|
-
const
|
|
280
|
-
this.zoomTo(
|
|
276
|
+
), R = w - E;
|
|
277
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(w, !0)) : this._dollyToNoClamp(w, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : w) - b, this._dollyControlCoord.set(g, C)), this._lastDollyDirection = Math.sign(-l);
|
|
278
|
+
}, this._zoomInternal = (l, g, C) => {
|
|
279
|
+
const v = Math.pow(0.95, l * this.dollySpeed), b = this._zoom, E = this._zoom * v;
|
|
280
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - b, this._dollyControlCoord.set(g, C));
|
|
281
281
|
}, typeof T == "undefined" && console.error(
|
|
282
282
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
283
283
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
@@ -303,45 +303,45 @@ class J extends Os {
|
|
|
303
303
|
two: Y(this._camera) ? c.TOUCH_DOLLY_TRUCK : j(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
|
|
304
304
|
three: c.TOUCH_TRUCK
|
|
305
305
|
};
|
|
306
|
-
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (
|
|
306
|
+
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
307
307
|
if (!this._enabled || !this._domElement) return;
|
|
308
308
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
309
|
+
const v = this._domElement.getBoundingClientRect(), b = (l.clientX - v.left) / (v.right - v.left), E = (l.clientY - v.top) / (v.bottom - v.top);
|
|
310
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
const
|
|
316
|
-
|
|
313
|
+
const g = 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;
|
|
314
|
+
if (g !== null) {
|
|
315
|
+
const v = this._findPointerByMouseButton(g);
|
|
316
|
+
v && this._disposePointer(v);
|
|
317
317
|
}
|
|
318
|
-
if ((
|
|
318
|
+
if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
319
319
|
return;
|
|
320
|
-
const
|
|
321
|
-
pointerId:
|
|
322
|
-
clientX:
|
|
323
|
-
clientY:
|
|
320
|
+
const C = {
|
|
321
|
+
pointerId: l.pointerId,
|
|
322
|
+
clientX: l.clientX,
|
|
323
|
+
clientY: l.clientY,
|
|
324
324
|
deltaX: 0,
|
|
325
325
|
deltaY: 0,
|
|
326
|
-
mouseButton:
|
|
326
|
+
mouseButton: g
|
|
327
327
|
};
|
|
328
|
-
this._activePointers.push(
|
|
328
|
+
this._activePointers.push(C), this._domElement.ownerDocument.removeEventListener(
|
|
329
329
|
"pointermove",
|
|
330
|
-
|
|
330
|
+
n,
|
|
331
331
|
{ passive: !1 }
|
|
332
332
|
), this._domElement.ownerDocument.removeEventListener(
|
|
333
333
|
"pointerup",
|
|
334
|
-
|
|
334
|
+
a
|
|
335
335
|
), this._domElement.ownerDocument.addEventListener(
|
|
336
336
|
"pointermove",
|
|
337
|
-
|
|
337
|
+
n,
|
|
338
338
|
{ passive: !1 }
|
|
339
|
-
), this._domElement.ownerDocument.addEventListener("pointerup",
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
344
|
-
if (
|
|
339
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, O(l);
|
|
340
|
+
}, n = (l) => {
|
|
341
|
+
l.cancelable && l.preventDefault();
|
|
342
|
+
const g = l.pointerId, C = this._lockedPointer || this._findPointerById(g);
|
|
343
|
+
if (C) {
|
|
344
|
+
if (C.clientX = l.clientX, C.clientY = l.clientY, C.deltaX = l.movementX, C.deltaY = l.movementY, this._state = 0, l.pointerType === "touch")
|
|
345
345
|
switch (this._activePointers.length) {
|
|
346
346
|
case 1:
|
|
347
347
|
this._state = this.touches.one;
|
|
@@ -354,13 +354,13 @@ class J extends Os {
|
|
|
354
354
|
break;
|
|
355
355
|
}
|
|
356
356
|
else
|
|
357
|
-
(!this._isDragging && this._lockedPointer || this._isDragging && (
|
|
358
|
-
|
|
357
|
+
(!this._isDragging && this._lockedPointer || this._isDragging && (l.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
358
|
+
y();
|
|
359
359
|
}
|
|
360
|
-
},
|
|
361
|
-
const
|
|
362
|
-
if (!(
|
|
363
|
-
if (
|
|
360
|
+
}, a = (l) => {
|
|
361
|
+
const g = this._findPointerById(l.pointerId);
|
|
362
|
+
if (!(g && g === this._lockedPointer)) {
|
|
363
|
+
if (g && this._disposePointer(g), l.pointerType === "touch")
|
|
364
364
|
switch (this._activePointers.length) {
|
|
365
365
|
case 0:
|
|
366
366
|
this._state = c.NONE;
|
|
@@ -381,72 +381,72 @@ class J extends Os {
|
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
383
|
let d = -1;
|
|
384
|
-
const
|
|
384
|
+
const _ = (l) => {
|
|
385
385
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === c.NONE) return;
|
|
386
386
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
387
|
+
const E = this._domElement.getBoundingClientRect(), w = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
388
|
+
if (w < this._interactiveArea.left || w > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
d -
|
|
391
|
+
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === c.ROTATE || this.mouseButtons.wheel === c.TRUCK) {
|
|
392
|
+
const E = performance.now();
|
|
393
|
+
d - E < 1e3 && this._getClientRect(this._elementRect), d = E;
|
|
394
394
|
}
|
|
395
|
-
const
|
|
395
|
+
const g = Ts ? -1 : -3, C = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / g : l.deltaY / (g * 10), v = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, b = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
396
396
|
switch (this.mouseButtons.wheel) {
|
|
397
397
|
case c.ROTATE: {
|
|
398
|
-
this._rotateInternal(
|
|
398
|
+
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
399
399
|
break;
|
|
400
400
|
}
|
|
401
401
|
case c.TRUCK: {
|
|
402
|
-
this._truckInternal(
|
|
402
|
+
this._truckInternal(l.deltaX, l.deltaY, !1, !1), this._isUserControllingTruck = !0;
|
|
403
403
|
break;
|
|
404
404
|
}
|
|
405
405
|
case c.SCREEN_PAN: {
|
|
406
|
-
this._truckInternal(
|
|
406
|
+
this._truckInternal(l.deltaX, l.deltaY, !1, !0), this._isUserControllingTruck = !0;
|
|
407
407
|
break;
|
|
408
408
|
}
|
|
409
409
|
case c.OFFSET: {
|
|
410
|
-
this._truckInternal(
|
|
410
|
+
this._truckInternal(l.deltaX, l.deltaY, !0, !1), this._isUserControllingOffset = !0;
|
|
411
411
|
break;
|
|
412
412
|
}
|
|
413
413
|
case c.DOLLY: {
|
|
414
|
-
this._dollyInternal(-
|
|
414
|
+
this._dollyInternal(-C, v, b), this._isUserControllingDolly = !0;
|
|
415
415
|
break;
|
|
416
416
|
}
|
|
417
417
|
case c.ZOOM: {
|
|
418
|
-
this._zoomInternal(-
|
|
418
|
+
this._zoomInternal(-C, v, b), this._isUserControllingZoom = !0;
|
|
419
419
|
break;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
this.dispatchEvent({ type: "control" });
|
|
423
|
-
}, p = (
|
|
423
|
+
}, p = (l) => {
|
|
424
424
|
if (!(!this._domElement || !this._enabled)) {
|
|
425
425
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
426
|
-
const
|
|
427
|
-
|
|
426
|
+
const g = l instanceof PointerEvent ? l.pointerId : 0, C = this._findPointerById(g);
|
|
427
|
+
C && this._disposePointer(C), this._domElement.ownerDocument.removeEventListener(
|
|
428
428
|
"pointermove",
|
|
429
|
-
|
|
429
|
+
n,
|
|
430
430
|
{ passive: !1 }
|
|
431
431
|
), this._domElement.ownerDocument.removeEventListener(
|
|
432
432
|
"pointerup",
|
|
433
|
-
|
|
433
|
+
a
|
|
434
434
|
);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
|
|
437
|
+
l.preventDefault();
|
|
438
438
|
}
|
|
439
|
-
},
|
|
439
|
+
}, O = (l) => {
|
|
440
440
|
if (!this._enabled) return;
|
|
441
|
-
if (
|
|
442
|
-
const
|
|
443
|
-
r.set(0,
|
|
444
|
-
const
|
|
445
|
-
i.set(
|
|
441
|
+
if (Oe(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
442
|
+
const C = D.x - this._activePointers[1].clientX, v = D.y - this._activePointers[1].clientY, b = Math.sqrt(C * C + v * v);
|
|
443
|
+
r.set(0, b);
|
|
444
|
+
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, w = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
445
|
+
i.set(E, w);
|
|
446
446
|
}
|
|
447
|
-
if (this._state = 0, !
|
|
447
|
+
if (this._state = 0, !l)
|
|
448
448
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
449
|
-
else if ("pointerType" in
|
|
449
|
+
else if ("pointerType" in l && l.pointerType === "touch")
|
|
450
450
|
switch (this._activePointers.length) {
|
|
451
451
|
case 1:
|
|
452
452
|
this._state = this.touches.one;
|
|
@@ -459,39 +459,39 @@ class J extends Os {
|
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
461
461
|
else
|
|
462
|
-
!this._lockedPointer && (
|
|
462
|
+
!this._lockedPointer && (l.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
463
463
|
((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & c.TRUCK) === c.TRUCK || (this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & c.DOLLY) === c.DOLLY || (this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & c.ZOOM) === c.ZOOM || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
464
|
-
},
|
|
464
|
+
}, y = () => {
|
|
465
465
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
466
|
-
this._dragNeedsUpdate = !1,
|
|
467
|
-
const
|
|
468
|
-
if (i.copy(
|
|
469
|
-
const
|
|
466
|
+
this._dragNeedsUpdate = !1, Oe(this._activePointers, D);
|
|
467
|
+
const g = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, C = g ? -g.deltaX : i.x - D.x, v = g ? -g.deltaY : i.y - D.y;
|
|
468
|
+
if (i.copy(D), ((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(C, v), this._isUserControllingRotate = !0), (this._state & c.DOLLY) === c.DOLLY || (this._state & c.ZOOM) === c.ZOOM) {
|
|
469
|
+
const b = 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, w = this.dollyDragInverted ? -1 : 1;
|
|
470
470
|
(this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
471
|
+
w * v * ce,
|
|
472
|
+
b,
|
|
473
|
+
E
|
|
474
474
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
475
|
+
w * v * ce,
|
|
476
|
+
b,
|
|
477
|
+
E
|
|
478
478
|
), this._isUserControllingZoom = !0);
|
|
479
479
|
}
|
|
480
480
|
if ((this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) {
|
|
481
|
-
const
|
|
482
|
-
r.set(0,
|
|
483
|
-
const
|
|
484
|
-
(this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(
|
|
481
|
+
const b = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, w = Math.sqrt(b * b + E * E), R = r.y - w;
|
|
482
|
+
r.set(0, w);
|
|
483
|
+
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;
|
|
484
|
+
(this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * ce, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * ce, V, le), this._isUserControllingZoom = !0);
|
|
485
485
|
}
|
|
486
|
-
((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(
|
|
486
|
+
((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(C, v, !1, !1), this._isUserControllingTruck = !0), ((this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(C, v, !1, !0), this._isUserControllingTruck = !0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._truckInternal(C, v, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
487
487
|
}, m = () => {
|
|
488
|
-
|
|
488
|
+
Oe(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(
|
|
489
489
|
"pointermove",
|
|
490
|
-
|
|
490
|
+
n,
|
|
491
491
|
{ passive: !1 }
|
|
492
492
|
), this._domElement.ownerDocument.removeEventListener(
|
|
493
493
|
"pointerup",
|
|
494
|
-
|
|
494
|
+
a
|
|
495
495
|
), this.dispatchEvent({ type: "controlend" }));
|
|
496
496
|
};
|
|
497
497
|
this.lockPointer = () => {
|
|
@@ -504,57 +504,57 @@ class J extends Os {
|
|
|
504
504
|
mouseButton: null
|
|
505
505
|
}, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener(
|
|
506
506
|
"pointermove",
|
|
507
|
-
|
|
507
|
+
n,
|
|
508
508
|
{ passive: !1 }
|
|
509
509
|
), this._domElement.ownerDocument.removeEventListener(
|
|
510
510
|
"pointerup",
|
|
511
|
-
|
|
511
|
+
a
|
|
512
512
|
), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener(
|
|
513
513
|
"pointerlockchange",
|
|
514
514
|
u
|
|
515
515
|
), this._domElement.ownerDocument.addEventListener(
|
|
516
516
|
"pointerlockerror",
|
|
517
|
-
|
|
517
|
+
f
|
|
518
518
|
), this._domElement.ownerDocument.addEventListener(
|
|
519
519
|
"pointermove",
|
|
520
|
-
|
|
520
|
+
n,
|
|
521
521
|
{ passive: !1 }
|
|
522
|
-
), this._domElement.ownerDocument.addEventListener("pointerup",
|
|
522
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", a), O());
|
|
523
523
|
}, this.unlockPointer = () => {
|
|
524
|
-
var
|
|
525
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (
|
|
524
|
+
var l, g, C;
|
|
525
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (g = this._domElement) === null || g === void 0 || g.ownerDocument.removeEventListener(
|
|
526
526
|
"pointerlockchange",
|
|
527
527
|
u
|
|
528
|
-
), (
|
|
528
|
+
), (C = this._domElement) === null || C === void 0 || C.ownerDocument.removeEventListener(
|
|
529
529
|
"pointerlockerror",
|
|
530
|
-
|
|
530
|
+
f
|
|
531
531
|
), this.cancel();
|
|
532
532
|
};
|
|
533
533
|
const u = () => {
|
|
534
534
|
this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
|
|
535
|
-
},
|
|
535
|
+
}, f = () => {
|
|
536
536
|
this.unlockPointer();
|
|
537
537
|
};
|
|
538
|
-
this._addAllEventListeners = (
|
|
539
|
-
this._domElement =
|
|
538
|
+
this._addAllEventListeners = (l) => {
|
|
539
|
+
this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel", _, {
|
|
540
540
|
passive: !1
|
|
541
541
|
}), this._domElement.addEventListener("contextmenu", p);
|
|
542
542
|
}, this._removeAllEventListeners = () => {
|
|
543
|
-
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel",
|
|
543
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel", _, {
|
|
544
544
|
passive: !1
|
|
545
545
|
}), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
|
|
546
546
|
"pointermove",
|
|
547
|
-
|
|
547
|
+
n,
|
|
548
548
|
{ passive: !1 }
|
|
549
549
|
), this._domElement.ownerDocument.removeEventListener(
|
|
550
550
|
"pointerup",
|
|
551
|
-
|
|
551
|
+
a
|
|
552
552
|
), this._domElement.ownerDocument.removeEventListener(
|
|
553
553
|
"pointerlockchange",
|
|
554
554
|
u
|
|
555
555
|
), this._domElement.ownerDocument.removeEventListener(
|
|
556
556
|
"pointerlockerror",
|
|
557
|
-
|
|
557
|
+
f
|
|
558
558
|
));
|
|
559
559
|
}, this.cancel = () => {
|
|
560
560
|
this._state !== c.NONE && (this._state = c.NONE, this._activePointers.length = 0, m());
|
|
@@ -795,11 +795,11 @@ class J extends Os {
|
|
|
795
795
|
this.maxAzimuthAngle
|
|
796
796
|
), r = k(t, this.minPolarAngle, this.maxPolarAngle);
|
|
797
797
|
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);
|
|
798
|
-
const o = !s ||
|
|
798
|
+
const o = !s || P(
|
|
799
799
|
this._spherical.theta,
|
|
800
800
|
this._sphericalEnd.theta,
|
|
801
801
|
this.restThreshold
|
|
802
|
-
) &&
|
|
802
|
+
) && P(
|
|
803
803
|
this._spherical.phi,
|
|
804
804
|
this._sphericalEnd.phi,
|
|
805
805
|
this.restThreshold
|
|
@@ -830,11 +830,11 @@ class J extends Os {
|
|
|
830
830
|
_dollyToNoClamp(e, t = !1) {
|
|
831
831
|
const s = this._sphericalEnd.radius;
|
|
832
832
|
if (this.colliderMeshes.length >= 1) {
|
|
833
|
-
const o = this._collisionTest(),
|
|
833
|
+
const o = this._collisionTest(), n = P(
|
|
834
834
|
o,
|
|
835
835
|
this._spherical.radius
|
|
836
836
|
);
|
|
837
|
-
if (!(s > e) &&
|
|
837
|
+
if (!(s > e) && n) return Promise.resolve();
|
|
838
838
|
this._sphericalEnd.radius = Math.min(
|
|
839
839
|
e,
|
|
840
840
|
o
|
|
@@ -842,7 +842,7 @@ class J extends Os {
|
|
|
842
842
|
} else
|
|
843
843
|
this._sphericalEnd.radius = e;
|
|
844
844
|
this._needsUpdate = !0, t || (this._spherical.radius = this._sphericalEnd.radius);
|
|
845
|
-
const r = !t ||
|
|
845
|
+
const r = !t || P(
|
|
846
846
|
this._spherical.radius,
|
|
847
847
|
this._sphericalEnd.radius,
|
|
848
848
|
this.restThreshold
|
|
@@ -858,9 +858,9 @@ class J extends Os {
|
|
|
858
858
|
*/
|
|
859
859
|
dollyInFixed(e, t = !1) {
|
|
860
860
|
this._targetEnd.add(
|
|
861
|
-
this._getCameraDirection(
|
|
861
|
+
this._getCameraDirection(ne).multiplyScalar(e)
|
|
862
862
|
), t || this._target.copy(this._targetEnd);
|
|
863
|
-
const s = !t ||
|
|
863
|
+
const s = !t || 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);
|
|
864
864
|
return this._createOnRestPromise(s);
|
|
865
865
|
}
|
|
866
866
|
/**
|
|
@@ -882,7 +882,7 @@ class J extends Os {
|
|
|
882
882
|
*/
|
|
883
883
|
zoomTo(e, t = !1) {
|
|
884
884
|
this._isUserControllingZoom = !1, this._zoomEnd = k(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
|
|
885
|
-
const s = !t ||
|
|
885
|
+
const s = !t || P(this._zoom, this._zoomEnd, this.restThreshold);
|
|
886
886
|
return this._changedZoom = 0, this._createOnRestPromise(s);
|
|
887
887
|
}
|
|
888
888
|
/**
|
|
@@ -901,7 +901,7 @@ class J extends Os {
|
|
|
901
901
|
*/
|
|
902
902
|
truck(e, t, s = !1) {
|
|
903
903
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
904
|
-
const i = x.copy(F).add(N), r =
|
|
904
|
+
const i = x.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
905
905
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
906
906
|
}
|
|
907
907
|
/**
|
|
@@ -912,7 +912,7 @@ class J extends Os {
|
|
|
912
912
|
*/
|
|
913
913
|
forward(e, t = !1) {
|
|
914
914
|
x.setFromMatrixColumn(this._camera.matrix, 0), x.crossVectors(this._camera.up, x), x.multiplyScalar(e);
|
|
915
|
-
const s =
|
|
915
|
+
const s = L.copy(this._targetEnd).add(x);
|
|
916
916
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
917
917
|
}
|
|
918
918
|
/**
|
|
@@ -941,7 +941,7 @@ class J extends Os {
|
|
|
941
941
|
this._isUserControllingTruck = !1;
|
|
942
942
|
const r = x.set(e, t, s).sub(this._targetEnd);
|
|
943
943
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
944
|
-
const o = !i ||
|
|
944
|
+
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);
|
|
945
945
|
return this._createOnRestPromise(o);
|
|
946
946
|
}
|
|
947
947
|
/**
|
|
@@ -954,11 +954,11 @@ class J extends Os {
|
|
|
954
954
|
* @category Methods
|
|
955
955
|
*/
|
|
956
956
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
957
|
-
const
|
|
957
|
+
const n = x.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
958
958
|
return this.setPosition(
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
959
|
+
n.x,
|
|
960
|
+
n.y,
|
|
961
|
+
n.z,
|
|
962
962
|
i
|
|
963
963
|
);
|
|
964
964
|
}
|
|
@@ -980,36 +980,36 @@ class J extends Os {
|
|
|
980
980
|
paddingLeft: i = 0,
|
|
981
981
|
paddingRight: r = 0,
|
|
982
982
|
paddingBottom: o = 0,
|
|
983
|
-
paddingTop:
|
|
983
|
+
paddingTop: n = 0
|
|
984
984
|
} = {}) {
|
|
985
|
-
const
|
|
985
|
+
const a = [], d = e.isBox3 ? $.copy(e) : $.setFromObject(e);
|
|
986
986
|
d.isEmpty() && (console.warn(
|
|
987
987
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
988
988
|
), Promise.resolve());
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
const
|
|
992
|
-
m &&
|
|
993
|
-
const u =
|
|
994
|
-
|
|
995
|
-
const
|
|
989
|
+
const _ = je(this._sphericalEnd.theta, He), p = je(this._sphericalEnd.phi, He);
|
|
990
|
+
a.push(this.rotateTo(_, p, t));
|
|
991
|
+
const O = x.setFromSpherical(this._sphericalEnd).normalize(), y = Ge.setFromUnitVectors(O, Te), m = P(Math.abs(O.y), 1);
|
|
992
|
+
m && y.multiply(xe.setFromAxisAngle(de, _)), y.multiply(this._yAxisUpSpaceInverse);
|
|
993
|
+
const u = We.makeEmpty();
|
|
994
|
+
L.copy(d.min).applyQuaternion(y), u.expandByPoint(L), L.copy(d.min).setX(d.max.x).applyQuaternion(y), u.expandByPoint(L), L.copy(d.min).setY(d.max.y).applyQuaternion(y), u.expandByPoint(L), L.copy(d.max).setZ(d.min.z).applyQuaternion(y), u.expandByPoint(L), L.copy(d.min).setZ(d.max.z).applyQuaternion(y), u.expandByPoint(L), L.copy(d.max).setY(d.min.y).applyQuaternion(y), u.expandByPoint(L), L.copy(d.max).setX(d.min.x).applyQuaternion(y), u.expandByPoint(L), L.copy(d.max).applyQuaternion(y), u.expandByPoint(L), u.min.x -= i, u.min.y -= o, u.max.x += r, u.max.y += n, y.setFromUnitVectors(Te, O), m && y.premultiply(xe.invert()), y.premultiply(this._yAxisUpSpace);
|
|
995
|
+
const f = u.getSize(x), l = u.getCenter(L).applyQuaternion(y);
|
|
996
996
|
if (Y(this._camera)) {
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
997
|
+
const g = this.getDistanceToFitBox(
|
|
998
|
+
f.x,
|
|
999
|
+
f.y,
|
|
1000
|
+
f.z,
|
|
1001
1001
|
s
|
|
1002
1002
|
);
|
|
1003
|
-
|
|
1004
|
-
this.moveTo(
|
|
1005
|
-
),
|
|
1003
|
+
a.push(
|
|
1004
|
+
this.moveTo(l.x, l.y, l.z, t)
|
|
1005
|
+
), a.push(this.dollyTo(g, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1006
1006
|
} else if (j(this._camera)) {
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
this.moveTo(
|
|
1010
|
-
),
|
|
1007
|
+
const g = this._camera, C = g.right - g.left, v = g.top - g.bottom, b = s ? Math.max(C / f.x, v / f.y) : Math.min(C / f.x, v / f.y);
|
|
1008
|
+
a.push(
|
|
1009
|
+
this.moveTo(l.x, l.y, l.z, t)
|
|
1010
|
+
), a.push(this.zoomTo(b, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1011
1011
|
}
|
|
1012
|
-
return Promise.all(
|
|
1012
|
+
return Promise.all(a);
|
|
1013
1013
|
}
|
|
1014
1014
|
/**
|
|
1015
1015
|
* Fit the viewport to the sphere or the bounding sphere of the object.
|
|
@@ -1018,7 +1018,7 @@ class J extends Os {
|
|
|
1018
1018
|
* @category Methods
|
|
1019
1019
|
*/
|
|
1020
1020
|
fitToSphere(e, t) {
|
|
1021
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1021
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, be) : be.copy(e);
|
|
1022
1022
|
if (s.push(
|
|
1023
1023
|
this.moveTo(
|
|
1024
1024
|
r.center.x,
|
|
@@ -1030,7 +1030,7 @@ class J extends Os {
|
|
|
1030
1030
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1031
1031
|
s.push(this.dollyTo(o, t));
|
|
1032
1032
|
} else if (j(this._camera)) {
|
|
1033
|
-
const o = this._camera.right - this._camera.left,
|
|
1033
|
+
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, d = Math.min(o / a, n / a);
|
|
1034
1034
|
s.push(this.zoomTo(d, t));
|
|
1035
1035
|
}
|
|
1036
1036
|
return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
|
|
@@ -1046,26 +1046,26 @@ class J extends Os {
|
|
|
1046
1046
|
* @param enableTransition
|
|
1047
1047
|
* @category Methods
|
|
1048
1048
|
*/
|
|
1049
|
-
setLookAt(e, t, s, i, r, o,
|
|
1049
|
+
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1050
1050
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0;
|
|
1051
|
-
const
|
|
1052
|
-
this._targetEnd.copy(
|
|
1053
|
-
d.sub(
|
|
1054
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1055
|
-
const
|
|
1051
|
+
const a = L.set(i, r, o), d = x.set(e, t, s);
|
|
1052
|
+
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1053
|
+
d.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1054
|
+
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1055
|
+
const _ = !n || 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(
|
|
1056
1056
|
this._spherical.theta,
|
|
1057
1057
|
this._sphericalEnd.theta,
|
|
1058
1058
|
this.restThreshold
|
|
1059
|
-
) &&
|
|
1059
|
+
) && P(
|
|
1060
1060
|
this._spherical.phi,
|
|
1061
1061
|
this._sphericalEnd.phi,
|
|
1062
1062
|
this.restThreshold
|
|
1063
|
-
) &&
|
|
1063
|
+
) && P(
|
|
1064
1064
|
this._spherical.radius,
|
|
1065
1065
|
this._sphericalEnd.radius,
|
|
1066
1066
|
this.restThreshold
|
|
1067
1067
|
);
|
|
1068
|
-
return this._createOnRestPromise(
|
|
1068
|
+
return this._createOnRestPromise(_);
|
|
1069
1069
|
}
|
|
1070
1070
|
/**
|
|
1071
1071
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -1085,36 +1085,36 @@ class J extends Os {
|
|
|
1085
1085
|
* @param enableTransition
|
|
1086
1086
|
* @category Methods
|
|
1087
1087
|
*/
|
|
1088
|
-
lerpLookAt(e, t, s, i, r, o,
|
|
1088
|
+
lerpLookAt(e, t, s, i, r, o, n, a, d, _, p, O, y, m = !1) {
|
|
1089
1089
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0;
|
|
1090
|
-
const u = x.set(i, r, o),
|
|
1090
|
+
const u = x.set(i, r, o), f = L.set(e, t, s);
|
|
1091
1091
|
z.setFromVector3(
|
|
1092
|
-
|
|
1092
|
+
f.sub(u).applyQuaternion(this._yAxisUpSpace)
|
|
1093
1093
|
);
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
), this._targetEnd.copy(u.lerp(
|
|
1098
|
-
const
|
|
1094
|
+
const l = X.set(_, p, O), g = L.set(n, a, d);
|
|
1095
|
+
ae.setFromVector3(
|
|
1096
|
+
g.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1097
|
+
), this._targetEnd.copy(u.lerp(l, y));
|
|
1098
|
+
const C = ae.theta - z.theta, v = ae.phi - z.phi, b = ae.radius - z.radius;
|
|
1099
1099
|
this._sphericalEnd.set(
|
|
1100
|
-
z.radius +
|
|
1101
|
-
z.phi +
|
|
1102
|
-
z.theta +
|
|
1100
|
+
z.radius + b * y,
|
|
1101
|
+
z.phi + v * y,
|
|
1102
|
+
z.theta + C * y
|
|
1103
1103
|
), this.normalizeRotations(), this._needsUpdate = !0, m || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1104
|
-
const
|
|
1104
|
+
const E = !m || 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(
|
|
1105
1105
|
this._spherical.theta,
|
|
1106
1106
|
this._sphericalEnd.theta,
|
|
1107
1107
|
this.restThreshold
|
|
1108
|
-
) &&
|
|
1108
|
+
) && P(
|
|
1109
1109
|
this._spherical.phi,
|
|
1110
1110
|
this._sphericalEnd.phi,
|
|
1111
1111
|
this.restThreshold
|
|
1112
|
-
) &&
|
|
1112
|
+
) && P(
|
|
1113
1113
|
this._spherical.radius,
|
|
1114
1114
|
this._sphericalEnd.radius,
|
|
1115
1115
|
this.restThreshold
|
|
1116
1116
|
);
|
|
1117
|
-
return this._createOnRestPromise(
|
|
1117
|
+
return this._createOnRestPromise(E);
|
|
1118
1118
|
}
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Set angle and distance by given position.
|
|
@@ -1171,15 +1171,15 @@ class J extends Os {
|
|
|
1171
1171
|
*/
|
|
1172
1172
|
setFocalOffset(e, t, s, i = !1) {
|
|
1173
1173
|
this._isUserControllingOffset = !1, this._focalOffsetEnd.set(e, t, s), this._needsUpdate = !0, i || this._focalOffset.copy(this._focalOffsetEnd);
|
|
1174
|
-
const r = !i ||
|
|
1174
|
+
const r = !i || P(
|
|
1175
1175
|
this._focalOffset.x,
|
|
1176
1176
|
this._focalOffsetEnd.x,
|
|
1177
1177
|
this.restThreshold
|
|
1178
|
-
) &&
|
|
1178
|
+
) && P(
|
|
1179
1179
|
this._focalOffset.y,
|
|
1180
1180
|
this._focalOffsetEnd.y,
|
|
1181
1181
|
this.restThreshold
|
|
1182
|
-
) &&
|
|
1182
|
+
) && P(
|
|
1183
1183
|
this._focalOffset.z,
|
|
1184
1184
|
this._focalOffsetEnd.z,
|
|
1185
1185
|
this.restThreshold
|
|
@@ -1236,10 +1236,10 @@ class J extends Os {
|
|
|
1236
1236
|
* @category Methods
|
|
1237
1237
|
*/
|
|
1238
1238
|
getDistanceToFitBox(e, t, s, i = !1) {
|
|
1239
|
-
if (
|
|
1239
|
+
if (Ee(this._camera, "getDistanceToFitBox"))
|
|
1240
1240
|
return this._spherical.radius;
|
|
1241
|
-
const r = e / t, o = this._camera.getEffectiveFOV() *
|
|
1242
|
-
return ((i ? r >
|
|
1241
|
+
const r = e / t, o = this._camera.getEffectiveFOV() * ie, n = this._camera.aspect;
|
|
1242
|
+
return ((i ? r > n : r < n) ? t : e / n) * 0.5 / Math.tan(o * 0.5) + s * 0.5;
|
|
1243
1243
|
}
|
|
1244
1244
|
/**
|
|
1245
1245
|
* Calculate the distance to fit the sphere.
|
|
@@ -1248,9 +1248,9 @@ class J extends Os {
|
|
|
1248
1248
|
* @category Methods
|
|
1249
1249
|
*/
|
|
1250
1250
|
getDistanceToFitSphere(e) {
|
|
1251
|
-
if (
|
|
1251
|
+
if (Ee(this._camera, "getDistanceToFitSphere"))
|
|
1252
1252
|
return this._spherical.radius;
|
|
1253
|
-
const t = this._camera.getEffectiveFOV() *
|
|
1253
|
+
const t = this._camera.getEffectiveFOV() * ie, s = Math.atan(Math.tan(t * 0.5) * this._camera.aspect) * 2, i = 1 < this._camera.aspect ? t : s;
|
|
1254
1254
|
return e / Math.sin(i * 0.5);
|
|
1255
1255
|
}
|
|
1256
1256
|
/**
|
|
@@ -1310,7 +1310,7 @@ class J extends Os {
|
|
|
1310
1310
|
* @category Methods
|
|
1311
1311
|
*/
|
|
1312
1312
|
reset(e = !1) {
|
|
1313
|
-
if (!
|
|
1313
|
+
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)) {
|
|
1314
1314
|
this._camera.up.copy(this._cameraUp0);
|
|
1315
1315
|
const s = this.getPosition(x);
|
|
1316
1316
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
@@ -1356,7 +1356,7 @@ class J extends Os {
|
|
|
1356
1356
|
* @category Methods
|
|
1357
1357
|
*/
|
|
1358
1358
|
applyCameraUp() {
|
|
1359
|
-
const e = x.subVectors(this._target, this._camera.position).normalize(), t =
|
|
1359
|
+
const e = x.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1360
1360
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1361
1361
|
const s = this.getPosition(x);
|
|
1362
1362
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
@@ -1369,15 +1369,15 @@ class J extends Os {
|
|
|
1369
1369
|
* @category Methods
|
|
1370
1370
|
*/
|
|
1371
1371
|
update(e) {
|
|
1372
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r =
|
|
1372
|
+
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r = Ye.subVectors(this._targetEnd, this._target), o = Ze.subVectors(
|
|
1373
1373
|
this._focalOffsetEnd,
|
|
1374
1374
|
this._focalOffset
|
|
1375
|
-
),
|
|
1376
|
-
if (
|
|
1375
|
+
), n = this._zoomEnd - this._zoom;
|
|
1376
|
+
if (S(t))
|
|
1377
1377
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1378
1378
|
else {
|
|
1379
1379
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1380
|
-
this._spherical.theta =
|
|
1380
|
+
this._spherical.theta = he(
|
|
1381
1381
|
this._spherical.theta,
|
|
1382
1382
|
this._sphericalEnd.theta,
|
|
1383
1383
|
this._thetaVelocity,
|
|
@@ -1386,11 +1386,11 @@ class J extends Os {
|
|
|
1386
1386
|
e
|
|
1387
1387
|
), this._needsUpdate = !0;
|
|
1388
1388
|
}
|
|
1389
|
-
if (
|
|
1389
|
+
if (S(s))
|
|
1390
1390
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1391
1391
|
else {
|
|
1392
1392
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1393
|
-
this._spherical.phi =
|
|
1393
|
+
this._spherical.phi = he(
|
|
1394
1394
|
this._spherical.phi,
|
|
1395
1395
|
this._sphericalEnd.phi,
|
|
1396
1396
|
this._phiVelocity,
|
|
@@ -1399,11 +1399,11 @@ class J extends Os {
|
|
|
1399
1399
|
e
|
|
1400
1400
|
), this._needsUpdate = !0;
|
|
1401
1401
|
}
|
|
1402
|
-
if (
|
|
1402
|
+
if (S(i))
|
|
1403
1403
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1404
1404
|
else {
|
|
1405
1405
|
const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
1406
|
-
this._spherical.radius =
|
|
1406
|
+
this._spherical.radius = he(
|
|
1407
1407
|
this._spherical.radius,
|
|
1408
1408
|
this._sphericalEnd.radius,
|
|
1409
1409
|
this._radiusVelocity,
|
|
@@ -1412,11 +1412,11 @@ class J extends Os {
|
|
|
1412
1412
|
e
|
|
1413
1413
|
), this._needsUpdate = !0;
|
|
1414
1414
|
}
|
|
1415
|
-
if (
|
|
1415
|
+
if (S(r.x) && S(r.y) && S(r.z))
|
|
1416
1416
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1417
1417
|
else {
|
|
1418
1418
|
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1419
|
-
|
|
1419
|
+
Be(
|
|
1420
1420
|
this._target,
|
|
1421
1421
|
this._targetEnd,
|
|
1422
1422
|
this._targetVelocity,
|
|
@@ -1426,11 +1426,11 @@ class J extends Os {
|
|
|
1426
1426
|
this._target
|
|
1427
1427
|
), this._needsUpdate = !0;
|
|
1428
1428
|
}
|
|
1429
|
-
if (
|
|
1429
|
+
if (S(o.x) && S(o.y) && S(o.z))
|
|
1430
1430
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1431
1431
|
else {
|
|
1432
1432
|
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1433
|
-
|
|
1433
|
+
Be(
|
|
1434
1434
|
this._focalOffset,
|
|
1435
1435
|
this._focalOffsetEnd,
|
|
1436
1436
|
this._focalOffsetVelocity,
|
|
@@ -1440,11 +1440,11 @@ class J extends Os {
|
|
|
1440
1440
|
this._focalOffset
|
|
1441
1441
|
), this._needsUpdate = !0;
|
|
1442
1442
|
}
|
|
1443
|
-
if (
|
|
1443
|
+
if (S(n))
|
|
1444
1444
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1445
1445
|
else {
|
|
1446
1446
|
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
1447
|
-
this._zoom =
|
|
1447
|
+
this._zoom = he(
|
|
1448
1448
|
this._zoom,
|
|
1449
1449
|
this._zoomEnd,
|
|
1450
1450
|
this._zoomVelocity,
|
|
@@ -1455,45 +1455,45 @@ class J extends Os {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
if (this.dollyToCursor) {
|
|
1457
1457
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1458
|
-
const p = this._spherical.radius - this._lastDistance,
|
|
1458
|
+
const p = this._spherical.radius - this._lastDistance, O = this._camera, y = this._getCameraDirection(ne), m = x.copy(y).cross(O.up).normalize();
|
|
1459
1459
|
m.lengthSq() === 0 && (m.x = 1);
|
|
1460
|
-
const u =
|
|
1460
|
+
const u = L.crossVectors(m, y), f = this._sphericalEnd.radius * Math.tan(O.getEffectiveFOV() * ie * 0.5), g = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, C = X.copy(this._targetEnd).add(
|
|
1461
1461
|
m.multiplyScalar(
|
|
1462
|
-
this._dollyControlCoord.x *
|
|
1462
|
+
this._dollyControlCoord.x * f * O.aspect
|
|
1463
1463
|
)
|
|
1464
1464
|
).add(
|
|
1465
|
-
u.multiplyScalar(this._dollyControlCoord.y *
|
|
1466
|
-
),
|
|
1467
|
-
if (this.infinityDolly && (
|
|
1465
|
+
u.multiplyScalar(this._dollyControlCoord.y * f)
|
|
1466
|
+
), v = x.copy(this._targetEnd).lerp(C, g), b = this._lastDollyDirection === G.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === G.OUT && this.maxDistance <= this._spherical.radius;
|
|
1467
|
+
if (this.infinityDolly && (b || E)) {
|
|
1468
1468
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1469
|
-
const
|
|
1470
|
-
|
|
1469
|
+
const R = L.copy(y).multiplyScalar(-p);
|
|
1470
|
+
v.add(R);
|
|
1471
1471
|
}
|
|
1472
|
-
this._boundary.clampPoint(
|
|
1473
|
-
const
|
|
1474
|
-
this._targetEnd.copy(
|
|
1472
|
+
this._boundary.clampPoint(v, v);
|
|
1473
|
+
const w = L.subVectors(v, this._targetEnd);
|
|
1474
|
+
this._targetEnd.copy(v), this._target.add(w), this._changedDolly -= p, S(this._changedDolly) && (this._changedDolly = 0);
|
|
1475
1475
|
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1476
|
-
const p = this._zoom - this._lastZoom,
|
|
1476
|
+
const p = this._zoom - this._lastZoom, O = this._camera, y = x.set(
|
|
1477
1477
|
this._dollyControlCoord.x,
|
|
1478
1478
|
this._dollyControlCoord.y,
|
|
1479
|
-
(
|
|
1480
|
-
).unproject(
|
|
1481
|
-
|
|
1479
|
+
(O.near + O.far) / (O.near - O.far)
|
|
1480
|
+
).unproject(O), m = L.set(0, 0, -1).applyQuaternion(O.quaternion), u = X.copy(y).add(m.multiplyScalar(-y.dot(O.up))), l = -(this._zoom - p - this._zoom) / this._zoom, g = this._getCameraDirection(ne), C = this._targetEnd.dot(g), v = x.copy(this._targetEnd).lerp(u, l), b = v.dot(g), E = g.multiplyScalar(
|
|
1481
|
+
b - C
|
|
1482
1482
|
);
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1485
|
-
this._targetEnd.copy(
|
|
1483
|
+
v.sub(E), this._boundary.clampPoint(v, v);
|
|
1484
|
+
const w = L.subVectors(v, this._targetEnd);
|
|
1485
|
+
this._targetEnd.copy(v), this._target.add(w), this._changedZoom -= p, S(this._changedZoom) && (this._changedZoom = 0);
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1489
|
-
const
|
|
1490
|
-
this._spherical.radius = Math.min(this._spherical.radius,
|
|
1489
|
+
const a = this._collisionTest();
|
|
1490
|
+
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), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(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(
|
|
1491
1491
|
this._camera.position.copy(this._target),
|
|
1492
1492
|
x.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1493
1493
|
1
|
|
1494
1494
|
);
|
|
1495
|
-
const
|
|
1496
|
-
return
|
|
1495
|
+
const _ = this._needsUpdate;
|
|
1496
|
+
return _ && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : _ ? (this.dispatchEvent({ type: "update" }), S(t, this.restThreshold) && S(s, this.restThreshold) && S(i, this.restThreshold) && S(r.x, this.restThreshold) && S(r.y, this.restThreshold) && S(r.z, this.restThreshold) && S(o.x, this.restThreshold) && S(o.y, this.restThreshold) && S(o.z, this.restThreshold) && S(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !_ && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = _, this._needsUpdate = !1, _;
|
|
1497
1497
|
}
|
|
1498
1498
|
/**
|
|
1499
1499
|
* Get all state in JSON string
|
|
@@ -1503,13 +1503,13 @@ class J extends Os {
|
|
|
1503
1503
|
return JSON.stringify({
|
|
1504
1504
|
enabled: this._enabled,
|
|
1505
1505
|
minDistance: this.minDistance,
|
|
1506
|
-
maxDistance:
|
|
1506
|
+
maxDistance: re(this.maxDistance),
|
|
1507
1507
|
minZoom: this.minZoom,
|
|
1508
|
-
maxZoom:
|
|
1508
|
+
maxZoom: re(this.maxZoom),
|
|
1509
1509
|
minPolarAngle: this.minPolarAngle,
|
|
1510
|
-
maxPolarAngle:
|
|
1511
|
-
minAzimuthAngle:
|
|
1512
|
-
maxAzimuthAngle:
|
|
1510
|
+
maxPolarAngle: re(this.maxPolarAngle),
|
|
1511
|
+
minAzimuthAngle: re(this.minAzimuthAngle),
|
|
1512
|
+
maxAzimuthAngle: re(this.maxAzimuthAngle),
|
|
1513
1513
|
smoothTime: this.smoothTime,
|
|
1514
1514
|
draggingSmoothTime: this.draggingSmoothTime,
|
|
1515
1515
|
dollySpeed: this.dollySpeed,
|
|
@@ -1533,7 +1533,7 @@ class J extends Os {
|
|
|
1533
1533
|
*/
|
|
1534
1534
|
fromJSON(e, t = !1) {
|
|
1535
1535
|
const s = JSON.parse(e);
|
|
1536
|
-
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance =
|
|
1536
|
+
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(
|
|
1537
1537
|
x.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1538
1538
|
), this.rotateTo(z.theta, z.phi, t), this.dollyTo(z.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1539
1539
|
s.focalOffset[0],
|
|
@@ -1591,21 +1591,21 @@ class J extends Os {
|
|
|
1591
1591
|
const i = t.lengthSq();
|
|
1592
1592
|
if (i === 0)
|
|
1593
1593
|
return e;
|
|
1594
|
-
const r =
|
|
1595
|
-
if (
|
|
1594
|
+
const r = L.copy(t).add(e), n = this._boundary.clampPoint(r, X).sub(r), a = n.lengthSq();
|
|
1595
|
+
if (a === 0)
|
|
1596
1596
|
return e.add(t);
|
|
1597
|
-
if (
|
|
1597
|
+
if (a === i)
|
|
1598
1598
|
return e;
|
|
1599
1599
|
if (s === 0)
|
|
1600
|
-
return e.add(t).add(
|
|
1600
|
+
return e.add(t).add(n);
|
|
1601
1601
|
{
|
|
1602
|
-
const d = 1 + s *
|
|
1603
|
-
return e.add(
|
|
1602
|
+
const d = 1 + s * a / t.dot(n);
|
|
1603
|
+
return e.add(L.copy(t).multiplyScalar(d)).add(n.multiplyScalar(1 - s));
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
1606
|
_updateNearPlaneCorners() {
|
|
1607
1607
|
if (Y(this._camera)) {
|
|
1608
|
-
const e = this._camera, t = e.near, s = e.getEffectiveFOV() *
|
|
1608
|
+
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1609
1609
|
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);
|
|
1610
1610
|
} else if (j(this._camera)) {
|
|
1611
1611
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
@@ -1615,17 +1615,17 @@ class J extends Os {
|
|
|
1615
1615
|
// lateUpdate
|
|
1616
1616
|
_collisionTest() {
|
|
1617
1617
|
let e = 1 / 0;
|
|
1618
|
-
if (!(this.colliderMeshes.length >= 1) ||
|
|
1618
|
+
if (!(this.colliderMeshes.length >= 1) || Ee(this._camera, "_collisionTest"))
|
|
1619
1619
|
return e;
|
|
1620
|
-
const s = this._getTargetDirection(
|
|
1621
|
-
|
|
1620
|
+
const s = this._getTargetDirection(ne);
|
|
1621
|
+
we.lookAt(Ve, s, this._camera.up);
|
|
1622
1622
|
for (let i = 0; i < 4; i++) {
|
|
1623
|
-
const r =
|
|
1624
|
-
r.applyMatrix4(
|
|
1623
|
+
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1624
|
+
r.applyMatrix4(we);
|
|
1625
1625
|
const o = X.addVectors(this._target, r);
|
|
1626
1626
|
pe.set(o, s), pe.far = this._spherical.radius + 1;
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1627
|
+
const n = pe.intersectObjects(this.colliderMeshes);
|
|
1628
|
+
n.length !== 0 && n[0].distance < e && (e = n[0].distance);
|
|
1629
1629
|
}
|
|
1630
1630
|
return e;
|
|
1631
1631
|
}
|
|
@@ -1692,23 +1692,23 @@ class J extends Os {
|
|
|
1692
1692
|
}
|
|
1693
1693
|
static createBoundingSphere(e, t = new T.Sphere()) {
|
|
1694
1694
|
const s = t, i = s.center;
|
|
1695
|
-
|
|
1696
|
-
o.isMesh &&
|
|
1697
|
-
}),
|
|
1695
|
+
$.makeEmpty(), e.traverseVisible((o) => {
|
|
1696
|
+
o.isMesh && $.expandByObject(o);
|
|
1697
|
+
}), $.getCenter(i);
|
|
1698
1698
|
let r = 0;
|
|
1699
1699
|
return e.traverseVisible((o) => {
|
|
1700
1700
|
if (!o.isMesh) return;
|
|
1701
|
-
const
|
|
1702
|
-
if (!
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1706
|
-
for (let p = 0,
|
|
1707
|
-
x.fromBufferAttribute(
|
|
1701
|
+
const n = o;
|
|
1702
|
+
if (!n.geometry) return;
|
|
1703
|
+
const a = n.geometry.clone();
|
|
1704
|
+
a.applyMatrix4(n.matrixWorld);
|
|
1705
|
+
const _ = a.attributes.position;
|
|
1706
|
+
for (let p = 0, O = _.count; p < O; p++)
|
|
1707
|
+
x.fromBufferAttribute(_, p), r = Math.max(r, i.distanceToSquared(x));
|
|
1708
1708
|
}), s.radius = Math.sqrt(r), s;
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
|
-
var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null,
|
|
1711
|
+
var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ke = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1712
1712
|
return Function.prototype.apply.call(e, t, s);
|
|
1713
1713
|
}, ue;
|
|
1714
1714
|
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
@@ -1716,52 +1716,52 @@ Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymb
|
|
|
1716
1716
|
} : ue = function(e) {
|
|
1717
1717
|
return Object.getOwnPropertyNames(e);
|
|
1718
1718
|
};
|
|
1719
|
-
function
|
|
1720
|
-
console && console.warn && console.warn(
|
|
1719
|
+
function bs(h) {
|
|
1720
|
+
console && console.warn && console.warn(h);
|
|
1721
1721
|
}
|
|
1722
|
-
var
|
|
1722
|
+
var _t = Number.isNaN || function(e) {
|
|
1723
1723
|
return e !== e;
|
|
1724
1724
|
};
|
|
1725
|
-
function
|
|
1726
|
-
|
|
1725
|
+
function A() {
|
|
1726
|
+
A.init.call(this);
|
|
1727
1727
|
}
|
|
1728
|
-
Se.exports =
|
|
1729
|
-
Se.exports.once =
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
var
|
|
1735
|
-
function ge(
|
|
1736
|
-
if (typeof
|
|
1737
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof
|
|
1728
|
+
Se.exports = A;
|
|
1729
|
+
Se.exports.once = Ps;
|
|
1730
|
+
A.EventEmitter = A;
|
|
1731
|
+
A.prototype._events = void 0;
|
|
1732
|
+
A.prototype._eventsCount = 0;
|
|
1733
|
+
A.prototype._maxListeners = void 0;
|
|
1734
|
+
var Xe = 10;
|
|
1735
|
+
function ge(h) {
|
|
1736
|
+
if (typeof h != "function")
|
|
1737
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof h);
|
|
1738
1738
|
}
|
|
1739
|
-
Object.defineProperty(
|
|
1739
|
+
Object.defineProperty(A, "defaultMaxListeners", {
|
|
1740
1740
|
enumerable: !0,
|
|
1741
1741
|
get: function() {
|
|
1742
|
-
return
|
|
1742
|
+
return Xe;
|
|
1743
1743
|
},
|
|
1744
|
-
set: function(
|
|
1745
|
-
if (typeof
|
|
1746
|
-
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' +
|
|
1747
|
-
|
|
1744
|
+
set: function(h) {
|
|
1745
|
+
if (typeof h != "number" || h < 0 || _t(h))
|
|
1746
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + h + ".");
|
|
1747
|
+
Xe = h;
|
|
1748
1748
|
}
|
|
1749
1749
|
});
|
|
1750
|
-
|
|
1750
|
+
A.init = function() {
|
|
1751
1751
|
(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;
|
|
1752
1752
|
};
|
|
1753
|
-
|
|
1754
|
-
if (typeof e != "number" || e < 0 ||
|
|
1753
|
+
A.prototype.setMaxListeners = function(e) {
|
|
1754
|
+
if (typeof e != "number" || e < 0 || _t(e))
|
|
1755
1755
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1756
1756
|
return this._maxListeners = e, this;
|
|
1757
1757
|
};
|
|
1758
|
-
function
|
|
1759
|
-
return
|
|
1758
|
+
function gt(h) {
|
|
1759
|
+
return h._maxListeners === void 0 ? A.defaultMaxListeners : h._maxListeners;
|
|
1760
1760
|
}
|
|
1761
|
-
|
|
1762
|
-
return
|
|
1761
|
+
A.prototype.getMaxListeners = function() {
|
|
1762
|
+
return gt(this);
|
|
1763
1763
|
};
|
|
1764
|
-
|
|
1764
|
+
A.prototype.emit = function(e) {
|
|
1765
1765
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
1766
1766
|
var i = e === "error", r = this._events;
|
|
1767
1767
|
if (r !== void 0)
|
|
@@ -1772,57 +1772,57 @@ S.prototype.emit = function(e) {
|
|
|
1772
1772
|
var o;
|
|
1773
1773
|
if (t.length > 0 && (o = t[0]), o instanceof Error)
|
|
1774
1774
|
throw o;
|
|
1775
|
-
var
|
|
1776
|
-
throw
|
|
1775
|
+
var n = new Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
|
|
1776
|
+
throw n.context = o, n;
|
|
1777
1777
|
}
|
|
1778
|
-
var
|
|
1779
|
-
if (
|
|
1778
|
+
var a = r[e];
|
|
1779
|
+
if (a === void 0)
|
|
1780
1780
|
return !1;
|
|
1781
|
-
if (typeof
|
|
1782
|
-
|
|
1781
|
+
if (typeof a == "function")
|
|
1782
|
+
Ke(a, this, t);
|
|
1783
1783
|
else
|
|
1784
|
-
for (var d =
|
|
1785
|
-
|
|
1784
|
+
for (var d = a.length, _ = Et(a, d), s = 0; s < d; ++s)
|
|
1785
|
+
Ke(_[s], this, t);
|
|
1786
1786
|
return !0;
|
|
1787
1787
|
};
|
|
1788
|
-
function
|
|
1788
|
+
function yt(h, e, t, s) {
|
|
1789
1789
|
var i, r, o;
|
|
1790
|
-
if (ge(t), r =
|
|
1790
|
+
if (ge(t), r = h._events, r === void 0 ? (r = h._events = /* @__PURE__ */ Object.create(null), h._eventsCount = 0) : (r.newListener !== void 0 && (h.emit(
|
|
1791
1791
|
"newListener",
|
|
1792
1792
|
e,
|
|
1793
1793
|
t.listener ? t.listener : t
|
|
1794
|
-
), r =
|
|
1795
|
-
o = r[e] = t, ++
|
|
1796
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i =
|
|
1794
|
+
), r = h._events), o = r[e]), o === void 0)
|
|
1795
|
+
o = r[e] = t, ++h._eventsCount;
|
|
1796
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = gt(h), i > 0 && o.length > i && !o.warned) {
|
|
1797
1797
|
o.warned = !0;
|
|
1798
|
-
var
|
|
1799
|
-
|
|
1798
|
+
var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1799
|
+
n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length, bs(n);
|
|
1800
1800
|
}
|
|
1801
|
-
return
|
|
1801
|
+
return h;
|
|
1802
1802
|
}
|
|
1803
|
-
|
|
1804
|
-
return
|
|
1803
|
+
A.prototype.addListener = function(e, t) {
|
|
1804
|
+
return yt(this, e, t, !1);
|
|
1805
1805
|
};
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
return
|
|
1806
|
+
A.prototype.on = A.prototype.addListener;
|
|
1807
|
+
A.prototype.prependListener = function(e, t) {
|
|
1808
|
+
return yt(this, e, t, !0);
|
|
1809
1809
|
};
|
|
1810
1810
|
function xs() {
|
|
1811
1811
|
if (!this.fired)
|
|
1812
1812
|
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);
|
|
1813
1813
|
}
|
|
1814
|
-
function vt(
|
|
1815
|
-
var s = { fired: !1, wrapFn: void 0, target:
|
|
1814
|
+
function vt(h, e, t) {
|
|
1815
|
+
var s = { fired: !1, wrapFn: void 0, target: h, type: e, listener: t }, i = xs.bind(s);
|
|
1816
1816
|
return i.listener = t, s.wrapFn = i, i;
|
|
1817
1817
|
}
|
|
1818
|
-
|
|
1818
|
+
A.prototype.once = function(e, t) {
|
|
1819
1819
|
return ge(t), this.on(e, vt(this, e, t)), this;
|
|
1820
1820
|
};
|
|
1821
|
-
|
|
1821
|
+
A.prototype.prependOnceListener = function(e, t) {
|
|
1822
1822
|
return ge(t), this.prependListener(e, vt(this, e, t)), this;
|
|
1823
1823
|
};
|
|
1824
|
-
|
|
1825
|
-
var s, i, r, o,
|
|
1824
|
+
A.prototype.removeListener = function(e, t) {
|
|
1825
|
+
var s, i, r, o, n;
|
|
1826
1826
|
if (ge(t), i = this._events, i === void 0)
|
|
1827
1827
|
return this;
|
|
1828
1828
|
if (s = i[e], s === void 0)
|
|
@@ -1832,17 +1832,17 @@ S.prototype.removeListener = function(e, t) {
|
|
|
1832
1832
|
else if (typeof s != "function") {
|
|
1833
1833
|
for (r = -1, o = s.length - 1; o >= 0; o--)
|
|
1834
1834
|
if (s[o] === t || s[o].listener === t) {
|
|
1835
|
-
|
|
1835
|
+
n = s[o].listener, r = o;
|
|
1836
1836
|
break;
|
|
1837
1837
|
}
|
|
1838
1838
|
if (r < 0)
|
|
1839
1839
|
return this;
|
|
1840
|
-
r === 0 ? s.shift() :
|
|
1840
|
+
r === 0 ? s.shift() : ws(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, n || t);
|
|
1841
1841
|
}
|
|
1842
1842
|
return this;
|
|
1843
1843
|
};
|
|
1844
|
-
|
|
1845
|
-
|
|
1844
|
+
A.prototype.off = A.prototype.removeListener;
|
|
1845
|
+
A.prototype.removeAllListeners = function(e) {
|
|
1846
1846
|
var t, s, i;
|
|
1847
1847
|
if (s = this._events, s === void 0)
|
|
1848
1848
|
return this;
|
|
@@ -1861,27 +1861,27 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1861
1861
|
this.removeListener(e, t[i]);
|
|
1862
1862
|
return this;
|
|
1863
1863
|
};
|
|
1864
|
-
function
|
|
1865
|
-
var s =
|
|
1864
|
+
function Ct(h, e, t) {
|
|
1865
|
+
var s = h._events;
|
|
1866
1866
|
if (s === void 0)
|
|
1867
1867
|
return [];
|
|
1868
1868
|
var i = s[e];
|
|
1869
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ?
|
|
1869
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ls(i) : Et(i, i.length);
|
|
1870
1870
|
}
|
|
1871
|
-
|
|
1872
|
-
return
|
|
1871
|
+
A.prototype.listeners = function(e) {
|
|
1872
|
+
return Ct(this, e, !0);
|
|
1873
1873
|
};
|
|
1874
|
-
|
|
1875
|
-
return
|
|
1874
|
+
A.prototype.rawListeners = function(e) {
|
|
1875
|
+
return Ct(this, e, !1);
|
|
1876
1876
|
};
|
|
1877
|
-
|
|
1878
|
-
return typeof
|
|
1877
|
+
A.listenerCount = function(h, e) {
|
|
1878
|
+
return typeof h.listenerCount == "function" ? h.listenerCount(e) : Ot.call(h, e);
|
|
1879
1879
|
};
|
|
1880
|
-
|
|
1881
|
-
function
|
|
1880
|
+
A.prototype.listenerCount = Ot;
|
|
1881
|
+
function Ot(h) {
|
|
1882
1882
|
var e = this._events;
|
|
1883
1883
|
if (e !== void 0) {
|
|
1884
|
-
var t = e[
|
|
1884
|
+
var t = e[h];
|
|
1885
1885
|
if (typeof t == "function")
|
|
1886
1886
|
return 1;
|
|
1887
1887
|
if (t !== void 0)
|
|
@@ -1889,56 +1889,56 @@ function Ct(l) {
|
|
|
1889
1889
|
}
|
|
1890
1890
|
return 0;
|
|
1891
1891
|
}
|
|
1892
|
-
|
|
1892
|
+
A.prototype.eventNames = function() {
|
|
1893
1893
|
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1894
1894
|
};
|
|
1895
|
-
function Et(
|
|
1895
|
+
function Et(h, e) {
|
|
1896
1896
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1897
|
-
t[s] =
|
|
1897
|
+
t[s] = h[s];
|
|
1898
1898
|
return t;
|
|
1899
1899
|
}
|
|
1900
|
-
function
|
|
1901
|
-
for (; e + 1 <
|
|
1902
|
-
|
|
1903
|
-
|
|
1900
|
+
function ws(h, e) {
|
|
1901
|
+
for (; e + 1 < h.length; e++)
|
|
1902
|
+
h[e] = h[e + 1];
|
|
1903
|
+
h.pop();
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1906
|
-
for (var e = new Array(
|
|
1907
|
-
e[t] =
|
|
1905
|
+
function Ls(h) {
|
|
1906
|
+
for (var e = new Array(h.length), t = 0; t < e.length; ++t)
|
|
1907
|
+
e[t] = h[t].listener || h[t];
|
|
1908
1908
|
return e;
|
|
1909
1909
|
}
|
|
1910
|
-
function
|
|
1910
|
+
function Ps(h, e) {
|
|
1911
1911
|
return new Promise(function(t, s) {
|
|
1912
1912
|
function i(o) {
|
|
1913
|
-
|
|
1913
|
+
h.removeListener(e, r), s(o);
|
|
1914
1914
|
}
|
|
1915
1915
|
function r() {
|
|
1916
|
-
typeof
|
|
1916
|
+
typeof h.removeListener == "function" && h.removeListener("error", i), t([].slice.call(arguments));
|
|
1917
1917
|
}
|
|
1918
|
-
|
|
1918
|
+
Tt(h, e, r, { once: !0 }), e !== "error" && As(h, i, { once: !0 });
|
|
1919
1919
|
});
|
|
1920
1920
|
}
|
|
1921
|
-
function
|
|
1922
|
-
typeof
|
|
1921
|
+
function As(h, e, t) {
|
|
1922
|
+
typeof h.on == "function" && Tt(h, "error", e, t);
|
|
1923
1923
|
}
|
|
1924
|
-
function
|
|
1925
|
-
if (typeof
|
|
1926
|
-
s.once ?
|
|
1927
|
-
else if (typeof
|
|
1928
|
-
|
|
1929
|
-
s.once &&
|
|
1924
|
+
function Tt(h, e, t, s) {
|
|
1925
|
+
if (typeof h.on == "function")
|
|
1926
|
+
s.once ? h.once(e, t) : h.on(e, t);
|
|
1927
|
+
else if (typeof h.addEventListener == "function")
|
|
1928
|
+
h.addEventListener(e, function i(r) {
|
|
1929
|
+
s.once && h.removeEventListener(e, i), t(r);
|
|
1930
1930
|
});
|
|
1931
1931
|
else
|
|
1932
|
-
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof
|
|
1932
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof h);
|
|
1933
1933
|
}
|
|
1934
|
-
var
|
|
1935
|
-
const
|
|
1934
|
+
var ye = Se.exports;
|
|
1935
|
+
const Ss = {
|
|
1936
1936
|
antialias: !1,
|
|
1937
1937
|
devicePixelRatio: window.devicePixelRatio,
|
|
1938
1938
|
powerPreference: "high-performance",
|
|
1939
1939
|
toneMappingExposure: 1,
|
|
1940
1940
|
alpha: !1,
|
|
1941
|
-
outputColorSpace:
|
|
1941
|
+
outputColorSpace: ns.sRGB,
|
|
1942
1942
|
logarithmicDepthBuffer: !1,
|
|
1943
1943
|
preserveDrawingBuffer: !1,
|
|
1944
1944
|
stencil: !1,
|
|
@@ -1950,24 +1950,24 @@ class Ms {
|
|
|
1950
1950
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
1951
1951
|
alpha: r,
|
|
1952
1952
|
devicePixelRatio: o,
|
|
1953
|
-
antialias:
|
|
1954
|
-
powerPreference:
|
|
1953
|
+
antialias: n,
|
|
1954
|
+
powerPreference: a,
|
|
1955
1955
|
toneMappingExposure: d,
|
|
1956
|
-
outputColorSpace:
|
|
1956
|
+
outputColorSpace: _,
|
|
1957
1957
|
logarithmicDepthBuffer: p,
|
|
1958
|
-
preserveDrawingBuffer:
|
|
1959
|
-
stencil:
|
|
1958
|
+
preserveDrawingBuffer: O,
|
|
1959
|
+
stencil: y,
|
|
1960
1960
|
depth: m
|
|
1961
|
-
} = i, u = new
|
|
1961
|
+
} = i, u = new Ut({
|
|
1962
1962
|
alpha: r,
|
|
1963
|
-
antialias:
|
|
1964
|
-
powerPreference:
|
|
1963
|
+
antialias: n,
|
|
1964
|
+
powerPreference: a,
|
|
1965
1965
|
logarithmicDepthBuffer: p,
|
|
1966
|
-
preserveDrawingBuffer:
|
|
1967
|
-
stencil:
|
|
1966
|
+
preserveDrawingBuffer: O,
|
|
1967
|
+
stencil: y,
|
|
1968
1968
|
depth: m
|
|
1969
1969
|
});
|
|
1970
|
-
u.setSize(t, s), u.setPixelRatio(o), u.toneMappingExposure = d, u.outputColorSpace =
|
|
1970
|
+
u.setSize(t, s), u.setPixelRatio(o), u.toneMappingExposure = d, u.outputColorSpace = _, this.renderer = u;
|
|
1971
1971
|
}
|
|
1972
1972
|
setSize(e, t) {
|
|
1973
1973
|
this.renderer.setSize(e, t);
|
|
@@ -1979,35 +1979,35 @@ class Ms {
|
|
|
1979
1979
|
this.renderer.render(e, t);
|
|
1980
1980
|
}
|
|
1981
1981
|
setViewport(e) {
|
|
1982
|
-
var
|
|
1983
|
-
const { x: t, y: s, width: i, height: r } = e, o = (
|
|
1984
|
-
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(
|
|
1982
|
+
var a, d;
|
|
1983
|
+
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (d = e.scissorTest) != null ? d : !1;
|
|
1984
|
+
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
|
|
1985
1985
|
}
|
|
1986
1986
|
setViewPadding(e = 0, t = 0, s = 0, i = 0) {
|
|
1987
|
-
const { width: r, height: o } = this.renderer.getSize(new
|
|
1987
|
+
const { width: r, height: o } = this.renderer.getSize(new B()), n = {
|
|
1988
1988
|
x: i,
|
|
1989
1989
|
y: s,
|
|
1990
1990
|
width: r - i - t,
|
|
1991
1991
|
height: o - e - s
|
|
1992
1992
|
};
|
|
1993
|
-
this.setViewport(
|
|
1993
|
+
this.setViewport(n);
|
|
1994
1994
|
}
|
|
1995
1995
|
dispose() {
|
|
1996
1996
|
var e, t;
|
|
1997
1997
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
|
-
const
|
|
2000
|
+
const Rs = {
|
|
2001
2001
|
antialias: !0,
|
|
2002
2002
|
devicePixelRatio: window.devicePixelRatio
|
|
2003
2003
|
};
|
|
2004
|
-
class
|
|
2004
|
+
class Ds {
|
|
2005
2005
|
constructor(e) {
|
|
2006
2006
|
this.options = e;
|
|
2007
|
-
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias:
|
|
2008
|
-
antialias:
|
|
2007
|
+
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
|
|
2008
|
+
antialias: n
|
|
2009
2009
|
});
|
|
2010
|
-
|
|
2010
|
+
a.setSize(t, s), a.setPixelRatio(o), this.renderer = a;
|
|
2011
2011
|
}
|
|
2012
2012
|
setSize(e, t) {
|
|
2013
2013
|
this.renderer.setSize(e, t);
|
|
@@ -2046,9 +2046,9 @@ let Us = class {
|
|
|
2046
2046
|
return (this.mask & (1 << e | 0)) !== 0;
|
|
2047
2047
|
}
|
|
2048
2048
|
};
|
|
2049
|
-
class
|
|
2049
|
+
class ee {
|
|
2050
2050
|
constructor() {
|
|
2051
|
-
this.event = new
|
|
2051
|
+
this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
2052
2052
|
}
|
|
2053
2053
|
addController(e, t) {
|
|
2054
2054
|
const s = new Us();
|
|
@@ -2079,21 +2079,21 @@ class ae {
|
|
|
2079
2079
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
|
-
const
|
|
2082
|
+
const bt = {
|
|
2083
2083
|
fov: 45,
|
|
2084
2084
|
near: 1,
|
|
2085
2085
|
far: 1e3,
|
|
2086
|
-
up: new
|
|
2086
|
+
up: new H(0, 1, 0)
|
|
2087
2087
|
};
|
|
2088
|
-
class zs extends
|
|
2088
|
+
class zs extends ee {
|
|
2089
2089
|
constructor(e) {
|
|
2090
2090
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2091
2091
|
}
|
|
2092
2092
|
get camera() {
|
|
2093
2093
|
return this.controller;
|
|
2094
2094
|
}
|
|
2095
|
-
addPerspectiveCamera(e =
|
|
2096
|
-
const { fov: s, far: i, near: r, up: o, aspect:
|
|
2095
|
+
addPerspectiveCamera(e = bt, t) {
|
|
2096
|
+
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, d = new zt(s, a, r, i);
|
|
2097
2097
|
return d.up = o, this.addController(d, t);
|
|
2098
2098
|
}
|
|
2099
2099
|
setPageActive(e) {
|
|
@@ -2160,7 +2160,7 @@ class zs extends ae {
|
|
|
2160
2160
|
s[7],
|
|
2161
2161
|
s[11],
|
|
2162
2162
|
s[15]
|
|
2163
|
-
), { width:
|
|
2163
|
+
), { width: n, height: a } = this, d = n / a;
|
|
2164
2164
|
(this.camera.fov !== t.fov || this.camera.aspect !== d || !this.camera.matrixWorld.equals(r) || !this.camera.matrixWorldInverse.equals(o)) && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix(), this.camera.matrixAutoUpdate = !1, this.camera.matrixWorld.copy(r), this.camera.matrixWorldInverse.copy(o), this.camera.aspect = d, this.camera.updateProjectionMatrix());
|
|
2165
2165
|
}
|
|
2166
2166
|
}
|
|
@@ -2168,7 +2168,7 @@ class zs extends ae {
|
|
|
2168
2168
|
const ks = {
|
|
2169
2169
|
background: null
|
|
2170
2170
|
};
|
|
2171
|
-
class Fs extends
|
|
2171
|
+
class Fs extends ee {
|
|
2172
2172
|
get scene() {
|
|
2173
2173
|
return this.controller;
|
|
2174
2174
|
}
|
|
@@ -2176,12 +2176,12 @@ class Fs extends ae {
|
|
|
2176
2176
|
super(), this.options = e;
|
|
2177
2177
|
}
|
|
2178
2178
|
addScene(e, t) {
|
|
2179
|
-
const s = new
|
|
2179
|
+
const s = new nt();
|
|
2180
2180
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
2181
2181
|
}
|
|
2182
2182
|
removePage(e) {
|
|
2183
2183
|
super.removePage(e, (t) => {
|
|
2184
|
-
const s = new
|
|
2184
|
+
const s = new Pe();
|
|
2185
2185
|
s.track(t), s.dispose();
|
|
2186
2186
|
});
|
|
2187
2187
|
}
|
|
@@ -2202,21 +2202,21 @@ class Ns {
|
|
|
2202
2202
|
if (e.isScene)
|
|
2203
2203
|
i = new De(100);
|
|
2204
2204
|
else if (e.isCamera)
|
|
2205
|
-
i = new
|
|
2205
|
+
i = new kt(e);
|
|
2206
2206
|
else if (e.isPointLight)
|
|
2207
|
-
i = new kt(e, 1);
|
|
2208
|
-
else if (e.isDirectionalLight)
|
|
2209
2207
|
i = new Ft(e, 1);
|
|
2208
|
+
else if (e.isDirectionalLight)
|
|
2209
|
+
i = new Nt(e, 1);
|
|
2210
2210
|
else if (e.isSpotLight)
|
|
2211
|
-
i = new
|
|
2211
|
+
i = new It(e);
|
|
2212
2212
|
else if (e.isHemisphereLight)
|
|
2213
2213
|
i = new Ht(e, 10);
|
|
2214
2214
|
else if (e.isRectAreaLight)
|
|
2215
2215
|
i = new cs(e);
|
|
2216
2216
|
else {
|
|
2217
|
-
const r = new
|
|
2217
|
+
const r = new at();
|
|
2218
2218
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2219
|
-
i = new
|
|
2219
|
+
i = new Ue(r);
|
|
2220
2220
|
const o = i.material;
|
|
2221
2221
|
o.userData.object = e, o.depthTest = !1, o.transparent = !0;
|
|
2222
2222
|
} else
|
|
@@ -2256,10 +2256,10 @@ class Ns {
|
|
|
2256
2256
|
update(e, t, s) {
|
|
2257
2257
|
var r, o;
|
|
2258
2258
|
const { cameraController: i } = this.options;
|
|
2259
|
-
Object.values(this.helpers).forEach((
|
|
2260
|
-
if (
|
|
2261
|
-
const
|
|
2262
|
-
d &&
|
|
2259
|
+
Object.values(this.helpers).forEach((n) => {
|
|
2260
|
+
if (n.update && n.update(), n instanceof Ue) {
|
|
2261
|
+
const a = n.material, { object: d } = a.userData;
|
|
2262
|
+
d && n.box.setFromObject(d, !0);
|
|
2263
2263
|
}
|
|
2264
2264
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
2265
2265
|
...i.camera.position.toArray()
|
|
@@ -2276,18 +2276,18 @@ class Ns {
|
|
|
2276
2276
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2277
2277
|
}
|
|
2278
2278
|
}
|
|
2279
|
-
class
|
|
2279
|
+
class Is extends ee {
|
|
2280
2280
|
constructor(e) {
|
|
2281
2281
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2282
2282
|
const t = {
|
|
2283
|
-
Vector2:
|
|
2284
|
-
Vector3:
|
|
2285
|
-
Vector4:
|
|
2286
|
-
Quaternion:
|
|
2283
|
+
Vector2: B,
|
|
2284
|
+
Vector3: H,
|
|
2285
|
+
Vector4: Bt,
|
|
2286
|
+
Quaternion: lt,
|
|
2287
2287
|
Matrix4: W,
|
|
2288
2288
|
Spherical: Vt,
|
|
2289
|
-
Box3:
|
|
2290
|
-
Sphere:
|
|
2289
|
+
Box3: at,
|
|
2290
|
+
Sphere: Yt,
|
|
2291
2291
|
Raycaster: ht
|
|
2292
2292
|
};
|
|
2293
2293
|
J.install({ THREE: t });
|
|
@@ -2320,29 +2320,29 @@ class Hs extends ae {
|
|
|
2320
2320
|
});
|
|
2321
2321
|
}
|
|
2322
2322
|
update(e, t) {
|
|
2323
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2323
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * jt.DEG2RAD);
|
|
2324
2324
|
}
|
|
2325
2325
|
}
|
|
2326
|
-
class
|
|
2326
|
+
class Hs {
|
|
2327
2327
|
constructor(e) {
|
|
2328
|
-
this.event = new
|
|
2328
|
+
this.event = new ye.EventEmitter();
|
|
2329
2329
|
const { renderer: t, scene: s, camera: i } = e, r = new ps(
|
|
2330
2330
|
i,
|
|
2331
2331
|
t.domElement
|
|
2332
2332
|
);
|
|
2333
2333
|
if (r.getHelper) {
|
|
2334
2334
|
const o = r.getHelper();
|
|
2335
|
-
if (s.add(o), +
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2335
|
+
if (s.add(o), +Zt < 170) {
|
|
2336
|
+
const n = r._root;
|
|
2337
|
+
n.dispose = () => {
|
|
2338
|
+
n.traverse((a) => {
|
|
2339
|
+
a.geometry && a.geometry.dispose(), a.material && a.material.dispose();
|
|
2340
2340
|
});
|
|
2341
2341
|
}, r.dispose = () => {
|
|
2342
|
-
r.disconnect(),
|
|
2342
|
+
r.disconnect(), n.dispose();
|
|
2343
2343
|
};
|
|
2344
2344
|
}
|
|
2345
|
-
} else r instanceof
|
|
2345
|
+
} else r instanceof Wt && s.add(r);
|
|
2346
2346
|
this.controls = r, this.addEvent();
|
|
2347
2347
|
}
|
|
2348
2348
|
get detach() {
|
|
@@ -2392,8 +2392,8 @@ class Is {
|
|
|
2392
2392
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
2393
2393
|
}
|
|
2394
2394
|
}
|
|
2395
|
-
const
|
|
2396
|
-
class
|
|
2395
|
+
const $e = new H(), js = new lt(), qe = new H(), I = new W(), Bs = new W();
|
|
2396
|
+
class Vs {
|
|
2397
2397
|
/**
|
|
2398
2398
|
* Constructs a new CSS3D renderer.
|
|
2399
2399
|
*
|
|
@@ -2402,71 +2402,71 @@ class Bs {
|
|
|
2402
2402
|
constructor(e = {}) {
|
|
2403
2403
|
const t = this;
|
|
2404
2404
|
let s, i, r, o;
|
|
2405
|
-
const
|
|
2405
|
+
const n = {
|
|
2406
2406
|
camera: { style: "" },
|
|
2407
2407
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2408
|
-
},
|
|
2409
|
-
|
|
2408
|
+
}, a = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2409
|
+
a.style.overflow = "hidden", this.domElement = a;
|
|
2410
2410
|
const d = document.createElement("div");
|
|
2411
|
-
d.style.transformOrigin = "0 0", d.style.pointerEvents = "none",
|
|
2412
|
-
const
|
|
2413
|
-
|
|
2411
|
+
d.style.transformOrigin = "0 0", d.style.pointerEvents = "none", a.appendChild(d);
|
|
2412
|
+
const _ = document.createElement("div");
|
|
2413
|
+
_.style.transformStyle = "preserve-3d", d.appendChild(_), this.getSize = function() {
|
|
2414
2414
|
return {
|
|
2415
2415
|
width: s,
|
|
2416
2416
|
height: i
|
|
2417
2417
|
};
|
|
2418
|
-
}, this.render = function(
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2421
|
-
let
|
|
2422
|
-
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2425
|
-
}, this.setSize = function(
|
|
2426
|
-
s =
|
|
2418
|
+
}, this.render = function(f, l) {
|
|
2419
|
+
const g = l.projectionMatrix.elements[5] * o;
|
|
2420
|
+
l.view && l.view.enabled ? (d.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, d.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : d.style.transform = "", f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2421
|
+
let C, v;
|
|
2422
|
+
l.isOrthographicCamera && (C = -(l.right + l.left) / 2, v = (l.top + l.bottom) / 2);
|
|
2423
|
+
const b = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${b} )scale(` + g + ")translate(" + p(C) + "px," + p(v) + "px)" + O(l.matrixWorldInverse) : `scale( ${b} )translateZ(` + g + "px)" + O(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2424
|
+
n.camera.style !== R && (_.style.transform = R, n.camera.style = R), u(f, f, l);
|
|
2425
|
+
}, this.setSize = function(f, l) {
|
|
2426
|
+
s = f, i = l, r = s / 2, o = i / 2, a.style.width = f + "px", a.style.height = l + "px", d.style.width = f + "px", d.style.height = l + "px", _.style.width = f + "px", _.style.height = l + "px";
|
|
2427
2427
|
};
|
|
2428
|
-
function p(
|
|
2429
|
-
return Math.abs(
|
|
2428
|
+
function p(f) {
|
|
2429
|
+
return Math.abs(f) < 1e-10 ? 0 : f;
|
|
2430
2430
|
}
|
|
2431
|
-
function
|
|
2432
|
-
const
|
|
2433
|
-
return "matrix3d(" + p(
|
|
2431
|
+
function O(f) {
|
|
2432
|
+
const l = f.elements;
|
|
2433
|
+
return "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]) + ")";
|
|
2434
2434
|
}
|
|
2435
|
-
function
|
|
2436
|
-
const
|
|
2437
|
-
return "translate(-50%,-50%)" + ("matrix3d(" + p(
|
|
2435
|
+
function y(f) {
|
|
2436
|
+
const l = f.elements;
|
|
2437
|
+
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]) + ")");
|
|
2438
2438
|
}
|
|
2439
|
-
function m(
|
|
2440
|
-
|
|
2441
|
-
for (let
|
|
2442
|
-
m(
|
|
2439
|
+
function m(f) {
|
|
2440
|
+
f.isCSS3DObject && (f.element.style.display = "none");
|
|
2441
|
+
for (let l = 0, g = f.children.length; l < g; l++)
|
|
2442
|
+
m(f.children[l]);
|
|
2443
2443
|
}
|
|
2444
|
-
function u(
|
|
2445
|
-
if (
|
|
2446
|
-
m(
|
|
2444
|
+
function u(f, l, g, C) {
|
|
2445
|
+
if (f.visible === !1) {
|
|
2446
|
+
m(f);
|
|
2447
2447
|
return;
|
|
2448
2448
|
}
|
|
2449
|
-
if (
|
|
2450
|
-
const
|
|
2451
|
-
if (
|
|
2452
|
-
|
|
2453
|
-
let
|
|
2454
|
-
|
|
2455
|
-
const
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2449
|
+
if (f.isCSS3DObject) {
|
|
2450
|
+
const v = f.layers.test(g.layers) === !0, b = f.element;
|
|
2451
|
+
if (b.style.display = v === !0 ? "" : "none", v === !0) {
|
|
2452
|
+
f.onBeforeRender(t, l, g);
|
|
2453
|
+
let E;
|
|
2454
|
+
f.isCSS3DSprite ? (I.copy(g.matrixWorldInverse), I.transpose(), f.rotation2D !== 0 && I.multiply(Bs.makeRotationZ(f.rotation2D)), f.matrixWorld.decompose($e, js, qe), I.setPosition($e), I.scale(qe), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, E = y(I)) : E = y(f.matrixWorld);
|
|
2455
|
+
const w = n.objects.get(f);
|
|
2456
|
+
if (w === void 0 || w.style !== E) {
|
|
2457
|
+
b.style.transform = E;
|
|
2458
|
+
const R = { style: E };
|
|
2459
|
+
n.objects.set(f, R);
|
|
2460
2460
|
}
|
|
2461
|
-
|
|
2461
|
+
b.parentNode !== _ && _.appendChild(b), f.onAfterRender(t, l, g);
|
|
2462
2462
|
}
|
|
2463
2463
|
}
|
|
2464
|
-
for (let
|
|
2465
|
-
u(
|
|
2464
|
+
for (let v = 0, b = f.children.length; v < b; v++)
|
|
2465
|
+
u(f.children[v], l, g);
|
|
2466
2466
|
}
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
const
|
|
2469
|
+
const q = new H(), Qe = new W(), Je = new W(), et = new H(), tt = new H();
|
|
2470
2470
|
class Ys {
|
|
2471
2471
|
/**
|
|
2472
2472
|
* Constructs a new CSS2D renderer.
|
|
@@ -2476,63 +2476,63 @@ class Ys {
|
|
|
2476
2476
|
constructor(e = {}) {
|
|
2477
2477
|
const t = this;
|
|
2478
2478
|
let s, i, r, o;
|
|
2479
|
-
const
|
|
2479
|
+
const n = {
|
|
2480
2480
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2481
|
-
},
|
|
2482
|
-
|
|
2481
|
+
}, a = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2482
|
+
a.style.overflow = "hidden", this.domElement = a, this.getSize = function() {
|
|
2483
2483
|
return {
|
|
2484
2484
|
width: s,
|
|
2485
2485
|
height: i
|
|
2486
2486
|
};
|
|
2487
2487
|
}, this.render = function(m, u) {
|
|
2488
|
-
m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), u.parent === null && u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(),
|
|
2488
|
+
m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), u.parent === null && u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), Qe.copy(u.matrixWorldInverse), Je.multiplyMatrices(u.projectionMatrix, Qe), _(m, m, u), y(m);
|
|
2489
2489
|
}, this.setSize = function(m, u) {
|
|
2490
|
-
s = m, i = u, r = s / 2, o = i / 2,
|
|
2490
|
+
s = m, i = u, r = s / 2, o = i / 2, a.style.width = m + "px", a.style.height = u + "px";
|
|
2491
2491
|
};
|
|
2492
2492
|
function d(m) {
|
|
2493
2493
|
m.isCSS2DObject && (m.element.style.display = "none");
|
|
2494
|
-
for (let u = 0,
|
|
2494
|
+
for (let u = 0, f = m.children.length; u < f; u++)
|
|
2495
2495
|
d(m.children[u]);
|
|
2496
2496
|
}
|
|
2497
|
-
function
|
|
2497
|
+
function _(m, u, f) {
|
|
2498
2498
|
if (m.visible === !1) {
|
|
2499
2499
|
d(m);
|
|
2500
2500
|
return;
|
|
2501
2501
|
}
|
|
2502
2502
|
if (m.isCSS2DObject) {
|
|
2503
|
-
|
|
2504
|
-
const
|
|
2505
|
-
|
|
2506
|
-
const
|
|
2507
|
-
distanceToCameraSquared: p(
|
|
2503
|
+
q.setFromMatrixPosition(m.matrixWorld), q.applyMatrix4(Je);
|
|
2504
|
+
const l = q.z >= -1 && q.z <= 1 && m.layers.test(f.layers) === !0, g = m.element;
|
|
2505
|
+
g.style.display = l === !0 ? "" : "none", l === !0 && (m.onBeforeRender(t, u, f), g.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", g.parentNode !== a && a.appendChild(g), m.onAfterRender(t, u, f));
|
|
2506
|
+
const C = {
|
|
2507
|
+
distanceToCameraSquared: p(f, m)
|
|
2508
2508
|
};
|
|
2509
|
-
|
|
2509
|
+
n.objects.set(m, C);
|
|
2510
2510
|
}
|
|
2511
|
-
for (let
|
|
2512
|
-
|
|
2511
|
+
for (let l = 0, g = m.children.length; l < g; l++)
|
|
2512
|
+
_(m.children[l], u, f);
|
|
2513
2513
|
}
|
|
2514
2514
|
function p(m, u) {
|
|
2515
|
-
return
|
|
2515
|
+
return et.setFromMatrixPosition(m.matrixWorld), tt.setFromMatrixPosition(u.matrixWorld), et.distanceToSquared(tt);
|
|
2516
2516
|
}
|
|
2517
|
-
function
|
|
2517
|
+
function O(m) {
|
|
2518
2518
|
const u = [];
|
|
2519
|
-
return m.traverseVisible(function(
|
|
2520
|
-
|
|
2519
|
+
return m.traverseVisible(function(f) {
|
|
2520
|
+
f.isCSS2DObject && u.push(f);
|
|
2521
2521
|
}), u;
|
|
2522
2522
|
}
|
|
2523
|
-
function
|
|
2524
|
-
const u =
|
|
2525
|
-
if (
|
|
2526
|
-
return
|
|
2527
|
-
const
|
|
2528
|
-
return
|
|
2529
|
-
}),
|
|
2530
|
-
for (let
|
|
2531
|
-
u[
|
|
2523
|
+
function y(m) {
|
|
2524
|
+
const u = O(m).sort(function(l, g) {
|
|
2525
|
+
if (l.renderOrder !== g.renderOrder)
|
|
2526
|
+
return g.renderOrder - l.renderOrder;
|
|
2527
|
+
const C = n.objects.get(l).distanceToCameraSquared, v = n.objects.get(g).distanceToCameraSquared;
|
|
2528
|
+
return C - v;
|
|
2529
|
+
}), f = u.length;
|
|
2530
|
+
for (let l = 0, g = u.length; l < g; l++)
|
|
2531
|
+
u[l].element.style.zIndex = f - l;
|
|
2532
2532
|
}
|
|
2533
2533
|
}
|
|
2534
2534
|
}
|
|
2535
|
-
const
|
|
2535
|
+
const st = {
|
|
2536
2536
|
zIndex: "auto"
|
|
2537
2537
|
};
|
|
2538
2538
|
class Zs {
|
|
@@ -2540,7 +2540,7 @@ class Zs {
|
|
|
2540
2540
|
this.container = e;
|
|
2541
2541
|
}
|
|
2542
2542
|
addRenderer(e, t) {
|
|
2543
|
-
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new Ys() : new
|
|
2543
|
+
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new Ys() : new Vs();
|
|
2544
2544
|
o.domElement.style.position = "absolute", o.domElement.style.top = "0", o.domElement.style.pointerEvents = "none", o.domElement.style.zIndex = t.zIndex, o.setSize(i, r), s.appendChild(o.domElement), e === "css2d" ? this.css2Drenderer = o : e === "css3d" && (this.css3Drenderer = o);
|
|
2545
2545
|
}
|
|
2546
2546
|
setSize(e, t) {
|
|
@@ -2654,20 +2654,20 @@ class Gs extends fs {
|
|
|
2654
2654
|
constructor() {
|
|
2655
2655
|
super();
|
|
2656
2656
|
const e = Ws;
|
|
2657
|
-
this.uniforms =
|
|
2657
|
+
this.uniforms = Gt.clone(e.uniforms), this.material = new Kt({
|
|
2658
2658
|
name: e.name,
|
|
2659
2659
|
uniforms: this.uniforms,
|
|
2660
2660
|
vertexShader: e.vertexShader,
|
|
2661
2661
|
fragmentShader: e.fragmentShader
|
|
2662
|
-
}), this.fsQuad ? this.fsQuad = new
|
|
2662
|
+
}), this.fsQuad ? this.fsQuad = new Fe(this.material) : this._fsQuad && (this._fsQuad = new Fe(this.material));
|
|
2663
2663
|
}
|
|
2664
2664
|
}
|
|
2665
|
-
const Ks = (
|
|
2665
|
+
const Ks = (h) => {
|
|
2666
2666
|
const e = new _s(
|
|
2667
|
-
new
|
|
2667
|
+
new Xt({
|
|
2668
2668
|
uniforms: {
|
|
2669
2669
|
baseTexture: { value: null },
|
|
2670
|
-
bloomTexture: { value:
|
|
2670
|
+
bloomTexture: { value: h.renderTarget2.texture },
|
|
2671
2671
|
bloomAlphaType: { value: 0 }
|
|
2672
2672
|
},
|
|
2673
2673
|
vertexShader: `
|
|
@@ -2698,19 +2698,19 @@ const Ks = (l) => {
|
|
|
2698
2698
|
"baseTexture"
|
|
2699
2699
|
);
|
|
2700
2700
|
return e.needsSwap = !0, e;
|
|
2701
|
-
},
|
|
2701
|
+
}, Le = 1, me = !1, Xs = new $t({ color: "black" }), $s = new ct({
|
|
2702
2702
|
color: "black",
|
|
2703
2703
|
sizeAttenuation: !1
|
|
2704
|
-
}),
|
|
2704
|
+
}), qs = new ct({
|
|
2705
2705
|
color: "black",
|
|
2706
2706
|
sizeAttenuation: !0
|
|
2707
|
-
}), Qs = new
|
|
2707
|
+
}), Qs = new dt({
|
|
2708
2708
|
color: "black",
|
|
2709
2709
|
sizeAttenuation: !0
|
|
2710
|
-
}), Js = new
|
|
2710
|
+
}), Js = new dt({
|
|
2711
2711
|
color: "black",
|
|
2712
2712
|
sizeAttenuation: !1
|
|
2713
|
-
}), ei = new
|
|
2713
|
+
}), ei = new ut({
|
|
2714
2714
|
color: "black",
|
|
2715
2715
|
sizeAttenuation: 0,
|
|
2716
2716
|
lineWidth: 0
|
|
@@ -2729,7 +2729,7 @@ const Ks = (l) => {
|
|
|
2729
2729
|
};
|
|
2730
2730
|
class ri {
|
|
2731
2731
|
constructor(e) {
|
|
2732
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new qt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.pipViewportState = null, this.options = e;
|
|
2732
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new qt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2733
2733
|
const {
|
|
2734
2734
|
rendererController: t,
|
|
2735
2735
|
sceneController: s,
|
|
@@ -2737,20 +2737,20 @@ class ri {
|
|
|
2737
2737
|
composerParams: r
|
|
2738
2738
|
} = e, { renderer: o } = t;
|
|
2739
2739
|
this.renderer = o;
|
|
2740
|
-
const { multisampling:
|
|
2740
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, d = o.getDrawingBufferSize(new B()), _ = new Qt(
|
|
2741
2741
|
d.width,
|
|
2742
2742
|
d.height,
|
|
2743
2743
|
{
|
|
2744
|
-
samples: Math.min(
|
|
2745
|
-
type:
|
|
2744
|
+
samples: Math.min(n, a),
|
|
2745
|
+
type: Jt
|
|
2746
2746
|
}
|
|
2747
|
-
), p = new
|
|
2748
|
-
p.setSize(
|
|
2749
|
-
const
|
|
2747
|
+
), p = new ke(o, _), O = this.getSize();
|
|
2748
|
+
p.setSize(O.width, O.height);
|
|
2749
|
+
const y = new ms(
|
|
2750
2750
|
s.scene,
|
|
2751
2751
|
i.camera
|
|
2752
2752
|
);
|
|
2753
|
-
p.addPass(
|
|
2753
|
+
p.addPass(y), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = y, i.event.on("pageChange", (m) => {
|
|
2754
2754
|
this.changeCamera(m);
|
|
2755
2755
|
}), s.event.on("pageChange", (m) => {
|
|
2756
2756
|
this.changeScene(m);
|
|
@@ -2770,21 +2770,21 @@ class ri {
|
|
|
2770
2770
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2771
2771
|
}
|
|
2772
2772
|
addSSAOPass(e) {
|
|
2773
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new
|
|
2774
|
-
|
|
2773
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new us(t, s, o, n);
|
|
2774
|
+
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2775
2775
|
}
|
|
2776
2776
|
addBloomPass(e) {
|
|
2777
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e,
|
|
2778
|
-
new
|
|
2777
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new gs(
|
|
2778
|
+
new B(window.innerWidth, window.innerHeight),
|
|
2779
2779
|
i,
|
|
2780
2780
|
r,
|
|
2781
2781
|
s
|
|
2782
2782
|
);
|
|
2783
|
-
this.bloomPass =
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
const d = Ks(
|
|
2787
|
-
d.uniforms.bloomAlphaType.value = o, this.bloomComposer =
|
|
2783
|
+
this.bloomPass = n;
|
|
2784
|
+
const a = new ke(t);
|
|
2785
|
+
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2786
|
+
const d = Ks(a);
|
|
2787
|
+
d.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(Le);
|
|
2788
2788
|
}
|
|
2789
2789
|
setBloomSelection(e, t) {
|
|
2790
2790
|
if (!this.bloomComposer) {
|
|
@@ -2793,7 +2793,7 @@ class ri {
|
|
|
2793
2793
|
}
|
|
2794
2794
|
e.traverse((s) => {
|
|
2795
2795
|
const { object3d: i } = s;
|
|
2796
|
-
i && (t ? (this.bloomSelection.add(s), i.layers.enable(
|
|
2796
|
+
i && (t ? (this.bloomSelection.add(s), i.layers.enable(Le)) : (this.bloomSelection.delete(s), i.layers.disable(Le)));
|
|
2797
2797
|
}), this.bloomSelection.size === 0 ? this.bloomComposerActive = !1 : this.bloomComposerActive = !0;
|
|
2798
2798
|
}
|
|
2799
2799
|
enable() {
|
|
@@ -2816,9 +2816,9 @@ class ri {
|
|
|
2816
2816
|
s.isTransformControls || s.isTransformControlsRoot || s.type === "RectAreaLightHelper" ? e.push(s) : t.push(s);
|
|
2817
2817
|
}), t.forEach((s) => {
|
|
2818
2818
|
s.traverse((i) => {
|
|
2819
|
-
var
|
|
2820
|
-
const r = i, o = i,
|
|
2821
|
-
(
|
|
2819
|
+
var a;
|
|
2820
|
+
const r = i, o = i, n = i;
|
|
2821
|
+
(a = r.material) != null && a.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = Qs : o.material = Js : r.material instanceof ut ? r.material = ei : n.isPoints ? n.material.sizeAttenuation ? n.material = qs : n.material = $s : r.material = Xs);
|
|
2822
2822
|
});
|
|
2823
2823
|
}), e.forEach((s) => {
|
|
2824
2824
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2831,10 +2831,10 @@ class ri {
|
|
|
2831
2831
|
});
|
|
2832
2832
|
}
|
|
2833
2833
|
finalComposerRender() {
|
|
2834
|
-
this.bloomComposerActive && this.bloomComposer ? (this.mixPass.enabled = !0, this.darkenNonBloomed(), this.bloomComposer.render(), this.restoreNonBloomed()) : this.mixPass && (this.mixPass.enabled = !1), this.finalComposer.render();
|
|
2834
|
+
this.bloomComposerActive && this.bloomComposer ? (this.bloomComposerRenderIng = !0, this.mixPass.enabled = !0, this.darkenNonBloomed(), this.bloomComposer.render(), this.restoreNonBloomed(), this.bloomComposerRenderIng = !1) : this.mixPass && (this.mixPass.enabled = !1), this.finalComposer.render();
|
|
2835
2835
|
}
|
|
2836
2836
|
getSize() {
|
|
2837
|
-
return this.renderer.getSize(new
|
|
2837
|
+
return this.renderer.getSize(new B());
|
|
2838
2838
|
}
|
|
2839
2839
|
render() {
|
|
2840
2840
|
if (!this.active) return;
|
|
@@ -2842,7 +2842,7 @@ class ri {
|
|
|
2842
2842
|
if (this.finalComposerRender(), this.pipViewportState) {
|
|
2843
2843
|
e.setPageActive(31), e.setAspect(
|
|
2844
2844
|
this.pipViewportState.width / this.pipViewportState.height
|
|
2845
|
-
), t.setViewport(
|
|
2845
|
+
), t.setViewport(te(U({}, this.pipViewportState), {
|
|
2846
2846
|
scissor: !0,
|
|
2847
2847
|
scissorTest: !0
|
|
2848
2848
|
})), this.finalComposerRender(), e.setPageActive(s.activeIndex);
|
|
@@ -2862,7 +2862,7 @@ class ri {
|
|
|
2862
2862
|
this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomSelection.clear(), this.finalComposer.dispose(), (e = this.bloomComposer) == null || e.dispose();
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
|
-
class
|
|
2865
|
+
class it extends pt {
|
|
2866
2866
|
constructor(e) {
|
|
2867
2867
|
super(e), this.options = { type: "image" };
|
|
2868
2868
|
}
|
|
@@ -2871,22 +2871,22 @@ class st extends dt {
|
|
|
2871
2871
|
}
|
|
2872
2872
|
load(e, t, s, i) {
|
|
2873
2873
|
let r, o;
|
|
2874
|
-
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
|
|
2875
|
-
const
|
|
2876
|
-
return
|
|
2874
|
+
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 mt(o)) : r = new fe();
|
|
2875
|
+
const n = new Ae(this.manager);
|
|
2876
|
+
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
2877
2877
|
e,
|
|
2878
|
-
(
|
|
2879
|
-
let d =
|
|
2880
|
-
const
|
|
2881
|
-
d = d.slice(0,
|
|
2882
|
-
const
|
|
2883
|
-
o.removeEventListener("load",
|
|
2884
|
-
},
|
|
2885
|
-
|
|
2886
|
-
}, m = (
|
|
2887
|
-
|
|
2878
|
+
(a) => {
|
|
2879
|
+
let d = a;
|
|
2880
|
+
const _ = e.split(".").pop(), p = this.options.type === "image" ? `image/${_ || "png"}` : `video/${_ || "mp4"}`;
|
|
2881
|
+
d = d.slice(0, a.size, p);
|
|
2882
|
+
const O = () => {
|
|
2883
|
+
o.removeEventListener("load", y, !1), o.removeEventListener("error", m, !1);
|
|
2884
|
+
}, y = () => {
|
|
2885
|
+
O(), r.needsUpdate = !0, t && t(r);
|
|
2886
|
+
}, m = (f) => {
|
|
2887
|
+
O(), i && i(f), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
2888
2888
|
};
|
|
2889
|
-
o.addEventListener("load",
|
|
2889
|
+
o.addEventListener("load", y, !1), o.addEventListener("error", m, !1);
|
|
2890
2890
|
const u = window.URL.createObjectURL(d);
|
|
2891
2891
|
o.src = u;
|
|
2892
2892
|
},
|
|
@@ -2895,16 +2895,16 @@ class st extends dt {
|
|
|
2895
2895
|
), r;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
|
-
class oi extends
|
|
2898
|
+
class oi extends pt {
|
|
2899
2899
|
constructor(e) {
|
|
2900
2900
|
super(e);
|
|
2901
2901
|
}
|
|
2902
2902
|
load(e, t, s, i) {
|
|
2903
|
-
const r = new
|
|
2903
|
+
const r = new Ae(this.manager);
|
|
2904
2904
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
2905
2905
|
e,
|
|
2906
2906
|
(o) => {
|
|
2907
|
-
const
|
|
2907
|
+
const n = o, a = new DecompressionStream("gzip"), d = n.stream().pipeThrough(a);
|
|
2908
2908
|
new Response(d).json().then((p) => {
|
|
2909
2909
|
t == null || t(p);
|
|
2910
2910
|
}).catch((p) => {
|
|
@@ -2927,10 +2927,10 @@ const ni = {
|
|
|
2927
2927
|
};
|
|
2928
2928
|
class ai {
|
|
2929
2929
|
constructor(e) {
|
|
2930
|
-
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new
|
|
2930
|
+
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
|
|
2931
2931
|
simpleTexture4deleted: !1,
|
|
2932
2932
|
prefix: ""
|
|
2933
|
-
}, e), this.loadingManager = new
|
|
2933
|
+
}, e), this.loadingManager = new es(
|
|
2934
2934
|
() => {
|
|
2935
2935
|
},
|
|
2936
2936
|
(t, s, i) => {
|
|
@@ -2974,21 +2974,21 @@ class ai {
|
|
|
2974
2974
|
}
|
|
2975
2975
|
getLoader(e, t) {
|
|
2976
2976
|
if (e === "images")
|
|
2977
|
-
return this.textureLoader || (this.textureLoader = new
|
|
2977
|
+
return this.textureLoader || (this.textureLoader = new it(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
2978
2978
|
if (e === "media")
|
|
2979
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
2979
|
+
return this.videoTextureLoader || (this.videoTextureLoader = new it(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
2980
2980
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
2981
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
2981
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new ys(), 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;
|
|
2982
2982
|
if (e === "gltf")
|
|
2983
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
2983
|
+
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
2984
2984
|
if (e === "lottie")
|
|
2985
2985
|
return this.lottieLoader || (this.lottieLoader = new Cs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
2986
2986
|
if (e === "gzipJson")
|
|
2987
2987
|
return this.gzipJsonLoader || (this.gzipJsonLoader = new oi(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
2988
2988
|
if (e === "json")
|
|
2989
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
2989
|
+
return this.jsonLoader || (this.jsonLoader = new Ae(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
2990
2990
|
if (e === "exr")
|
|
2991
|
-
return this.exrLoader || (this.exrLoader = new
|
|
2991
|
+
return this.exrLoader || (this.exrLoader = new vs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
2992
2992
|
}
|
|
2993
2993
|
add(e, t) {
|
|
2994
2994
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
@@ -3007,11 +3007,11 @@ class ai {
|
|
|
3007
3007
|
get textureAssets() {
|
|
3008
3008
|
const e = /* @__PURE__ */ new Map();
|
|
3009
3009
|
return this.assets.forEach((t, s) => {
|
|
3010
|
-
(t instanceof fe || t instanceof
|
|
3010
|
+
(t instanceof fe || t instanceof ts || t instanceof mt) && e.set(s, t);
|
|
3011
3011
|
}), e;
|
|
3012
3012
|
}
|
|
3013
3013
|
loadAll() {
|
|
3014
|
-
return
|
|
3014
|
+
return se(this, null, function* () {
|
|
3015
3015
|
const e = this.loadObj.filter((t) => !this.delLoadArr.includes(t.src));
|
|
3016
3016
|
return yield Promise.all(
|
|
3017
3017
|
e.map((t) => this.load(t.src, t))
|
|
@@ -3019,12 +3019,12 @@ class ai {
|
|
|
3019
3019
|
});
|
|
3020
3020
|
}
|
|
3021
3021
|
load(e, t) {
|
|
3022
|
-
return
|
|
3023
|
-
var
|
|
3024
|
-
const s = (
|
|
3022
|
+
return se(this, null, function* () {
|
|
3023
|
+
var n, a;
|
|
3024
|
+
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3025
3025
|
if (!s)
|
|
3026
3026
|
return;
|
|
3027
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3027
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = Os();
|
|
3028
3028
|
if (i) {
|
|
3029
3029
|
if (this.assets.has(e))
|
|
3030
3030
|
return this.assets.get(e);
|
|
@@ -3034,9 +3034,9 @@ class ai {
|
|
|
3034
3034
|
try {
|
|
3035
3035
|
const d = yield o.loadAsync(e);
|
|
3036
3036
|
if (this.assets.set(e, d), r.resolve(d), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3037
|
-
(t == null ? void 0 : t.colorCorrection) !== !1 &&
|
|
3038
|
-
const
|
|
3039
|
-
d.anisotropy =
|
|
3037
|
+
(t == null ? void 0 : t.colorCorrection) !== !1 && as({ texture: d });
|
|
3038
|
+
const _ = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
|
|
3039
|
+
d.anisotropy = _;
|
|
3040
3040
|
}
|
|
3041
3041
|
return d;
|
|
3042
3042
|
} catch (d) {
|
|
@@ -3052,18 +3052,18 @@ class ai {
|
|
|
3052
3052
|
const t = /* @__PURE__ */ new Set(), s = this.textureAssets;
|
|
3053
3053
|
e.traverse((r) => {
|
|
3054
3054
|
const o = r;
|
|
3055
|
-
o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((
|
|
3055
|
+
o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((a) => {
|
|
3056
3056
|
[
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3057
|
+
a.map,
|
|
3058
|
+
a.emissiveMap,
|
|
3059
|
+
a.normalMap,
|
|
3060
|
+
a.roughnessMap,
|
|
3061
|
+
a.metalnessMap,
|
|
3062
|
+
a.aoMap
|
|
3063
3063
|
].forEach((d) => {
|
|
3064
3064
|
if (d) {
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3065
|
+
const _ = this.getSrcByAsset(d, s);
|
|
3066
|
+
_ && t.add(_);
|
|
3067
3067
|
}
|
|
3068
3068
|
});
|
|
3069
3069
|
});
|
|
@@ -3078,10 +3078,10 @@ class ai {
|
|
|
3078
3078
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3079
3079
|
}
|
|
3080
3080
|
}
|
|
3081
|
-
const
|
|
3081
|
+
const li = {
|
|
3082
3082
|
prefix: ""
|
|
3083
3083
|
};
|
|
3084
|
-
class
|
|
3084
|
+
class hi extends ee {
|
|
3085
3085
|
get loader() {
|
|
3086
3086
|
return this.controller;
|
|
3087
3087
|
}
|
|
@@ -3089,7 +3089,7 @@ class li extends ae {
|
|
|
3089
3089
|
super(), this.options = e;
|
|
3090
3090
|
}
|
|
3091
3091
|
addLoader(e, t) {
|
|
3092
|
-
const { loaderParams: s } = this.options, i = new ai(
|
|
3092
|
+
const { loaderParams: s } = this.options, i = new ai(te(U({}, s), {
|
|
3093
3093
|
scene: e
|
|
3094
3094
|
}));
|
|
3095
3095
|
return this.addController(i, t);
|
|
@@ -3100,20 +3100,20 @@ class li extends ae {
|
|
|
3100
3100
|
});
|
|
3101
3101
|
}
|
|
3102
3102
|
}
|
|
3103
|
-
class ci extends
|
|
3103
|
+
class ci extends hs {
|
|
3104
3104
|
constructor(e) {
|
|
3105
3105
|
super(), this.options = U({}, e);
|
|
3106
3106
|
}
|
|
3107
3107
|
create() {
|
|
3108
3108
|
var e;
|
|
3109
|
-
this.object3d = (e = this.options.scene) != null ? e : new
|
|
3109
|
+
this.object3d = (e = this.options.scene) != null ? e : new nt();
|
|
3110
3110
|
}
|
|
3111
3111
|
}
|
|
3112
|
-
function
|
|
3112
|
+
function rt(h) {
|
|
3113
3113
|
let e = !1, t = [];
|
|
3114
3114
|
return function(...s) {
|
|
3115
3115
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
3116
|
-
e = !1,
|
|
3116
|
+
e = !1, h(...t);
|
|
3117
3117
|
}));
|
|
3118
3118
|
};
|
|
3119
3119
|
}
|
|
@@ -3127,33 +3127,33 @@ class di {
|
|
|
3127
3127
|
}
|
|
3128
3128
|
addPickListener(e) {
|
|
3129
3129
|
const t = /* @__PURE__ */ new Set(["move", "enter", "leave"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
3130
|
-
var
|
|
3130
|
+
var y;
|
|
3131
3131
|
if (!this.enabled)
|
|
3132
3132
|
return;
|
|
3133
3133
|
r.preventDefault();
|
|
3134
|
-
const o = e === "move" ? t : s,
|
|
3134
|
+
const o = e === "move" ? t : s, n = [];
|
|
3135
3135
|
if (this.pickFunctionsMap.forEach((m) => {
|
|
3136
|
-
o.has(m.type) &&
|
|
3136
|
+
o.has(m.type) && n.push(te(U({}, m), {
|
|
3137
3137
|
objArr: m.objArr instanceof Function ? m.objArr() : m.objArr
|
|
3138
3138
|
}));
|
|
3139
|
-
}),
|
|
3139
|
+
}), n.length === 0) return;
|
|
3140
3140
|
this.activeObjects.clear(), this.objCallbackMap.clear();
|
|
3141
|
-
const
|
|
3142
|
-
for (const m of
|
|
3141
|
+
const a = this.objCallbackMap, d = [];
|
|
3142
|
+
for (const m of n)
|
|
3143
3143
|
for (const u of m.objArr) {
|
|
3144
3144
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
3145
|
-
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3145
|
+
a.has(u) || (a.set(u, /* @__PURE__ */ new Map()), d.push(u));
|
|
3146
|
+
const f = a.get(u);
|
|
3147
|
+
f.has(m.type) || f.set(m.type, []), f.get(m.type).push(m.cb);
|
|
3148
3148
|
}
|
|
3149
3149
|
if (d.length === 0) return;
|
|
3150
|
-
const
|
|
3151
|
-
|
|
3150
|
+
const _ = d.map((m) => m.object3d);
|
|
3151
|
+
_.forEach((m) => {
|
|
3152
3152
|
m.isGroup && m.traverse((u) => {
|
|
3153
|
-
u instanceof
|
|
3153
|
+
u instanceof ss && _.push(u);
|
|
3154
3154
|
});
|
|
3155
3155
|
});
|
|
3156
|
-
const p = (
|
|
3156
|
+
const p = (y = this.pencil.pick(r, _, !1)) == null ? void 0 : y.intersects;
|
|
3157
3157
|
if (!p || p.length === 0)
|
|
3158
3158
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
3159
3159
|
else {
|
|
@@ -3161,12 +3161,12 @@ class di {
|
|
|
3161
3161
|
const m = p[0];
|
|
3162
3162
|
this.processIntersection(m, r, e);
|
|
3163
3163
|
}
|
|
3164
|
-
const
|
|
3165
|
-
this.prevActiveObjects = this.activeObjects, this.activeObjects =
|
|
3164
|
+
const O = this.prevActiveObjects;
|
|
3165
|
+
this.prevActiveObjects = this.activeObjects, this.activeObjects = O, this.activeObjects.clear();
|
|
3166
3166
|
};
|
|
3167
3167
|
this.domElement.addEventListener(
|
|
3168
3168
|
`pointer${e}`,
|
|
3169
|
-
|
|
3169
|
+
rt(i),
|
|
3170
3170
|
{ passive: !1 }
|
|
3171
3171
|
);
|
|
3172
3172
|
}
|
|
@@ -3177,8 +3177,8 @@ class di {
|
|
|
3177
3177
|
const i = this.objCallbackMap, r = e.index || -1;
|
|
3178
3178
|
let o = e.object;
|
|
3179
3179
|
for (; o; ) {
|
|
3180
|
-
const
|
|
3181
|
-
|
|
3180
|
+
const n = this.pencil.lead.objMap.get(o);
|
|
3181
|
+
n && i.has(n) && this.activeObjects.add(n), o = o.parent;
|
|
3182
3182
|
}
|
|
3183
3183
|
s === "move" ? this.handleLeaveEvents(t) : s === "down" && this.handleDownOutside(t), this.processObjectHierarchy(t, s, r);
|
|
3184
3184
|
}
|
|
@@ -3188,48 +3188,48 @@ class di {
|
|
|
3188
3188
|
const o = () => {
|
|
3189
3189
|
r = !0;
|
|
3190
3190
|
};
|
|
3191
|
-
for (const
|
|
3191
|
+
for (const n of this.activeObjects) {
|
|
3192
3192
|
if (r) break;
|
|
3193
|
-
const
|
|
3194
|
-
if (
|
|
3193
|
+
const a = i.get(n);
|
|
3194
|
+
if (a)
|
|
3195
3195
|
if (t === "move") {
|
|
3196
|
-
const d =
|
|
3197
|
-
if (d && !this.prevActiveObjects.has(
|
|
3196
|
+
const d = a.get("enter");
|
|
3197
|
+
if (d && !this.prevActiveObjects.has(n))
|
|
3198
3198
|
for (const p of d)
|
|
3199
3199
|
p({
|
|
3200
|
-
baseObject:
|
|
3200
|
+
baseObject: n,
|
|
3201
3201
|
mouseEvent: e,
|
|
3202
3202
|
sp: o,
|
|
3203
3203
|
intersectionIndex: s
|
|
3204
3204
|
});
|
|
3205
|
-
const
|
|
3206
|
-
if (
|
|
3207
|
-
for (const p of
|
|
3205
|
+
const _ = a.get("move");
|
|
3206
|
+
if (_)
|
|
3207
|
+
for (const p of _)
|
|
3208
3208
|
p({
|
|
3209
|
-
baseObject:
|
|
3209
|
+
baseObject: n,
|
|
3210
3210
|
mouseEvent: e,
|
|
3211
3211
|
sp: o,
|
|
3212
3212
|
intersectionIndex: s
|
|
3213
3213
|
});
|
|
3214
3214
|
} else {
|
|
3215
|
-
const d =
|
|
3215
|
+
const d = a.get("down");
|
|
3216
3216
|
if (d)
|
|
3217
3217
|
for (const p of d)
|
|
3218
3218
|
p({
|
|
3219
|
-
baseObject:
|
|
3219
|
+
baseObject: n,
|
|
3220
3220
|
mouseEvent: e,
|
|
3221
3221
|
sp: o,
|
|
3222
3222
|
intersectionIndex: s
|
|
3223
3223
|
});
|
|
3224
|
-
const
|
|
3225
|
-
if (
|
|
3226
|
-
const p = (
|
|
3227
|
-
|
|
3228
|
-
const
|
|
3229
|
-
if (!r && Math.abs(
|
|
3230
|
-
for (const m of
|
|
3224
|
+
const _ = a.get("click");
|
|
3225
|
+
if (_) {
|
|
3226
|
+
const p = (O) => {
|
|
3227
|
+
O.preventDefault();
|
|
3228
|
+
const y = 5;
|
|
3229
|
+
if (!r && Math.abs(O.clientX - e.clientX) <= y && Math.abs(O.clientY - e.clientY) <= y)
|
|
3230
|
+
for (const m of _)
|
|
3231
3231
|
m({
|
|
3232
|
-
baseObject:
|
|
3232
|
+
baseObject: n,
|
|
3233
3233
|
mouseEvent: e,
|
|
3234
3234
|
sp: o,
|
|
3235
3235
|
intersectionIndex: s
|
|
@@ -3268,9 +3268,9 @@ class di {
|
|
|
3268
3268
|
i === "mousemove" ? i = "move" : i === "mouseenter" ? i = "enter" : i === "mouseleave" && (i = "leave"), this.pickFunctionsMapIndex += 1;
|
|
3269
3269
|
const r = this.pickFunctionsMapIndex;
|
|
3270
3270
|
return this.pickFunctionsMap.set(r, { objArr: e, type: i, cb: s }), this.pickListener.move || Array.from(this.pickFunctionsMap.values()).some(
|
|
3271
|
-
(
|
|
3271
|
+
(n) => ["move", "enter", "leave"].includes(n.type)
|
|
3272
3272
|
) && (this.pickListener.move = !0, this.addPickListener("move")), this.pickListener.down || Array.from(this.pickFunctionsMap.values()).some(
|
|
3273
|
-
(
|
|
3273
|
+
(n) => ["down", "downOutside", "click"].includes(n.type)
|
|
3274
3274
|
) && (this.pickListener.down = !0, this.addPickListener("down")), r;
|
|
3275
3275
|
}
|
|
3276
3276
|
removePick(e) {
|
|
@@ -3281,16 +3281,16 @@ class di {
|
|
|
3281
3281
|
return console.warn("handlePickNode:err:不支持 downOutside"), -1;
|
|
3282
3282
|
this.pickNodeFunctionsMapIndex += 1;
|
|
3283
3283
|
const i = this.pickNodeFunctionsMapIndex, r = e instanceof Function ? e() : e, o = [];
|
|
3284
|
-
for (const
|
|
3285
|
-
const
|
|
3286
|
-
|
|
3284
|
+
for (const n of r) {
|
|
3285
|
+
const a = n;
|
|
3286
|
+
a.element.style.pointerEvents = "auto";
|
|
3287
3287
|
const d = (p) => {
|
|
3288
3288
|
this.enabled && (p.preventDefault(), s({
|
|
3289
|
-
baseObject:
|
|
3289
|
+
baseObject: a,
|
|
3290
3290
|
mouseEvent: p
|
|
3291
3291
|
}));
|
|
3292
|
-
},
|
|
3293
|
-
|
|
3292
|
+
}, _ = `pointer${t}`;
|
|
3293
|
+
a.element.addEventListener(_, rt(d), !1), o.push({ arr: a, type: _, listener: d });
|
|
3294
3294
|
}
|
|
3295
3295
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
3296
3296
|
}
|
|
@@ -3314,7 +3314,7 @@ class pi extends di {
|
|
|
3314
3314
|
constructor(e, t) {
|
|
3315
3315
|
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.scene = new ci({
|
|
3316
3316
|
scene: t.scene
|
|
3317
|
-
}), this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.key = "Scene", this.scene.object3d.name = "场景", this.group = new
|
|
3317
|
+
}), this.mList = t.mList, this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.mList = this.mList, this.scene.key = "Scene", this.scene.object3d.name = "场景", this.group = new ze(), this.group.create(), this.group.lead = this, this.group.pencil = e, this.group.mList = this.mList, this.group.key = "@Group", this.group.object3d.name = "物体组", this.prefabGroup = new ze(), this.prefabGroup.create(), this.prefabGroup.lead = this, this.prefabGroup.pencil = e, this.prefabGroup.mList = this.mList, this.prefabGroup.key = "@PrefabGroup", this.prefabGroup.object3d.name = "预制组", this.scene.add(this.group.object3d, this.prefabGroup.object3d), this.objects.set("@Scene", this.scene), this.objects.set("@Group", this.group), this.objects.set("@PrefabGroup", this.prefabGroup), this.objMap.set(this.scene.object3d, this.scene), this.objMap.set(this.group.object3d, this.group), this.objMap.set(this.prefabGroup.object3d, this.prefabGroup);
|
|
3318
3318
|
}
|
|
3319
3319
|
get objectsPromise() {
|
|
3320
3320
|
return this.objectsPm.values();
|
|
@@ -3337,29 +3337,29 @@ class pi extends di {
|
|
|
3337
3337
|
getAllObject(e, t) {
|
|
3338
3338
|
e.includes("#") && console.warn("getAllObject:err:不支持 #", e);
|
|
3339
3339
|
const { key: s } = t || {}, i = `${e}${s ? `#${s}` : ""}`, r = [];
|
|
3340
|
-
return this.objects.forEach((o,
|
|
3341
|
-
(
|
|
3340
|
+
return this.objects.forEach((o, n) => {
|
|
3341
|
+
(n.startsWith(s ? i : `${i}#`) || n === i) && r.push(o);
|
|
3342
3342
|
}), r;
|
|
3343
3343
|
}
|
|
3344
3344
|
draw(e, t, s) {
|
|
3345
|
-
return
|
|
3346
|
-
var r, o,
|
|
3345
|
+
return se(this, null, function* () {
|
|
3346
|
+
var r, o, n, a;
|
|
3347
3347
|
const i = this.objectNamesToFactories.get(e);
|
|
3348
3348
|
if (i) {
|
|
3349
3349
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3350
|
-
const d = t.target,
|
|
3350
|
+
const d = t.target, _ = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, O = (n = t.create) != null ? n : !0, y = new i().create(t);
|
|
3351
3351
|
let m;
|
|
3352
|
-
return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (
|
|
3353
|
-
} :
|
|
3354
|
-
|
|
3355
|
-
}),
|
|
3356
|
-
|
|
3352
|
+
return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (a = d == null ? void 0 : d.objectType) != null && a.startsWith("BaseObject") || d ? m = d : p ? m = this.prefabGroup : m = this.group, O === !1 ? y.create = () => {
|
|
3353
|
+
} : O !== !0 && (y.create = () => {
|
|
3354
|
+
O(y);
|
|
3355
|
+
}), y.pencil = this.pencil, y.lead = this, y.mList = this.mList, y.prefab = p, y.objectType = `BaseObject#${e}`, y.objectOptions = t, this.setBaseObjectKey(
|
|
3356
|
+
y,
|
|
3357
3357
|
t.key ? `$t:#${t.key}` : "$t:",
|
|
3358
3358
|
m == null ? void 0 : m.key
|
|
3359
3359
|
), this.objectsPm.set(
|
|
3360
|
-
|
|
3361
|
-
this.addBaseObject(
|
|
3362
|
-
), yield this.objectsPm.get(
|
|
3360
|
+
y,
|
|
3361
|
+
this.addBaseObject(y, m, _)
|
|
3362
|
+
), yield this.objectsPm.get(y), this.objectsPm.delete(y), y;
|
|
3363
3363
|
}
|
|
3364
3364
|
throw new Error(`Unrecognized:${e}`);
|
|
3365
3365
|
});
|
|
@@ -3368,33 +3368,29 @@ class pi extends di {
|
|
|
3368
3368
|
const i = e.objectType, [, r] = i.split("#");
|
|
3369
3369
|
let o = t.replace("$t:", r);
|
|
3370
3370
|
if (s) {
|
|
3371
|
-
const [,
|
|
3372
|
-
o = o.replace("$p:",
|
|
3371
|
+
const [, n] = s.split("#");
|
|
3372
|
+
o = o.replace("$p:", n);
|
|
3373
3373
|
}
|
|
3374
|
-
return this.objects.has(o) && (o.includes("#") ? o += `-${
|
|
3374
|
+
return this.objects.has(o) && (o.includes("#") ? o += `-${Ie()}` : o += `#${Ie()}`), e.key = o, this.objects.set(o, e), o;
|
|
3375
3375
|
}
|
|
3376
3376
|
updateBaseObjectKey(e, t) {
|
|
3377
3377
|
var o;
|
|
3378
3378
|
let s;
|
|
3379
|
-
for (const [
|
|
3380
|
-
if (
|
|
3381
|
-
s =
|
|
3379
|
+
for (const [n, a] of this.objects.entries())
|
|
3380
|
+
if (a === e) {
|
|
3381
|
+
s = n;
|
|
3382
3382
|
break;
|
|
3383
3383
|
}
|
|
3384
|
-
const i = (o = e.parent) == null ? void 0 : o.key;
|
|
3385
|
-
|
|
3386
|
-
return this.setBaseObjectKey(e, t, i);
|
|
3387
|
-
this.objects.delete(s);
|
|
3388
|
-
const r = this.setBaseObjectKey(e, t, i);
|
|
3389
|
-
return this.pencil.event.emit("updateKey", e, r, s), r;
|
|
3384
|
+
const i = (o = e.parent) == null ? void 0 : o.key, r = this.setBaseObjectKey(e, t, i);
|
|
3385
|
+
return s && this.objects.delete(s), this.pencil.event.emit("updateKey", e, r, s), r;
|
|
3390
3386
|
}
|
|
3391
3387
|
addBaseObject(e, t, s) {
|
|
3392
|
-
return
|
|
3393
|
-
yield e.create(), e.object3d && (s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render(), this.pencil.event.emit("draw", e);
|
|
3388
|
+
return se(this, null, function* () {
|
|
3389
|
+
yield e.create(), e.object3d && (this.mList.proxyBaseObject(e), this.mList.addBaseObjectMap(e), s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render(), this.pencil.event.emit("draw", e);
|
|
3394
3390
|
});
|
|
3395
3391
|
}
|
|
3396
3392
|
erase(...e) {
|
|
3397
|
-
this.handleErase(!0, ...e)
|
|
3393
|
+
this.handleErase(!0, ...e);
|
|
3398
3394
|
}
|
|
3399
3395
|
eraseWithoutMaterial(...e) {
|
|
3400
3396
|
this.handleErase(!1, ...e);
|
|
@@ -3408,9 +3404,9 @@ class pi extends di {
|
|
|
3408
3404
|
} else
|
|
3409
3405
|
i.push(s);
|
|
3410
3406
|
i.forEach((r) => {
|
|
3411
|
-
|
|
3407
|
+
r.disposeMaterialIfNotUsed = e, r.dispose();
|
|
3412
3408
|
});
|
|
3413
|
-
});
|
|
3409
|
+
}), this.pencil.event.emit("erase", ...t);
|
|
3414
3410
|
}
|
|
3415
3411
|
update(e, t) {
|
|
3416
3412
|
this.objects.forEach((s) => {
|
|
@@ -3433,18 +3429,19 @@ class pi extends di {
|
|
|
3433
3429
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectNamesToFactories.clear();
|
|
3434
3430
|
}
|
|
3435
3431
|
}
|
|
3436
|
-
class mi extends
|
|
3432
|
+
class mi extends ee {
|
|
3437
3433
|
get lead() {
|
|
3438
3434
|
return this.controller;
|
|
3439
3435
|
}
|
|
3440
3436
|
constructor(e) {
|
|
3441
3437
|
super(), this.options = e;
|
|
3442
3438
|
}
|
|
3443
|
-
addLead(e, t) {
|
|
3444
|
-
const { pencil:
|
|
3445
|
-
scene: e
|
|
3439
|
+
addLead(e, t, s) {
|
|
3440
|
+
const { pencil: i } = this.options, r = new pi(i, {
|
|
3441
|
+
scene: e,
|
|
3442
|
+
mList: t
|
|
3446
3443
|
});
|
|
3447
|
-
return this.addController(
|
|
3444
|
+
return this.addController(r, s);
|
|
3448
3445
|
}
|
|
3449
3446
|
removePage(e) {
|
|
3450
3447
|
super.removePage(e, (t) => {
|
|
@@ -3462,11 +3459,194 @@ class mi extends ae {
|
|
|
3462
3459
|
});
|
|
3463
3460
|
}
|
|
3464
3461
|
}
|
|
3462
|
+
class ui {
|
|
3463
|
+
constructor(e) {
|
|
3464
|
+
this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
|
|
3465
|
+
}
|
|
3466
|
+
add(e, t) {
|
|
3467
|
+
this.materials.set(e, t);
|
|
3468
|
+
const s = {
|
|
3469
|
+
object3d: new Proxy(
|
|
3470
|
+
{
|
|
3471
|
+
material: t
|
|
3472
|
+
},
|
|
3473
|
+
{
|
|
3474
|
+
set: (i, r, o) => {
|
|
3475
|
+
var n;
|
|
3476
|
+
if (r === "material" && !((n = this.pencil.composerController) != null && n.bloomComposerRenderIng)) {
|
|
3477
|
+
const a = i.material;
|
|
3478
|
+
return i.material = o, this.materials.set(e, o), this.disposeMaterial(a), this.syncChangeMaterial(a, o), !0;
|
|
3479
|
+
}
|
|
3480
|
+
return Reflect.set(i, r, o);
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
)
|
|
3484
|
+
};
|
|
3485
|
+
this.fixBaseObjects.set(e, s);
|
|
3486
|
+
}
|
|
3487
|
+
get(e) {
|
|
3488
|
+
const t = this.materials.get(e);
|
|
3489
|
+
return t || console.warn(`Material with key "${e}" not found.`), t;
|
|
3490
|
+
}
|
|
3491
|
+
getKey(e) {
|
|
3492
|
+
for (const [t, s] of this.materials.entries())
|
|
3493
|
+
if (s === e)
|
|
3494
|
+
return t;
|
|
3495
|
+
}
|
|
3496
|
+
getFixBaseObject(e) {
|
|
3497
|
+
const t = this.fixBaseObjects.get(e);
|
|
3498
|
+
return t || null;
|
|
3499
|
+
}
|
|
3500
|
+
addMultiple(e, t) {
|
|
3501
|
+
for (const [s, i] of Object.entries(t)) {
|
|
3502
|
+
const r = `${e}#${s}`;
|
|
3503
|
+
i && this.add(r, i);
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
getMultiple(e) {
|
|
3507
|
+
const t = {}, s = `${e}#`;
|
|
3508
|
+
let i = !1;
|
|
3509
|
+
for (const [r, o] of this.materials.entries())
|
|
3510
|
+
if (r.startsWith(s)) {
|
|
3511
|
+
const n = r.substring(s.length);
|
|
3512
|
+
t[n] = o, i = !0;
|
|
3513
|
+
}
|
|
3514
|
+
return i ? t : null;
|
|
3515
|
+
}
|
|
3516
|
+
copyMultiple(e, t) {
|
|
3517
|
+
const s = {}, i = `${e}#`;
|
|
3518
|
+
for (const [r, o] of this.materials.entries())
|
|
3519
|
+
if (r.startsWith(i)) {
|
|
3520
|
+
const n = r.substring(i.length), a = o.clone();
|
|
3521
|
+
s[n] = a;
|
|
3522
|
+
const d = `${t}#${n}`;
|
|
3523
|
+
this.add(d, a);
|
|
3524
|
+
}
|
|
3525
|
+
return s;
|
|
3526
|
+
}
|
|
3527
|
+
disposeMaterial(e) {
|
|
3528
|
+
if (!e) return;
|
|
3529
|
+
const t = new Pe();
|
|
3530
|
+
t.track([e]), t.dispose();
|
|
3531
|
+
}
|
|
3532
|
+
remove(e) {
|
|
3533
|
+
const t = this.materials.get(e);
|
|
3534
|
+
t && this.disposeMaterial(t), this.materials.delete(e), this.fixBaseObjects.delete(e);
|
|
3535
|
+
}
|
|
3536
|
+
removeByMaterial(e) {
|
|
3537
|
+
[...this.materials.entries()].some(([t, s]) => s === e ? (this.remove(t), !0) : !1);
|
|
3538
|
+
}
|
|
3539
|
+
proxyBaseObject(e) {
|
|
3540
|
+
const t = e.object3d, s = (i) => new Proxy(i, {
|
|
3541
|
+
set: (r, o, n) => {
|
|
3542
|
+
if (typeof o == "string" && !isNaN(Number(o))) {
|
|
3543
|
+
const a = Number(o);
|
|
3544
|
+
if (a >= 0 && a < r.length) {
|
|
3545
|
+
const d = r[a];
|
|
3546
|
+
return this.rmBaseObjectMap(e, d), r[a] = n, this.addBaseObjectMap(e), !0;
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
return Reflect.set(r, o, n);
|
|
3550
|
+
}
|
|
3551
|
+
});
|
|
3552
|
+
e.materialList && (e.materialList = new Proxy(e.materialList, {
|
|
3553
|
+
set: (i, r, o) => {
|
|
3554
|
+
if (typeof r == "string") {
|
|
3555
|
+
const n = i[r];
|
|
3556
|
+
return n && (Array.isArray(n) ? n.forEach((a) => this.rmBaseObjectMap(e, a)) : this.rmBaseObjectMap(e, n)), i[r] = o, o && this.addBaseObjectMap(e), !0;
|
|
3557
|
+
}
|
|
3558
|
+
return Reflect.set(i, r, o);
|
|
3559
|
+
},
|
|
3560
|
+
deleteProperty: (i, r) => {
|
|
3561
|
+
if (typeof r == "string" && i[r]) {
|
|
3562
|
+
const o = i[r];
|
|
3563
|
+
Array.isArray(o) ? o.forEach((n) => this.rmBaseObjectMap(e, n)) : this.rmBaseObjectMap(e, o);
|
|
3564
|
+
}
|
|
3565
|
+
return Reflect.deleteProperty(i, r);
|
|
3566
|
+
}
|
|
3567
|
+
})), e.object3d = new Proxy(t, {
|
|
3568
|
+
set: (i, r, o) => {
|
|
3569
|
+
var n;
|
|
3570
|
+
return r === "material" && !((n = this.pencil.composerController) != null && n.bloomComposerRenderIng) ? e.materialList && Object.values(e.materialList).includes(o) ? (i.material = o, !0) : (this.rmBaseObjectMap(e), i.material = o, this.addBaseObjectMap(e), !0) : Reflect.set(i, r, o);
|
|
3571
|
+
},
|
|
3572
|
+
get: (i, r) => {
|
|
3573
|
+
var o;
|
|
3574
|
+
if (r === "material" && !((o = this.pencil.composerController) != null && o.bloomComposerRenderIng)) {
|
|
3575
|
+
const n = i.material;
|
|
3576
|
+
if (Array.isArray(n) && !n.hasOwnProperty("__isProxy")) {
|
|
3577
|
+
const a = s(n);
|
|
3578
|
+
Object.defineProperty(a, "__isProxy", {
|
|
3579
|
+
value: !0,
|
|
3580
|
+
enumerable: !1
|
|
3581
|
+
}), i.material = a;
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
return Reflect.get(i, r);
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3588
|
+
addBaseObjectMap(e) {
|
|
3589
|
+
console.log("addBaseObjectMap", e);
|
|
3590
|
+
const t = e.object3d;
|
|
3591
|
+
t.material && (Array.isArray(t.material) ? t.material : [t.material]).forEach((i) => {
|
|
3592
|
+
const r = this.materialBaseObjectMap.get(i);
|
|
3593
|
+
r ? r.add(e) : this.materialBaseObjectMap.set(i, /* @__PURE__ */ new Set([e]));
|
|
3594
|
+
}), e.materialList && Object.values(e.materialList).forEach((s) => {
|
|
3595
|
+
s && (Array.isArray(s) ? s : [s]).forEach((r) => {
|
|
3596
|
+
const o = this.materialBaseObjectMap.get(r);
|
|
3597
|
+
o ? o.add(e) : this.materialBaseObjectMap.set(r, /* @__PURE__ */ new Set([e]));
|
|
3598
|
+
});
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
rmBaseObjectMap(e, t, s = !0) {
|
|
3602
|
+
this.materialBaseObjectMap.forEach((i, r) => {
|
|
3603
|
+
t && r !== t || i.has(e) && (i.delete(e), i.size === 0 && s && (this.materialBaseObjectMap.delete(r), this.disposeMaterial(r)));
|
|
3604
|
+
});
|
|
3605
|
+
}
|
|
3606
|
+
syncChangeMaterial(e, t) {
|
|
3607
|
+
const s = this.materialBaseObjectMap.get(e);
|
|
3608
|
+
s && s.forEach((i) => {
|
|
3609
|
+
const r = i.object3d, o = r.material;
|
|
3610
|
+
if (Array.isArray(o)) {
|
|
3611
|
+
const n = o.indexOf(e);
|
|
3612
|
+
n !== -1 && (o[n] = t);
|
|
3613
|
+
} else o === e && (r.material = t);
|
|
3614
|
+
i.materialList && Object.keys(i.materialList).forEach((n) => {
|
|
3615
|
+
const a = i.materialList[n];
|
|
3616
|
+
if (Array.isArray(a)) {
|
|
3617
|
+
const d = a.indexOf(e);
|
|
3618
|
+
d !== -1 && (a[d] = t);
|
|
3619
|
+
} else a === e && (i.materialList[n] = t);
|
|
3620
|
+
});
|
|
3621
|
+
});
|
|
3622
|
+
}
|
|
3623
|
+
dispose() {
|
|
3624
|
+
const e = new Pe();
|
|
3625
|
+
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
class fi extends ee {
|
|
3629
|
+
get mList() {
|
|
3630
|
+
return this.controller;
|
|
3631
|
+
}
|
|
3632
|
+
constructor(e) {
|
|
3633
|
+
super(), this.options = e;
|
|
3634
|
+
}
|
|
3635
|
+
addMList(e, t) {
|
|
3636
|
+
const { pencil: s } = this.options, i = new ui(s);
|
|
3637
|
+
return this.addController(i, t);
|
|
3638
|
+
}
|
|
3639
|
+
removePage(e) {
|
|
3640
|
+
super.removePage(e, (t) => {
|
|
3641
|
+
t.dispose();
|
|
3642
|
+
});
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3465
3645
|
const _e = class _e {
|
|
3466
3646
|
constructor(e) {
|
|
3467
3647
|
var r, o;
|
|
3468
|
-
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new
|
|
3469
|
-
isMergeableObject:
|
|
3648
|
+
this.raycaster = new ht(), 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 is(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = rs(_e.options, e, {
|
|
3649
|
+
isMergeableObject: ls
|
|
3470
3650
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3471
3651
|
const {
|
|
3472
3652
|
container: t,
|
|
@@ -3474,10 +3654,10 @@ const _e = class _e {
|
|
|
3474
3654
|
transformControls: i
|
|
3475
3655
|
} = this.options;
|
|
3476
3656
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3477
|
-
const
|
|
3657
|
+
const n = new os({
|
|
3478
3658
|
horizontal: !1
|
|
3479
3659
|
});
|
|
3480
|
-
|
|
3660
|
+
n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
|
|
3481
3661
|
}
|
|
3482
3662
|
this.initResizeObserver(), this.tweenUpdateRaf();
|
|
3483
3663
|
}
|
|
@@ -3511,6 +3691,9 @@ const _e = class _e {
|
|
|
3511
3691
|
get lead() {
|
|
3512
3692
|
return this.leadController.lead;
|
|
3513
3693
|
}
|
|
3694
|
+
get mList() {
|
|
3695
|
+
return this.mListController.mList;
|
|
3696
|
+
}
|
|
3514
3697
|
tweenUpdateRaf() {
|
|
3515
3698
|
Ce.update(), this.TweenRaf = requestAnimationFrame(this.tweenUpdateRaf.bind(this));
|
|
3516
3699
|
}
|
|
@@ -3525,19 +3708,21 @@ const _e = class _e {
|
|
|
3525
3708
|
t,
|
|
3526
3709
|
s
|
|
3527
3710
|
), r = this.sceneController.addScene(e, s);
|
|
3528
|
-
|
|
3711
|
+
r.add(i), this.controlsController.addCameraControls(i, s), this.loaderController.addLoader(r, s);
|
|
3712
|
+
const o = this.mListController.addMList(null, s);
|
|
3713
|
+
return this.leadController.addLead(r, o, s), this.pageCountIndex = s, s;
|
|
3529
3714
|
}
|
|
3530
3715
|
removePage(e) {
|
|
3531
|
-
this.cameraController.removePage(e), this.sceneController.removePage(e), this.controlsController.removePage(e), this.loaderController.removePage(e), this.leadController.removePage(e), this.pageCountIndex === e && (this.pageCountIndex -= 1), this.pageActiveIndex === e && (this.render(), this.showPage(0));
|
|
3716
|
+
this.cameraController.removePage(e), this.sceneController.removePage(e), this.controlsController.removePage(e), this.loaderController.removePage(e), this.mListController.removePage(e), this.leadController.removePage(e), this.pageCountIndex === e && (this.pageCountIndex -= 1), this.pageActiveIndex === e && (this.render(), this.showPage(0));
|
|
3532
3717
|
}
|
|
3533
3718
|
showPage(e) {
|
|
3534
3719
|
var s;
|
|
3535
3720
|
if (e === this.pageActiveIndex) return;
|
|
3536
3721
|
const t = this.scene;
|
|
3537
|
-
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.leadController.setPageActive(e), this.pageActiveIndex = e;
|
|
3722
|
+
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;
|
|
3538
3723
|
}
|
|
3539
3724
|
init() {
|
|
3540
|
-
var
|
|
3725
|
+
var g;
|
|
3541
3726
|
const {
|
|
3542
3727
|
container: e,
|
|
3543
3728
|
WebGPUTHREE: t,
|
|
@@ -3545,46 +3730,48 @@ const _e = class _e {
|
|
|
3545
3730
|
viewHelper: i,
|
|
3546
3731
|
renderer: r,
|
|
3547
3732
|
controls: o,
|
|
3548
|
-
loader:
|
|
3549
|
-
} = this.options, { width:
|
|
3550
|
-
width:
|
|
3733
|
+
loader: n
|
|
3734
|
+
} = this.options, { width: a, height: d } = this.getSize(), _ = t ? new Ds({
|
|
3735
|
+
width: a,
|
|
3551
3736
|
height: d,
|
|
3552
3737
|
renderer: t.WebGPURenderer,
|
|
3553
|
-
rendererParams:
|
|
3738
|
+
rendererParams: Rs
|
|
3554
3739
|
}) : new Ms({
|
|
3555
|
-
width:
|
|
3740
|
+
width: a,
|
|
3556
3741
|
height: d,
|
|
3557
|
-
rendererParams:
|
|
3742
|
+
rendererParams: te(U({}, r), {
|
|
3558
3743
|
antialias: !1
|
|
3559
3744
|
})
|
|
3560
3745
|
}), p = new zs({
|
|
3561
|
-
width:
|
|
3746
|
+
width: a,
|
|
3562
3747
|
height: d
|
|
3563
|
-
}),
|
|
3748
|
+
}), O = new Fs({}), y = new Is({
|
|
3564
3749
|
controlsParams: {
|
|
3565
|
-
domElement: (
|
|
3750
|
+
domElement: (g = o == null ? void 0 : o.domElement) != null ? g : _.renderer.domElement
|
|
3566
3751
|
}
|
|
3567
|
-
}), m = new
|
|
3752
|
+
}), m = new hi({
|
|
3568
3753
|
loaderParams: U({
|
|
3569
|
-
anisotropy:
|
|
3570
|
-
},
|
|
3571
|
-
}), u = new
|
|
3754
|
+
anisotropy: _.renderer.capabilities.getMaxAnisotropy()
|
|
3755
|
+
}, n)
|
|
3756
|
+
}), u = new fi({
|
|
3757
|
+
pencil: this
|
|
3758
|
+
}), f = new mi({
|
|
3572
3759
|
pencil: this
|
|
3573
3760
|
});
|
|
3574
|
-
this.sceneController =
|
|
3575
|
-
const
|
|
3761
|
+
this.sceneController = O, this.cameraController = p, this.controlsController = y, this.rendererController = _, this.loaderController = m, this.mListController = u, this.leadController = f;
|
|
3762
|
+
const l = this.addPage({
|
|
3576
3763
|
sceneOptions: this.options.scene,
|
|
3577
3764
|
cameraOptions: this.options.camera
|
|
3578
3765
|
});
|
|
3579
|
-
if (this.showPage(
|
|
3580
|
-
const
|
|
3766
|
+
if (this.showPage(l), s) {
|
|
3767
|
+
const C = new Ns({
|
|
3581
3768
|
container: e,
|
|
3582
|
-
sceneController:
|
|
3769
|
+
sceneController: O,
|
|
3583
3770
|
cameraController: p
|
|
3584
3771
|
});
|
|
3585
|
-
|
|
3772
|
+
C.add(O.scene), this.helperController = C, i && C.addViewHelper();
|
|
3586
3773
|
}
|
|
3587
|
-
e.appendChild(
|
|
3774
|
+
e.appendChild(_.renderer.domElement);
|
|
3588
3775
|
}
|
|
3589
3776
|
initComposer() {
|
|
3590
3777
|
const {
|
|
@@ -3615,7 +3802,7 @@ const _e = class _e {
|
|
|
3615
3802
|
}
|
|
3616
3803
|
}
|
|
3617
3804
|
initTransformControls() {
|
|
3618
|
-
const e = new
|
|
3805
|
+
const e = new Hs({
|
|
3619
3806
|
camera: this.camera,
|
|
3620
3807
|
renderer: this.renderer,
|
|
3621
3808
|
scene: this.scene
|
|
@@ -3651,16 +3838,16 @@ const _e = class _e {
|
|
|
3651
3838
|
rendererController: i,
|
|
3652
3839
|
cameraController: r,
|
|
3653
3840
|
composerController: o,
|
|
3654
|
-
cssRendererController:
|
|
3655
|
-
leadController:
|
|
3656
|
-
} = this, d = this.renderer.getSize(new
|
|
3657
|
-
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t),
|
|
3841
|
+
cssRendererController: n,
|
|
3842
|
+
leadController: a
|
|
3843
|
+
} = this, d = this.renderer.getSize(new B());
|
|
3844
|
+
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t), a.setSize(e, t), this.installPlugins.forEach((_) => {
|
|
3658
3845
|
var p;
|
|
3659
|
-
(p =
|
|
3846
|
+
(p = _.setSize) == null || p.call(_, e, t);
|
|
3660
3847
|
}), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3661
3848
|
}
|
|
3662
3849
|
setDevicePixelRatio(e) {
|
|
3663
|
-
var
|
|
3850
|
+
var n;
|
|
3664
3851
|
this.userSetDprCache = e;
|
|
3665
3852
|
const { width: t, height: s } = this.getSize();
|
|
3666
3853
|
let i = Math.sqrt(this.maxBackufferArea / (t * s));
|
|
@@ -3673,12 +3860,12 @@ const _e = class _e {
|
|
|
3673
3860
|
r
|
|
3674
3861
|
);
|
|
3675
3862
|
const o = this.renderer.getPixelRatio();
|
|
3676
|
-
r !== o && (this.rendererController.setPixelRatio(r), (
|
|
3863
|
+
r !== o && (this.rendererController.setPixelRatio(r), (n = this.composerController) == null || n.setPixelRatio(r));
|
|
3677
3864
|
}
|
|
3678
3865
|
pick(e, t, s = !0) {
|
|
3679
|
-
const { raycaster: i, options: r } = this, { container: o } = r,
|
|
3680
|
-
if (
|
|
3681
|
-
i.setFromCamera(
|
|
3866
|
+
const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), a = o.getBoundingClientRect();
|
|
3867
|
+
if (n.x = (e.clientX - a.left) / (a.right - a.left) * 2 - 1, n.y = -((e.clientY - a.top) / (a.bottom - a.top)) * 2 + 1, this.camera && this.scene) {
|
|
3868
|
+
i.setFromCamera(n, this.camera);
|
|
3682
3869
|
const d = i.intersectObjects(
|
|
3683
3870
|
t || this.scene.children,
|
|
3684
3871
|
s
|
|
@@ -3692,19 +3879,19 @@ const _e = class _e {
|
|
|
3692
3879
|
}
|
|
3693
3880
|
}
|
|
3694
3881
|
render() {
|
|
3695
|
-
var s, i, r, o,
|
|
3882
|
+
var s, i, r, o, n, a;
|
|
3696
3883
|
if (!this.camera || !this.scene)
|
|
3697
3884
|
return;
|
|
3698
3885
|
this.timer.update(), Ce.update();
|
|
3699
3886
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3700
3887
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((d) => {
|
|
3701
|
-
var
|
|
3702
|
-
(
|
|
3888
|
+
var _;
|
|
3889
|
+
(_ = d.update) == null || _.call(d, e, t);
|
|
3703
3890
|
}), (s = this.helperController) == null || s.update(
|
|
3704
3891
|
e,
|
|
3705
3892
|
this.controlsController,
|
|
3706
3893
|
this.cameraTarget
|
|
3707
|
-
), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (
|
|
3894
|
+
), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (n = this.cssRendererController) == null || n.render(this.scene, this.camera), (a = this.stats) == null || a.update(), this.event.emit("render", { delta: e, elapsed: t });
|
|
3708
3895
|
}
|
|
3709
3896
|
start() {
|
|
3710
3897
|
window.cancelAnimationFrame(this.TweenRaf), this.renderer.setAnimationLoop(this.render.bind(this)), this.event.emit("start");
|
|
@@ -3742,11 +3929,11 @@ const _e = class _e {
|
|
|
3742
3929
|
}
|
|
3743
3930
|
}
|
|
3744
3931
|
dispose() {
|
|
3745
|
-
var e, t, s, i, r, o,
|
|
3746
|
-
this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((
|
|
3747
|
-
var
|
|
3748
|
-
(
|
|
3749
|
-
}), (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(), (
|
|
3932
|
+
var e, t, s, i, r, o, n, a, d, _, p, O, y, m;
|
|
3933
|
+
this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((u) => {
|
|
3934
|
+
var f;
|
|
3935
|
+
(f = u.dispose) == null || f.call(u);
|
|
3936
|
+
}), (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(), (d = this.rendererController) == null || d.dispose(), (_ = this.loaderController) == null || _.dispose(), (p = this.leadController) == null || p.dispose(), (O = this.mListController) == null || O.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (y = this.stats) == null || y.dom.remove(), (m = this.renderer) == null || m.domElement.remove();
|
|
3750
3937
|
}
|
|
3751
3938
|
};
|
|
3752
3939
|
_e.options = {
|
|
@@ -3755,26 +3942,26 @@ _e.options = {
|
|
|
3755
3942
|
viewHelper: me,
|
|
3756
3943
|
controls: !0,
|
|
3757
3944
|
transformControls: me,
|
|
3758
|
-
renderer:
|
|
3945
|
+
renderer: Ss,
|
|
3759
3946
|
composer: ii,
|
|
3760
3947
|
scene: ks,
|
|
3761
|
-
camera:
|
|
3948
|
+
camera: bt,
|
|
3762
3949
|
bloom: !1,
|
|
3763
3950
|
bloomParams: si,
|
|
3764
3951
|
ssao: !1,
|
|
3765
|
-
loader:
|
|
3952
|
+
loader: li,
|
|
3766
3953
|
ssaoParams: ti,
|
|
3767
3954
|
css2DRenderer: !1,
|
|
3768
|
-
css2DRendererParams: U({},
|
|
3955
|
+
css2DRendererParams: U({}, st),
|
|
3769
3956
|
css3DRenderer: !1,
|
|
3770
|
-
css3DRendererParams: U({},
|
|
3957
|
+
css3DRendererParams: U({}, st)
|
|
3771
3958
|
};
|
|
3772
|
-
let
|
|
3773
|
-
const
|
|
3959
|
+
let ot = _e;
|
|
3960
|
+
const $i = J.ACTION;
|
|
3774
3961
|
export {
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3962
|
+
hs as BaseObject,
|
|
3963
|
+
ot as Pencil,
|
|
3964
|
+
Pe as ResourceTracker,
|
|
3965
|
+
$i as cameraControlsAction,
|
|
3966
|
+
ot as default
|
|
3780
3967
|
};
|