gl-draw 0.15.32 → 0.16.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WebGPULineSegments2.js +4 -4
- package/dist/WebGPULineSegments2.module.js +243 -243
- package/dist/core/BaseObject/index.d.ts +1 -0
- package/dist/core/Loader/TextureLoader.d.ts +1 -1
- package/dist/core/Pencil.d.ts +1 -2
- package/dist/index.js +3 -3
- package/dist/index.module.js +417 -508
- package/package.json +1 -1
- package/dist/utils/Timer.d.ts +0 -72
package/dist/index.module.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var St = Object.defineProperty, At = Object.defineProperties;
|
|
2
|
+
var Mt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Me = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Re = (h, e, t) => e in h ?
|
|
4
|
+
var Rt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Re = (h, e, t) => e in h ? St(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, U = (h, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
Rt.call(e, t) && Re(h, t, e[t]);
|
|
8
8
|
if (Me)
|
|
9
9
|
for (var t of Me(e))
|
|
10
|
-
|
|
10
|
+
Dt.call(e, t) && Re(h, t, e[t]);
|
|
11
11
|
return h;
|
|
12
|
-
}, te = (h, e) =>
|
|
12
|
+
}, te = (h, e) => At(h, Mt(e));
|
|
13
13
|
var se = (h, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (a) => {
|
|
15
15
|
try {
|
|
@@ -27,14 +27,14 @@ var se = (h, e, t) => new Promise((s, i) => {
|
|
|
27
27
|
n((t = t.apply(h, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as Ce from "@tweenjs/tween.js";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import { Vector3 as
|
|
33
|
-
import { M as
|
|
30
|
+
import Ut from "deepmerge";
|
|
31
|
+
import zt from "stats-gl";
|
|
32
|
+
import { Vector3 as j, PerspectiveCamera as kt, 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 ze, Camera as es, Loader as mt, FileLoader as Se, Texture as fe, 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 ut, B as Oe, a as ls, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
|
|
34
34
|
import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
|
-
import { RenderPass as
|
|
36
|
-
import { SSAOPass as
|
|
37
|
-
import { UnrealBloomPass as
|
|
35
|
+
import { RenderPass as hs } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
|
+
import { SSAOPass as cs } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
|
+
import { UnrealBloomPass as ds } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
38
38
|
import "three/examples/jsm/lines/LineMaterial";
|
|
39
39
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
40
40
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
@@ -45,18 +45,18 @@ import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
|
45
45
|
import "three-bvh-csg";
|
|
46
46
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
47
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
48
|
-
import { ShaderPass as
|
|
48
|
+
import { ShaderPass as ps } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
49
|
+
import { OutputPass as ms } from "three/examples/jsm/postprocessing/OutputPass";
|
|
49
50
|
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import { TransformControls as Cs } from "three/examples/jsm/controls/TransformControls";
|
|
51
|
+
import { RectAreaLightHelper as us } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
|
+
import { ViewHelper as fs } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
|
+
import { generateUUID as Ne, makePromiseCreator as _s } from "esus-lite";
|
|
54
|
+
import { DRACOLoader as gs } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
|
+
import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
|
+
import { GLTFLoader as Ie } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
+
import { LottieLoader as vs } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
|
+
import { a as Cs, C as Os, i as Es } from "./isPlainObject.module.js";
|
|
59
|
+
import { TransformControls as Ts } from "three/examples/jsm/controls/TransformControls";
|
|
60
60
|
const M = {
|
|
61
61
|
LEFT: 1,
|
|
62
62
|
RIGHT: 2,
|
|
@@ -91,20 +91,20 @@ const M = {
|
|
|
91
91
|
function Y(h) {
|
|
92
92
|
return h.isPerspectiveCamera;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function H(h) {
|
|
95
95
|
return h.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2,
|
|
97
|
+
const $ = Math.PI * 2, je = Math.PI / 2, ft = 1e-5, ie = Math.PI / 180;
|
|
98
98
|
function k(h, e, t) {
|
|
99
99
|
return Math.max(e, Math.min(t, h));
|
|
100
100
|
}
|
|
101
|
-
function A(h, e =
|
|
101
|
+
function A(h, e = ft) {
|
|
102
102
|
return Math.abs(h) < e;
|
|
103
103
|
}
|
|
104
|
-
function P(h, e, t =
|
|
104
|
+
function P(h, e, t = ft) {
|
|
105
105
|
return A(h - e, t);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function He(h, e) {
|
|
108
108
|
return Math.round(h / e) * e;
|
|
109
109
|
}
|
|
110
110
|
function re(h) {
|
|
@@ -117,27 +117,27 @@ function ce(h, 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
119
|
let c = h - e;
|
|
120
|
-
const f = e,
|
|
121
|
-
c = k(c, -
|
|
120
|
+
const f = e, p = i * s;
|
|
121
|
+
c = k(c, -p, p), e = h - c;
|
|
122
122
|
const v = (t.value + o * c) * r;
|
|
123
123
|
t.value = (t.value - o * v) * a;
|
|
124
|
-
let
|
|
125
|
-
return f - h > 0 ==
|
|
124
|
+
let m = e + (c + v) * a;
|
|
125
|
+
return f - h > 0 == m > f && (m = f, t.value = (m - f) / r), m;
|
|
126
126
|
}
|
|
127
127
|
function Be(h, e, t, s, i = 1 / 0, r, o) {
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
129
|
const n = 2 / s, a = n * r, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
|
-
let f = e.x,
|
|
131
|
-
const y = f, l =
|
|
132
|
-
if (
|
|
133
|
-
const ve = Math.sqrt(
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
f = h.x -
|
|
137
|
-
const E = (t.x + n *
|
|
138
|
-
t.x = (t.x - n * E) * c, t.y = (t.y - n * x) * c, t.z = (t.z - n * R) * c, o.x = f + (
|
|
139
|
-
const V = y - h.x, le = l - h.y, bt = _ - h.z,
|
|
140
|
-
return V *
|
|
130
|
+
let f = e.x, p = e.y, v = e.z, m = h.x - f, u = h.y - p, g = h.z - v;
|
|
131
|
+
const y = f, l = p, _ = v, O = i * s, C = O * O, w = m * m + u * u + g * g;
|
|
132
|
+
if (w > C) {
|
|
133
|
+
const ve = Math.sqrt(w);
|
|
134
|
+
m = m / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
|
+
}
|
|
136
|
+
f = h.x - m, p = h.y - u, v = h.z - g;
|
|
137
|
+
const E = (t.x + n * m) * r, x = (t.y + n * u) * r, R = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * c, t.y = (t.y - n * x) * c, t.z = (t.z - n * R) * c, o.x = f + (m + E) * c, o.y = p + (u + x) * c, o.z = v + (g + R) * c;
|
|
139
|
+
const V = y - h.x, le = l - h.y, bt = _ - h.z, xt = o.x - y, Lt = o.y - l, Pt = o.z - _;
|
|
140
|
+
return V * xt + le * Lt + bt * Pt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
141
141
|
}
|
|
142
142
|
function Ee(h, e) {
|
|
143
143
|
e.set(0, 0), h.forEach((t) => {
|
|
@@ -145,9 +145,9 @@ function Ee(h, e) {
|
|
|
145
145
|
}), e.x /= h.length, e.y /= h.length;
|
|
146
146
|
}
|
|
147
147
|
function Te(h, e) {
|
|
148
|
-
return
|
|
148
|
+
return H(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
|
-
class
|
|
150
|
+
class ws {
|
|
151
151
|
constructor() {
|
|
152
152
|
this._listeners = {};
|
|
153
153
|
}
|
|
@@ -211,11 +211,11 @@ class Os {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const de = 1 / 8,
|
|
215
|
-
let T, Ve,
|
|
216
|
-
class J extends
|
|
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, z, ae, X, We, be, Ke, xe, Le, me;
|
|
216
|
+
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)),
|
|
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(), z = 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
|
|
@@ -244,46 +244,46 @@ class J extends Os {
|
|
|
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
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, _, O, C) => {
|
|
247
|
-
let
|
|
247
|
+
let w, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const x =
|
|
250
|
-
|
|
251
|
-
} else if (
|
|
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 * _ * V / this._elementRect.height;
|
|
251
|
+
} else if (H(this._camera)) {
|
|
252
252
|
const x = this._camera;
|
|
253
|
-
|
|
253
|
+
w = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * _ * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
256
|
C ? (O ? this.setFocalOffset(
|
|
257
|
-
this._focalOffsetEnd.x +
|
|
257
|
+
this._focalOffsetEnd.x + w,
|
|
258
258
|
this._focalOffsetEnd.y,
|
|
259
259
|
this._focalOffsetEnd.z,
|
|
260
260
|
!0
|
|
261
|
-
) : this.truck(
|
|
262
|
-
this._focalOffsetEnd.x +
|
|
261
|
+
) : this.truck(w, 0, !0), this.forward(-E, !0)) : O ? this.setFocalOffset(
|
|
262
|
+
this._focalOffsetEnd.x + w,
|
|
263
263
|
this._focalOffsetEnd.y + E,
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
|
-
) : this.truck(
|
|
266
|
+
) : this.truck(w, E, !0);
|
|
267
267
|
}, this._rotateInternal = (l, _) => {
|
|
268
268
|
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
269
269
|
this.rotate(O, C, !0);
|
|
270
270
|
}, this._dollyInternal = (l, _, O) => {
|
|
271
|
-
const C = Math.pow(0.95, -l * this.dollySpeed),
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, x = k(
|
|
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) -
|
|
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(_, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
277
|
}, this._zoomInternal = (l, _, O) => {
|
|
278
|
-
const C = Math.pow(0.95, l * this.dollySpeed),
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E -
|
|
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(_, O));
|
|
280
280
|
}, typeof T == "undefined" && console.error(
|
|
281
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
282
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
|
-
|
|
284
|
+
pe
|
|
285
285
|
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
286
|
-
|
|
286
|
+
b.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
288
|
new T.Vector3(),
|
|
289
289
|
new T.Vector3(),
|
|
@@ -296,17 +296,17 @@ class J extends Os {
|
|
|
296
296
|
left: d.ROTATE,
|
|
297
297
|
middle: d.DOLLY,
|
|
298
298
|
right: d.TRUCK,
|
|
299
|
-
wheel: Y(this._camera) ? d.DOLLY :
|
|
299
|
+
wheel: Y(this._camera) ? d.DOLLY : H(this._camera) ? d.ZOOM : d.NONE
|
|
300
300
|
}, this.touches = {
|
|
301
301
|
one: d.TOUCH_ROTATE,
|
|
302
|
-
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK :
|
|
302
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : H(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
303
303
|
three: d.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
306
306
|
if (!this._enabled || !this._domElement) return;
|
|
307
307
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
308
|
-
const C = this._domElement.getBoundingClientRect(),
|
|
309
|
-
if (
|
|
308
|
+
const C = this._domElement.getBoundingClientRect(), w = (l.clientX - C.left) / (C.right - C.left), E = (l.clientY - C.top) / (C.bottom - C.top);
|
|
309
|
+
if (w < this._interactiveArea.left || w > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
const _ = l.pointerType !== "mouse" ? null : (l.buttons & M.LEFT) === M.LEFT ? M.LEFT : (l.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (l.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
|
|
@@ -354,7 +354,7 @@ class J extends Os {
|
|
|
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
|
+
m();
|
|
358
358
|
}
|
|
359
359
|
}, a = (l) => {
|
|
360
360
|
const _ = this._findPointerById(l.pointerId);
|
|
@@ -391,7 +391,7 @@ class J extends Os {
|
|
|
391
391
|
const E = performance.now();
|
|
392
392
|
c - E < 1e3 && this._getClientRect(this._elementRect), c = E;
|
|
393
393
|
}
|
|
394
|
-
const _ =
|
|
394
|
+
const _ = bs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
396
|
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -410,16 +410,16 @@ class J extends Os {
|
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
412
|
case d.DOLLY: {
|
|
413
|
-
this._dollyInternal(-O, C,
|
|
413
|
+
this._dollyInternal(-O, C, w), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
416
|
case d.ZOOM: {
|
|
417
|
-
this._zoomInternal(-O, C,
|
|
417
|
+
this._zoomInternal(-O, C, w), this._isUserControllingZoom = !0;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
this.dispatchEvent({ type: "control" });
|
|
422
|
-
},
|
|
422
|
+
}, p = (l) => {
|
|
423
423
|
if (!(!this._domElement || !this._enabled)) {
|
|
424
424
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
425
425
|
const _ = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(_);
|
|
@@ -438,8 +438,8 @@ class J extends Os {
|
|
|
438
438
|
}, v = (l) => {
|
|
439
439
|
if (!this._enabled) return;
|
|
440
440
|
if (Ee(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
441
|
-
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY,
|
|
442
|
-
r.set(0,
|
|
441
|
+
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
|
|
442
|
+
r.set(0, w);
|
|
443
443
|
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
444
444
|
i.set(E, x);
|
|
445
445
|
}
|
|
@@ -460,24 +460,24 @@ class J extends Os {
|
|
|
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
|
+
}, m = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
465
|
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
466
466
|
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = _ ? -_.deltaX : i.x - D.x, C = _ ? -_.deltaY : i.y - D.y;
|
|
467
467
|
if (i.copy(D), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
-
const
|
|
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(
|
|
470
470
|
x * C * de,
|
|
471
|
-
|
|
471
|
+
w,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
474
|
x * C * de,
|
|
475
|
-
|
|
475
|
+
w,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
479
|
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
480
|
-
const
|
|
480
|
+
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, x = Math.sqrt(w * w + E * E), R = r.y - x;
|
|
481
481
|
r.set(0, x);
|
|
482
482
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
483
483
|
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * de, V, le), this._isUserControllingZoom = !0);
|
|
@@ -537,11 +537,11 @@ class J extends Os {
|
|
|
537
537
|
this._addAllEventListeners = (l) => {
|
|
538
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", f, {
|
|
539
539
|
passive: !1
|
|
540
|
-
}), this._domElement.addEventListener("contextmenu",
|
|
540
|
+
}), this._domElement.addEventListener("contextmenu", p);
|
|
541
541
|
}, this._removeAllEventListeners = () => {
|
|
542
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", f, {
|
|
543
543
|
passive: !1
|
|
544
|
-
}), this._domElement.removeEventListener("contextmenu",
|
|
544
|
+
}), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
|
|
545
545
|
"pointermove",
|
|
546
546
|
n,
|
|
547
547
|
{ passive: !1 }
|
|
@@ -900,7 +900,7 @@ class J extends Os {
|
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
902
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
903
|
-
const i =
|
|
903
|
+
const i = b.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -910,8 +910,8 @@ class J extends Os {
|
|
|
910
910
|
* @category Methods
|
|
911
911
|
*/
|
|
912
912
|
forward(e, t = !1) {
|
|
913
|
-
|
|
914
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
b.setFromMatrixColumn(this._camera.matrix, 0), b.crossVectors(this._camera.up, b), b.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(b);
|
|
915
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -921,10 +921,10 @@ class J extends Os {
|
|
|
921
921
|
* @category Methods
|
|
922
922
|
*/
|
|
923
923
|
elevate(e, t = !1) {
|
|
924
|
-
return
|
|
925
|
-
this._targetEnd.x +
|
|
926
|
-
this._targetEnd.y +
|
|
927
|
-
this._targetEnd.z +
|
|
924
|
+
return b.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
925
|
+
this._targetEnd.x + b.x,
|
|
926
|
+
this._targetEnd.y + b.y,
|
|
927
|
+
this._targetEnd.z + b.z,
|
|
928
928
|
t
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -938,7 +938,7 @@ class J extends Os {
|
|
|
938
938
|
*/
|
|
939
939
|
moveTo(e, t, s, i = !1) {
|
|
940
940
|
this._isUserControllingTruck = !1;
|
|
941
|
-
const r =
|
|
941
|
+
const r = b.set(e, t, s).sub(this._targetEnd);
|
|
942
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
943
943
|
const o = !i || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
944
944
|
return this._createOnRestPromise(o);
|
|
@@ -953,7 +953,7 @@ class J extends Os {
|
|
|
953
953
|
* @category Methods
|
|
954
954
|
*/
|
|
955
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
956
|
-
const n =
|
|
956
|
+
const n = b.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
957
957
|
return this.setPosition(
|
|
958
958
|
n.x,
|
|
959
959
|
n.y,
|
|
@@ -985,13 +985,13 @@ class J extends Os {
|
|
|
985
985
|
c.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const f =
|
|
989
|
-
a.push(this.rotateTo(f,
|
|
990
|
-
const v =
|
|
991
|
-
u &&
|
|
988
|
+
const f = He(this._sphericalEnd.theta, je), p = He(this._sphericalEnd.phi, je);
|
|
989
|
+
a.push(this.rotateTo(f, p, t));
|
|
990
|
+
const v = b.setFromSpherical(this._sphericalEnd).normalize(), m = Ke.setFromUnitVectors(v, we), u = P(Math.abs(v.y), 1);
|
|
991
|
+
u && m.multiply(xe.setFromAxisAngle(pe, f)), m.multiply(this._yAxisUpSpaceInverse);
|
|
992
992
|
const g = We.makeEmpty();
|
|
993
|
-
L.copy(c.min).applyQuaternion(
|
|
994
|
-
const y = g.getSize(
|
|
993
|
+
L.copy(c.min).applyQuaternion(m), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(m), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(m), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(m), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(m), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(m), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(m), g.expandByPoint(L), L.copy(c.max).applyQuaternion(m), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, m.setFromUnitVectors(we, v), u && m.premultiply(xe.invert()), m.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(m);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
996
|
const _ = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
@@ -1002,11 +1002,11 @@ class J extends Os {
|
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
1004
|
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
|
-
} else if (
|
|
1006
|
-
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom,
|
|
1005
|
+
} else if (H(this._camera)) {
|
|
1006
|
+
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1009
|
-
), a.push(this.zoomTo(
|
|
1009
|
+
), a.push(this.zoomTo(w, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1010
1010
|
}
|
|
1011
1011
|
return Promise.all(a);
|
|
1012
1012
|
}
|
|
@@ -1017,7 +1017,7 @@ class J extends Os {
|
|
|
1017
1017
|
* @category Methods
|
|
1018
1018
|
*/
|
|
1019
1019
|
fitToSphere(e, t) {
|
|
1020
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1020
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, be) : be.copy(e);
|
|
1021
1021
|
if (s.push(
|
|
1022
1022
|
this.moveTo(
|
|
1023
1023
|
r.center.x,
|
|
@@ -1028,7 +1028,7 @@ class J extends Os {
|
|
|
1028
1028
|
), Y(this._camera)) {
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
|
-
} else if (
|
|
1031
|
+
} else if (H(this._camera)) {
|
|
1032
1032
|
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, c = Math.min(o / a, n / a);
|
|
1033
1033
|
s.push(this.zoomTo(c, t));
|
|
1034
1034
|
}
|
|
@@ -1047,7 +1047,7 @@ class J extends Os {
|
|
|
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), c =
|
|
1050
|
+
const a = L.set(i, r, o), c = b.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
1052
|
c.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -1084,21 +1084,21 @@ class J extends Os {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a, c, f,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, c, f, p, v, m, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g =
|
|
1089
|
+
const g = b.set(i, r, o), y = L.set(e, t, s);
|
|
1090
1090
|
z.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(f,
|
|
1093
|
+
const l = G.set(f, p, v), _ = L.set(n, a, c);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
1095
|
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
|
-
), this._targetEnd.copy(g.lerp(l,
|
|
1097
|
-
const O = ae.theta - z.theta, C = ae.phi - z.phi,
|
|
1096
|
+
), this._targetEnd.copy(g.lerp(l, m));
|
|
1097
|
+
const O = ae.theta - z.theta, C = ae.phi - z.phi, w = ae.radius - z.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
z.radius +
|
|
1100
|
-
z.phi + C *
|
|
1101
|
-
z.theta + O *
|
|
1099
|
+
z.radius + w * m,
|
|
1100
|
+
z.phi + C * m,
|
|
1101
|
+
z.theta + O * m
|
|
1102
1102
|
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
1103
|
const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
@@ -1145,7 +1145,7 @@ class J extends Os {
|
|
|
1145
1145
|
* @category Methods
|
|
1146
1146
|
*/
|
|
1147
1147
|
setTarget(e, t, s, i = !1) {
|
|
1148
|
-
const r = this.getPosition(
|
|
1148
|
+
const r = this.getPosition(b), o = this.setLookAt(
|
|
1149
1149
|
r.x,
|
|
1150
1150
|
r.y,
|
|
1151
1151
|
r.z,
|
|
@@ -1195,8 +1195,8 @@ class J extends Os {
|
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
1197
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1198
|
-
const i =
|
|
1199
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1198
|
+
const i = b.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1199
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), b.copy(F).add(N).add(Z), b.z = b.z + r, this.dollyTo(r, !1), this.setFocalOffset(-b.x, b.y, -b.z, !1), this.moveTo(e, t, s, !1);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1311,7 +1311,7 @@ class J extends Os {
|
|
|
1311
1311
|
reset(e = !1) {
|
|
1312
1312
|
if (!P(this._camera.up.x, this._cameraUp0.x) || !P(this._camera.up.y, this._cameraUp0.y) || !P(this._camera.up.z, this._cameraUp0.z)) {
|
|
1313
1313
|
this._camera.up.copy(this._cameraUp0);
|
|
1314
|
-
const s = this.getPosition(
|
|
1314
|
+
const s = this.getPosition(b);
|
|
1315
1315
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1316
1316
|
}
|
|
1317
1317
|
const t = [
|
|
@@ -1347,7 +1347,7 @@ class J extends Os {
|
|
|
1347
1347
|
* @category Methods
|
|
1348
1348
|
*/
|
|
1349
1349
|
updateCameraUp() {
|
|
1350
|
-
this._yAxisUpSpace.setFromUnitVectors(this._camera.up,
|
|
1350
|
+
this._yAxisUpSpace.setFromUnitVectors(this._camera.up, pe), this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert();
|
|
1351
1351
|
}
|
|
1352
1352
|
/**
|
|
1353
1353
|
* Apply current camera-up direction to the camera.
|
|
@@ -1355,9 +1355,9 @@ class J extends Os {
|
|
|
1355
1355
|
* @category Methods
|
|
1356
1356
|
*/
|
|
1357
1357
|
applyCameraUp() {
|
|
1358
|
-
const e =
|
|
1358
|
+
const e = b.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1359
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1360
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(b);
|
|
1361
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
@@ -1375,12 +1375,12 @@ class J extends Os {
|
|
|
1375
1375
|
if (A(t))
|
|
1376
1376
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1377
1377
|
else {
|
|
1378
|
-
const
|
|
1378
|
+
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1379
1379
|
this._spherical.theta = ce(
|
|
1380
1380
|
this._spherical.theta,
|
|
1381
1381
|
this._sphericalEnd.theta,
|
|
1382
1382
|
this._thetaVelocity,
|
|
1383
|
-
|
|
1383
|
+
p,
|
|
1384
1384
|
1 / 0,
|
|
1385
1385
|
e
|
|
1386
1386
|
), this._needsUpdate = !0;
|
|
@@ -1388,12 +1388,12 @@ class J extends Os {
|
|
|
1388
1388
|
if (A(s))
|
|
1389
1389
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1390
1390
|
else {
|
|
1391
|
-
const
|
|
1391
|
+
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1392
1392
|
this._spherical.phi = ce(
|
|
1393
1393
|
this._spherical.phi,
|
|
1394
1394
|
this._sphericalEnd.phi,
|
|
1395
1395
|
this._phiVelocity,
|
|
1396
|
-
|
|
1396
|
+
p,
|
|
1397
1397
|
1 / 0,
|
|
1398
1398
|
e
|
|
1399
1399
|
), this._needsUpdate = !0;
|
|
@@ -1401,12 +1401,12 @@ class J extends Os {
|
|
|
1401
1401
|
if (A(i))
|
|
1402
1402
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1403
1403
|
else {
|
|
1404
|
-
const
|
|
1404
|
+
const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
1405
1405
|
this._spherical.radius = ce(
|
|
1406
1406
|
this._spherical.radius,
|
|
1407
1407
|
this._sphericalEnd.radius,
|
|
1408
1408
|
this._radiusVelocity,
|
|
1409
|
-
|
|
1409
|
+
p,
|
|
1410
1410
|
this.maxSpeed,
|
|
1411
1411
|
e
|
|
1412
1412
|
), this._needsUpdate = !0;
|
|
@@ -1414,12 +1414,12 @@ class J extends Os {
|
|
|
1414
1414
|
if (A(r.x) && A(r.y) && A(r.z))
|
|
1415
1415
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1416
1416
|
else {
|
|
1417
|
-
const
|
|
1417
|
+
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1418
1418
|
Be(
|
|
1419
1419
|
this._target,
|
|
1420
1420
|
this._targetEnd,
|
|
1421
1421
|
this._targetVelocity,
|
|
1422
|
-
|
|
1422
|
+
p,
|
|
1423
1423
|
this.maxSpeed,
|
|
1424
1424
|
e,
|
|
1425
1425
|
this._target
|
|
@@ -1428,12 +1428,12 @@ class J extends Os {
|
|
|
1428
1428
|
if (A(o.x) && A(o.y) && A(o.z))
|
|
1429
1429
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1430
1430
|
else {
|
|
1431
|
-
const
|
|
1431
|
+
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1432
1432
|
Be(
|
|
1433
1433
|
this._focalOffset,
|
|
1434
1434
|
this._focalOffsetEnd,
|
|
1435
1435
|
this._focalOffsetVelocity,
|
|
1436
|
-
|
|
1436
|
+
p,
|
|
1437
1437
|
this.maxSpeed,
|
|
1438
1438
|
e,
|
|
1439
1439
|
this._focalOffset
|
|
@@ -1442,53 +1442,53 @@ class J extends Os {
|
|
|
1442
1442
|
if (A(n))
|
|
1443
1443
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1444
1444
|
else {
|
|
1445
|
-
const
|
|
1445
|
+
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
1446
1446
|
this._zoom = ce(
|
|
1447
1447
|
this._zoom,
|
|
1448
1448
|
this._zoomEnd,
|
|
1449
1449
|
this._zoomVelocity,
|
|
1450
|
-
|
|
1450
|
+
p,
|
|
1451
1451
|
1 / 0,
|
|
1452
1452
|
e
|
|
1453
1453
|
);
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, m = this._getCameraDirection(ne), u = b.copy(m).cross(v.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
-
const g = L.crossVectors(u,
|
|
1459
|
+
const g = L.crossVectors(u, m), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
1461
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
), C =
|
|
1466
|
-
if (this.infinityDolly && (
|
|
1467
|
-
this._sphericalEnd.radius -=
|
|
1468
|
-
const R = L.copy(
|
|
1465
|
+
), C = b.copy(this._targetEnd).lerp(O, _), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
|
+
if (this.infinityDolly && (w || E)) {
|
|
1467
|
+
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
+
const R = L.copy(m).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
|
-
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -=
|
|
1474
|
-
} else if (
|
|
1475
|
-
const
|
|
1473
|
+
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
|
+
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, m = 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), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(
|
|
1480
|
-
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(m).add(u.multiplyScalar(-m.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), O = this._targetEnd.dot(_), C = b.copy(this._targetEnd).lerp(g, l), w = C.dot(_), E = _.multiplyScalar(
|
|
1480
|
+
w - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1483
1483
|
const x = L.subVectors(C, this._targetEnd);
|
|
1484
|
-
this._targetEnd.copy(C), this._target.add(x), this._changedZoom -=
|
|
1484
|
+
this._targetEnd.copy(C), this._target.add(x), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1488
1488
|
const a = this._collisionTest();
|
|
1489
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z),
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), b.copy(F).add(N).add(Z), this._camera.position.add(b), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
|
-
|
|
1491
|
+
b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const f = this._needsUpdate;
|
|
@@ -1515,7 +1515,7 @@ class J extends Os {
|
|
|
1515
1515
|
truckSpeed: this.truckSpeed,
|
|
1516
1516
|
dollyToCursor: this.dollyToCursor,
|
|
1517
1517
|
target: this._targetEnd.toArray(),
|
|
1518
|
-
position:
|
|
1518
|
+
position: b.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1519
1519
|
zoom: this._zoomEnd,
|
|
1520
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1521
1521
|
target0: this._target0.toArray(),
|
|
@@ -1533,7 +1533,7 @@ class J extends Os {
|
|
|
1533
1533
|
fromJSON(e, t = !1) {
|
|
1534
1534
|
const s = JSON.parse(e);
|
|
1535
1535
|
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), z.setFromVector3(
|
|
1536
|
-
|
|
1536
|
+
b.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1537
1537
|
), this.rotateTo(z.theta, z.phi, t), this.dollyTo(z.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1538
1538
|
s.focalOffset[0],
|
|
1539
1539
|
s.focalOffset[1],
|
|
@@ -1606,7 +1606,7 @@ class J extends Os {
|
|
|
1606
1606
|
if (Y(this._camera)) {
|
|
1607
1607
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1608
1608
|
this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
|
|
1609
|
-
} else if (
|
|
1609
|
+
} else if (H(this._camera)) {
|
|
1610
1610
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
1611
1611
|
this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
|
|
1612
1612
|
}
|
|
@@ -1622,8 +1622,8 @@ class J extends Os {
|
|
|
1622
1622
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1623
1623
|
r.applyMatrix4(Le);
|
|
1624
1624
|
const o = G.addVectors(this._target, r);
|
|
1625
|
-
|
|
1626
|
-
const n =
|
|
1625
|
+
me.set(o, s), me.far = this._spherical.radius + 1;
|
|
1626
|
+
const n = me.intersectObjects(this.colliderMeshes);
|
|
1627
1627
|
n.length !== 0 && n[0].distance < e && (e = n[0].distance);
|
|
1628
1628
|
}
|
|
1629
1629
|
return e;
|
|
@@ -1702,8 +1702,8 @@ class J extends Os {
|
|
|
1702
1702
|
const a = n.geometry.clone();
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
1704
|
const f = a.attributes.position;
|
|
1705
|
-
for (let
|
|
1706
|
-
|
|
1705
|
+
for (let p = 0, v = f.count; p < v; p++)
|
|
1706
|
+
b.fromBufferAttribute(f, p), r = Math.max(r, i.distanceToSquared(b));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
@@ -1715,17 +1715,17 @@ Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymb
|
|
|
1715
1715
|
} : ue = function(e) {
|
|
1716
1716
|
return Object.getOwnPropertyNames(e);
|
|
1717
1717
|
};
|
|
1718
|
-
function
|
|
1718
|
+
function xs(h) {
|
|
1719
1719
|
console && console.warn && console.warn(h);
|
|
1720
1720
|
}
|
|
1721
|
-
var
|
|
1721
|
+
var _t = Number.isNaN || function(e) {
|
|
1722
1722
|
return e !== e;
|
|
1723
1723
|
};
|
|
1724
1724
|
function S() {
|
|
1725
1725
|
S.init.call(this);
|
|
1726
1726
|
}
|
|
1727
1727
|
Ae.exports = S;
|
|
1728
|
-
Ae.exports.once =
|
|
1728
|
+
Ae.exports.once = As;
|
|
1729
1729
|
S.EventEmitter = S;
|
|
1730
1730
|
S.prototype._events = void 0;
|
|
1731
1731
|
S.prototype._eventsCount = 0;
|
|
@@ -1741,7 +1741,7 @@ Object.defineProperty(S, "defaultMaxListeners", {
|
|
|
1741
1741
|
return Ge;
|
|
1742
1742
|
},
|
|
1743
1743
|
set: function(h) {
|
|
1744
|
-
if (typeof h != "number" || h < 0 ||
|
|
1744
|
+
if (typeof h != "number" || h < 0 || _t(h))
|
|
1745
1745
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + h + ".");
|
|
1746
1746
|
Ge = h;
|
|
1747
1747
|
}
|
|
@@ -1750,15 +1750,15 @@ S.init = function() {
|
|
|
1750
1750
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
1751
1751
|
};
|
|
1752
1752
|
S.prototype.setMaxListeners = function(e) {
|
|
1753
|
-
if (typeof e != "number" || e < 0 ||
|
|
1753
|
+
if (typeof e != "number" || e < 0 || _t(e))
|
|
1754
1754
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1755
1755
|
return this._maxListeners = e, this;
|
|
1756
1756
|
};
|
|
1757
|
-
function
|
|
1757
|
+
function gt(h) {
|
|
1758
1758
|
return h._maxListeners === void 0 ? S.defaultMaxListeners : h._maxListeners;
|
|
1759
1759
|
}
|
|
1760
1760
|
S.prototype.getMaxListeners = function() {
|
|
1761
|
-
return
|
|
1761
|
+
return gt(this);
|
|
1762
1762
|
};
|
|
1763
1763
|
S.prototype.emit = function(e) {
|
|
1764
1764
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
@@ -1780,11 +1780,11 @@ S.prototype.emit = function(e) {
|
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
1781
|
$e(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var c = a.length, f =
|
|
1783
|
+
for (var c = a.length, f = Et(a, c), s = 0; s < c; ++s)
|
|
1784
1784
|
$e(f[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
|
-
function
|
|
1787
|
+
function yt(h, e, t, s) {
|
|
1788
1788
|
var i, r, o;
|
|
1789
1789
|
if (ge(t), r = h._events, r === void 0 ? (r = h._events = /* @__PURE__ */ Object.create(null), h._eventsCount = 0) : (r.newListener !== void 0 && (h.emit(
|
|
1790
1790
|
"newListener",
|
|
@@ -1792,33 +1792,33 @@ function gt(h, e, t, s) {
|
|
|
1792
1792
|
t.listener ? t.listener : t
|
|
1793
1793
|
), r = h._events), o = r[e]), o === void 0)
|
|
1794
1794
|
o = r[e] = t, ++h._eventsCount;
|
|
1795
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i =
|
|
1795
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = gt(h), 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 = h, n.type = e, n.count = o.length,
|
|
1798
|
+
n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length, xs(n);
|
|
1799
1799
|
}
|
|
1800
1800
|
return h;
|
|
1801
1801
|
}
|
|
1802
1802
|
S.prototype.addListener = function(e, t) {
|
|
1803
|
-
return
|
|
1803
|
+
return yt(this, e, t, !1);
|
|
1804
1804
|
};
|
|
1805
1805
|
S.prototype.on = S.prototype.addListener;
|
|
1806
1806
|
S.prototype.prependListener = function(e, t) {
|
|
1807
|
-
return
|
|
1807
|
+
return yt(this, e, t, !0);
|
|
1808
1808
|
};
|
|
1809
|
-
function
|
|
1809
|
+
function Ls() {
|
|
1810
1810
|
if (!this.fired)
|
|
1811
1811
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1814
|
-
var s = { fired: !1, wrapFn: void 0, target: h, type: e, listener: t }, i =
|
|
1813
|
+
function vt(h, e, t) {
|
|
1814
|
+
var s = { fired: !1, wrapFn: void 0, target: h, type: e, listener: t }, i = Ls.bind(s);
|
|
1815
1815
|
return i.listener = t, s.wrapFn = i, i;
|
|
1816
1816
|
}
|
|
1817
1817
|
S.prototype.once = function(e, t) {
|
|
1818
|
-
return ge(t), this.on(e,
|
|
1818
|
+
return ge(t), this.on(e, vt(this, e, t)), this;
|
|
1819
1819
|
};
|
|
1820
1820
|
S.prototype.prependOnceListener = function(e, t) {
|
|
1821
|
-
return ge(t), this.prependListener(e,
|
|
1821
|
+
return ge(t), this.prependListener(e, vt(this, e, t)), this;
|
|
1822
1822
|
};
|
|
1823
1823
|
S.prototype.removeListener = function(e, t) {
|
|
1824
1824
|
var s, i, r, o, n;
|
|
@@ -1836,7 +1836,7 @@ S.prototype.removeListener = function(e, t) {
|
|
|
1836
1836
|
}
|
|
1837
1837
|
if (r < 0)
|
|
1838
1838
|
return this;
|
|
1839
|
-
r === 0 ? s.shift() :
|
|
1839
|
+
r === 0 ? s.shift() : Ps(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, n || t);
|
|
1840
1840
|
}
|
|
1841
1841
|
return this;
|
|
1842
1842
|
};
|
|
@@ -1860,24 +1860,24 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1863
|
+
function Ct(h, e, t) {
|
|
1864
1864
|
var s = h._events;
|
|
1865
1865
|
if (s === void 0)
|
|
1866
1866
|
return [];
|
|
1867
1867
|
var i = s[e];
|
|
1868
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ?
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ss(i) : Et(i, i.length);
|
|
1869
1869
|
}
|
|
1870
1870
|
S.prototype.listeners = function(e) {
|
|
1871
|
-
return
|
|
1871
|
+
return Ct(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
1873
|
S.prototype.rawListeners = function(e) {
|
|
1874
|
-
return
|
|
1874
|
+
return Ct(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
1876
|
S.listenerCount = function(h, e) {
|
|
1877
|
-
return typeof h.listenerCount == "function" ? h.listenerCount(e) :
|
|
1877
|
+
return typeof h.listenerCount == "function" ? h.listenerCount(e) : Ot.call(h, e);
|
|
1878
1878
|
};
|
|
1879
|
-
S.prototype.listenerCount =
|
|
1880
|
-
function
|
|
1879
|
+
S.prototype.listenerCount = Ot;
|
|
1880
|
+
function Ot(h) {
|
|
1881
1881
|
var e = this._events;
|
|
1882
1882
|
if (e !== void 0) {
|
|
1883
1883
|
var t = e[h];
|
|
@@ -1891,22 +1891,22 @@ function Ct(h) {
|
|
|
1891
1891
|
S.prototype.eventNames = function() {
|
|
1892
1892
|
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function Et(h, e) {
|
|
1895
1895
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1896
1896
|
t[s] = h[s];
|
|
1897
1897
|
return t;
|
|
1898
1898
|
}
|
|
1899
|
-
function
|
|
1899
|
+
function Ps(h, e) {
|
|
1900
1900
|
for (; e + 1 < h.length; e++)
|
|
1901
1901
|
h[e] = h[e + 1];
|
|
1902
1902
|
h.pop();
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Ss(h) {
|
|
1905
1905
|
for (var e = new Array(h.length), t = 0; t < e.length; ++t)
|
|
1906
1906
|
e[t] = h[t].listener || h[t];
|
|
1907
1907
|
return e;
|
|
1908
1908
|
}
|
|
1909
|
-
function
|
|
1909
|
+
function As(h, e) {
|
|
1910
1910
|
return new Promise(function(t, s) {
|
|
1911
1911
|
function i(o) {
|
|
1912
1912
|
h.removeListener(e, r), s(o);
|
|
@@ -1914,13 +1914,13 @@ function Ls(h, e) {
|
|
|
1914
1914
|
function r() {
|
|
1915
1915
|
typeof h.removeListener == "function" && h.removeListener("error", i), t([].slice.call(arguments));
|
|
1916
1916
|
}
|
|
1917
|
-
|
|
1917
|
+
Tt(h, e, r, { once: !0 }), e !== "error" && Ms(h, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
|
-
function
|
|
1921
|
-
typeof h.on == "function" &&
|
|
1920
|
+
function Ms(h, e, t) {
|
|
1921
|
+
typeof h.on == "function" && Tt(h, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Tt(h, e, t, s) {
|
|
1924
1924
|
if (typeof h.on == "function")
|
|
1925
1925
|
s.once ? h.once(e, t) : h.on(e, t);
|
|
1926
1926
|
else if (typeof h.addEventListener == "function")
|
|
@@ -1931,7 +1931,7 @@ function Et(h, e, t, s) {
|
|
|
1931
1931
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof h);
|
|
1932
1932
|
}
|
|
1933
1933
|
var ye = Ae.exports;
|
|
1934
|
-
let
|
|
1934
|
+
let Rs = class {
|
|
1935
1935
|
constructor() {
|
|
1936
1936
|
this.mask = 1;
|
|
1937
1937
|
}
|
|
@@ -1962,7 +1962,7 @@ class ee {
|
|
|
1962
1962
|
this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
1963
1963
|
}
|
|
1964
1964
|
addController(e, t) {
|
|
1965
|
-
const s = new
|
|
1965
|
+
const s = new Rs();
|
|
1966
1966
|
return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
|
|
1967
1967
|
}
|
|
1968
1968
|
removePage(e, t) {
|
|
@@ -1991,21 +1991,21 @@ class ee {
|
|
|
1991
1991
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
1992
1992
|
}
|
|
1993
1993
|
}
|
|
1994
|
-
const
|
|
1994
|
+
const wt = {
|
|
1995
1995
|
fov: 45,
|
|
1996
1996
|
near: 1,
|
|
1997
1997
|
far: 1e3,
|
|
1998
|
-
up: new
|
|
1998
|
+
up: new j(0, 1, 0)
|
|
1999
1999
|
};
|
|
2000
|
-
class
|
|
2000
|
+
class Ds extends ee {
|
|
2001
2001
|
constructor(e) {
|
|
2002
2002
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2003
2003
|
}
|
|
2004
2004
|
get camera() {
|
|
2005
2005
|
return this.controller;
|
|
2006
2006
|
}
|
|
2007
|
-
addPerspectiveCamera(e =
|
|
2008
|
-
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, c = new
|
|
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, c = new kt(s, a, r, i);
|
|
2009
2009
|
return c.up = o, this.addController(c, t);
|
|
2010
2010
|
}
|
|
2011
2011
|
setPageActive(e) {
|
|
@@ -2077,9 +2077,9 @@ class As extends ee {
|
|
|
2077
2077
|
}
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
|
-
const
|
|
2081
|
-
const e = new
|
|
2082
|
-
new
|
|
2080
|
+
const Us = (h) => {
|
|
2081
|
+
const e = new ps(
|
|
2082
|
+
new Ft({
|
|
2083
2083
|
uniforms: {
|
|
2084
2084
|
baseTexture: { value: null },
|
|
2085
2085
|
bloomTexture: { value: h.renderTarget2.texture },
|
|
@@ -2113,7 +2113,7 @@ const Ms = (h) => {
|
|
|
2113
2113
|
"baseTexture"
|
|
2114
2114
|
);
|
|
2115
2115
|
return e.needsSwap = !0, e;
|
|
2116
|
-
},
|
|
2116
|
+
}, zs = {
|
|
2117
2117
|
name: "OutputShader",
|
|
2118
2118
|
uniforms: {
|
|
2119
2119
|
tDiffuse: { value: null },
|
|
@@ -2207,11 +2207,11 @@ const Ms = (h) => {
|
|
|
2207
2207
|
}`
|
|
2208
2208
|
)
|
|
2209
2209
|
};
|
|
2210
|
-
class
|
|
2210
|
+
class ks extends ms {
|
|
2211
2211
|
constructor() {
|
|
2212
2212
|
super();
|
|
2213
|
-
const e =
|
|
2214
|
-
this.uniforms =
|
|
2213
|
+
const e = zs;
|
|
2214
|
+
this.uniforms = Nt.clone(e.uniforms), this.material = new It({
|
|
2215
2215
|
name: e.name,
|
|
2216
2216
|
uniforms: this.uniforms,
|
|
2217
2217
|
vertexShader: e.vertexShader,
|
|
@@ -2219,38 +2219,38 @@ class Ds extends cs {
|
|
|
2219
2219
|
}), this.fsQuad ? this.fsQuad = new Fe(this.material) : this._fsQuad && (this._fsQuad = new Fe(this.material));
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
|
-
const
|
|
2222
|
+
const Fs = new jt({ color: "black" }), Ns = new at({
|
|
2223
2223
|
color: "black",
|
|
2224
2224
|
sizeAttenuation: !1
|
|
2225
|
-
}),
|
|
2225
|
+
}), Is = new at({
|
|
2226
2226
|
color: "black",
|
|
2227
2227
|
sizeAttenuation: !0
|
|
2228
|
-
}),
|
|
2228
|
+
}), js = new lt({
|
|
2229
2229
|
color: "black",
|
|
2230
2230
|
sizeAttenuation: !0
|
|
2231
|
-
}),
|
|
2231
|
+
}), Hs = new lt({
|
|
2232
2232
|
color: "black",
|
|
2233
2233
|
sizeAttenuation: !1
|
|
2234
|
-
}),
|
|
2234
|
+
}), Bs = new ut({
|
|
2235
2235
|
color: "black",
|
|
2236
2236
|
sizeAttenuation: !1,
|
|
2237
2237
|
lineWidth: 0
|
|
2238
|
-
}),
|
|
2238
|
+
}), Xe = new Ht(0), Vs = {
|
|
2239
2239
|
kernelRadius: 8,
|
|
2240
2240
|
minDistance: 5e-3,
|
|
2241
2241
|
maxDistance: 0.1
|
|
2242
|
-
},
|
|
2242
|
+
}, Ys = {
|
|
2243
2243
|
threshold: 0,
|
|
2244
2244
|
strength: 0.4,
|
|
2245
2245
|
radius: 0.1,
|
|
2246
2246
|
bloomAlphaType: 0
|
|
2247
|
-
},
|
|
2247
|
+
}, Zs = {
|
|
2248
2248
|
multisampling: 4,
|
|
2249
2249
|
premultiplieAlpha: !1
|
|
2250
2250
|
};
|
|
2251
|
-
class
|
|
2251
|
+
class Ws {
|
|
2252
2252
|
constructor(e) {
|
|
2253
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2253
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new Bt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2254
2254
|
const {
|
|
2255
2255
|
rendererController: t,
|
|
2256
2256
|
sceneController: s,
|
|
@@ -2258,20 +2258,20 @@ class Vs {
|
|
|
2258
2258
|
composerParams: r
|
|
2259
2259
|
} = e, { renderer: o } = t;
|
|
2260
2260
|
this.renderer = o;
|
|
2261
|
-
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, c = o.getDrawingBufferSize(new B()), f = new
|
|
2261
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, c = o.getDrawingBufferSize(new B()), f = new Vt(
|
|
2262
2262
|
c.width,
|
|
2263
2263
|
c.height,
|
|
2264
2264
|
{
|
|
2265
2265
|
samples: Math.min(n, a),
|
|
2266
|
-
type:
|
|
2266
|
+
type: Yt
|
|
2267
2267
|
}
|
|
2268
|
-
),
|
|
2269
|
-
|
|
2270
|
-
const
|
|
2268
|
+
), p = new ke(o, f), v = this.getSize();
|
|
2269
|
+
p.setSize(v.width, v.height);
|
|
2270
|
+
const m = new hs(
|
|
2271
2271
|
s.scene,
|
|
2272
2272
|
i.camera
|
|
2273
2273
|
);
|
|
2274
|
-
|
|
2274
|
+
p.addPass(m), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = m, i.event.on("pageChange", (u) => {
|
|
2275
2275
|
this.changeCamera(u);
|
|
2276
2276
|
}), s.event.on("pageChange", (u) => {
|
|
2277
2277
|
this.changeScene(u);
|
|
@@ -2284,18 +2284,18 @@ class Vs {
|
|
|
2284
2284
|
this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
|
|
2285
2285
|
}
|
|
2286
2286
|
addOutputPass() {
|
|
2287
|
-
const { premultiplieAlpha: e } = this.options.composerParams, t = new
|
|
2287
|
+
const { premultiplieAlpha: e } = this.options.composerParams, t = new ks();
|
|
2288
2288
|
this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
|
|
2289
2289
|
}
|
|
2290
2290
|
setPremultiplieAlpha(e) {
|
|
2291
2291
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2292
2292
|
}
|
|
2293
2293
|
addSSAOPass(e) {
|
|
2294
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new
|
|
2294
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new cs(t, s, o, n);
|
|
2295
2295
|
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2296
2296
|
}
|
|
2297
2297
|
addBloomPass(e) {
|
|
2298
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new
|
|
2298
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new ds(
|
|
2299
2299
|
new B(window.innerWidth, window.innerHeight),
|
|
2300
2300
|
i,
|
|
2301
2301
|
r,
|
|
@@ -2304,7 +2304,7 @@ class Vs {
|
|
|
2304
2304
|
this.bloomPass = n;
|
|
2305
2305
|
const a = new ke(t);
|
|
2306
2306
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2307
|
-
const c =
|
|
2307
|
+
const c = Us(a);
|
|
2308
2308
|
c.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(c), this.mixPass = c, this.bloomLayer.set(Oe);
|
|
2309
2309
|
}
|
|
2310
2310
|
setBloomSelection(e, t) {
|
|
@@ -2333,31 +2333,36 @@ class Vs {
|
|
|
2333
2333
|
}
|
|
2334
2334
|
darkenNonBloomed() {
|
|
2335
2335
|
const e = [], t = [];
|
|
2336
|
-
this.scene.children.forEach((
|
|
2337
|
-
|
|
2338
|
-
}), t.forEach((
|
|
2339
|
-
|
|
2340
|
-
var
|
|
2341
|
-
const
|
|
2342
|
-
if ((
|
|
2343
|
-
e.push(
|
|
2344
|
-
else if (
|
|
2345
|
-
if (
|
|
2346
|
-
e.push(
|
|
2336
|
+
this.scene.children.forEach((i) => {
|
|
2337
|
+
i.isTransformControls || i.isTransformControlsRoot || i.type === "RectAreaLightHelper" ? e.push(i) : t.push(i);
|
|
2338
|
+
}), t.forEach((i) => {
|
|
2339
|
+
i.traverse((r) => {
|
|
2340
|
+
var c;
|
|
2341
|
+
const o = r, n = r, a = r;
|
|
2342
|
+
if ((c = o.material) != null && c.isShadowMaterial)
|
|
2343
|
+
e.push(o);
|
|
2344
|
+
else if (o.material && this.bloomLayer.test(o.layers) === !1) {
|
|
2345
|
+
if (o.material.transparent === !0 && (o.material.opacity !== 1 || o.material.alphaMap)) {
|
|
2346
|
+
e.push(o);
|
|
2347
2347
|
return;
|
|
2348
2348
|
}
|
|
2349
|
-
this.bloomMaterials[
|
|
2349
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = js : n.material = Hs : o.material instanceof ut ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = Is : a.material = Ns : o.material = Fs;
|
|
2350
2350
|
}
|
|
2351
2351
|
});
|
|
2352
|
-
}), e.forEach((
|
|
2353
|
-
this.bloomVisible[
|
|
2352
|
+
}), e.forEach((i) => {
|
|
2353
|
+
this.bloomVisible[i.uuid] = i.visible, i.visible = !1;
|
|
2354
2354
|
});
|
|
2355
|
+
const s = this.scene.background;
|
|
2356
|
+
s != null && s.isTexture && (this.scene.userData._backgroundOriginal = s, this.scene.background = Xe);
|
|
2355
2357
|
}
|
|
2356
2358
|
restoreNonBloomed() {
|
|
2357
|
-
this.scene.traverse((e) => {
|
|
2359
|
+
if (this.scene.traverse((e) => {
|
|
2358
2360
|
const t = e;
|
|
2359
2361
|
this.bloomMaterials[t.uuid] ? (t.material = this.bloomMaterials[t.uuid], delete this.bloomMaterials[t.uuid]) : this.bloomVisible[t.uuid] !== void 0 && (t.visible = this.bloomVisible[t.uuid], delete this.bloomVisible[t.uuid]);
|
|
2360
|
-
})
|
|
2362
|
+
}), this.scene.background === Xe) {
|
|
2363
|
+
const e = this.scene.userData._backgroundOriginal;
|
|
2364
|
+
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2365
|
+
}
|
|
2361
2366
|
}
|
|
2362
2367
|
finalComposerRender() {
|
|
2363
2368
|
this.bloomComposerActive && this.bloomComposer ? (this.bloomComposerRenderIng = !0, this.mixPass.enabled = !0, this.darkenNonBloomed(), this.bloomComposer.render(), this.restoreNonBloomed(), this.bloomComposerRenderIng = !1) : this.mixPass && (this.mixPass.enabled = !1), this.finalComposer.render();
|
|
@@ -2391,19 +2396,19 @@ class Vs {
|
|
|
2391
2396
|
this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomSelection.clear(), this.finalComposer.dispose(), (e = this.bloomComposer) == null || e.dispose();
|
|
2392
2397
|
}
|
|
2393
2398
|
}
|
|
2394
|
-
class
|
|
2399
|
+
class Ks extends ee {
|
|
2395
2400
|
constructor(e) {
|
|
2396
2401
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2397
2402
|
const t = {
|
|
2398
2403
|
Vector2: B,
|
|
2399
|
-
Vector3:
|
|
2400
|
-
Vector4:
|
|
2401
|
-
Quaternion:
|
|
2404
|
+
Vector3: j,
|
|
2405
|
+
Vector4: Wt,
|
|
2406
|
+
Quaternion: ht,
|
|
2402
2407
|
Matrix4: W,
|
|
2403
|
-
Spherical:
|
|
2404
|
-
Box3:
|
|
2405
|
-
Sphere:
|
|
2406
|
-
Raycaster:
|
|
2408
|
+
Spherical: Kt,
|
|
2409
|
+
Box3: ct,
|
|
2410
|
+
Sphere: $t,
|
|
2411
|
+
Raycaster: dt
|
|
2407
2412
|
};
|
|
2408
2413
|
J.install({ THREE: t });
|
|
2409
2414
|
}
|
|
@@ -2435,11 +2440,11 @@ class Ys extends ee {
|
|
|
2435
2440
|
});
|
|
2436
2441
|
}
|
|
2437
2442
|
update(e, t) {
|
|
2438
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2443
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Zt.DEG2RAD);
|
|
2439
2444
|
}
|
|
2440
2445
|
}
|
|
2441
|
-
const
|
|
2442
|
-
class
|
|
2446
|
+
const qe = new j(), $s = new ht(), Qe = new j(), I = new W(), Gs = new W();
|
|
2447
|
+
class Xs {
|
|
2443
2448
|
/**
|
|
2444
2449
|
* Constructs a new CSS3D renderer.
|
|
2445
2450
|
*
|
|
@@ -2466,21 +2471,21 @@ class Ks {
|
|
|
2466
2471
|
l.view && l.view.enabled ? (c.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, c.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : c.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2467
2472
|
let O, C;
|
|
2468
2473
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2469
|
-
const
|
|
2474
|
+
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2470
2475
|
n.camera.style !== R && (f.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2471
2476
|
}, this.setSize = function(y, l) {
|
|
2472
2477
|
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", c.style.width = y + "px", c.style.height = l + "px", f.style.width = y + "px", f.style.height = l + "px";
|
|
2473
2478
|
};
|
|
2474
|
-
function
|
|
2479
|
+
function p(y) {
|
|
2475
2480
|
return Math.abs(y) < 1e-10 ? 0 : y;
|
|
2476
2481
|
}
|
|
2477
2482
|
function v(y) {
|
|
2478
2483
|
const l = y.elements;
|
|
2479
|
-
return "matrix3d(" +
|
|
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]) + ")";
|
|
2480
2485
|
}
|
|
2481
|
-
function
|
|
2486
|
+
function m(y) {
|
|
2482
2487
|
const l = y.elements;
|
|
2483
|
-
return "translate(-50%,-50%)" + ("matrix3d(" +
|
|
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]) + ")");
|
|
2484
2489
|
}
|
|
2485
2490
|
function u(y) {
|
|
2486
2491
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
@@ -2493,27 +2498,27 @@ class Ks {
|
|
|
2493
2498
|
return;
|
|
2494
2499
|
}
|
|
2495
2500
|
if (y.isCSS3DObject) {
|
|
2496
|
-
const C = y.layers.test(_.layers) === !0,
|
|
2497
|
-
if (
|
|
2501
|
+
const C = y.layers.test(_.layers) === !0, w = y.element;
|
|
2502
|
+
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2498
2503
|
y.onBeforeRender(t, l, _);
|
|
2499
2504
|
let E;
|
|
2500
|
-
y.isCSS3DSprite ? (
|
|
2505
|
+
y.isCSS3DSprite ? (I.copy(_.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 = m(I)) : E = m(y.matrixWorld);
|
|
2501
2506
|
const x = n.objects.get(y);
|
|
2502
2507
|
if (x === void 0 || x.style !== E) {
|
|
2503
|
-
|
|
2508
|
+
w.style.transform = E;
|
|
2504
2509
|
const R = { style: E };
|
|
2505
2510
|
n.objects.set(y, R);
|
|
2506
2511
|
}
|
|
2507
|
-
|
|
2512
|
+
w.parentNode !== f && f.appendChild(w), y.onAfterRender(t, l, _);
|
|
2508
2513
|
}
|
|
2509
2514
|
}
|
|
2510
|
-
for (let C = 0,
|
|
2515
|
+
for (let C = 0, w = y.children.length; C < w; C++)
|
|
2511
2516
|
g(y.children[C], l, _);
|
|
2512
2517
|
}
|
|
2513
2518
|
}
|
|
2514
2519
|
}
|
|
2515
|
-
const q = new
|
|
2516
|
-
class
|
|
2520
|
+
const q = new j(), Je = new W(), et = new W(), tt = new j(), st = new j();
|
|
2521
|
+
class qs {
|
|
2517
2522
|
/**
|
|
2518
2523
|
* Constructs a new CSS2D renderer.
|
|
2519
2524
|
*
|
|
@@ -2531,7 +2536,7 @@ class $s {
|
|
|
2531
2536
|
height: i
|
|
2532
2537
|
};
|
|
2533
2538
|
}, this.render = function(u, g) {
|
|
2534
|
-
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(),
|
|
2539
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Je.copy(g.matrixWorldInverse), et.multiplyMatrices(g.projectionMatrix, Je), f(u, u, g), m(u);
|
|
2535
2540
|
}, this.setSize = function(u, g) {
|
|
2536
2541
|
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2537
2542
|
};
|
|
@@ -2546,19 +2551,19 @@ class $s {
|
|
|
2546
2551
|
return;
|
|
2547
2552
|
}
|
|
2548
2553
|
if (u.isCSS2DObject) {
|
|
2549
|
-
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(
|
|
2554
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(et);
|
|
2550
2555
|
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, _ = u.element;
|
|
2551
2556
|
_.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), _.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", _.parentNode !== a && a.appendChild(_), u.onAfterRender(t, g, y));
|
|
2552
2557
|
const O = {
|
|
2553
|
-
distanceToCameraSquared:
|
|
2558
|
+
distanceToCameraSquared: p(y, u)
|
|
2554
2559
|
};
|
|
2555
2560
|
n.objects.set(u, O);
|
|
2556
2561
|
}
|
|
2557
2562
|
for (let l = 0, _ = u.children.length; l < _; l++)
|
|
2558
2563
|
f(u.children[l], g, y);
|
|
2559
2564
|
}
|
|
2560
|
-
function
|
|
2561
|
-
return
|
|
2565
|
+
function p(u, g) {
|
|
2566
|
+
return tt.setFromMatrixPosition(u.matrixWorld), st.setFromMatrixPosition(g.matrixWorld), tt.distanceToSquared(st);
|
|
2562
2567
|
}
|
|
2563
2568
|
function v(u) {
|
|
2564
2569
|
const g = [];
|
|
@@ -2566,7 +2571,7 @@ class $s {
|
|
|
2566
2571
|
y.isCSS2DObject && g.push(y);
|
|
2567
2572
|
}), g;
|
|
2568
2573
|
}
|
|
2569
|
-
function
|
|
2574
|
+
function m(u) {
|
|
2570
2575
|
const g = v(u).sort(function(l, _) {
|
|
2571
2576
|
if (l.renderOrder !== _.renderOrder)
|
|
2572
2577
|
return _.renderOrder - l.renderOrder;
|
|
@@ -2578,15 +2583,15 @@ class $s {
|
|
|
2578
2583
|
}
|
|
2579
2584
|
}
|
|
2580
2585
|
}
|
|
2581
|
-
const
|
|
2586
|
+
const it = {
|
|
2582
2587
|
zIndex: "auto"
|
|
2583
2588
|
};
|
|
2584
|
-
class
|
|
2589
|
+
class Qs {
|
|
2585
2590
|
constructor(e) {
|
|
2586
2591
|
this.container = e;
|
|
2587
2592
|
}
|
|
2588
2593
|
addRenderer(e, t) {
|
|
2589
|
-
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new
|
|
2594
|
+
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new qs() : new Xs();
|
|
2590
2595
|
o.domElement.style.position = "absolute", o.domElement.style.top = "0", o.domElement.style.pointerEvents = "none", o.domElement.style.zIndex = t.zIndex, o.setSize(i, r), s.appendChild(o.domElement), e === "css2d" ? this.css2Drenderer = o : e === "css3d" && (this.css3Drenderer = o);
|
|
2591
2596
|
}
|
|
2592
2597
|
setSize(e, t) {
|
|
@@ -2602,7 +2607,7 @@ class Gs {
|
|
|
2602
2607
|
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
2603
2608
|
}
|
|
2604
2609
|
}
|
|
2605
|
-
class
|
|
2610
|
+
class Js {
|
|
2606
2611
|
constructor(e) {
|
|
2607
2612
|
this.helpers = {}, this.options = e;
|
|
2608
2613
|
}
|
|
@@ -2613,19 +2618,19 @@ class Xs {
|
|
|
2613
2618
|
if (e.isScene)
|
|
2614
2619
|
i = new De(100);
|
|
2615
2620
|
else if (e.isCamera)
|
|
2616
|
-
i = new
|
|
2621
|
+
i = new Gt(e);
|
|
2617
2622
|
else if (e.isPointLight)
|
|
2618
|
-
i = new
|
|
2623
|
+
i = new Xt(e, 1);
|
|
2619
2624
|
else if (e.isDirectionalLight)
|
|
2620
|
-
i = new
|
|
2625
|
+
i = new qt(e, 1);
|
|
2621
2626
|
else if (e.isSpotLight)
|
|
2622
|
-
i = new
|
|
2627
|
+
i = new Qt(e);
|
|
2623
2628
|
else if (e.isHemisphereLight)
|
|
2624
|
-
i = new
|
|
2629
|
+
i = new Jt(e, 10);
|
|
2625
2630
|
else if (e.isRectAreaLight)
|
|
2626
|
-
i = new
|
|
2631
|
+
i = new us(e);
|
|
2627
2632
|
else {
|
|
2628
|
-
const r = new
|
|
2633
|
+
const r = new ct();
|
|
2629
2634
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2630
2635
|
i = new Ue(r);
|
|
2631
2636
|
const o = i.material;
|
|
@@ -2637,7 +2642,7 @@ class Xs {
|
|
|
2637
2642
|
}
|
|
2638
2643
|
}
|
|
2639
2644
|
addViewHelper() {
|
|
2640
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2645
|
+
const { cameraController: e, container: t } = this.options, s = new fs(e.camera, t);
|
|
2641
2646
|
t.addEventListener("pointerdown", (i) => {
|
|
2642
2647
|
i.preventDefault(), s.handleClick(i);
|
|
2643
2648
|
}), this.viewHelper = s;
|
|
@@ -2687,7 +2692,7 @@ class Xs {
|
|
|
2687
2692
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2688
2693
|
}
|
|
2689
2694
|
}
|
|
2690
|
-
function
|
|
2695
|
+
function rt(h) {
|
|
2691
2696
|
let e = !1, t = [];
|
|
2692
2697
|
return function(...s) {
|
|
2693
2698
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
@@ -2695,7 +2700,7 @@ function it(h) {
|
|
|
2695
2700
|
}));
|
|
2696
2701
|
};
|
|
2697
2702
|
}
|
|
2698
|
-
class
|
|
2703
|
+
class ei {
|
|
2699
2704
|
constructor(e) {
|
|
2700
2705
|
var t;
|
|
2701
2706
|
this.enabled = !0, this.pickFunctionsMap = /* @__PURE__ */ new Map(), this.pickNodeFunctionsMap = /* @__PURE__ */ new Map(), this.pickFunctionsMapIndex = -1, this.pickNodeFunctionsMapIndex = -1, this.activeObjects = /* @__PURE__ */ new Set(), this.activeObject = null, this.prevActiveObjects = /* @__PURE__ */ new Set(), this.objCallbackMap = /* @__PURE__ */ new Map(), this.pickListener = {
|
|
@@ -2710,34 +2715,34 @@ class qs {
|
|
|
2710
2715
|
return;
|
|
2711
2716
|
r.preventDefault();
|
|
2712
2717
|
const o = e === "move" ? t : s, n = [];
|
|
2713
|
-
if (this.pickFunctionsMap.forEach((
|
|
2714
|
-
o.has(
|
|
2715
|
-
objArr:
|
|
2718
|
+
if (this.pickFunctionsMap.forEach((m) => {
|
|
2719
|
+
o.has(m.type) && n.push(te(U({}, m), {
|
|
2720
|
+
objArr: m.objArr instanceof Function ? m.objArr() : m.objArr
|
|
2716
2721
|
}));
|
|
2717
2722
|
}), n.length === 0) return;
|
|
2718
2723
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2719
2724
|
const a = this.objCallbackMap;
|
|
2720
|
-
for (const
|
|
2721
|
-
for (const u of
|
|
2725
|
+
for (const m of n)
|
|
2726
|
+
for (const u of m.objArr) {
|
|
2722
2727
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
2723
2728
|
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
2724
2729
|
const g = a.get(u);
|
|
2725
|
-
g.has(
|
|
2730
|
+
g.has(m.type) || g.set(m.type, []), g.get(m.type).push(m.cb);
|
|
2726
2731
|
}
|
|
2727
2732
|
if (a.size === 0) return;
|
|
2728
|
-
const c = [...a.keys()].map((
|
|
2733
|
+
const c = [...a.keys()].map((m) => m.object3d), f = (v = this.pencil.pick(r, c, !0)) == null ? void 0 : v.intersects;
|
|
2729
2734
|
if (!f || f.length === 0)
|
|
2730
2735
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2731
2736
|
else {
|
|
2732
|
-
const
|
|
2733
|
-
this.processIntersection(
|
|
2737
|
+
const m = f[0];
|
|
2738
|
+
this.processIntersection(m, r, e);
|
|
2734
2739
|
}
|
|
2735
|
-
const
|
|
2736
|
-
this.prevActiveObjects = this.activeObjects, this.activeObjects =
|
|
2740
|
+
const p = this.prevActiveObjects;
|
|
2741
|
+
this.prevActiveObjects = this.activeObjects, this.activeObjects = p, this.activeObjects.clear();
|
|
2737
2742
|
};
|
|
2738
2743
|
this.domElement.addEventListener(
|
|
2739
2744
|
`pointer${e}`,
|
|
2740
|
-
|
|
2745
|
+
rt(i),
|
|
2741
2746
|
{ passive: !1 }
|
|
2742
2747
|
);
|
|
2743
2748
|
}
|
|
@@ -2763,8 +2768,8 @@ class qs {
|
|
|
2763
2768
|
if (t === "move") {
|
|
2764
2769
|
const c = a.get("enter");
|
|
2765
2770
|
if (c && !this.prevActiveObjects.has(n))
|
|
2766
|
-
for (const
|
|
2767
|
-
|
|
2771
|
+
for (const p of c)
|
|
2772
|
+
p({
|
|
2768
2773
|
baseObject: n,
|
|
2769
2774
|
realBaseObject: this.activeObject,
|
|
2770
2775
|
mouseEvent: e,
|
|
@@ -2773,8 +2778,8 @@ class qs {
|
|
|
2773
2778
|
});
|
|
2774
2779
|
const f = a.get("move");
|
|
2775
2780
|
if (f)
|
|
2776
|
-
for (const
|
|
2777
|
-
|
|
2781
|
+
for (const p of f)
|
|
2782
|
+
p({
|
|
2778
2783
|
baseObject: n,
|
|
2779
2784
|
realBaseObject: this.activeObject,
|
|
2780
2785
|
mouseEvent: e,
|
|
@@ -2784,8 +2789,8 @@ class qs {
|
|
|
2784
2789
|
} else {
|
|
2785
2790
|
const c = a.get("down");
|
|
2786
2791
|
if (c)
|
|
2787
|
-
for (const
|
|
2788
|
-
|
|
2792
|
+
for (const p of c)
|
|
2793
|
+
p({
|
|
2789
2794
|
baseObject: n,
|
|
2790
2795
|
realBaseObject: this.activeObject,
|
|
2791
2796
|
mouseEvent: e,
|
|
@@ -2794,10 +2799,10 @@ class qs {
|
|
|
2794
2799
|
});
|
|
2795
2800
|
const f = a.get("click");
|
|
2796
2801
|
if (f) {
|
|
2797
|
-
const
|
|
2802
|
+
const p = (v) => {
|
|
2798
2803
|
v.preventDefault();
|
|
2799
|
-
const
|
|
2800
|
-
if (!r && Math.abs(v.clientX - e.clientX) <=
|
|
2804
|
+
const m = 5;
|
|
2805
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= m && Math.abs(v.clientY - e.clientY) <= m)
|
|
2801
2806
|
for (const u of f)
|
|
2802
2807
|
u({
|
|
2803
2808
|
baseObject: n,
|
|
@@ -2806,9 +2811,9 @@ class qs {
|
|
|
2806
2811
|
sp: o,
|
|
2807
2812
|
intersectionIndex: s
|
|
2808
2813
|
});
|
|
2809
|
-
this.domElement.removeEventListener("pointerup",
|
|
2814
|
+
this.domElement.removeEventListener("pointerup", p);
|
|
2810
2815
|
};
|
|
2811
|
-
this.domElement.addEventListener("pointerup",
|
|
2816
|
+
this.domElement.addEventListener("pointerup", p);
|
|
2812
2817
|
}
|
|
2813
2818
|
}
|
|
2814
2819
|
}
|
|
@@ -2856,13 +2861,13 @@ class qs {
|
|
|
2856
2861
|
for (const n of r) {
|
|
2857
2862
|
const a = n;
|
|
2858
2863
|
a.element.style.pointerEvents = "auto";
|
|
2859
|
-
const c = (
|
|
2860
|
-
this.enabled && (
|
|
2864
|
+
const c = (p) => {
|
|
2865
|
+
this.enabled && (p.preventDefault(), s({
|
|
2861
2866
|
baseObject: a,
|
|
2862
|
-
mouseEvent:
|
|
2867
|
+
mouseEvent: p
|
|
2863
2868
|
}));
|
|
2864
2869
|
}, f = `pointer${t}`;
|
|
2865
|
-
a.element.addEventListener(f,
|
|
2870
|
+
a.element.addEventListener(f, rt(c), !1), o.push({ arr: a, type: f, listener: c });
|
|
2866
2871
|
}
|
|
2867
2872
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2868
2873
|
}
|
|
@@ -2882,9 +2887,9 @@ class qs {
|
|
|
2882
2887
|
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
|
|
2883
2888
|
}
|
|
2884
2889
|
}
|
|
2885
|
-
class
|
|
2890
|
+
class ti extends ei {
|
|
2886
2891
|
constructor(e, t) {
|
|
2887
|
-
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new
|
|
2892
|
+
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new pt(), {
|
|
2888
2893
|
key: "@Scene",
|
|
2889
2894
|
name: "场景",
|
|
2890
2895
|
mList: !1
|
|
@@ -2906,12 +2911,12 @@ class Qs extends qs {
|
|
|
2906
2911
|
createBaseObject(e, t = {}) {
|
|
2907
2912
|
const s = U({
|
|
2908
2913
|
mList: !0
|
|
2909
|
-
}, t), i = new
|
|
2914
|
+
}, t), i = new ls();
|
|
2910
2915
|
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key)
|
|
2911
2916
|
i.key = s.key;
|
|
2912
2917
|
else if (s.target) {
|
|
2913
2918
|
const r = s.target.key;
|
|
2914
|
-
if (r === "@Scene" && e instanceof
|
|
2919
|
+
if (r === "@Scene" && e instanceof es)
|
|
2915
2920
|
i.key = "@Camera";
|
|
2916
2921
|
else {
|
|
2917
2922
|
const o = this.objectWrapChindIdMap.get(s.target) ? this.objectWrapChindIdMap.get(s.target) + 1 : 0;
|
|
@@ -2953,19 +2958,19 @@ class Qs extends qs {
|
|
|
2953
2958
|
const i = this.objectNamesToFactories.get(e);
|
|
2954
2959
|
if (i) {
|
|
2955
2960
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
2956
|
-
const c = t.target, f = (r = t.onTop) != null ? r : 0,
|
|
2961
|
+
const c = t.target, f = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, v = (n = t.create) != null ? n : !0, m = new i().create(t);
|
|
2957
2962
|
let u;
|
|
2958
|
-
return c === null ? u = null : typeof c == "string" ? u = this.objects.get(c) : (a = c == null ? void 0 : c.objectType) != null && a.startsWith("BaseObject") || c ? u = c :
|
|
2959
|
-
} : v !== !0 && (
|
|
2960
|
-
v(
|
|
2961
|
-
}),
|
|
2962
|
-
|
|
2963
|
+
return c === null ? u = null : typeof c == "string" ? u = this.objects.get(c) : (a = c == null ? void 0 : c.objectType) != null && a.startsWith("BaseObject") || c ? u = c : p ? u = this.prefabGroup : u = this.group, v === !1 ? m.create = () => {
|
|
2964
|
+
} : v !== !0 && (m.create = () => {
|
|
2965
|
+
v(m);
|
|
2966
|
+
}), m.pencil = this.pencil, m.lead = this, m.mList = this.mList, m.prefab = p, m.objectType = `BaseObject#${e}`, m.objectOptions = t, this.setBaseObjectKey(
|
|
2967
|
+
m,
|
|
2963
2968
|
t.key ? `$t:#${t.key}` : "$t:",
|
|
2964
2969
|
u == null ? void 0 : u.key
|
|
2965
2970
|
), this.objectsPm.set(
|
|
2966
|
-
|
|
2967
|
-
this.addBaseObject(
|
|
2968
|
-
), yield this.objectsPm.get(
|
|
2971
|
+
m,
|
|
2972
|
+
this.addBaseObject(m, u, f)
|
|
2973
|
+
), yield this.objectsPm.get(m), this.objectsPm.delete(m), m;
|
|
2969
2974
|
}
|
|
2970
2975
|
throw new Error(`Unrecognized:${e}`);
|
|
2971
2976
|
});
|
|
@@ -3045,7 +3050,7 @@ class Qs extends qs {
|
|
|
3045
3050
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectWrapChindIdMap.clear(), this.objectNamesToFactories.clear();
|
|
3046
3051
|
}
|
|
3047
3052
|
}
|
|
3048
|
-
class
|
|
3053
|
+
class si extends ee {
|
|
3049
3054
|
get lead() {
|
|
3050
3055
|
return this.controller;
|
|
3051
3056
|
}
|
|
@@ -3053,7 +3058,7 @@ class Js extends ee {
|
|
|
3053
3058
|
super(), this.options = e;
|
|
3054
3059
|
}
|
|
3055
3060
|
addLead(e, t, s) {
|
|
3056
|
-
const { pencil: i } = this.options, r = new
|
|
3061
|
+
const { pencil: i } = this.options, r = new ti(i, {
|
|
3057
3062
|
scene: e,
|
|
3058
3063
|
mList: t
|
|
3059
3064
|
});
|
|
@@ -3075,7 +3080,7 @@ class Js extends ee {
|
|
|
3075
3080
|
});
|
|
3076
3081
|
}
|
|
3077
3082
|
}
|
|
3078
|
-
class
|
|
3083
|
+
class ii extends mt {
|
|
3079
3084
|
constructor(e) {
|
|
3080
3085
|
super(e);
|
|
3081
3086
|
}
|
|
@@ -3085,10 +3090,10 @@ class ei extends mt {
|
|
|
3085
3090
|
e,
|
|
3086
3091
|
(o) => {
|
|
3087
3092
|
const n = o, a = new DecompressionStream("gzip"), c = n.stream().pipeThrough(a);
|
|
3088
|
-
new Response(c).json().then((
|
|
3089
|
-
t == null || t(
|
|
3090
|
-
}).catch((
|
|
3091
|
-
i == null || i(
|
|
3093
|
+
new Response(c).json().then((p) => {
|
|
3094
|
+
t == null || t(p);
|
|
3095
|
+
}).catch((p) => {
|
|
3096
|
+
i == null || i(p);
|
|
3092
3097
|
});
|
|
3093
3098
|
},
|
|
3094
3099
|
s,
|
|
@@ -3096,7 +3101,7 @@ class ei extends mt {
|
|
|
3096
3101
|
);
|
|
3097
3102
|
}
|
|
3098
3103
|
}
|
|
3099
|
-
class
|
|
3104
|
+
class ot extends mt {
|
|
3100
3105
|
constructor(e) {
|
|
3101
3106
|
super(e), this.options = { type: "image" };
|
|
3102
3107
|
}
|
|
@@ -3105,22 +3110,22 @@ class rt extends mt {
|
|
|
3105
3110
|
}
|
|
3106
3111
|
load(e, t, s, i) {
|
|
3107
3112
|
let r, o;
|
|
3108
|
-
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new
|
|
3113
|
+
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new ts(o)) : r = new fe();
|
|
3109
3114
|
const n = new Se(this.manager);
|
|
3110
3115
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3111
3116
|
e,
|
|
3112
3117
|
(a) => {
|
|
3113
3118
|
let c = a;
|
|
3114
|
-
const f = e.split(".").pop(),
|
|
3115
|
-
c = c.slice(0, a.size,
|
|
3119
|
+
const f = e.split(".").pop(), p = this.options.type === "image" ? `image/${f || "png"}` : `video/${f || "mp4"}`;
|
|
3120
|
+
c = c.slice(0, a.size, p);
|
|
3116
3121
|
const v = () => {
|
|
3117
|
-
o.removeEventListener("load",
|
|
3118
|
-
},
|
|
3122
|
+
o.removeEventListener("load", m, !1), o.removeEventListener("error", u, !1);
|
|
3123
|
+
}, m = () => {
|
|
3119
3124
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3120
3125
|
}, u = (y) => {
|
|
3121
3126
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3122
3127
|
};
|
|
3123
|
-
o.addEventListener("load",
|
|
3128
|
+
o.addEventListener("load", m, !1), o.addEventListener("error", u, !1);
|
|
3124
3129
|
const g = window.URL.createObjectURL(c);
|
|
3125
3130
|
o.src = g;
|
|
3126
3131
|
},
|
|
@@ -3129,7 +3134,7 @@ class rt extends mt {
|
|
|
3129
3134
|
), r;
|
|
3130
3135
|
}
|
|
3131
3136
|
}
|
|
3132
|
-
const
|
|
3137
|
+
const ri = {
|
|
3133
3138
|
images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
|
|
3134
3139
|
media: ["mp4", "webm", "ogg"],
|
|
3135
3140
|
gltf: ["gltf", "glb"],
|
|
@@ -3138,12 +3143,12 @@ const ti = {
|
|
|
3138
3143
|
exr: ["exr"],
|
|
3139
3144
|
lottie: ["lottie.json"]
|
|
3140
3145
|
};
|
|
3141
|
-
class
|
|
3146
|
+
class oi {
|
|
3142
3147
|
constructor(e) {
|
|
3143
3148
|
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
|
|
3144
3149
|
simpleTexture4deleted: !1,
|
|
3145
3150
|
prefix: ""
|
|
3146
|
-
}, e), this.loadingManager = new
|
|
3151
|
+
}, e), this.loadingManager = new ss(
|
|
3147
3152
|
() => {
|
|
3148
3153
|
},
|
|
3149
3154
|
(t, s, i) => {
|
|
@@ -3181,27 +3186,27 @@ class si {
|
|
|
3181
3186
|
if (e.endsWith("json.gzip"))
|
|
3182
3187
|
return "gzipJson";
|
|
3183
3188
|
} else return;
|
|
3184
|
-
for (const [i, r] of Object.entries(
|
|
3189
|
+
for (const [i, r] of Object.entries(ri))
|
|
3185
3190
|
if (r.includes(t))
|
|
3186
3191
|
return i;
|
|
3187
3192
|
}
|
|
3188
3193
|
getLoader(e, t) {
|
|
3189
3194
|
if (e === "images")
|
|
3190
|
-
return this.textureLoader || (this.textureLoader = new
|
|
3195
|
+
return this.textureLoader || (this.textureLoader = new ot(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
3191
3196
|
if (e === "media")
|
|
3192
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
3197
|
+
return this.videoTextureLoader || (this.videoTextureLoader = new ot(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3193
3198
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3194
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3199
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ie(this.loadingManager), this.dracoLoader = new gs(), this.dracoLoader.setDecoderPath(t == null ? void 0 : t.dracoPath), this.dracoGltfLoader.setDRACOLoader(this.dracoLoader), this.options.prefix && this.dracoGltfLoader.setPath(this.options.prefix)), this.dracoGltfLoader;
|
|
3195
3200
|
if (e === "gltf")
|
|
3196
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3201
|
+
return this.gltfLoader || (this.gltfLoader = new Ie(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3197
3202
|
if (e === "lottie")
|
|
3198
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
3203
|
+
return this.lottieLoader || (this.lottieLoader = new vs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3199
3204
|
if (e === "gzipJson")
|
|
3200
|
-
return this.gzipJsonLoader || (this.gzipJsonLoader = new
|
|
3205
|
+
return this.gzipJsonLoader || (this.gzipJsonLoader = new ii(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3201
3206
|
if (e === "json")
|
|
3202
3207
|
return this.jsonLoader || (this.jsonLoader = new Se(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3203
3208
|
if (e === "exr")
|
|
3204
|
-
return this.exrLoader || (this.exrLoader = new
|
|
3209
|
+
return this.exrLoader || (this.exrLoader = new ys(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3205
3210
|
}
|
|
3206
3211
|
add(e, t) {
|
|
3207
3212
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
@@ -3220,7 +3225,7 @@ class si {
|
|
|
3220
3225
|
get textureAssets() {
|
|
3221
3226
|
const e = /* @__PURE__ */ new Map();
|
|
3222
3227
|
return this.assets.forEach((t, s) => {
|
|
3223
|
-
(t instanceof fe || t instanceof
|
|
3228
|
+
(t instanceof fe || t instanceof is || t.isVideoTexture) && e.set(s, t);
|
|
3224
3229
|
}), e;
|
|
3225
3230
|
}
|
|
3226
3231
|
loadAll() {
|
|
@@ -3237,7 +3242,7 @@ class si {
|
|
|
3237
3242
|
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3238
3243
|
if (!s)
|
|
3239
3244
|
return;
|
|
3240
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3245
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = _s();
|
|
3241
3246
|
if (i) {
|
|
3242
3247
|
if (this.assets.has(e))
|
|
3243
3248
|
return this.assets.get(e);
|
|
@@ -3290,10 +3295,10 @@ class si {
|
|
|
3290
3295
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3291
3296
|
}
|
|
3292
3297
|
}
|
|
3293
|
-
const
|
|
3298
|
+
const ni = {
|
|
3294
3299
|
prefix: ""
|
|
3295
3300
|
};
|
|
3296
|
-
class
|
|
3301
|
+
class ai extends ee {
|
|
3297
3302
|
get loader() {
|
|
3298
3303
|
return this.controller;
|
|
3299
3304
|
}
|
|
@@ -3301,7 +3306,7 @@ class ri extends ee {
|
|
|
3301
3306
|
super(), this.options = e;
|
|
3302
3307
|
}
|
|
3303
3308
|
addLoader(e, t) {
|
|
3304
|
-
const { loaderParams: s } = this.options, i = new
|
|
3309
|
+
const { loaderParams: s } = this.options, i = new oi(te(U({}, s), {
|
|
3305
3310
|
scene: e
|
|
3306
3311
|
}));
|
|
3307
3312
|
return this.addController(i, t);
|
|
@@ -3312,7 +3317,7 @@ class ri extends ee {
|
|
|
3312
3317
|
});
|
|
3313
3318
|
}
|
|
3314
3319
|
}
|
|
3315
|
-
class
|
|
3320
|
+
class li {
|
|
3316
3321
|
constructor(e) {
|
|
3317
3322
|
this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
|
|
3318
3323
|
}
|
|
@@ -3419,10 +3424,10 @@ class oi {
|
|
|
3419
3424
|
const n = new Proxy(o, {
|
|
3420
3425
|
set: (a, c, f) => {
|
|
3421
3426
|
if (typeof c == "string" && !Number.isNaN(Number(c))) {
|
|
3422
|
-
const
|
|
3423
|
-
if (
|
|
3424
|
-
const v = a[
|
|
3425
|
-
return this.rmBaseObjectMap(e, v), a[
|
|
3427
|
+
const p = Number(c);
|
|
3428
|
+
if (p >= 0 && p < a.length) {
|
|
3429
|
+
const v = a[p];
|
|
3430
|
+
return this.rmBaseObjectMap(e, v), a[p] = f, f && (this.applyColorSpaceToMaterials(f), this.addBaseObjectMap(e)), !0;
|
|
3426
3431
|
}
|
|
3427
3432
|
}
|
|
3428
3433
|
return a[c] = f, !0;
|
|
@@ -3491,7 +3496,7 @@ class oi {
|
|
|
3491
3496
|
});
|
|
3492
3497
|
}
|
|
3493
3498
|
applyColorSpaceToMaterials(e) {
|
|
3494
|
-
|
|
3499
|
+
Cs({ material: e });
|
|
3495
3500
|
}
|
|
3496
3501
|
material2array(e) {
|
|
3497
3502
|
return Array.isArray(e) ? e : [e];
|
|
@@ -3539,7 +3544,7 @@ class oi {
|
|
|
3539
3544
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3540
3545
|
}
|
|
3541
3546
|
}
|
|
3542
|
-
class
|
|
3547
|
+
class hi extends ee {
|
|
3543
3548
|
get mList() {
|
|
3544
3549
|
return this.controller;
|
|
3545
3550
|
}
|
|
@@ -3547,7 +3552,7 @@ class ni extends ee {
|
|
|
3547
3552
|
super(), this.options = e;
|
|
3548
3553
|
}
|
|
3549
3554
|
addMList(e, t) {
|
|
3550
|
-
const { pencil: s } = this.options, i = new
|
|
3555
|
+
const { pencil: s } = this.options, i = new li(s);
|
|
3551
3556
|
return this.addController(i, t);
|
|
3552
3557
|
}
|
|
3553
3558
|
removePage(e) {
|
|
@@ -3556,19 +3561,19 @@ class ni extends ee {
|
|
|
3556
3561
|
});
|
|
3557
3562
|
}
|
|
3558
3563
|
}
|
|
3559
|
-
const
|
|
3564
|
+
const ci = {
|
|
3560
3565
|
antialias: !1,
|
|
3561
3566
|
devicePixelRatio: window.devicePixelRatio,
|
|
3562
3567
|
powerPreference: "high-performance",
|
|
3563
3568
|
toneMappingExposure: 1,
|
|
3564
3569
|
alpha: !1,
|
|
3565
|
-
outputColorSpace:
|
|
3570
|
+
outputColorSpace: Os.sRGB,
|
|
3566
3571
|
logarithmicDepthBuffer: !1,
|
|
3567
3572
|
preserveDrawingBuffer: !1,
|
|
3568
3573
|
stencil: !1,
|
|
3569
3574
|
depth: !1
|
|
3570
3575
|
};
|
|
3571
|
-
class
|
|
3576
|
+
class di {
|
|
3572
3577
|
constructor(e) {
|
|
3573
3578
|
this.options = e;
|
|
3574
3579
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
@@ -3578,17 +3583,17 @@ class li {
|
|
|
3578
3583
|
powerPreference: a,
|
|
3579
3584
|
toneMappingExposure: c,
|
|
3580
3585
|
outputColorSpace: f,
|
|
3581
|
-
logarithmicDepthBuffer:
|
|
3586
|
+
logarithmicDepthBuffer: p,
|
|
3582
3587
|
preserveDrawingBuffer: v,
|
|
3583
|
-
stencil:
|
|
3588
|
+
stencil: m,
|
|
3584
3589
|
depth: u
|
|
3585
|
-
} = i, g = new
|
|
3590
|
+
} = i, g = new rs({
|
|
3586
3591
|
alpha: r,
|
|
3587
3592
|
antialias: n,
|
|
3588
3593
|
powerPreference: a,
|
|
3589
|
-
logarithmicDepthBuffer:
|
|
3594
|
+
logarithmicDepthBuffer: p,
|
|
3590
3595
|
preserveDrawingBuffer: v,
|
|
3591
|
-
stencil:
|
|
3596
|
+
stencil: m,
|
|
3592
3597
|
depth: u
|
|
3593
3598
|
});
|
|
3594
3599
|
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = c, g.outputColorSpace = f, this.renderer = g;
|
|
@@ -3612,10 +3617,10 @@ class li {
|
|
|
3612
3617
|
this.setSize(0, 0), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose(), (s = this.renderer) == null || s.forceContextLoss();
|
|
3613
3618
|
}
|
|
3614
3619
|
}
|
|
3615
|
-
const
|
|
3620
|
+
const pi = {
|
|
3616
3621
|
background: null
|
|
3617
3622
|
};
|
|
3618
|
-
class
|
|
3623
|
+
class mi extends ee {
|
|
3619
3624
|
get scene() {
|
|
3620
3625
|
return this.controller;
|
|
3621
3626
|
}
|
|
@@ -3623,7 +3628,7 @@ class ci extends ee {
|
|
|
3623
3628
|
super(), this.options = e;
|
|
3624
3629
|
}
|
|
3625
3630
|
addScene(e, t) {
|
|
3626
|
-
const s = new
|
|
3631
|
+
const s = new pt();
|
|
3627
3632
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
3628
3633
|
}
|
|
3629
3634
|
removePage(e) {
|
|
@@ -3638,16 +3643,16 @@ class ci extends ee {
|
|
|
3638
3643
|
});
|
|
3639
3644
|
}
|
|
3640
3645
|
}
|
|
3641
|
-
class
|
|
3646
|
+
class ui {
|
|
3642
3647
|
constructor(e) {
|
|
3643
3648
|
this.event = new ye.EventEmitter();
|
|
3644
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
3649
|
+
const { renderer: t, scene: s, camera: i } = e, r = new Ts(
|
|
3645
3650
|
i,
|
|
3646
3651
|
t.domElement
|
|
3647
3652
|
);
|
|
3648
3653
|
if (r.getHelper) {
|
|
3649
3654
|
const o = r.getHelper();
|
|
3650
|
-
if (s.add(o), +
|
|
3655
|
+
if (s.add(o), +os < 170) {
|
|
3651
3656
|
const n = r._root;
|
|
3652
3657
|
n.dispose = () => {
|
|
3653
3658
|
n.traverse((a) => {
|
|
@@ -3657,7 +3662,7 @@ class di {
|
|
|
3657
3662
|
r.disconnect(), n.dispose();
|
|
3658
3663
|
};
|
|
3659
3664
|
}
|
|
3660
|
-
} else r instanceof
|
|
3665
|
+
} else r instanceof ns && s.add(r);
|
|
3661
3666
|
this.controls = r, this.addEvent();
|
|
3662
3667
|
}
|
|
3663
3668
|
get detach() {
|
|
@@ -3707,11 +3712,11 @@ class di {
|
|
|
3707
3712
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3708
3713
|
}
|
|
3709
3714
|
}
|
|
3710
|
-
const
|
|
3715
|
+
const fi = {
|
|
3711
3716
|
antialias: !0,
|
|
3712
3717
|
devicePixelRatio: window.devicePixelRatio
|
|
3713
3718
|
};
|
|
3714
|
-
class
|
|
3719
|
+
class _i {
|
|
3715
3720
|
constructor(e) {
|
|
3716
3721
|
this.options = e;
|
|
3717
3722
|
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
|
|
@@ -3730,107 +3735,11 @@ class pi {
|
|
|
3730
3735
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
3731
3736
|
}
|
|
3732
3737
|
}
|
|
3733
|
-
class ui {
|
|
3734
|
-
/**
|
|
3735
|
-
* Constructs a new timer.
|
|
3736
|
-
*/
|
|
3737
|
-
constructor() {
|
|
3738
|
-
this._previousTime = 0, this._currentTime = 0, this._startTime = performance.now(), this._delta = 0, this._elapsed = 0, this._timescale = 1, this._document = null, this._pageVisibilityHandler = null;
|
|
3739
|
-
}
|
|
3740
|
-
/**
|
|
3741
|
-
* Connect the timer to the given document.Calling this method is not mandatory to
|
|
3742
|
-
* use the timer but enables the usage of the Page Visibility API to avoid large time
|
|
3743
|
-
* delta values.
|
|
3744
|
-
*
|
|
3745
|
-
* @param {Document} document - The document.
|
|
3746
|
-
*/
|
|
3747
|
-
connect(e) {
|
|
3748
|
-
this._document = e, e.hidden !== void 0 && (this._pageVisibilityHandler = fi.bind(this), e.addEventListener(
|
|
3749
|
-
"visibilitychange",
|
|
3750
|
-
this._pageVisibilityHandler,
|
|
3751
|
-
!1
|
|
3752
|
-
));
|
|
3753
|
-
}
|
|
3754
|
-
/**
|
|
3755
|
-
* Disconnects the timer from the DOM and also disables the usage of the Page Visibility API.
|
|
3756
|
-
*/
|
|
3757
|
-
disconnect() {
|
|
3758
|
-
this._pageVisibilityHandler !== null && (this._document.removeEventListener(
|
|
3759
|
-
"visibilitychange",
|
|
3760
|
-
this._pageVisibilityHandler
|
|
3761
|
-
), this._pageVisibilityHandler = null), this._document = null;
|
|
3762
|
-
}
|
|
3763
|
-
/**
|
|
3764
|
-
* Returns the time delta in seconds.
|
|
3765
|
-
*
|
|
3766
|
-
* @return {number} The time delta in second.
|
|
3767
|
-
*/
|
|
3768
|
-
getDelta() {
|
|
3769
|
-
return this._delta / 1e3;
|
|
3770
|
-
}
|
|
3771
|
-
/**
|
|
3772
|
-
* Returns the elapsed time in seconds.
|
|
3773
|
-
*
|
|
3774
|
-
* @return {number} The elapsed time in second.
|
|
3775
|
-
*/
|
|
3776
|
-
getElapsed() {
|
|
3777
|
-
return this._elapsed / 1e3;
|
|
3778
|
-
}
|
|
3779
|
-
/**
|
|
3780
|
-
* Returns the timescale.
|
|
3781
|
-
*
|
|
3782
|
-
* @return {number} The timescale.
|
|
3783
|
-
*/
|
|
3784
|
-
getTimescale() {
|
|
3785
|
-
return this._timescale;
|
|
3786
|
-
}
|
|
3787
|
-
/**
|
|
3788
|
-
* Sets the given timescale which scale the time delta computation
|
|
3789
|
-
* in `update()`.
|
|
3790
|
-
*
|
|
3791
|
-
* @param {number} timescale - The timescale to set.
|
|
3792
|
-
* @return {Timer} A reference to this timer.
|
|
3793
|
-
*/
|
|
3794
|
-
setTimescale(e) {
|
|
3795
|
-
return this._timescale = e, this;
|
|
3796
|
-
}
|
|
3797
|
-
/**
|
|
3798
|
-
* Resets the time computation for the current simulation step.
|
|
3799
|
-
*
|
|
3800
|
-
* @return {Timer} A reference to this timer.
|
|
3801
|
-
*/
|
|
3802
|
-
reset() {
|
|
3803
|
-
return this._currentTime = performance.now() - this._startTime, this;
|
|
3804
|
-
}
|
|
3805
|
-
/**
|
|
3806
|
-
* Can be used to free all internal resources. Usually called when
|
|
3807
|
-
* the timer instance isn't required anymore.
|
|
3808
|
-
*/
|
|
3809
|
-
dispose() {
|
|
3810
|
-
this.disconnect();
|
|
3811
|
-
}
|
|
3812
|
-
/**
|
|
3813
|
-
* Updates the internal state of the timer. This method should be called
|
|
3814
|
-
* once per simulation step and before you perform queries against the timer
|
|
3815
|
-
* (e.g. via `getDelta()`).
|
|
3816
|
-
*
|
|
3817
|
-
* @param {number} timestamp - The current time in milliseconds. Can be obtained
|
|
3818
|
-
* from the `requestAnimationFrame` callback argument. If not provided, the current
|
|
3819
|
-
* time will be determined with `performance.now`.
|
|
3820
|
-
* @return {Timer} A reference to this timer.
|
|
3821
|
-
*/
|
|
3822
|
-
update(e) {
|
|
3823
|
-
return this._pageVisibilityHandler !== null && this._document.hidden === !0 ? this._delta = 0 : (this._previousTime = this._currentTime, this._currentTime = (e !== void 0 ? e : performance.now()) - this._startTime, this._delta = (this._currentTime - this._previousTime) * this._timescale, this._elapsed += this._delta), this;
|
|
3824
|
-
}
|
|
3825
|
-
}
|
|
3826
|
-
function fi() {
|
|
3827
|
-
this._document.hidden === !1 && this.reset();
|
|
3828
|
-
}
|
|
3829
3738
|
const _e = class _e {
|
|
3830
3739
|
constructor(e) {
|
|
3831
3740
|
var r, o;
|
|
3832
|
-
this.raycaster = new
|
|
3833
|
-
isMergeableObject:
|
|
3741
|
+
this.raycaster = new dt(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new j(), this._cameraTarget = new j(), this.event = new ye.EventEmitter(), this.timer = new as(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this._isDispose = !1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = Ut(_e.options, e, {
|
|
3742
|
+
isMergeableObject: Es
|
|
3834
3743
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3835
3744
|
const {
|
|
3836
3745
|
container: t,
|
|
@@ -3838,7 +3747,7 @@ const _e = class _e {
|
|
|
3838
3747
|
transformControls: i
|
|
3839
3748
|
} = this.options;
|
|
3840
3749
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3841
|
-
const n = new
|
|
3750
|
+
const n = new zt({
|
|
3842
3751
|
horizontal: !1
|
|
3843
3752
|
});
|
|
3844
3753
|
n.dom.style.position = "absolute", n.init(this.renderer), t.appendChild(n.dom), this.stats = n;
|
|
@@ -3915,13 +3824,13 @@ const _e = class _e {
|
|
|
3915
3824
|
renderer: r,
|
|
3916
3825
|
controls: o,
|
|
3917
3826
|
loader: n
|
|
3918
|
-
} = this.options, { width: a, height: c } = this.getSize(), f = t ? new
|
|
3827
|
+
} = this.options, { width: a, height: c } = this.getSize(), f = t ? new _i({
|
|
3919
3828
|
width: a,
|
|
3920
3829
|
height: c,
|
|
3921
3830
|
//@ts-ignore
|
|
3922
3831
|
renderer: this.options.WebGPURenderer,
|
|
3923
|
-
rendererParams:
|
|
3924
|
-
}) : new
|
|
3832
|
+
rendererParams: fi
|
|
3833
|
+
}) : new di({
|
|
3925
3834
|
width: a,
|
|
3926
3835
|
height: c,
|
|
3927
3836
|
rendererParams: te(U({}, r), {
|
|
@@ -3929,32 +3838,32 @@ const _e = class _e {
|
|
|
3929
3838
|
})
|
|
3930
3839
|
});
|
|
3931
3840
|
this.rendererController = f;
|
|
3932
|
-
const
|
|
3841
|
+
const p = new Ds({
|
|
3933
3842
|
width: a,
|
|
3934
3843
|
height: c
|
|
3935
|
-
}), v = new
|
|
3844
|
+
}), v = new mi({}), m = new Ks({
|
|
3936
3845
|
controlsParams: {
|
|
3937
3846
|
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : f.renderer.domElement
|
|
3938
3847
|
}
|
|
3939
|
-
}), u = new
|
|
3848
|
+
}), u = new ai({
|
|
3940
3849
|
loaderParams: U({
|
|
3941
3850
|
anisotropy: this.maxAnisotropy
|
|
3942
3851
|
}, n)
|
|
3943
|
-
}), g = new
|
|
3852
|
+
}), g = new hi({
|
|
3944
3853
|
pencil: this
|
|
3945
|
-
}), y = new
|
|
3854
|
+
}), y = new si({
|
|
3946
3855
|
pencil: this
|
|
3947
3856
|
});
|
|
3948
|
-
this.sceneController = v, this.cameraController =
|
|
3857
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = m, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3949
3858
|
const l = this.addPage({
|
|
3950
3859
|
sceneOptions: this.options.scene,
|
|
3951
3860
|
cameraOptions: this.options.camera
|
|
3952
3861
|
});
|
|
3953
3862
|
if (this.showPage(l), s) {
|
|
3954
|
-
const O = new
|
|
3863
|
+
const O = new Js({
|
|
3955
3864
|
container: e,
|
|
3956
3865
|
sceneController: v,
|
|
3957
|
-
cameraController:
|
|
3866
|
+
cameraController: p
|
|
3958
3867
|
});
|
|
3959
3868
|
O.add(v.scene), this.helperController = O, i && O.addViewHelper();
|
|
3960
3869
|
}
|
|
@@ -3967,7 +3876,7 @@ const _e = class _e {
|
|
|
3967
3876
|
ssao: s,
|
|
3968
3877
|
ssaoParams: i,
|
|
3969
3878
|
composer: r
|
|
3970
|
-
} = this.options, o = new
|
|
3879
|
+
} = this.options, o = new Ws({
|
|
3971
3880
|
rendererController: this.rendererController,
|
|
3972
3881
|
sceneController: this.sceneController,
|
|
3973
3882
|
cameraController: this.cameraController,
|
|
@@ -3984,12 +3893,12 @@ const _e = class _e {
|
|
|
3984
3893
|
css3DRendererParams: r
|
|
3985
3894
|
} = this.options;
|
|
3986
3895
|
if (t || s) {
|
|
3987
|
-
const o = new
|
|
3896
|
+
const o = new Qs(e);
|
|
3988
3897
|
t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
|
|
3989
3898
|
}
|
|
3990
3899
|
}
|
|
3991
3900
|
initTransformControls() {
|
|
3992
|
-
const e = new
|
|
3901
|
+
const e = new ui({
|
|
3993
3902
|
camera: this.camera,
|
|
3994
3903
|
renderer: this.renderer,
|
|
3995
3904
|
scene: this.scene
|
|
@@ -4029,8 +3938,8 @@ const _e = class _e {
|
|
|
4029
3938
|
leadController: a
|
|
4030
3939
|
} = this, c = this.renderer.getSize(new B());
|
|
4031
3940
|
c.x === e && c.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t), a.setSize(e, t), this.installPlugins.forEach((f) => {
|
|
4032
|
-
var
|
|
4033
|
-
(
|
|
3941
|
+
var p;
|
|
3942
|
+
(p = f.setSize) == null || p.call(f, e, t);
|
|
4034
3943
|
}), this.viewPadding.some((f) => f !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
4035
3944
|
}
|
|
4036
3945
|
setDevicePixelRatio(e) {
|
|
@@ -4127,11 +4036,11 @@ const _e = class _e {
|
|
|
4127
4036
|
}
|
|
4128
4037
|
}
|
|
4129
4038
|
dispose() {
|
|
4130
|
-
var e, t, s, i, r, o, n, a, c, f,
|
|
4039
|
+
var e, t, s, i, r, o, n, a, c, f, p, v, m, u;
|
|
4131
4040
|
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) => {
|
|
4132
4041
|
var y;
|
|
4133
4042
|
(y = g.dispose) == null || y.call(g);
|
|
4134
|
-
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (c = this.rendererController) == null || c.dispose(), (f = this.loaderController) == null || f.dispose(), (
|
|
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(), (c = this.rendererController) == null || c.dispose(), (f = this.loaderController) == null || f.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (m = this.stats) == null || m.dom.remove(), (u = this.renderer) == null || u.domElement.remove(), this._isDispose = !0;
|
|
4135
4044
|
}
|
|
4136
4045
|
};
|
|
4137
4046
|
_e.options = {
|
|
@@ -4140,26 +4049,26 @@ _e.options = {
|
|
|
4140
4049
|
viewHelper: he,
|
|
4141
4050
|
controls: !0,
|
|
4142
4051
|
transformControls: he,
|
|
4143
|
-
renderer:
|
|
4144
|
-
composer:
|
|
4145
|
-
scene:
|
|
4146
|
-
camera:
|
|
4052
|
+
renderer: ci,
|
|
4053
|
+
composer: Zs,
|
|
4054
|
+
scene: pi,
|
|
4055
|
+
camera: wt,
|
|
4147
4056
|
bloom: !1,
|
|
4148
|
-
bloomParams:
|
|
4057
|
+
bloomParams: Ys,
|
|
4149
4058
|
ssao: !1,
|
|
4150
|
-
loader:
|
|
4151
|
-
ssaoParams:
|
|
4059
|
+
loader: ni,
|
|
4060
|
+
ssaoParams: Vs,
|
|
4152
4061
|
css2DRenderer: !1,
|
|
4153
|
-
css2DRendererParams: U({},
|
|
4062
|
+
css2DRendererParams: U({}, it),
|
|
4154
4063
|
css3DRenderer: !1,
|
|
4155
|
-
css3DRendererParams: U({},
|
|
4064
|
+
css3DRendererParams: U({}, it)
|
|
4156
4065
|
};
|
|
4157
|
-
let
|
|
4158
|
-
const
|
|
4066
|
+
let nt = _e;
|
|
4067
|
+
const Xi = J.ACTION;
|
|
4159
4068
|
export {
|
|
4160
|
-
|
|
4161
|
-
|
|
4069
|
+
ls as BaseObject,
|
|
4070
|
+
nt as Pencil,
|
|
4162
4071
|
Pe as ResourceTracker,
|
|
4163
|
-
|
|
4164
|
-
|
|
4072
|
+
Xi as cameraControlsAction,
|
|
4073
|
+
nt as default
|
|
4165
4074
|
};
|