gl-draw 0.15.21 → 0.15.23
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 +12 -11
- package/dist/WebGPULineSegments2.module.js +173 -166
- package/dist/core/Pencil.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.module.js +427 -332
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +2 -0
- package/dist/objects/line/meshLine/fragment.d.ts +1 -1
- package/dist/objects/line/meshLine/vertex.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +10 -10
- package/dist/utils/Timer.d.ts +72 -0
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -29,13 +29,12 @@ var se = (h, e, t) => new Promise((s, i) => {
|
|
|
29
29
|
import * as Ce from "@tweenjs/tween.js";
|
|
30
30
|
import Ut from "deepmerge";
|
|
31
31
|
import zt from "stats-gl";
|
|
32
|
-
import { Vector3 as
|
|
33
|
-
import {
|
|
34
|
-
import { M as ft, B as Oe, a as ns, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
|
|
32
|
+
import { Vector3 as I, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as Ft, UniformsUtils as Nt, RawShaderMaterial as Ht, MeshBasicMaterial as It, PointsMaterial as nt, SpriteMaterial as at, Layers as jt, Vector2 as B, WebGLRenderTarget as Bt, HalfFloatType as Vt, MathUtils as Yt, Vector4 as Zt, Quaternion as lt, Spherical as Wt, Box3 as ht, Sphere as Kt, Raycaster as ct, AxesHelper as De, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as Ue, Scene as dt, Group as ze, Camera as Jt, Loader as mt, Texture as fe, VideoTexture as pt, FileLoader as Ae, LoadingManager as es, DataTexture as ts, WebGLRenderer as ss, REVISION as is, Object3D as rs } from "three";
|
|
33
|
+
import { M as ut, B as Oe, a as os, R as Pe, I as he } from "./WebGPULineSegments2.module.js";
|
|
35
34
|
import { EffectComposer as ke } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
36
|
-
import { RenderPass as
|
|
37
|
-
import { SSAOPass as
|
|
38
|
-
import { UnrealBloomPass as
|
|
35
|
+
import { RenderPass as ns } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
|
+
import { SSAOPass as as } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
|
+
import { UnrealBloomPass as ls } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
39
38
|
import "three/examples/jsm/lines/LineMaterial";
|
|
40
39
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
41
40
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
@@ -46,18 +45,18 @@ import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
|
46
45
|
import "three-bvh-csg";
|
|
47
46
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
48
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
49
|
-
import { ShaderPass as
|
|
48
|
+
import { ShaderPass as hs } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
50
49
|
import { FullScreenQuad as Fe } from "three/examples/jsm/postprocessing/Pass";
|
|
51
|
-
import { OutputPass as
|
|
52
|
-
import { RectAreaLightHelper as
|
|
53
|
-
import { ViewHelper as
|
|
54
|
-
import { generateUUID as Ne, makePromiseCreator as
|
|
55
|
-
import { GLTFLoader as
|
|
50
|
+
import { OutputPass as cs } from "three/examples/jsm/postprocessing/OutputPass";
|
|
51
|
+
import { RectAreaLightHelper as ds } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
|
+
import { ViewHelper as ms } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
|
+
import { generateUUID as Ne, makePromiseCreator as ps } from "esus-lite";
|
|
54
|
+
import { GLTFLoader as He } from "three/examples/jsm/loaders/GLTFLoader";
|
|
56
55
|
import { DRACOLoader as us } from "three/examples/jsm/loaders/DRACOLoader";
|
|
57
|
-
import { EXRLoader as
|
|
58
|
-
import { LottieLoader as
|
|
59
|
-
import { c as
|
|
60
|
-
import { TransformControls as
|
|
56
|
+
import { EXRLoader as fs } from "three/examples/jsm/loaders/EXRLoader";
|
|
57
|
+
import { LottieLoader as _s } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
|
+
import { c as gs, C as ys, i as vs } from "./isPlainObject.module.js";
|
|
59
|
+
import { TransformControls as Cs } from "three/examples/jsm/controls/TransformControls";
|
|
61
60
|
const M = {
|
|
62
61
|
LEFT: 1,
|
|
63
62
|
RIGHT: 2,
|
|
@@ -92,20 +91,20 @@ const M = {
|
|
|
92
91
|
function Y(h) {
|
|
93
92
|
return h.isPerspectiveCamera;
|
|
94
93
|
}
|
|
95
|
-
function
|
|
94
|
+
function j(h) {
|
|
96
95
|
return h.isOrthographicCamera;
|
|
97
96
|
}
|
|
98
|
-
const $ = Math.PI * 2,
|
|
97
|
+
const $ = Math.PI * 2, Ie = Math.PI / 2, ft = 1e-5, ie = Math.PI / 180;
|
|
99
98
|
function k(h, e, t) {
|
|
100
99
|
return Math.max(e, Math.min(t, h));
|
|
101
100
|
}
|
|
102
|
-
function S(h, e =
|
|
101
|
+
function S(h, e = ft) {
|
|
103
102
|
return Math.abs(h) < e;
|
|
104
103
|
}
|
|
105
|
-
function P(h, e, t =
|
|
104
|
+
function P(h, e, t = ft) {
|
|
106
105
|
return S(h - e, t);
|
|
107
106
|
}
|
|
108
|
-
function
|
|
107
|
+
function je(h, e) {
|
|
109
108
|
return Math.round(h / e) * e;
|
|
110
109
|
}
|
|
111
110
|
function re(h) {
|
|
@@ -118,27 +117,27 @@ function ce(h, e, t, s, i = 1 / 0, r) {
|
|
|
118
117
|
s = Math.max(1e-4, s);
|
|
119
118
|
const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
120
119
|
let c = h - e;
|
|
121
|
-
const
|
|
120
|
+
const f = e, m = i * s;
|
|
122
121
|
c = k(c, -m, m), e = h - c;
|
|
123
122
|
const v = (t.value + o * c) * r;
|
|
124
123
|
t.value = (t.value - o * v) * a;
|
|
125
124
|
let p = e + (c + v) * a;
|
|
126
|
-
return
|
|
125
|
+
return f - h > 0 == p > f && (p = f, t.value = (p - f) / r), p;
|
|
127
126
|
}
|
|
128
127
|
function Be(h, e, t, s, i = 1 / 0, r, o) {
|
|
129
128
|
s = Math.max(1e-4, s);
|
|
130
129
|
const n = 2 / s, a = n * r, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
131
|
-
let
|
|
132
|
-
const y =
|
|
133
|
-
if (
|
|
134
|
-
const ve = Math.sqrt(
|
|
135
|
-
p = p / ve * O,
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const E = (t.x + n * p) * r, x = (t.y + n *
|
|
139
|
-
t.x = (t.x - n * E) * c, t.y = (t.y - n * x) * c, t.z = (t.z - n * R) * c, o.x =
|
|
140
|
-
const V = y - h.x, le = l - h.y,
|
|
141
|
-
return V * xt + le * Lt +
|
|
130
|
+
let f = e.x, m = e.y, v = e.z, p = h.x - f, u = h.y - m, g = h.z - v;
|
|
131
|
+
const y = f, l = m, _ = v, O = i * s, C = O * O, b = p * p + u * u + g * g;
|
|
132
|
+
if (b > C) {
|
|
133
|
+
const ve = Math.sqrt(b);
|
|
134
|
+
p = p / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
|
+
}
|
|
136
|
+
f = h.x - p, m = h.y - u, v = h.z - g;
|
|
137
|
+
const E = (t.x + n * p) * 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 + (p + E) * c, o.y = m + (u + x) * c, o.z = v + (g + R) * c;
|
|
139
|
+
const V = y - h.x, le = l - h.y, wt = _ - h.z, xt = o.x - y, Lt = o.y - l, Pt = o.z - _;
|
|
140
|
+
return V * xt + le * Lt + wt * Pt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
142
141
|
}
|
|
143
142
|
function Ee(h, e) {
|
|
144
143
|
e.set(0, 0), h.forEach((t) => {
|
|
@@ -146,9 +145,9 @@ function Ee(h, e) {
|
|
|
146
145
|
}), e.x /= h.length, e.y /= h.length;
|
|
147
146
|
}
|
|
148
147
|
function Te(h, e) {
|
|
149
|
-
return
|
|
148
|
+
return j(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
150
149
|
}
|
|
151
|
-
class
|
|
150
|
+
class Os {
|
|
152
151
|
constructor() {
|
|
153
152
|
this._listeners = {};
|
|
154
153
|
}
|
|
@@ -212,11 +211,11 @@ class Es {
|
|
|
212
211
|
}
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
|
-
const de = 1 / 8,
|
|
216
|
-
let T, Ve, me,
|
|
217
|
-
class J extends
|
|
214
|
+
const de = 1 / 8, Es = /Mac/.test(navigator.platform);
|
|
215
|
+
let T, Ve, me, be, D, w, L, G, ne, F, N, Z, Ye, Ze, z, ae, X, We, we, Ke, xe, Le, pe;
|
|
216
|
+
class J extends Os {
|
|
218
217
|
static install(e) {
|
|
219
|
-
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), me = Object.freeze(new T.Vector3(0, 1, 0)),
|
|
218
|
+
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), me = Object.freeze(new T.Vector3(0, 1, 0)), be = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), w = 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(), we = new T.Sphere(), Ke = new T.Quaternion(), xe = new T.Quaternion(), Le = new T.Matrix4(), pe = new T.Raycaster();
|
|
220
219
|
}
|
|
221
220
|
/**
|
|
222
221
|
* list all ACTIONs
|
|
@@ -245,46 +244,46 @@ class J extends Es {
|
|
|
245
244
|
constructor(e, t) {
|
|
246
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 = () => {
|
|
247
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) => {
|
|
248
|
-
let
|
|
247
|
+
let b, E;
|
|
249
248
|
if (Y(this._camera)) {
|
|
250
|
-
const x =
|
|
251
|
-
|
|
252
|
-
} else if (
|
|
249
|
+
const x = w.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(R * 0.5);
|
|
250
|
+
b = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * _ * V / this._elementRect.height;
|
|
251
|
+
} else if (j(this._camera)) {
|
|
253
252
|
const x = this._camera;
|
|
254
|
-
|
|
253
|
+
b = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * _ * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
255
254
|
} else
|
|
256
255
|
return;
|
|
257
256
|
C ? (O ? this.setFocalOffset(
|
|
258
|
-
this._focalOffsetEnd.x +
|
|
257
|
+
this._focalOffsetEnd.x + b,
|
|
259
258
|
this._focalOffsetEnd.y,
|
|
260
259
|
this._focalOffsetEnd.z,
|
|
261
260
|
!0
|
|
262
|
-
) : this.truck(
|
|
263
|
-
this._focalOffsetEnd.x +
|
|
261
|
+
) : this.truck(b, 0, !0), this.forward(-E, !0)) : O ? this.setFocalOffset(
|
|
262
|
+
this._focalOffsetEnd.x + b,
|
|
264
263
|
this._focalOffsetEnd.y + E,
|
|
265
264
|
this._focalOffsetEnd.z,
|
|
266
265
|
!0
|
|
267
|
-
) : this.truck(
|
|
266
|
+
) : this.truck(b, E, !0);
|
|
268
267
|
}, this._rotateInternal = (l, _) => {
|
|
269
268
|
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
270
269
|
this.rotate(O, C, !0);
|
|
271
270
|
}, this._dollyInternal = (l, _, O) => {
|
|
272
|
-
const C = Math.pow(0.95, -l * this.dollySpeed),
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), b = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, x = k(
|
|
273
272
|
E,
|
|
274
273
|
this.minDistance,
|
|
275
274
|
this.maxDistance
|
|
276
275
|
), R = x - E;
|
|
277
|
-
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) - b, this._dollyControlCoord.set(_, O)), this._lastDollyDirection = Math.sign(-l);
|
|
278
277
|
}, this._zoomInternal = (l, _, O) => {
|
|
279
|
-
const C = Math.pow(0.95, l * this.dollySpeed),
|
|
280
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E -
|
|
278
|
+
const C = Math.pow(0.95, l * this.dollySpeed), b = this._zoom, E = this._zoom * C;
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - b, this._dollyControlCoord.set(_, O));
|
|
281
280
|
}, typeof T == "undefined" && console.error(
|
|
282
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
283
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
284
283
|
this._camera.up,
|
|
285
284
|
me
|
|
286
285
|
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
287
|
-
|
|
286
|
+
w.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
288
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 = [
|
|
289
288
|
new T.Vector3(),
|
|
290
289
|
new T.Vector3(),
|
|
@@ -297,17 +296,17 @@ class J extends Es {
|
|
|
297
296
|
left: d.ROTATE,
|
|
298
297
|
middle: d.DOLLY,
|
|
299
298
|
right: d.TRUCK,
|
|
300
|
-
wheel: Y(this._camera) ? d.DOLLY :
|
|
299
|
+
wheel: Y(this._camera) ? d.DOLLY : j(this._camera) ? d.ZOOM : d.NONE
|
|
301
300
|
}, this.touches = {
|
|
302
301
|
one: d.TOUCH_ROTATE,
|
|
303
|
-
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK :
|
|
302
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : j(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
304
303
|
three: d.TOUCH_TRUCK
|
|
305
304
|
};
|
|
306
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
307
306
|
if (!this._enabled || !this._domElement) return;
|
|
308
307
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
309
|
-
const C = this._domElement.getBoundingClientRect(),
|
|
310
|
-
if (
|
|
308
|
+
const C = this._domElement.getBoundingClientRect(), b = (l.clientX - C.left) / (C.right - C.left), E = (l.clientY - C.top) / (C.bottom - C.top);
|
|
309
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
311
310
|
return;
|
|
312
311
|
}
|
|
313
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;
|
|
@@ -377,11 +376,11 @@ class J extends Es {
|
|
|
377
376
|
}
|
|
378
377
|
else
|
|
379
378
|
this._state = d.NONE;
|
|
380
|
-
|
|
379
|
+
u();
|
|
381
380
|
}
|
|
382
381
|
};
|
|
383
382
|
let c = -1;
|
|
384
|
-
const
|
|
383
|
+
const f = (l) => {
|
|
385
384
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
386
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
387
386
|
const E = this._domElement.getBoundingClientRect(), x = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
@@ -392,7 +391,7 @@ class J extends Es {
|
|
|
392
391
|
const E = performance.now();
|
|
393
392
|
c - E < 1e3 && this._getClientRect(this._elementRect), c = E;
|
|
394
393
|
}
|
|
395
|
-
const _ =
|
|
394
|
+
const _ = Es ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, b = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
396
395
|
switch (this.mouseButtons.wheel) {
|
|
397
396
|
case d.ROTATE: {
|
|
398
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -411,11 +410,11 @@ class J extends Es {
|
|
|
411
410
|
break;
|
|
412
411
|
}
|
|
413
412
|
case d.DOLLY: {
|
|
414
|
-
this._dollyInternal(-O, C,
|
|
413
|
+
this._dollyInternal(-O, C, b), this._isUserControllingDolly = !0;
|
|
415
414
|
break;
|
|
416
415
|
}
|
|
417
416
|
case d.ZOOM: {
|
|
418
|
-
this._zoomInternal(-O, C,
|
|
417
|
+
this._zoomInternal(-O, C, b), this._isUserControllingZoom = !0;
|
|
419
418
|
break;
|
|
420
419
|
}
|
|
421
420
|
}
|
|
@@ -439,8 +438,8 @@ class J extends Es {
|
|
|
439
438
|
}, v = (l) => {
|
|
440
439
|
if (!this._enabled) return;
|
|
441
440
|
if (Ee(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
442
|
-
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY,
|
|
443
|
-
r.set(0,
|
|
441
|
+
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, b = Math.sqrt(O * O + C * C);
|
|
442
|
+
r.set(0, b);
|
|
444
443
|
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
445
444
|
i.set(E, x);
|
|
446
445
|
}
|
|
@@ -466,25 +465,25 @@ class J extends Es {
|
|
|
466
465
|
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
467
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;
|
|
468
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) {
|
|
469
|
-
const
|
|
468
|
+
const b = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
|
|
470
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
471
470
|
x * C * de,
|
|
472
|
-
|
|
471
|
+
b,
|
|
473
472
|
E
|
|
474
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
475
474
|
x * C * de,
|
|
476
|
-
|
|
475
|
+
b,
|
|
477
476
|
E
|
|
478
477
|
), this._isUserControllingZoom = !0);
|
|
479
478
|
}
|
|
480
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) {
|
|
481
|
-
const
|
|
480
|
+
const b = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, x = Math.sqrt(b * b + E * E), R = r.y - x;
|
|
482
481
|
r.set(0, x);
|
|
483
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;
|
|
484
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);
|
|
485
484
|
}
|
|
486
485
|
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
487
|
-
},
|
|
486
|
+
}, u = () => {
|
|
488
487
|
Ee(this._activePointers, D), i.copy(D), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
|
|
489
488
|
"pointermove",
|
|
490
489
|
n,
|
|
@@ -536,11 +535,11 @@ class J extends Es {
|
|
|
536
535
|
this.unlockPointer();
|
|
537
536
|
};
|
|
538
537
|
this._addAllEventListeners = (l) => {
|
|
539
|
-
this._domElement = l, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", a), this._domElement.addEventListener("wheel",
|
|
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, {
|
|
540
539
|
passive: !1
|
|
541
540
|
}), this._domElement.addEventListener("contextmenu", m);
|
|
542
541
|
}, this._removeAllEventListeners = () => {
|
|
543
|
-
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel",
|
|
542
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", a), this._domElement.removeEventListener("wheel", f, {
|
|
544
543
|
passive: !1
|
|
545
544
|
}), this._domElement.removeEventListener("contextmenu", m), this._domElement.ownerDocument.removeEventListener(
|
|
546
545
|
"pointermove",
|
|
@@ -557,7 +556,7 @@ class J extends Es {
|
|
|
557
556
|
y
|
|
558
557
|
));
|
|
559
558
|
}, this.cancel = () => {
|
|
560
|
-
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0,
|
|
559
|
+
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
|
|
561
560
|
}, t && this.connect(t), this.update(0);
|
|
562
561
|
}
|
|
563
562
|
/**
|
|
@@ -901,7 +900,7 @@ class J extends Es {
|
|
|
901
900
|
*/
|
|
902
901
|
truck(e, t, s = !1) {
|
|
903
902
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
904
|
-
const i =
|
|
903
|
+
const i = w.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
905
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
906
905
|
}
|
|
907
906
|
/**
|
|
@@ -911,8 +910,8 @@ class J extends Es {
|
|
|
911
910
|
* @category Methods
|
|
912
911
|
*/
|
|
913
912
|
forward(e, t = !1) {
|
|
914
|
-
|
|
915
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
w.setFromMatrixColumn(this._camera.matrix, 0), w.crossVectors(this._camera.up, w), w.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(w);
|
|
916
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
917
916
|
}
|
|
918
917
|
/**
|
|
@@ -922,10 +921,10 @@ class J extends Es {
|
|
|
922
921
|
* @category Methods
|
|
923
922
|
*/
|
|
924
923
|
elevate(e, t = !1) {
|
|
925
|
-
return
|
|
926
|
-
this._targetEnd.x +
|
|
927
|
-
this._targetEnd.y +
|
|
928
|
-
this._targetEnd.z +
|
|
924
|
+
return w.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
925
|
+
this._targetEnd.x + w.x,
|
|
926
|
+
this._targetEnd.y + w.y,
|
|
927
|
+
this._targetEnd.z + w.z,
|
|
929
928
|
t
|
|
930
929
|
);
|
|
931
930
|
}
|
|
@@ -939,7 +938,7 @@ class J extends Es {
|
|
|
939
938
|
*/
|
|
940
939
|
moveTo(e, t, s, i = !1) {
|
|
941
940
|
this._isUserControllingTruck = !1;
|
|
942
|
-
const r =
|
|
941
|
+
const r = w.set(e, t, s).sub(this._targetEnd);
|
|
943
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
944
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);
|
|
945
944
|
return this._createOnRestPromise(o);
|
|
@@ -954,7 +953,7 @@ class J extends Es {
|
|
|
954
953
|
* @category Methods
|
|
955
954
|
*/
|
|
956
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
957
|
-
const n =
|
|
956
|
+
const n = w.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
958
957
|
return this.setPosition(
|
|
959
958
|
n.x,
|
|
960
959
|
n.y,
|
|
@@ -986,13 +985,13 @@ class J extends Es {
|
|
|
986
985
|
c.isEmpty() && (console.warn(
|
|
987
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
988
987
|
), Promise.resolve());
|
|
989
|
-
const
|
|
990
|
-
a.push(this.rotateTo(
|
|
991
|
-
const v =
|
|
992
|
-
|
|
988
|
+
const f = je(this._sphericalEnd.theta, Ie), m = je(this._sphericalEnd.phi, Ie);
|
|
989
|
+
a.push(this.rotateTo(f, m, t));
|
|
990
|
+
const v = w.setFromSpherical(this._sphericalEnd).normalize(), p = Ke.setFromUnitVectors(v, be), u = P(Math.abs(v.y), 1);
|
|
991
|
+
u && p.multiply(xe.setFromAxisAngle(me, f)), p.multiply(this._yAxisUpSpaceInverse);
|
|
993
992
|
const g = We.makeEmpty();
|
|
994
|
-
L.copy(c.min).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).applyQuaternion(p), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, p.setFromUnitVectors(
|
|
995
|
-
const y = g.getSize(
|
|
993
|
+
L.copy(c.min).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).applyQuaternion(p), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, p.setFromUnitVectors(be, v), u && p.premultiply(xe.invert()), p.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(w), l = g.getCenter(L).applyQuaternion(p);
|
|
996
995
|
if (Y(this._camera)) {
|
|
997
996
|
const _ = this.getDistanceToFitBox(
|
|
998
997
|
y.x,
|
|
@@ -1003,11 +1002,11 @@ class J extends Es {
|
|
|
1003
1002
|
a.push(
|
|
1004
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1005
1004
|
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1006
|
-
} else if (
|
|
1007
|
-
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom,
|
|
1005
|
+
} else if (j(this._camera)) {
|
|
1006
|
+
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom, b = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1008
1007
|
a.push(
|
|
1009
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1010
|
-
), a.push(this.zoomTo(
|
|
1009
|
+
), a.push(this.zoomTo(b, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1011
1010
|
}
|
|
1012
1011
|
return Promise.all(a);
|
|
1013
1012
|
}
|
|
@@ -1018,7 +1017,7 @@ class J extends Es {
|
|
|
1018
1017
|
* @category Methods
|
|
1019
1018
|
*/
|
|
1020
1019
|
fitToSphere(e, t) {
|
|
1021
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1020
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, we) : we.copy(e);
|
|
1022
1021
|
if (s.push(
|
|
1023
1022
|
this.moveTo(
|
|
1024
1023
|
r.center.x,
|
|
@@ -1029,7 +1028,7 @@ class J extends Es {
|
|
|
1029
1028
|
), Y(this._camera)) {
|
|
1030
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1031
1030
|
s.push(this.dollyTo(o, t));
|
|
1032
|
-
} else if (
|
|
1031
|
+
} else if (j(this._camera)) {
|
|
1033
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);
|
|
1034
1033
|
s.push(this.zoomTo(c, t));
|
|
1035
1034
|
}
|
|
@@ -1048,11 +1047,11 @@ class J extends Es {
|
|
|
1048
1047
|
*/
|
|
1049
1048
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1050
1049
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1051
|
-
const a = L.set(i, r, o), c =
|
|
1050
|
+
const a = L.set(i, r, o), c = w.set(e, t, s);
|
|
1052
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1053
1052
|
c.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1054
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1055
|
-
const
|
|
1054
|
+
const f = !n || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1056
1055
|
this._spherical.theta,
|
|
1057
1056
|
this._sphericalEnd.theta,
|
|
1058
1057
|
this.restThreshold
|
|
@@ -1065,7 +1064,7 @@ class J extends Es {
|
|
|
1065
1064
|
this._sphericalEnd.radius,
|
|
1066
1065
|
this.restThreshold
|
|
1067
1066
|
);
|
|
1068
|
-
return this._createOnRestPromise(
|
|
1067
|
+
return this._createOnRestPromise(f);
|
|
1069
1068
|
}
|
|
1070
1069
|
/**
|
|
1071
1070
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -1085,23 +1084,23 @@ class J extends Es {
|
|
|
1085
1084
|
* @param enableTransition
|
|
1086
1085
|
* @category Methods
|
|
1087
1086
|
*/
|
|
1088
|
-
lerpLookAt(e, t, s, i, r, o, n, a, c,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, c, f, m, v, p, u = !1) {
|
|
1089
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1090
|
-
const g =
|
|
1089
|
+
const g = w.set(i, r, o), y = L.set(e, t, s);
|
|
1091
1090
|
z.setFromVector3(
|
|
1092
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1093
1092
|
);
|
|
1094
|
-
const l = G.set(
|
|
1093
|
+
const l = G.set(f, m, v), _ = L.set(n, a, c);
|
|
1095
1094
|
ae.setFromVector3(
|
|
1096
1095
|
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1097
1096
|
), this._targetEnd.copy(g.lerp(l, p));
|
|
1098
|
-
const O = ae.theta - z.theta, C = ae.phi - z.phi,
|
|
1097
|
+
const O = ae.theta - z.theta, C = ae.phi - z.phi, b = ae.radius - z.radius;
|
|
1099
1098
|
this._sphericalEnd.set(
|
|
1100
|
-
z.radius +
|
|
1099
|
+
z.radius + b * p,
|
|
1101
1100
|
z.phi + C * p,
|
|
1102
1101
|
z.theta + O * p
|
|
1103
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1104
|
-
const E = !
|
|
1102
|
+
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
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(
|
|
1105
1104
|
this._spherical.theta,
|
|
1106
1105
|
this._sphericalEnd.theta,
|
|
1107
1106
|
this.restThreshold
|
|
@@ -1146,7 +1145,7 @@ class J extends Es {
|
|
|
1146
1145
|
* @category Methods
|
|
1147
1146
|
*/
|
|
1148
1147
|
setTarget(e, t, s, i = !1) {
|
|
1149
|
-
const r = this.getPosition(
|
|
1148
|
+
const r = this.getPosition(w), o = this.setLookAt(
|
|
1150
1149
|
r.x,
|
|
1151
1150
|
r.y,
|
|
1152
1151
|
r.z,
|
|
@@ -1196,8 +1195,8 @@ class J extends Es {
|
|
|
1196
1195
|
*/
|
|
1197
1196
|
setOrbitPoint(e, t, s) {
|
|
1198
1197
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1199
|
-
const i =
|
|
1200
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1198
|
+
const i = w.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), w.copy(F).add(N).add(Z), w.z = w.z + r, this.dollyTo(r, !1), this.setFocalOffset(-w.x, w.y, -w.z, !1), this.moveTo(e, t, s, !1);
|
|
1201
1200
|
}
|
|
1202
1201
|
/**
|
|
1203
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1312,7 +1311,7 @@ class J extends Es {
|
|
|
1312
1311
|
reset(e = !1) {
|
|
1313
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)) {
|
|
1314
1313
|
this._camera.up.copy(this._cameraUp0);
|
|
1315
|
-
const s = this.getPosition(
|
|
1314
|
+
const s = this.getPosition(w);
|
|
1316
1315
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1317
1316
|
}
|
|
1318
1317
|
const t = [
|
|
@@ -1356,9 +1355,9 @@ class J extends Es {
|
|
|
1356
1355
|
* @category Methods
|
|
1357
1356
|
*/
|
|
1358
1357
|
applyCameraUp() {
|
|
1359
|
-
const e =
|
|
1358
|
+
const e = w.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1360
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1361
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(w);
|
|
1362
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1363
1362
|
}
|
|
1364
1363
|
/**
|
|
@@ -1455,16 +1454,16 @@ class J extends Es {
|
|
|
1455
1454
|
}
|
|
1456
1455
|
if (this.dollyToCursor) {
|
|
1457
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1458
|
-
const m = this._spherical.radius - this._lastDistance, v = this._camera, p = this._getCameraDirection(ne),
|
|
1459
|
-
|
|
1460
|
-
const g = L.crossVectors(
|
|
1461
|
-
|
|
1457
|
+
const m = this._spherical.radius - this._lastDistance, v = this._camera, p = this._getCameraDirection(ne), u = w.copy(p).cross(v.up).normalize();
|
|
1458
|
+
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
+
const g = L.crossVectors(u, p), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - m - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
|
+
u.multiplyScalar(
|
|
1462
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1463
1462
|
)
|
|
1464
1463
|
).add(
|
|
1465
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1466
|
-
), C =
|
|
1467
|
-
if (this.infinityDolly && (
|
|
1465
|
+
), C = w.copy(this._targetEnd).lerp(O, _), b = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
|
+
if (this.infinityDolly && (b || E)) {
|
|
1468
1467
|
this._sphericalEnd.radius -= m, this._spherical.radius -= m;
|
|
1469
1468
|
const R = L.copy(p).multiplyScalar(-m);
|
|
1470
1469
|
C.add(R);
|
|
@@ -1472,13 +1471,13 @@ class J extends Es {
|
|
|
1472
1471
|
this._boundary.clampPoint(C, C);
|
|
1473
1472
|
const x = L.subVectors(C, this._targetEnd);
|
|
1474
1473
|
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= m, S(this._changedDolly) && (this._changedDolly = 0);
|
|
1475
|
-
} else if (
|
|
1476
|
-
const m = this._zoom - this._lastZoom, v = this._camera, p =
|
|
1474
|
+
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
+
const m = this._zoom - this._lastZoom, v = this._camera, p = w.set(
|
|
1477
1476
|
this._dollyControlCoord.x,
|
|
1478
1477
|
this._dollyControlCoord.y,
|
|
1479
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1480
|
-
).unproject(v),
|
|
1481
|
-
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(p).add(u.multiplyScalar(-p.dot(v.up))), l = -(this._zoom - m - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), O = this._targetEnd.dot(_), C = w.copy(this._targetEnd).lerp(g, l), b = C.dot(_), E = _.multiplyScalar(
|
|
1480
|
+
b - O
|
|
1482
1481
|
);
|
|
1483
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1484
1483
|
const x = L.subVectors(C, this._targetEnd);
|
|
@@ -1487,13 +1486,13 @@ class J extends Es {
|
|
|
1487
1486
|
}
|
|
1488
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1489
1488
|
const a = this._collisionTest();
|
|
1490
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z),
|
|
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), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(F).add(N).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1491
1490
|
this._camera.position.copy(this._target),
|
|
1492
|
-
|
|
1491
|
+
w.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1493
1492
|
1
|
|
1494
1493
|
);
|
|
1495
|
-
const
|
|
1496
|
-
return
|
|
1494
|
+
const f = this._needsUpdate;
|
|
1495
|
+
return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), S(t, this.restThreshold) && S(s, this.restThreshold) && S(i, this.restThreshold) && S(r.x, this.restThreshold) && S(r.y, this.restThreshold) && S(r.z, this.restThreshold) && S(o.x, this.restThreshold) && S(o.y, this.restThreshold) && S(o.z, this.restThreshold) && S(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !f && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = f, this._needsUpdate = !1, f;
|
|
1497
1496
|
}
|
|
1498
1497
|
/**
|
|
1499
1498
|
* Get all state in JSON string
|
|
@@ -1516,7 +1515,7 @@ class J extends Es {
|
|
|
1516
1515
|
truckSpeed: this.truckSpeed,
|
|
1517
1516
|
dollyToCursor: this.dollyToCursor,
|
|
1518
1517
|
target: this._targetEnd.toArray(),
|
|
1519
|
-
position:
|
|
1518
|
+
position: w.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1520
1519
|
zoom: this._zoomEnd,
|
|
1521
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1522
1521
|
target0: this._target0.toArray(),
|
|
@@ -1534,7 +1533,7 @@ class J extends Es {
|
|
|
1534
1533
|
fromJSON(e, t = !1) {
|
|
1535
1534
|
const s = JSON.parse(e);
|
|
1536
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(
|
|
1537
|
-
|
|
1536
|
+
w.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1538
1537
|
), this.rotateTo(z.theta, z.phi, t), this.dollyTo(z.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1539
1538
|
s.focalOffset[0],
|
|
1540
1539
|
s.focalOffset[1],
|
|
@@ -1607,7 +1606,7 @@ class J extends Es {
|
|
|
1607
1606
|
if (Y(this._camera)) {
|
|
1608
1607
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1609
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);
|
|
1610
|
-
} else if (
|
|
1609
|
+
} else if (j(this._camera)) {
|
|
1611
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;
|
|
1612
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);
|
|
1613
1612
|
}
|
|
@@ -1702,21 +1701,21 @@ class J extends Es {
|
|
|
1702
1701
|
if (!n.geometry) return;
|
|
1703
1702
|
const a = n.geometry.clone();
|
|
1704
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1705
|
-
const
|
|
1706
|
-
for (let m = 0, v =
|
|
1707
|
-
|
|
1704
|
+
const f = a.attributes.position;
|
|
1705
|
+
for (let m = 0, v = f.count; m < v; m++)
|
|
1706
|
+
w.fromBufferAttribute(f, m), r = Math.max(r, i.distanceToSquared(w));
|
|
1708
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1709
1708
|
}
|
|
1710
1709
|
}
|
|
1711
1710
|
var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, $e = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1712
1711
|
return Function.prototype.apply.call(e, t, s);
|
|
1713
|
-
},
|
|
1714
|
-
Q && typeof Q.ownKeys == "function" ?
|
|
1712
|
+
}, ue;
|
|
1713
|
+
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
1715
1714
|
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
1716
|
-
} :
|
|
1715
|
+
} : ue = function(e) {
|
|
1717
1716
|
return Object.getOwnPropertyNames(e);
|
|
1718
1717
|
};
|
|
1719
|
-
function
|
|
1718
|
+
function Ts(h) {
|
|
1720
1719
|
console && console.warn && console.warn(h);
|
|
1721
1720
|
}
|
|
1722
1721
|
var _t = Number.isNaN || function(e) {
|
|
@@ -1726,7 +1725,7 @@ function A() {
|
|
|
1726
1725
|
A.init.call(this);
|
|
1727
1726
|
}
|
|
1728
1727
|
Se.exports = A;
|
|
1729
|
-
Se.exports.once =
|
|
1728
|
+
Se.exports.once = Ls;
|
|
1730
1729
|
A.EventEmitter = A;
|
|
1731
1730
|
A.prototype._events = void 0;
|
|
1732
1731
|
A.prototype._eventsCount = 0;
|
|
@@ -1781,8 +1780,8 @@ A.prototype.emit = function(e) {
|
|
|
1781
1780
|
if (typeof a == "function")
|
|
1782
1781
|
$e(a, this, t);
|
|
1783
1782
|
else
|
|
1784
|
-
for (var c = a.length,
|
|
1785
|
-
$e(
|
|
1783
|
+
for (var c = a.length, f = Et(a, c), s = 0; s < c; ++s)
|
|
1784
|
+
$e(f[s], this, t);
|
|
1786
1785
|
return !0;
|
|
1787
1786
|
};
|
|
1788
1787
|
function yt(h, e, t, s) {
|
|
@@ -1796,7 +1795,7 @@ function yt(h, e, t, s) {
|
|
|
1796
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) {
|
|
1797
1796
|
o.warned = !0;
|
|
1798
1797
|
var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1799
|
-
n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length,
|
|
1798
|
+
n.name = "MaxListenersExceededWarning", n.emitter = h, n.type = e, n.count = o.length, Ts(n);
|
|
1800
1799
|
}
|
|
1801
1800
|
return h;
|
|
1802
1801
|
}
|
|
@@ -1837,7 +1836,7 @@ A.prototype.removeListener = function(e, t) {
|
|
|
1837
1836
|
}
|
|
1838
1837
|
if (r < 0)
|
|
1839
1838
|
return this;
|
|
1840
|
-
r === 0 ? s.shift() :
|
|
1839
|
+
r === 0 ? s.shift() : ws(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, n || t);
|
|
1841
1840
|
}
|
|
1842
1841
|
return this;
|
|
1843
1842
|
};
|
|
@@ -1866,7 +1865,7 @@ function Ct(h, e, t) {
|
|
|
1866
1865
|
if (s === void 0)
|
|
1867
1866
|
return [];
|
|
1868
1867
|
var i = s[e];
|
|
1869
|
-
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 ? xs(i) : Et(i, i.length);
|
|
1870
1869
|
}
|
|
1871
1870
|
A.prototype.listeners = function(e) {
|
|
1872
1871
|
return Ct(this, e, !0);
|
|
@@ -1890,24 +1889,24 @@ function Ot(h) {
|
|
|
1890
1889
|
return 0;
|
|
1891
1890
|
}
|
|
1892
1891
|
A.prototype.eventNames = function() {
|
|
1893
|
-
return this._eventsCount > 0 ?
|
|
1892
|
+
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1894
1893
|
};
|
|
1895
1894
|
function Et(h, e) {
|
|
1896
1895
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1897
1896
|
t[s] = h[s];
|
|
1898
1897
|
return t;
|
|
1899
1898
|
}
|
|
1900
|
-
function
|
|
1899
|
+
function ws(h, e) {
|
|
1901
1900
|
for (; e + 1 < h.length; e++)
|
|
1902
1901
|
h[e] = h[e + 1];
|
|
1903
1902
|
h.pop();
|
|
1904
1903
|
}
|
|
1905
|
-
function
|
|
1904
|
+
function xs(h) {
|
|
1906
1905
|
for (var e = new Array(h.length), t = 0; t < e.length; ++t)
|
|
1907
1906
|
e[t] = h[t].listener || h[t];
|
|
1908
1907
|
return e;
|
|
1909
1908
|
}
|
|
1910
|
-
function
|
|
1909
|
+
function Ls(h, e) {
|
|
1911
1910
|
return new Promise(function(t, s) {
|
|
1912
1911
|
function i(o) {
|
|
1913
1912
|
h.removeListener(e, r), s(o);
|
|
@@ -1915,10 +1914,10 @@ function Ps(h, e) {
|
|
|
1915
1914
|
function r() {
|
|
1916
1915
|
typeof h.removeListener == "function" && h.removeListener("error", i), t([].slice.call(arguments));
|
|
1917
1916
|
}
|
|
1918
|
-
Tt(h, e, r, { once: !0 }), e !== "error" &&
|
|
1917
|
+
Tt(h, e, r, { once: !0 }), e !== "error" && Ps(h, i, { once: !0 });
|
|
1919
1918
|
});
|
|
1920
1919
|
}
|
|
1921
|
-
function
|
|
1920
|
+
function Ps(h, e, t) {
|
|
1922
1921
|
typeof h.on == "function" && Tt(h, "error", e, t);
|
|
1923
1922
|
}
|
|
1924
1923
|
function Tt(h, e, t, s) {
|
|
@@ -1932,7 +1931,7 @@ function Tt(h, e, t, s) {
|
|
|
1932
1931
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof h);
|
|
1933
1932
|
}
|
|
1934
1933
|
var ye = Se.exports;
|
|
1935
|
-
let
|
|
1934
|
+
let As = class {
|
|
1936
1935
|
constructor() {
|
|
1937
1936
|
this.mask = 1;
|
|
1938
1937
|
}
|
|
@@ -1963,7 +1962,7 @@ class ee {
|
|
|
1963
1962
|
this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
1964
1963
|
}
|
|
1965
1964
|
addController(e, t) {
|
|
1966
|
-
const s = new
|
|
1965
|
+
const s = new As();
|
|
1967
1966
|
return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
|
|
1968
1967
|
}
|
|
1969
1968
|
removePage(e, t) {
|
|
@@ -1992,20 +1991,20 @@ class ee {
|
|
|
1992
1991
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
1993
1992
|
}
|
|
1994
1993
|
}
|
|
1995
|
-
const
|
|
1994
|
+
const bt = {
|
|
1996
1995
|
fov: 45,
|
|
1997
1996
|
near: 1,
|
|
1998
1997
|
far: 1e3,
|
|
1999
|
-
up: new
|
|
1998
|
+
up: new I(0, 1, 0)
|
|
2000
1999
|
};
|
|
2001
|
-
class
|
|
2000
|
+
class Ss extends ee {
|
|
2002
2001
|
constructor(e) {
|
|
2003
2002
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2004
2003
|
}
|
|
2005
2004
|
get camera() {
|
|
2006
2005
|
return this.controller;
|
|
2007
2006
|
}
|
|
2008
|
-
addPerspectiveCamera(e =
|
|
2007
|
+
addPerspectiveCamera(e = bt, t) {
|
|
2009
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);
|
|
2010
2009
|
return c.up = o, this.addController(c, t);
|
|
2011
2010
|
}
|
|
@@ -2078,8 +2077,8 @@ class Ms extends ee {
|
|
|
2078
2077
|
}
|
|
2079
2078
|
}
|
|
2080
2079
|
}
|
|
2081
|
-
const
|
|
2082
|
-
const e = new
|
|
2080
|
+
const Ms = (h) => {
|
|
2081
|
+
const e = new hs(
|
|
2083
2082
|
new Ft({
|
|
2084
2083
|
uniforms: {
|
|
2085
2084
|
baseTexture: { value: null },
|
|
@@ -2114,7 +2113,7 @@ const Rs = (h) => {
|
|
|
2114
2113
|
"baseTexture"
|
|
2115
2114
|
);
|
|
2116
2115
|
return e.needsSwap = !0, e;
|
|
2117
|
-
},
|
|
2116
|
+
}, Rs = {
|
|
2118
2117
|
name: "OutputShader",
|
|
2119
2118
|
uniforms: {
|
|
2120
2119
|
tDiffuse: { value: null },
|
|
@@ -2208,11 +2207,11 @@ const Rs = (h) => {
|
|
|
2208
2207
|
}`
|
|
2209
2208
|
)
|
|
2210
2209
|
};
|
|
2211
|
-
class
|
|
2210
|
+
class Ds extends cs {
|
|
2212
2211
|
constructor() {
|
|
2213
2212
|
super();
|
|
2214
|
-
const e =
|
|
2215
|
-
this.uniforms = Nt.clone(e.uniforms), this.material = new
|
|
2213
|
+
const e = Rs;
|
|
2214
|
+
this.uniforms = Nt.clone(e.uniforms), this.material = new Ht({
|
|
2216
2215
|
name: e.name,
|
|
2217
2216
|
uniforms: this.uniforms,
|
|
2218
2217
|
vertexShader: e.vertexShader,
|
|
@@ -2220,38 +2219,38 @@ class Us extends ds {
|
|
|
2220
2219
|
}), this.fsQuad ? this.fsQuad = new Fe(this.material) : this._fsQuad && (this._fsQuad = new Fe(this.material));
|
|
2221
2220
|
}
|
|
2222
2221
|
}
|
|
2223
|
-
const
|
|
2222
|
+
const Us = new It({ color: "black" }), zs = new nt({
|
|
2224
2223
|
color: "black",
|
|
2225
2224
|
sizeAttenuation: !1
|
|
2226
|
-
}),
|
|
2225
|
+
}), ks = new nt({
|
|
2227
2226
|
color: "black",
|
|
2228
2227
|
sizeAttenuation: !0
|
|
2229
|
-
}),
|
|
2228
|
+
}), Fs = new at({
|
|
2230
2229
|
color: "black",
|
|
2231
2230
|
sizeAttenuation: !0
|
|
2232
|
-
}),
|
|
2231
|
+
}), Ns = new at({
|
|
2233
2232
|
color: "black",
|
|
2234
2233
|
sizeAttenuation: !1
|
|
2235
|
-
}),
|
|
2234
|
+
}), Hs = new ut({
|
|
2236
2235
|
color: "black",
|
|
2237
2236
|
sizeAttenuation: !1,
|
|
2238
2237
|
lineWidth: 0
|
|
2239
|
-
}),
|
|
2238
|
+
}), Is = {
|
|
2240
2239
|
kernelRadius: 8,
|
|
2241
2240
|
minDistance: 5e-3,
|
|
2242
2241
|
maxDistance: 0.1
|
|
2243
|
-
},
|
|
2242
|
+
}, js = {
|
|
2244
2243
|
threshold: 0,
|
|
2245
2244
|
strength: 0.4,
|
|
2246
2245
|
radius: 0.1,
|
|
2247
2246
|
bloomAlphaType: 0
|
|
2248
|
-
},
|
|
2247
|
+
}, Bs = {
|
|
2249
2248
|
multisampling: 4,
|
|
2250
2249
|
premultiplieAlpha: !1
|
|
2251
2250
|
};
|
|
2252
|
-
class
|
|
2251
|
+
class Vs {
|
|
2253
2252
|
constructor(e) {
|
|
2254
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2253
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new jt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2255
2254
|
const {
|
|
2256
2255
|
rendererController: t,
|
|
2257
2256
|
sceneController: s,
|
|
@@ -2259,23 +2258,23 @@ class Ys {
|
|
|
2259
2258
|
composerParams: r
|
|
2260
2259
|
} = e, { renderer: o } = t;
|
|
2261
2260
|
this.renderer = o;
|
|
2262
|
-
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, c = o.getDrawingBufferSize(new B()),
|
|
2261
|
+
const { multisampling: n } = r, { maxSamples: a } = o.capabilities, c = o.getDrawingBufferSize(new B()), f = new Bt(
|
|
2263
2262
|
c.width,
|
|
2264
2263
|
c.height,
|
|
2265
2264
|
{
|
|
2266
2265
|
samples: Math.min(n, a),
|
|
2267
2266
|
type: Vt
|
|
2268
2267
|
}
|
|
2269
|
-
), m = new ke(o,
|
|
2268
|
+
), m = new ke(o, f), v = this.getSize();
|
|
2270
2269
|
m.setSize(v.width, v.height);
|
|
2271
|
-
const p = new
|
|
2270
|
+
const p = new ns(
|
|
2272
2271
|
s.scene,
|
|
2273
2272
|
i.camera
|
|
2274
2273
|
);
|
|
2275
|
-
m.addPass(p), this.scene = s.scene, this.camera = i.camera, this.finalComposer = m, this.renderPass = p, i.event.on("pageChange", (
|
|
2276
|
-
this.changeCamera(
|
|
2277
|
-
}), s.event.on("pageChange", (
|
|
2278
|
-
this.changeScene(
|
|
2274
|
+
m.addPass(p), this.scene = s.scene, this.camera = i.camera, this.finalComposer = m, this.renderPass = p, i.event.on("pageChange", (u) => {
|
|
2275
|
+
this.changeCamera(u);
|
|
2276
|
+
}), s.event.on("pageChange", (u) => {
|
|
2277
|
+
this.changeScene(u);
|
|
2279
2278
|
});
|
|
2280
2279
|
}
|
|
2281
2280
|
changeCamera(e) {
|
|
@@ -2285,18 +2284,18 @@ class Ys {
|
|
|
2285
2284
|
this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
|
|
2286
2285
|
}
|
|
2287
2286
|
addOutputPass() {
|
|
2288
|
-
const { premultiplieAlpha: e } = this.options.composerParams, t = new
|
|
2287
|
+
const { premultiplieAlpha: e } = this.options.composerParams, t = new Ds();
|
|
2289
2288
|
this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
|
|
2290
2289
|
}
|
|
2291
2290
|
setPremultiplieAlpha(e) {
|
|
2292
2291
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2293
2292
|
}
|
|
2294
2293
|
addSSAOPass(e) {
|
|
2295
|
-
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 as(t, s, o, n);
|
|
2296
2295
|
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2297
2296
|
}
|
|
2298
2297
|
addBloomPass(e) {
|
|
2299
|
-
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 ls(
|
|
2300
2299
|
new B(window.innerWidth, window.innerHeight),
|
|
2301
2300
|
i,
|
|
2302
2301
|
r,
|
|
@@ -2305,7 +2304,7 @@ class Ys {
|
|
|
2305
2304
|
this.bloomPass = n;
|
|
2306
2305
|
const a = new ke(t);
|
|
2307
2306
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2308
|
-
const c =
|
|
2307
|
+
const c = Ms(a);
|
|
2309
2308
|
c.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(c), this.mixPass = c, this.bloomLayer.set(Oe);
|
|
2310
2309
|
}
|
|
2311
2310
|
setBloomSelection(e, t) {
|
|
@@ -2340,7 +2339,7 @@ class Ys {
|
|
|
2340
2339
|
s.traverse((i) => {
|
|
2341
2340
|
var a;
|
|
2342
2341
|
const r = i, o = i, n = i;
|
|
2343
|
-
(a = r.material) != null && a.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material =
|
|
2342
|
+
(a = r.material) != null && a.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = Fs : o.material = Ns : r.material instanceof ut ? r.material = Hs : n.isPoints ? n.material.sizeAttenuation ? n.material = ks : n.material = zs : r.material = Us);
|
|
2344
2343
|
});
|
|
2345
2344
|
}), e.forEach((s) => {
|
|
2346
2345
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2384,12 +2383,12 @@ class Ys {
|
|
|
2384
2383
|
this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomSelection.clear(), this.finalComposer.dispose(), (e = this.bloomComposer) == null || e.dispose();
|
|
2385
2384
|
}
|
|
2386
2385
|
}
|
|
2387
|
-
class
|
|
2386
|
+
class Ys extends ee {
|
|
2388
2387
|
constructor(e) {
|
|
2389
2388
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2390
2389
|
const t = {
|
|
2391
2390
|
Vector2: B,
|
|
2392
|
-
Vector3:
|
|
2391
|
+
Vector3: I,
|
|
2393
2392
|
Vector4: Zt,
|
|
2394
2393
|
Quaternion: lt,
|
|
2395
2394
|
Matrix4: W,
|
|
@@ -2431,8 +2430,8 @@ class Zs extends ee {
|
|
|
2431
2430
|
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Yt.DEG2RAD);
|
|
2432
2431
|
}
|
|
2433
2432
|
}
|
|
2434
|
-
const Xe = new
|
|
2435
|
-
class
|
|
2433
|
+
const Xe = new I(), Zs = new lt(), qe = new I(), H = new W(), Ws = new W();
|
|
2434
|
+
class Ks {
|
|
2436
2435
|
/**
|
|
2437
2436
|
* Constructs a new CSS3D renderer.
|
|
2438
2437
|
*
|
|
@@ -2448,8 +2447,8 @@ class $s {
|
|
|
2448
2447
|
a.style.overflow = "hidden", this.domElement = a;
|
|
2449
2448
|
const c = document.createElement("div");
|
|
2450
2449
|
c.style.transformOrigin = "0 0", c.style.pointerEvents = "none", a.appendChild(c);
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2450
|
+
const f = document.createElement("div");
|
|
2451
|
+
f.style.transformStyle = "preserve-3d", c.appendChild(f), this.getSize = function() {
|
|
2453
2452
|
return {
|
|
2454
2453
|
width: s,
|
|
2455
2454
|
height: i
|
|
@@ -2459,10 +2458,10 @@ class $s {
|
|
|
2459
2458
|
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();
|
|
2460
2459
|
let O, C;
|
|
2461
2460
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2462
|
-
const
|
|
2463
|
-
n.camera.style !== R && (
|
|
2461
|
+
const b = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${b} )scale(` + _ + ")translate(" + m(O) + "px," + m(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${b} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2462
|
+
n.camera.style !== R && (f.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2464
2463
|
}, this.setSize = function(y, l) {
|
|
2465
|
-
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",
|
|
2464
|
+
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";
|
|
2466
2465
|
};
|
|
2467
2466
|
function m(y) {
|
|
2468
2467
|
return Math.abs(y) < 1e-10 ? 0 : y;
|
|
@@ -2475,38 +2474,38 @@ class $s {
|
|
|
2475
2474
|
const l = y.elements;
|
|
2476
2475
|
return "translate(-50%,-50%)" + ("matrix3d(" + m(l[0]) + "," + m(l[1]) + "," + m(l[2]) + "," + m(l[3]) + "," + m(-l[4]) + "," + m(-l[5]) + "," + m(-l[6]) + "," + m(-l[7]) + "," + m(l[8]) + "," + m(l[9]) + "," + m(l[10]) + "," + m(l[11]) + "," + m(l[12]) + "," + m(l[13]) + "," + m(l[14]) + "," + m(l[15]) + ")");
|
|
2477
2476
|
}
|
|
2478
|
-
function
|
|
2477
|
+
function u(y) {
|
|
2479
2478
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2480
2479
|
for (let l = 0, _ = y.children.length; l < _; l++)
|
|
2481
|
-
|
|
2480
|
+
u(y.children[l]);
|
|
2482
2481
|
}
|
|
2483
2482
|
function g(y, l, _, O) {
|
|
2484
2483
|
if (y.visible === !1) {
|
|
2485
|
-
|
|
2484
|
+
u(y);
|
|
2486
2485
|
return;
|
|
2487
2486
|
}
|
|
2488
2487
|
if (y.isCSS3DObject) {
|
|
2489
|
-
const C = y.layers.test(_.layers) === !0,
|
|
2490
|
-
if (
|
|
2488
|
+
const C = y.layers.test(_.layers) === !0, b = y.element;
|
|
2489
|
+
if (b.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2491
2490
|
y.onBeforeRender(t, l, _);
|
|
2492
2491
|
let E;
|
|
2493
|
-
y.isCSS3DSprite ? (
|
|
2492
|
+
y.isCSS3DSprite ? (H.copy(_.matrixWorldInverse), H.transpose(), y.rotation2D !== 0 && H.multiply(Ws.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(Xe, Zs, qe), H.setPosition(Xe), H.scale(qe), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, E = p(H)) : E = p(y.matrixWorld);
|
|
2494
2493
|
const x = n.objects.get(y);
|
|
2495
2494
|
if (x === void 0 || x.style !== E) {
|
|
2496
|
-
|
|
2495
|
+
b.style.transform = E;
|
|
2497
2496
|
const R = { style: E };
|
|
2498
2497
|
n.objects.set(y, R);
|
|
2499
2498
|
}
|
|
2500
|
-
|
|
2499
|
+
b.parentNode !== f && f.appendChild(b), y.onAfterRender(t, l, _);
|
|
2501
2500
|
}
|
|
2502
2501
|
}
|
|
2503
|
-
for (let C = 0,
|
|
2502
|
+
for (let C = 0, b = y.children.length; C < b; C++)
|
|
2504
2503
|
g(y.children[C], l, _);
|
|
2505
2504
|
}
|
|
2506
2505
|
}
|
|
2507
2506
|
}
|
|
2508
|
-
const q = new
|
|
2509
|
-
class
|
|
2507
|
+
const q = new I(), Qe = new W(), Je = new W(), et = new I(), tt = new I();
|
|
2508
|
+
class $s {
|
|
2510
2509
|
/**
|
|
2511
2510
|
* Constructs a new CSS2D renderer.
|
|
2512
2511
|
*
|
|
@@ -2523,44 +2522,44 @@ class Gs {
|
|
|
2523
2522
|
width: s,
|
|
2524
2523
|
height: i
|
|
2525
2524
|
};
|
|
2526
|
-
}, this.render = function(
|
|
2527
|
-
|
|
2528
|
-
}, this.setSize = function(
|
|
2529
|
-
s =
|
|
2525
|
+
}, this.render = function(u, g) {
|
|
2526
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Qe.copy(g.matrixWorldInverse), Je.multiplyMatrices(g.projectionMatrix, Qe), f(u, u, g), p(u);
|
|
2527
|
+
}, this.setSize = function(u, g) {
|
|
2528
|
+
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2530
2529
|
};
|
|
2531
|
-
function c(
|
|
2532
|
-
|
|
2533
|
-
for (let g = 0, y =
|
|
2534
|
-
c(
|
|
2530
|
+
function c(u) {
|
|
2531
|
+
u.isCSS2DObject && (u.element.style.display = "none");
|
|
2532
|
+
for (let g = 0, y = u.children.length; g < y; g++)
|
|
2533
|
+
c(u.children[g]);
|
|
2535
2534
|
}
|
|
2536
|
-
function u
|
|
2537
|
-
if (
|
|
2538
|
-
c(
|
|
2535
|
+
function f(u, g, y) {
|
|
2536
|
+
if (u.visible === !1) {
|
|
2537
|
+
c(u);
|
|
2539
2538
|
return;
|
|
2540
2539
|
}
|
|
2541
|
-
if (
|
|
2542
|
-
q.setFromMatrixPosition(
|
|
2543
|
-
const l = q.z >= -1 && q.z <= 1 &&
|
|
2544
|
-
_.style.display = l === !0 ? "" : "none", l === !0 && (
|
|
2540
|
+
if (u.isCSS2DObject) {
|
|
2541
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Je);
|
|
2542
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, _ = u.element;
|
|
2543
|
+
_.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));
|
|
2545
2544
|
const O = {
|
|
2546
|
-
distanceToCameraSquared: m(y,
|
|
2545
|
+
distanceToCameraSquared: m(y, u)
|
|
2547
2546
|
};
|
|
2548
|
-
n.objects.set(
|
|
2547
|
+
n.objects.set(u, O);
|
|
2549
2548
|
}
|
|
2550
|
-
for (let l = 0, _ =
|
|
2551
|
-
u
|
|
2549
|
+
for (let l = 0, _ = u.children.length; l < _; l++)
|
|
2550
|
+
f(u.children[l], g, y);
|
|
2552
2551
|
}
|
|
2553
|
-
function m(
|
|
2554
|
-
return et.setFromMatrixPosition(
|
|
2552
|
+
function m(u, g) {
|
|
2553
|
+
return et.setFromMatrixPosition(u.matrixWorld), tt.setFromMatrixPosition(g.matrixWorld), et.distanceToSquared(tt);
|
|
2555
2554
|
}
|
|
2556
|
-
function v(
|
|
2555
|
+
function v(u) {
|
|
2557
2556
|
const g = [];
|
|
2558
|
-
return
|
|
2557
|
+
return u.traverseVisible(function(y) {
|
|
2559
2558
|
y.isCSS2DObject && g.push(y);
|
|
2560
2559
|
}), g;
|
|
2561
2560
|
}
|
|
2562
|
-
function p(
|
|
2563
|
-
const g = v(
|
|
2561
|
+
function p(u) {
|
|
2562
|
+
const g = v(u).sort(function(l, _) {
|
|
2564
2563
|
if (l.renderOrder !== _.renderOrder)
|
|
2565
2564
|
return _.renderOrder - l.renderOrder;
|
|
2566
2565
|
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(_).distanceToCameraSquared;
|
|
@@ -2574,12 +2573,12 @@ class Gs {
|
|
|
2574
2573
|
const st = {
|
|
2575
2574
|
zIndex: "auto"
|
|
2576
2575
|
};
|
|
2577
|
-
class
|
|
2576
|
+
class Gs {
|
|
2578
2577
|
constructor(e) {
|
|
2579
2578
|
this.container = e;
|
|
2580
2579
|
}
|
|
2581
2580
|
addRenderer(e, t) {
|
|
2582
|
-
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new
|
|
2581
|
+
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new $s() : new Ks();
|
|
2583
2582
|
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);
|
|
2584
2583
|
}
|
|
2585
2584
|
setSize(e, t) {
|
|
@@ -2595,7 +2594,7 @@ class Xs {
|
|
|
2595
2594
|
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
2596
2595
|
}
|
|
2597
2596
|
}
|
|
2598
|
-
class
|
|
2597
|
+
class Xs {
|
|
2599
2598
|
constructor(e) {
|
|
2600
2599
|
this.helpers = {}, this.options = e;
|
|
2601
2600
|
}
|
|
@@ -2616,7 +2615,7 @@ class qs {
|
|
|
2616
2615
|
else if (e.isHemisphereLight)
|
|
2617
2616
|
i = new Qt(e, 10);
|
|
2618
2617
|
else if (e.isRectAreaLight)
|
|
2619
|
-
i = new
|
|
2618
|
+
i = new ds(e);
|
|
2620
2619
|
else {
|
|
2621
2620
|
const r = new ht();
|
|
2622
2621
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
@@ -2630,7 +2629,7 @@ class qs {
|
|
|
2630
2629
|
}
|
|
2631
2630
|
}
|
|
2632
2631
|
addViewHelper() {
|
|
2633
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2632
|
+
const { cameraController: e, container: t } = this.options, s = new ms(e.camera, t);
|
|
2634
2633
|
t.addEventListener("pointerdown", (i) => {
|
|
2635
2634
|
i.preventDefault(), s.handleClick(i);
|
|
2636
2635
|
}), this.viewHelper = s;
|
|
@@ -2688,7 +2687,7 @@ function it(h) {
|
|
|
2688
2687
|
}));
|
|
2689
2688
|
};
|
|
2690
2689
|
}
|
|
2691
|
-
class
|
|
2690
|
+
class qs {
|
|
2692
2691
|
constructor(e) {
|
|
2693
2692
|
var t;
|
|
2694
2693
|
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 = {
|
|
@@ -2711,18 +2710,18 @@ class Qs {
|
|
|
2711
2710
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2712
2711
|
const a = this.objCallbackMap;
|
|
2713
2712
|
for (const p of n)
|
|
2714
|
-
for (const
|
|
2715
|
-
if (!
|
|
2716
|
-
a.has(
|
|
2717
|
-
const g = a.get(
|
|
2713
|
+
for (const u of p.objArr) {
|
|
2714
|
+
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
2715
|
+
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
2716
|
+
const g = a.get(u);
|
|
2718
2717
|
g.has(p.type) || g.set(p.type, []), g.get(p.type).push(p.cb);
|
|
2719
2718
|
}
|
|
2720
2719
|
if (a.size === 0) return;
|
|
2721
|
-
const c = [...a.keys()].map((p) => p.object3d),
|
|
2722
|
-
if (!
|
|
2720
|
+
const c = [...a.keys()].map((p) => p.object3d), f = (v = this.pencil.pick(r, c, !0)) == null ? void 0 : v.intersects;
|
|
2721
|
+
if (!f || f.length === 0)
|
|
2723
2722
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2724
2723
|
else {
|
|
2725
|
-
const p =
|
|
2724
|
+
const p = f[0];
|
|
2726
2725
|
this.processIntersection(p, r, e);
|
|
2727
2726
|
}
|
|
2728
2727
|
const m = this.prevActiveObjects;
|
|
@@ -2764,9 +2763,9 @@ class Qs {
|
|
|
2764
2763
|
sp: o,
|
|
2765
2764
|
intersectionIndex: s
|
|
2766
2765
|
});
|
|
2767
|
-
const
|
|
2768
|
-
if (
|
|
2769
|
-
for (const m of
|
|
2766
|
+
const f = a.get("move");
|
|
2767
|
+
if (f)
|
|
2768
|
+
for (const m of f)
|
|
2770
2769
|
m({
|
|
2771
2770
|
baseObject: n,
|
|
2772
2771
|
realBaseObject: this.activeObject,
|
|
@@ -2785,14 +2784,14 @@ class Qs {
|
|
|
2785
2784
|
sp: o,
|
|
2786
2785
|
intersectionIndex: s
|
|
2787
2786
|
});
|
|
2788
|
-
const
|
|
2789
|
-
if (
|
|
2787
|
+
const f = a.get("click");
|
|
2788
|
+
if (f) {
|
|
2790
2789
|
const m = (v) => {
|
|
2791
2790
|
v.preventDefault();
|
|
2792
2791
|
const p = 5;
|
|
2793
2792
|
if (!r && Math.abs(v.clientX - e.clientX) <= p && Math.abs(v.clientY - e.clientY) <= p)
|
|
2794
|
-
for (const
|
|
2795
|
-
|
|
2793
|
+
for (const u of f)
|
|
2794
|
+
u({
|
|
2796
2795
|
baseObject: n,
|
|
2797
2796
|
realBaseObject: this.activeObject,
|
|
2798
2797
|
mouseEvent: e,
|
|
@@ -2854,8 +2853,8 @@ class Qs {
|
|
|
2854
2853
|
baseObject: a,
|
|
2855
2854
|
mouseEvent: m
|
|
2856
2855
|
}));
|
|
2857
|
-
},
|
|
2858
|
-
a.element.addEventListener(
|
|
2856
|
+
}, f = `pointer${t}`;
|
|
2857
|
+
a.element.addEventListener(f, it(c), !1), o.push({ arr: a, type: f, listener: c });
|
|
2859
2858
|
}
|
|
2860
2859
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2861
2860
|
}
|
|
@@ -2875,7 +2874,7 @@ class Qs {
|
|
|
2875
2874
|
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
|
|
2876
2875
|
}
|
|
2877
2876
|
}
|
|
2878
|
-
class
|
|
2877
|
+
class Qs extends qs {
|
|
2879
2878
|
constructor(e, t) {
|
|
2880
2879
|
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new dt(), {
|
|
2881
2880
|
key: "@Scene",
|
|
@@ -2899,7 +2898,7 @@ class Js extends Qs {
|
|
|
2899
2898
|
createBaseObject(e, t = {}) {
|
|
2900
2899
|
const s = U({
|
|
2901
2900
|
mList: !0
|
|
2902
|
-
}, t), i = new
|
|
2901
|
+
}, t), i = new os();
|
|
2903
2902
|
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key)
|
|
2904
2903
|
i.key = s.key;
|
|
2905
2904
|
else if (s.target) {
|
|
@@ -2946,18 +2945,18 @@ class Js extends Qs {
|
|
|
2946
2945
|
const i = this.objectNamesToFactories.get(e);
|
|
2947
2946
|
if (i) {
|
|
2948
2947
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
2949
|
-
const c = t.target,
|
|
2950
|
-
let
|
|
2951
|
-
return c === null ?
|
|
2948
|
+
const c = t.target, f = (r = t.onTop) != null ? r : 0, m = (o = t.prefab) != null ? o : !1, v = (n = t.create) != null ? n : !0, p = new i().create(t);
|
|
2949
|
+
let u;
|
|
2950
|
+
return c === null ? u = null : typeof c == "string" ? u = this.objects.get(c) : (a = c == null ? void 0 : c.objectType) != null && a.startsWith("BaseObject") || c ? u = c : m ? u = this.prefabGroup : u = this.group, v === !1 ? p.create = () => {
|
|
2952
2951
|
} : v !== !0 && (p.create = () => {
|
|
2953
2952
|
v(p);
|
|
2954
2953
|
}), p.pencil = this.pencil, p.lead = this, p.mList = this.mList, p.prefab = m, p.objectType = `BaseObject#${e}`, p.objectOptions = t, this.setBaseObjectKey(
|
|
2955
2954
|
p,
|
|
2956
2955
|
t.key ? `$t:#${t.key}` : "$t:",
|
|
2957
|
-
|
|
2956
|
+
u == null ? void 0 : u.key
|
|
2958
2957
|
), this.objectsPm.set(
|
|
2959
2958
|
p,
|
|
2960
|
-
this.addBaseObject(p,
|
|
2959
|
+
this.addBaseObject(p, u, f)
|
|
2961
2960
|
), yield this.objectsPm.get(p), this.objectsPm.delete(p), p;
|
|
2962
2961
|
}
|
|
2963
2962
|
throw new Error(`Unrecognized:${e}`);
|
|
@@ -3038,7 +3037,7 @@ class Js extends Qs {
|
|
|
3038
3037
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectWrapChindIdMap.clear(), this.objectNamesToFactories.clear();
|
|
3039
3038
|
}
|
|
3040
3039
|
}
|
|
3041
|
-
class
|
|
3040
|
+
class Js extends ee {
|
|
3042
3041
|
get lead() {
|
|
3043
3042
|
return this.controller;
|
|
3044
3043
|
}
|
|
@@ -3046,7 +3045,7 @@ class ei extends ee {
|
|
|
3046
3045
|
super(), this.options = e;
|
|
3047
3046
|
}
|
|
3048
3047
|
addLead(e, t, s) {
|
|
3049
|
-
const { pencil: i } = this.options, r = new
|
|
3048
|
+
const { pencil: i } = this.options, r = new Qs(i, {
|
|
3050
3049
|
scene: e,
|
|
3051
3050
|
mList: t
|
|
3052
3051
|
});
|
|
@@ -3077,22 +3076,22 @@ class rt extends mt {
|
|
|
3077
3076
|
}
|
|
3078
3077
|
load(e, t, s, i) {
|
|
3079
3078
|
let r, o;
|
|
3080
|
-
this.options.type === "image" ? (o = document.createElement("img"), r = new
|
|
3079
|
+
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new pt(o)) : r = new fe();
|
|
3081
3080
|
const n = new Ae(this.manager);
|
|
3082
3081
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3083
3082
|
e,
|
|
3084
3083
|
(a) => {
|
|
3085
3084
|
let c = a;
|
|
3086
|
-
const
|
|
3085
|
+
const f = e.split(".").pop(), m = this.options.type === "image" ? `image/${f || "png"}` : `video/${f || "mp4"}`;
|
|
3087
3086
|
c = c.slice(0, a.size, m);
|
|
3088
3087
|
const v = () => {
|
|
3089
|
-
o.removeEventListener("load", p, !1), o.removeEventListener("error",
|
|
3088
|
+
o.removeEventListener("load", p, !1), o.removeEventListener("error", u, !1);
|
|
3090
3089
|
}, p = () => {
|
|
3091
3090
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3092
|
-
},
|
|
3091
|
+
}, u = (y) => {
|
|
3093
3092
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3094
3093
|
};
|
|
3095
|
-
o.addEventListener("load", p, !1), o.addEventListener("error",
|
|
3094
|
+
o.addEventListener("load", p, !1), o.addEventListener("error", u, !1);
|
|
3096
3095
|
const g = window.URL.createObjectURL(c);
|
|
3097
3096
|
o.src = g;
|
|
3098
3097
|
},
|
|
@@ -3101,7 +3100,7 @@ class rt extends mt {
|
|
|
3101
3100
|
), r;
|
|
3102
3101
|
}
|
|
3103
3102
|
}
|
|
3104
|
-
class
|
|
3103
|
+
class ei extends mt {
|
|
3105
3104
|
constructor(e) {
|
|
3106
3105
|
super(e);
|
|
3107
3106
|
}
|
|
@@ -3122,7 +3121,7 @@ class ti extends mt {
|
|
|
3122
3121
|
);
|
|
3123
3122
|
}
|
|
3124
3123
|
}
|
|
3125
|
-
const
|
|
3124
|
+
const ti = {
|
|
3126
3125
|
images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
|
|
3127
3126
|
media: ["mp4", "webm", "ogg"],
|
|
3128
3127
|
gltf: ["gltf", "glb"],
|
|
@@ -3131,7 +3130,7 @@ const si = {
|
|
|
3131
3130
|
exr: ["exr"],
|
|
3132
3131
|
lottie: ["lottie.json"]
|
|
3133
3132
|
};
|
|
3134
|
-
class
|
|
3133
|
+
class si {
|
|
3135
3134
|
constructor(e) {
|
|
3136
3135
|
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = U({
|
|
3137
3136
|
simpleTexture4deleted: !1,
|
|
@@ -3160,7 +3159,7 @@ class ii {
|
|
|
3160
3159
|
const s = this.assets.get(e);
|
|
3161
3160
|
if (!s) {
|
|
3162
3161
|
if ((t === "images" || t === "media" || t === "exr") && this.options.simpleTexture4deleted && this.delLoadArr.includes(e))
|
|
3163
|
-
return new
|
|
3162
|
+
return new fe();
|
|
3164
3163
|
console.warn(`Asset ${e} not found`);
|
|
3165
3164
|
}
|
|
3166
3165
|
return s;
|
|
@@ -3174,7 +3173,7 @@ class ii {
|
|
|
3174
3173
|
if (e.endsWith("json.gzip"))
|
|
3175
3174
|
return "gzipJson";
|
|
3176
3175
|
} else return;
|
|
3177
|
-
for (const [i, r] of Object.entries(
|
|
3176
|
+
for (const [i, r] of Object.entries(ti))
|
|
3178
3177
|
if (r.includes(t))
|
|
3179
3178
|
return i;
|
|
3180
3179
|
}
|
|
@@ -3184,17 +3183,17 @@ class ii {
|
|
|
3184
3183
|
if (e === "media")
|
|
3185
3184
|
return this.videoTextureLoader || (this.videoTextureLoader = new rt(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3186
3185
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3187
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3186
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new He(this.loadingManager), this.dracoLoader = new us(), 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;
|
|
3188
3187
|
if (e === "gltf")
|
|
3189
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3188
|
+
return this.gltfLoader || (this.gltfLoader = new He(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3190
3189
|
if (e === "lottie")
|
|
3191
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
3190
|
+
return this.lottieLoader || (this.lottieLoader = new _s(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3192
3191
|
if (e === "gzipJson")
|
|
3193
|
-
return this.gzipJsonLoader || (this.gzipJsonLoader = new
|
|
3192
|
+
return this.gzipJsonLoader || (this.gzipJsonLoader = new ei(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3194
3193
|
if (e === "json")
|
|
3195
3194
|
return this.jsonLoader || (this.jsonLoader = new Ae(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3196
3195
|
if (e === "exr")
|
|
3197
|
-
return this.exrLoader || (this.exrLoader = new
|
|
3196
|
+
return this.exrLoader || (this.exrLoader = new fs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3198
3197
|
}
|
|
3199
3198
|
add(e, t) {
|
|
3200
3199
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
@@ -3213,7 +3212,7 @@ class ii {
|
|
|
3213
3212
|
get textureAssets() {
|
|
3214
3213
|
const e = /* @__PURE__ */ new Map();
|
|
3215
3214
|
return this.assets.forEach((t, s) => {
|
|
3216
|
-
(t instanceof
|
|
3215
|
+
(t instanceof fe || t instanceof ts || t instanceof pt) && e.set(s, t);
|
|
3217
3216
|
}), e;
|
|
3218
3217
|
}
|
|
3219
3218
|
loadAll() {
|
|
@@ -3230,7 +3229,7 @@ class ii {
|
|
|
3230
3229
|
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3231
3230
|
if (!s)
|
|
3232
3231
|
return;
|
|
3233
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3232
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = ps();
|
|
3234
3233
|
if (i) {
|
|
3235
3234
|
if (this.assets.has(e))
|
|
3236
3235
|
return this.assets.get(e);
|
|
@@ -3240,9 +3239,9 @@ class ii {
|
|
|
3240
3239
|
try {
|
|
3241
3240
|
const c = yield o.loadAsync(e);
|
|
3242
3241
|
if (this.assets.set(e, c), r.resolve(c), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3243
|
-
(t == null ? void 0 : t.colorCorrection) !== !1 &&
|
|
3244
|
-
const
|
|
3245
|
-
c.anisotropy =
|
|
3242
|
+
(t == null ? void 0 : t.colorCorrection) !== !1 && gs({ texture: c });
|
|
3243
|
+
const f = (a = t == null ? void 0 : t.anisotropy) != null ? a : this.options.anisotropy;
|
|
3244
|
+
c.anisotropy = f;
|
|
3246
3245
|
}
|
|
3247
3246
|
return c;
|
|
3248
3247
|
} catch (c) {
|
|
@@ -3268,8 +3267,8 @@ class ii {
|
|
|
3268
3267
|
a.aoMap
|
|
3269
3268
|
].forEach((c) => {
|
|
3270
3269
|
if (c) {
|
|
3271
|
-
const
|
|
3272
|
-
|
|
3270
|
+
const f = this.getSrcByAsset(c, s);
|
|
3271
|
+
f && t.add(f);
|
|
3273
3272
|
}
|
|
3274
3273
|
});
|
|
3275
3274
|
});
|
|
@@ -3284,10 +3283,10 @@ class ii {
|
|
|
3284
3283
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3285
3284
|
}
|
|
3286
3285
|
}
|
|
3287
|
-
const
|
|
3286
|
+
const ii = {
|
|
3288
3287
|
prefix: ""
|
|
3289
3288
|
};
|
|
3290
|
-
class
|
|
3289
|
+
class ri extends ee {
|
|
3291
3290
|
get loader() {
|
|
3292
3291
|
return this.controller;
|
|
3293
3292
|
}
|
|
@@ -3295,7 +3294,7 @@ class oi extends ee {
|
|
|
3295
3294
|
super(), this.options = e;
|
|
3296
3295
|
}
|
|
3297
3296
|
addLoader(e, t) {
|
|
3298
|
-
const { loaderParams: s } = this.options, i = new
|
|
3297
|
+
const { loaderParams: s } = this.options, i = new si(te(U({}, s), {
|
|
3299
3298
|
scene: e
|
|
3300
3299
|
}));
|
|
3301
3300
|
return this.addController(i, t);
|
|
@@ -3306,7 +3305,7 @@ class oi extends ee {
|
|
|
3306
3305
|
});
|
|
3307
3306
|
}
|
|
3308
3307
|
}
|
|
3309
|
-
class
|
|
3308
|
+
class oi {
|
|
3310
3309
|
constructor(e) {
|
|
3311
3310
|
this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
|
|
3312
3311
|
}
|
|
@@ -3410,15 +3409,15 @@ class ni {
|
|
|
3410
3409
|
if (o.hasOwnProperty("__isProxy"))
|
|
3411
3410
|
return o;
|
|
3412
3411
|
const n = new Proxy(o, {
|
|
3413
|
-
set: (a, c,
|
|
3412
|
+
set: (a, c, f) => {
|
|
3414
3413
|
if (typeof c == "string" && !isNaN(Number(c))) {
|
|
3415
3414
|
const m = Number(c);
|
|
3416
3415
|
if (m >= 0 && m < a.length) {
|
|
3417
3416
|
const v = a[m];
|
|
3418
|
-
return this.rmBaseObjectMap(e, v), a[m] =
|
|
3417
|
+
return this.rmBaseObjectMap(e, v), a[m] = f, f && this.addBaseObjectMap(e), !0;
|
|
3419
3418
|
}
|
|
3420
3419
|
}
|
|
3421
|
-
return a[c] =
|
|
3420
|
+
return a[c] = f, !0;
|
|
3422
3421
|
}
|
|
3423
3422
|
});
|
|
3424
3423
|
return Object.defineProperty(n, "__isProxy", {
|
|
@@ -3526,7 +3525,7 @@ class ni {
|
|
|
3526
3525
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3527
3526
|
}
|
|
3528
3527
|
}
|
|
3529
|
-
class
|
|
3528
|
+
class ni extends ee {
|
|
3530
3529
|
get mList() {
|
|
3531
3530
|
return this.controller;
|
|
3532
3531
|
}
|
|
@@ -3534,7 +3533,7 @@ class ai extends ee {
|
|
|
3534
3533
|
super(), this.options = e;
|
|
3535
3534
|
}
|
|
3536
3535
|
addMList(e, t) {
|
|
3537
|
-
const { pencil: s } = this.options, i = new
|
|
3536
|
+
const { pencil: s } = this.options, i = new oi(s);
|
|
3538
3537
|
return this.addController(i, t);
|
|
3539
3538
|
}
|
|
3540
3539
|
removePage(e) {
|
|
@@ -3543,19 +3542,19 @@ class ai extends ee {
|
|
|
3543
3542
|
});
|
|
3544
3543
|
}
|
|
3545
3544
|
}
|
|
3546
|
-
const
|
|
3545
|
+
const ai = {
|
|
3547
3546
|
antialias: !1,
|
|
3548
3547
|
devicePixelRatio: window.devicePixelRatio,
|
|
3549
3548
|
powerPreference: "high-performance",
|
|
3550
3549
|
toneMappingExposure: 1,
|
|
3551
3550
|
alpha: !1,
|
|
3552
|
-
outputColorSpace:
|
|
3551
|
+
outputColorSpace: ys.sRGB,
|
|
3553
3552
|
logarithmicDepthBuffer: !1,
|
|
3554
3553
|
preserveDrawingBuffer: !1,
|
|
3555
3554
|
stencil: !1,
|
|
3556
3555
|
depth: !1
|
|
3557
3556
|
};
|
|
3558
|
-
class
|
|
3557
|
+
class li {
|
|
3559
3558
|
constructor(e) {
|
|
3560
3559
|
this.options = e;
|
|
3561
3560
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
@@ -3564,11 +3563,11 @@ class hi {
|
|
|
3564
3563
|
antialias: n,
|
|
3565
3564
|
powerPreference: a,
|
|
3566
3565
|
toneMappingExposure: c,
|
|
3567
|
-
outputColorSpace:
|
|
3566
|
+
outputColorSpace: f,
|
|
3568
3567
|
logarithmicDepthBuffer: m,
|
|
3569
3568
|
preserveDrawingBuffer: v,
|
|
3570
3569
|
stencil: p,
|
|
3571
|
-
depth:
|
|
3570
|
+
depth: u
|
|
3572
3571
|
} = i, g = new ss({
|
|
3573
3572
|
alpha: r,
|
|
3574
3573
|
antialias: n,
|
|
@@ -3576,9 +3575,9 @@ class hi {
|
|
|
3576
3575
|
logarithmicDepthBuffer: m,
|
|
3577
3576
|
preserveDrawingBuffer: v,
|
|
3578
3577
|
stencil: p,
|
|
3579
|
-
depth:
|
|
3578
|
+
depth: u
|
|
3580
3579
|
});
|
|
3581
|
-
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = c, g.outputColorSpace =
|
|
3580
|
+
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = c, g.outputColorSpace = f, this.renderer = g;
|
|
3582
3581
|
}
|
|
3583
3582
|
setSize(e, t) {
|
|
3584
3583
|
this.renderer.setSize(e, t);
|
|
@@ -3599,10 +3598,10 @@ class hi {
|
|
|
3599
3598
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
3600
3599
|
}
|
|
3601
3600
|
}
|
|
3602
|
-
const
|
|
3601
|
+
const hi = {
|
|
3603
3602
|
background: null
|
|
3604
3603
|
};
|
|
3605
|
-
class
|
|
3604
|
+
class ci extends ee {
|
|
3606
3605
|
get scene() {
|
|
3607
3606
|
return this.controller;
|
|
3608
3607
|
}
|
|
@@ -3625,10 +3624,10 @@ class di extends ee {
|
|
|
3625
3624
|
});
|
|
3626
3625
|
}
|
|
3627
3626
|
}
|
|
3628
|
-
class
|
|
3627
|
+
class di {
|
|
3629
3628
|
constructor(e) {
|
|
3630
3629
|
this.event = new ye.EventEmitter();
|
|
3631
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
3630
|
+
const { renderer: t, scene: s, camera: i } = e, r = new Cs(
|
|
3632
3631
|
i,
|
|
3633
3632
|
t.domElement
|
|
3634
3633
|
);
|
|
@@ -3694,11 +3693,11 @@ class mi {
|
|
|
3694
3693
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3695
3694
|
}
|
|
3696
3695
|
}
|
|
3697
|
-
const
|
|
3696
|
+
const mi = {
|
|
3698
3697
|
antialias: !0,
|
|
3699
3698
|
devicePixelRatio: window.devicePixelRatio
|
|
3700
3699
|
};
|
|
3701
|
-
class
|
|
3700
|
+
class pi {
|
|
3702
3701
|
constructor(e) {
|
|
3703
3702
|
this.options = e;
|
|
3704
3703
|
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
|
|
@@ -3717,11 +3716,107 @@ class fi {
|
|
|
3717
3716
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
3718
3717
|
}
|
|
3719
3718
|
}
|
|
3719
|
+
class ui {
|
|
3720
|
+
/**
|
|
3721
|
+
* Constructs a new timer.
|
|
3722
|
+
*/
|
|
3723
|
+
constructor() {
|
|
3724
|
+
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;
|
|
3725
|
+
}
|
|
3726
|
+
/**
|
|
3727
|
+
* Connect the timer to the given document.Calling this method is not mandatory to
|
|
3728
|
+
* use the timer but enables the usage of the Page Visibility API to avoid large time
|
|
3729
|
+
* delta values.
|
|
3730
|
+
*
|
|
3731
|
+
* @param {Document} document - The document.
|
|
3732
|
+
*/
|
|
3733
|
+
connect(e) {
|
|
3734
|
+
this._document = e, e.hidden !== void 0 && (this._pageVisibilityHandler = fi.bind(this), e.addEventListener(
|
|
3735
|
+
"visibilitychange",
|
|
3736
|
+
this._pageVisibilityHandler,
|
|
3737
|
+
!1
|
|
3738
|
+
));
|
|
3739
|
+
}
|
|
3740
|
+
/**
|
|
3741
|
+
* Disconnects the timer from the DOM and also disables the usage of the Page Visibility API.
|
|
3742
|
+
*/
|
|
3743
|
+
disconnect() {
|
|
3744
|
+
this._pageVisibilityHandler !== null && (this._document.removeEventListener(
|
|
3745
|
+
"visibilitychange",
|
|
3746
|
+
this._pageVisibilityHandler
|
|
3747
|
+
), this._pageVisibilityHandler = null), this._document = null;
|
|
3748
|
+
}
|
|
3749
|
+
/**
|
|
3750
|
+
* Returns the time delta in seconds.
|
|
3751
|
+
*
|
|
3752
|
+
* @return {number} The time delta in second.
|
|
3753
|
+
*/
|
|
3754
|
+
getDelta() {
|
|
3755
|
+
return this._delta / 1e3;
|
|
3756
|
+
}
|
|
3757
|
+
/**
|
|
3758
|
+
* Returns the elapsed time in seconds.
|
|
3759
|
+
*
|
|
3760
|
+
* @return {number} The elapsed time in second.
|
|
3761
|
+
*/
|
|
3762
|
+
getElapsed() {
|
|
3763
|
+
return this._elapsed / 1e3;
|
|
3764
|
+
}
|
|
3765
|
+
/**
|
|
3766
|
+
* Returns the timescale.
|
|
3767
|
+
*
|
|
3768
|
+
* @return {number} The timescale.
|
|
3769
|
+
*/
|
|
3770
|
+
getTimescale() {
|
|
3771
|
+
return this._timescale;
|
|
3772
|
+
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Sets the given timescale which scale the time delta computation
|
|
3775
|
+
* in `update()`.
|
|
3776
|
+
*
|
|
3777
|
+
* @param {number} timescale - The timescale to set.
|
|
3778
|
+
* @return {Timer} A reference to this timer.
|
|
3779
|
+
*/
|
|
3780
|
+
setTimescale(e) {
|
|
3781
|
+
return this._timescale = e, this;
|
|
3782
|
+
}
|
|
3783
|
+
/**
|
|
3784
|
+
* Resets the time computation for the current simulation step.
|
|
3785
|
+
*
|
|
3786
|
+
* @return {Timer} A reference to this timer.
|
|
3787
|
+
*/
|
|
3788
|
+
reset() {
|
|
3789
|
+
return this._currentTime = performance.now() - this._startTime, this;
|
|
3790
|
+
}
|
|
3791
|
+
/**
|
|
3792
|
+
* Can be used to free all internal resources. Usually called when
|
|
3793
|
+
* the timer instance isn't required anymore.
|
|
3794
|
+
*/
|
|
3795
|
+
dispose() {
|
|
3796
|
+
this.disconnect();
|
|
3797
|
+
}
|
|
3798
|
+
/**
|
|
3799
|
+
* Updates the internal state of the timer. This method should be called
|
|
3800
|
+
* once per simulation step and before you perform queries against the timer
|
|
3801
|
+
* (e.g. via `getDelta()`).
|
|
3802
|
+
*
|
|
3803
|
+
* @param {number} timestamp - The current time in milliseconds. Can be obtained
|
|
3804
|
+
* from the `requestAnimationFrame` callback argument. If not provided, the current
|
|
3805
|
+
* time will be determined with `performance.now`.
|
|
3806
|
+
* @return {Timer} A reference to this timer.
|
|
3807
|
+
*/
|
|
3808
|
+
update(e) {
|
|
3809
|
+
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;
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
function fi() {
|
|
3813
|
+
this._document.hidden === !1 && this.reset();
|
|
3814
|
+
}
|
|
3720
3815
|
const _e = class _e {
|
|
3721
3816
|
constructor(e) {
|
|
3722
3817
|
var r, o;
|
|
3723
|
-
this.raycaster = new ct(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new
|
|
3724
|
-
isMergeableObject:
|
|
3818
|
+
this.raycaster = new ct(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ye.EventEmitter(), this.timer = new ui(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = Ut(_e.options, e, {
|
|
3819
|
+
isMergeableObject: vs
|
|
3725
3820
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3726
3821
|
const {
|
|
3727
3822
|
container: t,
|
|
@@ -3806,50 +3901,50 @@ const _e = class _e {
|
|
|
3806
3901
|
renderer: r,
|
|
3807
3902
|
controls: o,
|
|
3808
3903
|
loader: n
|
|
3809
|
-
} = this.options, { width: a, height: c } = this.getSize(),
|
|
3904
|
+
} = this.options, { width: a, height: c } = this.getSize(), f = t ? new pi({
|
|
3810
3905
|
width: a,
|
|
3811
3906
|
height: c,
|
|
3812
3907
|
//@ts-ignore
|
|
3813
3908
|
renderer: this.options.WebGPURenderer,
|
|
3814
|
-
rendererParams:
|
|
3815
|
-
}) : new
|
|
3909
|
+
rendererParams: mi
|
|
3910
|
+
}) : new li({
|
|
3816
3911
|
width: a,
|
|
3817
3912
|
height: c,
|
|
3818
3913
|
rendererParams: te(U({}, r), {
|
|
3819
3914
|
antialias: !1
|
|
3820
3915
|
})
|
|
3821
3916
|
});
|
|
3822
|
-
this.rendererController =
|
|
3823
|
-
const m = new
|
|
3917
|
+
this.rendererController = f;
|
|
3918
|
+
const m = new Ss({
|
|
3824
3919
|
width: a,
|
|
3825
3920
|
height: c
|
|
3826
|
-
}), v = new
|
|
3921
|
+
}), v = new ci({}), p = new Ys({
|
|
3827
3922
|
controlsParams: {
|
|
3828
|
-
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ :
|
|
3923
|
+
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : f.renderer.domElement
|
|
3829
3924
|
}
|
|
3830
|
-
}),
|
|
3925
|
+
}), u = new ri({
|
|
3831
3926
|
loaderParams: U({
|
|
3832
3927
|
anisotropy: this.maxAnisotropy
|
|
3833
3928
|
}, n)
|
|
3834
|
-
}), g = new
|
|
3929
|
+
}), g = new ni({
|
|
3835
3930
|
pencil: this
|
|
3836
|
-
}), y = new
|
|
3931
|
+
}), y = new Js({
|
|
3837
3932
|
pencil: this
|
|
3838
3933
|
});
|
|
3839
|
-
this.sceneController = v, this.cameraController = m, this.controlsController = p, this.loaderController =
|
|
3934
|
+
this.sceneController = v, this.cameraController = m, this.controlsController = p, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3840
3935
|
const l = this.addPage({
|
|
3841
3936
|
sceneOptions: this.options.scene,
|
|
3842
3937
|
cameraOptions: this.options.camera
|
|
3843
3938
|
});
|
|
3844
3939
|
if (this.showPage(l), s) {
|
|
3845
|
-
const O = new
|
|
3940
|
+
const O = new Xs({
|
|
3846
3941
|
container: e,
|
|
3847
3942
|
sceneController: v,
|
|
3848
3943
|
cameraController: m
|
|
3849
3944
|
});
|
|
3850
3945
|
O.add(v.scene), this.helperController = O, i && O.addViewHelper();
|
|
3851
3946
|
}
|
|
3852
|
-
e.appendChild(
|
|
3947
|
+
e.appendChild(f.renderer.domElement);
|
|
3853
3948
|
}
|
|
3854
3949
|
initComposer() {
|
|
3855
3950
|
const {
|
|
@@ -3858,7 +3953,7 @@ const _e = class _e {
|
|
|
3858
3953
|
ssao: s,
|
|
3859
3954
|
ssaoParams: i,
|
|
3860
3955
|
composer: r
|
|
3861
|
-
} = this.options, o = new
|
|
3956
|
+
} = this.options, o = new Vs({
|
|
3862
3957
|
rendererController: this.rendererController,
|
|
3863
3958
|
sceneController: this.sceneController,
|
|
3864
3959
|
cameraController: this.cameraController,
|
|
@@ -3875,12 +3970,12 @@ const _e = class _e {
|
|
|
3875
3970
|
css3DRendererParams: r
|
|
3876
3971
|
} = this.options;
|
|
3877
3972
|
if (t || s) {
|
|
3878
|
-
const o = new
|
|
3973
|
+
const o = new Gs(e);
|
|
3879
3974
|
t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
|
|
3880
3975
|
}
|
|
3881
3976
|
}
|
|
3882
3977
|
initTransformControls() {
|
|
3883
|
-
const e = new
|
|
3978
|
+
const e = new di({
|
|
3884
3979
|
camera: this.camera,
|
|
3885
3980
|
renderer: this.renderer,
|
|
3886
3981
|
scene: this.scene
|
|
@@ -3919,10 +4014,10 @@ const _e = class _e {
|
|
|
3919
4014
|
cssRendererController: n,
|
|
3920
4015
|
leadController: a
|
|
3921
4016
|
} = this, c = this.renderer.getSize(new B());
|
|
3922
|
-
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((
|
|
4017
|
+
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) => {
|
|
3923
4018
|
var m;
|
|
3924
|
-
(m =
|
|
3925
|
-
}), this.viewPadding.some((
|
|
4019
|
+
(m = f.setSize) == null || m.call(f, e, t);
|
|
4020
|
+
}), this.viewPadding.some((f) => f !== 0) && this.setViewPadding(...this.viewPadding), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3926
4021
|
}
|
|
3927
4022
|
setDevicePixelRatio(e) {
|
|
3928
4023
|
var n;
|
|
@@ -3972,8 +4067,8 @@ const _e = class _e {
|
|
|
3972
4067
|
this.event.emit("beforeRender"), this.timer.update(), Ce.update();
|
|
3973
4068
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3974
4069
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((c) => {
|
|
3975
|
-
var
|
|
3976
|
-
(
|
|
4070
|
+
var f;
|
|
4071
|
+
(f = c.update) == null || f.call(c, e, t);
|
|
3977
4072
|
}), (s = this.helperController) == null || s.update(
|
|
3978
4073
|
e,
|
|
3979
4074
|
this.controlsController,
|
|
@@ -4018,11 +4113,11 @@ const _e = class _e {
|
|
|
4018
4113
|
}
|
|
4019
4114
|
}
|
|
4020
4115
|
dispose() {
|
|
4021
|
-
var e, t, s, i, r, o, n, a, c,
|
|
4116
|
+
var e, t, s, i, r, o, n, a, c, f, m, v, p, u;
|
|
4022
4117
|
this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4023
4118
|
var y;
|
|
4024
4119
|
(y = g.dispose) == null || y.call(g);
|
|
4025
|
-
}), (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(), (
|
|
4120
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (c = this.rendererController) == null || c.dispose(), (f = this.loaderController) == null || f.dispose(), (m = this.leadController) == null || m.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (p = this.stats) == null || p.dom.remove(), (u = this.renderer) == null || u.domElement.remove();
|
|
4026
4121
|
}
|
|
4027
4122
|
};
|
|
4028
4123
|
_e.options = {
|
|
@@ -4031,15 +4126,15 @@ _e.options = {
|
|
|
4031
4126
|
viewHelper: he,
|
|
4032
4127
|
controls: !0,
|
|
4033
4128
|
transformControls: he,
|
|
4034
|
-
renderer:
|
|
4035
|
-
composer:
|
|
4036
|
-
scene:
|
|
4037
|
-
camera:
|
|
4129
|
+
renderer: ai,
|
|
4130
|
+
composer: Bs,
|
|
4131
|
+
scene: hi,
|
|
4132
|
+
camera: bt,
|
|
4038
4133
|
bloom: !1,
|
|
4039
|
-
bloomParams:
|
|
4134
|
+
bloomParams: js,
|
|
4040
4135
|
ssao: !1,
|
|
4041
|
-
loader:
|
|
4042
|
-
ssaoParams:
|
|
4136
|
+
loader: ii,
|
|
4137
|
+
ssaoParams: Is,
|
|
4043
4138
|
css2DRenderer: !1,
|
|
4044
4139
|
css2DRendererParams: U({}, st),
|
|
4045
4140
|
css3DRenderer: !1,
|
|
@@ -4048,7 +4143,7 @@ _e.options = {
|
|
|
4048
4143
|
let ot = _e;
|
|
4049
4144
|
const Gi = J.ACTION;
|
|
4050
4145
|
export {
|
|
4051
|
-
|
|
4146
|
+
os as BaseObject,
|
|
4052
4147
|
ot as Pencil,
|
|
4053
4148
|
Pe as ResourceTracker,
|
|
4054
4149
|
Gi as cameraControlsAction,
|