gl-draw 0.16.0-beta.2 → 0.16.0-beta.20
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 +265 -255
- package/dist/core/BaseObject/index.d.ts +6 -2
- package/dist/core/Lead/Lead.d.ts +8 -8
- package/dist/index.js +2 -2
- package/dist/index.module.js +430 -418
- package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +1 -22
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +58 -58
- package/dist/objects/node/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +21 -21
- package/package.json +8 -8
package/dist/index.module.js
CHANGED
|
@@ -2,36 +2,36 @@ var St = Object.defineProperty, At = Object.defineProperties;
|
|
|
2
2
|
var Mt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Me = Object.getOwnPropertySymbols;
|
|
4
4
|
var Rt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Re = (
|
|
5
|
+
var Re = (c, e, t) => e in c ? St(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
|
-
Rt.call(e, t) && Re(
|
|
7
|
+
Rt.call(e, t) && Re(c, t, e[t]);
|
|
8
8
|
if (Me)
|
|
9
9
|
for (var t of Me(e))
|
|
10
|
-
Dt.call(e, t) && Re(
|
|
11
|
-
return
|
|
12
|
-
}, te = (
|
|
13
|
-
var se = (
|
|
10
|
+
Dt.call(e, t) && Re(c, t, e[t]);
|
|
11
|
+
return c;
|
|
12
|
+
}, te = (c, e) => At(c, Mt(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
30
|
import Ut from "deepmerge";
|
|
31
|
-
import
|
|
32
|
-
import { Vector3 as j, PerspectiveCamera as
|
|
33
|
-
import { M as
|
|
34
|
-
import { EffectComposer as
|
|
31
|
+
import kt from "stats-gl";
|
|
32
|
+
import { Vector3 as j, PerspectiveCamera as zt, Matrix4 as W, ShaderMaterial as Ft, UniformsUtils as Nt, RawShaderMaterial as It, MeshBasicMaterial as jt, PointsMaterial as at, SpriteMaterial as lt, Color as Ht, Layers as Bt, Vector2 as B, WebGLRenderTarget as Vt, HalfFloatType as Yt, MathUtils as Zt, Vector4 as Wt, Quaternion as ht, Spherical as Kt, Box3 as ct, Sphere as $t, Raycaster as dt, AxesHelper as De, CameraHelper as Gt, PointLightHelper as Xt, DirectionalLightHelper as qt, SpotLightHelper as Qt, HemisphereLightHelper as Jt, Box3Helper as Ue, Scene as pt, Group as ke, Camera as es, Loader as mt, FileLoader as Se, Texture as ue, VideoTexture as ts, LoadingManager as ss, DataTexture as is, WebGLRenderer as rs, REVISION as os, Object3D as ns, Timer as as } from "three";
|
|
33
|
+
import { M as ft, B as Oe, a as ls, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
|
|
34
|
+
import { EffectComposer as ze } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
35
|
import { RenderPass as hs } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
36
|
import { SSAOPass as cs } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
37
|
import { UnrealBloomPass as ds } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
@@ -48,8 +48,8 @@ import "three/examples/jsm/lines/LineSegments2";
|
|
|
48
48
|
import { ShaderPass as ps } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
49
49
|
import { OutputPass as ms } from "three/examples/jsm/postprocessing/OutputPass";
|
|
50
50
|
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
51
|
-
import { RectAreaLightHelper as
|
|
52
|
-
import { ViewHelper as
|
|
51
|
+
import { RectAreaLightHelper as fs } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
|
+
import { ViewHelper as us } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
53
|
import { generateUUID as Ne, 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";
|
|
@@ -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 H(
|
|
95
|
-
return
|
|
94
|
+
function H(c) {
|
|
95
|
+
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2, je = Math.PI / 2,
|
|
98
|
-
function
|
|
99
|
-
return Math.max(e, Math.min(t,
|
|
97
|
+
const $ = Math.PI * 2, je = 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
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const v = (t.value + o *
|
|
119
|
+
let h = c - e;
|
|
120
|
+
const m = e, p = i * s;
|
|
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
|
|
124
|
+
let _ = e + (h + v) * a;
|
|
125
|
+
return m - c > 0 == _ > m && (_ = m, t.value = (_ - m) / r), _;
|
|
126
126
|
}
|
|
127
|
-
function Be(
|
|
127
|
+
function Be(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
|
|
131
|
-
const y =
|
|
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, f = c.y - p, g = c.z - v;
|
|
131
|
+
const y = m, l = p, u = v, O = i * s, C = O * O, w = _ * _ + f * f + g * g;
|
|
132
132
|
if (w > C) {
|
|
133
133
|
const ve = Math.sqrt(w);
|
|
134
|
-
|
|
134
|
+
_ = _ / ve * O, f = f / ve * O, g = g / ve * O;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
const E = (t.x + n *
|
|
138
|
-
t.x = (t.x - n * E) *
|
|
139
|
-
const V = y -
|
|
140
|
-
return V * xt + le * Lt + bt * Pt > 0 && (o.x = y, o.y = l, o.z =
|
|
136
|
+
m = c.x - _, p = c.y - f, v = c.z - g;
|
|
137
|
+
const E = (t.x + n * _) * r, x = (t.y + n * f) * r, R = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * h, t.y = (t.y - n * x) * h, t.z = (t.z - n * R) * h, o.x = m + (_ + E) * h, o.y = p + (f + x) * h, o.z = v + (g + R) * h;
|
|
139
|
+
const V = y - c.x, le = l - c.y, bt = u - c.z, xt = o.x - y, Lt = o.y - l, Pt = o.z - u;
|
|
140
|
+
return V * xt + le * Lt + bt * Pt > 0 && (o.x = y, o.y = l, o.z = u, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - u) / 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 H(
|
|
147
|
+
function Te(c, e) {
|
|
148
|
+
return H(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
150
|
class ws {
|
|
151
151
|
constructor() {
|
|
@@ -212,10 +212,10 @@ class ws {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
const de = 1 / 8, bs = /Mac/.test(navigator.platform);
|
|
215
|
-
let T, Ve, pe, we, D, b, L, G, ne, F, N, Z, Ye, Ze,
|
|
215
|
+
let T, Ve, pe, we, D, b, L, G, ne, F, N, Z, Ye, Ze, k, ae, X, We, be, Ke, xe, Le, me;
|
|
216
216
|
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE, Ve = 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(), b = 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(), Ye = new T.Vector3(), Ze = new T.Vector3(),
|
|
218
|
+
T = e.THREE, Ve = 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(), b = 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(), Ye = new T.Vector3(), Ze = new T.Vector3(), k = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), We = new T.Box3(), be = new T.Sphere(), Ke = new T.Quaternion(), xe = new T.Quaternion(), Le = new T.Matrix4(), me = new T.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -243,14 +243,14 @@ class J extends ws {
|
|
|
243
243
|
*/
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
246
|
-
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l,
|
|
246
|
+
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, u, O, C) => {
|
|
247
247
|
let w, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
249
|
const x = b.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(R * 0.5);
|
|
250
|
-
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed *
|
|
250
|
+
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * u * V / this._elementRect.height;
|
|
251
251
|
} else if (H(this._camera)) {
|
|
252
252
|
const x = this._camera;
|
|
253
|
-
w = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed *
|
|
253
|
+
w = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * u * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
256
|
C ? (O ? this.setFocalOffset(
|
|
@@ -264,19 +264,19 @@ 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, u) => {
|
|
268
|
+
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * u / 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, x =
|
|
270
|
+
}, this._dollyInternal = (l, u, O) => {
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, x = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
275
|
), R = x - E;
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - w, this._dollyControlCoord.set(
|
|
277
|
-
}, this._zoomInternal = (l,
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - w, this._dollyControlCoord.set(u, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
|
+
}, this._zoomInternal = (l, u, 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(u, 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(
|
|
@@ -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 u = 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 (u !== null) {
|
|
314
|
+
const C = this._findPointerByMouseButton(u);
|
|
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: u
|
|
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 u = l.pointerId, O = this._lockedPointer || this._findPointerById(u);
|
|
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,12 +354,12 @@ 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 u = this._findPointerById(l.pointerId);
|
|
361
|
+
if (!(u && u === this._lockedPointer)) {
|
|
362
|
+
if (u && this._disposePointer(u), l.pointerType === "touch")
|
|
363
363
|
switch (this._activePointers.length) {
|
|
364
364
|
case 0:
|
|
365
365
|
this._state = d.NONE;
|
|
@@ -376,11 +376,11 @@ class J extends ws {
|
|
|
376
376
|
}
|
|
377
377
|
else
|
|
378
378
|
this._state = d.NONE;
|
|
379
|
-
|
|
379
|
+
f();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
|
-
let
|
|
383
|
-
const
|
|
382
|
+
let h = -1;
|
|
383
|
+
const m = (l) => {
|
|
384
384
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
385
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
386
386
|
const E = this._domElement.getBoundingClientRect(), x = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
@@ -389,9 +389,9 @@ class J extends ws {
|
|
|
389
389
|
}
|
|
390
390
|
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
|
|
391
391
|
const E = performance.now();
|
|
392
|
-
|
|
392
|
+
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const u = bs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / u : l.deltaY / (u * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
396
|
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -422,7 +422,7 @@ class J extends ws {
|
|
|
422
422
|
}, p = (l) => {
|
|
423
423
|
if (!(!this._domElement || !this._enabled)) {
|
|
424
424
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
425
|
-
const
|
|
425
|
+
const u = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(u);
|
|
426
426
|
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener(
|
|
427
427
|
"pointermove",
|
|
428
428
|
n,
|
|
@@ -460,10 +460,10 @@ class J extends ws {
|
|
|
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
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
|
-
},
|
|
463
|
+
}, _ = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
465
|
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
466
|
-
const
|
|
466
|
+
const u = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = u ? -u.deltaX : i.x - D.x, C = u ? -u.deltaY : i.y - D.y;
|
|
467
467
|
if (i.copy(D), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
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, x = this.dollyDragInverted ? -1 : 1;
|
|
469
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
@@ -483,7 +483,7 @@ class J extends ws {
|
|
|
483
483
|
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
485
485
|
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
|
-
},
|
|
486
|
+
}, f = () => {
|
|
487
487
|
Ee(this._activePointers, D), i.copy(D), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
|
|
488
488
|
"pointermove",
|
|
489
489
|
n,
|
|
@@ -520,8 +520,8 @@ class J extends ws {
|
|
|
520
520
|
{ passive: !1 }
|
|
521
521
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), v());
|
|
522
522
|
}, this.unlockPointer = () => {
|
|
523
|
-
var l,
|
|
524
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (
|
|
523
|
+
var l, u, O;
|
|
524
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (u = this._domElement) === null || u === void 0 || u.ownerDocument.removeEventListener(
|
|
525
525
|
"pointerlockchange",
|
|
526
526
|
g
|
|
527
527
|
), (O = this._domElement) === null || O === void 0 || O.ownerDocument.removeEventListener(
|
|
@@ -535,11 +535,11 @@ class J extends ws {
|
|
|
535
535
|
this.unlockPointer();
|
|
536
536
|
};
|
|
537
537
|
this._addAllEventListeners = (l) => {
|
|
538
|
-
this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel",
|
|
538
|
+
this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel", m, {
|
|
539
539
|
passive: !1
|
|
540
540
|
}), this._domElement.addEventListener("contextmenu", p);
|
|
541
541
|
}, this._removeAllEventListeners = () => {
|
|
542
|
-
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel",
|
|
542
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel", m, {
|
|
543
543
|
passive: !1
|
|
544
544
|
}), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
|
|
545
545
|
"pointermove",
|
|
@@ -556,7 +556,7 @@ class J extends ws {
|
|
|
556
556
|
y
|
|
557
557
|
));
|
|
558
558
|
}, this.cancel = () => {
|
|
559
|
-
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0,
|
|
559
|
+
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, f());
|
|
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
|
}
|
|
@@ -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
|
|
989
|
-
a.push(this.rotateTo(
|
|
990
|
-
const v = b.setFromSpherical(this._sphericalEnd).normalize(),
|
|
991
|
-
|
|
988
|
+
const m = He(this._sphericalEnd.theta, je), p = He(this._sphericalEnd.phi, je);
|
|
989
|
+
a.push(this.rotateTo(m, p, t));
|
|
990
|
+
const v = b.setFromSpherical(this._sphericalEnd).normalize(), _ = Ke.setFromUnitVectors(v, we), f = P(Math.abs(v.y), 1);
|
|
991
|
+
f && _.multiply(xe.setFromAxisAngle(pe, m)), _.multiply(this._yAxisUpSpaceInverse);
|
|
992
992
|
const g = We.makeEmpty();
|
|
993
|
-
L.copy(
|
|
994
|
-
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(
|
|
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), f && _.premultiply(xe.invert()), _.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(_);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
|
-
const
|
|
996
|
+
const u = 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(
|
|
1004
|
+
), a.push(this.dollyTo(u, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
1005
|
} else if (H(this._camera)) {
|
|
1006
|
-
const
|
|
1006
|
+
const u = this._camera, O = u.right - u.left, C = u.top - u.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));
|
|
@@ -1029,8 +1029,8 @@ class J extends ws {
|
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
1031
|
} else if (H(this._camera)) {
|
|
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(
|
|
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,11 +1047,11 @@ 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 = b.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
|
-
const
|
|
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,
|
|
1056
1056
|
this._sphericalEnd.theta,
|
|
1057
1057
|
this.restThreshold
|
|
@@ -1064,7 +1064,7 @@ class J extends ws {
|
|
|
1064
1064
|
this._sphericalEnd.radius,
|
|
1065
1065
|
this.restThreshold
|
|
1066
1066
|
);
|
|
1067
|
-
return this._createOnRestPromise(
|
|
1067
|
+
return this._createOnRestPromise(m);
|
|
1068
1068
|
}
|
|
1069
1069
|
/**
|
|
1070
1070
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -1084,23 +1084,23 @@ class J extends ws {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, _, f = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
1089
|
const g = b.set(i, r, o), y = L.set(e, t, s);
|
|
1090
|
-
|
|
1090
|
+
k.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(
|
|
1093
|
+
const l = G.set(m, p, v), u = L.set(n, a, h);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
|
-
|
|
1096
|
-
), this._targetEnd.copy(g.lerp(l,
|
|
1097
|
-
const O = ae.theta -
|
|
1095
|
+
u.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
|
-
|
|
1102
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1103
|
-
const E = !
|
|
1099
|
+
k.radius + w * _,
|
|
1100
|
+
k.phi + C * _,
|
|
1101
|
+
k.theta + O * _
|
|
1102
|
+
), this.normalizeRotations(), this._needsUpdate = !0, f || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
|
+
const E = !f || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
1105
1105
|
this._sphericalEnd.theta,
|
|
1106
1106
|
this.restThreshold
|
|
@@ -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
|
|
@@ -1454,29 +1454,29 @@ 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,
|
|
1458
|
-
|
|
1459
|
-
const g = L.crossVectors(
|
|
1460
|
-
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne), f = b.copy(_).cross(v.up).normalize();
|
|
1458
|
+
f.lengthSq() === 0 && (f.x = 1);
|
|
1459
|
+
const g = L.crossVectors(f, _), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), u = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
|
+
f.multiplyScalar(
|
|
1461
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
), C = b.copy(this._targetEnd).lerp(O,
|
|
1465
|
+
), C = b.copy(this._targetEnd).lerp(O, u), 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
1472
|
const x = L.subVectors(C, this._targetEnd);
|
|
1473
1473
|
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
1474
|
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera,
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, _ = b.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v),
|
|
1479
|
+
).unproject(v), f = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(f.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, u = this._getCameraDirection(ne), O = this._targetEnd.dot(u), C = b.copy(this._targetEnd).lerp(g, l), w = C.dot(u), E = u.multiplyScalar(
|
|
1480
1480
|
w - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
@@ -1491,8 +1491,8 @@ class J extends ws {
|
|
|
1491
1491
|
b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
|
-
const
|
|
1495
|
-
return
|
|
1494
|
+
const m = this._needsUpdate;
|
|
1495
|
+
return m && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : m ? (this.dispatchEvent({ type: "update" }), A(t, this.restThreshold) && A(s, this.restThreshold) && A(i, this.restThreshold) && A(r.x, this.restThreshold) && A(r.y, this.restThreshold) && A(r.z, this.restThreshold) && A(o.x, this.restThreshold) && A(o.y, this.restThreshold) && A(o.z, this.restThreshold) && A(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !m && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = m, this._needsUpdate = !1, m;
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
1498
1498
|
* Get all state in JSON string
|
|
@@ -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),
|
|
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
1536
|
b.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1537
|
-
), this.rotateTo(
|
|
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,8 +1598,8 @@ 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() {
|
|
@@ -1701,22 +1701,22 @@ class J extends ws {
|
|
|
1701
1701
|
if (!n.geometry) return;
|
|
1702
1702
|
const a = n.geometry.clone();
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
|
-
const
|
|
1705
|
-
for (let p = 0, v =
|
|
1706
|
-
b.fromBufferAttribute(
|
|
1704
|
+
const m = a.attributes.position;
|
|
1705
|
+
for (let p = 0, v = m.count; p < v; p++)
|
|
1706
|
+
b.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(b));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
1710
|
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, $e = 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
|
+
}, fe;
|
|
1713
|
+
Q && typeof Q.ownKeys == "function" ? fe = Q.ownKeys : Object.getOwnPropertySymbols ? fe = function(e) {
|
|
1714
1714
|
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
1715
|
-
} :
|
|
1715
|
+
} : fe = function(e) {
|
|
1716
1716
|
return Object.getOwnPropertyNames(e);
|
|
1717
1717
|
};
|
|
1718
|
-
function xs(
|
|
1719
|
-
console && console.warn && console.warn(
|
|
1718
|
+
function xs(c) {
|
|
1719
|
+
console && console.warn && console.warn(c);
|
|
1720
1720
|
}
|
|
1721
1721
|
var _t = Number.isNaN || function(e) {
|
|
1722
1722
|
return e !== e;
|
|
@@ -1731,19 +1731,19 @@ S.prototype._events = void 0;
|
|
|
1731
1731
|
S.prototype._eventsCount = 0;
|
|
1732
1732
|
S.prototype._maxListeners = void 0;
|
|
1733
1733
|
var Ge = 10;
|
|
1734
|
-
function ge(
|
|
1735
|
-
if (typeof
|
|
1736
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof
|
|
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
1741
|
return Ge;
|
|
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
|
-
Ge =
|
|
1743
|
+
set: function(c) {
|
|
1744
|
+
if (typeof c != "number" || c < 0 || _t(c))
|
|
1745
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + c + ".");
|
|
1746
|
+
Ge = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
S.init = function() {
|
|
@@ -1754,8 +1754,8 @@ S.prototype.setMaxListeners = function(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 gt(
|
|
1758
|
-
return
|
|
1757
|
+
function gt(c) {
|
|
1758
|
+
return c._maxListeners === void 0 ? S.defaultMaxListeners : c._maxListeners;
|
|
1759
1759
|
}
|
|
1760
1760
|
S.prototype.getMaxListeners = function() {
|
|
1761
1761
|
return gt(this);
|
|
@@ -1780,24 +1780,24 @@ S.prototype.emit = function(e) {
|
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
1781
|
$e(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var
|
|
1784
|
-
$e(
|
|
1783
|
+
for (var h = a.length, m = Et(a, h), s = 0; s < h; ++s)
|
|
1784
|
+
$e(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
|
-
function yt(
|
|
1787
|
+
function yt(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 = gt(
|
|
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 = gt(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, xs(n);
|
|
1799
1799
|
}
|
|
1800
|
-
return
|
|
1800
|
+
return c;
|
|
1801
1801
|
}
|
|
1802
1802
|
S.prototype.addListener = function(e, t) {
|
|
1803
1803
|
return yt(this, e, t, !1);
|
|
@@ -1810,8 +1810,8 @@ 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 vt(
|
|
1814
|
-
var s = { fired: !1, wrapFn: void 0, target:
|
|
1813
|
+
function vt(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) {
|
|
@@ -1860,8 +1860,8 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function Ct(
|
|
1864
|
-
var s =
|
|
1863
|
+
function Ct(c, e, t) {
|
|
1864
|
+
var s = c._events;
|
|
1865
1865
|
if (s === void 0)
|
|
1866
1866
|
return [];
|
|
1867
1867
|
var i = s[e];
|
|
@@ -1873,14 +1873,14 @@ S.prototype.listeners = function(e) {
|
|
|
1873
1873
|
S.prototype.rawListeners = function(e) {
|
|
1874
1874
|
return Ct(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) : Ot.call(c, e);
|
|
1878
1878
|
};
|
|
1879
1879
|
S.prototype.listenerCount = Ot;
|
|
1880
|
-
function Ot(
|
|
1880
|
+
function Ot(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 ? fe(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function Et(
|
|
1894
|
+
function Et(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
|
-
Tt(
|
|
1917
|
+
Tt(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" && Tt(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function Tt(
|
|
1924
|
-
if (typeof
|
|
1925
|
-
s.once ?
|
|
1926
|
-
else if (typeof
|
|
1927
|
-
|
|
1928
|
-
s.once &&
|
|
1923
|
+
function Tt(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 {
|
|
@@ -2005,8 +2005,8 @@ class Ds extends ee {
|
|
|
2005
2005
|
return this.controller;
|
|
2006
2006
|
}
|
|
2007
2007
|
addPerspectiveCamera(e = wt, t) {
|
|
2008
|
-
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height,
|
|
2009
|
-
return
|
|
2008
|
+
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, h = new zt(s, a, r, i);
|
|
2009
|
+
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 = (
|
|
2080
|
+
const Us = (c) => {
|
|
2081
2081
|
const e = new ps(
|
|
2082
2082
|
new Ft({
|
|
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,10 +2207,10 @@ const Us = (h) => {
|
|
|
2207
2207
|
}`
|
|
2208
2208
|
)
|
|
2209
2209
|
};
|
|
2210
|
-
class
|
|
2210
|
+
class zs extends ms {
|
|
2211
2211
|
constructor() {
|
|
2212
2212
|
super();
|
|
2213
|
-
const e =
|
|
2213
|
+
const e = ks;
|
|
2214
2214
|
this.uniforms = Nt.clone(e.uniforms), this.material = new It({
|
|
2215
2215
|
name: e.name,
|
|
2216
2216
|
uniforms: this.uniforms,
|
|
@@ -2231,7 +2231,7 @@ const Fs = new jt({ color: "black" }), Ns = new at({
|
|
|
2231
2231
|
}), Hs = new lt({
|
|
2232
2232
|
color: "black",
|
|
2233
2233
|
sizeAttenuation: !1
|
|
2234
|
-
}), Bs = new
|
|
2234
|
+
}), Bs = new ft({
|
|
2235
2235
|
color: "black",
|
|
2236
2236
|
sizeAttenuation: !1,
|
|
2237
2237
|
lineWidth: 0
|
|
@@ -2258,23 +2258,23 @@ class Ws {
|
|
|
2258
2258
|
composerParams: r
|
|
2259
2259
|
} = e, { renderer: o } = t;
|
|
2260
2260
|
this.renderer = o;
|
|
2261
|
-
const { multisampling: n } = r, { maxSamples: a } = o.capabilities,
|
|
2262
|
-
|
|
2263
|
-
|
|
2261
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, h = o.getDrawingBufferSize(new B()), m = new Vt(
|
|
2262
|
+
h.width,
|
|
2263
|
+
h.height,
|
|
2264
2264
|
{
|
|
2265
2265
|
samples: Math.min(n, a),
|
|
2266
2266
|
type: Yt
|
|
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 hs(
|
|
2271
2271
|
s.scene,
|
|
2272
2272
|
i.camera
|
|
2273
2273
|
);
|
|
2274
|
-
p.addPass(
|
|
2275
|
-
this.changeCamera(
|
|
2276
|
-
}), s.event.on("pageChange", (
|
|
2277
|
-
this.changeScene(
|
|
2274
|
+
p.addPass(_), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = _, i.event.on("pageChange", (f) => {
|
|
2275
|
+
this.changeCamera(f);
|
|
2276
|
+
}), s.event.on("pageChange", (f) => {
|
|
2277
|
+
this.changeScene(f);
|
|
2278
2278
|
});
|
|
2279
2279
|
}
|
|
2280
2280
|
changeCamera(e) {
|
|
@@ -2284,7 +2284,7 @@ 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) {
|
|
@@ -2302,10 +2302,10 @@ class Ws {
|
|
|
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,16 +2337,16 @@ 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 = js : n.material = Hs : o.material instanceof
|
|
2349
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = js : n.material = Hs : o.material instanceof ft ? 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) => {
|
|
@@ -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
|
-
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2461
|
+
const h = document.createElement("div");
|
|
2462
|
+
h.style.transformOrigin = "0 0", h.style.pointerEvents = "none", a.appendChild(h);
|
|
2463
|
+
const m = document.createElement("div");
|
|
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 u = 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(` +
|
|
2475
|
-
n.camera.style !== R && (
|
|
2474
|
+
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + u + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + u + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + u + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
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,37 +2483,37 @@ 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
|
-
function
|
|
2490
|
+
function f(y) {
|
|
2491
2491
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2492
|
-
for (let l = 0,
|
|
2493
|
-
|
|
2492
|
+
for (let l = 0, u = y.children.length; l < u; l++)
|
|
2493
|
+
f(y.children[l]);
|
|
2494
2494
|
}
|
|
2495
|
-
function g(y, l,
|
|
2495
|
+
function g(y, l, u, O) {
|
|
2496
2496
|
if (y.visible === !1) {
|
|
2497
|
-
|
|
2497
|
+
f(y);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
if (y.isCSS3DObject) {
|
|
2501
|
-
const C = y.layers.test(
|
|
2501
|
+
const C = y.layers.test(u.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, u);
|
|
2504
2504
|
let E;
|
|
2505
|
-
y.isCSS3DSprite ? (I.copy(
|
|
2505
|
+
y.isCSS3DSprite ? (I.copy(u.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Gs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(qe, $s, Qe), I.setPosition(qe), 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
2506
|
const x = n.objects.get(y);
|
|
2507
2507
|
if (x === void 0 || x.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 !==
|
|
2512
|
+
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l, u);
|
|
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, u);
|
|
2517
2517
|
}
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
@@ -2535,50 +2535,50 @@ class qs {
|
|
|
2535
2535
|
width: s,
|
|
2536
2536
|
height: i
|
|
2537
2537
|
};
|
|
2538
|
-
}, this.render = function(
|
|
2539
|
-
|
|
2540
|
-
}, this.setSize = function(
|
|
2541
|
-
s =
|
|
2538
|
+
}, this.render = function(f, g) {
|
|
2539
|
+
f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Je.copy(g.matrixWorldInverse), et.multiplyMatrices(g.projectionMatrix, Je), m(f, f, g), _(f);
|
|
2540
|
+
}, this.setSize = function(f, g) {
|
|
2541
|
+
s = f, i = g, r = s / 2, o = i / 2, a.style.width = f + "px", a.style.height = g + "px";
|
|
2542
2542
|
};
|
|
2543
|
-
function
|
|
2544
|
-
|
|
2545
|
-
for (let g = 0, y =
|
|
2546
|
-
|
|
2543
|
+
function h(f) {
|
|
2544
|
+
f.isCSS2DObject && (f.element.style.display = "none");
|
|
2545
|
+
for (let g = 0, y = f.children.length; g < y; g++)
|
|
2546
|
+
h(f.children[g]);
|
|
2547
2547
|
}
|
|
2548
|
-
function f
|
|
2549
|
-
if (
|
|
2550
|
-
|
|
2548
|
+
function m(f, g, y) {
|
|
2549
|
+
if (f.visible === !1) {
|
|
2550
|
+
h(f);
|
|
2551
2551
|
return;
|
|
2552
2552
|
}
|
|
2553
|
-
if (
|
|
2554
|
-
q.setFromMatrixPosition(
|
|
2555
|
-
const l = q.z >= -1 && q.z <= 1 &&
|
|
2556
|
-
|
|
2553
|
+
if (f.isCSS2DObject) {
|
|
2554
|
+
q.setFromMatrixPosition(f.matrixWorld), q.applyMatrix4(et);
|
|
2555
|
+
const l = q.z >= -1 && q.z <= 1 && f.layers.test(y.layers) === !0, u = f.element;
|
|
2556
|
+
u.style.display = l === !0 ? "" : "none", l === !0 && (f.onBeforeRender(t, g, y), u.style.transform = "translate(" + -100 * f.center.x + "%," + -100 * f.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", u.parentNode !== a && a.appendChild(u), f.onAfterRender(t, g, y));
|
|
2557
2557
|
const O = {
|
|
2558
|
-
distanceToCameraSquared: p(y,
|
|
2558
|
+
distanceToCameraSquared: p(y, f)
|
|
2559
2559
|
};
|
|
2560
|
-
n.objects.set(
|
|
2560
|
+
n.objects.set(f, O);
|
|
2561
2561
|
}
|
|
2562
|
-
for (let l = 0,
|
|
2563
|
-
f
|
|
2562
|
+
for (let l = 0, u = f.children.length; l < u; l++)
|
|
2563
|
+
m(f.children[l], g, y);
|
|
2564
2564
|
}
|
|
2565
|
-
function p(
|
|
2566
|
-
return tt.setFromMatrixPosition(
|
|
2565
|
+
function p(f, g) {
|
|
2566
|
+
return tt.setFromMatrixPosition(f.matrixWorld), st.setFromMatrixPosition(g.matrixWorld), tt.distanceToSquared(st);
|
|
2567
2567
|
}
|
|
2568
|
-
function v(
|
|
2568
|
+
function v(f) {
|
|
2569
2569
|
const g = [];
|
|
2570
|
-
return
|
|
2570
|
+
return f.traverseVisible(function(y) {
|
|
2571
2571
|
y.isCSS2DObject && g.push(y);
|
|
2572
2572
|
}), g;
|
|
2573
2573
|
}
|
|
2574
|
-
function
|
|
2575
|
-
const g = v(
|
|
2576
|
-
if (l.renderOrder !==
|
|
2577
|
-
return
|
|
2578
|
-
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(
|
|
2574
|
+
function _(f) {
|
|
2575
|
+
const g = v(f).sort(function(l, u) {
|
|
2576
|
+
if (l.renderOrder !== u.renderOrder)
|
|
2577
|
+
return u.renderOrder - l.renderOrder;
|
|
2578
|
+
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(u).distanceToCameraSquared;
|
|
2579
2579
|
return O - C;
|
|
2580
2580
|
}), y = g.length;
|
|
2581
|
-
for (let l = 0,
|
|
2581
|
+
for (let l = 0, u = g.length; l < u; l++)
|
|
2582
2582
|
g[l].element.style.zIndex = y - l;
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
@@ -2628,7 +2628,7 @@ class Js {
|
|
|
2628
2628
|
else if (e.isHemisphereLight)
|
|
2629
2629
|
i = new Jt(e, 10);
|
|
2630
2630
|
else if (e.isRectAreaLight)
|
|
2631
|
-
i = new
|
|
2631
|
+
i = new fs(e);
|
|
2632
2632
|
else {
|
|
2633
2633
|
const r = new ct();
|
|
2634
2634
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
@@ -2642,7 +2642,7 @@ class Js {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
}
|
|
2644
2644
|
addViewHelper() {
|
|
2645
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2645
|
+
const { cameraController: e, container: t } = this.options, s = new us(e.camera, t);
|
|
2646
2646
|
t.addEventListener("pointerdown", (i) => {
|
|
2647
2647
|
i.preventDefault(), s.handleClick(i);
|
|
2648
2648
|
}), this.viewHelper = s;
|
|
@@ -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 rt(
|
|
2695
|
+
function rt(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,27 +2715,27 @@ 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
|
|
2727
|
-
if (!
|
|
2728
|
-
a.has(
|
|
2729
|
-
const g = a.get(
|
|
2730
|
-
g.has(
|
|
2725
|
+
for (const _ of n)
|
|
2726
|
+
for (const f of _.objArr) {
|
|
2727
|
+
if (!f.object3d || !f.visibleWithAncestors) continue;
|
|
2728
|
+
a.has(f) || a.set(f, /* @__PURE__ */ new Map());
|
|
2729
|
+
const g = a.get(f);
|
|
2730
|
+
g.has(_.type) || g.set(_.type, []), g.get(_.type).push(_.cb);
|
|
2731
2731
|
}
|
|
2732
2732
|
if (a.size === 0) return;
|
|
2733
|
-
const
|
|
2734
|
-
if (!
|
|
2733
|
+
const h = [...a.keys()].map((_) => _.object3d), m = (v = this.pencil.pick(r, h, !0)) == null ? void 0 : v.intersects;
|
|
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();
|
|
@@ -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,
|
|
@@ -2776,9 +2776,9 @@ class ei {
|
|
|
2776
2776
|
sp: o,
|
|
2777
2777
|
intersectionIndex: s
|
|
2778
2778
|
});
|
|
2779
|
-
const
|
|
2780
|
-
if (
|
|
2781
|
-
for (const p of
|
|
2779
|
+
const m = a.get("move");
|
|
2780
|
+
if (m)
|
|
2781
|
+
for (const p of m)
|
|
2782
2782
|
p({
|
|
2783
2783
|
baseObject: n,
|
|
2784
2784
|
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,
|
|
@@ -2797,14 +2797,14 @@ class ei {
|
|
|
2797
2797
|
sp: o,
|
|
2798
2798
|
intersectionIndex: s
|
|
2799
2799
|
});
|
|
2800
|
-
const
|
|
2801
|
-
if (
|
|
2800
|
+
const m = a.get("click");
|
|
2801
|
+
if (m) {
|
|
2802
2802
|
const p = (v) => {
|
|
2803
2803
|
v.preventDefault();
|
|
2804
|
-
const
|
|
2805
|
-
if (!r && Math.abs(v.clientX - e.clientX) <=
|
|
2806
|
-
for (const
|
|
2807
|
-
|
|
2804
|
+
const _ = 5;
|
|
2805
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= _ && Math.abs(v.clientY - e.clientY) <= _)
|
|
2806
|
+
for (const f of m)
|
|
2807
|
+
f({
|
|
2808
2808
|
baseObject: n,
|
|
2809
2809
|
realBaseObject: this.activeObject,
|
|
2810
2810
|
mouseEvent: e,
|
|
@@ -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
|
-
},
|
|
2870
|
-
a.element.addEventListener(
|
|
2869
|
+
}, m = `pointer${t}`;
|
|
2870
|
+
a.element.addEventListener(m, rt(h), !1), o.push({ arr: a, type: m, listener: h });
|
|
2871
2871
|
}
|
|
2872
2872
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2873
2873
|
}
|
|
@@ -2893,12 +2893,12 @@ class ti extends ei {
|
|
|
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,
|
|
@@ -2919,8 +2919,10 @@ class ti extends ei {
|
|
|
2919
2919
|
if (r === "@Scene" && e instanceof es)
|
|
2920
2920
|
i.key = "@Camera";
|
|
2921
2921
|
else {
|
|
2922
|
-
const o = this.objectWrapChindIdMap.get(s.target) ?
|
|
2923
|
-
this.objectWrapChindIdMap.set(s.target,
|
|
2922
|
+
const o = this.objectWrapChindIdMap.get(s.target), n = o !== void 0 ? o + 1 : 0;
|
|
2923
|
+
this.objectWrapChindIdMap.set(s.target, n);
|
|
2924
|
+
const [a, h] = r.split("#");
|
|
2925
|
+
i.key = `${a}__c__${n}${h ? `#${h}` : ""}`;
|
|
2924
2926
|
}
|
|
2925
2927
|
}
|
|
2926
2928
|
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) => {
|
|
@@ -2928,7 +2930,7 @@ class ti extends ei {
|
|
|
2928
2930
|
target: i,
|
|
2929
2931
|
mList: s.mList
|
|
2930
2932
|
});
|
|
2931
|
-
}), i;
|
|
2933
|
+
}), this.pencil.event.emit("lead.draw", { baseObject: i }), i;
|
|
2932
2934
|
}
|
|
2933
2935
|
init(e) {
|
|
2934
2936
|
return Object.keys(e).forEach((t) => {
|
|
@@ -2937,7 +2939,7 @@ class ti extends ei {
|
|
|
2937
2939
|
return new e[t](r);
|
|
2938
2940
|
}
|
|
2939
2941
|
};
|
|
2940
|
-
this.objectNamesToFactories.set(t, s);
|
|
2942
|
+
this.objectNamesToFactories.set(String(t), s);
|
|
2941
2943
|
}), this;
|
|
2942
2944
|
}
|
|
2943
2945
|
getObject(e, t) {
|
|
@@ -2954,35 +2956,42 @@ class ti extends ei {
|
|
|
2954
2956
|
}
|
|
2955
2957
|
draw(e, t, s) {
|
|
2956
2958
|
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
|
-
|
|
2959
|
+
var p, v, _;
|
|
2960
|
+
const i = this.objectNamesToFactories.get(String(e));
|
|
2961
|
+
if (!i)
|
|
2962
|
+
throw new Error(`Unrecognized factory: ${String(e)}`);
|
|
2963
|
+
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
2964
|
+
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);
|
|
2965
|
+
let m;
|
|
2966
|
+
if (r === null)
|
|
2967
|
+
m = null;
|
|
2968
|
+
else if (typeof r == "string") {
|
|
2969
|
+
const f = this.objects.get(r);
|
|
2970
|
+
if (!f)
|
|
2971
|
+
throw new Error(`Object with key "${r}" not found`);
|
|
2972
|
+
m = f;
|
|
2973
|
+
} else r != null && r.isBaseObject || r ? m = r : n ? m = this.prefabGroup : m = this.group;
|
|
2974
|
+
return a === !1 ? h.create = () => {
|
|
2975
|
+
} : a !== !0 && (h.create = () => {
|
|
2976
|
+
a(h);
|
|
2977
|
+
}), h.pencil = this.pencil, h.lead = this, h.mList = this.mList, h.isPrefab = n, h.objectType = `${e}`, h.objectOptions = t, this.setBaseObjectKey(
|
|
2978
|
+
h,
|
|
2979
|
+
t.key ? `$t:#${t.key}` : "$t:",
|
|
2980
|
+
m == null ? void 0 : m.key
|
|
2981
|
+
), this.objectsPm.set(
|
|
2982
|
+
h,
|
|
2983
|
+
this.addBaseObject(h, m, o)
|
|
2984
|
+
), yield this.objectsPm.get(h), this.objectsPm.delete(h), h;
|
|
2976
2985
|
});
|
|
2977
2986
|
}
|
|
2978
2987
|
setBaseObjectKey(e, t, s) {
|
|
2979
|
-
const i = e.
|
|
2980
|
-
let
|
|
2988
|
+
const i = e.objectTypeKey || e.objectType;
|
|
2989
|
+
let r = t.replace("$t:", i);
|
|
2981
2990
|
if (s) {
|
|
2982
|
-
const [,
|
|
2983
|
-
|
|
2991
|
+
const [, o] = s.split("#");
|
|
2992
|
+
r = r.replace("$p:", o);
|
|
2984
2993
|
}
|
|
2985
|
-
return this.objects.has(
|
|
2994
|
+
return this.objects.has(r) && (r.includes("#") ? r += `-${Ne()}` : r += `#${Ne()}`), e._key = r, this.objects.set(r, e), r;
|
|
2986
2995
|
}
|
|
2987
2996
|
updateBaseObjectKey(e, t) {
|
|
2988
2997
|
var o;
|
|
@@ -2993,8 +3002,11 @@ class ti extends ei {
|
|
|
2993
3002
|
break;
|
|
2994
3003
|
}
|
|
2995
3004
|
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
|
|
2997
|
-
n.key.includes("__c__")
|
|
3005
|
+
return s && this.objects.delete(s), this.pencil.event.emit("lead.updateKey", { baseObject: e, key: r, oldKey: s }), e.children.forEach((n) => {
|
|
3006
|
+
if (n.key.includes("__c__")) {
|
|
3007
|
+
const [a, h] = r.split("#");
|
|
3008
|
+
n.key = `${n.key.split("#")[0]}${h ? `#${h}` : ""}`;
|
|
3009
|
+
}
|
|
2998
3010
|
}), r;
|
|
2999
3011
|
}
|
|
3000
3012
|
addBaseObject(e, t, s) {
|
|
@@ -3089,8 +3101,8 @@ class ii extends mt {
|
|
|
3089
3101
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3090
3102
|
e,
|
|
3091
3103
|
(o) => {
|
|
3092
|
-
const n = o, a = new DecompressionStream("gzip"),
|
|
3093
|
-
new Response(
|
|
3104
|
+
const n = o, a = new DecompressionStream("gzip"), h = n.stream().pipeThrough(a);
|
|
3105
|
+
new Response(h).json().then((p) => {
|
|
3094
3106
|
t == null || t(p);
|
|
3095
3107
|
}).catch((p) => {
|
|
3096
3108
|
i == null || i(p);
|
|
@@ -3110,23 +3122,23 @@ class ot extends mt {
|
|
|
3110
3122
|
}
|
|
3111
3123
|
load(e, t, s, i) {
|
|
3112
3124
|
let r, o;
|
|
3113
|
-
this.options.type === "image" ? (o = document.createElement("img"), r = new
|
|
3125
|
+
this.options.type === "image" ? (o = document.createElement("img"), r = new ue(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 ts(o)) : r = new ue();
|
|
3114
3126
|
const n = new Se(this.manager);
|
|
3115
3127
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3116
3128
|
e,
|
|
3117
3129
|
(a) => {
|
|
3118
|
-
let
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3130
|
+
let h = a;
|
|
3131
|
+
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3132
|
+
h = h.slice(0, a.size, p);
|
|
3121
3133
|
const v = () => {
|
|
3122
|
-
o.removeEventListener("load",
|
|
3123
|
-
},
|
|
3134
|
+
o.removeEventListener("load", _, !1), o.removeEventListener("error", f, !1);
|
|
3135
|
+
}, _ = () => {
|
|
3124
3136
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3125
|
-
},
|
|
3137
|
+
}, f = (y) => {
|
|
3126
3138
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3127
3139
|
};
|
|
3128
|
-
o.addEventListener("load",
|
|
3129
|
-
const g = window.URL.createObjectURL(
|
|
3140
|
+
o.addEventListener("load", _, !1), o.addEventListener("error", f, !1);
|
|
3141
|
+
const g = window.URL.createObjectURL(h);
|
|
3130
3142
|
o.src = g;
|
|
3131
3143
|
},
|
|
3132
3144
|
s,
|
|
@@ -3172,7 +3184,7 @@ class oi {
|
|
|
3172
3184
|
const s = this.assets.get(e);
|
|
3173
3185
|
if (!s) {
|
|
3174
3186
|
if ((t === "images" || t === "media" || t === "exr") && this.options.simpleTexture4deleted && this.delLoadArr.includes(e))
|
|
3175
|
-
return new
|
|
3187
|
+
return new ue();
|
|
3176
3188
|
console.warn(`Asset ${e} not found`);
|
|
3177
3189
|
}
|
|
3178
3190
|
return s;
|
|
@@ -3225,7 +3237,7 @@ class oi {
|
|
|
3225
3237
|
get textureAssets() {
|
|
3226
3238
|
const e = /* @__PURE__ */ new Map();
|
|
3227
3239
|
return this.assets.forEach((t, s) => {
|
|
3228
|
-
(t instanceof
|
|
3240
|
+
(t instanceof ue || t instanceof is || t.isVideoTexture) && e.set(s, t);
|
|
3229
3241
|
}), e;
|
|
3230
3242
|
}
|
|
3231
3243
|
loadAll() {
|
|
@@ -3250,13 +3262,13 @@ class oi {
|
|
|
3250
3262
|
}
|
|
3251
3263
|
const o = this.getLoader(s, t);
|
|
3252
3264
|
try {
|
|
3253
|
-
const
|
|
3254
|
-
if (this.assets.set(e,
|
|
3255
|
-
const
|
|
3256
|
-
|
|
3265
|
+
const h = yield o.loadAsync(e);
|
|
3266
|
+
if (this.assets.set(e, h), r.resolve(h), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3267
|
+
const m = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
|
|
3268
|
+
h.anisotropy = m;
|
|
3257
3269
|
}
|
|
3258
|
-
return
|
|
3259
|
-
} catch (
|
|
3270
|
+
return h;
|
|
3271
|
+
} catch (h) {
|
|
3260
3272
|
r.reject(`Failed to load ${e}`);
|
|
3261
3273
|
return;
|
|
3262
3274
|
}
|
|
@@ -3277,10 +3289,10 @@ class oi {
|
|
|
3277
3289
|
a.roughnessMap,
|
|
3278
3290
|
a.metalnessMap,
|
|
3279
3291
|
a.aoMap
|
|
3280
|
-
].forEach((
|
|
3281
|
-
if (
|
|
3282
|
-
const
|
|
3283
|
-
|
|
3292
|
+
].forEach((h) => {
|
|
3293
|
+
if (h) {
|
|
3294
|
+
const m = this.getSrcByAsset(h, s);
|
|
3295
|
+
m && t.add(m);
|
|
3284
3296
|
}
|
|
3285
3297
|
});
|
|
3286
3298
|
});
|
|
@@ -3396,8 +3408,8 @@ class li {
|
|
|
3396
3408
|
if (r.startsWith(i)) {
|
|
3397
3409
|
const n = r.substring(i.length), a = o.clone();
|
|
3398
3410
|
s[n] = a;
|
|
3399
|
-
const
|
|
3400
|
-
this.add(
|
|
3411
|
+
const h = `${t}#${n}`;
|
|
3412
|
+
this.add(h, a);
|
|
3401
3413
|
}
|
|
3402
3414
|
return s;
|
|
3403
3415
|
}
|
|
@@ -3422,15 +3434,15 @@ class li {
|
|
|
3422
3434
|
if ("__isProxy" in o)
|
|
3423
3435
|
return o;
|
|
3424
3436
|
const n = new Proxy(o, {
|
|
3425
|
-
set: (a,
|
|
3426
|
-
if (typeof
|
|
3427
|
-
const p = Number(
|
|
3437
|
+
set: (a, h, m) => {
|
|
3438
|
+
if (typeof h == "string" && !Number.isNaN(Number(h))) {
|
|
3439
|
+
const p = Number(h);
|
|
3428
3440
|
if (p >= 0 && p < a.length) {
|
|
3429
3441
|
const v = a[p];
|
|
3430
|
-
return this.rmBaseObjectMap(e, v), a[p] =
|
|
3442
|
+
return this.rmBaseObjectMap(e, v), a[p] = m, m && (this.applyColorSpaceToMaterials(m), this.addBaseObjectMap(e)), !0;
|
|
3431
3443
|
}
|
|
3432
3444
|
}
|
|
3433
|
-
return a[
|
|
3445
|
+
return a[h] = m, !0;
|
|
3434
3446
|
}
|
|
3435
3447
|
});
|
|
3436
3448
|
return Object.defineProperty(n, "__isProxy", {
|
|
@@ -3443,8 +3455,8 @@ class li {
|
|
|
3443
3455
|
}), e.materialList = new Proxy(e.materialList, {
|
|
3444
3456
|
set: (o, n, a) => {
|
|
3445
3457
|
if (typeof n == "string") {
|
|
3446
|
-
const
|
|
3447
|
-
return this.rmBaseObjectMap(e,
|
|
3458
|
+
const h = o[n];
|
|
3459
|
+
return this.rmBaseObjectMap(e, h), o[n] = a, a && (this.applyColorSpaceToMaterials(a), this.addBaseObjectMap(e)), !0;
|
|
3448
3460
|
}
|
|
3449
3461
|
return o[n] = a, !0;
|
|
3450
3462
|
},
|
|
@@ -3452,8 +3464,8 @@ class li {
|
|
|
3452
3464
|
if (typeof n == "string" && o[n]) {
|
|
3453
3465
|
const a = o[n];
|
|
3454
3466
|
if (Array.isArray(a)) {
|
|
3455
|
-
const
|
|
3456
|
-
return
|
|
3467
|
+
const h = s(a);
|
|
3468
|
+
return h !== a && (o[n] = h), h;
|
|
3457
3469
|
}
|
|
3458
3470
|
return a;
|
|
3459
3471
|
}
|
|
@@ -3530,11 +3542,11 @@ class li {
|
|
|
3530
3542
|
n !== -1 && (o[n] = t);
|
|
3531
3543
|
} else o === e && (r.material = t);
|
|
3532
3544
|
i.materialList && Object.keys(i.materialList).forEach((n) => {
|
|
3533
|
-
var
|
|
3534
|
-
const a = (
|
|
3545
|
+
var h;
|
|
3546
|
+
const a = (h = i.materialList) == null ? void 0 : h[n];
|
|
3535
3547
|
if (Array.isArray(a)) {
|
|
3536
|
-
const
|
|
3537
|
-
|
|
3548
|
+
const m = a.indexOf(e);
|
|
3549
|
+
m !== -1 && (a[m] = t);
|
|
3538
3550
|
} else a === e && i.materialList && (i.materialList[n] = t);
|
|
3539
3551
|
});
|
|
3540
3552
|
});
|
|
@@ -3581,22 +3593,22 @@ class di {
|
|
|
3581
3593
|
devicePixelRatio: o,
|
|
3582
3594
|
antialias: n,
|
|
3583
3595
|
powerPreference: a,
|
|
3584
|
-
toneMappingExposure:
|
|
3585
|
-
outputColorSpace:
|
|
3596
|
+
toneMappingExposure: h,
|
|
3597
|
+
outputColorSpace: m,
|
|
3586
3598
|
logarithmicDepthBuffer: p,
|
|
3587
3599
|
preserveDrawingBuffer: v,
|
|
3588
|
-
stencil:
|
|
3589
|
-
depth:
|
|
3600
|
+
stencil: _,
|
|
3601
|
+
depth: f
|
|
3590
3602
|
} = i, g = new rs({
|
|
3591
3603
|
alpha: r,
|
|
3592
3604
|
antialias: n,
|
|
3593
3605
|
powerPreference: a,
|
|
3594
3606
|
logarithmicDepthBuffer: p,
|
|
3595
3607
|
preserveDrawingBuffer: v,
|
|
3596
|
-
stencil:
|
|
3597
|
-
depth:
|
|
3608
|
+
stencil: _,
|
|
3609
|
+
depth: f
|
|
3598
3610
|
});
|
|
3599
|
-
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure =
|
|
3611
|
+
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = h, g.outputColorSpace = m, this.renderer = g;
|
|
3600
3612
|
}
|
|
3601
3613
|
setSize(e, t) {
|
|
3602
3614
|
this.renderer.setSize(e, t);
|
|
@@ -3608,8 +3620,8 @@ class di {
|
|
|
3608
3620
|
this.renderer.render(e, t);
|
|
3609
3621
|
}
|
|
3610
3622
|
setViewport(e) {
|
|
3611
|
-
var a,
|
|
3612
|
-
const { x: t, y: s, width: i, height: r } = e, o = (a = e.scissor) != null ? a : !1, n = (
|
|
3623
|
+
var a, h;
|
|
3624
|
+
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
3625
|
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
|
|
3614
3626
|
}
|
|
3615
3627
|
dispose() {
|
|
@@ -3643,7 +3655,7 @@ class mi extends ee {
|
|
|
3643
3655
|
});
|
|
3644
3656
|
}
|
|
3645
3657
|
}
|
|
3646
|
-
class
|
|
3658
|
+
class fi {
|
|
3647
3659
|
constructor(e) {
|
|
3648
3660
|
this.event = new ye.EventEmitter();
|
|
3649
3661
|
const { renderer: t, scene: s, camera: i } = e, r = new Ts(
|
|
@@ -3712,7 +3724,7 @@ class ui {
|
|
|
3712
3724
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3713
3725
|
}
|
|
3714
3726
|
}
|
|
3715
|
-
const
|
|
3727
|
+
const ui = {
|
|
3716
3728
|
antialias: !0,
|
|
3717
3729
|
devicePixelRatio: window.devicePixelRatio
|
|
3718
3730
|
};
|
|
@@ -3747,7 +3759,7 @@ const _e = class _e {
|
|
|
3747
3759
|
transformControls: i
|
|
3748
3760
|
} = this.options;
|
|
3749
3761
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3750
|
-
const n = new
|
|
3762
|
+
const n = new kt({
|
|
3751
3763
|
horizontal: !1
|
|
3752
3764
|
});
|
|
3753
3765
|
n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
|
|
@@ -3815,7 +3827,7 @@ const _e = class _e {
|
|
|
3815
3827
|
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
3828
|
}
|
|
3817
3829
|
init() {
|
|
3818
|
-
var
|
|
3830
|
+
var u;
|
|
3819
3831
|
const {
|
|
3820
3832
|
container: e,
|
|
3821
3833
|
WebGPUTHREE: t,
|
|
@@ -3824,28 +3836,28 @@ const _e = class _e {
|
|
|
3824
3836
|
renderer: r,
|
|
3825
3837
|
controls: o,
|
|
3826
3838
|
loader: n
|
|
3827
|
-
} = this.options, { width: a, height:
|
|
3839
|
+
} = this.options, { width: a, height: h } = this.getSize(), m = t ? new _i({
|
|
3828
3840
|
width: a,
|
|
3829
|
-
height:
|
|
3841
|
+
height: h,
|
|
3830
3842
|
//@ts-ignore
|
|
3831
3843
|
renderer: this.options.WebGPURenderer,
|
|
3832
|
-
rendererParams:
|
|
3844
|
+
rendererParams: ui
|
|
3833
3845
|
}) : new di({
|
|
3834
3846
|
width: a,
|
|
3835
|
-
height:
|
|
3847
|
+
height: h,
|
|
3836
3848
|
rendererParams: te(U({}, r), {
|
|
3837
3849
|
antialias: !1
|
|
3838
3850
|
})
|
|
3839
3851
|
});
|
|
3840
|
-
this.rendererController =
|
|
3852
|
+
this.rendererController = m;
|
|
3841
3853
|
const p = new Ds({
|
|
3842
3854
|
width: a,
|
|
3843
|
-
height:
|
|
3844
|
-
}), v = new mi({}),
|
|
3855
|
+
height: h
|
|
3856
|
+
}), v = new mi({}), _ = new Ks({
|
|
3845
3857
|
controlsParams: {
|
|
3846
|
-
domElement: (
|
|
3858
|
+
domElement: (u = o == null ? void 0 : o.domElement) != null ? u : m.renderer.domElement
|
|
3847
3859
|
}
|
|
3848
|
-
}),
|
|
3860
|
+
}), f = new ai({
|
|
3849
3861
|
loaderParams: U({
|
|
3850
3862
|
anisotropy: this.maxAnisotropy
|
|
3851
3863
|
}, n)
|
|
@@ -3854,7 +3866,7 @@ const _e = class _e {
|
|
|
3854
3866
|
}), y = new si({
|
|
3855
3867
|
pencil: this
|
|
3856
3868
|
});
|
|
3857
|
-
this.sceneController = v, this.cameraController = p, this.controlsController =
|
|
3869
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = _, this.loaderController = f, this.mListController = g, this.leadController = y;
|
|
3858
3870
|
const l = this.addPage({
|
|
3859
3871
|
sceneOptions: this.options.scene,
|
|
3860
3872
|
cameraOptions: this.options.camera
|
|
@@ -3867,7 +3879,7 @@ const _e = class _e {
|
|
|
3867
3879
|
});
|
|
3868
3880
|
O.add(v.scene), this.helperController = O, i && O.addViewHelper();
|
|
3869
3881
|
}
|
|
3870
|
-
e.appendChild(
|
|
3882
|
+
e.appendChild(m.renderer.domElement);
|
|
3871
3883
|
}
|
|
3872
3884
|
initComposer() {
|
|
3873
3885
|
const {
|
|
@@ -3898,7 +3910,7 @@ const _e = class _e {
|
|
|
3898
3910
|
}
|
|
3899
3911
|
}
|
|
3900
3912
|
initTransformControls() {
|
|
3901
|
-
const e = new
|
|
3913
|
+
const e = new fi({
|
|
3902
3914
|
camera: this.camera,
|
|
3903
3915
|
renderer: this.renderer,
|
|
3904
3916
|
scene: this.scene
|
|
@@ -3936,11 +3948,11 @@ const _e = class _e {
|
|
|
3936
3948
|
composerController: o,
|
|
3937
3949
|
cssRendererController: n,
|
|
3938
3950
|
leadController: a
|
|
3939
|
-
} = this,
|
|
3940
|
-
|
|
3951
|
+
} = this, h = this.renderer.getSize(new B());
|
|
3952
|
+
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
3953
|
var p;
|
|
3942
|
-
(p =
|
|
3943
|
-
}), this.viewPadding.some((
|
|
3954
|
+
(p = m.setSize) == null || p.call(m, e, t);
|
|
3955
|
+
}), this.viewPadding.some((m) => m !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3944
3956
|
}
|
|
3945
3957
|
setDevicePixelRatio(e) {
|
|
3946
3958
|
var n;
|
|
@@ -3971,15 +3983,15 @@ const _e = class _e {
|
|
|
3971
3983
|
const { raycaster: i, options: r } = this, { container: o } = r, n = new B(), a = o.getBoundingClientRect();
|
|
3972
3984
|
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
3985
|
i.setFromCamera(n, this.camera);
|
|
3974
|
-
const
|
|
3986
|
+
const h = i.intersectObjects(
|
|
3975
3987
|
t || this.scene.children,
|
|
3976
3988
|
s
|
|
3977
3989
|
);
|
|
3978
|
-
if (
|
|
3990
|
+
if (h.length)
|
|
3979
3991
|
return {
|
|
3980
|
-
object:
|
|
3981
|
-
index:
|
|
3982
|
-
intersects:
|
|
3992
|
+
object: h[0].object,
|
|
3993
|
+
index: h[0].index,
|
|
3994
|
+
intersects: h
|
|
3983
3995
|
};
|
|
3984
3996
|
}
|
|
3985
3997
|
}
|
|
@@ -3989,9 +4001,9 @@ const _e = class _e {
|
|
|
3989
4001
|
return;
|
|
3990
4002
|
this.event.emit("beforeRender"), this.timer.update(), Ce.update();
|
|
3991
4003
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3992
|
-
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((
|
|
3993
|
-
var
|
|
3994
|
-
(
|
|
4004
|
+
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((h) => {
|
|
4005
|
+
var m;
|
|
4006
|
+
(m = h.update) == null || m.call(h, e, t);
|
|
3995
4007
|
}), (s = this.helperController) == null || s.update(
|
|
3996
4008
|
e,
|
|
3997
4009
|
this.controlsController,
|
|
@@ -4036,11 +4048,11 @@ const _e = class _e {
|
|
|
4036
4048
|
}
|
|
4037
4049
|
}
|
|
4038
4050
|
dispose() {
|
|
4039
|
-
var e, t, s, i, r, o, n, a,
|
|
4051
|
+
var e, t, s, i, r, o, n, a, h, m, p, v, _, f;
|
|
4040
4052
|
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
4053
|
var y;
|
|
4042
4054
|
(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(), (
|
|
4055
|
+
}), (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(), (f = this.renderer) == null || f.domElement.remove(), this._isDispose = !0;
|
|
4044
4056
|
}
|
|
4045
4057
|
};
|
|
4046
4058
|
_e.options = {
|