gl-draw 0.15.0-beta.9 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/BaseObject.d.ts +1 -0
- package/dist/core/Lead/Lead.d.ts +4 -5
- package/dist/core/Lead/Pick.d.ts +0 -1
- package/dist/core/MList/MList.d.ts +4 -3
- package/dist/core/Pencil.d.ts +4 -0
- package/dist/core/Renderer.d.ts +0 -1
- package/dist/index.js +3 -3
- package/dist/index.module.js +862 -802
- package/dist/index.module2.js +241 -243
- package/dist/index2.js +5 -5
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +63 -58
- package/package.json +1 -1
- package/dist/objects/scene/index.d.ts +0 -11
package/dist/index.module.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
var
|
|
1
|
+
var At = Object.defineProperty, St = Object.defineProperties;
|
|
2
2
|
var Mt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Me = Object.getOwnPropertySymbols;
|
|
4
4
|
var Rt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Re = (h, e, t) => e in h ?
|
|
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
7
|
Rt.call(e, t) && Re(h, t, e[t]);
|
|
8
8
|
if (Me)
|
|
9
9
|
for (var t of Me(e))
|
|
10
10
|
Dt.call(e, t) && Re(h, t, e[t]);
|
|
11
11
|
return h;
|
|
12
|
-
}, te = (h, e) =>
|
|
12
|
+
}, te = (h, e) => St(h, Mt(e));
|
|
13
13
|
var se = (h, e, t) => new Promise((s, i) => {
|
|
14
|
-
var r = (
|
|
14
|
+
var r = (a) => {
|
|
15
15
|
try {
|
|
16
|
-
n(t.next(
|
|
17
|
-
} catch (
|
|
18
|
-
i(
|
|
16
|
+
n(t.next(a));
|
|
17
|
+
} catch (c) {
|
|
18
|
+
i(c);
|
|
19
19
|
}
|
|
20
|
-
}, o = (
|
|
20
|
+
}, o = (a) => {
|
|
21
21
|
try {
|
|
22
|
-
n(t.throw(
|
|
23
|
-
} catch (
|
|
24
|
-
i(
|
|
22
|
+
n(t.throw(a));
|
|
23
|
+
} catch (c) {
|
|
24
|
+
i(c);
|
|
25
25
|
}
|
|
26
|
-
}, n = (
|
|
26
|
+
}, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
27
27
|
n((t = t.apply(h, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import { WebGLRenderer as Ut,
|
|
30
|
-
import { Timer as
|
|
29
|
+
import { WebGLRenderer as Ut, Vector3 as I, PerspectiveCamera as zt, Matrix4 as W, Scene as nt, AxesHelper as De, CameraHelper as kt, PointLightHelper as Ft, DirectionalLightHelper as Nt, SpotLightHelper as Ht, HemisphereLightHelper as It, Box3 as at, Box3Helper as Ue, MathUtils as jt, Vector2 as B, Vector4 as Bt, Quaternion as lt, Spherical as Vt, Sphere as Yt, Raycaster as ht, REVISION as Zt, Object3D as Wt, UniformsUtils as Kt, RawShaderMaterial as Gt, ShaderMaterial as Xt, MeshBasicMaterial as $t, PointsMaterial as ct, SpriteMaterial as dt, Layers as qt, WebGLRenderTarget as Qt, HalfFloatType as Jt, Loader as mt, Texture as fe, VideoTexture as pt, FileLoader as Ae, LoadingManager as es, DataTexture as ts, Group as ze } from "three";
|
|
30
|
+
import { Timer as ss } 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 Pe, M as ut, B as
|
|
36
|
-
import { RectAreaLightHelper as
|
|
37
|
-
import { ViewHelper as
|
|
38
|
-
import { TransformControls as
|
|
32
|
+
import is from "deepmerge";
|
|
33
|
+
import rs from "stats-gl";
|
|
34
|
+
import { C as os, c as ns, i as as } from "./isPlainObject.module.js";
|
|
35
|
+
import { R as Pe, M as ut, B as ls } from "./index.module2.js";
|
|
36
|
+
import { RectAreaLightHelper as hs } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
37
|
+
import { ViewHelper as cs } from "three/examples/jsm/helpers/ViewHelper";
|
|
38
|
+
import { TransformControls as ds } from "three/examples/jsm/controls/TransformControls";
|
|
39
39
|
import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
40
40
|
import { RenderPass as ms } from "three/examples/jsm/postprocessing/RenderPass";
|
|
41
|
-
import { SSAOPass as
|
|
41
|
+
import { SSAOPass as ps } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
42
42
|
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
43
|
-
import { OutputPass as
|
|
44
|
-
import { ShaderPass as
|
|
45
|
-
import { UnrealBloomPass as
|
|
43
|
+
import { OutputPass as us } from "three/examples/jsm/postprocessing/OutputPass";
|
|
44
|
+
import { ShaderPass as fs } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
45
|
+
import { UnrealBloomPass as _s } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
46
46
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
47
47
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
48
48
|
import "d3-geo";
|
|
@@ -54,15 +54,15 @@ import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
|
54
54
|
import "three/examples/jsm/lines/LineMaterial";
|
|
55
55
|
import "three-bvh-csg";
|
|
56
56
|
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
-
import { DRACOLoader as
|
|
57
|
+
import { DRACOLoader as gs } from "three/examples/jsm/loaders/DRACOLoader";
|
|
58
58
|
import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
|
|
59
|
-
import { LottieLoader as
|
|
60
|
-
import { makePromiseCreator as
|
|
59
|
+
import { LottieLoader as vs } from "three/examples/jsm/loaders/LottieLoader";
|
|
60
|
+
import { makePromiseCreator as Cs, generateUUID as He } from "esus-lite";
|
|
61
61
|
const M = {
|
|
62
62
|
LEFT: 1,
|
|
63
63
|
RIGHT: 2,
|
|
64
64
|
MIDDLE: 4
|
|
65
|
-
},
|
|
65
|
+
}, d = Object.freeze({
|
|
66
66
|
NONE: 0,
|
|
67
67
|
ROTATE: 1,
|
|
68
68
|
TRUCK: 2,
|
|
@@ -84,7 +84,7 @@ const M = {
|
|
|
84
84
|
TOUCH_SCREEN_PAN: 131072,
|
|
85
85
|
TOUCH_DOLLY_SCREEN_PAN: 262144,
|
|
86
86
|
TOUCH_ZOOM_SCREEN_PAN: 524288
|
|
87
|
-
}),
|
|
87
|
+
}), K = {
|
|
88
88
|
NONE: 0,
|
|
89
89
|
IN: 1,
|
|
90
90
|
OUT: -1
|
|
@@ -92,20 +92,20 @@ const M = {
|
|
|
92
92
|
function Y(h) {
|
|
93
93
|
return h.isPerspectiveCamera;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function j(h) {
|
|
96
96
|
return h.isOrthographicCamera;
|
|
97
97
|
}
|
|
98
|
-
const
|
|
98
|
+
const G = Math.PI * 2, Ie = Math.PI / 2, ft = 1e-5, ie = Math.PI / 180;
|
|
99
99
|
function k(h, e, t) {
|
|
100
100
|
return Math.max(e, Math.min(t, h));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function S(h, e = ft) {
|
|
103
103
|
return Math.abs(h) < e;
|
|
104
104
|
}
|
|
105
105
|
function P(h, e, t = ft) {
|
|
106
|
-
return
|
|
106
|
+
return S(h - e, t);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function je(h, e) {
|
|
109
109
|
return Math.round(h / e) * e;
|
|
110
110
|
}
|
|
111
111
|
function re(h) {
|
|
@@ -116,29 +116,29 @@ function oe(h) {
|
|
|
116
116
|
}
|
|
117
117
|
function he(h, e, t, s, i = 1 / 0, r) {
|
|
118
118
|
s = Math.max(1e-4, s);
|
|
119
|
-
const o = 2 / s, n = o * r,
|
|
120
|
-
let
|
|
121
|
-
const
|
|
122
|
-
|
|
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 c = h - e;
|
|
121
|
+
const f = e, m = i * s;
|
|
122
|
+
c = k(c, -m, m), e = h - c;
|
|
123
|
+
const v = (t.value + o * c) * r;
|
|
124
|
+
t.value = (t.value - o * v) * a;
|
|
125
|
+
let p = e + (c + v) * a;
|
|
126
|
+
return f - h > 0 == p > f && (p = f, t.value = (p - f) / r), p;
|
|
127
127
|
}
|
|
128
128
|
function Be(h, e, t, s, i = 1 / 0, r, o) {
|
|
129
129
|
s = Math.max(1e-4, s);
|
|
130
|
-
const n = 2 / s,
|
|
131
|
-
let
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const E = (t.x + n *
|
|
139
|
-
t.x = (t.x - n * E) *
|
|
140
|
-
const V =
|
|
141
|
-
return V *
|
|
130
|
+
const n = 2 / s, a = n * r, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
131
|
+
let f = e.x, m = e.y, v = e.z, p = h.x - f, u = h.y - m, g = h.z - v;
|
|
132
|
+
const y = f, l = m, _ = v, O = i * s, C = O * O, w = p * p + u * u + g * g;
|
|
133
|
+
if (w > C) {
|
|
134
|
+
const ve = Math.sqrt(w);
|
|
135
|
+
p = p / ve * O, u = u / ve * O, g = g / ve * O;
|
|
136
|
+
}
|
|
137
|
+
f = h.x - p, m = h.y - u, v = h.z - g;
|
|
138
|
+
const E = (t.x + n * p) * r, b = (t.y + n * u) * r, R = (t.z + n * g) * r;
|
|
139
|
+
t.x = (t.x - n * E) * c, t.y = (t.y - n * b) * c, t.z = (t.z - n * R) * c, o.x = f + (p + E) * c, o.y = m + (u + b) * c, o.z = v + (g + R) * c;
|
|
140
|
+
const V = y - h.x, le = l - h.y, xt = _ - h.z, bt = o.x - y, Lt = o.y - l, Pt = o.z - _;
|
|
141
|
+
return V * bt + le * Lt + xt * Pt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
142
142
|
}
|
|
143
143
|
function Oe(h, e) {
|
|
144
144
|
e.set(0, 0), h.forEach((t) => {
|
|
@@ -146,9 +146,9 @@ function Oe(h, e) {
|
|
|
146
146
|
}), e.x /= h.length, e.y /= h.length;
|
|
147
147
|
}
|
|
148
148
|
function Ee(h, e) {
|
|
149
|
-
return
|
|
149
|
+
return j(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
150
150
|
}
|
|
151
|
-
class
|
|
151
|
+
class Os {
|
|
152
152
|
constructor() {
|
|
153
153
|
this._listeners = {};
|
|
154
154
|
}
|
|
@@ -212,18 +212,18 @@ class Es {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const ce = 1 / 8,
|
|
216
|
-
let T, Ve, de, Te, D,
|
|
217
|
-
class J extends
|
|
215
|
+
const ce = 1 / 8, Es = /Mac/.test(navigator.platform);
|
|
216
|
+
let T, Ve, de, Te, D, x, L, X, ne, F, N, Z, Ye, Ze, z, ae, $, We, we, Ke, xe, be, me;
|
|
217
|
+
class J extends Os {
|
|
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)), D = new T.Vector2(),
|
|
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(), we = new T.Sphere(), Ke = new T.Quaternion(), xe = new T.Quaternion(), be = new T.Matrix4(), me = new T.Raycaster();
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* list all ACTIONs
|
|
223
223
|
* @category Statics
|
|
224
224
|
*/
|
|
225
225
|
static get ACTION() {
|
|
226
|
-
return
|
|
226
|
+
return d;
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Creates a `CameraControls` instance.
|
|
@@ -244,47 +244,47 @@ class J extends Es {
|
|
|
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 =
|
|
248
|
-
let
|
|
247
|
+
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, _, O, C) => {
|
|
248
|
+
let w, E;
|
|
249
249
|
if (Y(this._camera)) {
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
} else if (
|
|
253
|
-
const
|
|
254
|
-
|
|
250
|
+
const b = x.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = b.length() * Math.tan(R * 0.5);
|
|
251
|
+
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * _ * V / this._elementRect.height;
|
|
252
|
+
} else if (j(this._camera)) {
|
|
253
|
+
const b = this._camera;
|
|
254
|
+
w = this.truckSpeed * l * (b.right - b.left) / b.zoom / this._elementRect.width, E = this.truckSpeed * _ * (b.top - b.bottom) / b.zoom / this._elementRect.height;
|
|
255
255
|
} else
|
|
256
256
|
return;
|
|
257
|
-
|
|
258
|
-
this._focalOffsetEnd.x +
|
|
257
|
+
C ? (O ? this.setFocalOffset(
|
|
258
|
+
this._focalOffsetEnd.x + w,
|
|
259
259
|
this._focalOffsetEnd.y,
|
|
260
260
|
this._focalOffsetEnd.z,
|
|
261
261
|
!0
|
|
262
|
-
) : this.truck(
|
|
263
|
-
this._focalOffsetEnd.x +
|
|
262
|
+
) : this.truck(w, 0, !0), this.forward(-E, !0)) : O ? this.setFocalOffset(
|
|
263
|
+
this._focalOffsetEnd.x + w,
|
|
264
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
|
|
267
|
+
) : this.truck(w, E, !0);
|
|
268
|
+
}, this._rotateInternal = (l, _) => {
|
|
269
|
+
const O = G * this.azimuthRotateSpeed * l / this._elementRect.height, C = G * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
270
|
+
this.rotate(O, C, !0);
|
|
271
|
+
}, this._dollyInternal = (l, _, O) => {
|
|
272
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, b = k(
|
|
273
273
|
E,
|
|
274
274
|
this.minDistance,
|
|
275
275
|
this.maxDistance
|
|
276
|
-
), R =
|
|
277
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(
|
|
278
|
-
}, this._zoomInternal = (
|
|
279
|
-
const
|
|
280
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E -
|
|
276
|
+
), R = b - E;
|
|
277
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(b, !0)) : this._dollyToNoClamp(b, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : b) - w, this._dollyControlCoord.set(_, O)), this._lastDollyDirection = Math.sign(-l);
|
|
278
|
+
}, this._zoomInternal = (l, _, O) => {
|
|
279
|
+
const C = Math.pow(0.95, l * this.dollySpeed), w = this._zoom, E = this._zoom * C;
|
|
280
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(_, O));
|
|
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(
|
|
284
284
|
this._camera.up,
|
|
285
285
|
de
|
|
286
|
-
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state =
|
|
287
|
-
|
|
286
|
+
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
287
|
+
x.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
288
288
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
289
289
|
new T.Vector3(),
|
|
290
290
|
new T.Vector3(),
|
|
@@ -294,54 +294,54 @@ class J extends Es {
|
|
|
294
294
|
new T.Vector3(-1 / 0, -1 / 0, -1 / 0),
|
|
295
295
|
new T.Vector3(1 / 0, 1 / 0, 1 / 0)
|
|
296
296
|
), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new T.Vector2(), this.mouseButtons = {
|
|
297
|
-
left:
|
|
298
|
-
middle:
|
|
299
|
-
right:
|
|
300
|
-
wheel: Y(this._camera) ?
|
|
297
|
+
left: d.ROTATE,
|
|
298
|
+
middle: d.DOLLY,
|
|
299
|
+
right: d.TRUCK,
|
|
300
|
+
wheel: Y(this._camera) ? d.DOLLY : j(this._camera) ? d.ZOOM : d.NONE
|
|
301
301
|
}, this.touches = {
|
|
302
|
-
one:
|
|
303
|
-
two: Y(this._camera) ?
|
|
304
|
-
three:
|
|
302
|
+
one: d.TOUCH_ROTATE,
|
|
303
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : j(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
304
|
+
three: d.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 C = this._domElement.getBoundingClientRect(), w = (l.clientX - C.left) / (C.right - C.left), E = (l.clientY - C.top) / (C.bottom - C.top);
|
|
310
|
+
if (w < this._interactiveArea.left || w > 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 _ = 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 (_ !== null) {
|
|
315
|
+
const C = this._findPointerByMouseButton(_);
|
|
316
|
+
C && this._disposePointer(C);
|
|
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 O = {
|
|
321
|
+
pointerId: l.pointerId,
|
|
322
|
+
clientX: l.clientX,
|
|
323
|
+
clientY: l.clientY,
|
|
324
324
|
deltaX: 0,
|
|
325
325
|
deltaY: 0,
|
|
326
|
-
mouseButton:
|
|
326
|
+
mouseButton: _
|
|
327
327
|
};
|
|
328
|
-
this._activePointers.push(
|
|
328
|
+
this._activePointers.push(O), 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
|
-
}, n = (
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
344
|
-
if (
|
|
339
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, v(l);
|
|
340
|
+
}, n = (l) => {
|
|
341
|
+
l.cancelable && l.preventDefault();
|
|
342
|
+
const _ = l.pointerId, O = this._lockedPointer || this._findPointerById(_);
|
|
343
|
+
if (O) {
|
|
344
|
+
if (O.clientX = l.clientX, O.clientY = l.clientY, O.deltaX = l.movementX, O.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,16 +354,16 @@ class J extends Es {
|
|
|
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
|
+
p();
|
|
359
359
|
}
|
|
360
|
-
},
|
|
361
|
-
const
|
|
362
|
-
if (!(
|
|
363
|
-
if (
|
|
360
|
+
}, a = (l) => {
|
|
361
|
+
const _ = this._findPointerById(l.pointerId);
|
|
362
|
+
if (!(_ && _ === this._lockedPointer)) {
|
|
363
|
+
if (_ && this._disposePointer(_), l.pointerType === "touch")
|
|
364
364
|
switch (this._activePointers.length) {
|
|
365
365
|
case 0:
|
|
366
|
-
this._state =
|
|
366
|
+
this._state = d.NONE;
|
|
367
367
|
break;
|
|
368
368
|
case 1:
|
|
369
369
|
this._state = this.touches.one;
|
|
@@ -376,77 +376,77 @@ class J extends Es {
|
|
|
376
376
|
break;
|
|
377
377
|
}
|
|
378
378
|
else
|
|
379
|
-
this._state =
|
|
380
|
-
|
|
379
|
+
this._state = d.NONE;
|
|
380
|
+
u();
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
|
-
let
|
|
384
|
-
const
|
|
385
|
-
if (!this._domElement || !this._enabled || this.mouseButtons.wheel ===
|
|
383
|
+
let c = -1;
|
|
384
|
+
const f = (l) => {
|
|
385
|
+
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
386
386
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
387
|
-
const E = this._domElement.getBoundingClientRect(),
|
|
388
|
-
if (
|
|
387
|
+
const E = this._domElement.getBoundingClientRect(), b = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
388
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
|
-
if (
|
|
391
|
+
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
|
|
392
392
|
const E = performance.now();
|
|
393
|
-
|
|
393
|
+
c - E < 1e3 && this._getClientRect(this._elementRect), c = E;
|
|
394
394
|
}
|
|
395
|
-
const
|
|
395
|
+
const _ = Es ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
396
396
|
switch (this.mouseButtons.wheel) {
|
|
397
|
-
case
|
|
398
|
-
this._rotateInternal(
|
|
397
|
+
case d.ROTATE: {
|
|
398
|
+
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
399
399
|
break;
|
|
400
400
|
}
|
|
401
|
-
case
|
|
402
|
-
this._truckInternal(
|
|
401
|
+
case d.TRUCK: {
|
|
402
|
+
this._truckInternal(l.deltaX, l.deltaY, !1, !1), this._isUserControllingTruck = !0;
|
|
403
403
|
break;
|
|
404
404
|
}
|
|
405
|
-
case
|
|
406
|
-
this._truckInternal(
|
|
405
|
+
case d.SCREEN_PAN: {
|
|
406
|
+
this._truckInternal(l.deltaX, l.deltaY, !1, !0), this._isUserControllingTruck = !0;
|
|
407
407
|
break;
|
|
408
408
|
}
|
|
409
|
-
case
|
|
410
|
-
this._truckInternal(
|
|
409
|
+
case d.OFFSET: {
|
|
410
|
+
this._truckInternal(l.deltaX, l.deltaY, !0, !1), this._isUserControllingOffset = !0;
|
|
411
411
|
break;
|
|
412
412
|
}
|
|
413
|
-
case
|
|
414
|
-
this._dollyInternal(-
|
|
413
|
+
case d.DOLLY: {
|
|
414
|
+
this._dollyInternal(-O, C, w), this._isUserControllingDolly = !0;
|
|
415
415
|
break;
|
|
416
416
|
}
|
|
417
|
-
case
|
|
418
|
-
this._zoomInternal(-
|
|
417
|
+
case d.ZOOM: {
|
|
418
|
+
this._zoomInternal(-O, C, w), this._isUserControllingZoom = !0;
|
|
419
419
|
break;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
this.dispatchEvent({ type: "control" });
|
|
423
|
-
},
|
|
423
|
+
}, m = (l) => {
|
|
424
424
|
if (!(!this._domElement || !this._enabled)) {
|
|
425
425
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
426
|
-
const
|
|
427
|
-
|
|
426
|
+
const _ = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(_);
|
|
427
|
+
O && this._disposePointer(O), 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
|
+
}, v = (l) => {
|
|
440
440
|
if (!this._enabled) return;
|
|
441
441
|
if (Oe(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
442
|
-
const
|
|
443
|
-
r.set(0,
|
|
444
|
-
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
445
|
-
i.set(E,
|
|
442
|
+
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
|
|
443
|
+
r.set(0, w);
|
|
444
|
+
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, b = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
445
|
+
i.set(E, b);
|
|
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 Es {
|
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
461
461
|
else
|
|
462
|
-
!this._lockedPointer && (
|
|
463
|
-
((this._state &
|
|
464
|
-
},
|
|
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
|
+
((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & d.TRUCK) === d.TRUCK || (this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & d.DOLLY) === d.DOLLY || (this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & d.ZOOM) === d.ZOOM || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
464
|
+
}, p = () => {
|
|
465
465
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
466
466
|
this._dragNeedsUpdate = !1, Oe(this._activePointers, D);
|
|
467
|
-
const
|
|
468
|
-
if (i.copy(D), ((this._state &
|
|
469
|
-
const
|
|
470
|
-
(this._state &
|
|
471
|
-
|
|
472
|
-
|
|
467
|
+
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = _ ? -_.deltaX : i.x - D.x, C = _ ? -_.deltaY : i.y - D.y;
|
|
468
|
+
if (i.copy(D), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
469
|
+
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, b = this.dollyDragInverted ? -1 : 1;
|
|
470
|
+
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
471
|
+
b * C * ce,
|
|
472
|
+
w,
|
|
473
473
|
E
|
|
474
474
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
b * C * ce,
|
|
476
|
+
w,
|
|
477
477
|
E
|
|
478
478
|
), this._isUserControllingZoom = !0);
|
|
479
479
|
}
|
|
480
|
-
if ((this._state &
|
|
481
|
-
const
|
|
482
|
-
r.set(0,
|
|
480
|
+
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
481
|
+
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, b = Math.sqrt(w * w + E * E), R = r.y - b;
|
|
482
|
+
r.set(0, b);
|
|
483
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 &
|
|
484
|
+
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * ce, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * ce, V, le), this._isUserControllingZoom = !0);
|
|
485
485
|
}
|
|
486
|
-
((this._state &
|
|
487
|
-
},
|
|
486
|
+
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
487
|
+
}, u = () => {
|
|
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 = () => {
|
|
@@ -508,56 +508,56 @@ class J extends Es {
|
|
|
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
|
+
g
|
|
515
515
|
), this._domElement.ownerDocument.addEventListener(
|
|
516
516
|
"pointerlockerror",
|
|
517
|
-
|
|
517
|
+
y
|
|
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), v());
|
|
523
523
|
}, this.unlockPointer = () => {
|
|
524
|
-
var
|
|
525
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (
|
|
524
|
+
var l, _, O;
|
|
525
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
|
|
526
526
|
"pointerlockchange",
|
|
527
|
-
|
|
528
|
-
), (
|
|
527
|
+
g
|
|
528
|
+
), (O = this._domElement) === null || O === void 0 || O.ownerDocument.removeEventListener(
|
|
529
529
|
"pointerlockerror",
|
|
530
|
-
|
|
530
|
+
y
|
|
531
531
|
), this.cancel();
|
|
532
532
|
};
|
|
533
|
-
const
|
|
533
|
+
const g = () => {
|
|
534
534
|
this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
|
|
535
|
-
},
|
|
535
|
+
}, y = () => {
|
|
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", f, {
|
|
540
540
|
passive: !1
|
|
541
|
-
}), this._domElement.addEventListener("contextmenu",
|
|
541
|
+
}), this._domElement.addEventListener("contextmenu", m);
|
|
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", f, {
|
|
544
544
|
passive: !1
|
|
545
|
-
}), this._domElement.removeEventListener("contextmenu",
|
|
545
|
+
}), this._domElement.removeEventListener("contextmenu", m), 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
|
+
g
|
|
555
555
|
), this._domElement.ownerDocument.removeEventListener(
|
|
556
556
|
"pointerlockerror",
|
|
557
|
-
|
|
557
|
+
y
|
|
558
558
|
));
|
|
559
559
|
}, this.cancel = () => {
|
|
560
|
-
this._state !==
|
|
560
|
+
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
|
|
561
561
|
}, t && this.connect(t), this.update(0);
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
@@ -822,7 +822,7 @@ class J extends Es {
|
|
|
822
822
|
* @category Methods
|
|
823
823
|
*/
|
|
824
824
|
dollyTo(e, t = !1) {
|
|
825
|
-
return this._isUserControllingDolly = !1, this._lastDollyDirection =
|
|
825
|
+
return this._isUserControllingDolly = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0, this._dollyToNoClamp(
|
|
826
826
|
k(e, this.minDistance, this.maxDistance),
|
|
827
827
|
t
|
|
828
828
|
);
|
|
@@ -901,7 +901,7 @@ class J extends Es {
|
|
|
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 =
|
|
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
|
/**
|
|
@@ -911,8 +911,8 @@ class J extends Es {
|
|
|
911
911
|
* @category Methods
|
|
912
912
|
*/
|
|
913
913
|
forward(e, t = !1) {
|
|
914
|
-
|
|
915
|
-
const s = L.copy(this._targetEnd).add(
|
|
914
|
+
x.setFromMatrixColumn(this._camera.matrix, 0), x.crossVectors(this._camera.up, x), x.multiplyScalar(e);
|
|
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
|
/**
|
|
@@ -922,10 +922,10 @@ class J extends Es {
|
|
|
922
922
|
* @category Methods
|
|
923
923
|
*/
|
|
924
924
|
elevate(e, t = !1) {
|
|
925
|
-
return
|
|
926
|
-
this._targetEnd.x +
|
|
927
|
-
this._targetEnd.y +
|
|
928
|
-
this._targetEnd.z +
|
|
925
|
+
return x.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
926
|
+
this._targetEnd.x + x.x,
|
|
927
|
+
this._targetEnd.y + x.y,
|
|
928
|
+
this._targetEnd.z + x.z,
|
|
929
929
|
t
|
|
930
930
|
);
|
|
931
931
|
}
|
|
@@ -939,7 +939,7 @@ class J extends Es {
|
|
|
939
939
|
*/
|
|
940
940
|
moveTo(e, t, s, i = !1) {
|
|
941
941
|
this._isUserControllingTruck = !1;
|
|
942
|
-
const r =
|
|
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
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);
|
|
@@ -954,7 +954,7 @@ class J extends Es {
|
|
|
954
954
|
* @category Methods
|
|
955
955
|
*/
|
|
956
956
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
957
|
-
const n =
|
|
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
959
|
n.x,
|
|
960
960
|
n.y,
|
|
@@ -982,34 +982,34 @@ class J extends Es {
|
|
|
982
982
|
paddingBottom: o = 0,
|
|
983
983
|
paddingTop: n = 0
|
|
984
984
|
} = {}) {
|
|
985
|
-
const
|
|
986
|
-
|
|
985
|
+
const a = [], c = e.isBox3 ? $.copy(e) : $.setFromObject(e);
|
|
986
|
+
c.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
|
-
|
|
993
|
-
const
|
|
994
|
-
L.copy(
|
|
995
|
-
const
|
|
989
|
+
const f = je(this._sphericalEnd.theta, Ie), m = je(this._sphericalEnd.phi, Ie);
|
|
990
|
+
a.push(this.rotateTo(f, m, t));
|
|
991
|
+
const v = x.setFromSpherical(this._sphericalEnd).normalize(), p = Ke.setFromUnitVectors(v, Te), u = P(Math.abs(v.y), 1);
|
|
992
|
+
u && p.multiply(xe.setFromAxisAngle(de, f)), p.multiply(this._yAxisUpSpaceInverse);
|
|
993
|
+
const g = We.makeEmpty();
|
|
994
|
+
L.copy(c.min).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).applyQuaternion(p), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, p.setFromUnitVectors(Te, v), u && p.premultiply(xe.invert()), p.premultiply(this._yAxisUpSpace);
|
|
995
|
+
const y = g.getSize(x), l = g.getCenter(L).applyQuaternion(p);
|
|
996
996
|
if (Y(this._camera)) {
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
997
|
+
const _ = this.getDistanceToFitBox(
|
|
998
|
+
y.x,
|
|
999
|
+
y.y,
|
|
1000
|
+
y.z,
|
|
1001
1001
|
s
|
|
1002
1002
|
);
|
|
1003
|
-
|
|
1004
|
-
this.moveTo(
|
|
1005
|
-
),
|
|
1006
|
-
} else if (
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
this.moveTo(
|
|
1010
|
-
),
|
|
1003
|
+
a.push(
|
|
1004
|
+
this.moveTo(l.x, l.y, l.z, t)
|
|
1005
|
+
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1006
|
+
} else if (j(this._camera)) {
|
|
1007
|
+
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1008
|
+
a.push(
|
|
1009
|
+
this.moveTo(l.x, l.y, l.z, t)
|
|
1010
|
+
), a.push(this.zoomTo(w, 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 Es {
|
|
|
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, we) : we.copy(e);
|
|
1022
1022
|
if (s.push(
|
|
1023
1023
|
this.moveTo(
|
|
1024
1024
|
r.center.x,
|
|
@@ -1029,9 +1029,9 @@ class J extends Es {
|
|
|
1029
1029
|
), Y(this._camera)) {
|
|
1030
1030
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1031
1031
|
s.push(this.dollyTo(o, t));
|
|
1032
|
-
} else if (
|
|
1033
|
-
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom,
|
|
1034
|
-
s.push(this.zoomTo(
|
|
1032
|
+
} else if (j(this._camera)) {
|
|
1033
|
+
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, c = Math.min(o / a, n / a);
|
|
1034
|
+
s.push(this.zoomTo(c, t));
|
|
1035
1035
|
}
|
|
1036
1036
|
return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
|
|
1037
1037
|
}
|
|
@@ -1047,12 +1047,12 @@ class J extends Es {
|
|
|
1047
1047
|
* @category Methods
|
|
1048
1048
|
*/
|
|
1049
1049
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1050
|
-
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection =
|
|
1051
|
-
const
|
|
1052
|
-
this._targetEnd.copy(
|
|
1053
|
-
|
|
1050
|
+
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1051
|
+
const a = L.set(i, r, o), c = x.set(e, t, s);
|
|
1052
|
+
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1053
|
+
c.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1054
1054
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1055
|
-
const
|
|
1055
|
+
const f = !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
|
|
@@ -1065,7 +1065,7 @@ class J extends Es {
|
|
|
1065
1065
|
this._sphericalEnd.radius,
|
|
1066
1066
|
this.restThreshold
|
|
1067
1067
|
);
|
|
1068
|
-
return this._createOnRestPromise(
|
|
1068
|
+
return this._createOnRestPromise(f);
|
|
1069
1069
|
}
|
|
1070
1070
|
/**
|
|
1071
1071
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -1085,23 +1085,23 @@ class J extends Es {
|
|
|
1085
1085
|
* @param enableTransition
|
|
1086
1086
|
* @category Methods
|
|
1087
1087
|
*/
|
|
1088
|
-
lerpLookAt(e, t, s, i, r, o, n,
|
|
1089
|
-
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection =
|
|
1090
|
-
const
|
|
1088
|
+
lerpLookAt(e, t, s, i, r, o, n, a, c, f, m, v, p, u = !1) {
|
|
1089
|
+
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1090
|
+
const g = x.set(i, r, o), y = L.set(e, t, s);
|
|
1091
1091
|
z.setFromVector3(
|
|
1092
|
-
|
|
1092
|
+
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1093
1093
|
);
|
|
1094
|
-
const
|
|
1094
|
+
const l = X.set(f, m, v), _ = L.set(n, a, c);
|
|
1095
1095
|
ae.setFromVector3(
|
|
1096
|
-
|
|
1097
|
-
), this._targetEnd.copy(
|
|
1098
|
-
const
|
|
1096
|
+
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1097
|
+
), this._targetEnd.copy(g.lerp(l, p));
|
|
1098
|
+
const O = ae.theta - z.theta, C = ae.phi - z.phi, w = ae.radius - z.radius;
|
|
1099
1099
|
this._sphericalEnd.set(
|
|
1100
|
-
z.radius +
|
|
1101
|
-
z.phi +
|
|
1102
|
-
z.theta +
|
|
1103
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1104
|
-
const E = !
|
|
1100
|
+
z.radius + w * p,
|
|
1101
|
+
z.phi + C * p,
|
|
1102
|
+
z.theta + O * p
|
|
1103
|
+
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1104
|
+
const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1105
1105
|
this._spherical.theta,
|
|
1106
1106
|
this._sphericalEnd.theta,
|
|
1107
1107
|
this.restThreshold
|
|
@@ -1146,7 +1146,7 @@ class J extends Es {
|
|
|
1146
1146
|
* @category Methods
|
|
1147
1147
|
*/
|
|
1148
1148
|
setTarget(e, t, s, i = !1) {
|
|
1149
|
-
const r = this.getPosition(
|
|
1149
|
+
const r = this.getPosition(x), o = this.setLookAt(
|
|
1150
1150
|
r.x,
|
|
1151
1151
|
r.y,
|
|
1152
1152
|
r.z,
|
|
@@ -1196,8 +1196,8 @@ class J extends Es {
|
|
|
1196
1196
|
*/
|
|
1197
1197
|
setOrbitPoint(e, t, s) {
|
|
1198
1198
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1199
|
-
const i =
|
|
1200
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1199
|
+
const i = x.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1200
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), x.copy(F).add(N).add(Z), x.z = x.z + r, this.dollyTo(r, !1), this.setFocalOffset(-x.x, x.y, -x.z, !1), this.moveTo(e, t, s, !1);
|
|
1201
1201
|
}
|
|
1202
1202
|
/**
|
|
1203
1203
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1296,7 +1296,7 @@ class J extends Es {
|
|
|
1296
1296
|
* @category Methods
|
|
1297
1297
|
*/
|
|
1298
1298
|
normalizeRotations() {
|
|
1299
|
-
this._sphericalEnd.theta = this._sphericalEnd.theta %
|
|
1299
|
+
this._sphericalEnd.theta = this._sphericalEnd.theta % G, this._sphericalEnd.theta < 0 && (this._sphericalEnd.theta += G), this._spherical.theta += G * Math.round((this._sphericalEnd.theta - this._spherical.theta) / G);
|
|
1300
1300
|
}
|
|
1301
1301
|
/**
|
|
1302
1302
|
* stop all transitions.
|
|
@@ -1312,7 +1312,7 @@ class J extends Es {
|
|
|
1312
1312
|
reset(e = !1) {
|
|
1313
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
|
-
const s = this.getPosition(
|
|
1315
|
+
const s = this.getPosition(x);
|
|
1316
1316
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1317
1317
|
}
|
|
1318
1318
|
const t = [
|
|
@@ -1356,9 +1356,9 @@ class J extends Es {
|
|
|
1356
1356
|
* @category Methods
|
|
1357
1357
|
*/
|
|
1358
1358
|
applyCameraUp() {
|
|
1359
|
-
const e =
|
|
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
|
-
const s = this.getPosition(
|
|
1361
|
+
const s = this.getPosition(x);
|
|
1362
1362
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1363
1363
|
}
|
|
1364
1364
|
/**
|
|
@@ -1373,127 +1373,127 @@ class J extends Es {
|
|
|
1373
1373
|
this._focalOffsetEnd,
|
|
1374
1374
|
this._focalOffset
|
|
1375
1375
|
), n = this._zoomEnd - this._zoom;
|
|
1376
|
-
if (
|
|
1376
|
+
if (S(t))
|
|
1377
1377
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1378
1378
|
else {
|
|
1379
|
-
const
|
|
1379
|
+
const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1380
1380
|
this._spherical.theta = he(
|
|
1381
1381
|
this._spherical.theta,
|
|
1382
1382
|
this._sphericalEnd.theta,
|
|
1383
1383
|
this._thetaVelocity,
|
|
1384
|
-
|
|
1384
|
+
m,
|
|
1385
1385
|
1 / 0,
|
|
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
|
-
const
|
|
1392
|
+
const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1393
1393
|
this._spherical.phi = he(
|
|
1394
1394
|
this._spherical.phi,
|
|
1395
1395
|
this._sphericalEnd.phi,
|
|
1396
1396
|
this._phiVelocity,
|
|
1397
|
-
|
|
1397
|
+
m,
|
|
1398
1398
|
1 / 0,
|
|
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
|
-
const
|
|
1405
|
+
const m = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
1406
1406
|
this._spherical.radius = he(
|
|
1407
1407
|
this._spherical.radius,
|
|
1408
1408
|
this._sphericalEnd.radius,
|
|
1409
1409
|
this._radiusVelocity,
|
|
1410
|
-
|
|
1410
|
+
m,
|
|
1411
1411
|
this.maxSpeed,
|
|
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
|
-
const
|
|
1418
|
+
const m = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1419
1419
|
Be(
|
|
1420
1420
|
this._target,
|
|
1421
1421
|
this._targetEnd,
|
|
1422
1422
|
this._targetVelocity,
|
|
1423
|
-
|
|
1423
|
+
m,
|
|
1424
1424
|
this.maxSpeed,
|
|
1425
1425
|
e,
|
|
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
|
-
const
|
|
1432
|
+
const m = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1433
1433
|
Be(
|
|
1434
1434
|
this._focalOffset,
|
|
1435
1435
|
this._focalOffsetEnd,
|
|
1436
1436
|
this._focalOffsetVelocity,
|
|
1437
|
-
|
|
1437
|
+
m,
|
|
1438
1438
|
this.maxSpeed,
|
|
1439
1439
|
e,
|
|
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
|
-
const
|
|
1446
|
+
const m = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
1447
1447
|
this._zoom = he(
|
|
1448
1448
|
this._zoom,
|
|
1449
1449
|
this._zoomEnd,
|
|
1450
1450
|
this._zoomVelocity,
|
|
1451
|
-
|
|
1451
|
+
m,
|
|
1452
1452
|
1 / 0,
|
|
1453
1453
|
e
|
|
1454
1454
|
);
|
|
1455
1455
|
}
|
|
1456
1456
|
if (this.dollyToCursor) {
|
|
1457
1457
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1462
|
-
this._dollyControlCoord.x *
|
|
1458
|
+
const m = this._spherical.radius - this._lastDistance, v = this._camera, p = this._getCameraDirection(ne), u = x.copy(p).cross(v.up).normalize();
|
|
1459
|
+
u.lengthSq() === 0 && (u.x = 1);
|
|
1460
|
+
const g = L.crossVectors(u, p), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - m - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = X.copy(this._targetEnd).add(
|
|
1461
|
+
u.multiplyScalar(
|
|
1462
|
+
this._dollyControlCoord.x * y * v.aspect
|
|
1463
1463
|
)
|
|
1464
1464
|
).add(
|
|
1465
|
-
|
|
1466
|
-
),
|
|
1467
|
-
if (this.infinityDolly && (
|
|
1468
|
-
this._sphericalEnd.radius -=
|
|
1469
|
-
const R = L.copy(
|
|
1470
|
-
|
|
1465
|
+
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1466
|
+
), C = x.copy(this._targetEnd).lerp(O, _), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1467
|
+
if (this.infinityDolly && (w || E)) {
|
|
1468
|
+
this._sphericalEnd.radius -= m, this._spherical.radius -= m;
|
|
1469
|
+
const R = L.copy(p).multiplyScalar(-m);
|
|
1470
|
+
C.add(R);
|
|
1471
1471
|
}
|
|
1472
|
-
this._boundary.clampPoint(
|
|
1473
|
-
const
|
|
1474
|
-
this._targetEnd.copy(
|
|
1475
|
-
} else if (
|
|
1476
|
-
const
|
|
1472
|
+
this._boundary.clampPoint(C, C);
|
|
1473
|
+
const b = L.subVectors(C, this._targetEnd);
|
|
1474
|
+
this._targetEnd.copy(C), this._target.add(b), this._changedDolly -= m, S(this._changedDolly) && (this._changedDolly = 0);
|
|
1475
|
+
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1476
|
+
const m = this._zoom - this._lastZoom, v = this._camera, p = x.set(
|
|
1477
1477
|
this._dollyControlCoord.x,
|
|
1478
1478
|
this._dollyControlCoord.y,
|
|
1479
|
-
(
|
|
1480
|
-
).unproject(
|
|
1481
|
-
|
|
1479
|
+
(v.near + v.far) / (v.near - v.far)
|
|
1480
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = X.copy(p).add(u.multiplyScalar(-p.dot(v.up))), l = -(this._zoom - m - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), O = this._targetEnd.dot(_), C = x.copy(this._targetEnd).lerp(g, l), w = C.dot(_), E = _.multiplyScalar(
|
|
1481
|
+
w - O
|
|
1482
1482
|
);
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1485
|
-
this._targetEnd.copy(
|
|
1483
|
+
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1484
|
+
const b = L.subVectors(C, this._targetEnd);
|
|
1485
|
+
this._targetEnd.copy(C), this._target.add(b), this._changedZoom -= m, 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 f = this._needsUpdate;
|
|
1496
|
+
return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (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" }))) : !f && 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 = f, this._needsUpdate = !1, f;
|
|
1497
1497
|
}
|
|
1498
1498
|
/**
|
|
1499
1499
|
* Get all state in JSON string
|
|
@@ -1516,7 +1516,7 @@ class J extends Es {
|
|
|
1516
1516
|
truckSpeed: this.truckSpeed,
|
|
1517
1517
|
dollyToCursor: this.dollyToCursor,
|
|
1518
1518
|
target: this._targetEnd.toArray(),
|
|
1519
|
-
position:
|
|
1519
|
+
position: x.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1520
1520
|
zoom: this._zoomEnd,
|
|
1521
1521
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1522
1522
|
target0: this._target0.toArray(),
|
|
@@ -1534,7 +1534,7 @@ class J extends Es {
|
|
|
1534
1534
|
fromJSON(e, t = !1) {
|
|
1535
1535
|
const s = JSON.parse(e);
|
|
1536
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],
|
|
1540
1540
|
s.focalOffset[1],
|
|
@@ -1591,23 +1591,23 @@ class J extends Es {
|
|
|
1591
1591
|
const i = t.lengthSq();
|
|
1592
1592
|
if (i === 0)
|
|
1593
1593
|
return e;
|
|
1594
|
-
const r = L.copy(t).add(e), n = this._boundary.clampPoint(r, X).sub(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
1600
|
return e.add(t).add(n);
|
|
1601
1601
|
{
|
|
1602
|
-
const
|
|
1603
|
-
return e.add(L.copy(t).multiplyScalar(
|
|
1602
|
+
const c = 1 + s * a / t.dot(n);
|
|
1603
|
+
return e.add(L.copy(t).multiplyScalar(c)).add(n.multiplyScalar(1 - s));
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
1606
|
_updateNearPlaneCorners() {
|
|
1607
1607
|
if (Y(this._camera)) {
|
|
1608
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
|
-
} else if (
|
|
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;
|
|
1612
1612
|
this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
|
|
1613
1613
|
}
|
|
@@ -1618,13 +1618,13 @@ class J extends Es {
|
|
|
1618
1618
|
if (!(this.colliderMeshes.length >= 1) || Ee(this._camera, "_collisionTest"))
|
|
1619
1619
|
return e;
|
|
1620
1620
|
const s = this._getTargetDirection(ne);
|
|
1621
|
-
|
|
1621
|
+
be.lookAt(Ve, s, this._camera.up);
|
|
1622
1622
|
for (let i = 0; i < 4; i++) {
|
|
1623
1623
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1624
|
-
r.applyMatrix4(
|
|
1624
|
+
r.applyMatrix4(be);
|
|
1625
1625
|
const o = X.addVectors(this._target, r);
|
|
1626
|
-
|
|
1627
|
-
const n =
|
|
1626
|
+
me.set(o, s), me.far = this._spherical.radius + 1;
|
|
1627
|
+
const n = me.intersectObjects(this.colliderMeshes);
|
|
1628
1628
|
n.length !== 0 && n[0].distance < e && (e = n[0].distance);
|
|
1629
1629
|
}
|
|
1630
1630
|
return e;
|
|
@@ -1700,15 +1700,15 @@ class J extends Es {
|
|
|
1700
1700
|
if (!o.isMesh) return;
|
|
1701
1701
|
const n = o;
|
|
1702
1702
|
if (!n.geometry) return;
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1706
|
-
for (let
|
|
1707
|
-
|
|
1703
|
+
const a = n.geometry.clone();
|
|
1704
|
+
a.applyMatrix4(n.matrixWorld);
|
|
1705
|
+
const f = a.attributes.position;
|
|
1706
|
+
for (let m = 0, v = f.count; m < v; m++)
|
|
1707
|
+
x.fromBufferAttribute(f, m), r = Math.max(r, i.distanceToSquared(x));
|
|
1708
1708
|
}), s.radius = Math.sqrt(r), s;
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
|
-
var
|
|
1711
|
+
var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ge = 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,27 +1716,27 @@ 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
|
|
1719
|
+
function Ts(h) {
|
|
1720
1720
|
console && console.warn && console.warn(h);
|
|
1721
1721
|
}
|
|
1722
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
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1728
|
+
Se.exports = A;
|
|
1729
|
+
Se.exports.once = Ls;
|
|
1730
|
+
A.EventEmitter = A;
|
|
1731
|
+
A.prototype._events = void 0;
|
|
1732
|
+
A.prototype._eventsCount = 0;
|
|
1733
|
+
A.prototype._maxListeners = void 0;
|
|
1734
1734
|
var Xe = 10;
|
|
1735
1735
|
function ge(h) {
|
|
1736
1736
|
if (typeof h != "function")
|
|
1737
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
1742
|
return Xe;
|
|
@@ -1747,21 +1747,21 @@ Object.defineProperty(S, "defaultMaxListeners", {
|
|
|
1747
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
|
-
|
|
1753
|
+
A.prototype.setMaxListeners = function(e) {
|
|
1754
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
1758
|
function gt(h) {
|
|
1759
|
-
return h._maxListeners === void 0 ?
|
|
1759
|
+
return h._maxListeners === void 0 ? A.defaultMaxListeners : h._maxListeners;
|
|
1760
1760
|
}
|
|
1761
|
-
|
|
1761
|
+
A.prototype.getMaxListeners = function() {
|
|
1762
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)
|
|
@@ -1775,17 +1775,17 @@ S.prototype.emit = function(e) {
|
|
|
1775
1775
|
var n = new Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
|
|
1776
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
|
+
Ge(a, this, t);
|
|
1783
1783
|
else
|
|
1784
|
-
for (var
|
|
1785
|
-
|
|
1784
|
+
for (var c = a.length, f = Et(a, c), s = 0; s < c; ++s)
|
|
1785
|
+
Ge(f[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
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",
|
|
@@ -1796,32 +1796,32 @@ function vt(h, e, t, s) {
|
|
|
1796
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
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,
|
|
1799
|
+
n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length, Ts(n);
|
|
1800
1800
|
}
|
|
1801
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 ws() {
|
|
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
|
|
1814
|
+
function vt(h, e, t) {
|
|
1815
1815
|
var s = { fired: !1, wrapFn: void 0, target: h, type: e, listener: t }, i = ws.bind(s);
|
|
1816
1816
|
return i.listener = t, s.wrapFn = i, i;
|
|
1817
1817
|
}
|
|
1818
|
-
|
|
1819
|
-
return ge(t), this.on(e,
|
|
1818
|
+
A.prototype.once = function(e, t) {
|
|
1819
|
+
return ge(t), this.on(e, vt(this, e, t)), this;
|
|
1820
1820
|
};
|
|
1821
|
-
|
|
1822
|
-
return ge(t), this.prependListener(e,
|
|
1821
|
+
A.prototype.prependOnceListener = function(e, t) {
|
|
1822
|
+
return ge(t), this.prependListener(e, vt(this, e, t)), this;
|
|
1823
1823
|
};
|
|
1824
|
-
|
|
1824
|
+
A.prototype.removeListener = function(e, t) {
|
|
1825
1825
|
var s, i, r, o, n;
|
|
1826
1826
|
if (ge(t), i = this._events, i === void 0)
|
|
1827
1827
|
return this;
|
|
@@ -1841,8 +1841,8 @@ S.prototype.removeListener = function(e, 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;
|
|
@@ -1866,18 +1866,18 @@ function Ct(h, e, t) {
|
|
|
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 ? bs(i) : Et(i, i.length);
|
|
1870
1870
|
}
|
|
1871
|
-
|
|
1871
|
+
A.prototype.listeners = function(e) {
|
|
1872
1872
|
return Ct(this, e, !0);
|
|
1873
1873
|
};
|
|
1874
|
-
|
|
1874
|
+
A.prototype.rawListeners = function(e) {
|
|
1875
1875
|
return Ct(this, e, !1);
|
|
1876
1876
|
};
|
|
1877
|
-
|
|
1877
|
+
A.listenerCount = function(h, e) {
|
|
1878
1878
|
return typeof h.listenerCount == "function" ? h.listenerCount(e) : Ot.call(h, e);
|
|
1879
1879
|
};
|
|
1880
|
-
|
|
1880
|
+
A.prototype.listenerCount = Ot;
|
|
1881
1881
|
function Ot(h) {
|
|
1882
1882
|
var e = this._events;
|
|
1883
1883
|
if (e !== void 0) {
|
|
@@ -1889,7 +1889,7 @@ function Ot(h) {
|
|
|
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
1895
|
function Et(h, e) {
|
|
@@ -1902,12 +1902,12 @@ function xs(h, e) {
|
|
|
1902
1902
|
h[e] = h[e + 1];
|
|
1903
1903
|
h.pop();
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1905
|
+
function bs(h) {
|
|
1906
1906
|
for (var e = new Array(h.length), t = 0; t < e.length; ++t)
|
|
1907
1907
|
e[t] = h[t].listener || h[t];
|
|
1908
1908
|
return e;
|
|
1909
1909
|
}
|
|
1910
|
-
function
|
|
1910
|
+
function Ls(h, e) {
|
|
1911
1911
|
return new Promise(function(t, s) {
|
|
1912
1912
|
function i(o) {
|
|
1913
1913
|
h.removeListener(e, r), s(o);
|
|
@@ -1915,10 +1915,10 @@ function Ps(h, e) {
|
|
|
1915
1915
|
function r() {
|
|
1916
1916
|
typeof h.removeListener == "function" && h.removeListener("error", i), t([].slice.call(arguments));
|
|
1917
1917
|
}
|
|
1918
|
-
Tt(h, e, r, { once: !0 }), e !== "error" &&
|
|
1918
|
+
Tt(h, e, r, { once: !0 }), e !== "error" && Ps(h, i, { once: !0 });
|
|
1919
1919
|
});
|
|
1920
1920
|
}
|
|
1921
|
-
function
|
|
1921
|
+
function Ps(h, e, t) {
|
|
1922
1922
|
typeof h.on == "function" && Tt(h, "error", e, t);
|
|
1923
1923
|
}
|
|
1924
1924
|
function Tt(h, e, t, s) {
|
|
@@ -1931,43 +1931,43 @@ function Tt(h, e, t, s) {
|
|
|
1931
1931
|
else
|
|
1932
1932
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof h);
|
|
1933
1933
|
}
|
|
1934
|
-
var
|
|
1934
|
+
var ye = Se.exports;
|
|
1935
1935
|
const As = {
|
|
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: os.sRGB,
|
|
1942
1942
|
logarithmicDepthBuffer: !1,
|
|
1943
1943
|
preserveDrawingBuffer: !1,
|
|
1944
1944
|
stencil: !1,
|
|
1945
1945
|
depth: !1
|
|
1946
1946
|
};
|
|
1947
|
-
class
|
|
1947
|
+
class Ss {
|
|
1948
1948
|
constructor(e) {
|
|
1949
1949
|
this.options = e;
|
|
1950
1950
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
1951
1951
|
alpha: r,
|
|
1952
1952
|
devicePixelRatio: o,
|
|
1953
1953
|
antialias: n,
|
|
1954
|
-
powerPreference:
|
|
1955
|
-
toneMappingExposure:
|
|
1956
|
-
outputColorSpace:
|
|
1957
|
-
logarithmicDepthBuffer:
|
|
1958
|
-
preserveDrawingBuffer:
|
|
1959
|
-
stencil:
|
|
1960
|
-
depth:
|
|
1961
|
-
} = i,
|
|
1954
|
+
powerPreference: a,
|
|
1955
|
+
toneMappingExposure: c,
|
|
1956
|
+
outputColorSpace: f,
|
|
1957
|
+
logarithmicDepthBuffer: m,
|
|
1958
|
+
preserveDrawingBuffer: v,
|
|
1959
|
+
stencil: p,
|
|
1960
|
+
depth: u
|
|
1961
|
+
} = i, g = new Ut({
|
|
1962
1962
|
alpha: r,
|
|
1963
1963
|
antialias: n,
|
|
1964
|
-
powerPreference:
|
|
1965
|
-
logarithmicDepthBuffer:
|
|
1966
|
-
preserveDrawingBuffer:
|
|
1967
|
-
stencil:
|
|
1968
|
-
depth:
|
|
1964
|
+
powerPreference: a,
|
|
1965
|
+
logarithmicDepthBuffer: m,
|
|
1966
|
+
preserveDrawingBuffer: v,
|
|
1967
|
+
stencil: p,
|
|
1968
|
+
depth: u
|
|
1969
1969
|
});
|
|
1970
|
-
|
|
1970
|
+
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = c, g.outputColorSpace = f, this.renderer = g;
|
|
1971
1971
|
}
|
|
1972
1972
|
setSize(e, t) {
|
|
1973
1973
|
this.renderer.setSize(e, t);
|
|
@@ -1979,35 +1979,26 @@ 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 = (
|
|
1982
|
+
var a, c;
|
|
1983
|
+
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (c = e.scissorTest) != null ? c : !1;
|
|
1984
1984
|
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
|
|
1985
1985
|
}
|
|
1986
|
-
setViewPadding(e = 0, t = 0, s = 0, i = 0) {
|
|
1987
|
-
const { width: r, height: o } = this.renderer.getSize(new B()), n = {
|
|
1988
|
-
x: i,
|
|
1989
|
-
y: s,
|
|
1990
|
-
width: r - i - t,
|
|
1991
|
-
height: o - e - s
|
|
1992
|
-
};
|
|
1993
|
-
this.setViewport(n);
|
|
1994
|
-
}
|
|
1995
1986
|
dispose() {
|
|
1996
1987
|
var e, t;
|
|
1997
1988
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
1998
1989
|
}
|
|
1999
1990
|
}
|
|
2000
|
-
const
|
|
1991
|
+
const Ms = {
|
|
2001
1992
|
antialias: !0,
|
|
2002
1993
|
devicePixelRatio: window.devicePixelRatio
|
|
2003
1994
|
};
|
|
2004
|
-
class
|
|
1995
|
+
class Rs {
|
|
2005
1996
|
constructor(e) {
|
|
2006
1997
|
this.options = e;
|
|
2007
|
-
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i,
|
|
1998
|
+
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
|
|
2008
1999
|
antialias: n
|
|
2009
2000
|
});
|
|
2010
|
-
|
|
2001
|
+
a.setSize(t, s), a.setPixelRatio(o), this.renderer = a;
|
|
2011
2002
|
}
|
|
2012
2003
|
setSize(e, t) {
|
|
2013
2004
|
this.renderer.setSize(e, t);
|
|
@@ -2020,7 +2011,7 @@ class Ds {
|
|
|
2020
2011
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
2021
2012
|
}
|
|
2022
2013
|
}
|
|
2023
|
-
let
|
|
2014
|
+
let Ds = class {
|
|
2024
2015
|
constructor() {
|
|
2025
2016
|
this.mask = 1;
|
|
2026
2017
|
}
|
|
@@ -2048,10 +2039,10 @@ let Us = class {
|
|
|
2048
2039
|
};
|
|
2049
2040
|
class ee {
|
|
2050
2041
|
constructor() {
|
|
2051
|
-
this.event = new
|
|
2042
|
+
this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
2052
2043
|
}
|
|
2053
2044
|
addController(e, t) {
|
|
2054
|
-
const s = new
|
|
2045
|
+
const s = new Ds();
|
|
2055
2046
|
return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
|
|
2056
2047
|
}
|
|
2057
2048
|
removePage(e, t) {
|
|
@@ -2079,22 +2070,22 @@ class ee {
|
|
|
2079
2070
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
2080
2071
|
}
|
|
2081
2072
|
}
|
|
2082
|
-
const
|
|
2073
|
+
const wt = {
|
|
2083
2074
|
fov: 45,
|
|
2084
2075
|
near: 1,
|
|
2085
2076
|
far: 1e3,
|
|
2086
2077
|
up: new I(0, 1, 0)
|
|
2087
2078
|
};
|
|
2088
|
-
class
|
|
2079
|
+
class Us extends ee {
|
|
2089
2080
|
constructor(e) {
|
|
2090
2081
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2091
2082
|
}
|
|
2092
2083
|
get camera() {
|
|
2093
2084
|
return this.controller;
|
|
2094
2085
|
}
|
|
2095
|
-
addPerspectiveCamera(e =
|
|
2096
|
-
const { fov: s, far: i, near: r, up: o, aspect: n } = e,
|
|
2097
|
-
return
|
|
2086
|
+
addPerspectiveCamera(e = wt, t) {
|
|
2087
|
+
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, c = new zt(s, a, r, i);
|
|
2088
|
+
return c.up = o, this.addController(c, t);
|
|
2098
2089
|
}
|
|
2099
2090
|
setPageActive(e) {
|
|
2100
2091
|
super.setPageActive(e, (t, s) => {
|
|
@@ -2160,15 +2151,15 @@ class zs extends ee {
|
|
|
2160
2151
|
s[7],
|
|
2161
2152
|
s[11],
|
|
2162
2153
|
s[15]
|
|
2163
|
-
), { width: n, height:
|
|
2164
|
-
(this.camera.fov !== t.fov || this.camera.aspect !==
|
|
2154
|
+
), { width: n, height: a } = this, c = n / a;
|
|
2155
|
+
(this.camera.fov !== t.fov || this.camera.aspect !== c || !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 = c, this.camera.updateProjectionMatrix());
|
|
2165
2156
|
}
|
|
2166
2157
|
}
|
|
2167
2158
|
}
|
|
2168
|
-
const
|
|
2159
|
+
const zs = {
|
|
2169
2160
|
background: null
|
|
2170
2161
|
};
|
|
2171
|
-
class
|
|
2162
|
+
class ks extends ee {
|
|
2172
2163
|
get scene() {
|
|
2173
2164
|
return this.controller;
|
|
2174
2165
|
}
|
|
@@ -2191,7 +2182,7 @@ class Fs extends ee {
|
|
|
2191
2182
|
});
|
|
2192
2183
|
}
|
|
2193
2184
|
}
|
|
2194
|
-
class
|
|
2185
|
+
class Fs {
|
|
2195
2186
|
constructor(e) {
|
|
2196
2187
|
this.helpers = {}, this.options = e;
|
|
2197
2188
|
}
|
|
@@ -2208,11 +2199,11 @@ class Ns {
|
|
|
2208
2199
|
else if (e.isDirectionalLight)
|
|
2209
2200
|
i = new Nt(e, 1);
|
|
2210
2201
|
else if (e.isSpotLight)
|
|
2211
|
-
i = new
|
|
2202
|
+
i = new Ht(e);
|
|
2212
2203
|
else if (e.isHemisphereLight)
|
|
2213
2204
|
i = new It(e, 10);
|
|
2214
2205
|
else if (e.isRectAreaLight)
|
|
2215
|
-
i = new
|
|
2206
|
+
i = new hs(e);
|
|
2216
2207
|
else {
|
|
2217
2208
|
const r = new at();
|
|
2218
2209
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
@@ -2226,7 +2217,7 @@ class Ns {
|
|
|
2226
2217
|
}
|
|
2227
2218
|
}
|
|
2228
2219
|
addViewHelper() {
|
|
2229
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2220
|
+
const { cameraController: e, container: t } = this.options, s = new cs(e.camera, t);
|
|
2230
2221
|
t.addEventListener("pointerdown", (i) => {
|
|
2231
2222
|
i.preventDefault(), s.handleClick(i);
|
|
2232
2223
|
}), this.viewHelper = s;
|
|
@@ -2258,8 +2249,8 @@ class Ns {
|
|
|
2258
2249
|
const { cameraController: i } = this.options;
|
|
2259
2250
|
Object.values(this.helpers).forEach((n) => {
|
|
2260
2251
|
if (n.update && n.update(), n instanceof Ue) {
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2252
|
+
const a = n.material, { object: c } = a.userData;
|
|
2253
|
+
c && n.box.setFromObject(c, !0);
|
|
2263
2254
|
}
|
|
2264
2255
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
2265
2256
|
...i.camera.position.toArray()
|
|
@@ -2276,7 +2267,7 @@ class Ns {
|
|
|
2276
2267
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2277
2268
|
}
|
|
2278
2269
|
}
|
|
2279
|
-
class
|
|
2270
|
+
class Ns extends ee {
|
|
2280
2271
|
constructor(e) {
|
|
2281
2272
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2282
2273
|
const t = {
|
|
@@ -2320,13 +2311,13 @@ class js extends ee {
|
|
|
2320
2311
|
});
|
|
2321
2312
|
}
|
|
2322
2313
|
update(e, t) {
|
|
2323
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2314
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * jt.DEG2RAD);
|
|
2324
2315
|
}
|
|
2325
2316
|
}
|
|
2326
|
-
class
|
|
2317
|
+
class Hs {
|
|
2327
2318
|
constructor(e) {
|
|
2328
|
-
this.event = new
|
|
2329
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
2319
|
+
this.event = new ye.EventEmitter();
|
|
2320
|
+
const { renderer: t, scene: s, camera: i } = e, r = new ds(
|
|
2330
2321
|
i,
|
|
2331
2322
|
t.domElement
|
|
2332
2323
|
);
|
|
@@ -2335,8 +2326,8 @@ class Is {
|
|
|
2335
2326
|
if (s.add(o), +Zt < 170) {
|
|
2336
2327
|
const n = r._root;
|
|
2337
2328
|
n.dispose = () => {
|
|
2338
|
-
n.traverse((
|
|
2339
|
-
|
|
2329
|
+
n.traverse((a) => {
|
|
2330
|
+
a.geometry && a.geometry.dispose(), a.material && a.material.dispose();
|
|
2340
2331
|
});
|
|
2341
2332
|
}, r.dispose = () => {
|
|
2342
2333
|
r.disconnect(), n.dispose();
|
|
@@ -2392,8 +2383,8 @@ class Is {
|
|
|
2392
2383
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
2393
2384
|
}
|
|
2394
2385
|
}
|
|
2395
|
-
const $e = new I(),
|
|
2396
|
-
class
|
|
2386
|
+
const $e = new I(), Is = new lt(), qe = new I(), H = new W(), js = new W();
|
|
2387
|
+
class Bs {
|
|
2397
2388
|
/**
|
|
2398
2389
|
* Constructs a new CSS3D renderer.
|
|
2399
2390
|
*
|
|
@@ -2405,69 +2396,69 @@ class Vs {
|
|
|
2405
2396
|
const n = {
|
|
2406
2397
|
camera: { style: "" },
|
|
2407
2398
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2408
|
-
},
|
|
2409
|
-
|
|
2410
|
-
const
|
|
2411
|
-
|
|
2412
|
-
const
|
|
2413
|
-
|
|
2399
|
+
}, a = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2400
|
+
a.style.overflow = "hidden", this.domElement = a;
|
|
2401
|
+
const c = document.createElement("div");
|
|
2402
|
+
c.style.transformOrigin = "0 0", c.style.pointerEvents = "none", a.appendChild(c);
|
|
2403
|
+
const f = document.createElement("div");
|
|
2404
|
+
f.style.transformStyle = "preserve-3d", c.appendChild(f), this.getSize = function() {
|
|
2414
2405
|
return {
|
|
2415
2406
|
width: s,
|
|
2416
2407
|
height: i
|
|
2417
2408
|
};
|
|
2418
|
-
}, this.render = function(
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2421
|
-
let
|
|
2422
|
-
|
|
2423
|
-
const
|
|
2424
|
-
n.camera.style !== R && (
|
|
2425
|
-
}, this.setSize = function(
|
|
2426
|
-
s =
|
|
2409
|
+
}, this.render = function(y, l) {
|
|
2410
|
+
const _ = l.projectionMatrix.elements[5] * o;
|
|
2411
|
+
l.view && l.view.enabled ? (c.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, c.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : c.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2412
|
+
let O, C;
|
|
2413
|
+
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2414
|
+
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + m(O) + "px," + m(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2415
|
+
n.camera.style !== R && (f.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2416
|
+
}, this.setSize = function(y, l) {
|
|
2417
|
+
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", c.style.width = y + "px", c.style.height = l + "px", f.style.width = y + "px", f.style.height = l + "px";
|
|
2427
2418
|
};
|
|
2428
|
-
function
|
|
2429
|
-
return Math.abs(
|
|
2419
|
+
function m(y) {
|
|
2420
|
+
return Math.abs(y) < 1e-10 ? 0 : y;
|
|
2430
2421
|
}
|
|
2431
|
-
function
|
|
2432
|
-
const
|
|
2433
|
-
return "matrix3d(" +
|
|
2422
|
+
function v(y) {
|
|
2423
|
+
const l = y.elements;
|
|
2424
|
+
return "matrix3d(" + m(l[0]) + "," + m(-l[1]) + "," + m(l[2]) + "," + m(l[3]) + "," + m(l[4]) + "," + m(-l[5]) + "," + m(l[6]) + "," + m(l[7]) + "," + m(l[8]) + "," + m(-l[9]) + "," + m(l[10]) + "," + m(l[11]) + "," + m(l[12]) + "," + m(-l[13]) + "," + m(l[14]) + "," + m(l[15]) + ")";
|
|
2434
2425
|
}
|
|
2435
|
-
function
|
|
2436
|
-
const
|
|
2437
|
-
return "translate(-50%,-50%)" + ("matrix3d(" +
|
|
2426
|
+
function p(y) {
|
|
2427
|
+
const l = y.elements;
|
|
2428
|
+
return "translate(-50%,-50%)" + ("matrix3d(" + m(l[0]) + "," + m(l[1]) + "," + m(l[2]) + "," + m(l[3]) + "," + m(-l[4]) + "," + m(-l[5]) + "," + m(-l[6]) + "," + m(-l[7]) + "," + m(l[8]) + "," + m(l[9]) + "," + m(l[10]) + "," + m(l[11]) + "," + m(l[12]) + "," + m(l[13]) + "," + m(l[14]) + "," + m(l[15]) + ")");
|
|
2438
2429
|
}
|
|
2439
|
-
function
|
|
2440
|
-
|
|
2441
|
-
for (let
|
|
2442
|
-
|
|
2430
|
+
function u(y) {
|
|
2431
|
+
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2432
|
+
for (let l = 0, _ = y.children.length; l < _; l++)
|
|
2433
|
+
u(y.children[l]);
|
|
2443
2434
|
}
|
|
2444
|
-
function
|
|
2445
|
-
if (
|
|
2446
|
-
|
|
2435
|
+
function g(y, l, _, O) {
|
|
2436
|
+
if (y.visible === !1) {
|
|
2437
|
+
u(y);
|
|
2447
2438
|
return;
|
|
2448
2439
|
}
|
|
2449
|
-
if (
|
|
2450
|
-
const
|
|
2451
|
-
if (
|
|
2452
|
-
|
|
2440
|
+
if (y.isCSS3DObject) {
|
|
2441
|
+
const C = y.layers.test(_.layers) === !0, w = y.element;
|
|
2442
|
+
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2443
|
+
y.onBeforeRender(t, l, _);
|
|
2453
2444
|
let E;
|
|
2454
|
-
|
|
2455
|
-
const
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
2445
|
+
y.isCSS3DSprite ? (H.copy(_.matrixWorldInverse), H.transpose(), y.rotation2D !== 0 && H.multiply(js.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose($e, Is, qe), H.setPosition($e), H.scale(qe), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, E = p(H)) : E = p(y.matrixWorld);
|
|
2446
|
+
const b = n.objects.get(y);
|
|
2447
|
+
if (b === void 0 || b.style !== E) {
|
|
2448
|
+
w.style.transform = E;
|
|
2458
2449
|
const R = { style: E };
|
|
2459
|
-
n.objects.set(
|
|
2450
|
+
n.objects.set(y, R);
|
|
2460
2451
|
}
|
|
2461
|
-
|
|
2452
|
+
w.parentNode !== f && f.appendChild(w), y.onAfterRender(t, l, _);
|
|
2462
2453
|
}
|
|
2463
2454
|
}
|
|
2464
|
-
for (let
|
|
2465
|
-
|
|
2455
|
+
for (let C = 0, w = y.children.length; C < w; C++)
|
|
2456
|
+
g(y.children[C], l, _);
|
|
2466
2457
|
}
|
|
2467
2458
|
}
|
|
2468
2459
|
}
|
|
2469
2460
|
const q = new I(), Qe = new W(), Je = new W(), et = new I(), tt = new I();
|
|
2470
|
-
class
|
|
2461
|
+
class Vs {
|
|
2471
2462
|
/**
|
|
2472
2463
|
* Constructs a new CSS2D renderer.
|
|
2473
2464
|
*
|
|
@@ -2478,69 +2469,69 @@ class Ys {
|
|
|
2478
2469
|
let s, i, r, o;
|
|
2479
2470
|
const n = {
|
|
2480
2471
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2481
|
-
},
|
|
2482
|
-
|
|
2472
|
+
}, a = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2473
|
+
a.style.overflow = "hidden", this.domElement = a, this.getSize = function() {
|
|
2483
2474
|
return {
|
|
2484
2475
|
width: s,
|
|
2485
2476
|
height: i
|
|
2486
2477
|
};
|
|
2487
|
-
}, this.render = function(
|
|
2488
|
-
|
|
2489
|
-
}, this.setSize = function(
|
|
2490
|
-
s =
|
|
2478
|
+
}, this.render = function(u, g) {
|
|
2479
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Qe.copy(g.matrixWorldInverse), Je.multiplyMatrices(g.projectionMatrix, Qe), f(u, u, g), p(u);
|
|
2480
|
+
}, this.setSize = function(u, g) {
|
|
2481
|
+
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2491
2482
|
};
|
|
2492
|
-
function
|
|
2493
|
-
|
|
2494
|
-
for (let
|
|
2495
|
-
|
|
2483
|
+
function c(u) {
|
|
2484
|
+
u.isCSS2DObject && (u.element.style.display = "none");
|
|
2485
|
+
for (let g = 0, y = u.children.length; g < y; g++)
|
|
2486
|
+
c(u.children[g]);
|
|
2496
2487
|
}
|
|
2497
|
-
function
|
|
2498
|
-
if (
|
|
2499
|
-
|
|
2488
|
+
function f(u, g, y) {
|
|
2489
|
+
if (u.visible === !1) {
|
|
2490
|
+
c(u);
|
|
2500
2491
|
return;
|
|
2501
2492
|
}
|
|
2502
|
-
if (
|
|
2503
|
-
q.setFromMatrixPosition(
|
|
2504
|
-
const
|
|
2505
|
-
|
|
2506
|
-
const
|
|
2507
|
-
distanceToCameraSquared:
|
|
2493
|
+
if (u.isCSS2DObject) {
|
|
2494
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Je);
|
|
2495
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, _ = u.element;
|
|
2496
|
+
_.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), _.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", _.parentNode !== a && a.appendChild(_), u.onAfterRender(t, g, y));
|
|
2497
|
+
const O = {
|
|
2498
|
+
distanceToCameraSquared: m(y, u)
|
|
2508
2499
|
};
|
|
2509
|
-
n.objects.set(
|
|
2500
|
+
n.objects.set(u, O);
|
|
2510
2501
|
}
|
|
2511
|
-
for (let
|
|
2512
|
-
|
|
2502
|
+
for (let l = 0, _ = u.children.length; l < _; l++)
|
|
2503
|
+
f(u.children[l], g, y);
|
|
2513
2504
|
}
|
|
2514
|
-
function
|
|
2515
|
-
return et.setFromMatrixPosition(
|
|
2505
|
+
function m(u, g) {
|
|
2506
|
+
return et.setFromMatrixPosition(u.matrixWorld), tt.setFromMatrixPosition(g.matrixWorld), et.distanceToSquared(tt);
|
|
2516
2507
|
}
|
|
2517
|
-
function
|
|
2518
|
-
const
|
|
2519
|
-
return
|
|
2520
|
-
|
|
2521
|
-
}),
|
|
2508
|
+
function v(u) {
|
|
2509
|
+
const g = [];
|
|
2510
|
+
return u.traverseVisible(function(y) {
|
|
2511
|
+
y.isCSS2DObject && g.push(y);
|
|
2512
|
+
}), g;
|
|
2522
2513
|
}
|
|
2523
|
-
function
|
|
2524
|
-
const
|
|
2525
|
-
if (
|
|
2526
|
-
return
|
|
2527
|
-
const
|
|
2528
|
-
return
|
|
2529
|
-
}),
|
|
2530
|
-
for (let
|
|
2531
|
-
|
|
2514
|
+
function p(u) {
|
|
2515
|
+
const g = v(u).sort(function(l, _) {
|
|
2516
|
+
if (l.renderOrder !== _.renderOrder)
|
|
2517
|
+
return _.renderOrder - l.renderOrder;
|
|
2518
|
+
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(_).distanceToCameraSquared;
|
|
2519
|
+
return O - C;
|
|
2520
|
+
}), y = g.length;
|
|
2521
|
+
for (let l = 0, _ = g.length; l < _; l++)
|
|
2522
|
+
g[l].element.style.zIndex = y - l;
|
|
2532
2523
|
}
|
|
2533
2524
|
}
|
|
2534
2525
|
}
|
|
2535
2526
|
const st = {
|
|
2536
2527
|
zIndex: "auto"
|
|
2537
2528
|
};
|
|
2538
|
-
class
|
|
2529
|
+
class Ys {
|
|
2539
2530
|
constructor(e) {
|
|
2540
2531
|
this.container = e;
|
|
2541
2532
|
}
|
|
2542
2533
|
addRenderer(e, t) {
|
|
2543
|
-
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new
|
|
2534
|
+
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new Vs() : new Bs();
|
|
2544
2535
|
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
2536
|
}
|
|
2546
2537
|
setSize(e, t) {
|
|
@@ -2556,7 +2547,7 @@ class Zs {
|
|
|
2556
2547
|
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
2557
2548
|
}
|
|
2558
2549
|
}
|
|
2559
|
-
const
|
|
2550
|
+
const Zs = {
|
|
2560
2551
|
name: "OutputShader",
|
|
2561
2552
|
uniforms: {
|
|
2562
2553
|
tDiffuse: { value: null },
|
|
@@ -2650,11 +2641,11 @@ const Ws = {
|
|
|
2650
2641
|
}`
|
|
2651
2642
|
)
|
|
2652
2643
|
};
|
|
2653
|
-
class
|
|
2644
|
+
class Ws extends us {
|
|
2654
2645
|
constructor() {
|
|
2655
2646
|
super();
|
|
2656
|
-
const e =
|
|
2657
|
-
this.uniforms =
|
|
2647
|
+
const e = Zs;
|
|
2648
|
+
this.uniforms = Kt.clone(e.uniforms), this.material = new Gt({
|
|
2658
2649
|
name: e.name,
|
|
2659
2650
|
uniforms: this.uniforms,
|
|
2660
2651
|
vertexShader: e.vertexShader,
|
|
@@ -2663,7 +2654,7 @@ class Gs extends fs {
|
|
|
2663
2654
|
}
|
|
2664
2655
|
}
|
|
2665
2656
|
const Ks = (h) => {
|
|
2666
|
-
const e = new
|
|
2657
|
+
const e = new fs(
|
|
2667
2658
|
new Xt({
|
|
2668
2659
|
uniforms: {
|
|
2669
2660
|
baseTexture: { value: null },
|
|
@@ -2698,36 +2689,36 @@ const Ks = (h) => {
|
|
|
2698
2689
|
"baseTexture"
|
|
2699
2690
|
);
|
|
2700
2691
|
return e.needsSwap = !0, e;
|
|
2701
|
-
}, Le = 1,
|
|
2692
|
+
}, Le = 1, pe = !1, Gs = new $t({ color: "black" }), Xs = new ct({
|
|
2702
2693
|
color: "black",
|
|
2703
2694
|
sizeAttenuation: !1
|
|
2704
|
-
}),
|
|
2695
|
+
}), $s = new ct({
|
|
2705
2696
|
color: "black",
|
|
2706
2697
|
sizeAttenuation: !0
|
|
2707
|
-
}),
|
|
2698
|
+
}), qs = new dt({
|
|
2708
2699
|
color: "black",
|
|
2709
2700
|
sizeAttenuation: !0
|
|
2710
|
-
}),
|
|
2701
|
+
}), Qs = new dt({
|
|
2711
2702
|
color: "black",
|
|
2712
2703
|
sizeAttenuation: !1
|
|
2713
|
-
}),
|
|
2704
|
+
}), Js = new ut({
|
|
2714
2705
|
color: "black",
|
|
2715
2706
|
sizeAttenuation: 0,
|
|
2716
2707
|
lineWidth: 0
|
|
2717
|
-
}),
|
|
2708
|
+
}), ei = {
|
|
2718
2709
|
kernelRadius: 8,
|
|
2719
2710
|
minDistance: 5e-3,
|
|
2720
2711
|
maxDistance: 0.1
|
|
2721
|
-
},
|
|
2712
|
+
}, ti = {
|
|
2722
2713
|
threshold: 0,
|
|
2723
2714
|
strength: 0.4,
|
|
2724
2715
|
radius: 0.1,
|
|
2725
2716
|
bloomAlphaType: 0
|
|
2726
|
-
},
|
|
2717
|
+
}, si = {
|
|
2727
2718
|
multisampling: 4,
|
|
2728
2719
|
premultiplieAlpha: !1
|
|
2729
2720
|
};
|
|
2730
|
-
class
|
|
2721
|
+
class ii {
|
|
2731
2722
|
constructor(e) {
|
|
2732
2723
|
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
2724
|
const {
|
|
@@ -2737,23 +2728,23 @@ class ri {
|
|
|
2737
2728
|
composerParams: r
|
|
2738
2729
|
} = e, { renderer: o } = t;
|
|
2739
2730
|
this.renderer = o;
|
|
2740
|
-
const { multisampling: n } = r, { maxSamples:
|
|
2741
|
-
|
|
2742
|
-
|
|
2731
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, c = o.getDrawingBufferSize(new B()), f = new Qt(
|
|
2732
|
+
c.width,
|
|
2733
|
+
c.height,
|
|
2743
2734
|
{
|
|
2744
|
-
samples: Math.min(n,
|
|
2735
|
+
samples: Math.min(n, a),
|
|
2745
2736
|
type: Jt
|
|
2746
2737
|
}
|
|
2747
|
-
),
|
|
2748
|
-
|
|
2749
|
-
const
|
|
2738
|
+
), m = new ke(o, f), v = this.getSize();
|
|
2739
|
+
m.setSize(v.width, v.height);
|
|
2740
|
+
const p = new ms(
|
|
2750
2741
|
s.scene,
|
|
2751
2742
|
i.camera
|
|
2752
2743
|
);
|
|
2753
|
-
|
|
2754
|
-
this.changeCamera(
|
|
2755
|
-
}), s.event.on("pageChange", (
|
|
2756
|
-
this.changeScene(
|
|
2744
|
+
m.addPass(p), this.scene = s.scene, this.camera = i.camera, this.finalComposer = m, this.renderPass = p, i.event.on("pageChange", (u) => {
|
|
2745
|
+
this.changeCamera(u);
|
|
2746
|
+
}), s.event.on("pageChange", (u) => {
|
|
2747
|
+
this.changeScene(u);
|
|
2757
2748
|
});
|
|
2758
2749
|
}
|
|
2759
2750
|
changeCamera(e) {
|
|
@@ -2763,28 +2754,28 @@ class ri {
|
|
|
2763
2754
|
this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
|
|
2764
2755
|
}
|
|
2765
2756
|
addOutputPass() {
|
|
2766
|
-
const { premultiplieAlpha: e } = this.options.composerParams, t = new
|
|
2757
|
+
const { premultiplieAlpha: e } = this.options.composerParams, t = new Ws();
|
|
2767
2758
|
this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
|
|
2768
2759
|
}
|
|
2769
2760
|
setPremultiplieAlpha(e) {
|
|
2770
2761
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2771
2762
|
}
|
|
2772
2763
|
addSSAOPass(e) {
|
|
2773
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height,
|
|
2774
|
-
|
|
2764
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new ps(t, s, o, n);
|
|
2765
|
+
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2775
2766
|
}
|
|
2776
2767
|
addBloomPass(e) {
|
|
2777
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new
|
|
2768
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new _s(
|
|
2778
2769
|
new B(window.innerWidth, window.innerHeight),
|
|
2779
2770
|
i,
|
|
2780
2771
|
r,
|
|
2781
2772
|
s
|
|
2782
2773
|
);
|
|
2783
2774
|
this.bloomPass = n;
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2775
|
+
const a = new ke(t);
|
|
2776
|
+
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2777
|
+
const c = Ks(a);
|
|
2778
|
+
c.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(c), this.mixPass = c, this.bloomLayer.set(Le);
|
|
2788
2779
|
}
|
|
2789
2780
|
setBloomSelection(e, t) {
|
|
2790
2781
|
if (!this.bloomComposer) {
|
|
@@ -2816,9 +2807,9 @@ class ri {
|
|
|
2816
2807
|
s.isTransformControls || s.isTransformControlsRoot || s.type === "RectAreaLightHelper" ? e.push(s) : t.push(s);
|
|
2817
2808
|
}), t.forEach((s) => {
|
|
2818
2809
|
s.traverse((i) => {
|
|
2819
|
-
var
|
|
2810
|
+
var a;
|
|
2820
2811
|
const r = i, o = i, n = i;
|
|
2821
|
-
(
|
|
2812
|
+
(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 = Qs : r.material instanceof ut ? r.material = Js : n.isPoints ? n.material.sizeAttenuation ? n.material = $s : n.material = Xs : r.material = Gs);
|
|
2822
2813
|
});
|
|
2823
2814
|
}), e.forEach((s) => {
|
|
2824
2815
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2862,7 +2853,7 @@ class ri {
|
|
|
2862
2853
|
this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomSelection.clear(), this.finalComposer.dispose(), (e = this.bloomComposer) == null || e.dispose();
|
|
2863
2854
|
}
|
|
2864
2855
|
}
|
|
2865
|
-
class it extends
|
|
2856
|
+
class it extends mt {
|
|
2866
2857
|
constructor(e) {
|
|
2867
2858
|
super(e), this.options = { type: "image" };
|
|
2868
2859
|
}
|
|
@@ -2871,44 +2862,44 @@ class it extends pt {
|
|
|
2871
2862
|
}
|
|
2872
2863
|
load(e, t, s, i) {
|
|
2873
2864
|
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 n = new
|
|
2865
|
+
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 pt(o)) : r = new fe();
|
|
2866
|
+
const n = new Ae(this.manager);
|
|
2876
2867
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
2877
2868
|
e,
|
|
2878
|
-
(
|
|
2879
|
-
let
|
|
2880
|
-
const
|
|
2881
|
-
|
|
2882
|
-
const
|
|
2883
|
-
o.removeEventListener("load",
|
|
2884
|
-
},
|
|
2885
|
-
|
|
2886
|
-
},
|
|
2887
|
-
|
|
2869
|
+
(a) => {
|
|
2870
|
+
let c = a;
|
|
2871
|
+
const f = e.split(".").pop(), m = this.options.type === "image" ? `image/${f || "png"}` : `video/${f || "mp4"}`;
|
|
2872
|
+
c = c.slice(0, a.size, m);
|
|
2873
|
+
const v = () => {
|
|
2874
|
+
o.removeEventListener("load", p, !1), o.removeEventListener("error", u, !1);
|
|
2875
|
+
}, p = () => {
|
|
2876
|
+
v(), r.needsUpdate = !0, t && t(r);
|
|
2877
|
+
}, u = (y) => {
|
|
2878
|
+
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
2888
2879
|
};
|
|
2889
|
-
o.addEventListener("load",
|
|
2890
|
-
const
|
|
2891
|
-
o.src =
|
|
2880
|
+
o.addEventListener("load", p, !1), o.addEventListener("error", u, !1);
|
|
2881
|
+
const g = window.URL.createObjectURL(c);
|
|
2882
|
+
o.src = g;
|
|
2892
2883
|
},
|
|
2893
2884
|
s,
|
|
2894
2885
|
i
|
|
2895
2886
|
), r;
|
|
2896
2887
|
}
|
|
2897
2888
|
}
|
|
2898
|
-
class
|
|
2889
|
+
class ri extends mt {
|
|
2899
2890
|
constructor(e) {
|
|
2900
2891
|
super(e);
|
|
2901
2892
|
}
|
|
2902
2893
|
load(e, t, s, i) {
|
|
2903
|
-
const r = new
|
|
2894
|
+
const r = new Ae(this.manager);
|
|
2904
2895
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
2905
2896
|
e,
|
|
2906
2897
|
(o) => {
|
|
2907
|
-
const n = o,
|
|
2908
|
-
new Response(
|
|
2909
|
-
t == null || t(
|
|
2910
|
-
}).catch((
|
|
2911
|
-
i == null || i(
|
|
2898
|
+
const n = o, a = new DecompressionStream("gzip"), c = n.stream().pipeThrough(a);
|
|
2899
|
+
new Response(c).json().then((m) => {
|
|
2900
|
+
t == null || t(m);
|
|
2901
|
+
}).catch((m) => {
|
|
2902
|
+
i == null || i(m);
|
|
2912
2903
|
});
|
|
2913
2904
|
},
|
|
2914
2905
|
s,
|
|
@@ -2916,7 +2907,7 @@ class oi extends pt {
|
|
|
2916
2907
|
);
|
|
2917
2908
|
}
|
|
2918
2909
|
}
|
|
2919
|
-
const
|
|
2910
|
+
const oi = {
|
|
2920
2911
|
images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
|
|
2921
2912
|
media: ["mp4", "webm", "ogg"],
|
|
2922
2913
|
gltf: ["gltf", "glb"],
|
|
@@ -2925,9 +2916,9 @@ const ni = {
|
|
|
2925
2916
|
exr: ["exr"],
|
|
2926
2917
|
lottie: ["lottie.json"]
|
|
2927
2918
|
};
|
|
2928
|
-
class
|
|
2919
|
+
class ni {
|
|
2929
2920
|
constructor(e) {
|
|
2930
|
-
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new
|
|
2921
|
+
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
|
|
2931
2922
|
simpleTexture4deleted: !1,
|
|
2932
2923
|
prefix: ""
|
|
2933
2924
|
}, e), this.loadingManager = new es(
|
|
@@ -2968,7 +2959,7 @@ class ai {
|
|
|
2968
2959
|
if (e.endsWith("json.gzip"))
|
|
2969
2960
|
return "gzipJson";
|
|
2970
2961
|
} else return;
|
|
2971
|
-
for (const [i, r] of Object.entries(
|
|
2962
|
+
for (const [i, r] of Object.entries(oi))
|
|
2972
2963
|
if (r.includes(t))
|
|
2973
2964
|
return i;
|
|
2974
2965
|
}
|
|
@@ -2978,15 +2969,15 @@ class ai {
|
|
|
2978
2969
|
if (e === "media")
|
|
2979
2970
|
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
2971
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
2981
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new
|
|
2972
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new gs(), this.dracoLoader.setDecoderPath(t == null ? void 0 : t.dracoPath), this.dracoGltfLoader.setDRACOLoader(this.dracoLoader), this.options.prefix && this.dracoGltfLoader.setPath(this.options.prefix)), this.dracoGltfLoader;
|
|
2982
2973
|
if (e === "gltf")
|
|
2983
2974
|
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
2984
2975
|
if (e === "lottie")
|
|
2985
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
2976
|
+
return this.lottieLoader || (this.lottieLoader = new vs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
2986
2977
|
if (e === "gzipJson")
|
|
2987
|
-
return this.gzipJsonLoader || (this.gzipJsonLoader = new
|
|
2978
|
+
return this.gzipJsonLoader || (this.gzipJsonLoader = new ri(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
2988
2979
|
if (e === "json")
|
|
2989
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
2980
|
+
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
2981
|
if (e === "exr")
|
|
2991
2982
|
return this.exrLoader || (this.exrLoader = new ys(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
2992
2983
|
}
|
|
@@ -3007,7 +2998,7 @@ class ai {
|
|
|
3007
2998
|
get textureAssets() {
|
|
3008
2999
|
const e = /* @__PURE__ */ new Map();
|
|
3009
3000
|
return this.assets.forEach((t, s) => {
|
|
3010
|
-
(t instanceof fe || t instanceof ts || t instanceof
|
|
3001
|
+
(t instanceof fe || t instanceof ts || t instanceof pt) && e.set(s, t);
|
|
3011
3002
|
}), e;
|
|
3012
3003
|
}
|
|
3013
3004
|
loadAll() {
|
|
@@ -3020,11 +3011,11 @@ class ai {
|
|
|
3020
3011
|
}
|
|
3021
3012
|
load(e, t) {
|
|
3022
3013
|
return se(this, null, function* () {
|
|
3023
|
-
var n,
|
|
3014
|
+
var n, a;
|
|
3024
3015
|
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3025
3016
|
if (!s)
|
|
3026
3017
|
return;
|
|
3027
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3018
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = Cs();
|
|
3028
3019
|
if (i) {
|
|
3029
3020
|
if (this.assets.has(e))
|
|
3030
3021
|
return this.assets.get(e);
|
|
@@ -3032,14 +3023,14 @@ class ai {
|
|
|
3032
3023
|
}
|
|
3033
3024
|
const o = this.getLoader(s, t);
|
|
3034
3025
|
try {
|
|
3035
|
-
const
|
|
3036
|
-
if (this.assets.set(e,
|
|
3037
|
-
(t == null ? void 0 : t.colorCorrection) !== !1 &&
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3026
|
+
const c = yield o.loadAsync(e);
|
|
3027
|
+
if (this.assets.set(e, c), r.resolve(c), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3028
|
+
(t == null ? void 0 : t.colorCorrection) !== !1 && ns({ texture: c });
|
|
3029
|
+
const f = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
|
|
3030
|
+
c.anisotropy = f;
|
|
3040
3031
|
}
|
|
3041
|
-
return
|
|
3042
|
-
} catch (
|
|
3032
|
+
return c;
|
|
3033
|
+
} catch (c) {
|
|
3043
3034
|
r.reject(`Failed to load ${e}`);
|
|
3044
3035
|
return;
|
|
3045
3036
|
}
|
|
@@ -3052,18 +3043,18 @@ class ai {
|
|
|
3052
3043
|
const t = /* @__PURE__ */ new Set(), s = this.textureAssets;
|
|
3053
3044
|
e.traverse((r) => {
|
|
3054
3045
|
const o = r;
|
|
3055
|
-
o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((
|
|
3046
|
+
o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((a) => {
|
|
3056
3047
|
[
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
].forEach((
|
|
3064
|
-
if (
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3048
|
+
a.map,
|
|
3049
|
+
a.emissiveMap,
|
|
3050
|
+
a.normalMap,
|
|
3051
|
+
a.roughnessMap,
|
|
3052
|
+
a.metalnessMap,
|
|
3053
|
+
a.aoMap
|
|
3054
|
+
].forEach((c) => {
|
|
3055
|
+
if (c) {
|
|
3056
|
+
const f = this.getSrcByAsset(c, s);
|
|
3057
|
+
f && t.add(f);
|
|
3067
3058
|
}
|
|
3068
3059
|
});
|
|
3069
3060
|
});
|
|
@@ -3078,10 +3069,10 @@ class ai {
|
|
|
3078
3069
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3079
3070
|
}
|
|
3080
3071
|
}
|
|
3081
|
-
const
|
|
3072
|
+
const ai = {
|
|
3082
3073
|
prefix: ""
|
|
3083
3074
|
};
|
|
3084
|
-
class
|
|
3075
|
+
class li extends ee {
|
|
3085
3076
|
get loader() {
|
|
3086
3077
|
return this.controller;
|
|
3087
3078
|
}
|
|
@@ -3089,7 +3080,7 @@ class hi extends ee {
|
|
|
3089
3080
|
super(), this.options = e;
|
|
3090
3081
|
}
|
|
3091
3082
|
addLoader(e, t) {
|
|
3092
|
-
const { loaderParams: s } = this.options, i = new
|
|
3083
|
+
const { loaderParams: s } = this.options, i = new ni(te(U({}, s), {
|
|
3093
3084
|
scene: e
|
|
3094
3085
|
}));
|
|
3095
3086
|
return this.addController(i, t);
|
|
@@ -3100,15 +3091,6 @@ class hi extends ee {
|
|
|
3100
3091
|
});
|
|
3101
3092
|
}
|
|
3102
3093
|
}
|
|
3103
|
-
class ci extends hs {
|
|
3104
|
-
constructor(e) {
|
|
3105
|
-
super(), this.options = U({}, e);
|
|
3106
|
-
}
|
|
3107
|
-
create() {
|
|
3108
|
-
var e;
|
|
3109
|
-
this.object3d = (e = this.options.scene) != null ? e : new nt();
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
3094
|
function rt(h) {
|
|
3113
3095
|
let e = !1, t = [];
|
|
3114
3096
|
return function(...s) {
|
|
@@ -3117,7 +3099,7 @@ function rt(h) {
|
|
|
3117
3099
|
}));
|
|
3118
3100
|
};
|
|
3119
3101
|
}
|
|
3120
|
-
class
|
|
3102
|
+
class hi {
|
|
3121
3103
|
constructor(e) {
|
|
3122
3104
|
var t;
|
|
3123
3105
|
this.enabled = !0, this.pickFunctionsMap = /* @__PURE__ */ new Map(), this.pickNodeFunctionsMap = /* @__PURE__ */ new Map(), this.pickFunctionsMapIndex = -1, this.pickNodeFunctionsMapIndex = -1, this.activeObjects = /* @__PURE__ */ new Set(), this.prevActiveObjects = /* @__PURE__ */ new Set(), this.objCallbackMap = /* @__PURE__ */ new Map(), this.pickListener = {
|
|
@@ -3132,37 +3114,32 @@ class di {
|
|
|
3132
3114
|
return;
|
|
3133
3115
|
r.preventDefault();
|
|
3134
3116
|
const o = e === "move" ? t : s, n = [];
|
|
3135
|
-
if (this.pickFunctionsMap.forEach((
|
|
3136
|
-
o.has(
|
|
3137
|
-
objArr:
|
|
3117
|
+
if (this.pickFunctionsMap.forEach((p) => {
|
|
3118
|
+
o.has(p.type) && n.push(te(U({}, p), {
|
|
3119
|
+
objArr: p.objArr instanceof Function ? p.objArr() : p.objArr
|
|
3138
3120
|
}));
|
|
3139
3121
|
}), n.length === 0) return;
|
|
3140
3122
|
this.activeObjects.clear(), this.objCallbackMap.clear();
|
|
3141
|
-
const
|
|
3142
|
-
for (const
|
|
3143
|
-
for (const u of
|
|
3123
|
+
const a = this.objCallbackMap;
|
|
3124
|
+
for (const p of n)
|
|
3125
|
+
for (const u of p.objArr) {
|
|
3144
3126
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
3145
|
-
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3127
|
+
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
3128
|
+
const g = a.get(u);
|
|
3129
|
+
g.has(p.type) || g.set(p.type, []), g.get(p.type).push(p.cb);
|
|
3148
3130
|
}
|
|
3149
|
-
if (
|
|
3150
|
-
const
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
});
|
|
3155
|
-
});
|
|
3156
|
-
const p = (v = this.pencil.pick(r, _, !1)) == null ? void 0 : v.intersects;
|
|
3157
|
-
if (!p || p.length === 0)
|
|
3131
|
+
if (a.size === 0) return;
|
|
3132
|
+
const c = [...a.keys()].map((p) => p.object3d);
|
|
3133
|
+
console.time(`Pick:listener:${e}:pick`);
|
|
3134
|
+
const f = (v = this.pencil.pick(r, c, !0)) == null ? void 0 : v.intersects;
|
|
3135
|
+
if (console.timeEnd(`Pick:listener:${e}:pick`), !f || f.length === 0)
|
|
3158
3136
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
3159
3137
|
else {
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
this.processIntersection(m, r, e);
|
|
3138
|
+
const p = f[0];
|
|
3139
|
+
this.processIntersection(p, r, e);
|
|
3163
3140
|
}
|
|
3164
|
-
const
|
|
3165
|
-
this.prevActiveObjects = this.activeObjects, this.activeObjects =
|
|
3141
|
+
const m = this.prevActiveObjects;
|
|
3142
|
+
this.prevActiveObjects = this.activeObjects, this.activeObjects = m, this.activeObjects.clear();
|
|
3166
3143
|
};
|
|
3167
3144
|
this.domElement.addEventListener(
|
|
3168
3145
|
`pointer${e}`,
|
|
@@ -3170,9 +3147,6 @@ class di {
|
|
|
3170
3147
|
{ passive: !1 }
|
|
3171
3148
|
);
|
|
3172
3149
|
}
|
|
3173
|
-
sortIntersections(e) {
|
|
3174
|
-
e.sort((t, s) => t.distance === s.distance ? t.object.getObjectById(s.object.id) ? 1 : s.object.getObjectById(t.object.id) ? -1 : 0 : t.distance - s.distance);
|
|
3175
|
-
}
|
|
3176
3150
|
processIntersection(e, t, s) {
|
|
3177
3151
|
const i = this.objCallbackMap, r = e.index || -1;
|
|
3178
3152
|
let o = e.object;
|
|
@@ -3190,53 +3164,53 @@ class di {
|
|
|
3190
3164
|
};
|
|
3191
3165
|
for (const n of this.activeObjects) {
|
|
3192
3166
|
if (r) break;
|
|
3193
|
-
const
|
|
3194
|
-
if (
|
|
3167
|
+
const a = i.get(n);
|
|
3168
|
+
if (a)
|
|
3195
3169
|
if (t === "move") {
|
|
3196
|
-
const
|
|
3197
|
-
if (
|
|
3198
|
-
for (const
|
|
3199
|
-
|
|
3170
|
+
const c = a.get("enter");
|
|
3171
|
+
if (c && !this.prevActiveObjects.has(n))
|
|
3172
|
+
for (const m of c)
|
|
3173
|
+
m({
|
|
3200
3174
|
baseObject: n,
|
|
3201
3175
|
mouseEvent: e,
|
|
3202
3176
|
sp: o,
|
|
3203
3177
|
intersectionIndex: s
|
|
3204
3178
|
});
|
|
3205
|
-
const
|
|
3206
|
-
if (
|
|
3207
|
-
for (const
|
|
3208
|
-
|
|
3179
|
+
const f = a.get("move");
|
|
3180
|
+
if (f)
|
|
3181
|
+
for (const m of f)
|
|
3182
|
+
m({
|
|
3209
3183
|
baseObject: n,
|
|
3210
3184
|
mouseEvent: e,
|
|
3211
3185
|
sp: o,
|
|
3212
3186
|
intersectionIndex: s
|
|
3213
3187
|
});
|
|
3214
3188
|
} else {
|
|
3215
|
-
const
|
|
3216
|
-
if (
|
|
3217
|
-
for (const
|
|
3218
|
-
|
|
3189
|
+
const c = a.get("down");
|
|
3190
|
+
if (c)
|
|
3191
|
+
for (const m of c)
|
|
3192
|
+
m({
|
|
3219
3193
|
baseObject: n,
|
|
3220
3194
|
mouseEvent: e,
|
|
3221
3195
|
sp: o,
|
|
3222
3196
|
intersectionIndex: s
|
|
3223
3197
|
});
|
|
3224
|
-
const
|
|
3225
|
-
if (
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3228
|
-
const
|
|
3229
|
-
if (!r && Math.abs(
|
|
3230
|
-
for (const
|
|
3231
|
-
|
|
3198
|
+
const f = a.get("click");
|
|
3199
|
+
if (f) {
|
|
3200
|
+
const m = (v) => {
|
|
3201
|
+
v.preventDefault();
|
|
3202
|
+
const p = 5;
|
|
3203
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= p && Math.abs(v.clientY - e.clientY) <= p)
|
|
3204
|
+
for (const u of f)
|
|
3205
|
+
u({
|
|
3232
3206
|
baseObject: n,
|
|
3233
3207
|
mouseEvent: e,
|
|
3234
3208
|
sp: o,
|
|
3235
3209
|
intersectionIndex: s
|
|
3236
3210
|
});
|
|
3237
|
-
this.domElement.removeEventListener("pointerup",
|
|
3211
|
+
this.domElement.removeEventListener("pointerup", m);
|
|
3238
3212
|
};
|
|
3239
|
-
this.domElement.addEventListener("pointerup",
|
|
3213
|
+
this.domElement.addEventListener("pointerup", m);
|
|
3240
3214
|
}
|
|
3241
3215
|
}
|
|
3242
3216
|
}
|
|
@@ -3282,15 +3256,15 @@ class di {
|
|
|
3282
3256
|
this.pickNodeFunctionsMapIndex += 1;
|
|
3283
3257
|
const i = this.pickNodeFunctionsMapIndex, r = e instanceof Function ? e() : e, o = [];
|
|
3284
3258
|
for (const n of r) {
|
|
3285
|
-
const
|
|
3286
|
-
|
|
3287
|
-
const
|
|
3288
|
-
this.enabled && (
|
|
3289
|
-
baseObject:
|
|
3290
|
-
mouseEvent:
|
|
3259
|
+
const a = n;
|
|
3260
|
+
a.element.style.pointerEvents = "auto";
|
|
3261
|
+
const c = (m) => {
|
|
3262
|
+
this.enabled && (m.preventDefault(), s({
|
|
3263
|
+
baseObject: a,
|
|
3264
|
+
mouseEvent: m
|
|
3291
3265
|
}));
|
|
3292
|
-
},
|
|
3293
|
-
|
|
3266
|
+
}, f = `pointer${t}`;
|
|
3267
|
+
a.element.addEventListener(f, rt(c), !1), o.push({ arr: a, type: f, listener: c });
|
|
3294
3268
|
}
|
|
3295
3269
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
3296
3270
|
}
|
|
@@ -3310,15 +3284,28 @@ class di {
|
|
|
3310
3284
|
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
|
|
3311
3285
|
}
|
|
3312
3286
|
}
|
|
3313
|
-
class
|
|
3287
|
+
class ci extends hi {
|
|
3314
3288
|
constructor(e, t) {
|
|
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
|
|
3316
|
-
|
|
3317
|
-
|
|
3289
|
+
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new nt(), {
|
|
3290
|
+
key: "@Scene",
|
|
3291
|
+
name: "场景"
|
|
3292
|
+
}), this.group = this.createBaseObject(new ze(), {
|
|
3293
|
+
key: "@Group",
|
|
3294
|
+
name: "物体组",
|
|
3295
|
+
target: this.scene
|
|
3296
|
+
}), this.prefabGroup = this.createBaseObject(new ze(), {
|
|
3297
|
+
key: "@PrefabGroup",
|
|
3298
|
+
name: "预制组",
|
|
3299
|
+
target: this.scene
|
|
3300
|
+
});
|
|
3318
3301
|
}
|
|
3319
3302
|
get objectsPromise() {
|
|
3320
3303
|
return this.objectsPm.values();
|
|
3321
3304
|
}
|
|
3305
|
+
createBaseObject(e, t) {
|
|
3306
|
+
const s = new ls();
|
|
3307
|
+
return s.object3d = e, s.pencil = this.pencil, s.lead = this, s.mList = this.mList, t != null && t.key && (s.key = t.key), t != null && t.name && (e.name = t.name), t != null && t.target && (t == null || t.target.add(s.object3d)), this.objects.set(s.key, s), this.objMap.set(s.object3d, s), s;
|
|
3308
|
+
}
|
|
3322
3309
|
init(e) {
|
|
3323
3310
|
return Object.keys(e).forEach((t) => {
|
|
3324
3311
|
const s = class {
|
|
@@ -3343,23 +3330,23 @@ class pi extends di {
|
|
|
3343
3330
|
}
|
|
3344
3331
|
draw(e, t, s) {
|
|
3345
3332
|
return se(this, null, function* () {
|
|
3346
|
-
var r, o, n,
|
|
3333
|
+
var r, o, n, a;
|
|
3347
3334
|
const i = this.objectNamesToFactories.get(e);
|
|
3348
3335
|
if (i) {
|
|
3349
3336
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3350
|
-
const
|
|
3351
|
-
let
|
|
3352
|
-
return
|
|
3353
|
-
} :
|
|
3354
|
-
|
|
3355
|
-
}),
|
|
3356
|
-
|
|
3337
|
+
const c = t.target, f = (r = t.onTop) != null ? r : 0, m = (o = t.prefab) != null ? o : !1, v = (n = t.create) != null ? n : !0, p = new i().create(t);
|
|
3338
|
+
let u;
|
|
3339
|
+
return c === null ? u = null : typeof c == "string" ? u = this.objects.get(c) : (a = c == null ? void 0 : c.objectType) != null && a.startsWith("BaseObject") || c ? u = c : m ? u = this.prefabGroup : u = this.group, v === !1 ? p.create = () => {
|
|
3340
|
+
} : v !== !0 && (p.create = () => {
|
|
3341
|
+
v(p);
|
|
3342
|
+
}), p.pencil = this.pencil, p.lead = this, p.mList = this.mList, p.prefab = m, p.objectType = `BaseObject#${e}`, p.objectOptions = t, this.setBaseObjectKey(
|
|
3343
|
+
p,
|
|
3357
3344
|
t.key ? `$t:#${t.key}` : "$t:",
|
|
3358
|
-
|
|
3345
|
+
u == null ? void 0 : u.key
|
|
3359
3346
|
), this.objectsPm.set(
|
|
3360
|
-
|
|
3361
|
-
this.addBaseObject(
|
|
3362
|
-
), yield this.objectsPm.get(
|
|
3347
|
+
p,
|
|
3348
|
+
this.addBaseObject(p, u, f)
|
|
3349
|
+
), yield this.objectsPm.get(p), this.objectsPm.delete(p), p;
|
|
3363
3350
|
}
|
|
3364
3351
|
throw new Error(`Unrecognized:${e}`);
|
|
3365
3352
|
});
|
|
@@ -3371,13 +3358,13 @@ class pi extends di {
|
|
|
3371
3358
|
const [, n] = s.split("#");
|
|
3372
3359
|
o = o.replace("$p:", n);
|
|
3373
3360
|
}
|
|
3374
|
-
return this.objects.has(o) && (o.includes("#") ? o += `-${
|
|
3361
|
+
return this.objects.has(o) && (o.includes("#") ? o += `-${He()}` : o += `#${He()}`), e.key = o, this.objects.set(o, e), o;
|
|
3375
3362
|
}
|
|
3376
3363
|
updateBaseObjectKey(e, t) {
|
|
3377
3364
|
var o;
|
|
3378
3365
|
let s;
|
|
3379
|
-
for (const [n,
|
|
3380
|
-
if (
|
|
3366
|
+
for (const [n, a] of this.objects.entries())
|
|
3367
|
+
if (a === e) {
|
|
3381
3368
|
s = n;
|
|
3382
3369
|
break;
|
|
3383
3370
|
}
|
|
@@ -3386,7 +3373,11 @@ class pi extends di {
|
|
|
3386
3373
|
}
|
|
3387
3374
|
addBaseObject(e, t, s) {
|
|
3388
3375
|
return se(this, null, function* () {
|
|
3389
|
-
yield e.create(), e.object3d
|
|
3376
|
+
if (yield e.create(), e.object3d) {
|
|
3377
|
+
const i = e.object3d;
|
|
3378
|
+
i.material && Array.isArray(i.material) && (i.material = i.material.slice()), this.pencil.options.mList && (this.mList.proxyBaseObject(e), this.mList.addBaseObjectMap(e)), s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e));
|
|
3379
|
+
}
|
|
3380
|
+
e.render(), this.pencil.event.emit("draw", e);
|
|
3390
3381
|
});
|
|
3391
3382
|
}
|
|
3392
3383
|
erase(...e) {
|
|
@@ -3429,7 +3420,7 @@ class pi extends di {
|
|
|
3429
3420
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectNamesToFactories.clear();
|
|
3430
3421
|
}
|
|
3431
3422
|
}
|
|
3432
|
-
class
|
|
3423
|
+
class di extends ee {
|
|
3433
3424
|
get lead() {
|
|
3434
3425
|
return this.controller;
|
|
3435
3426
|
}
|
|
@@ -3437,7 +3428,7 @@ class mi extends ee {
|
|
|
3437
3428
|
super(), this.options = e;
|
|
3438
3429
|
}
|
|
3439
3430
|
addLead(e, t, s) {
|
|
3440
|
-
const { pencil: i } = this.options, r = new
|
|
3431
|
+
const { pencil: i } = this.options, r = new ci(i, {
|
|
3441
3432
|
scene: e,
|
|
3442
3433
|
mList: t
|
|
3443
3434
|
});
|
|
@@ -3459,7 +3450,7 @@ class mi extends ee {
|
|
|
3459
3450
|
});
|
|
3460
3451
|
}
|
|
3461
3452
|
}
|
|
3462
|
-
class
|
|
3453
|
+
class mi {
|
|
3463
3454
|
constructor(e) {
|
|
3464
3455
|
this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
|
|
3465
3456
|
}
|
|
@@ -3474,15 +3465,15 @@ class ui {
|
|
|
3474
3465
|
set: (i, r, o) => {
|
|
3475
3466
|
var n;
|
|
3476
3467
|
if (r === "material" && !((n = this.pencil.composerController) != null && n.bloomComposerRenderIng)) {
|
|
3477
|
-
const
|
|
3478
|
-
return i.material = o, this.materials.set(e, o), this.disposeMaterial(
|
|
3468
|
+
const a = i.material;
|
|
3469
|
+
return i.material = o, this.materials.set(e, o), this.disposeMaterial(a), this.syncChangeMaterial(a, o), !0;
|
|
3479
3470
|
}
|
|
3480
|
-
return
|
|
3471
|
+
return i[r] = o, !0;
|
|
3481
3472
|
}
|
|
3482
3473
|
}
|
|
3483
3474
|
)
|
|
3484
3475
|
};
|
|
3485
|
-
this.fixBaseObjects.set(e, s)
|
|
3476
|
+
this.fixBaseObjects.set(e, s);
|
|
3486
3477
|
}
|
|
3487
3478
|
get(e) {
|
|
3488
3479
|
const t = this.materials.get(e);
|
|
@@ -3513,73 +3504,129 @@ class ui {
|
|
|
3513
3504
|
}
|
|
3514
3505
|
return i ? t : null;
|
|
3515
3506
|
}
|
|
3507
|
+
copy(e, t) {
|
|
3508
|
+
const s = this.get(e);
|
|
3509
|
+
if (!s)
|
|
3510
|
+
return console.warn(`Material with key "${e}" not found.`), null;
|
|
3511
|
+
const i = s.clone();
|
|
3512
|
+
return this.add(t, i), i;
|
|
3513
|
+
}
|
|
3516
3514
|
copyMultiple(e, t) {
|
|
3517
3515
|
const s = {}, i = `${e}#`;
|
|
3518
3516
|
for (const [r, o] of this.materials.entries())
|
|
3519
3517
|
if (r.startsWith(i)) {
|
|
3520
|
-
const n = r.substring(i.length),
|
|
3521
|
-
s[n] =
|
|
3522
|
-
const
|
|
3523
|
-
this.add(
|
|
3518
|
+
const n = r.substring(i.length), a = o.clone();
|
|
3519
|
+
s[n] = a;
|
|
3520
|
+
const c = `${t}#${n}`;
|
|
3521
|
+
this.add(c, a);
|
|
3524
3522
|
}
|
|
3525
3523
|
return s;
|
|
3526
3524
|
}
|
|
3527
3525
|
disposeMaterial(e) {
|
|
3528
3526
|
if (!e) return;
|
|
3529
3527
|
const t = new Pe();
|
|
3530
|
-
t.track([e]), t.dispose();
|
|
3528
|
+
t.track(Array.isArray(e) ? e : [e]), t.dispose();
|
|
3531
3529
|
}
|
|
3532
3530
|
remove(e) {
|
|
3533
3531
|
const t = this.materials.get(e);
|
|
3534
|
-
t && this.disposeMaterial(t), this.materials.delete(e), this.fixBaseObjects.delete(e)
|
|
3532
|
+
t && this.disposeMaterial(t), this.materials.delete(e), this.fixBaseObjects.delete(e);
|
|
3535
3533
|
}
|
|
3536
3534
|
removeByMaterial(e) {
|
|
3537
3535
|
[...this.materials.entries()].some(([t, s]) => s === e ? (this.remove(t), !0) : !1);
|
|
3538
3536
|
}
|
|
3539
3537
|
proxyBaseObject(e) {
|
|
3540
|
-
const t = e.object3d, s = (
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3538
|
+
const t = e.object3d, s = (o) => {
|
|
3539
|
+
if (o.hasOwnProperty("__isProxy"))
|
|
3540
|
+
return o;
|
|
3541
|
+
const n = new Proxy(o, {
|
|
3542
|
+
set: (a, c, f) => {
|
|
3543
|
+
if (typeof c == "string" && !isNaN(Number(c))) {
|
|
3544
|
+
const m = Number(c);
|
|
3545
|
+
if (m >= 0 && m < a.length) {
|
|
3546
|
+
const v = a[m];
|
|
3547
|
+
return this.rmBaseObjectMap(e, v), a[m] = f, f && this.addBaseObjectMap(e), !0;
|
|
3548
|
+
}
|
|
3547
3549
|
}
|
|
3550
|
+
return a[c] = f, !0;
|
|
3548
3551
|
}
|
|
3549
|
-
|
|
3552
|
+
});
|
|
3553
|
+
return Object.defineProperty(n, "__isProxy", {
|
|
3554
|
+
value: !0,
|
|
3555
|
+
enumerable: !1
|
|
3556
|
+
}), n;
|
|
3557
|
+
};
|
|
3558
|
+
e.materialList && (e.materialList = new Proxy(e.materialList, {
|
|
3559
|
+
set: (o, n, a) => {
|
|
3560
|
+
if (typeof n == "string") {
|
|
3561
|
+
const c = o[n];
|
|
3562
|
+
return this.rmBaseObjectMap(e, c), o[n] = a, a && this.addBaseObjectMap(e), !0;
|
|
3563
|
+
}
|
|
3564
|
+
return o[n] = a, !0;
|
|
3565
|
+
},
|
|
3566
|
+
get: (o, n) => {
|
|
3567
|
+
if (typeof n == "string" && o[n]) {
|
|
3568
|
+
const a = o[n];
|
|
3569
|
+
if (Array.isArray(a)) {
|
|
3570
|
+
const c = s(a);
|
|
3571
|
+
return c !== a && (o[n] = c), c;
|
|
3572
|
+
}
|
|
3573
|
+
return a;
|
|
3574
|
+
}
|
|
3575
|
+
return o[n];
|
|
3576
|
+
},
|
|
3577
|
+
deleteProperty: (o, n) => {
|
|
3578
|
+
if (typeof n == "string" && o[n]) {
|
|
3579
|
+
const a = o[n];
|
|
3580
|
+
this.rmBaseObjectMap(e, a);
|
|
3581
|
+
}
|
|
3582
|
+
return delete o[n], !0;
|
|
3550
3583
|
}
|
|
3551
|
-
});
|
|
3552
|
-
|
|
3553
|
-
|
|
3584
|
+
}));
|
|
3585
|
+
const i = t.material, r = "_enhancedMaterial";
|
|
3586
|
+
t[r] = i, Object.defineProperty(t, "material", {
|
|
3587
|
+
get: () => {
|
|
3554
3588
|
var n;
|
|
3555
|
-
|
|
3589
|
+
const o = t[r];
|
|
3590
|
+
if (!((n = this.pencil.composerController) != null && n.bloomComposerRenderIng) && Array.isArray(o)) {
|
|
3591
|
+
const a = s(o);
|
|
3592
|
+
return a !== o && (t[r] = a), a;
|
|
3593
|
+
}
|
|
3594
|
+
return o;
|
|
3556
3595
|
},
|
|
3557
|
-
|
|
3558
|
-
var
|
|
3559
|
-
if (
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
enumerable: !1
|
|
3566
|
-
}), i.material = l;
|
|
3596
|
+
set: (o) => {
|
|
3597
|
+
var n;
|
|
3598
|
+
if ((n = this.pencil.composerController) != null && n.bloomComposerRenderIng)
|
|
3599
|
+
t[r] = o;
|
|
3600
|
+
else {
|
|
3601
|
+
if (e.materialList && Object.values(e.materialList).includes(o)) {
|
|
3602
|
+
t[r] = o;
|
|
3603
|
+
return;
|
|
3567
3604
|
}
|
|
3605
|
+
this.rmBaseObjectMap(e), t[r] = o, this.addBaseObjectMap(e);
|
|
3568
3606
|
}
|
|
3569
|
-
|
|
3570
|
-
|
|
3607
|
+
},
|
|
3608
|
+
enumerable: !0,
|
|
3609
|
+
configurable: !0
|
|
3571
3610
|
});
|
|
3572
3611
|
}
|
|
3612
|
+
material2array(e) {
|
|
3613
|
+
return Array.isArray(e) ? e : [e];
|
|
3614
|
+
}
|
|
3573
3615
|
addBaseObjectMap(e) {
|
|
3574
3616
|
const t = e.object3d;
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3617
|
+
[...Object.values(e.materialList), t.material].forEach(
|
|
3618
|
+
(s) => {
|
|
3619
|
+
s && this.material2array(s).forEach((r) => {
|
|
3620
|
+
const o = this.materialBaseObjectMap.get(r);
|
|
3621
|
+
o ? o.add(e) : this.materialBaseObjectMap.set(r, /* @__PURE__ */ new Set([e]));
|
|
3622
|
+
});
|
|
3623
|
+
}
|
|
3624
|
+
);
|
|
3579
3625
|
}
|
|
3580
3626
|
rmBaseObjectMap(e, t, s = !0) {
|
|
3581
|
-
this.
|
|
3582
|
-
|
|
3627
|
+
const i = t && this.material2array(t);
|
|
3628
|
+
this.materialBaseObjectMap.forEach((r, o) => {
|
|
3629
|
+
i && !i.includes(o) || r.has(e) && (r.delete(e), r.size === 0 && s && (this.materialBaseObjectMap.delete(o), this.disposeMaterial(o)));
|
|
3583
3630
|
});
|
|
3584
3631
|
}
|
|
3585
3632
|
syncChangeMaterial(e, t) {
|
|
@@ -3590,18 +3637,21 @@ class ui {
|
|
|
3590
3637
|
const n = o.indexOf(e);
|
|
3591
3638
|
n !== -1 && (o[n] = t);
|
|
3592
3639
|
} else o === e && (r.material = t);
|
|
3640
|
+
i.materialList && Object.keys(i.materialList).forEach((n) => {
|
|
3641
|
+
const a = i.materialList[n];
|
|
3642
|
+
if (Array.isArray(a)) {
|
|
3643
|
+
const c = a.indexOf(e);
|
|
3644
|
+
c !== -1 && (a[c] = t);
|
|
3645
|
+
} else a === e && (i.materialList[n] = t);
|
|
3646
|
+
});
|
|
3593
3647
|
});
|
|
3594
3648
|
}
|
|
3595
|
-
emitObject3dChange() {
|
|
3596
|
-
var e;
|
|
3597
|
-
(e = this.pencil) == null || e.event.emit("baseObjectListChange");
|
|
3598
|
-
}
|
|
3599
3649
|
dispose() {
|
|
3600
3650
|
const e = new Pe();
|
|
3601
3651
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3602
3652
|
}
|
|
3603
3653
|
}
|
|
3604
|
-
class
|
|
3654
|
+
class pi extends ee {
|
|
3605
3655
|
get mList() {
|
|
3606
3656
|
return this.controller;
|
|
3607
3657
|
}
|
|
@@ -3609,7 +3659,7 @@ class fi extends ee {
|
|
|
3609
3659
|
super(), this.options = e;
|
|
3610
3660
|
}
|
|
3611
3661
|
addMList(e, t) {
|
|
3612
|
-
const { pencil: s } = this.options, i = new
|
|
3662
|
+
const { pencil: s } = this.options, i = new mi(s);
|
|
3613
3663
|
return this.addController(i, t);
|
|
3614
3664
|
}
|
|
3615
3665
|
removePage(e) {
|
|
@@ -3621,8 +3671,8 @@ class fi extends ee {
|
|
|
3621
3671
|
const _e = class _e {
|
|
3622
3672
|
constructor(e) {
|
|
3623
3673
|
var r, o;
|
|
3624
|
-
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new
|
|
3625
|
-
isMergeableObject:
|
|
3674
|
+
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ye.EventEmitter(), this.timer = new ss(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = is(_e.options, e, {
|
|
3675
|
+
isMergeableObject: as
|
|
3626
3676
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3627
3677
|
const {
|
|
3628
3678
|
container: t,
|
|
@@ -3630,7 +3680,7 @@ const _e = class _e {
|
|
|
3630
3680
|
transformControls: i
|
|
3631
3681
|
} = this.options;
|
|
3632
3682
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3633
|
-
const n = new
|
|
3683
|
+
const n = new rs({
|
|
3634
3684
|
horizontal: !1
|
|
3635
3685
|
});
|
|
3636
3686
|
n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
|
|
@@ -3698,7 +3748,7 @@ const _e = class _e {
|
|
|
3698
3748
|
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;
|
|
3699
3749
|
}
|
|
3700
3750
|
init() {
|
|
3701
|
-
var
|
|
3751
|
+
var _;
|
|
3702
3752
|
const {
|
|
3703
3753
|
container: e,
|
|
3704
3754
|
WebGPUTHREE: t,
|
|
@@ -3707,47 +3757,47 @@ const _e = class _e {
|
|
|
3707
3757
|
renderer: r,
|
|
3708
3758
|
controls: o,
|
|
3709
3759
|
loader: n
|
|
3710
|
-
} = this.options, { width:
|
|
3711
|
-
width:
|
|
3712
|
-
height:
|
|
3760
|
+
} = this.options, { width: a, height: c } = this.getSize(), f = t ? new Rs({
|
|
3761
|
+
width: a,
|
|
3762
|
+
height: c,
|
|
3713
3763
|
renderer: t.WebGPURenderer,
|
|
3714
|
-
rendererParams:
|
|
3715
|
-
}) : new
|
|
3716
|
-
width:
|
|
3717
|
-
height:
|
|
3764
|
+
rendererParams: Ms
|
|
3765
|
+
}) : new Ss({
|
|
3766
|
+
width: a,
|
|
3767
|
+
height: c,
|
|
3718
3768
|
rendererParams: te(U({}, r), {
|
|
3719
3769
|
antialias: !1
|
|
3720
3770
|
})
|
|
3721
|
-
}),
|
|
3722
|
-
width:
|
|
3723
|
-
height:
|
|
3724
|
-
}),
|
|
3771
|
+
}), m = new Us({
|
|
3772
|
+
width: a,
|
|
3773
|
+
height: c
|
|
3774
|
+
}), v = new ks({}), p = new Ns({
|
|
3725
3775
|
controlsParams: {
|
|
3726
|
-
domElement: (
|
|
3776
|
+
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : f.renderer.domElement
|
|
3727
3777
|
}
|
|
3728
|
-
}),
|
|
3778
|
+
}), u = new li({
|
|
3729
3779
|
loaderParams: U({
|
|
3730
|
-
anisotropy:
|
|
3780
|
+
anisotropy: f.renderer.capabilities.getMaxAnisotropy()
|
|
3731
3781
|
}, n)
|
|
3732
|
-
}),
|
|
3782
|
+
}), g = new pi({
|
|
3733
3783
|
pencil: this
|
|
3734
|
-
}),
|
|
3784
|
+
}), y = new di({
|
|
3735
3785
|
pencil: this
|
|
3736
3786
|
});
|
|
3737
|
-
this.sceneController =
|
|
3738
|
-
const
|
|
3787
|
+
this.sceneController = v, this.cameraController = m, this.controlsController = p, this.rendererController = f, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3788
|
+
const l = this.addPage({
|
|
3739
3789
|
sceneOptions: this.options.scene,
|
|
3740
3790
|
cameraOptions: this.options.camera
|
|
3741
3791
|
});
|
|
3742
|
-
if (this.showPage(
|
|
3743
|
-
const
|
|
3792
|
+
if (this.showPage(l), s) {
|
|
3793
|
+
const O = new Fs({
|
|
3744
3794
|
container: e,
|
|
3745
|
-
sceneController:
|
|
3746
|
-
cameraController:
|
|
3795
|
+
sceneController: v,
|
|
3796
|
+
cameraController: m
|
|
3747
3797
|
});
|
|
3748
|
-
|
|
3798
|
+
O.add(v.scene), this.helperController = O, i && O.addViewHelper();
|
|
3749
3799
|
}
|
|
3750
|
-
e.appendChild(
|
|
3800
|
+
e.appendChild(f.renderer.domElement);
|
|
3751
3801
|
}
|
|
3752
3802
|
initComposer() {
|
|
3753
3803
|
const {
|
|
@@ -3756,7 +3806,7 @@ const _e = class _e {
|
|
|
3756
3806
|
ssao: s,
|
|
3757
3807
|
ssaoParams: i,
|
|
3758
3808
|
composer: r
|
|
3759
|
-
} = this.options, o = new
|
|
3809
|
+
} = this.options, o = new ii({
|
|
3760
3810
|
rendererController: this.rendererController,
|
|
3761
3811
|
sceneController: this.sceneController,
|
|
3762
3812
|
cameraController: this.cameraController,
|
|
@@ -3773,12 +3823,12 @@ const _e = class _e {
|
|
|
3773
3823
|
css3DRendererParams: r
|
|
3774
3824
|
} = this.options;
|
|
3775
3825
|
if (t || s) {
|
|
3776
|
-
const o = new
|
|
3826
|
+
const o = new Ys(e);
|
|
3777
3827
|
t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
|
|
3778
3828
|
}
|
|
3779
3829
|
}
|
|
3780
3830
|
initTransformControls() {
|
|
3781
|
-
const e = new
|
|
3831
|
+
const e = new Hs({
|
|
3782
3832
|
camera: this.camera,
|
|
3783
3833
|
renderer: this.renderer,
|
|
3784
3834
|
scene: this.scene
|
|
@@ -3815,12 +3865,12 @@ const _e = class _e {
|
|
|
3815
3865
|
cameraController: r,
|
|
3816
3866
|
composerController: o,
|
|
3817
3867
|
cssRendererController: n,
|
|
3818
|
-
leadController:
|
|
3819
|
-
} = this,
|
|
3820
|
-
|
|
3821
|
-
var
|
|
3822
|
-
(
|
|
3823
|
-
}), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3868
|
+
leadController: a
|
|
3869
|
+
} = this, c = this.renderer.getSize(new B());
|
|
3870
|
+
c.x === e && c.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((f) => {
|
|
3871
|
+
var m;
|
|
3872
|
+
(m = f.setSize) == null || m.call(f, e, t);
|
|
3873
|
+
}), this.viewPadding.some((f) => f !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3824
3874
|
}
|
|
3825
3875
|
setDevicePixelRatio(e) {
|
|
3826
3876
|
var n;
|
|
@@ -3836,38 +3886,47 @@ const _e = class _e {
|
|
|
3836
3886
|
r
|
|
3837
3887
|
);
|
|
3838
3888
|
const o = this.renderer.getPixelRatio();
|
|
3839
|
-
r !== o && (this.rendererController.setPixelRatio(r), (n = this.composerController) == null || n.setPixelRatio(r));
|
|
3889
|
+
r !== o && (this.rendererController.setPixelRatio(r), (n = this.composerController) == null || n.setPixelRatio(r), this.viewPadding.some((a) => a !== 0) && this.setViewPadding(...this.viewPadding));
|
|
3890
|
+
}
|
|
3891
|
+
setViewPadding(e = 0, t = 0, s = 0, i = 0) {
|
|
3892
|
+
const { width: r, height: o } = this.renderer.getSize(new B()), n = {
|
|
3893
|
+
x: i,
|
|
3894
|
+
y: s,
|
|
3895
|
+
width: r - i - t,
|
|
3896
|
+
height: o - e - s
|
|
3897
|
+
};
|
|
3898
|
+
this.rendererController.setViewport(n), this.cameraController.setAspect(n.width / n.height), this.viewPadding = [e, t, s, i];
|
|
3840
3899
|
}
|
|
3841
3900
|
pick(e, t, s = !0) {
|
|
3842
|
-
const { raycaster: i, options: r } = this, { container: o } = r, n = new B(),
|
|
3843
|
-
if (n.x = (e.clientX -
|
|
3901
|
+
const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), a = o.getBoundingClientRect();
|
|
3902
|
+
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) {
|
|
3844
3903
|
i.setFromCamera(n, this.camera);
|
|
3845
|
-
const
|
|
3904
|
+
const c = i.intersectObjects(
|
|
3846
3905
|
t || this.scene.children,
|
|
3847
3906
|
s
|
|
3848
3907
|
);
|
|
3849
|
-
if (
|
|
3908
|
+
if (c.length)
|
|
3850
3909
|
return {
|
|
3851
|
-
object:
|
|
3852
|
-
index:
|
|
3853
|
-
intersects:
|
|
3910
|
+
object: c[0].object,
|
|
3911
|
+
index: c[0].index,
|
|
3912
|
+
intersects: c
|
|
3854
3913
|
};
|
|
3855
3914
|
}
|
|
3856
3915
|
}
|
|
3857
3916
|
render() {
|
|
3858
|
-
var s, i, r, o, n,
|
|
3917
|
+
var s, i, r, o, n, a;
|
|
3859
3918
|
if (!this.camera || !this.scene)
|
|
3860
3919
|
return;
|
|
3861
3920
|
this.timer.update(), Ce.update();
|
|
3862
3921
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3863
|
-
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((
|
|
3864
|
-
var
|
|
3865
|
-
(
|
|
3922
|
+
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((c) => {
|
|
3923
|
+
var f;
|
|
3924
|
+
(f = c.update) == null || f.call(c, e, t);
|
|
3866
3925
|
}), (s = this.helperController) == null || s.update(
|
|
3867
3926
|
e,
|
|
3868
3927
|
this.controlsController,
|
|
3869
3928
|
this.cameraTarget
|
|
3870
|
-
), (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), (
|
|
3929
|
+
), (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 });
|
|
3871
3930
|
}
|
|
3872
3931
|
start() {
|
|
3873
3932
|
window.cancelAnimationFrame(this.TweenRaf), this.renderer.setAnimationLoop(this.render.bind(this)), this.event.emit("start");
|
|
@@ -3905,39 +3964,40 @@ const _e = class _e {
|
|
|
3905
3964
|
}
|
|
3906
3965
|
}
|
|
3907
3966
|
dispose() {
|
|
3908
|
-
var e, t, s, i, r, o, n,
|
|
3909
|
-
this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((
|
|
3910
|
-
var
|
|
3911
|
-
(
|
|
3912
|
-
}), (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(), (
|
|
3967
|
+
var e, t, s, i, r, o, n, a, c, f, m, v, p, u;
|
|
3968
|
+
this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
3969
|
+
var y;
|
|
3970
|
+
(y = g.dispose) == null || y.call(g);
|
|
3971
|
+
}), (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(), (c = this.rendererController) == null || c.dispose(), (f = this.loaderController) == null || f.dispose(), (m = this.leadController) == null || m.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (p = this.stats) == null || p.dom.remove(), (u = this.renderer) == null || u.domElement.remove();
|
|
3913
3972
|
}
|
|
3914
3973
|
};
|
|
3915
3974
|
_e.options = {
|
|
3916
|
-
stats:
|
|
3917
|
-
helper:
|
|
3918
|
-
viewHelper:
|
|
3975
|
+
stats: pe,
|
|
3976
|
+
helper: pe,
|
|
3977
|
+
viewHelper: pe,
|
|
3919
3978
|
controls: !0,
|
|
3920
|
-
transformControls:
|
|
3979
|
+
transformControls: pe,
|
|
3921
3980
|
renderer: As,
|
|
3922
|
-
composer:
|
|
3923
|
-
scene:
|
|
3924
|
-
camera:
|
|
3981
|
+
composer: si,
|
|
3982
|
+
scene: zs,
|
|
3983
|
+
camera: wt,
|
|
3925
3984
|
bloom: !1,
|
|
3926
|
-
bloomParams:
|
|
3985
|
+
bloomParams: ti,
|
|
3927
3986
|
ssao: !1,
|
|
3928
|
-
loader:
|
|
3929
|
-
ssaoParams:
|
|
3987
|
+
loader: ai,
|
|
3988
|
+
ssaoParams: ei,
|
|
3930
3989
|
css2DRenderer: !1,
|
|
3931
3990
|
css2DRendererParams: U({}, st),
|
|
3932
3991
|
css3DRenderer: !1,
|
|
3933
|
-
css3DRendererParams: U({}, st)
|
|
3992
|
+
css3DRendererParams: U({}, st),
|
|
3993
|
+
mList: !0
|
|
3934
3994
|
};
|
|
3935
3995
|
let ot = _e;
|
|
3936
|
-
const
|
|
3996
|
+
const Gi = J.ACTION;
|
|
3937
3997
|
export {
|
|
3938
|
-
|
|
3998
|
+
ls as BaseObject,
|
|
3939
3999
|
ot as Pencil,
|
|
3940
4000
|
Pe as ResourceTracker,
|
|
3941
|
-
|
|
4001
|
+
Gi as cameraControlsAction,
|
|
3942
4002
|
ot as default
|
|
3943
4003
|
};
|