gl-draw 0.16.0-beta.9 → 0.16.1
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/WebGPULineSegments2.js +3 -3
- package/dist/WebGPULineSegments2.module.js +407 -399
- package/dist/core/BaseObject/index.d.ts +4 -0
- package/dist/core/Lead/Lead.d.ts +17 -9
- package/dist/index.js +2 -2
- package/dist/index.module.js +541 -524
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, St = Object.defineProperties;
|
|
2
|
+
var At = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Me = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Re = (
|
|
4
|
+
var Mt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Re = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, U = (c, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
Mt.call(e, t) && Re(c, t, e[t]);
|
|
8
8
|
if (Me)
|
|
9
9
|
for (var t of Me(e))
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, te = (
|
|
13
|
-
var se = (
|
|
10
|
+
Rt.call(e, t) && Re(c, t, e[t]);
|
|
11
|
+
return c;
|
|
12
|
+
}, te = (c, e) => St(c, At(e));
|
|
13
|
+
var se = (c, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (a) => {
|
|
15
15
|
try {
|
|
16
16
|
n(t.next(a));
|
|
17
|
-
} catch (
|
|
18
|
-
i(
|
|
17
|
+
} catch (h) {
|
|
18
|
+
i(h);
|
|
19
19
|
}
|
|
20
20
|
}, o = (a) => {
|
|
21
21
|
try {
|
|
22
22
|
n(t.throw(a));
|
|
23
|
-
} catch (
|
|
24
|
-
i(
|
|
23
|
+
} catch (h) {
|
|
24
|
+
i(h);
|
|
25
25
|
}
|
|
26
26
|
}, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
27
|
-
n((t = t.apply(
|
|
27
|
+
n((t = t.apply(c, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as Ce from "@tweenjs/tween.js";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import { Vector3 as
|
|
33
|
-
import { M as
|
|
34
|
-
import { EffectComposer as
|
|
35
|
-
import { RenderPass as
|
|
36
|
-
import { SSAOPass as
|
|
37
|
-
import { UnrealBloomPass as
|
|
30
|
+
import Dt from "deepmerge";
|
|
31
|
+
import Ut from "stats-gl";
|
|
32
|
+
import { Vector3 as H, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as Ft, RawShaderMaterial as Nt, MeshBasicMaterial as It, PointsMaterial as nt, SpriteMaterial as at, Color as Ht, Layers as jt, Vector2 as B, WebGLRenderTarget as Bt, HalfFloatType as Vt, MathUtils as Yt, Vector4 as Zt, Quaternion as lt, Spherical as Wt, Box3 as ht, Sphere as Kt, Raycaster as ct, AxesHelper as De, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as Ue, Scene as dt, Group as ke, Camera as Jt, Loader as pt, FileLoader as Se, Texture as fe, VideoTexture as es, LoadingManager as ts, DataTexture as ss, WebGLRenderer as is, REVISION as rs, Object3D as os, Timer as ns } from "three";
|
|
33
|
+
import { M as mt, B as Oe, a as as, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
|
|
34
|
+
import { EffectComposer as ze } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
|
+
import { RenderPass as ls } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
|
+
import { SSAOPass as hs } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
|
+
import { UnrealBloomPass as cs } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
38
38
|
import "three/examples/jsm/lines/LineMaterial";
|
|
39
39
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
40
40
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
@@ -45,15 +45,15 @@ import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
|
45
45
|
import "three-bvh-csg";
|
|
46
46
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
47
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
48
|
-
import { ShaderPass as
|
|
49
|
-
import { OutputPass as
|
|
48
|
+
import { ShaderPass as ds } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
49
|
+
import { OutputPass as ps } from "three/examples/jsm/postprocessing/OutputPass";
|
|
50
50
|
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
51
|
-
import { RectAreaLightHelper as
|
|
51
|
+
import { RectAreaLightHelper as ms } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
52
|
import { ViewHelper as us } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
|
-
import { generateUUID as
|
|
53
|
+
import { generateUUID as fs, makePromiseCreator as _s } from "esus-lite";
|
|
54
54
|
import { DRACOLoader as gs } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
55
|
import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
|
-
import { GLTFLoader as
|
|
56
|
+
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
57
|
import { LottieLoader as vs } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
58
|
import { a as Cs, C as Os, i as Es } from "./isPlainObject.module.js";
|
|
59
59
|
import { TransformControls as Ts } from "three/examples/jsm/controls/TransformControls";
|
|
@@ -61,7 +61,7 @@ const M = {
|
|
|
61
61
|
LEFT: 1,
|
|
62
62
|
RIGHT: 2,
|
|
63
63
|
MIDDLE: 4
|
|
64
|
-
},
|
|
64
|
+
}, d = Object.freeze({
|
|
65
65
|
NONE: 0,
|
|
66
66
|
ROTATE: 1,
|
|
67
67
|
TRUCK: 2,
|
|
@@ -88,64 +88,64 @@ const M = {
|
|
|
88
88
|
IN: 1,
|
|
89
89
|
OUT: -1
|
|
90
90
|
};
|
|
91
|
-
function Y(
|
|
92
|
-
return
|
|
91
|
+
function Y(c) {
|
|
92
|
+
return c.isPerspectiveCamera;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
94
|
+
function j(c) {
|
|
95
|
+
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2,
|
|
98
|
-
function
|
|
99
|
-
return Math.max(e, Math.min(t,
|
|
97
|
+
const $ = Math.PI * 2, Ie = Math.PI / 2, ut = 1e-5, ie = Math.PI / 180;
|
|
98
|
+
function z(c, e, t) {
|
|
99
|
+
return Math.max(e, Math.min(t, c));
|
|
100
100
|
}
|
|
101
|
-
function A(
|
|
102
|
-
return Math.abs(
|
|
101
|
+
function A(c, e = ut) {
|
|
102
|
+
return Math.abs(c) < e;
|
|
103
103
|
}
|
|
104
|
-
function P(
|
|
105
|
-
return A(
|
|
104
|
+
function P(c, e, t = ut) {
|
|
105
|
+
return A(c - e, t);
|
|
106
106
|
}
|
|
107
|
-
function He(
|
|
108
|
-
return Math.round(
|
|
107
|
+
function He(c, e) {
|
|
108
|
+
return Math.round(c / e) * e;
|
|
109
109
|
}
|
|
110
|
-
function re(
|
|
111
|
-
return isFinite(
|
|
110
|
+
function re(c) {
|
|
111
|
+
return isFinite(c) ? c : c < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
112
112
|
}
|
|
113
|
-
function oe(
|
|
114
|
-
return Math.abs(
|
|
113
|
+
function oe(c) {
|
|
114
|
+
return Math.abs(c) < Number.MAX_VALUE ? c : c * (1 / 0);
|
|
115
115
|
}
|
|
116
|
-
function ce(
|
|
116
|
+
function ce(c, e, t, s, i = 1 / 0, r) {
|
|
117
117
|
s = Math.max(1e-4, s);
|
|
118
118
|
const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
119
|
-
let
|
|
119
|
+
let h = c - e;
|
|
120
120
|
const m = e, p = i * s;
|
|
121
|
-
|
|
122
|
-
const v = (t.value + o *
|
|
121
|
+
h = z(h, -p, p), e = c - h;
|
|
122
|
+
const v = (t.value + o * h) * r;
|
|
123
123
|
t.value = (t.value - o * v) * a;
|
|
124
|
-
let
|
|
125
|
-
return m -
|
|
124
|
+
let _ = e + (h + v) * a;
|
|
125
|
+
return m - c > 0 == _ > m && (_ = m, t.value = (_ - m) / r), _;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function je(c, e, t, s, i = 1 / 0, r, o) {
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
|
-
const n = 2 / s, a = n * r,
|
|
130
|
-
let m = e.x, p = e.y, v = e.z,
|
|
131
|
-
const y = m, l = p,
|
|
129
|
+
const n = 2 / s, a = n * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
|
+
let m = e.x, p = e.y, v = e.z, _ = c.x - m, u = c.y - p, g = c.z - v;
|
|
131
|
+
const y = m, l = p, f = v, O = i * s, C = O * O, w = _ * _ + u * u + g * g;
|
|
132
132
|
if (w > C) {
|
|
133
133
|
const ve = Math.sqrt(w);
|
|
134
|
-
|
|
134
|
+
_ = _ / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
135
|
}
|
|
136
|
-
m =
|
|
137
|
-
const E = (t.x + n *
|
|
138
|
-
t.x = (t.x - n * E) *
|
|
139
|
-
const V = y -
|
|
140
|
-
return V * xt + le *
|
|
136
|
+
m = c.x - _, p = c.y - u, v = c.z - g;
|
|
137
|
+
const E = (t.x + n * _) * r, b = (t.y + n * u) * r, R = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * h, t.y = (t.y - n * b) * h, t.z = (t.z - n * R) * h, o.x = m + (_ + E) * h, o.y = p + (u + b) * h, o.z = v + (g + R) * h;
|
|
139
|
+
const V = y - c.x, le = l - c.y, wt = f - c.z, xt = o.x - y, bt = o.y - l, Lt = o.z - f;
|
|
140
|
+
return V * xt + le * bt + wt * Lt > 0 && (o.x = y, o.y = l, o.z = f, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - f) / r), o;
|
|
141
141
|
}
|
|
142
|
-
function Ee(
|
|
143
|
-
e.set(0, 0),
|
|
142
|
+
function Ee(c, e) {
|
|
143
|
+
e.set(0, 0), c.forEach((t) => {
|
|
144
144
|
e.x += t.clientX, e.y += t.clientY;
|
|
145
|
-
}), e.x /=
|
|
145
|
+
}), e.x /= c.length, e.y /= c.length;
|
|
146
146
|
}
|
|
147
|
-
function Te(
|
|
148
|
-
return
|
|
147
|
+
function Te(c, e) {
|
|
148
|
+
return j(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
150
|
class ws {
|
|
151
151
|
constructor() {
|
|
@@ -211,18 +211,18 @@ class ws {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const de = 1 / 8,
|
|
215
|
-
let T,
|
|
214
|
+
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
+
let T, Be, pe, we, D, x, L, G, ne, F, N, Z, Ve, Ye, k, ae, X, Ze, xe, We, be, Le, me;
|
|
216
216
|
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE,
|
|
218
|
+
T = e.THREE, Be = Object.freeze(new T.Vector3(0, 0, 0)), pe = Object.freeze(new T.Vector3(0, 1, 0)), we = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), x = new T.Vector3(), L = new T.Vector3(), G = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Ve = new T.Vector3(), Ye = new T.Vector3(), k = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), Ze = new T.Box3(), xe = new T.Sphere(), We = new T.Quaternion(), be = new T.Quaternion(), Le = new T.Matrix4(), me = new T.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
222
222
|
* @category Statics
|
|
223
223
|
*/
|
|
224
224
|
static get ACTION() {
|
|
225
|
-
return
|
|
225
|
+
return d;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Creates a `CameraControls` instance.
|
|
@@ -243,14 +243,14 @@ class J extends ws {
|
|
|
243
243
|
*/
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
246
|
-
}, this._enabled = !0, this._state =
|
|
246
|
+
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, f, O, C) => {
|
|
247
247
|
let w, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const
|
|
250
|
-
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed *
|
|
251
|
-
} else if (
|
|
252
|
-
const
|
|
253
|
-
w = this.truckSpeed * l * (
|
|
249
|
+
const b = x.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = b.length() * Math.tan(R * 0.5);
|
|
250
|
+
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * f * V / this._elementRect.height;
|
|
251
|
+
} else if (j(this._camera)) {
|
|
252
|
+
const b = this._camera;
|
|
253
|
+
w = this.truckSpeed * l * (b.right - b.left) / b.zoom / this._elementRect.width, E = this.truckSpeed * f * (b.top - b.bottom) / b.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
256
|
C ? (O ? this.setFocalOffset(
|
|
@@ -264,26 +264,26 @@ class J extends ws {
|
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
266
|
) : this.truck(w, E, !0);
|
|
267
|
-
}, this._rotateInternal = (l,
|
|
268
|
-
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed *
|
|
267
|
+
}, this._rotateInternal = (l, f) => {
|
|
268
|
+
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * f / this._elementRect.height;
|
|
269
269
|
this.rotate(O, C, !0);
|
|
270
|
-
}, this._dollyInternal = (l,
|
|
271
|
-
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C,
|
|
270
|
+
}, this._dollyInternal = (l, f, O) => {
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, b = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
|
-
), R =
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(
|
|
277
|
-
}, this._zoomInternal = (l,
|
|
275
|
+
), R = b - E;
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(b, !0)) : this._dollyToNoClamp(b, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : b) - w, this._dollyControlCoord.set(f, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
|
+
}, this._zoomInternal = (l, f, O) => {
|
|
278
278
|
const C = Math.pow(0.95, l * this.dollySpeed), w = this._zoom, E = this._zoom * C;
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(f, O));
|
|
280
280
|
}, typeof T == "undefined" && console.error(
|
|
281
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
282
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
|
-
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state =
|
|
286
|
-
|
|
285
|
+
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
286
|
+
x.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
288
|
new T.Vector3(),
|
|
289
289
|
new T.Vector3(),
|
|
@@ -293,14 +293,14 @@ class J extends ws {
|
|
|
293
293
|
new T.Vector3(-1 / 0, -1 / 0, -1 / 0),
|
|
294
294
|
new T.Vector3(1 / 0, 1 / 0, 1 / 0)
|
|
295
295
|
), 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 = {
|
|
296
|
-
left:
|
|
297
|
-
middle:
|
|
298
|
-
right:
|
|
299
|
-
wheel: Y(this._camera) ?
|
|
296
|
+
left: d.ROTATE,
|
|
297
|
+
middle: d.DOLLY,
|
|
298
|
+
right: d.TRUCK,
|
|
299
|
+
wheel: Y(this._camera) ? d.DOLLY : j(this._camera) ? d.ZOOM : d.NONE
|
|
300
300
|
}, this.touches = {
|
|
301
|
-
one:
|
|
302
|
-
two: Y(this._camera) ?
|
|
303
|
-
three:
|
|
301
|
+
one: d.TOUCH_ROTATE,
|
|
302
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : j(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
303
|
+
three: d.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
306
306
|
if (!this._enabled || !this._domElement) return;
|
|
@@ -309,9 +309,9 @@ class J extends ws {
|
|
|
309
309
|
if (w < this._interactiveArea.left || w > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
const C = this._findPointerByMouseButton(
|
|
312
|
+
const f = l.pointerType !== "mouse" ? null : (l.buttons & M.LEFT) === M.LEFT ? M.LEFT : (l.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (l.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
|
|
313
|
+
if (f !== null) {
|
|
314
|
+
const C = this._findPointerByMouseButton(f);
|
|
315
315
|
C && this._disposePointer(C);
|
|
316
316
|
}
|
|
317
317
|
if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
@@ -322,7 +322,7 @@ class J extends ws {
|
|
|
322
322
|
clientY: l.clientY,
|
|
323
323
|
deltaX: 0,
|
|
324
324
|
deltaY: 0,
|
|
325
|
-
mouseButton:
|
|
325
|
+
mouseButton: f
|
|
326
326
|
};
|
|
327
327
|
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener(
|
|
328
328
|
"pointermove",
|
|
@@ -338,7 +338,7 @@ class J extends ws {
|
|
|
338
338
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, v(l);
|
|
339
339
|
}, n = (l) => {
|
|
340
340
|
l.cancelable && l.preventDefault();
|
|
341
|
-
const
|
|
341
|
+
const f = l.pointerId, O = this._lockedPointer || this._findPointerById(f);
|
|
342
342
|
if (O) {
|
|
343
343
|
if (O.clientX = l.clientX, O.clientY = l.clientY, O.deltaX = l.movementX, O.deltaY = l.movementY, this._state = 0, l.pointerType === "touch")
|
|
344
344
|
switch (this._activePointers.length) {
|
|
@@ -354,15 +354,15 @@ class J extends ws {
|
|
|
354
354
|
}
|
|
355
355
|
else
|
|
356
356
|
(!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);
|
|
357
|
-
|
|
357
|
+
_();
|
|
358
358
|
}
|
|
359
359
|
}, a = (l) => {
|
|
360
|
-
const
|
|
361
|
-
if (!(
|
|
362
|
-
if (
|
|
360
|
+
const f = this._findPointerById(l.pointerId);
|
|
361
|
+
if (!(f && f === this._lockedPointer)) {
|
|
362
|
+
if (f && this._disposePointer(f), l.pointerType === "touch")
|
|
363
363
|
switch (this._activePointers.length) {
|
|
364
364
|
case 0:
|
|
365
|
-
this._state =
|
|
365
|
+
this._state = d.NONE;
|
|
366
366
|
break;
|
|
367
367
|
case 1:
|
|
368
368
|
this._state = this.touches.one;
|
|
@@ -375,45 +375,45 @@ class J extends ws {
|
|
|
375
375
|
break;
|
|
376
376
|
}
|
|
377
377
|
else
|
|
378
|
-
this._state =
|
|
378
|
+
this._state = d.NONE;
|
|
379
379
|
u();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
|
-
let
|
|
382
|
+
let h = -1;
|
|
383
383
|
const m = (l) => {
|
|
384
|
-
if (!this._domElement || !this._enabled || this.mouseButtons.wheel ===
|
|
384
|
+
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
385
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
386
|
-
const E = this._domElement.getBoundingClientRect(),
|
|
387
|
-
if (
|
|
386
|
+
const E = this._domElement.getBoundingClientRect(), b = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
387
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel ===
|
|
390
|
+
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
|
|
391
391
|
const E = performance.now();
|
|
392
|
-
|
|
392
|
+
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const f = xs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / f : l.deltaY / (f * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
|
-
case
|
|
396
|
+
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
398
398
|
break;
|
|
399
399
|
}
|
|
400
|
-
case
|
|
400
|
+
case d.TRUCK: {
|
|
401
401
|
this._truckInternal(l.deltaX, l.deltaY, !1, !1), this._isUserControllingTruck = !0;
|
|
402
402
|
break;
|
|
403
403
|
}
|
|
404
|
-
case
|
|
404
|
+
case d.SCREEN_PAN: {
|
|
405
405
|
this._truckInternal(l.deltaX, l.deltaY, !1, !0), this._isUserControllingTruck = !0;
|
|
406
406
|
break;
|
|
407
407
|
}
|
|
408
|
-
case
|
|
408
|
+
case d.OFFSET: {
|
|
409
409
|
this._truckInternal(l.deltaX, l.deltaY, !0, !1), this._isUserControllingOffset = !0;
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
|
-
case
|
|
412
|
+
case d.DOLLY: {
|
|
413
413
|
this._dollyInternal(-O, C, w), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
|
-
case
|
|
416
|
+
case d.ZOOM: {
|
|
417
417
|
this._zoomInternal(-O, C, w), this._isUserControllingZoom = !0;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
@@ -422,7 +422,7 @@ class J extends ws {
|
|
|
422
422
|
}, p = (l) => {
|
|
423
423
|
if (!(!this._domElement || !this._enabled)) {
|
|
424
424
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
425
|
-
const
|
|
425
|
+
const f = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(f);
|
|
426
426
|
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener(
|
|
427
427
|
"pointermove",
|
|
428
428
|
n,
|
|
@@ -440,8 +440,8 @@ class J extends ws {
|
|
|
440
440
|
if (Ee(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
441
441
|
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
|
|
442
442
|
r.set(0, w);
|
|
443
|
-
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
444
|
-
i.set(E,
|
|
443
|
+
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, b = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
444
|
+
i.set(E, b);
|
|
445
445
|
}
|
|
446
446
|
if (this._state = 0, !l)
|
|
447
447
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
@@ -459,30 +459,30 @@ class J extends ws {
|
|
|
459
459
|
}
|
|
460
460
|
else
|
|
461
461
|
!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);
|
|
462
|
-
((this._state &
|
|
463
|
-
},
|
|
462
|
+
((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" });
|
|
463
|
+
}, _ = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
465
|
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
466
|
-
const
|
|
467
|
-
if (i.copy(D), ((this._state &
|
|
468
|
-
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0,
|
|
469
|
-
(this._state &
|
|
470
|
-
|
|
466
|
+
const f = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = f ? -f.deltaX : i.x - D.x, C = f ? -f.deltaY : i.y - D.y;
|
|
467
|
+
if (i.copy(D), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
+
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, b = this.dollyDragInverted ? -1 : 1;
|
|
469
|
+
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
470
|
+
b * C * de,
|
|
471
471
|
w,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
|
-
|
|
474
|
+
b * C * de,
|
|
475
475
|
w,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
|
-
if ((this._state &
|
|
480
|
-
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY,
|
|
481
|
-
r.set(0,
|
|
479
|
+
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
480
|
+
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, b = Math.sqrt(w * w + E * E), R = r.y - b;
|
|
481
|
+
r.set(0, b);
|
|
482
482
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
483
|
-
(this._state &
|
|
483
|
+
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
485
|
-
((this._state &
|
|
485
|
+
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
486
|
}, u = () => {
|
|
487
487
|
Ee(this._activePointers, D), i.copy(D), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
|
|
488
488
|
"pointermove",
|
|
@@ -520,8 +520,8 @@ class J extends ws {
|
|
|
520
520
|
{ passive: !1 }
|
|
521
521
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), v());
|
|
522
522
|
}, this.unlockPointer = () => {
|
|
523
|
-
var l,
|
|
524
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (
|
|
523
|
+
var l, f, O;
|
|
524
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (f = this._domElement) === null || f === void 0 || f.ownerDocument.removeEventListener(
|
|
525
525
|
"pointerlockchange",
|
|
526
526
|
g
|
|
527
527
|
), (O = this._domElement) === null || O === void 0 || O.ownerDocument.removeEventListener(
|
|
@@ -556,7 +556,7 @@ class J extends ws {
|
|
|
556
556
|
y
|
|
557
557
|
));
|
|
558
558
|
}, this.cancel = () => {
|
|
559
|
-
this._state !==
|
|
559
|
+
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
|
|
560
560
|
}, t && this.connect(t), this.update(0);
|
|
561
561
|
}
|
|
562
562
|
/**
|
|
@@ -646,11 +646,11 @@ class J extends ws {
|
|
|
646
646
|
* @category Properties
|
|
647
647
|
*/
|
|
648
648
|
set interactiveArea(e) {
|
|
649
|
-
this._interactiveArea.width =
|
|
649
|
+
this._interactiveArea.width = z(e.width, 0, 1), this._interactiveArea.height = z(e.height, 0, 1), this._interactiveArea.x = z(
|
|
650
650
|
e.x,
|
|
651
651
|
0,
|
|
652
652
|
1 - this._interactiveArea.width
|
|
653
|
-
), this._interactiveArea.y =
|
|
653
|
+
), this._interactiveArea.y = z(
|
|
654
654
|
e.y,
|
|
655
655
|
0,
|
|
656
656
|
1 - this._interactiveArea.height
|
|
@@ -788,11 +788,11 @@ class J extends ws {
|
|
|
788
788
|
*/
|
|
789
789
|
rotateTo(e, t, s = !1) {
|
|
790
790
|
this._isUserControllingRotate = !1;
|
|
791
|
-
const i =
|
|
791
|
+
const i = z(
|
|
792
792
|
e,
|
|
793
793
|
this.minAzimuthAngle,
|
|
794
794
|
this.maxAzimuthAngle
|
|
795
|
-
), r =
|
|
795
|
+
), r = z(t, this.minPolarAngle, this.maxPolarAngle);
|
|
796
796
|
this._sphericalEnd.theta = i, this._sphericalEnd.phi = r, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, s || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi);
|
|
797
797
|
const o = !s || P(
|
|
798
798
|
this._spherical.theta,
|
|
@@ -822,7 +822,7 @@ class J extends ws {
|
|
|
822
822
|
*/
|
|
823
823
|
dollyTo(e, t = !1) {
|
|
824
824
|
return this._isUserControllingDolly = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0, this._dollyToNoClamp(
|
|
825
|
-
|
|
825
|
+
z(e, this.minDistance, this.maxDistance),
|
|
826
826
|
t
|
|
827
827
|
);
|
|
828
828
|
}
|
|
@@ -880,7 +880,7 @@ class J extends ws {
|
|
|
880
880
|
* @category Methods
|
|
881
881
|
*/
|
|
882
882
|
zoomTo(e, t = !1) {
|
|
883
|
-
this._isUserControllingZoom = !1, this._zoomEnd =
|
|
883
|
+
this._isUserControllingZoom = !1, this._zoomEnd = z(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
|
|
884
884
|
const s = !t || P(this._zoom, this._zoomEnd, this.restThreshold);
|
|
885
885
|
return this._changedZoom = 0, this._createOnRestPromise(s);
|
|
886
886
|
}
|
|
@@ -900,7 +900,7 @@ class J extends ws {
|
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
902
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
903
|
-
const i =
|
|
903
|
+
const i = x.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -910,8 +910,8 @@ class J extends ws {
|
|
|
910
910
|
* @category Methods
|
|
911
911
|
*/
|
|
912
912
|
forward(e, t = !1) {
|
|
913
|
-
|
|
914
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
x.setFromMatrixColumn(this._camera.matrix, 0), x.crossVectors(this._camera.up, x), x.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(x);
|
|
915
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -921,10 +921,10 @@ class J extends ws {
|
|
|
921
921
|
* @category Methods
|
|
922
922
|
*/
|
|
923
923
|
elevate(e, t = !1) {
|
|
924
|
-
return
|
|
925
|
-
this._targetEnd.x +
|
|
926
|
-
this._targetEnd.y +
|
|
927
|
-
this._targetEnd.z +
|
|
924
|
+
return x.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
925
|
+
this._targetEnd.x + x.x,
|
|
926
|
+
this._targetEnd.y + x.y,
|
|
927
|
+
this._targetEnd.z + x.z,
|
|
928
928
|
t
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -938,7 +938,7 @@ class J extends ws {
|
|
|
938
938
|
*/
|
|
939
939
|
moveTo(e, t, s, i = !1) {
|
|
940
940
|
this._isUserControllingTruck = !1;
|
|
941
|
-
const r =
|
|
941
|
+
const r = x.set(e, t, s).sub(this._targetEnd);
|
|
942
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
943
943
|
const o = !i || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
944
944
|
return this._createOnRestPromise(o);
|
|
@@ -953,7 +953,7 @@ class J extends ws {
|
|
|
953
953
|
* @category Methods
|
|
954
954
|
*/
|
|
955
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
956
|
-
const n =
|
|
956
|
+
const n = x.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
957
957
|
return this.setPosition(
|
|
958
958
|
n.x,
|
|
959
959
|
n.y,
|
|
@@ -981,19 +981,19 @@ class J extends ws {
|
|
|
981
981
|
paddingBottom: o = 0,
|
|
982
982
|
paddingTop: n = 0
|
|
983
983
|
} = {}) {
|
|
984
|
-
const a = [],
|
|
985
|
-
|
|
984
|
+
const a = [], h = e.isBox3 ? X.copy(e) : X.setFromObject(e);
|
|
985
|
+
h.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const m = He(this._sphericalEnd.theta,
|
|
988
|
+
const m = He(this._sphericalEnd.theta, Ie), p = He(this._sphericalEnd.phi, Ie);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const v =
|
|
991
|
-
u &&
|
|
992
|
-
const g =
|
|
993
|
-
L.copy(
|
|
994
|
-
const y = g.getSize(
|
|
990
|
+
const v = x.setFromSpherical(this._sphericalEnd).normalize(), _ = We.setFromUnitVectors(v, we), u = P(Math.abs(v.y), 1);
|
|
991
|
+
u && _.multiply(be.setFromAxisAngle(pe, m)), _.multiply(this._yAxisUpSpaceInverse);
|
|
992
|
+
const g = Ze.makeEmpty();
|
|
993
|
+
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(we, v), u && _.premultiply(be.invert()), _.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(x), l = g.getCenter(L).applyQuaternion(_);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
|
-
const
|
|
996
|
+
const f = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
998
998
|
y.y,
|
|
999
999
|
y.z,
|
|
@@ -1001,9 +1001,9 @@ class J extends ws {
|
|
|
1001
1001
|
);
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
|
-
), a.push(this.dollyTo(
|
|
1005
|
-
} else if (
|
|
1006
|
-
const
|
|
1004
|
+
), a.push(this.dollyTo(f, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
|
+
} else if (j(this._camera)) {
|
|
1006
|
+
const f = this._camera, O = f.right - f.left, C = f.top - f.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1009
1009
|
), a.push(this.zoomTo(w, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
@@ -1017,7 +1017,7 @@ class J extends ws {
|
|
|
1017
1017
|
* @category Methods
|
|
1018
1018
|
*/
|
|
1019
1019
|
fitToSphere(e, t) {
|
|
1020
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1020
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, xe) : xe.copy(e);
|
|
1021
1021
|
if (s.push(
|
|
1022
1022
|
this.moveTo(
|
|
1023
1023
|
r.center.x,
|
|
@@ -1028,9 +1028,9 @@ class J extends ws {
|
|
|
1028
1028
|
), Y(this._camera)) {
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
|
-
} else if (
|
|
1032
|
-
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius,
|
|
1033
|
-
s.push(this.zoomTo(
|
|
1031
|
+
} else if (j(this._camera)) {
|
|
1032
|
+
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, h = Math.min(o / a, n / a);
|
|
1033
|
+
s.push(this.zoomTo(h, t));
|
|
1034
1034
|
}
|
|
1035
1035
|
return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
|
|
1036
1036
|
}
|
|
@@ -1047,9 +1047,9 @@ class J extends ws {
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1049
1049
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1050
|
-
const a = L.set(i, r, o),
|
|
1050
|
+
const a = L.set(i, r, o), h = x.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
|
-
|
|
1052
|
+
h.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1054
1054
|
const m = !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(
|
|
1055
1055
|
this._spherical.theta,
|
|
@@ -1084,21 +1084,21 @@ class J extends ws {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, _, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g =
|
|
1090
|
-
|
|
1089
|
+
const g = x.set(i, r, o), y = L.set(e, t, s);
|
|
1090
|
+
k.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(m, p, v),
|
|
1093
|
+
const l = G.set(m, p, v), f = L.set(n, a, h);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
|
-
|
|
1096
|
-
), this._targetEnd.copy(g.lerp(l,
|
|
1097
|
-
const O = ae.theta -
|
|
1095
|
+
f.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
|
+
), this._targetEnd.copy(g.lerp(l, _));
|
|
1097
|
+
const O = ae.theta - k.theta, C = ae.phi - k.phi, w = ae.radius - k.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1099
|
+
k.radius + w * _,
|
|
1100
|
+
k.phi + C * _,
|
|
1101
|
+
k.theta + O * _
|
|
1102
1102
|
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
1103
|
const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
@@ -1145,7 +1145,7 @@ class J extends ws {
|
|
|
1145
1145
|
* @category Methods
|
|
1146
1146
|
*/
|
|
1147
1147
|
setTarget(e, t, s, i = !1) {
|
|
1148
|
-
const r = this.getPosition(
|
|
1148
|
+
const r = this.getPosition(x), o = this.setLookAt(
|
|
1149
1149
|
r.x,
|
|
1150
1150
|
r.y,
|
|
1151
1151
|
r.z,
|
|
@@ -1154,7 +1154,7 @@ class J extends ws {
|
|
|
1154
1154
|
s,
|
|
1155
1155
|
i
|
|
1156
1156
|
);
|
|
1157
|
-
return this._sphericalEnd.phi =
|
|
1157
|
+
return this._sphericalEnd.phi = z(
|
|
1158
1158
|
this._sphericalEnd.phi,
|
|
1159
1159
|
this.minPolarAngle,
|
|
1160
1160
|
this.maxPolarAngle
|
|
@@ -1195,8 +1195,8 @@ class J extends ws {
|
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
1197
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1198
|
-
const i =
|
|
1199
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1198
|
+
const i = x.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1199
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), x.copy(F).add(N).add(Z), x.z = x.z + r, this.dollyTo(r, !1), this.setFocalOffset(-x.x, x.y, -x.z, !1), this.moveTo(e, t, s, !1);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1311,7 +1311,7 @@ class J extends ws {
|
|
|
1311
1311
|
reset(e = !1) {
|
|
1312
1312
|
if (!P(this._camera.up.x, this._cameraUp0.x) || !P(this._camera.up.y, this._cameraUp0.y) || !P(this._camera.up.z, this._cameraUp0.z)) {
|
|
1313
1313
|
this._camera.up.copy(this._cameraUp0);
|
|
1314
|
-
const s = this.getPosition(
|
|
1314
|
+
const s = this.getPosition(x);
|
|
1315
1315
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1316
1316
|
}
|
|
1317
1317
|
const t = [
|
|
@@ -1355,9 +1355,9 @@ class J extends ws {
|
|
|
1355
1355
|
* @category Methods
|
|
1356
1356
|
*/
|
|
1357
1357
|
applyCameraUp() {
|
|
1358
|
-
const e =
|
|
1358
|
+
const e = x.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1359
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1360
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(x);
|
|
1361
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
@@ -1368,7 +1368,7 @@ class J extends ws {
|
|
|
1368
1368
|
* @category Methods
|
|
1369
1369
|
*/
|
|
1370
1370
|
update(e) {
|
|
1371
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r =
|
|
1371
|
+
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r = Ve.subVectors(this._targetEnd, this._target), o = Ye.subVectors(
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
@@ -1415,7 +1415,7 @@ class J extends ws {
|
|
|
1415
1415
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1416
1416
|
else {
|
|
1417
1417
|
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1418
|
-
|
|
1418
|
+
je(
|
|
1419
1419
|
this._target,
|
|
1420
1420
|
this._targetEnd,
|
|
1421
1421
|
this._targetVelocity,
|
|
@@ -1429,7 +1429,7 @@ class J extends ws {
|
|
|
1429
1429
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1430
1430
|
else {
|
|
1431
1431
|
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1432
|
-
|
|
1432
|
+
je(
|
|
1433
1433
|
this._focalOffset,
|
|
1434
1434
|
this._focalOffsetEnd,
|
|
1435
1435
|
this._focalOffsetVelocity,
|
|
@@ -1454,41 +1454,41 @@ class J extends ws {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const p = this._spherical.radius - this._lastDistance, v = this._camera,
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne), u = x.copy(_).cross(v.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
-
const g = L.crossVectors(u,
|
|
1459
|
+
const g = L.crossVectors(u, _), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), f = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
1461
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
), C =
|
|
1465
|
+
), C = x.copy(this._targetEnd).lerp(O, f), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
1466
|
if (this.infinityDolly && (w || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
-
const R = L.copy(
|
|
1468
|
+
const R = L.copy(_).multiplyScalar(-p);
|
|
1469
1469
|
C.add(R);
|
|
1470
1470
|
}
|
|
1471
1471
|
this._boundary.clampPoint(C, C);
|
|
1472
|
-
const
|
|
1473
|
-
this._targetEnd.copy(C), this._target.add(
|
|
1474
|
-
} else if (
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera,
|
|
1472
|
+
const b = L.subVectors(C, this._targetEnd);
|
|
1473
|
+
this._targetEnd.copy(C), this._target.add(b), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
|
+
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, _ = x.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(u.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, f = this._getCameraDirection(ne), O = this._targetEnd.dot(f), C = x.copy(this._targetEnd).lerp(g, l), w = C.dot(f), E = f.multiplyScalar(
|
|
1480
1480
|
w - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1483
|
-
const
|
|
1484
|
-
this._targetEnd.copy(C), this._target.add(
|
|
1483
|
+
const b = L.subVectors(C, this._targetEnd);
|
|
1484
|
+
this._targetEnd.copy(C), this._target.add(b), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1488
1488
|
const a = this._collisionTest();
|
|
1489
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z),
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), x.copy(F).add(N).add(Z), this._camera.position.add(x), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
|
-
|
|
1491
|
+
x.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const m = this._needsUpdate;
|
|
@@ -1515,7 +1515,7 @@ class J extends ws {
|
|
|
1515
1515
|
truckSpeed: this.truckSpeed,
|
|
1516
1516
|
dollyToCursor: this.dollyToCursor,
|
|
1517
1517
|
target: this._targetEnd.toArray(),
|
|
1518
|
-
position:
|
|
1518
|
+
position: x.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1519
1519
|
zoom: this._zoomEnd,
|
|
1520
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1521
1521
|
target0: this._target0.toArray(),
|
|
@@ -1532,9 +1532,9 @@ class J extends ws {
|
|
|
1532
1532
|
*/
|
|
1533
1533
|
fromJSON(e, t = !1) {
|
|
1534
1534
|
const s = JSON.parse(e);
|
|
1535
|
-
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t),
|
|
1536
|
-
|
|
1537
|
-
), this.rotateTo(
|
|
1535
|
+
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), k.setFromVector3(
|
|
1536
|
+
x.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1537
|
+
), this.rotateTo(k.theta, k.phi, t), this.dollyTo(k.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1538
1538
|
s.focalOffset[0],
|
|
1539
1539
|
s.focalOffset[1],
|
|
1540
1540
|
s.focalOffset[2],
|
|
@@ -1598,15 +1598,15 @@ class J extends ws {
|
|
|
1598
1598
|
if (s === 0)
|
|
1599
1599
|
return e.add(t).add(n);
|
|
1600
1600
|
{
|
|
1601
|
-
const
|
|
1602
|
-
return e.add(L.copy(t).multiplyScalar(
|
|
1601
|
+
const h = 1 + s * a / t.dot(n);
|
|
1602
|
+
return e.add(L.copy(t).multiplyScalar(h)).add(n.multiplyScalar(1 - s));
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
1605
|
_updateNearPlaneCorners() {
|
|
1606
1606
|
if (Y(this._camera)) {
|
|
1607
1607
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1608
1608
|
this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
|
|
1609
|
-
} else if (
|
|
1609
|
+
} else if (j(this._camera)) {
|
|
1610
1610
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
1611
1611
|
this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
|
|
1612
1612
|
}
|
|
@@ -1617,7 +1617,7 @@ class J extends ws {
|
|
|
1617
1617
|
if (!(this.colliderMeshes.length >= 1) || Te(this._camera, "_collisionTest"))
|
|
1618
1618
|
return e;
|
|
1619
1619
|
const s = this._getTargetDirection(ne);
|
|
1620
|
-
Le.lookAt(
|
|
1620
|
+
Le.lookAt(Be, s, this._camera.up);
|
|
1621
1621
|
for (let i = 0; i < 4; i++) {
|
|
1622
1622
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1623
1623
|
r.applyMatrix4(Le);
|
|
@@ -1703,22 +1703,22 @@ class J extends ws {
|
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
1704
|
const m = a.attributes.position;
|
|
1705
1705
|
for (let p = 0, v = m.count; p < v; p++)
|
|
1706
|
-
|
|
1706
|
+
x.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(x));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null,
|
|
1710
|
+
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ke = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1711
1711
|
return Function.prototype.apply.call(e, t, s);
|
|
1712
|
-
},
|
|
1713
|
-
Q && typeof Q.ownKeys == "function" ?
|
|
1712
|
+
}, ue;
|
|
1713
|
+
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
1714
1714
|
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
1715
|
-
} :
|
|
1715
|
+
} : ue = function(e) {
|
|
1716
1716
|
return Object.getOwnPropertyNames(e);
|
|
1717
1717
|
};
|
|
1718
|
-
function
|
|
1719
|
-
console && console.warn && console.warn(
|
|
1718
|
+
function bs(c) {
|
|
1719
|
+
console && console.warn && console.warn(c);
|
|
1720
1720
|
}
|
|
1721
|
-
var
|
|
1721
|
+
var ft = Number.isNaN || function(e) {
|
|
1722
1722
|
return e !== e;
|
|
1723
1723
|
};
|
|
1724
1724
|
function S() {
|
|
@@ -1730,35 +1730,35 @@ S.EventEmitter = S;
|
|
|
1730
1730
|
S.prototype._events = void 0;
|
|
1731
1731
|
S.prototype._eventsCount = 0;
|
|
1732
1732
|
S.prototype._maxListeners = void 0;
|
|
1733
|
-
var
|
|
1734
|
-
function ge(
|
|
1735
|
-
if (typeof
|
|
1736
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof
|
|
1733
|
+
var $e = 10;
|
|
1734
|
+
function ge(c) {
|
|
1735
|
+
if (typeof c != "function")
|
|
1736
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof c);
|
|
1737
1737
|
}
|
|
1738
1738
|
Object.defineProperty(S, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
|
-
return
|
|
1741
|
+
return $e;
|
|
1742
1742
|
},
|
|
1743
|
-
set: function(
|
|
1744
|
-
if (typeof
|
|
1745
|
-
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' +
|
|
1746
|
-
|
|
1743
|
+
set: function(c) {
|
|
1744
|
+
if (typeof c != "number" || c < 0 || ft(c))
|
|
1745
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + c + ".");
|
|
1746
|
+
$e = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
S.init = function() {
|
|
1750
1750
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
1751
1751
|
};
|
|
1752
1752
|
S.prototype.setMaxListeners = function(e) {
|
|
1753
|
-
if (typeof e != "number" || e < 0 ||
|
|
1753
|
+
if (typeof e != "number" || e < 0 || ft(e))
|
|
1754
1754
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1755
1755
|
return this._maxListeners = e, this;
|
|
1756
1756
|
};
|
|
1757
|
-
function
|
|
1758
|
-
return
|
|
1757
|
+
function _t(c) {
|
|
1758
|
+
return c._maxListeners === void 0 ? S.defaultMaxListeners : c._maxListeners;
|
|
1759
1759
|
}
|
|
1760
1760
|
S.prototype.getMaxListeners = function() {
|
|
1761
|
-
return
|
|
1761
|
+
return _t(this);
|
|
1762
1762
|
};
|
|
1763
1763
|
S.prototype.emit = function(e) {
|
|
1764
1764
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
@@ -1778,47 +1778,47 @@ S.prototype.emit = function(e) {
|
|
|
1778
1778
|
if (a === void 0)
|
|
1779
1779
|
return !1;
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
|
-
|
|
1781
|
+
Ke(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var
|
|
1784
|
-
|
|
1783
|
+
for (var h = a.length, m = Ot(a, h), s = 0; s < h; ++s)
|
|
1784
|
+
Ke(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
|
-
function
|
|
1787
|
+
function gt(c, e, t, s) {
|
|
1788
1788
|
var i, r, o;
|
|
1789
|
-
if (ge(t), r =
|
|
1789
|
+
if (ge(t), r = c._events, r === void 0 ? (r = c._events = /* @__PURE__ */ Object.create(null), c._eventsCount = 0) : (r.newListener !== void 0 && (c.emit(
|
|
1790
1790
|
"newListener",
|
|
1791
1791
|
e,
|
|
1792
1792
|
t.listener ? t.listener : t
|
|
1793
|
-
), r =
|
|
1794
|
-
o = r[e] = t, ++
|
|
1795
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i =
|
|
1793
|
+
), r = c._events), o = r[e]), o === void 0)
|
|
1794
|
+
o = r[e] = t, ++c._eventsCount;
|
|
1795
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = _t(c), i > 0 && o.length > i && !o.warned) {
|
|
1796
1796
|
o.warned = !0;
|
|
1797
1797
|
var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1798
|
-
n.name = "MaxListenersExceededWarning", n.emitter =
|
|
1798
|
+
n.name = "MaxListenersExceededWarning", n.emitter = c, n.type = e, n.count = o.length, bs(n);
|
|
1799
1799
|
}
|
|
1800
|
-
return
|
|
1800
|
+
return c;
|
|
1801
1801
|
}
|
|
1802
1802
|
S.prototype.addListener = function(e, t) {
|
|
1803
|
-
return
|
|
1803
|
+
return gt(this, e, t, !1);
|
|
1804
1804
|
};
|
|
1805
1805
|
S.prototype.on = S.prototype.addListener;
|
|
1806
1806
|
S.prototype.prependListener = function(e, t) {
|
|
1807
|
-
return
|
|
1807
|
+
return gt(this, e, t, !0);
|
|
1808
1808
|
};
|
|
1809
1809
|
function Ls() {
|
|
1810
1810
|
if (!this.fired)
|
|
1811
1811
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1814
|
-
var s = { fired: !1, wrapFn: void 0, target:
|
|
1813
|
+
function yt(c, e, t) {
|
|
1814
|
+
var s = { fired: !1, wrapFn: void 0, target: c, type: e, listener: t }, i = Ls.bind(s);
|
|
1815
1815
|
return i.listener = t, s.wrapFn = i, i;
|
|
1816
1816
|
}
|
|
1817
1817
|
S.prototype.once = function(e, t) {
|
|
1818
|
-
return ge(t), this.on(e,
|
|
1818
|
+
return ge(t), this.on(e, yt(this, e, t)), this;
|
|
1819
1819
|
};
|
|
1820
1820
|
S.prototype.prependOnceListener = function(e, t) {
|
|
1821
|
-
return ge(t), this.prependListener(e,
|
|
1821
|
+
return ge(t), this.prependListener(e, yt(this, e, t)), this;
|
|
1822
1822
|
};
|
|
1823
1823
|
S.prototype.removeListener = function(e, t) {
|
|
1824
1824
|
var s, i, r, o, n;
|
|
@@ -1860,27 +1860,27 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1864
|
-
var s =
|
|
1863
|
+
function vt(c, e, t) {
|
|
1864
|
+
var s = c._events;
|
|
1865
1865
|
if (s === void 0)
|
|
1866
1866
|
return [];
|
|
1867
1867
|
var i = s[e];
|
|
1868
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ss(i) :
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ss(i) : Ot(i, i.length);
|
|
1869
1869
|
}
|
|
1870
1870
|
S.prototype.listeners = function(e) {
|
|
1871
|
-
return
|
|
1871
|
+
return vt(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
1873
|
S.prototype.rawListeners = function(e) {
|
|
1874
|
-
return
|
|
1874
|
+
return vt(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
|
-
S.listenerCount = function(
|
|
1877
|
-
return typeof
|
|
1876
|
+
S.listenerCount = function(c, e) {
|
|
1877
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(e) : Ct.call(c, e);
|
|
1878
1878
|
};
|
|
1879
|
-
S.prototype.listenerCount =
|
|
1880
|
-
function
|
|
1879
|
+
S.prototype.listenerCount = Ct;
|
|
1880
|
+
function Ct(c) {
|
|
1881
1881
|
var e = this._events;
|
|
1882
1882
|
if (e !== void 0) {
|
|
1883
|
-
var t = e[
|
|
1883
|
+
var t = e[c];
|
|
1884
1884
|
if (typeof t == "function")
|
|
1885
1885
|
return 1;
|
|
1886
1886
|
if (t !== void 0)
|
|
@@ -1889,46 +1889,46 @@ function Ot(h) {
|
|
|
1889
1889
|
return 0;
|
|
1890
1890
|
}
|
|
1891
1891
|
S.prototype.eventNames = function() {
|
|
1892
|
-
return this._eventsCount > 0 ?
|
|
1892
|
+
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function Ot(c, e) {
|
|
1895
1895
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1896
|
-
t[s] =
|
|
1896
|
+
t[s] = c[s];
|
|
1897
1897
|
return t;
|
|
1898
1898
|
}
|
|
1899
|
-
function Ps(
|
|
1900
|
-
for (; e + 1 <
|
|
1901
|
-
|
|
1902
|
-
|
|
1899
|
+
function Ps(c, e) {
|
|
1900
|
+
for (; e + 1 < c.length; e++)
|
|
1901
|
+
c[e] = c[e + 1];
|
|
1902
|
+
c.pop();
|
|
1903
1903
|
}
|
|
1904
|
-
function Ss(
|
|
1905
|
-
for (var e = new Array(
|
|
1906
|
-
e[t] =
|
|
1904
|
+
function Ss(c) {
|
|
1905
|
+
for (var e = new Array(c.length), t = 0; t < e.length; ++t)
|
|
1906
|
+
e[t] = c[t].listener || c[t];
|
|
1907
1907
|
return e;
|
|
1908
1908
|
}
|
|
1909
|
-
function As(
|
|
1909
|
+
function As(c, e) {
|
|
1910
1910
|
return new Promise(function(t, s) {
|
|
1911
1911
|
function i(o) {
|
|
1912
|
-
|
|
1912
|
+
c.removeListener(e, r), s(o);
|
|
1913
1913
|
}
|
|
1914
1914
|
function r() {
|
|
1915
|
-
typeof
|
|
1915
|
+
typeof c.removeListener == "function" && c.removeListener("error", i), t([].slice.call(arguments));
|
|
1916
1916
|
}
|
|
1917
|
-
|
|
1917
|
+
Et(c, e, r, { once: !0 }), e !== "error" && Ms(c, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
|
-
function Ms(
|
|
1921
|
-
typeof
|
|
1920
|
+
function Ms(c, e, t) {
|
|
1921
|
+
typeof c.on == "function" && Et(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1924
|
-
if (typeof
|
|
1925
|
-
s.once ?
|
|
1926
|
-
else if (typeof
|
|
1927
|
-
|
|
1928
|
-
s.once &&
|
|
1923
|
+
function Et(c, e, t, s) {
|
|
1924
|
+
if (typeof c.on == "function")
|
|
1925
|
+
s.once ? c.once(e, t) : c.on(e, t);
|
|
1926
|
+
else if (typeof c.addEventListener == "function")
|
|
1927
|
+
c.addEventListener(e, function i(r) {
|
|
1928
|
+
s.once && c.removeEventListener(e, i), t(r);
|
|
1929
1929
|
});
|
|
1930
1930
|
else
|
|
1931
|
-
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof
|
|
1931
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof c);
|
|
1932
1932
|
}
|
|
1933
1933
|
var ye = Ae.exports;
|
|
1934
1934
|
let Rs = class {
|
|
@@ -1991,11 +1991,11 @@ class ee {
|
|
|
1991
1991
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
1992
1992
|
}
|
|
1993
1993
|
}
|
|
1994
|
-
const
|
|
1994
|
+
const Tt = {
|
|
1995
1995
|
fov: 45,
|
|
1996
1996
|
near: 1,
|
|
1997
1997
|
far: 1e3,
|
|
1998
|
-
up: new
|
|
1998
|
+
up: new H(0, 1, 0)
|
|
1999
1999
|
};
|
|
2000
2000
|
class Ds extends ee {
|
|
2001
2001
|
constructor(e) {
|
|
@@ -2004,9 +2004,9 @@ class Ds extends ee {
|
|
|
2004
2004
|
get camera() {
|
|
2005
2005
|
return this.controller;
|
|
2006
2006
|
}
|
|
2007
|
-
addPerspectiveCamera(e =
|
|
2008
|
-
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height,
|
|
2009
|
-
return
|
|
2007
|
+
addPerspectiveCamera(e = Tt, t) {
|
|
2008
|
+
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, h = new kt(s, a, r, i);
|
|
2009
|
+
return h.up = o, this.addController(h, t);
|
|
2010
2010
|
}
|
|
2011
2011
|
setPageActive(e) {
|
|
2012
2012
|
super.setPageActive(e, (t, s) => {
|
|
@@ -2072,17 +2072,17 @@ class Ds extends ee {
|
|
|
2072
2072
|
s[7],
|
|
2073
2073
|
s[11],
|
|
2074
2074
|
s[15]
|
|
2075
|
-
), { width: n, height: a } = this,
|
|
2076
|
-
(this.camera.fov !== t.fov || this.camera.aspect !==
|
|
2075
|
+
), { width: n, height: a } = this, h = n / a;
|
|
2076
|
+
(this.camera.fov !== t.fov || this.camera.aspect !== h || !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 = h, this.camera.updateProjectionMatrix());
|
|
2077
2077
|
}
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
|
-
const Us = (
|
|
2081
|
-
const e = new
|
|
2082
|
-
new
|
|
2080
|
+
const Us = (c) => {
|
|
2081
|
+
const e = new ds(
|
|
2082
|
+
new zt({
|
|
2083
2083
|
uniforms: {
|
|
2084
2084
|
baseTexture: { value: null },
|
|
2085
|
-
bloomTexture: { value:
|
|
2085
|
+
bloomTexture: { value: c.renderTarget2.texture },
|
|
2086
2086
|
bloomAlphaType: { value: 0 }
|
|
2087
2087
|
},
|
|
2088
2088
|
vertexShader: `
|
|
@@ -2113,7 +2113,7 @@ const Us = (h) => {
|
|
|
2113
2113
|
"baseTexture"
|
|
2114
2114
|
);
|
|
2115
2115
|
return e.needsSwap = !0, e;
|
|
2116
|
-
},
|
|
2116
|
+
}, ks = {
|
|
2117
2117
|
name: "OutputShader",
|
|
2118
2118
|
uniforms: {
|
|
2119
2119
|
tDiffuse: { value: null },
|
|
@@ -2207,11 +2207,11 @@ const Us = (h) => {
|
|
|
2207
2207
|
}`
|
|
2208
2208
|
)
|
|
2209
2209
|
};
|
|
2210
|
-
class
|
|
2210
|
+
class zs extends ps {
|
|
2211
2211
|
constructor() {
|
|
2212
2212
|
super();
|
|
2213
|
-
const e =
|
|
2214
|
-
this.uniforms =
|
|
2213
|
+
const e = ks;
|
|
2214
|
+
this.uniforms = Ft.clone(e.uniforms), this.material = new Nt({
|
|
2215
2215
|
name: e.name,
|
|
2216
2216
|
uniforms: this.uniforms,
|
|
2217
2217
|
vertexShader: e.vertexShader,
|
|
@@ -2219,23 +2219,23 @@ class ks extends ms {
|
|
|
2219
2219
|
}), this.fsQuad ? this.fsQuad = new Fe(this.material) : this._fsQuad && (this._fsQuad = new Fe(this.material));
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
|
-
const Fs = new
|
|
2222
|
+
const Fs = new It({ color: "black" }), Ns = new nt({
|
|
2223
2223
|
color: "black",
|
|
2224
2224
|
sizeAttenuation: !1
|
|
2225
|
-
}), Is = new
|
|
2225
|
+
}), Is = new nt({
|
|
2226
2226
|
color: "black",
|
|
2227
2227
|
sizeAttenuation: !0
|
|
2228
|
-
}),
|
|
2228
|
+
}), Hs = new at({
|
|
2229
2229
|
color: "black",
|
|
2230
2230
|
sizeAttenuation: !0
|
|
2231
|
-
}),
|
|
2231
|
+
}), js = new at({
|
|
2232
2232
|
color: "black",
|
|
2233
2233
|
sizeAttenuation: !1
|
|
2234
|
-
}), Bs = new
|
|
2234
|
+
}), Bs = new mt({
|
|
2235
2235
|
color: "black",
|
|
2236
2236
|
sizeAttenuation: !1,
|
|
2237
2237
|
lineWidth: 0
|
|
2238
|
-
}),
|
|
2238
|
+
}), Ge = new Ht(0), Vs = {
|
|
2239
2239
|
kernelRadius: 8,
|
|
2240
2240
|
minDistance: 5e-3,
|
|
2241
2241
|
maxDistance: 0.1
|
|
@@ -2250,7 +2250,7 @@ const Fs = new jt({ color: "black" }), Ns = new at({
|
|
|
2250
2250
|
};
|
|
2251
2251
|
class Ws {
|
|
2252
2252
|
constructor(e) {
|
|
2253
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2253
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new jt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2254
2254
|
const {
|
|
2255
2255
|
rendererController: t,
|
|
2256
2256
|
sceneController: s,
|
|
@@ -2258,20 +2258,20 @@ class Ws {
|
|
|
2258
2258
|
composerParams: r
|
|
2259
2259
|
} = e, { renderer: o } = t;
|
|
2260
2260
|
this.renderer = o;
|
|
2261
|
-
const { multisampling: n } = r, { maxSamples: a } = o.capabilities,
|
|
2262
|
-
|
|
2263
|
-
|
|
2261
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, h = o.getDrawingBufferSize(new B()), m = new Bt(
|
|
2262
|
+
h.width,
|
|
2263
|
+
h.height,
|
|
2264
2264
|
{
|
|
2265
2265
|
samples: Math.min(n, a),
|
|
2266
|
-
type:
|
|
2266
|
+
type: Vt
|
|
2267
2267
|
}
|
|
2268
|
-
), p = new
|
|
2268
|
+
), p = new ze(o, m), v = this.getSize();
|
|
2269
2269
|
p.setSize(v.width, v.height);
|
|
2270
|
-
const
|
|
2270
|
+
const _ = new ls(
|
|
2271
2271
|
s.scene,
|
|
2272
2272
|
i.camera
|
|
2273
2273
|
);
|
|
2274
|
-
p.addPass(
|
|
2274
|
+
p.addPass(_), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = _, i.event.on("pageChange", (u) => {
|
|
2275
2275
|
this.changeCamera(u);
|
|
2276
2276
|
}), s.event.on("pageChange", (u) => {
|
|
2277
2277
|
this.changeScene(u);
|
|
@@ -2284,28 +2284,28 @@ class Ws {
|
|
|
2284
2284
|
this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
|
|
2285
2285
|
}
|
|
2286
2286
|
addOutputPass() {
|
|
2287
|
-
const { premultiplieAlpha: e } = this.options.composerParams, t = new
|
|
2287
|
+
const { premultiplieAlpha: e } = this.options.composerParams, t = new zs();
|
|
2288
2288
|
this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
|
|
2289
2289
|
}
|
|
2290
2290
|
setPremultiplieAlpha(e) {
|
|
2291
2291
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2292
2292
|
}
|
|
2293
2293
|
addSSAOPass(e) {
|
|
2294
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new
|
|
2294
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new hs(t, s, o, n);
|
|
2295
2295
|
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2296
2296
|
}
|
|
2297
2297
|
addBloomPass(e) {
|
|
2298
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new
|
|
2298
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new cs(
|
|
2299
2299
|
new B(window.innerWidth, window.innerHeight),
|
|
2300
2300
|
i,
|
|
2301
2301
|
r,
|
|
2302
2302
|
s
|
|
2303
2303
|
);
|
|
2304
2304
|
this.bloomPass = n;
|
|
2305
|
-
const a = new
|
|
2305
|
+
const a = new ze(t);
|
|
2306
2306
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2307
|
+
const h = Us(a);
|
|
2308
|
+
h.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(h), this.mixPass = h, this.bloomLayer.set(Oe);
|
|
2309
2309
|
}
|
|
2310
2310
|
setBloomSelection(e, t) {
|
|
2311
2311
|
if (!this.bloomComposer) {
|
|
@@ -2337,29 +2337,29 @@ class Ws {
|
|
|
2337
2337
|
i.isTransformControls || i.isTransformControlsRoot || i.type === "RectAreaLightHelper" ? e.push(i) : t.push(i);
|
|
2338
2338
|
}), t.forEach((i) => {
|
|
2339
2339
|
i.traverse((r) => {
|
|
2340
|
-
var
|
|
2340
|
+
var h;
|
|
2341
2341
|
const o = r, n = r, a = r;
|
|
2342
|
-
if ((
|
|
2342
|
+
if ((h = o.material) != null && h.isShadowMaterial)
|
|
2343
2343
|
e.push(o);
|
|
2344
2344
|
else if (o.material && this.bloomLayer.test(o.layers) === !1) {
|
|
2345
2345
|
if (o.material.transparent === !0 && (o.material.opacity !== 1 || o.material.alphaMap)) {
|
|
2346
2346
|
e.push(o);
|
|
2347
2347
|
return;
|
|
2348
2348
|
}
|
|
2349
|
-
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material =
|
|
2349
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Hs : n.material = js : o.material instanceof mt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = Is : a.material = Ns : o.material = Fs;
|
|
2350
2350
|
}
|
|
2351
2351
|
});
|
|
2352
2352
|
}), e.forEach((i) => {
|
|
2353
2353
|
this.bloomVisible[i.uuid] = i.visible, i.visible = !1;
|
|
2354
2354
|
});
|
|
2355
2355
|
const s = this.scene.background;
|
|
2356
|
-
s != null && s.isTexture && (this.scene.userData._backgroundOriginal = s, this.scene.background =
|
|
2356
|
+
s != null && s.isTexture && (this.scene.userData._backgroundOriginal = s, this.scene.background = Ge);
|
|
2357
2357
|
}
|
|
2358
2358
|
restoreNonBloomed() {
|
|
2359
2359
|
if (this.scene.traverse((e) => {
|
|
2360
2360
|
const t = e;
|
|
2361
2361
|
this.bloomMaterials[t.uuid] ? (t.material = this.bloomMaterials[t.uuid], delete this.bloomMaterials[t.uuid]) : this.bloomVisible[t.uuid] !== void 0 && (t.visible = this.bloomVisible[t.uuid], delete this.bloomVisible[t.uuid]);
|
|
2362
|
-
}), this.scene.background ===
|
|
2362
|
+
}), this.scene.background === Ge) {
|
|
2363
2363
|
const e = this.scene.userData._backgroundOriginal;
|
|
2364
2364
|
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2365
2365
|
}
|
|
@@ -2401,14 +2401,14 @@ class Ks extends ee {
|
|
|
2401
2401
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2402
2402
|
const t = {
|
|
2403
2403
|
Vector2: B,
|
|
2404
|
-
Vector3:
|
|
2405
|
-
Vector4:
|
|
2406
|
-
Quaternion:
|
|
2404
|
+
Vector3: H,
|
|
2405
|
+
Vector4: Zt,
|
|
2406
|
+
Quaternion: lt,
|
|
2407
2407
|
Matrix4: W,
|
|
2408
|
-
Spherical:
|
|
2409
|
-
Box3:
|
|
2410
|
-
Sphere:
|
|
2411
|
-
Raycaster:
|
|
2408
|
+
Spherical: Wt,
|
|
2409
|
+
Box3: ht,
|
|
2410
|
+
Sphere: Kt,
|
|
2411
|
+
Raycaster: ct
|
|
2412
2412
|
};
|
|
2413
2413
|
J.install({ THREE: t });
|
|
2414
2414
|
}
|
|
@@ -2440,10 +2440,10 @@ class Ks extends ee {
|
|
|
2440
2440
|
});
|
|
2441
2441
|
}
|
|
2442
2442
|
update(e, t) {
|
|
2443
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2443
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Yt.DEG2RAD);
|
|
2444
2444
|
}
|
|
2445
2445
|
}
|
|
2446
|
-
const
|
|
2446
|
+
const Xe = new H(), $s = new lt(), qe = new H(), I = new W(), Gs = new W();
|
|
2447
2447
|
class Xs {
|
|
2448
2448
|
/**
|
|
2449
2449
|
* Constructs a new CSS3D renderer.
|
|
@@ -2458,23 +2458,23 @@ class Xs {
|
|
|
2458
2458
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2459
2459
|
}, a = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2460
2460
|
a.style.overflow = "hidden", this.domElement = a;
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2461
|
+
const h = document.createElement("div");
|
|
2462
|
+
h.style.transformOrigin = "0 0", h.style.pointerEvents = "none", a.appendChild(h);
|
|
2463
2463
|
const m = document.createElement("div");
|
|
2464
|
-
m.style.transformStyle = "preserve-3d",
|
|
2464
|
+
m.style.transformStyle = "preserve-3d", h.appendChild(m), this.getSize = function() {
|
|
2465
2465
|
return {
|
|
2466
2466
|
width: s,
|
|
2467
2467
|
height: i
|
|
2468
2468
|
};
|
|
2469
2469
|
}, this.render = function(y, l) {
|
|
2470
|
-
const
|
|
2471
|
-
l.view && l.view.enabled ? (
|
|
2470
|
+
const f = l.projectionMatrix.elements[5] * o;
|
|
2471
|
+
l.view && l.view.enabled ? (h.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, h.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : h.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2472
2472
|
let O, C;
|
|
2473
2473
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2474
|
-
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` +
|
|
2474
|
+
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + f + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + f + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + f + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2475
2475
|
n.camera.style !== R && (m.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2476
2476
|
}, this.setSize = function(y, l) {
|
|
2477
|
-
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px",
|
|
2477
|
+
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", h.style.width = y + "px", h.style.height = l + "px", m.style.width = y + "px", m.style.height = l + "px";
|
|
2478
2478
|
};
|
|
2479
2479
|
function p(y) {
|
|
2480
2480
|
return Math.abs(y) < 1e-10 ? 0 : y;
|
|
@@ -2483,41 +2483,41 @@ class Xs {
|
|
|
2483
2483
|
const l = y.elements;
|
|
2484
2484
|
return "matrix3d(" + p(l[0]) + "," + p(-l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(l[4]) + "," + p(-l[5]) + "," + p(l[6]) + "," + p(l[7]) + "," + p(l[8]) + "," + p(-l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(-l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")";
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2486
|
+
function _(y) {
|
|
2487
2487
|
const l = y.elements;
|
|
2488
2488
|
return "translate(-50%,-50%)" + ("matrix3d(" + p(l[0]) + "," + p(l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(-l[4]) + "," + p(-l[5]) + "," + p(-l[6]) + "," + p(-l[7]) + "," + p(l[8]) + "," + p(l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")");
|
|
2489
2489
|
}
|
|
2490
2490
|
function u(y) {
|
|
2491
2491
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2492
|
-
for (let l = 0,
|
|
2492
|
+
for (let l = 0, f = y.children.length; l < f; l++)
|
|
2493
2493
|
u(y.children[l]);
|
|
2494
2494
|
}
|
|
2495
|
-
function g(y, l,
|
|
2495
|
+
function g(y, l, f, O) {
|
|
2496
2496
|
if (y.visible === !1) {
|
|
2497
2497
|
u(y);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
if (y.isCSS3DObject) {
|
|
2501
|
-
const C = y.layers.test(
|
|
2501
|
+
const C = y.layers.test(f.layers) === !0, w = y.element;
|
|
2502
2502
|
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2503
|
-
y.onBeforeRender(t, l,
|
|
2503
|
+
y.onBeforeRender(t, l, f);
|
|
2504
2504
|
let E;
|
|
2505
|
-
y.isCSS3DSprite ? (I.copy(
|
|
2506
|
-
const
|
|
2507
|
-
if (
|
|
2505
|
+
y.isCSS3DSprite ? (I.copy(f.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Gs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(Xe, $s, qe), I.setPosition(Xe), I.scale(qe), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, E = _(I)) : E = _(y.matrixWorld);
|
|
2506
|
+
const b = n.objects.get(y);
|
|
2507
|
+
if (b === void 0 || b.style !== E) {
|
|
2508
2508
|
w.style.transform = E;
|
|
2509
2509
|
const R = { style: E };
|
|
2510
2510
|
n.objects.set(y, R);
|
|
2511
2511
|
}
|
|
2512
|
-
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l,
|
|
2512
|
+
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l, f);
|
|
2513
2513
|
}
|
|
2514
2514
|
}
|
|
2515
2515
|
for (let C = 0, w = y.children.length; C < w; C++)
|
|
2516
|
-
g(y.children[C], l,
|
|
2516
|
+
g(y.children[C], l, f);
|
|
2517
2517
|
}
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
const q = new
|
|
2520
|
+
const q = new H(), Qe = new W(), Je = new W(), et = new H(), tt = new H();
|
|
2521
2521
|
class qs {
|
|
2522
2522
|
/**
|
|
2523
2523
|
* Constructs a new CSS2D renderer.
|
|
@@ -2536,34 +2536,34 @@ class qs {
|
|
|
2536
2536
|
height: i
|
|
2537
2537
|
};
|
|
2538
2538
|
}, this.render = function(u, g) {
|
|
2539
|
-
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(),
|
|
2539
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Qe.copy(g.matrixWorldInverse), Je.multiplyMatrices(g.projectionMatrix, Qe), m(u, u, g), _(u);
|
|
2540
2540
|
}, this.setSize = function(u, g) {
|
|
2541
2541
|
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2542
2542
|
};
|
|
2543
|
-
function
|
|
2543
|
+
function h(u) {
|
|
2544
2544
|
u.isCSS2DObject && (u.element.style.display = "none");
|
|
2545
2545
|
for (let g = 0, y = u.children.length; g < y; g++)
|
|
2546
|
-
|
|
2546
|
+
h(u.children[g]);
|
|
2547
2547
|
}
|
|
2548
2548
|
function m(u, g, y) {
|
|
2549
2549
|
if (u.visible === !1) {
|
|
2550
|
-
|
|
2550
|
+
h(u);
|
|
2551
2551
|
return;
|
|
2552
2552
|
}
|
|
2553
2553
|
if (u.isCSS2DObject) {
|
|
2554
|
-
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(
|
|
2555
|
-
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0,
|
|
2556
|
-
|
|
2554
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Je);
|
|
2555
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, f = u.element;
|
|
2556
|
+
f.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), f.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", f.parentNode !== a && a.appendChild(f), u.onAfterRender(t, g, y));
|
|
2557
2557
|
const O = {
|
|
2558
2558
|
distanceToCameraSquared: p(y, u)
|
|
2559
2559
|
};
|
|
2560
2560
|
n.objects.set(u, O);
|
|
2561
2561
|
}
|
|
2562
|
-
for (let l = 0,
|
|
2562
|
+
for (let l = 0, f = u.children.length; l < f; l++)
|
|
2563
2563
|
m(u.children[l], g, y);
|
|
2564
2564
|
}
|
|
2565
2565
|
function p(u, g) {
|
|
2566
|
-
return
|
|
2566
|
+
return et.setFromMatrixPosition(u.matrixWorld), tt.setFromMatrixPosition(g.matrixWorld), et.distanceToSquared(tt);
|
|
2567
2567
|
}
|
|
2568
2568
|
function v(u) {
|
|
2569
2569
|
const g = [];
|
|
@@ -2571,19 +2571,19 @@ class qs {
|
|
|
2571
2571
|
y.isCSS2DObject && g.push(y);
|
|
2572
2572
|
}), g;
|
|
2573
2573
|
}
|
|
2574
|
-
function
|
|
2575
|
-
const g = v(u).sort(function(l,
|
|
2576
|
-
if (l.renderOrder !==
|
|
2577
|
-
return
|
|
2578
|
-
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(
|
|
2574
|
+
function _(u) {
|
|
2575
|
+
const g = v(u).sort(function(l, f) {
|
|
2576
|
+
if (l.renderOrder !== f.renderOrder)
|
|
2577
|
+
return f.renderOrder - l.renderOrder;
|
|
2578
|
+
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(f).distanceToCameraSquared;
|
|
2579
2579
|
return O - C;
|
|
2580
2580
|
}), y = g.length;
|
|
2581
|
-
for (let l = 0,
|
|
2581
|
+
for (let l = 0, f = g.length; l < f; l++)
|
|
2582
2582
|
g[l].element.style.zIndex = y - l;
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
const
|
|
2586
|
+
const st = {
|
|
2587
2587
|
zIndex: "auto"
|
|
2588
2588
|
};
|
|
2589
2589
|
class Qs {
|
|
@@ -2618,19 +2618,19 @@ class Js {
|
|
|
2618
2618
|
if (e.isScene)
|
|
2619
2619
|
i = new De(100);
|
|
2620
2620
|
else if (e.isCamera)
|
|
2621
|
-
i = new
|
|
2621
|
+
i = new $t(e);
|
|
2622
2622
|
else if (e.isPointLight)
|
|
2623
|
-
i = new
|
|
2623
|
+
i = new Gt(e, 1);
|
|
2624
2624
|
else if (e.isDirectionalLight)
|
|
2625
|
-
i = new
|
|
2625
|
+
i = new Xt(e, 1);
|
|
2626
2626
|
else if (e.isSpotLight)
|
|
2627
|
-
i = new
|
|
2627
|
+
i = new qt(e);
|
|
2628
2628
|
else if (e.isHemisphereLight)
|
|
2629
|
-
i = new
|
|
2629
|
+
i = new Qt(e, 10);
|
|
2630
2630
|
else if (e.isRectAreaLight)
|
|
2631
|
-
i = new
|
|
2631
|
+
i = new ms(e);
|
|
2632
2632
|
else {
|
|
2633
|
-
const r = new
|
|
2633
|
+
const r = new ht();
|
|
2634
2634
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2635
2635
|
i = new Ue(r);
|
|
2636
2636
|
const o = i.material;
|
|
@@ -2674,8 +2674,8 @@ class Js {
|
|
|
2674
2674
|
const { cameraController: i } = this.options;
|
|
2675
2675
|
Object.values(this.helpers).forEach((n) => {
|
|
2676
2676
|
if (n.update && n.update(), n instanceof Ue) {
|
|
2677
|
-
const a = n.material, { object:
|
|
2678
|
-
|
|
2677
|
+
const a = n.material, { object: h } = a.userData;
|
|
2678
|
+
h && n.box.setFromObject(h, !0);
|
|
2679
2679
|
}
|
|
2680
2680
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
2681
2681
|
...i.camera.position.toArray()
|
|
@@ -2692,11 +2692,11 @@ class Js {
|
|
|
2692
2692
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
|
-
function
|
|
2695
|
+
function it(c) {
|
|
2696
2696
|
let e = !1, t = [];
|
|
2697
2697
|
return function(...s) {
|
|
2698
2698
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
2699
|
-
e = !1,
|
|
2699
|
+
e = !1, c(...t);
|
|
2700
2700
|
}));
|
|
2701
2701
|
};
|
|
2702
2702
|
}
|
|
@@ -2715,34 +2715,34 @@ class ei {
|
|
|
2715
2715
|
return;
|
|
2716
2716
|
r.preventDefault();
|
|
2717
2717
|
const o = e === "move" ? t : s, n = [];
|
|
2718
|
-
if (this.pickFunctionsMap.forEach((
|
|
2719
|
-
o.has(
|
|
2720
|
-
objArr:
|
|
2718
|
+
if (this.pickFunctionsMap.forEach((_) => {
|
|
2719
|
+
o.has(_.type) && n.push(te(U({}, _), {
|
|
2720
|
+
objArr: _.objArr instanceof Function ? _.objArr() : _.objArr
|
|
2721
2721
|
}));
|
|
2722
2722
|
}), n.length === 0) return;
|
|
2723
2723
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2724
2724
|
const a = this.objCallbackMap;
|
|
2725
|
-
for (const
|
|
2726
|
-
for (const u of
|
|
2725
|
+
for (const _ of n)
|
|
2726
|
+
for (const u of _.objArr) {
|
|
2727
2727
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
2728
2728
|
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
2729
2729
|
const g = a.get(u);
|
|
2730
|
-
g.has(
|
|
2730
|
+
g.has(_.type) || g.set(_.type, []), g.get(_.type).push(_.cb);
|
|
2731
2731
|
}
|
|
2732
2732
|
if (a.size === 0) return;
|
|
2733
|
-
const
|
|
2733
|
+
const h = [...a.keys()].map((_) => _.object3d), m = (v = this.pencil.pick(r, h, !0)) == null ? void 0 : v.intersects;
|
|
2734
2734
|
if (!m || m.length === 0)
|
|
2735
2735
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2736
2736
|
else {
|
|
2737
|
-
const
|
|
2738
|
-
this.processIntersection(
|
|
2737
|
+
const _ = m[0];
|
|
2738
|
+
this.processIntersection(_, r, e);
|
|
2739
2739
|
}
|
|
2740
2740
|
const p = this.prevActiveObjects;
|
|
2741
2741
|
this.prevActiveObjects = this.activeObjects, this.activeObjects = p, this.activeObjects.clear();
|
|
2742
2742
|
};
|
|
2743
2743
|
this.domElement.addEventListener(
|
|
2744
2744
|
`pointer${e}`,
|
|
2745
|
-
|
|
2745
|
+
it(i),
|
|
2746
2746
|
{ passive: !1 }
|
|
2747
2747
|
);
|
|
2748
2748
|
}
|
|
@@ -2766,9 +2766,9 @@ class ei {
|
|
|
2766
2766
|
const a = i.get(n);
|
|
2767
2767
|
if (a)
|
|
2768
2768
|
if (t === "move") {
|
|
2769
|
-
const
|
|
2770
|
-
if (
|
|
2771
|
-
for (const p of
|
|
2769
|
+
const h = a.get("enter");
|
|
2770
|
+
if (h && !this.prevActiveObjects.has(n))
|
|
2771
|
+
for (const p of h)
|
|
2772
2772
|
p({
|
|
2773
2773
|
baseObject: n,
|
|
2774
2774
|
realBaseObject: this.activeObject,
|
|
@@ -2787,9 +2787,9 @@ class ei {
|
|
|
2787
2787
|
intersectionIndex: s
|
|
2788
2788
|
});
|
|
2789
2789
|
} else {
|
|
2790
|
-
const
|
|
2791
|
-
if (
|
|
2792
|
-
for (const p of
|
|
2790
|
+
const h = a.get("down");
|
|
2791
|
+
if (h)
|
|
2792
|
+
for (const p of h)
|
|
2793
2793
|
p({
|
|
2794
2794
|
baseObject: n,
|
|
2795
2795
|
realBaseObject: this.activeObject,
|
|
@@ -2801,8 +2801,8 @@ class ei {
|
|
|
2801
2801
|
if (m) {
|
|
2802
2802
|
const p = (v) => {
|
|
2803
2803
|
v.preventDefault();
|
|
2804
|
-
const
|
|
2805
|
-
if (!r && Math.abs(v.clientX - e.clientX) <=
|
|
2804
|
+
const _ = 5;
|
|
2805
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= _ && Math.abs(v.clientY - e.clientY) <= _)
|
|
2806
2806
|
for (const u of m)
|
|
2807
2807
|
u({
|
|
2808
2808
|
baseObject: n,
|
|
@@ -2861,13 +2861,13 @@ class ei {
|
|
|
2861
2861
|
for (const n of r) {
|
|
2862
2862
|
const a = n;
|
|
2863
2863
|
a.element.style.pointerEvents = "auto";
|
|
2864
|
-
const
|
|
2864
|
+
const h = (p) => {
|
|
2865
2865
|
this.enabled && (p.preventDefault(), s({
|
|
2866
2866
|
baseObject: a,
|
|
2867
2867
|
mouseEvent: p
|
|
2868
2868
|
}));
|
|
2869
2869
|
}, m = `pointer${t}`;
|
|
2870
|
-
a.element.addEventListener(m,
|
|
2870
|
+
a.element.addEventListener(m, it(h), !1), o.push({ arr: a, type: m, listener: h });
|
|
2871
2871
|
}
|
|
2872
2872
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2873
2873
|
}
|
|
@@ -2889,16 +2889,16 @@ class ei {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
class ti extends ei {
|
|
2891
2891
|
constructor(e, t) {
|
|
2892
|
-
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new
|
|
2892
|
+
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new dt(), {
|
|
2893
2893
|
key: "@Scene",
|
|
2894
2894
|
name: "场景",
|
|
2895
2895
|
mList: !1
|
|
2896
|
-
}), this.group = this.createBaseObject(new
|
|
2896
|
+
}), this.group = this.createBaseObject(new ke(), {
|
|
2897
2897
|
key: "@Group",
|
|
2898
2898
|
name: "物体组",
|
|
2899
2899
|
target: this.scene,
|
|
2900
2900
|
mList: !1
|
|
2901
|
-
}), this.prefabGroup = this.createBaseObject(new
|
|
2901
|
+
}), this.prefabGroup = this.createBaseObject(new ke(), {
|
|
2902
2902
|
key: "@PrefabGroup",
|
|
2903
2903
|
name: "预制组",
|
|
2904
2904
|
target: this.scene,
|
|
@@ -2911,24 +2911,24 @@ class ti extends ei {
|
|
|
2911
2911
|
createBaseObject(e, t = {}) {
|
|
2912
2912
|
const s = U({
|
|
2913
2913
|
mList: !0
|
|
2914
|
-
}, t), i = new
|
|
2915
|
-
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key)
|
|
2916
|
-
|
|
2917
|
-
else if (s.target) {
|
|
2918
|
-
const r = s.target.key;
|
|
2919
|
-
if (r === "@Scene" && e instanceof es)
|
|
2914
|
+
}, t), i = new as();
|
|
2915
|
+
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key && (i.key = s.key), !s.key && s.target)
|
|
2916
|
+
if (s.target.key === "@Scene" && e instanceof Jt)
|
|
2920
2917
|
i.key = "@Camera";
|
|
2921
2918
|
else {
|
|
2922
|
-
const o = this.objectWrapChindIdMap.get(s.target) ?
|
|
2923
|
-
this.objectWrapChindIdMap.set(s.target,
|
|
2919
|
+
const o = this.objectWrapChindIdMap.get(s.target), n = o !== void 0 ? o + 1 : 0;
|
|
2920
|
+
this.objectWrapChindIdMap.set(s.target, n), this.setBaseObjectKey(
|
|
2921
|
+
i,
|
|
2922
|
+
{ type: `$p:__c__${n}`, uId: "$p:", key: "$p:" },
|
|
2923
|
+
s.target
|
|
2924
|
+
);
|
|
2924
2925
|
}
|
|
2925
|
-
}
|
|
2926
2926
|
return s.name && (e.name = s.name), s.target && !s.target.object3d.getObjectById(e.id) && s.target.object3d.add(e), this.objects.set(i.key, i), this.objMap.set(i.object3d, i), s.mList && (this.mList.proxyBaseObject(i), this.mList.addBaseObjectMap(i)), e.children && e.children.forEach((r) => {
|
|
2927
2927
|
this.createBaseObject(r, {
|
|
2928
2928
|
target: i,
|
|
2929
2929
|
mList: s.mList
|
|
2930
2930
|
});
|
|
2931
|
-
}), i;
|
|
2931
|
+
}), this.pencil.event.emit("lead.draw", { baseObject: i }), i;
|
|
2932
2932
|
}
|
|
2933
2933
|
init(e) {
|
|
2934
2934
|
return Object.keys(e).forEach((t) => {
|
|
@@ -2937,7 +2937,7 @@ class ti extends ei {
|
|
|
2937
2937
|
return new e[t](r);
|
|
2938
2938
|
}
|
|
2939
2939
|
};
|
|
2940
|
-
this.objectNamesToFactories.set(t, s);
|
|
2940
|
+
this.objectNamesToFactories.set(String(t), s);
|
|
2941
2941
|
}), this;
|
|
2942
2942
|
}
|
|
2943
2943
|
getObject(e, t) {
|
|
@@ -2954,47 +2954,64 @@ class ti extends ei {
|
|
|
2954
2954
|
}
|
|
2955
2955
|
draw(e, t, s) {
|
|
2956
2956
|
return se(this, null, function* () {
|
|
2957
|
-
var
|
|
2958
|
-
const i = this.objectNamesToFactories.get(e);
|
|
2959
|
-
if (i)
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2957
|
+
var p, v, _;
|
|
2958
|
+
const i = this.objectNamesToFactories.get(String(e));
|
|
2959
|
+
if (!i)
|
|
2960
|
+
throw new Error(`Unrecognized factory: ${String(e)}`);
|
|
2961
|
+
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
2962
|
+
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (v = t.prefab) != null ? v : !1, a = (_ = t.create) != null ? _ : !0, h = new i().create(t);
|
|
2963
|
+
let m;
|
|
2964
|
+
if (r === null)
|
|
2965
|
+
m = null;
|
|
2966
|
+
else if (typeof r == "string") {
|
|
2967
|
+
const u = this.objects.get(r);
|
|
2968
|
+
if (!u)
|
|
2969
|
+
throw new Error(`Object with key "${r}" not found`);
|
|
2970
|
+
m = u;
|
|
2971
|
+
} else r != null && r.isBaseObject || r ? m = r : n ? m = this.prefabGroup : m = this.group;
|
|
2972
|
+
return a === !1 ? h.create = () => {
|
|
2973
|
+
} : a !== !0 && (h.create = () => {
|
|
2974
|
+
a(h);
|
|
2975
|
+
}), h.pencil = this.pencil, h.lead = this, h.mList = this.mList, h.isPrefab = n, h.objectType = `${e}`, h.objectOptions = t, this.setBaseObjectKey(
|
|
2976
|
+
h,
|
|
2977
|
+
{
|
|
2978
|
+
type: t.keyType,
|
|
2979
|
+
key: t.key,
|
|
2980
|
+
uId: t.uId
|
|
2981
|
+
},
|
|
2982
|
+
m
|
|
2983
|
+
), this.objectsPm.set(
|
|
2984
|
+
h,
|
|
2985
|
+
this.addBaseObject(h, m, o)
|
|
2986
|
+
), yield this.objectsPm.get(h), this.objectsPm.delete(h), h;
|
|
2976
2987
|
});
|
|
2977
2988
|
}
|
|
2978
2989
|
setBaseObjectKey(e, t, s) {
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2990
|
+
let i = "", r = t.key, o = t.type || e.keyType || e.objectType, n = t.uId;
|
|
2991
|
+
return s && (r != null && r.includes("$p:") && (r = r.replace("$p:", s.keyName || "")), o != null && o.includes("$p:") && (o = o.replace("$p:", s.keyType || "")), n != null && n.includes("$p:") && (n = n.replace("$p:", s.keyUId || ""))), i = `${o}`, r && n ? i += `#${r}-${n}` : (r || n) && (i += `#${r || n}`), this.objects.has(i) ? this.setBaseObjectKey(
|
|
2992
|
+
e,
|
|
2993
|
+
{
|
|
2994
|
+
type: t.type,
|
|
2995
|
+
key: t.key,
|
|
2996
|
+
uId: fs()
|
|
2997
|
+
},
|
|
2998
|
+
s
|
|
2999
|
+
) : (e.key = i, e.keyType = o, e.keyUId = n, e.keyName = r, this.objects.set(i, e), i);
|
|
2986
3000
|
}
|
|
2987
3001
|
updateBaseObjectKey(e, t) {
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3002
|
+
const s = e.key;
|
|
3003
|
+
this.objects.delete(s);
|
|
3004
|
+
const i = e.parent, r = this.setBaseObjectKey(e, t, i);
|
|
3005
|
+
return this.pencil.event.emit("lead.updateKey", { baseObject: e, key: r, oldKey: s }), e.children.forEach((o) => {
|
|
3006
|
+
var n;
|
|
3007
|
+
if (o.key.includes("__c__")) {
|
|
3008
|
+
const a = (n = /__c__(\d+)/.exec(o.key)) == null ? void 0 : n[1];
|
|
3009
|
+
typeof a != "undefined" && this.updateBaseObjectKey(o, {
|
|
3010
|
+
type: `$p:__c__${a}`,
|
|
3011
|
+
key: "$p:",
|
|
3012
|
+
uId: "$p:"
|
|
3013
|
+
});
|
|
2994
3014
|
}
|
|
2995
|
-
const i = (o = e.parent) == null ? void 0 : o.key, r = this.setBaseObjectKey(e, t, i);
|
|
2996
|
-
return s && this.objects.delete(s), this.pencil.event.emit("lead.updateKey", { baseObject: e, key: r, oldKey: s }), e.children.forEach((n, a) => {
|
|
2997
|
-
n.key.includes("__c__") && this.updateBaseObjectKey(n, `${r}__c__${a}`);
|
|
2998
3015
|
}), r;
|
|
2999
3016
|
}
|
|
3000
3017
|
addBaseObject(e, t, s) {
|
|
@@ -3080,7 +3097,7 @@ class si extends ee {
|
|
|
3080
3097
|
});
|
|
3081
3098
|
}
|
|
3082
3099
|
}
|
|
3083
|
-
class ii extends
|
|
3100
|
+
class ii extends pt {
|
|
3084
3101
|
constructor(e) {
|
|
3085
3102
|
super(e);
|
|
3086
3103
|
}
|
|
@@ -3089,8 +3106,8 @@ class ii extends mt {
|
|
|
3089
3106
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3090
3107
|
e,
|
|
3091
3108
|
(o) => {
|
|
3092
|
-
const n = o, a = new DecompressionStream("gzip"),
|
|
3093
|
-
new Response(
|
|
3109
|
+
const n = o, a = new DecompressionStream("gzip"), h = n.stream().pipeThrough(a);
|
|
3110
|
+
new Response(h).json().then((p) => {
|
|
3094
3111
|
t == null || t(p);
|
|
3095
3112
|
}).catch((p) => {
|
|
3096
3113
|
i == null || i(p);
|
|
@@ -3101,7 +3118,7 @@ class ii extends mt {
|
|
|
3101
3118
|
);
|
|
3102
3119
|
}
|
|
3103
3120
|
}
|
|
3104
|
-
class
|
|
3121
|
+
class rt extends pt {
|
|
3105
3122
|
constructor(e) {
|
|
3106
3123
|
super(e), this.options = { type: "image" };
|
|
3107
3124
|
}
|
|
@@ -3110,23 +3127,23 @@ class ot extends mt {
|
|
|
3110
3127
|
}
|
|
3111
3128
|
load(e, t, s, i) {
|
|
3112
3129
|
let r, o;
|
|
3113
|
-
this.options.type === "image" ? (o = document.createElement("img"), r = new
|
|
3130
|
+
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new es(o)) : r = new fe();
|
|
3114
3131
|
const n = new Se(this.manager);
|
|
3115
3132
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3116
3133
|
e,
|
|
3117
3134
|
(a) => {
|
|
3118
|
-
let
|
|
3135
|
+
let h = a;
|
|
3119
3136
|
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3120
|
-
|
|
3137
|
+
h = h.slice(0, a.size, p);
|
|
3121
3138
|
const v = () => {
|
|
3122
|
-
o.removeEventListener("load",
|
|
3123
|
-
},
|
|
3139
|
+
o.removeEventListener("load", _, !1), o.removeEventListener("error", u, !1);
|
|
3140
|
+
}, _ = () => {
|
|
3124
3141
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3125
3142
|
}, u = (y) => {
|
|
3126
3143
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3127
3144
|
};
|
|
3128
|
-
o.addEventListener("load",
|
|
3129
|
-
const g = window.URL.createObjectURL(
|
|
3145
|
+
o.addEventListener("load", _, !1), o.addEventListener("error", u, !1);
|
|
3146
|
+
const g = window.URL.createObjectURL(h);
|
|
3130
3147
|
o.src = g;
|
|
3131
3148
|
},
|
|
3132
3149
|
s,
|
|
@@ -3148,7 +3165,7 @@ class oi {
|
|
|
3148
3165
|
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
|
|
3149
3166
|
simpleTexture4deleted: !1,
|
|
3150
3167
|
prefix: ""
|
|
3151
|
-
}, e), this.loadingManager = new
|
|
3168
|
+
}, e), this.loadingManager = new ts(
|
|
3152
3169
|
() => {
|
|
3153
3170
|
},
|
|
3154
3171
|
(t, s, i) => {
|
|
@@ -3172,7 +3189,7 @@ class oi {
|
|
|
3172
3189
|
const s = this.assets.get(e);
|
|
3173
3190
|
if (!s) {
|
|
3174
3191
|
if ((t === "images" || t === "media" || t === "exr") && this.options.simpleTexture4deleted && this.delLoadArr.includes(e))
|
|
3175
|
-
return new
|
|
3192
|
+
return new fe();
|
|
3176
3193
|
console.warn(`Asset ${e} not found`);
|
|
3177
3194
|
}
|
|
3178
3195
|
return s;
|
|
@@ -3192,13 +3209,13 @@ class oi {
|
|
|
3192
3209
|
}
|
|
3193
3210
|
getLoader(e, t) {
|
|
3194
3211
|
if (e === "images")
|
|
3195
|
-
return this.textureLoader || (this.textureLoader = new
|
|
3212
|
+
return this.textureLoader || (this.textureLoader = new rt(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
3196
3213
|
if (e === "media")
|
|
3197
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
3214
|
+
return this.videoTextureLoader || (this.videoTextureLoader = new rt(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3198
3215
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3199
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3216
|
+
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;
|
|
3200
3217
|
if (e === "gltf")
|
|
3201
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3218
|
+
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3202
3219
|
if (e === "lottie")
|
|
3203
3220
|
return this.lottieLoader || (this.lottieLoader = new vs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3204
3221
|
if (e === "gzipJson")
|
|
@@ -3225,7 +3242,7 @@ class oi {
|
|
|
3225
3242
|
get textureAssets() {
|
|
3226
3243
|
const e = /* @__PURE__ */ new Map();
|
|
3227
3244
|
return this.assets.forEach((t, s) => {
|
|
3228
|
-
(t instanceof
|
|
3245
|
+
(t instanceof fe || t instanceof ss || t.isVideoTexture) && e.set(s, t);
|
|
3229
3246
|
}), e;
|
|
3230
3247
|
}
|
|
3231
3248
|
loadAll() {
|
|
@@ -3250,13 +3267,13 @@ class oi {
|
|
|
3250
3267
|
}
|
|
3251
3268
|
const o = this.getLoader(s, t);
|
|
3252
3269
|
try {
|
|
3253
|
-
const
|
|
3254
|
-
if (this.assets.set(e,
|
|
3270
|
+
const h = yield o.loadAsync(e);
|
|
3271
|
+
if (this.assets.set(e, h), r.resolve(h), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3255
3272
|
const m = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
|
|
3256
|
-
|
|
3273
|
+
h.anisotropy = m;
|
|
3257
3274
|
}
|
|
3258
|
-
return
|
|
3259
|
-
} catch (
|
|
3275
|
+
return h;
|
|
3276
|
+
} catch (h) {
|
|
3260
3277
|
r.reject(`Failed to load ${e}`);
|
|
3261
3278
|
return;
|
|
3262
3279
|
}
|
|
@@ -3277,9 +3294,9 @@ class oi {
|
|
|
3277
3294
|
a.roughnessMap,
|
|
3278
3295
|
a.metalnessMap,
|
|
3279
3296
|
a.aoMap
|
|
3280
|
-
].forEach((
|
|
3281
|
-
if (
|
|
3282
|
-
const m = this.getSrcByAsset(
|
|
3297
|
+
].forEach((h) => {
|
|
3298
|
+
if (h) {
|
|
3299
|
+
const m = this.getSrcByAsset(h, s);
|
|
3283
3300
|
m && t.add(m);
|
|
3284
3301
|
}
|
|
3285
3302
|
});
|
|
@@ -3396,8 +3413,8 @@ class li {
|
|
|
3396
3413
|
if (r.startsWith(i)) {
|
|
3397
3414
|
const n = r.substring(i.length), a = o.clone();
|
|
3398
3415
|
s[n] = a;
|
|
3399
|
-
const
|
|
3400
|
-
this.add(
|
|
3416
|
+
const h = `${t}#${n}`;
|
|
3417
|
+
this.add(h, a);
|
|
3401
3418
|
}
|
|
3402
3419
|
return s;
|
|
3403
3420
|
}
|
|
@@ -3422,15 +3439,15 @@ class li {
|
|
|
3422
3439
|
if ("__isProxy" in o)
|
|
3423
3440
|
return o;
|
|
3424
3441
|
const n = new Proxy(o, {
|
|
3425
|
-
set: (a,
|
|
3426
|
-
if (typeof
|
|
3427
|
-
const p = Number(
|
|
3442
|
+
set: (a, h, m) => {
|
|
3443
|
+
if (typeof h == "string" && !Number.isNaN(Number(h))) {
|
|
3444
|
+
const p = Number(h);
|
|
3428
3445
|
if (p >= 0 && p < a.length) {
|
|
3429
3446
|
const v = a[p];
|
|
3430
3447
|
return this.rmBaseObjectMap(e, v), a[p] = m, m && (this.applyColorSpaceToMaterials(m), this.addBaseObjectMap(e)), !0;
|
|
3431
3448
|
}
|
|
3432
3449
|
}
|
|
3433
|
-
return a[
|
|
3450
|
+
return a[h] = m, !0;
|
|
3434
3451
|
}
|
|
3435
3452
|
});
|
|
3436
3453
|
return Object.defineProperty(n, "__isProxy", {
|
|
@@ -3443,8 +3460,8 @@ class li {
|
|
|
3443
3460
|
}), e.materialList = new Proxy(e.materialList, {
|
|
3444
3461
|
set: (o, n, a) => {
|
|
3445
3462
|
if (typeof n == "string") {
|
|
3446
|
-
const
|
|
3447
|
-
return this.rmBaseObjectMap(e,
|
|
3463
|
+
const h = o[n];
|
|
3464
|
+
return this.rmBaseObjectMap(e, h), o[n] = a, a && (this.applyColorSpaceToMaterials(a), this.addBaseObjectMap(e)), !0;
|
|
3448
3465
|
}
|
|
3449
3466
|
return o[n] = a, !0;
|
|
3450
3467
|
},
|
|
@@ -3452,8 +3469,8 @@ class li {
|
|
|
3452
3469
|
if (typeof n == "string" && o[n]) {
|
|
3453
3470
|
const a = o[n];
|
|
3454
3471
|
if (Array.isArray(a)) {
|
|
3455
|
-
const
|
|
3456
|
-
return
|
|
3472
|
+
const h = s(a);
|
|
3473
|
+
return h !== a && (o[n] = h), h;
|
|
3457
3474
|
}
|
|
3458
3475
|
return a;
|
|
3459
3476
|
}
|
|
@@ -3484,7 +3501,7 @@ class li {
|
|
|
3484
3501
|
t[r] = o;
|
|
3485
3502
|
else {
|
|
3486
3503
|
if (e.materialList && Object.values(e.materialList).includes(o)) {
|
|
3487
|
-
t[r] = o;
|
|
3504
|
+
t[r] = o, e.handleMaterialChange(o);
|
|
3488
3505
|
return;
|
|
3489
3506
|
}
|
|
3490
3507
|
this.rmBaseObjectMap(e), t[r] = o, o && this.applyColorSpaceToMaterials(o), this.addBaseObjectMap(e);
|
|
@@ -3530,8 +3547,8 @@ class li {
|
|
|
3530
3547
|
n !== -1 && (o[n] = t);
|
|
3531
3548
|
} else o === e && (r.material = t);
|
|
3532
3549
|
i.materialList && Object.keys(i.materialList).forEach((n) => {
|
|
3533
|
-
var
|
|
3534
|
-
const a = (
|
|
3550
|
+
var h;
|
|
3551
|
+
const a = (h = i.materialList) == null ? void 0 : h[n];
|
|
3535
3552
|
if (Array.isArray(a)) {
|
|
3536
3553
|
const m = a.indexOf(e);
|
|
3537
3554
|
m !== -1 && (a[m] = t);
|
|
@@ -3581,22 +3598,22 @@ class di {
|
|
|
3581
3598
|
devicePixelRatio: o,
|
|
3582
3599
|
antialias: n,
|
|
3583
3600
|
powerPreference: a,
|
|
3584
|
-
toneMappingExposure:
|
|
3601
|
+
toneMappingExposure: h,
|
|
3585
3602
|
outputColorSpace: m,
|
|
3586
3603
|
logarithmicDepthBuffer: p,
|
|
3587
3604
|
preserveDrawingBuffer: v,
|
|
3588
|
-
stencil:
|
|
3605
|
+
stencil: _,
|
|
3589
3606
|
depth: u
|
|
3590
|
-
} = i, g = new
|
|
3607
|
+
} = i, g = new is({
|
|
3591
3608
|
alpha: r,
|
|
3592
3609
|
antialias: n,
|
|
3593
3610
|
powerPreference: a,
|
|
3594
3611
|
logarithmicDepthBuffer: p,
|
|
3595
3612
|
preserveDrawingBuffer: v,
|
|
3596
|
-
stencil:
|
|
3613
|
+
stencil: _,
|
|
3597
3614
|
depth: u
|
|
3598
3615
|
});
|
|
3599
|
-
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure =
|
|
3616
|
+
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = h, g.outputColorSpace = m, this.renderer = g;
|
|
3600
3617
|
}
|
|
3601
3618
|
setSize(e, t) {
|
|
3602
3619
|
this.renderer.setSize(e, t);
|
|
@@ -3608,8 +3625,8 @@ class di {
|
|
|
3608
3625
|
this.renderer.render(e, t);
|
|
3609
3626
|
}
|
|
3610
3627
|
setViewport(e) {
|
|
3611
|
-
var a,
|
|
3612
|
-
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (
|
|
3628
|
+
var a, h;
|
|
3629
|
+
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (h = e.scissorTest) != null ? h : !1;
|
|
3613
3630
|
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
|
|
3614
3631
|
}
|
|
3615
3632
|
dispose() {
|
|
@@ -3628,7 +3645,7 @@ class mi extends ee {
|
|
|
3628
3645
|
super(), this.options = e;
|
|
3629
3646
|
}
|
|
3630
3647
|
addScene(e, t) {
|
|
3631
|
-
const s = new
|
|
3648
|
+
const s = new dt();
|
|
3632
3649
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
3633
3650
|
}
|
|
3634
3651
|
removePage(e) {
|
|
@@ -3643,7 +3660,7 @@ class mi extends ee {
|
|
|
3643
3660
|
});
|
|
3644
3661
|
}
|
|
3645
3662
|
}
|
|
3646
|
-
class
|
|
3663
|
+
class ui {
|
|
3647
3664
|
constructor(e) {
|
|
3648
3665
|
this.event = new ye.EventEmitter();
|
|
3649
3666
|
const { renderer: t, scene: s, camera: i } = e, r = new Ts(
|
|
@@ -3652,7 +3669,7 @@ class fi {
|
|
|
3652
3669
|
);
|
|
3653
3670
|
if (r.getHelper) {
|
|
3654
3671
|
const o = r.getHelper();
|
|
3655
|
-
if (s.add(o), +
|
|
3672
|
+
if (s.add(o), +rs < 170) {
|
|
3656
3673
|
const n = r._root;
|
|
3657
3674
|
n.dispose = () => {
|
|
3658
3675
|
n.traverse((a) => {
|
|
@@ -3662,7 +3679,7 @@ class fi {
|
|
|
3662
3679
|
r.disconnect(), n.dispose();
|
|
3663
3680
|
};
|
|
3664
3681
|
}
|
|
3665
|
-
} else r instanceof
|
|
3682
|
+
} else r instanceof os && s.add(r);
|
|
3666
3683
|
this.controls = r, this.addEvent();
|
|
3667
3684
|
}
|
|
3668
3685
|
get detach() {
|
|
@@ -3712,7 +3729,7 @@ class fi {
|
|
|
3712
3729
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3713
3730
|
}
|
|
3714
3731
|
}
|
|
3715
|
-
const
|
|
3732
|
+
const fi = {
|
|
3716
3733
|
antialias: !0,
|
|
3717
3734
|
devicePixelRatio: window.devicePixelRatio
|
|
3718
3735
|
};
|
|
@@ -3738,7 +3755,7 @@ class _i {
|
|
|
3738
3755
|
const _e = class _e {
|
|
3739
3756
|
constructor(e) {
|
|
3740
3757
|
var r, o;
|
|
3741
|
-
this.raycaster = new
|
|
3758
|
+
this.raycaster = new ct(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new H(), this._cameraTarget = new H(), this.event = new ye.EventEmitter(), this.timer = new ns(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this._isDispose = !1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = Dt(_e.options, e, {
|
|
3742
3759
|
isMergeableObject: Es
|
|
3743
3760
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3744
3761
|
const {
|
|
@@ -3747,7 +3764,7 @@ const _e = class _e {
|
|
|
3747
3764
|
transformControls: i
|
|
3748
3765
|
} = this.options;
|
|
3749
3766
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3750
|
-
const n = new
|
|
3767
|
+
const n = new Ut({
|
|
3751
3768
|
horizontal: !1
|
|
3752
3769
|
});
|
|
3753
3770
|
n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
|
|
@@ -3815,7 +3832,7 @@ const _e = class _e {
|
|
|
3815
3832
|
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;
|
|
3816
3833
|
}
|
|
3817
3834
|
init() {
|
|
3818
|
-
var
|
|
3835
|
+
var f;
|
|
3819
3836
|
const {
|
|
3820
3837
|
container: e,
|
|
3821
3838
|
WebGPUTHREE: t,
|
|
@@ -3824,15 +3841,15 @@ const _e = class _e {
|
|
|
3824
3841
|
renderer: r,
|
|
3825
3842
|
controls: o,
|
|
3826
3843
|
loader: n
|
|
3827
|
-
} = this.options, { width: a, height:
|
|
3844
|
+
} = this.options, { width: a, height: h } = this.getSize(), m = t ? new _i({
|
|
3828
3845
|
width: a,
|
|
3829
|
-
height:
|
|
3846
|
+
height: h,
|
|
3830
3847
|
//@ts-ignore
|
|
3831
3848
|
renderer: this.options.WebGPURenderer,
|
|
3832
|
-
rendererParams:
|
|
3849
|
+
rendererParams: fi
|
|
3833
3850
|
}) : new di({
|
|
3834
3851
|
width: a,
|
|
3835
|
-
height:
|
|
3852
|
+
height: h,
|
|
3836
3853
|
rendererParams: te(U({}, r), {
|
|
3837
3854
|
antialias: !1
|
|
3838
3855
|
})
|
|
@@ -3840,10 +3857,10 @@ const _e = class _e {
|
|
|
3840
3857
|
this.rendererController = m;
|
|
3841
3858
|
const p = new Ds({
|
|
3842
3859
|
width: a,
|
|
3843
|
-
height:
|
|
3844
|
-
}), v = new mi({}),
|
|
3860
|
+
height: h
|
|
3861
|
+
}), v = new mi({}), _ = new Ks({
|
|
3845
3862
|
controlsParams: {
|
|
3846
|
-
domElement: (
|
|
3863
|
+
domElement: (f = o == null ? void 0 : o.domElement) != null ? f : m.renderer.domElement
|
|
3847
3864
|
}
|
|
3848
3865
|
}), u = new ai({
|
|
3849
3866
|
loaderParams: U({
|
|
@@ -3854,7 +3871,7 @@ const _e = class _e {
|
|
|
3854
3871
|
}), y = new si({
|
|
3855
3872
|
pencil: this
|
|
3856
3873
|
});
|
|
3857
|
-
this.sceneController = v, this.cameraController = p, this.controlsController =
|
|
3874
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = _, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3858
3875
|
const l = this.addPage({
|
|
3859
3876
|
sceneOptions: this.options.scene,
|
|
3860
3877
|
cameraOptions: this.options.camera
|
|
@@ -3898,7 +3915,7 @@ const _e = class _e {
|
|
|
3898
3915
|
}
|
|
3899
3916
|
}
|
|
3900
3917
|
initTransformControls() {
|
|
3901
|
-
const e = new
|
|
3918
|
+
const e = new ui({
|
|
3902
3919
|
camera: this.camera,
|
|
3903
3920
|
renderer: this.renderer,
|
|
3904
3921
|
scene: this.scene
|
|
@@ -3936,8 +3953,8 @@ const _e = class _e {
|
|
|
3936
3953
|
composerController: o,
|
|
3937
3954
|
cssRendererController: n,
|
|
3938
3955
|
leadController: a
|
|
3939
|
-
} = this,
|
|
3940
|
-
|
|
3956
|
+
} = this, h = this.renderer.getSize(new B());
|
|
3957
|
+
h.x === e && h.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((m) => {
|
|
3941
3958
|
var p;
|
|
3942
3959
|
(p = m.setSize) == null || p.call(m, e, t);
|
|
3943
3960
|
}), this.viewPadding.some((m) => m !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
@@ -3971,15 +3988,15 @@ const _e = class _e {
|
|
|
3971
3988
|
const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), a = o.getBoundingClientRect();
|
|
3972
3989
|
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) {
|
|
3973
3990
|
i.setFromCamera(n, this.camera);
|
|
3974
|
-
const
|
|
3991
|
+
const h = i.intersectObjects(
|
|
3975
3992
|
t || this.scene.children,
|
|
3976
3993
|
s
|
|
3977
3994
|
);
|
|
3978
|
-
if (
|
|
3995
|
+
if (h.length)
|
|
3979
3996
|
return {
|
|
3980
|
-
object:
|
|
3981
|
-
index:
|
|
3982
|
-
intersects:
|
|
3997
|
+
object: h[0].object,
|
|
3998
|
+
index: h[0].index,
|
|
3999
|
+
intersects: h
|
|
3983
4000
|
};
|
|
3984
4001
|
}
|
|
3985
4002
|
}
|
|
@@ -3989,9 +4006,9 @@ const _e = class _e {
|
|
|
3989
4006
|
return;
|
|
3990
4007
|
this.event.emit("beforeRender"), this.timer.update(), Ce.update();
|
|
3991
4008
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3992
|
-
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((
|
|
4009
|
+
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((h) => {
|
|
3993
4010
|
var m;
|
|
3994
|
-
(m =
|
|
4011
|
+
(m = h.update) == null || m.call(h, e, t);
|
|
3995
4012
|
}), (s = this.helperController) == null || s.update(
|
|
3996
4013
|
e,
|
|
3997
4014
|
this.controlsController,
|
|
@@ -4036,11 +4053,11 @@ const _e = class _e {
|
|
|
4036
4053
|
}
|
|
4037
4054
|
}
|
|
4038
4055
|
dispose() {
|
|
4039
|
-
var e, t, s, i, r, o, n, a,
|
|
4056
|
+
var e, t, s, i, r, o, n, a, h, m, p, v, _, u;
|
|
4040
4057
|
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4041
4058
|
var y;
|
|
4042
4059
|
(y = g.dispose) == null || y.call(g);
|
|
4043
|
-
}), (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(), (
|
|
4060
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (_ = this.stats) == null || _.dom.remove(), (u = this.renderer) == null || u.domElement.remove(), this._isDispose = !0;
|
|
4044
4061
|
}
|
|
4045
4062
|
};
|
|
4046
4063
|
_e.options = {
|
|
@@ -4052,23 +4069,23 @@ _e.options = {
|
|
|
4052
4069
|
renderer: ci,
|
|
4053
4070
|
composer: Zs,
|
|
4054
4071
|
scene: pi,
|
|
4055
|
-
camera:
|
|
4072
|
+
camera: Tt,
|
|
4056
4073
|
bloom: !1,
|
|
4057
4074
|
bloomParams: Ys,
|
|
4058
4075
|
ssao: !1,
|
|
4059
4076
|
loader: ni,
|
|
4060
4077
|
ssaoParams: Vs,
|
|
4061
4078
|
css2DRenderer: !1,
|
|
4062
|
-
css2DRendererParams: U({},
|
|
4079
|
+
css2DRendererParams: U({}, st),
|
|
4063
4080
|
css3DRenderer: !1,
|
|
4064
|
-
css3DRendererParams: U({},
|
|
4081
|
+
css3DRendererParams: U({}, st)
|
|
4065
4082
|
};
|
|
4066
|
-
let
|
|
4083
|
+
let ot = _e;
|
|
4067
4084
|
const Xi = J.ACTION;
|
|
4068
4085
|
export {
|
|
4069
|
-
|
|
4070
|
-
|
|
4086
|
+
as as BaseObject,
|
|
4087
|
+
ot as Pencil,
|
|
4071
4088
|
Pe as ResourceTracker,
|
|
4072
4089
|
Xi as cameraControlsAction,
|
|
4073
|
-
|
|
4090
|
+
ot as default
|
|
4074
4091
|
};
|