gl-draw 0.17.0-beta.4 → 0.17.0-beta.41
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/cartographicToCartesian.js +1 -0
- package/dist/cartographicToCartesian.module.js +49 -0
- package/dist/constants.d.ts +0 -1
- package/dist/core/BaseObject/PointerEvent.d.ts +1 -0
- package/dist/core/BaseObject/index.d.ts +16 -4
- package/dist/core/CSSRenderer/CollisionManager.d.ts +98 -0
- package/dist/core/CSSRenderer/index.d.ts +18 -6
- package/dist/core/Composer.d.ts +5 -5
- package/dist/core/Helper.d.ts +4 -4
- package/dist/core/Lead/Pick.d.ts +35 -3
- package/dist/core/Lead/index.d.ts +5 -6
- package/dist/core/Pages/Pages.d.ts +1 -0
- package/dist/core/Pencil.d.ts +19 -5
- package/dist/core/pass/OutputPass.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +708 -442
- package/dist/index.module2.js +1183 -0
- package/dist/index2.js +140 -0
- package/dist/objects/conicPolygon/geometry/index.d.ts +1 -2
- package/dist/objects/ellipsoid/createGeometry.d.ts +30 -0
- package/dist/objects/ellipsoid/index.d.ts +38 -0
- package/dist/objects/extrudePolygon/createGeometry.d.ts +2 -1
- package/dist/objects/group/index.d.ts +1 -0
- package/dist/objects/index.d.ts +1 -0
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +691 -688
- package/dist/objects/node/index.d.ts +6 -2
- package/dist/objects/pie/index.d.ts +2 -1
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
- package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/getCoordinatesArr.d.ts +5 -1
- package/dist/plugins/Worker/getAttributes/line.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/line2.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/splitPolygonsByLongitudeDifference.d.ts +5 -2
- package/dist/plugins/Worker/index.d.ts +2 -3
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +77 -70
- package/dist/utils/Sprite2Points.d.ts +1 -1
- package/dist/utils/cartographicToCartesian.d.ts +30 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +15 -13
- package/dist/utils/proposedRaycast.d.ts +1 -0
- package/package.json +1 -1
- package/dist/WebGPULineSegments2.js +0 -140
- package/dist/WebGPULineSegments2.module.js +0 -1031
- package/dist/polar2Cartesian.js +0 -1
- package/dist/polar2Cartesian.module.js +0 -18
- package/dist/utils/polar2Cartesian.d.ts +0 -1
package/dist/index.module.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Pt = Object.defineProperty, St = Object.defineProperties;
|
|
2
2
|
var At = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var De = Object.getOwnPropertySymbols;
|
|
4
4
|
var Mt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var Ue = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, D = (c, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
Mt.call(e, t) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
Rt.call(e, t) &&
|
|
7
|
+
Mt.call(e, t) && Ue(c, t, e[t]);
|
|
8
|
+
if (De)
|
|
9
|
+
for (var t of De(e))
|
|
10
|
+
Rt.call(e, t) && Ue(c, t, e[t]);
|
|
11
11
|
return c;
|
|
12
12
|
}, te = (c, e) => St(c, At(e));
|
|
13
13
|
var se = (c, e, t) => new Promise((s, i) => {
|
|
@@ -26,15 +26,15 @@ var se = (c, e, t) => new Promise((s, i) => {
|
|
|
26
26
|
}, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
27
27
|
n((t = t.apply(c, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import * as
|
|
29
|
+
import * as Oe from "@tweenjs/tween.js";
|
|
30
30
|
import Dt from "deepmerge";
|
|
31
31
|
import Ut from "stats-gl";
|
|
32
|
-
import { Vector3 as
|
|
33
|
-
import { M as
|
|
34
|
-
import { EffectComposer as
|
|
35
|
-
import { RenderPass as
|
|
36
|
-
import { SSAOPass as
|
|
37
|
-
import { UnrealBloomPass as
|
|
32
|
+
import { Vector3 as I, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as Ft, RawShaderMaterial as jt, MeshBasicMaterial as Nt, PointsMaterial as ot, SpriteMaterial as nt, Color as It, Layers as Ht, Vector2 as B, WebGLRenderTarget as Bt, HalfFloatType as Vt, MathUtils as Yt, Vector4 as Zt, Quaternion as at, Spherical as Wt, Box3 as lt, Sphere as Kt, Raycaster as ht, AxesHelper as ke, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as ze, Scene as ct, Group as Ce, Camera as Jt, Loader as dt, FileLoader as Me, Texture as fe, VideoTexture as es, LoadingManager as ts, DataTexture as ss, WebGLRenderer as is, REVISION as rs, Object3D as os, Timer as ns } from "three";
|
|
33
|
+
import { M as pt, B as as, a as ls, R as Se, I as he } from "./index.module2.js";
|
|
34
|
+
import { EffectComposer as Fe } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
|
+
import { RenderPass as hs } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
|
+
import { SSAOPass as cs } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
|
+
import { UnrealBloomPass as ds } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
38
38
|
import "three/examples/jsm/lines/LineMaterial";
|
|
39
39
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
40
40
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
@@ -45,17 +45,17 @@ import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
|
45
45
|
import "three-bvh-csg";
|
|
46
46
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
47
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
48
|
-
import { ShaderPass as
|
|
49
|
-
import { OutputPass as
|
|
50
|
-
import { FullScreenQuad as
|
|
51
|
-
import { RectAreaLightHelper as
|
|
52
|
-
import { ViewHelper as
|
|
53
|
-
import { generateUUID as
|
|
54
|
-
import { DRACOLoader as
|
|
55
|
-
import { EXRLoader as
|
|
48
|
+
import { ShaderPass as ps } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
49
|
+
import { OutputPass as ms } from "three/examples/jsm/postprocessing/OutputPass";
|
|
50
|
+
import { FullScreenQuad as je } from "three/examples/jsm/postprocessing/Pass";
|
|
51
|
+
import { RectAreaLightHelper as us } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
|
+
import { ViewHelper as fs } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
|
+
import { generateUUID as _s, makePromiseCreator as gs } from "esus-lite";
|
|
54
|
+
import { DRACOLoader as ys } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
|
+
import { EXRLoader as vs } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
56
|
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
-
import { LottieLoader as
|
|
58
|
-
import { a as Cs, C as
|
|
57
|
+
import { LottieLoader as Os } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
|
+
import { a as Cs, C as Es, i as bs } from "./isPlainObject.module.js";
|
|
59
59
|
import { TransformControls as Ts } from "three/examples/jsm/controls/TransformControls";
|
|
60
60
|
const M = {
|
|
61
61
|
LEFT: 1,
|
|
@@ -94,17 +94,17 @@ function Y(c) {
|
|
|
94
94
|
function H(c) {
|
|
95
95
|
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2, Ie = Math.PI / 2,
|
|
97
|
+
const $ = Math.PI * 2, Ie = Math.PI / 2, mt = 1e-5, ie = Math.PI / 180;
|
|
98
98
|
function z(c, e, t) {
|
|
99
99
|
return Math.max(e, Math.min(t, c));
|
|
100
100
|
}
|
|
101
|
-
function A(c, e =
|
|
101
|
+
function A(c, e = mt) {
|
|
102
102
|
return Math.abs(c) < e;
|
|
103
103
|
}
|
|
104
|
-
function P(c, e, t =
|
|
104
|
+
function P(c, e, t = mt) {
|
|
105
105
|
return A(c - e, t);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function He(c, e) {
|
|
108
108
|
return Math.round(c / e) * e;
|
|
109
109
|
}
|
|
110
110
|
function re(c) {
|
|
@@ -121,30 +121,30 @@ function ce(c, e, t, s, i = 1 / 0, r) {
|
|
|
121
121
|
h = z(h, -p, p), e = c - h;
|
|
122
122
|
const v = (t.value + o * h) * r;
|
|
123
123
|
t.value = (t.value - o * v) * a;
|
|
124
|
-
let
|
|
125
|
-
return m - c > 0 ==
|
|
124
|
+
let f = e + (h + v) * a;
|
|
125
|
+
return m - c > 0 == f > m && (f = m, t.value = (f - m) / r), f;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Be(c, e, t, s, i = 1 / 0, r, o) {
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
129
|
const n = 2 / s, a = n * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
|
-
let m = e.x, p = e.y, v = e.z,
|
|
131
|
-
const y = m, l = p,
|
|
132
|
-
if (
|
|
133
|
-
const ve = Math.sqrt(
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
m = c.x -
|
|
137
|
-
const E = (t.x + n *
|
|
138
|
-
t.x = (t.x - n * E) * h, t.y = (t.y - n *
|
|
139
|
-
const V = y - c.x, le = l - c.y,
|
|
140
|
-
return V *
|
|
130
|
+
let m = e.x, p = e.y, v = e.z, f = c.x - m, u = c.y - p, g = c.z - v;
|
|
131
|
+
const y = m, l = p, _ = v, C = i * s, O = C * C, T = f * f + u * u + g * g;
|
|
132
|
+
if (T > O) {
|
|
133
|
+
const ve = Math.sqrt(T);
|
|
134
|
+
f = f / ve * C, u = u / ve * C, g = g / ve * C;
|
|
135
|
+
}
|
|
136
|
+
m = c.x - f, p = c.y - u, v = c.z - g;
|
|
137
|
+
const E = (t.x + n * f) * r, x = (t.y + n * u) * r, R = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * h, t.y = (t.y - n * x) * h, t.z = (t.z - n * R) * h, o.x = m + (f + E) * h, o.y = p + (u + x) * h, o.z = v + (g + R) * h;
|
|
139
|
+
const V = y - c.x, le = l - c.y, Tt = _ - c.z, wt = o.x - y, xt = o.y - l, Lt = o.z - _;
|
|
140
|
+
return V * wt + le * xt + Tt * Lt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
141
141
|
}
|
|
142
142
|
function Ee(c, e) {
|
|
143
143
|
e.set(0, 0), c.forEach((t) => {
|
|
144
144
|
e.x += t.clientX, e.y += t.clientY;
|
|
145
145
|
}), e.x /= c.length, e.y /= c.length;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function be(c, e) {
|
|
148
148
|
return H(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
150
|
class ws {
|
|
@@ -212,10 +212,10 @@ class ws {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
-
let
|
|
215
|
+
let b, Ve, pe, Te, U, w, L, G, ne, F, j, Z, Ye, Ze, k, ae, X, We, we, Ke, xe, Le, me;
|
|
216
216
|
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
|
|
218
|
+
b = e.THREE, Ve = Object.freeze(new b.Vector3(0, 0, 0)), pe = Object.freeze(new b.Vector3(0, 1, 0)), Te = Object.freeze(new b.Vector3(0, 0, 1)), U = new b.Vector2(), w = new b.Vector3(), L = new b.Vector3(), G = new b.Vector3(), ne = new b.Vector3(), F = new b.Vector3(), j = new b.Vector3(), Z = new b.Vector3(), Ye = new b.Vector3(), Ze = new b.Vector3(), k = new b.Spherical(), ae = new b.Spherical(), X = new b.Box3(), We = new b.Box3(), we = new b.Sphere(), Ke = new b.Quaternion(), xe = new b.Quaternion(), Le = new b.Matrix4(), me = new b.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -243,56 +243,56 @@ class J extends ws {
|
|
|
243
243
|
*/
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
246
|
-
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new
|
|
247
|
-
let
|
|
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 b.Vector3(), this._focalOffsetVelocity = new b.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, _, C, O) => {
|
|
247
|
+
let T, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const
|
|
250
|
-
|
|
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
|
+
T = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * _ * V / this._elementRect.height;
|
|
251
251
|
} else if (H(this._camera)) {
|
|
252
|
-
const
|
|
253
|
-
|
|
252
|
+
const x = this._camera;
|
|
253
|
+
T = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * _ * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
|
-
|
|
257
|
-
this._focalOffsetEnd.x +
|
|
256
|
+
O ? (C ? this.setFocalOffset(
|
|
257
|
+
this._focalOffsetEnd.x + T,
|
|
258
258
|
this._focalOffsetEnd.y,
|
|
259
259
|
this._focalOffsetEnd.z,
|
|
260
260
|
!0
|
|
261
|
-
) : this.truck(
|
|
262
|
-
this._focalOffsetEnd.x +
|
|
261
|
+
) : this.truck(T, 0, !0), this.forward(-E, !0)) : C ? this.setFocalOffset(
|
|
262
|
+
this._focalOffsetEnd.x + T,
|
|
263
263
|
this._focalOffsetEnd.y + E,
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
|
-
) : this.truck(
|
|
267
|
-
}, this._rotateInternal = (l,
|
|
268
|
-
const
|
|
269
|
-
this.rotate(
|
|
270
|
-
}, this._dollyInternal = (l,
|
|
271
|
-
const
|
|
266
|
+
) : this.truck(T, E, !0);
|
|
267
|
+
}, this._rotateInternal = (l, _) => {
|
|
268
|
+
const C = $ * this.azimuthRotateSpeed * l / this._elementRect.height, O = $ * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
269
|
+
this.rotate(C, O, !0);
|
|
270
|
+
}, this._dollyInternal = (l, _, C) => {
|
|
271
|
+
const O = Math.pow(0.95, -l * this.dollySpeed), T = this._sphericalEnd.radius, E = this._sphericalEnd.radius * O, x = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
|
-
), R =
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(
|
|
277
|
-
}, this._zoomInternal = (l,
|
|
278
|
-
const
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E -
|
|
280
|
-
}, typeof
|
|
275
|
+
), R = x - E;
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - T, this._dollyControlCoord.set(_, C)), this._lastDollyDirection = Math.sign(-l);
|
|
277
|
+
}, this._zoomInternal = (l, _, C) => {
|
|
278
|
+
const O = Math.pow(0.95, l * this.dollySpeed), T = this._zoom, E = this._zoom * O;
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - T, this._dollyControlCoord.set(_, C));
|
|
280
|
+
}, typeof b == "undefined" && console.error(
|
|
281
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
282
|
-
), this._camera = e, this._yAxisUpSpace = new
|
|
282
|
+
), this._camera = e, this._yAxisUpSpace = new b.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
|
-
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new
|
|
286
|
-
|
|
285
|
+
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new b.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new b.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new b.Spherical().setFromVector3(
|
|
286
|
+
w.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
|
-
new
|
|
289
|
-
new
|
|
290
|
-
new
|
|
291
|
-
new
|
|
292
|
-
], this._updateNearPlaneCorners(), this._boundary = new
|
|
293
|
-
new
|
|
294
|
-
new
|
|
295
|
-
), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new
|
|
288
|
+
new b.Vector3(),
|
|
289
|
+
new b.Vector3(),
|
|
290
|
+
new b.Vector3(),
|
|
291
|
+
new b.Vector3()
|
|
292
|
+
], this._updateNearPlaneCorners(), this._boundary = new b.Box3(
|
|
293
|
+
new b.Vector3(-1 / 0, -1 / 0, -1 / 0),
|
|
294
|
+
new b.Vector3(1 / 0, 1 / 0, 1 / 0)
|
|
295
|
+
), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new b.Vector2(), this.mouseButtons = {
|
|
296
296
|
left: d.ROTATE,
|
|
297
297
|
middle: d.DOLLY,
|
|
298
298
|
right: d.TRUCK,
|
|
@@ -302,29 +302,29 @@ class J extends ws {
|
|
|
302
302
|
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : H(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
303
303
|
three: d.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
|
-
const s = new
|
|
305
|
+
const s = new b.Vector2(), i = new b.Vector2(), r = new b.Vector2(), o = (l) => {
|
|
306
306
|
if (!this._enabled || !this._domElement) return;
|
|
307
307
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
308
|
+
const O = this._domElement.getBoundingClientRect(), T = (l.clientX - O.left) / (O.right - O.left), E = (l.clientY - O.top) / (O.bottom - O.top);
|
|
309
|
+
if (T < this._interactiveArea.left || T > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
const
|
|
315
|
-
|
|
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;
|
|
313
|
+
if (_ !== null) {
|
|
314
|
+
const O = this._findPointerByMouseButton(_);
|
|
315
|
+
O && this._disposePointer(O);
|
|
316
316
|
}
|
|
317
317
|
if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
318
318
|
return;
|
|
319
|
-
const
|
|
319
|
+
const C = {
|
|
320
320
|
pointerId: l.pointerId,
|
|
321
321
|
clientX: l.clientX,
|
|
322
322
|
clientY: l.clientY,
|
|
323
323
|
deltaX: 0,
|
|
324
324
|
deltaY: 0,
|
|
325
|
-
mouseButton:
|
|
325
|
+
mouseButton: _
|
|
326
326
|
};
|
|
327
|
-
this._activePointers.push(
|
|
327
|
+
this._activePointers.push(C), this._domElement.ownerDocument.removeEventListener(
|
|
328
328
|
"pointermove",
|
|
329
329
|
n,
|
|
330
330
|
{ passive: !1 }
|
|
@@ -338,9 +338,9 @@ class J extends ws {
|
|
|
338
338
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, v(l);
|
|
339
339
|
}, n = (l) => {
|
|
340
340
|
l.cancelable && l.preventDefault();
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
if (
|
|
341
|
+
const _ = l.pointerId, C = this._lockedPointer || this._findPointerById(_);
|
|
342
|
+
if (C) {
|
|
343
|
+
if (C.clientX = l.clientX, C.clientY = l.clientY, C.deltaX = l.movementX, C.deltaY = l.movementY, this._state = 0, l.pointerType === "touch")
|
|
344
344
|
switch (this._activePointers.length) {
|
|
345
345
|
case 1:
|
|
346
346
|
this._state = this.touches.one;
|
|
@@ -354,12 +354,12 @@ class J extends ws {
|
|
|
354
354
|
}
|
|
355
355
|
else
|
|
356
356
|
(!this._isDragging && this._lockedPointer || this._isDragging && (l.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
357
|
-
|
|
357
|
+
f();
|
|
358
358
|
}
|
|
359
359
|
}, a = (l) => {
|
|
360
|
-
const
|
|
361
|
-
if (!(
|
|
362
|
-
if (
|
|
360
|
+
const _ = this._findPointerById(l.pointerId);
|
|
361
|
+
if (!(_ && _ === this._lockedPointer)) {
|
|
362
|
+
if (_ && this._disposePointer(_), l.pointerType === "touch")
|
|
363
363
|
switch (this._activePointers.length) {
|
|
364
364
|
case 0:
|
|
365
365
|
this._state = d.NONE;
|
|
@@ -383,15 +383,15 @@ class J extends ws {
|
|
|
383
383
|
const m = (l) => {
|
|
384
384
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
385
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
386
|
-
const E = this._domElement.getBoundingClientRect(),
|
|
387
|
-
if (
|
|
386
|
+
const E = this._domElement.getBoundingClientRect(), x = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
387
|
+
if (x < this._interactiveArea.left || x > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
|
|
391
391
|
const E = performance.now();
|
|
392
392
|
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const _ = xs ? -1 : -3, C = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), O = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, T = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
396
|
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -410,11 +410,11 @@ class J extends ws {
|
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
412
|
case d.DOLLY: {
|
|
413
|
-
this._dollyInternal(-
|
|
413
|
+
this._dollyInternal(-C, O, T), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
416
|
case d.ZOOM: {
|
|
417
|
-
this._zoomInternal(-
|
|
417
|
+
this._zoomInternal(-C, O, T), this._isUserControllingZoom = !0;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
@@ -422,8 +422,8 @@ class J extends ws {
|
|
|
422
422
|
}, p = (l) => {
|
|
423
423
|
if (!(!this._domElement || !this._enabled)) {
|
|
424
424
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
425
|
-
const
|
|
426
|
-
|
|
425
|
+
const _ = l instanceof PointerEvent ? l.pointerId : 0, C = this._findPointerById(_);
|
|
426
|
+
C && this._disposePointer(C), this._domElement.ownerDocument.removeEventListener(
|
|
427
427
|
"pointermove",
|
|
428
428
|
n,
|
|
429
429
|
{ passive: !1 }
|
|
@@ -437,11 +437,11 @@ class J extends ws {
|
|
|
437
437
|
}
|
|
438
438
|
}, v = (l) => {
|
|
439
439
|
if (!this._enabled) return;
|
|
440
|
-
if (Ee(this._activePointers,
|
|
441
|
-
const
|
|
442
|
-
r.set(0,
|
|
443
|
-
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
444
|
-
i.set(E,
|
|
440
|
+
if (Ee(this._activePointers, U), this._getClientRect(this._elementRect), s.copy(U), i.copy(U), this._activePointers.length >= 2) {
|
|
441
|
+
const C = U.x - this._activePointers[1].clientX, O = U.y - this._activePointers[1].clientY, T = Math.sqrt(C * C + O * O);
|
|
442
|
+
r.set(0, T);
|
|
443
|
+
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
444
|
+
i.set(E, x);
|
|
445
445
|
}
|
|
446
446
|
if (this._state = 0, !l)
|
|
447
447
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
@@ -460,31 +460,31 @@ class J extends ws {
|
|
|
460
460
|
else
|
|
461
461
|
!this._lockedPointer && (l.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
462
462
|
((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & d.TRUCK) === d.TRUCK || (this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & d.DOLLY) === d.DOLLY || (this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & d.ZOOM) === d.ZOOM || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
463
|
-
},
|
|
463
|
+
}, f = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
|
-
this._dragNeedsUpdate = !1, Ee(this._activePointers,
|
|
466
|
-
const
|
|
467
|
-
if (i.copy(
|
|
468
|
-
const
|
|
465
|
+
this._dragNeedsUpdate = !1, Ee(this._activePointers, U);
|
|
466
|
+
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, C = _ ? -_.deltaX : i.x - U.x, O = _ ? -_.deltaY : i.y - U.y;
|
|
467
|
+
if (i.copy(U), ((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(C, O), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
+
const T = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
|
|
469
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
470
|
-
|
|
471
|
-
|
|
470
|
+
x * O * de,
|
|
471
|
+
T,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
x * O * de,
|
|
475
|
+
T,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
479
|
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
480
|
-
const
|
|
481
|
-
r.set(0,
|
|
480
|
+
const T = U.x - this._activePointers[1].clientX, E = U.y - this._activePointers[1].clientY, x = Math.sqrt(T * T + E * E), R = r.y - x;
|
|
481
|
+
r.set(0, x);
|
|
482
482
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
483
483
|
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
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(
|
|
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(C, O, !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(C, O, !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(C, O, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
486
|
}, u = () => {
|
|
487
|
-
Ee(this._activePointers,
|
|
487
|
+
Ee(this._activePointers, U), i.copy(U), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener(
|
|
488
488
|
"pointermove",
|
|
489
489
|
n,
|
|
490
490
|
{ passive: !1 }
|
|
@@ -520,11 +520,11 @@ class J extends ws {
|
|
|
520
520
|
{ passive: !1 }
|
|
521
521
|
), this._domElement.ownerDocument.addEventListener("pointerup", a), v());
|
|
522
522
|
}, this.unlockPointer = () => {
|
|
523
|
-
var l,
|
|
524
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (
|
|
523
|
+
var l, _, C;
|
|
524
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
|
|
525
525
|
"pointerlockchange",
|
|
526
526
|
g
|
|
527
|
-
), (
|
|
527
|
+
), (C = this._domElement) === null || C === void 0 || C.ownerDocument.removeEventListener(
|
|
528
528
|
"pointerlockerror",
|
|
529
529
|
y
|
|
530
530
|
), this.cancel();
|
|
@@ -899,8 +899,8 @@ class J extends ws {
|
|
|
899
899
|
* @category Methods
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
|
-
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0),
|
|
903
|
-
const i =
|
|
902
|
+
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), j.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), j.multiplyScalar(-t);
|
|
903
|
+
const i = w.copy(F).add(j), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -910,8 +910,8 @@ class J extends ws {
|
|
|
910
910
|
* @category Methods
|
|
911
911
|
*/
|
|
912
912
|
forward(e, t = !1) {
|
|
913
|
-
|
|
914
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
w.setFromMatrixColumn(this._camera.matrix, 0), w.crossVectors(this._camera.up, w), w.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(w);
|
|
915
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -921,10 +921,10 @@ class J extends ws {
|
|
|
921
921
|
* @category Methods
|
|
922
922
|
*/
|
|
923
923
|
elevate(e, t = !1) {
|
|
924
|
-
return
|
|
925
|
-
this._targetEnd.x +
|
|
926
|
-
this._targetEnd.y +
|
|
927
|
-
this._targetEnd.z +
|
|
924
|
+
return 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,
|
|
928
928
|
t
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -938,7 +938,7 @@ class J extends ws {
|
|
|
938
938
|
*/
|
|
939
939
|
moveTo(e, t, s, i = !1) {
|
|
940
940
|
this._isUserControllingTruck = !1;
|
|
941
|
-
const r =
|
|
941
|
+
const r = w.set(e, t, s).sub(this._targetEnd);
|
|
942
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
943
943
|
const o = !i || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
944
944
|
return this._createOnRestPromise(o);
|
|
@@ -953,7 +953,7 @@ class J extends ws {
|
|
|
953
953
|
* @category Methods
|
|
954
954
|
*/
|
|
955
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
956
|
-
const n =
|
|
956
|
+
const n = w.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
957
957
|
return this.setPosition(
|
|
958
958
|
n.x,
|
|
959
959
|
n.y,
|
|
@@ -985,15 +985,15 @@ class J extends ws {
|
|
|
985
985
|
h.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const m =
|
|
988
|
+
const m = He(this._sphericalEnd.theta, Ie), p = He(this._sphericalEnd.phi, Ie);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const v =
|
|
991
|
-
u &&
|
|
992
|
-
const g =
|
|
993
|
-
L.copy(h.min).applyQuaternion(
|
|
994
|
-
const y = g.getSize(
|
|
990
|
+
const v = w.setFromSpherical(this._sphericalEnd).normalize(), f = Ke.setFromUnitVectors(v, Te), u = P(Math.abs(v.y), 1);
|
|
991
|
+
u && f.multiply(xe.setFromAxisAngle(pe, m)), f.multiply(this._yAxisUpSpaceInverse);
|
|
992
|
+
const g = We.makeEmpty();
|
|
993
|
+
L.copy(h.min).applyQuaternion(f), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(f), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(f), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).applyQuaternion(f), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, f.setFromUnitVectors(Te, v), u && f.premultiply(xe.invert()), f.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(w), l = g.getCenter(L).applyQuaternion(f);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
|
-
const
|
|
996
|
+
const _ = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
998
998
|
y.y,
|
|
999
999
|
y.z,
|
|
@@ -1001,12 +1001,12 @@ class J extends ws {
|
|
|
1001
1001
|
);
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
|
-
), a.push(this.dollyTo(
|
|
1004
|
+
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
1005
|
} else if (H(this._camera)) {
|
|
1006
|
-
const
|
|
1006
|
+
const _ = this._camera, C = _.right - _.left, O = _.top - _.bottom, T = s ? Math.max(C / y.x, O / y.y) : Math.min(C / y.x, O / y.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1009
|
-
), a.push(this.zoomTo(
|
|
1009
|
+
), a.push(this.zoomTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1010
1010
|
}
|
|
1011
1011
|
return Promise.all(a);
|
|
1012
1012
|
}
|
|
@@ -1017,7 +1017,7 @@ class J extends ws {
|
|
|
1017
1017
|
* @category Methods
|
|
1018
1018
|
*/
|
|
1019
1019
|
fitToSphere(e, t) {
|
|
1020
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1020
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, we) : we.copy(e);
|
|
1021
1021
|
if (s.push(
|
|
1022
1022
|
this.moveTo(
|
|
1023
1023
|
r.center.x,
|
|
@@ -1047,7 +1047,7 @@ class J extends ws {
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1049
1049
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1050
|
-
const a = L.set(i, r, o), h =
|
|
1050
|
+
const a = L.set(i, r, o), h = w.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
1052
|
h.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -1084,21 +1084,21 @@ class J extends ws {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, f, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g =
|
|
1089
|
+
const g = w.set(i, r, o), y = L.set(e, t, s);
|
|
1090
1090
|
k.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(m, p, v),
|
|
1093
|
+
const l = G.set(m, p, v), _ = L.set(n, a, h);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
|
-
|
|
1096
|
-
), this._targetEnd.copy(g.lerp(l,
|
|
1097
|
-
const
|
|
1095
|
+
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
|
+
), this._targetEnd.copy(g.lerp(l, f));
|
|
1097
|
+
const C = ae.theta - k.theta, O = ae.phi - k.phi, T = ae.radius - k.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
k.radius +
|
|
1100
|
-
k.phi +
|
|
1101
|
-
k.theta +
|
|
1099
|
+
k.radius + T * f,
|
|
1100
|
+
k.phi + O * f,
|
|
1101
|
+
k.theta + C * f
|
|
1102
1102
|
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
1103
|
const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
@@ -1145,7 +1145,7 @@ class J extends ws {
|
|
|
1145
1145
|
* @category Methods
|
|
1146
1146
|
*/
|
|
1147
1147
|
setTarget(e, t, s, i = !1) {
|
|
1148
|
-
const r = this.getPosition(
|
|
1148
|
+
const r = this.getPosition(w), o = this.setLookAt(
|
|
1149
1149
|
r.x,
|
|
1150
1150
|
r.y,
|
|
1151
1151
|
r.z,
|
|
@@ -1194,9 +1194,9 @@ class J extends ws {
|
|
|
1194
1194
|
* @category Methods
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
|
-
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0),
|
|
1198
|
-
const i =
|
|
1199
|
-
F.multiplyScalar(o.x),
|
|
1197
|
+
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), j.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
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), j.multiplyScalar(o.y), Z.multiplyScalar(o.z), w.copy(F).add(j).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);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1224,7 +1224,7 @@ class J extends ws {
|
|
|
1224
1224
|
this._viewport = null;
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
1227
|
-
this._viewport = this._viewport || new
|
|
1227
|
+
this._viewport = this._viewport || new b.Vector4(), typeof e == "number" ? this._viewport.set(e, t, s, i) : this._viewport.copy(e);
|
|
1228
1228
|
}
|
|
1229
1229
|
/**
|
|
1230
1230
|
* Calculate the distance to fit the box.
|
|
@@ -1235,7 +1235,7 @@ class J extends ws {
|
|
|
1235
1235
|
* @category Methods
|
|
1236
1236
|
*/
|
|
1237
1237
|
getDistanceToFitBox(e, t, s, i = !1) {
|
|
1238
|
-
if (
|
|
1238
|
+
if (be(this._camera, "getDistanceToFitBox"))
|
|
1239
1239
|
return this._spherical.radius;
|
|
1240
1240
|
const r = e / t, o = this._camera.getEffectiveFOV() * ie, n = this._camera.aspect;
|
|
1241
1241
|
return ((i ? r > n : r < n) ? t : e / n) * 0.5 / Math.tan(o * 0.5) + s * 0.5;
|
|
@@ -1247,7 +1247,7 @@ class J extends ws {
|
|
|
1247
1247
|
* @category Methods
|
|
1248
1248
|
*/
|
|
1249
1249
|
getDistanceToFitSphere(e) {
|
|
1250
|
-
if (
|
|
1250
|
+
if (be(this._camera, "getDistanceToFitSphere"))
|
|
1251
1251
|
return this._spherical.radius;
|
|
1252
1252
|
const t = this._camera.getEffectiveFOV() * ie, s = Math.atan(Math.tan(t * 0.5) * this._camera.aspect) * 2, i = 1 < this._camera.aspect ? t : s;
|
|
1253
1253
|
return e / Math.sin(i * 0.5);
|
|
@@ -1259,7 +1259,7 @@ class J extends ws {
|
|
|
1259
1259
|
* @category Methods
|
|
1260
1260
|
*/
|
|
1261
1261
|
getTarget(e, t = !0) {
|
|
1262
|
-
return (e && e.isVector3 ? e : new
|
|
1262
|
+
return (e && e.isVector3 ? e : new b.Vector3()).copy(t ? this._targetEnd : this._target);
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Returns the camera position.
|
|
@@ -1268,7 +1268,7 @@ class J extends ws {
|
|
|
1268
1268
|
* @category Methods
|
|
1269
1269
|
*/
|
|
1270
1270
|
getPosition(e, t = !0) {
|
|
1271
|
-
return (e && e.isVector3 ? e : new
|
|
1271
|
+
return (e && e.isVector3 ? e : new b.Vector3()).setFromSpherical(t ? this._sphericalEnd : this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t ? this._targetEnd : this._target);
|
|
1272
1272
|
}
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Returns the spherical coordinates of the orbit.
|
|
@@ -1277,7 +1277,7 @@ class J extends ws {
|
|
|
1277
1277
|
* @category Methods
|
|
1278
1278
|
*/
|
|
1279
1279
|
getSpherical(e, t = !0) {
|
|
1280
|
-
return (e || new
|
|
1280
|
+
return (e || new b.Spherical()).copy(t ? this._sphericalEnd : this._spherical);
|
|
1281
1281
|
}
|
|
1282
1282
|
/**
|
|
1283
1283
|
* Returns the focal offset, which is how much the camera appears to be translated in screen parallel coordinates.
|
|
@@ -1286,7 +1286,7 @@ class J extends ws {
|
|
|
1286
1286
|
* @category Methods
|
|
1287
1287
|
*/
|
|
1288
1288
|
getFocalOffset(e, t = !0) {
|
|
1289
|
-
return (e && e.isVector3 ? e : new
|
|
1289
|
+
return (e && e.isVector3 ? e : new b.Vector3()).copy(
|
|
1290
1290
|
t ? this._focalOffsetEnd : this._focalOffset
|
|
1291
1291
|
);
|
|
1292
1292
|
}
|
|
@@ -1311,7 +1311,7 @@ class J extends ws {
|
|
|
1311
1311
|
reset(e = !1) {
|
|
1312
1312
|
if (!P(this._camera.up.x, this._cameraUp0.x) || !P(this._camera.up.y, this._cameraUp0.y) || !P(this._camera.up.z, this._cameraUp0.z)) {
|
|
1313
1313
|
this._camera.up.copy(this._cameraUp0);
|
|
1314
|
-
const s = this.getPosition(
|
|
1314
|
+
const s = this.getPosition(w);
|
|
1315
1315
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1316
1316
|
}
|
|
1317
1317
|
const t = [
|
|
@@ -1355,9 +1355,9 @@ class J extends ws {
|
|
|
1355
1355
|
* @category Methods
|
|
1356
1356
|
*/
|
|
1357
1357
|
applyCameraUp() {
|
|
1358
|
-
const e =
|
|
1358
|
+
const e = w.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1359
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1360
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(w);
|
|
1361
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
@@ -1368,7 +1368,7 @@ class J extends ws {
|
|
|
1368
1368
|
* @category Methods
|
|
1369
1369
|
*/
|
|
1370
1370
|
update(e) {
|
|
1371
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r =
|
|
1371
|
+
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r = Ye.subVectors(this._targetEnd, this._target), o = Ze.subVectors(
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
@@ -1415,7 +1415,7 @@ class J extends ws {
|
|
|
1415
1415
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1416
1416
|
else {
|
|
1417
1417
|
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1418
|
-
|
|
1418
|
+
Be(
|
|
1419
1419
|
this._target,
|
|
1420
1420
|
this._targetEnd,
|
|
1421
1421
|
this._targetVelocity,
|
|
@@ -1429,7 +1429,7 @@ class J extends ws {
|
|
|
1429
1429
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1430
1430
|
else {
|
|
1431
1431
|
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1432
|
-
|
|
1432
|
+
Be(
|
|
1433
1433
|
this._focalOffset,
|
|
1434
1434
|
this._focalOffsetEnd,
|
|
1435
1435
|
this._focalOffsetVelocity,
|
|
@@ -1454,41 +1454,41 @@ class J extends ws {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const p = this._spherical.radius - this._lastDistance, v = this._camera,
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, f = this._getCameraDirection(ne), u = w.copy(f).cross(v.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
-
const g = L.crossVectors(u,
|
|
1459
|
+
const g = L.crossVectors(u, f), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, C = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
1461
1461
|
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
),
|
|
1466
|
-
if (this.infinityDolly && (
|
|
1465
|
+
), O = w.copy(this._targetEnd).lerp(C, _), T = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
|
+
if (this.infinityDolly && (T || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
-
const R = L.copy(
|
|
1469
|
-
|
|
1468
|
+
const R = L.copy(f).multiplyScalar(-p);
|
|
1469
|
+
O.add(R);
|
|
1470
1470
|
}
|
|
1471
|
-
this._boundary.clampPoint(
|
|
1472
|
-
const
|
|
1473
|
-
this._targetEnd.copy(
|
|
1471
|
+
this._boundary.clampPoint(O, O);
|
|
1472
|
+
const x = L.subVectors(O, this._targetEnd);
|
|
1473
|
+
this._targetEnd.copy(O), this._target.add(x), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
1474
|
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera,
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, f = w.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(
|
|
1480
|
-
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(f).add(u.multiplyScalar(-f.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), C = this._targetEnd.dot(_), O = w.copy(this._targetEnd).lerp(g, l), T = O.dot(_), E = _.multiplyScalar(
|
|
1480
|
+
T - C
|
|
1481
1481
|
);
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1484
|
-
this._targetEnd.copy(
|
|
1482
|
+
O.sub(E), this._boundary.clampPoint(O, O);
|
|
1483
|
+
const x = L.subVectors(O, this._targetEnd);
|
|
1484
|
+
this._targetEnd.copy(O), this._target.add(x), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1488
1488
|
const a = this._collisionTest();
|
|
1489
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0),
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), j.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), j.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(F).add(j).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
|
-
|
|
1491
|
+
w.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const m = this._needsUpdate;
|
|
@@ -1515,7 +1515,7 @@ class J extends ws {
|
|
|
1515
1515
|
truckSpeed: this.truckSpeed,
|
|
1516
1516
|
dollyToCursor: this.dollyToCursor,
|
|
1517
1517
|
target: this._targetEnd.toArray(),
|
|
1518
|
-
position:
|
|
1518
|
+
position: w.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1519
1519
|
zoom: this._zoomEnd,
|
|
1520
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1521
1521
|
target0: this._target0.toArray(),
|
|
@@ -1533,7 +1533,7 @@ class J extends ws {
|
|
|
1533
1533
|
fromJSON(e, t = !1) {
|
|
1534
1534
|
const s = JSON.parse(e);
|
|
1535
1535
|
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), k.setFromVector3(
|
|
1536
|
-
|
|
1536
|
+
w.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1537
1537
|
), this.rotateTo(k.theta, k.phi, t), this.dollyTo(k.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1538
1538
|
s.focalOffset[0],
|
|
1539
1539
|
s.focalOffset[1],
|
|
@@ -1614,10 +1614,10 @@ class J extends ws {
|
|
|
1614
1614
|
// lateUpdate
|
|
1615
1615
|
_collisionTest() {
|
|
1616
1616
|
let e = 1 / 0;
|
|
1617
|
-
if (!(this.colliderMeshes.length >= 1) ||
|
|
1617
|
+
if (!(this.colliderMeshes.length >= 1) || be(this._camera, "_collisionTest"))
|
|
1618
1618
|
return e;
|
|
1619
1619
|
const s = this._getTargetDirection(ne);
|
|
1620
|
-
Le.lookAt(
|
|
1620
|
+
Le.lookAt(Ve, s, this._camera.up);
|
|
1621
1621
|
for (let i = 0; i < 4; i++) {
|
|
1622
1622
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1623
1623
|
r.applyMatrix4(Le);
|
|
@@ -1689,7 +1689,7 @@ class J extends ws {
|
|
|
1689
1689
|
".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."
|
|
1690
1690
|
);
|
|
1691
1691
|
}
|
|
1692
|
-
static createBoundingSphere(e, t = new
|
|
1692
|
+
static createBoundingSphere(e, t = new b.Sphere()) {
|
|
1693
1693
|
const s = t, i = s.center;
|
|
1694
1694
|
X.makeEmpty(), e.traverseVisible((o) => {
|
|
1695
1695
|
o.isMesh && X.expandByObject(o);
|
|
@@ -1703,11 +1703,11 @@ class J extends ws {
|
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
1704
|
const m = a.attributes.position;
|
|
1705
1705
|
for (let p = 0, v = m.count; p < v; p++)
|
|
1706
|
-
|
|
1706
|
+
w.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(w));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
var
|
|
1710
|
+
var Re = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, $e = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1711
1711
|
return Function.prototype.apply.call(e, t, s);
|
|
1712
1712
|
}, ue;
|
|
1713
1713
|
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
@@ -1715,22 +1715,22 @@ Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymb
|
|
|
1715
1715
|
} : ue = function(e) {
|
|
1716
1716
|
return Object.getOwnPropertyNames(e);
|
|
1717
1717
|
};
|
|
1718
|
-
function
|
|
1718
|
+
function Ls(c) {
|
|
1719
1719
|
console && console.warn && console.warn(c);
|
|
1720
1720
|
}
|
|
1721
|
-
var
|
|
1721
|
+
var ut = Number.isNaN || function(e) {
|
|
1722
1722
|
return e !== e;
|
|
1723
1723
|
};
|
|
1724
1724
|
function S() {
|
|
1725
1725
|
S.init.call(this);
|
|
1726
1726
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1727
|
+
Re.exports = S;
|
|
1728
|
+
Re.exports.once = Ms;
|
|
1729
1729
|
S.EventEmitter = S;
|
|
1730
1730
|
S.prototype._events = void 0;
|
|
1731
1731
|
S.prototype._eventsCount = 0;
|
|
1732
1732
|
S.prototype._maxListeners = void 0;
|
|
1733
|
-
var
|
|
1733
|
+
var Ge = 10;
|
|
1734
1734
|
function ge(c) {
|
|
1735
1735
|
if (typeof c != "function")
|
|
1736
1736
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof c);
|
|
@@ -1738,27 +1738,27 @@ function ge(c) {
|
|
|
1738
1738
|
Object.defineProperty(S, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
|
-
return
|
|
1741
|
+
return Ge;
|
|
1742
1742
|
},
|
|
1743
1743
|
set: function(c) {
|
|
1744
|
-
if (typeof c != "number" || c < 0 ||
|
|
1744
|
+
if (typeof c != "number" || c < 0 || ut(c))
|
|
1745
1745
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + c + ".");
|
|
1746
|
-
|
|
1746
|
+
Ge = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
S.init = function() {
|
|
1750
1750
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
1751
1751
|
};
|
|
1752
1752
|
S.prototype.setMaxListeners = function(e) {
|
|
1753
|
-
if (typeof e != "number" || e < 0 ||
|
|
1753
|
+
if (typeof e != "number" || e < 0 || ut(e))
|
|
1754
1754
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1755
1755
|
return this._maxListeners = e, this;
|
|
1756
1756
|
};
|
|
1757
|
-
function
|
|
1757
|
+
function ft(c) {
|
|
1758
1758
|
return c._maxListeners === void 0 ? S.defaultMaxListeners : c._maxListeners;
|
|
1759
1759
|
}
|
|
1760
1760
|
S.prototype.getMaxListeners = function() {
|
|
1761
|
-
return
|
|
1761
|
+
return ft(this);
|
|
1762
1762
|
};
|
|
1763
1763
|
S.prototype.emit = function(e) {
|
|
1764
1764
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
@@ -1778,13 +1778,13 @@ S.prototype.emit = function(e) {
|
|
|
1778
1778
|
if (a === void 0)
|
|
1779
1779
|
return !1;
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
|
-
|
|
1781
|
+
$e(a, this, t);
|
|
1782
1782
|
else
|
|
1783
1783
|
for (var h = a.length, m = Ot(a, h), s = 0; s < h; ++s)
|
|
1784
|
-
|
|
1784
|
+
$e(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
|
-
function
|
|
1787
|
+
function _t(c, e, t, s) {
|
|
1788
1788
|
var i, r, o;
|
|
1789
1789
|
if (ge(t), r = c._events, r === void 0 ? (r = c._events = /* @__PURE__ */ Object.create(null), c._eventsCount = 0) : (r.newListener !== void 0 && (c.emit(
|
|
1790
1790
|
"newListener",
|
|
@@ -1792,33 +1792,33 @@ function gt(c, e, t, s) {
|
|
|
1792
1792
|
t.listener ? t.listener : t
|
|
1793
1793
|
), r = c._events), o = r[e]), o === void 0)
|
|
1794
1794
|
o = r[e] = t, ++c._eventsCount;
|
|
1795
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i =
|
|
1795
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = ft(c), i > 0 && o.length > i && !o.warned) {
|
|
1796
1796
|
o.warned = !0;
|
|
1797
1797
|
var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1798
|
-
n.name = "MaxListenersExceededWarning", n.emitter = c, n.type = e, n.count = o.length,
|
|
1798
|
+
n.name = "MaxListenersExceededWarning", n.emitter = c, n.type = e, n.count = o.length, Ls(n);
|
|
1799
1799
|
}
|
|
1800
1800
|
return c;
|
|
1801
1801
|
}
|
|
1802
1802
|
S.prototype.addListener = function(e, t) {
|
|
1803
|
-
return
|
|
1803
|
+
return _t(this, e, t, !1);
|
|
1804
1804
|
};
|
|
1805
1805
|
S.prototype.on = S.prototype.addListener;
|
|
1806
1806
|
S.prototype.prependListener = function(e, t) {
|
|
1807
|
-
return
|
|
1807
|
+
return _t(this, e, t, !0);
|
|
1808
1808
|
};
|
|
1809
|
-
function
|
|
1809
|
+
function Ps() {
|
|
1810
1810
|
if (!this.fired)
|
|
1811
1811
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1814
|
-
var s = { fired: !1, wrapFn: void 0, target: c, type: e, listener: t }, i =
|
|
1813
|
+
function gt(c, e, t) {
|
|
1814
|
+
var s = { fired: !1, wrapFn: void 0, target: c, type: e, listener: t }, i = Ps.bind(s);
|
|
1815
1815
|
return i.listener = t, s.wrapFn = i, i;
|
|
1816
1816
|
}
|
|
1817
1817
|
S.prototype.once = function(e, t) {
|
|
1818
|
-
return ge(t), this.on(e,
|
|
1818
|
+
return ge(t), this.on(e, gt(this, e, t)), this;
|
|
1819
1819
|
};
|
|
1820
1820
|
S.prototype.prependOnceListener = function(e, t) {
|
|
1821
|
-
return ge(t), this.prependListener(e,
|
|
1821
|
+
return ge(t), this.prependListener(e, gt(this, e, t)), this;
|
|
1822
1822
|
};
|
|
1823
1823
|
S.prototype.removeListener = function(e, t) {
|
|
1824
1824
|
var s, i, r, o, n;
|
|
@@ -1836,7 +1836,7 @@ S.prototype.removeListener = function(e, t) {
|
|
|
1836
1836
|
}
|
|
1837
1837
|
if (r < 0)
|
|
1838
1838
|
return this;
|
|
1839
|
-
r === 0 ? s.shift() :
|
|
1839
|
+
r === 0 ? s.shift() : Ss(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, n || t);
|
|
1840
1840
|
}
|
|
1841
1841
|
return this;
|
|
1842
1842
|
};
|
|
@@ -1860,24 +1860,24 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1863
|
+
function yt(c, e, t) {
|
|
1864
1864
|
var s = c._events;
|
|
1865
1865
|
if (s === void 0)
|
|
1866
1866
|
return [];
|
|
1867
1867
|
var i = s[e];
|
|
1868
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ?
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? As(i) : Ot(i, i.length);
|
|
1869
1869
|
}
|
|
1870
1870
|
S.prototype.listeners = function(e) {
|
|
1871
|
-
return
|
|
1871
|
+
return yt(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
1873
|
S.prototype.rawListeners = function(e) {
|
|
1874
|
-
return
|
|
1874
|
+
return yt(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
1876
|
S.listenerCount = function(c, e) {
|
|
1877
|
-
return typeof c.listenerCount == "function" ? c.listenerCount(e) :
|
|
1877
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(e) : vt.call(c, e);
|
|
1878
1878
|
};
|
|
1879
|
-
S.prototype.listenerCount =
|
|
1880
|
-
function
|
|
1879
|
+
S.prototype.listenerCount = vt;
|
|
1880
|
+
function vt(c) {
|
|
1881
1881
|
var e = this._events;
|
|
1882
1882
|
if (e !== void 0) {
|
|
1883
1883
|
var t = e[c];
|
|
@@ -1896,17 +1896,17 @@ function Ot(c, e) {
|
|
|
1896
1896
|
t[s] = c[s];
|
|
1897
1897
|
return t;
|
|
1898
1898
|
}
|
|
1899
|
-
function
|
|
1899
|
+
function Ss(c, e) {
|
|
1900
1900
|
for (; e + 1 < c.length; e++)
|
|
1901
1901
|
c[e] = c[e + 1];
|
|
1902
1902
|
c.pop();
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function As(c) {
|
|
1905
1905
|
for (var e = new Array(c.length), t = 0; t < e.length; ++t)
|
|
1906
1906
|
e[t] = c[t].listener || c[t];
|
|
1907
1907
|
return e;
|
|
1908
1908
|
}
|
|
1909
|
-
function
|
|
1909
|
+
function Ms(c, e) {
|
|
1910
1910
|
return new Promise(function(t, s) {
|
|
1911
1911
|
function i(o) {
|
|
1912
1912
|
c.removeListener(e, r), s(o);
|
|
@@ -1914,13 +1914,13 @@ function As(c, e) {
|
|
|
1914
1914
|
function r() {
|
|
1915
1915
|
typeof c.removeListener == "function" && c.removeListener("error", i), t([].slice.call(arguments));
|
|
1916
1916
|
}
|
|
1917
|
-
|
|
1917
|
+
Ct(c, e, r, { once: !0 }), e !== "error" && Rs(c, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
|
-
function
|
|
1921
|
-
typeof c.on == "function" &&
|
|
1920
|
+
function Rs(c, e, t) {
|
|
1921
|
+
typeof c.on == "function" && Ct(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Ct(c, e, t, s) {
|
|
1924
1924
|
if (typeof c.on == "function")
|
|
1925
1925
|
s.once ? c.once(e, t) : c.on(e, t);
|
|
1926
1926
|
else if (typeof c.addEventListener == "function")
|
|
@@ -1930,8 +1930,8 @@ function Et(c, e, t, s) {
|
|
|
1930
1930
|
else
|
|
1931
1931
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof c);
|
|
1932
1932
|
}
|
|
1933
|
-
var ye =
|
|
1934
|
-
let
|
|
1933
|
+
var ye = Re.exports;
|
|
1934
|
+
let Et = class {
|
|
1935
1935
|
constructor() {
|
|
1936
1936
|
this.mask = 1;
|
|
1937
1937
|
}
|
|
@@ -1956,13 +1956,19 @@ let Rs = class {
|
|
|
1956
1956
|
isEnabled(e) {
|
|
1957
1957
|
return (this.mask & (1 << e | 0)) !== 0;
|
|
1958
1958
|
}
|
|
1959
|
+
getMinDisabledLayer() {
|
|
1960
|
+
const e = ~this.mask;
|
|
1961
|
+
if (!(e & 4294967295)) return null;
|
|
1962
|
+
const t = e & -e;
|
|
1963
|
+
return 31 - Math.clz32(t >>> 0);
|
|
1964
|
+
}
|
|
1959
1965
|
};
|
|
1960
1966
|
class ee {
|
|
1961
1967
|
constructor() {
|
|
1962
1968
|
this.event = new ye.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
1963
1969
|
}
|
|
1964
1970
|
addController(e, t) {
|
|
1965
|
-
const s = new
|
|
1971
|
+
const s = new Et();
|
|
1966
1972
|
return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
|
|
1967
1973
|
}
|
|
1968
1974
|
removePage(e, t) {
|
|
@@ -1991,11 +1997,11 @@ class ee {
|
|
|
1991
1997
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
1992
1998
|
}
|
|
1993
1999
|
}
|
|
1994
|
-
const
|
|
2000
|
+
const bt = {
|
|
1995
2001
|
fov: 45,
|
|
1996
2002
|
near: 1,
|
|
1997
2003
|
far: 1e3,
|
|
1998
|
-
up: new
|
|
2004
|
+
up: new I(0, 1, 0)
|
|
1999
2005
|
};
|
|
2000
2006
|
class Ds extends ee {
|
|
2001
2007
|
constructor(e) {
|
|
@@ -2004,7 +2010,7 @@ class Ds extends ee {
|
|
|
2004
2010
|
get camera() {
|
|
2005
2011
|
return this.controller;
|
|
2006
2012
|
}
|
|
2007
|
-
addPerspectiveCamera(e =
|
|
2013
|
+
addPerspectiveCamera(e = bt, t) {
|
|
2008
2014
|
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, h = new kt(s, a, r, i);
|
|
2009
2015
|
return h.up = o, this.addController(h, t);
|
|
2010
2016
|
}
|
|
@@ -2078,7 +2084,7 @@ class Ds extends ee {
|
|
|
2078
2084
|
}
|
|
2079
2085
|
}
|
|
2080
2086
|
const Us = (c) => {
|
|
2081
|
-
const e = new
|
|
2087
|
+
const e = new ps(
|
|
2082
2088
|
new zt({
|
|
2083
2089
|
uniforms: {
|
|
2084
2090
|
baseTexture: { value: null },
|
|
@@ -2207,35 +2213,35 @@ const Us = (c) => {
|
|
|
2207
2213
|
}`
|
|
2208
2214
|
)
|
|
2209
2215
|
};
|
|
2210
|
-
class zs extends
|
|
2216
|
+
class zs extends ms {
|
|
2211
2217
|
constructor() {
|
|
2212
2218
|
super();
|
|
2213
2219
|
const e = ks;
|
|
2214
|
-
this.uniforms = Ft.clone(e.uniforms), this.material = new
|
|
2220
|
+
this.uniforms = Ft.clone(e.uniforms), this.material = new jt({
|
|
2215
2221
|
name: e.name,
|
|
2216
2222
|
uniforms: this.uniforms,
|
|
2217
2223
|
vertexShader: e.vertexShader,
|
|
2218
2224
|
fragmentShader: e.fragmentShader
|
|
2219
|
-
}), this.fsQuad ? this.fsQuad = new
|
|
2225
|
+
}), this.fsQuad ? this.fsQuad = new je(this.material) : this._fsQuad && (this._fsQuad = new je(this.material));
|
|
2220
2226
|
}
|
|
2221
2227
|
}
|
|
2222
|
-
const Fs = new
|
|
2228
|
+
const Fs = new Nt({ color: "black" }), js = new ot({
|
|
2223
2229
|
color: "black",
|
|
2224
2230
|
sizeAttenuation: !1
|
|
2225
|
-
}),
|
|
2231
|
+
}), Ns = new ot({
|
|
2226
2232
|
color: "black",
|
|
2227
2233
|
sizeAttenuation: !0
|
|
2228
|
-
}),
|
|
2234
|
+
}), Is = new nt({
|
|
2229
2235
|
color: "black",
|
|
2230
2236
|
sizeAttenuation: !0
|
|
2231
|
-
}), Hs = new
|
|
2237
|
+
}), Hs = new nt({
|
|
2232
2238
|
color: "black",
|
|
2233
2239
|
sizeAttenuation: !1
|
|
2234
|
-
}), Bs = new
|
|
2240
|
+
}), Bs = new pt({
|
|
2235
2241
|
color: "black",
|
|
2236
2242
|
sizeAttenuation: !1,
|
|
2237
2243
|
lineWidth: 0
|
|
2238
|
-
}),
|
|
2244
|
+
}), Xe = new It(0), Vs = {
|
|
2239
2245
|
kernelRadius: 8,
|
|
2240
2246
|
minDistance: 5e-3,
|
|
2241
2247
|
maxDistance: 0.1
|
|
@@ -2265,13 +2271,13 @@ class Ws {
|
|
|
2265
2271
|
samples: Math.min(n, a),
|
|
2266
2272
|
type: Vt
|
|
2267
2273
|
}
|
|
2268
|
-
), p = new
|
|
2274
|
+
), p = new Fe(o, m), v = this.getSize();
|
|
2269
2275
|
p.setSize(v.width, v.height);
|
|
2270
|
-
const
|
|
2276
|
+
const f = new hs(
|
|
2271
2277
|
s.scene,
|
|
2272
2278
|
i.camera
|
|
2273
2279
|
);
|
|
2274
|
-
p.addPass(
|
|
2280
|
+
p.addPass(f), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = f, i.event.on("pageChange", (u) => {
|
|
2275
2281
|
this.changeCamera(u);
|
|
2276
2282
|
}), s.event.on("pageChange", (u) => {
|
|
2277
2283
|
this.changeScene(u);
|
|
@@ -2291,31 +2297,24 @@ class Ws {
|
|
|
2291
2297
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2292
2298
|
}
|
|
2293
2299
|
addSSAOPass(e) {
|
|
2294
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new
|
|
2300
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new B()), o = r.width, n = r.height, a = new cs(t, s, o, n);
|
|
2295
2301
|
a.kernelRadius = e.kernelRadius, a.minDistance = e.minDistance, a.maxDistance = e.maxDistance, this.ssaoPass = a, this.finalComposer.addPass(a);
|
|
2296
2302
|
}
|
|
2297
2303
|
addBloomPass(e) {
|
|
2298
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new
|
|
2304
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new ds(
|
|
2299
2305
|
new B(window.innerWidth, window.innerHeight),
|
|
2300
2306
|
i,
|
|
2301
2307
|
r,
|
|
2302
2308
|
s
|
|
2303
2309
|
);
|
|
2304
2310
|
this.bloomPass = n;
|
|
2305
|
-
const a = new
|
|
2311
|
+
const a = new Fe(t);
|
|
2306
2312
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2307
2313
|
const h = Us(a);
|
|
2308
|
-
h.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(h), this.mixPass = h, this.bloomLayer.set(
|
|
2314
|
+
h.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(h), this.mixPass = h, this.bloomLayer.set(as);
|
|
2309
2315
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
console.warn("err:pencil.options.bloom");
|
|
2313
|
-
return;
|
|
2314
|
-
}
|
|
2315
|
-
e.traverse((s) => {
|
|
2316
|
-
const { object3d: i } = s;
|
|
2317
|
-
i && (t ? (this.bloomSelection.add(s), i.layers.enable(Oe)) : (this.bloomSelection.delete(s), i.layers.disable(Oe)));
|
|
2318
|
-
}), this.bloomSelection.size === 0 ? this.bloomComposerActive = !1 : this.bloomComposerActive = !0;
|
|
2316
|
+
checkBloomComposerActive() {
|
|
2317
|
+
this.bloomSelection.size === 0 ? this.bloomComposerActive = !1 : this.bloomComposerActive = !0;
|
|
2319
2318
|
}
|
|
2320
2319
|
enable() {
|
|
2321
2320
|
this.active || (this.active = !0);
|
|
@@ -2346,20 +2345,20 @@ class Ws {
|
|
|
2346
2345
|
e.push(o);
|
|
2347
2346
|
return;
|
|
2348
2347
|
}
|
|
2349
|
-
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material =
|
|
2348
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Is : n.material = Hs : o.material instanceof pt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = Ns : a.material = js : o.material = Fs;
|
|
2350
2349
|
}
|
|
2351
2350
|
});
|
|
2352
2351
|
}), e.forEach((i) => {
|
|
2353
2352
|
this.bloomVisible[i.uuid] = i.visible, i.visible = !1;
|
|
2354
2353
|
});
|
|
2355
2354
|
const s = this.scene.background;
|
|
2356
|
-
this.scene.userData._backgroundOriginal = s, this.scene.background =
|
|
2355
|
+
this.scene.userData._backgroundOriginal = s, this.scene.background = Xe;
|
|
2357
2356
|
}
|
|
2358
2357
|
restoreNonBloomed() {
|
|
2359
2358
|
if (this.scene.traverse((e) => {
|
|
2360
2359
|
const t = e;
|
|
2361
2360
|
this.bloomMaterials[t.uuid] ? (t.material = this.bloomMaterials[t.uuid], delete this.bloomMaterials[t.uuid]) : this.bloomVisible[t.uuid] !== void 0 && (t.visible = this.bloomVisible[t.uuid], delete this.bloomVisible[t.uuid]);
|
|
2362
|
-
}), this.scene.background ===
|
|
2361
|
+
}), this.scene.background === Xe) {
|
|
2363
2362
|
const e = this.scene.userData._backgroundOriginal;
|
|
2364
2363
|
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2365
2364
|
}
|
|
@@ -2376,7 +2375,7 @@ class Ws {
|
|
|
2376
2375
|
if (this.finalComposerRender(), this.pipViewportState) {
|
|
2377
2376
|
e.setPageActive(31), e.setAspect(
|
|
2378
2377
|
this.pipViewportState.width / this.pipViewportState.height
|
|
2379
|
-
), t.setViewport(te(
|
|
2378
|
+
), t.setViewport(te(D({}, this.pipViewportState), {
|
|
2380
2379
|
scissor: !0,
|
|
2381
2380
|
scissorTest: !0
|
|
2382
2381
|
})), this.finalComposerRender(), e.setPageActive(s.activeIndex);
|
|
@@ -2401,14 +2400,14 @@ class Ks extends ee {
|
|
|
2401
2400
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2402
2401
|
const t = {
|
|
2403
2402
|
Vector2: B,
|
|
2404
|
-
Vector3:
|
|
2403
|
+
Vector3: I,
|
|
2405
2404
|
Vector4: Zt,
|
|
2406
|
-
Quaternion:
|
|
2405
|
+
Quaternion: at,
|
|
2407
2406
|
Matrix4: W,
|
|
2408
2407
|
Spherical: Wt,
|
|
2409
|
-
Box3:
|
|
2408
|
+
Box3: lt,
|
|
2410
2409
|
Sphere: Kt,
|
|
2411
|
-
Raycaster:
|
|
2410
|
+
Raycaster: ht
|
|
2412
2411
|
};
|
|
2413
2412
|
J.install({ THREE: t });
|
|
2414
2413
|
}
|
|
@@ -2443,7 +2442,7 @@ class Ks extends ee {
|
|
|
2443
2442
|
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Yt.DEG2RAD);
|
|
2444
2443
|
}
|
|
2445
2444
|
}
|
|
2446
|
-
const q = new
|
|
2445
|
+
const q = new I(), qe = new W(), Qe = new W(), Je = new I(), et = new I();
|
|
2447
2446
|
class $s {
|
|
2448
2447
|
/**
|
|
2449
2448
|
* Constructs a new CSS2D renderer.
|
|
@@ -2462,7 +2461,7 @@ class $s {
|
|
|
2462
2461
|
height: i
|
|
2463
2462
|
};
|
|
2464
2463
|
}, this.render = function(u, g) {
|
|
2465
|
-
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(),
|
|
2464
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), qe.copy(g.matrixWorldInverse), Qe.multiplyMatrices(g.projectionMatrix, qe), m(u, u, g), this.sortObjects && f(u);
|
|
2466
2465
|
}, this.setSize = function(u, g) {
|
|
2467
2466
|
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2468
2467
|
};
|
|
@@ -2477,19 +2476,19 @@ class $s {
|
|
|
2477
2476
|
return;
|
|
2478
2477
|
}
|
|
2479
2478
|
if (u.isCSS2DObject) {
|
|
2480
|
-
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(
|
|
2481
|
-
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0,
|
|
2482
|
-
|
|
2483
|
-
const
|
|
2479
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Qe);
|
|
2480
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, _ = u.element;
|
|
2481
|
+
_.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));
|
|
2482
|
+
const C = {
|
|
2484
2483
|
distanceToCameraSquared: p(y, u)
|
|
2485
2484
|
};
|
|
2486
|
-
n.objects.set(u,
|
|
2485
|
+
n.objects.set(u, C);
|
|
2487
2486
|
}
|
|
2488
|
-
for (let l = 0,
|
|
2487
|
+
for (let l = 0, _ = u.children.length; l < _; l++)
|
|
2489
2488
|
m(u.children[l], g, y);
|
|
2490
2489
|
}
|
|
2491
2490
|
function p(u, g) {
|
|
2492
|
-
return
|
|
2491
|
+
return Je.setFromMatrixPosition(u.matrixWorld), et.setFromMatrixPosition(g.matrixWorld), Je.distanceToSquared(et);
|
|
2493
2492
|
}
|
|
2494
2493
|
function v(u) {
|
|
2495
2494
|
const g = [];
|
|
@@ -2497,19 +2496,19 @@ class $s {
|
|
|
2497
2496
|
y.isCSS2DObject && g.push(y);
|
|
2498
2497
|
}), g;
|
|
2499
2498
|
}
|
|
2500
|
-
function
|
|
2501
|
-
const g = v(u).sort(function(l,
|
|
2502
|
-
if (l.renderOrder !==
|
|
2503
|
-
return
|
|
2504
|
-
const
|
|
2505
|
-
return
|
|
2499
|
+
function f(u) {
|
|
2500
|
+
const g = v(u).sort(function(l, _) {
|
|
2501
|
+
if (l.renderOrder !== _.renderOrder)
|
|
2502
|
+
return _.renderOrder - l.renderOrder;
|
|
2503
|
+
const C = n.objects.get(l).distanceToCameraSquared, O = n.objects.get(_).distanceToCameraSquared;
|
|
2504
|
+
return C - O;
|
|
2506
2505
|
}), y = g.length;
|
|
2507
|
-
for (let l = 0,
|
|
2506
|
+
for (let l = 0, _ = g.length; l < _; l++)
|
|
2508
2507
|
g[l].element.style.zIndex = y - l;
|
|
2509
2508
|
}
|
|
2510
2509
|
}
|
|
2511
2510
|
}
|
|
2512
|
-
const
|
|
2511
|
+
const tt = new I(), Gs = new at(), st = new I(), N = new W(), Xs = new W();
|
|
2513
2512
|
class qs {
|
|
2514
2513
|
/**
|
|
2515
2514
|
* Constructs a new CSS3D renderer.
|
|
@@ -2533,11 +2532,11 @@ class qs {
|
|
|
2533
2532
|
height: i
|
|
2534
2533
|
};
|
|
2535
2534
|
}, this.render = function(y, l) {
|
|
2536
|
-
const
|
|
2535
|
+
const _ = l.projectionMatrix.elements[5] * o;
|
|
2537
2536
|
l.view && l.view.enabled ? (h.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, h.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : h.style.transform = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2538
|
-
let
|
|
2539
|
-
l.isOrthographicCamera && (
|
|
2540
|
-
const
|
|
2537
|
+
let C, O;
|
|
2538
|
+
l.isOrthographicCamera && (C = -(l.right + l.left) / 2, O = (l.top + l.bottom) / 2);
|
|
2539
|
+
const T = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${T} )scale(` + _ + ")translate(" + p(C) + "px," + p(O) + "px)" + v(l.matrixWorldInverse) : `scale( ${T} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2541
2540
|
n.camera.style !== R && (m.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2542
2541
|
}, this.setSize = function(y, l) {
|
|
2543
2542
|
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", h.style.width = y + "px", h.style.height = l + "px", m.style.width = y + "px", m.style.height = l + "px";
|
|
@@ -2549,50 +2548,222 @@ class qs {
|
|
|
2549
2548
|
const l = y.elements;
|
|
2550
2549
|
return "matrix3d(" + p(l[0]) + "," + p(-l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(l[4]) + "," + p(-l[5]) + "," + p(l[6]) + "," + p(l[7]) + "," + p(l[8]) + "," + p(-l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(-l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")";
|
|
2551
2550
|
}
|
|
2552
|
-
function
|
|
2551
|
+
function f(y) {
|
|
2553
2552
|
const l = y.elements;
|
|
2554
2553
|
return "translate(-50%,-50%)" + ("matrix3d(" + p(l[0]) + "," + p(l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(-l[4]) + "," + p(-l[5]) + "," + p(-l[6]) + "," + p(-l[7]) + "," + p(l[8]) + "," + p(l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")");
|
|
2555
2554
|
}
|
|
2556
2555
|
function u(y) {
|
|
2557
2556
|
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2558
|
-
for (let l = 0,
|
|
2557
|
+
for (let l = 0, _ = y.children.length; l < _; l++)
|
|
2559
2558
|
u(y.children[l]);
|
|
2560
2559
|
}
|
|
2561
|
-
function g(y, l,
|
|
2560
|
+
function g(y, l, _, C) {
|
|
2562
2561
|
if (y.visible === !1) {
|
|
2563
2562
|
u(y);
|
|
2564
2563
|
return;
|
|
2565
2564
|
}
|
|
2566
2565
|
if (y.isCSS3DObject) {
|
|
2567
|
-
const
|
|
2568
|
-
if (
|
|
2569
|
-
y.onBeforeRender(t, l,
|
|
2566
|
+
const O = y.layers.test(_.layers) === !0, T = y.element;
|
|
2567
|
+
if (T.style.display = O === !0 ? "" : "none", O === !0) {
|
|
2568
|
+
y.onBeforeRender(t, l, _);
|
|
2570
2569
|
let E;
|
|
2571
|
-
y.isCSS3DSprite ? (
|
|
2572
|
-
const
|
|
2573
|
-
if (
|
|
2574
|
-
|
|
2570
|
+
y.isCSS3DSprite ? (N.copy(_.matrixWorldInverse), N.transpose(), y.rotation2D !== 0 && N.multiply(Xs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(tt, Gs, st), N.setPosition(tt), N.scale(st), N.elements[3] = 0, N.elements[7] = 0, N.elements[11] = 0, N.elements[15] = 1, E = f(N)) : E = f(y.matrixWorld);
|
|
2571
|
+
const x = n.objects.get(y);
|
|
2572
|
+
if (x === void 0 || x.style !== E) {
|
|
2573
|
+
T.style.transform = E;
|
|
2575
2574
|
const R = { style: E };
|
|
2576
2575
|
n.objects.set(y, R);
|
|
2577
2576
|
}
|
|
2578
|
-
|
|
2577
|
+
T.parentNode !== m && m.appendChild(T), y.onAfterRender(t, l, _);
|
|
2579
2578
|
}
|
|
2580
2579
|
}
|
|
2581
|
-
for (let
|
|
2582
|
-
g(y.children[
|
|
2580
|
+
for (let O = 0, T = y.children.length; O < T; O++)
|
|
2581
|
+
g(y.children[O], l, _);
|
|
2583
2582
|
}
|
|
2584
2583
|
}
|
|
2585
2584
|
}
|
|
2586
|
-
|
|
2585
|
+
class Qs {
|
|
2586
|
+
constructor(e = {}) {
|
|
2587
|
+
this.labels = /* @__PURE__ */ new Map(), this.lastUpdateTime = 0, this.isUpdating = !1, this.options = D({
|
|
2588
|
+
padding: 2,
|
|
2589
|
+
enabled: !1,
|
|
2590
|
+
throttleTime: 16,
|
|
2591
|
+
// ~60fps
|
|
2592
|
+
viewportMargin: 50
|
|
2593
|
+
}, e);
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* 添加标签到碰撞检测系统
|
|
2597
|
+
* @param node Node 实例
|
|
2598
|
+
* @param options 配置项,priority 越大越优先显示,不传则使用 node.options.priority
|
|
2599
|
+
*/
|
|
2600
|
+
add(e, t = {}) {
|
|
2601
|
+
var s, i;
|
|
2602
|
+
this.labels.set(e, {
|
|
2603
|
+
node: e,
|
|
2604
|
+
priority: (i = (s = t.priority) != null ? s : e.options.priority) != null ? i : 0,
|
|
2605
|
+
visible: !0
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* 移除标签
|
|
2610
|
+
*/
|
|
2611
|
+
remove(e) {
|
|
2612
|
+
this.labels.delete(e);
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* 更新标签优先级
|
|
2616
|
+
*/
|
|
2617
|
+
setPriority(e, t) {
|
|
2618
|
+
const s = this.labels.get(e);
|
|
2619
|
+
s && (s.priority = t);
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* 批量添加标签
|
|
2623
|
+
*/
|
|
2624
|
+
addBatch(e, t) {
|
|
2625
|
+
e.forEach((s, i) => {
|
|
2626
|
+
this.add(s, {
|
|
2627
|
+
priority: t ? t(s, i) : 0
|
|
2628
|
+
});
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* 启用/禁用碰撞检测
|
|
2633
|
+
*/
|
|
2634
|
+
setEnabled(e) {
|
|
2635
|
+
this.options.enabled = e, e || this.labels.forEach((t) => {
|
|
2636
|
+
this.setNodeVisibility(t.node, !0), t.visible = !0;
|
|
2637
|
+
});
|
|
2638
|
+
}
|
|
2639
|
+
/**
|
|
2640
|
+
* 更新碰撞检测(在渲染循环中调用)
|
|
2641
|
+
*/
|
|
2642
|
+
update(e) {
|
|
2643
|
+
if (!this.options.enabled) return;
|
|
2644
|
+
const t = performance.now();
|
|
2645
|
+
t - this.lastUpdateTime < this.options.throttleTime || (this.lastUpdateTime = t, this.camera = e, !this.isUpdating && (this.isUpdating = !0, this.animationFrameId = requestAnimationFrame(() => {
|
|
2646
|
+
this.performCollisionDetection(), this.isUpdating = !1;
|
|
2647
|
+
})));
|
|
2648
|
+
}
|
|
2649
|
+
/**
|
|
2650
|
+
* 强制立即更新
|
|
2651
|
+
*/
|
|
2652
|
+
forceUpdate() {
|
|
2653
|
+
this.camera && this.performCollisionDetection();
|
|
2654
|
+
}
|
|
2655
|
+
performCollisionDetection() {
|
|
2656
|
+
const { padding: e, viewportMargin: t } = this.options, s = window.innerWidth, i = window.innerHeight, r = [];
|
|
2657
|
+
this.labels.forEach((n) => {
|
|
2658
|
+
const a = n.node.element;
|
|
2659
|
+
if (!a) return;
|
|
2660
|
+
const h = a.style.display === "none";
|
|
2661
|
+
h && (a.style.visibility = "hidden", a.style.display = "");
|
|
2662
|
+
const m = a.getBoundingClientRect();
|
|
2663
|
+
if (h && (a.style.display = "none", a.style.visibility = ""), m.width === 0 || m.height === 0) return;
|
|
2664
|
+
m.right >= -t && m.left <= s + t && m.bottom >= -t && m.top <= i + t ? (n.bounds = m, r.push(n)) : (this.setNodeVisibility(n.node, !1), n.visible = !1);
|
|
2665
|
+
}), r.sort((n, a) => a.priority - n.priority);
|
|
2666
|
+
const o = [];
|
|
2667
|
+
for (const n of r) {
|
|
2668
|
+
if (!n.bounds) continue;
|
|
2669
|
+
this.checkCollision(
|
|
2670
|
+
n.bounds,
|
|
2671
|
+
o,
|
|
2672
|
+
e
|
|
2673
|
+
) ? (this.setNodeVisibility(n.node, !1), n.visible = !1) : (this.setNodeVisibility(n.node, !0), n.visible = !0, o.push(n.bounds));
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
/**
|
|
2677
|
+
* 检测矩形是否与已占用区域碰撞
|
|
2678
|
+
*/
|
|
2679
|
+
checkCollision(e, t, s) {
|
|
2680
|
+
for (const i of t)
|
|
2681
|
+
if (this.rectsIntersect(e, i, s))
|
|
2682
|
+
return !0;
|
|
2683
|
+
return !1;
|
|
2684
|
+
}
|
|
2685
|
+
/**
|
|
2686
|
+
* 检测两个矩形是否相交(包含 padding)
|
|
2687
|
+
*/
|
|
2688
|
+
rectsIntersect(e, t, s) {
|
|
2689
|
+
return !(e.right + s < t.left || e.left - s > t.right || e.bottom + s < t.top || e.top - s > t.bottom);
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* 设置节点可见性
|
|
2693
|
+
*/
|
|
2694
|
+
setNodeVisibility(e, t) {
|
|
2695
|
+
const s = e.element;
|
|
2696
|
+
s && (t ? s.style.opacity = "1" : s.style.opacity = "0");
|
|
2697
|
+
}
|
|
2698
|
+
/**
|
|
2699
|
+
* 获取当前可见的标签数量
|
|
2700
|
+
*/
|
|
2701
|
+
getVisibleCount() {
|
|
2702
|
+
let e = 0;
|
|
2703
|
+
return this.labels.forEach((t) => {
|
|
2704
|
+
t.visible && e++;
|
|
2705
|
+
}), e;
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* 获取所有标签数量
|
|
2709
|
+
*/
|
|
2710
|
+
getTotalCount() {
|
|
2711
|
+
return this.labels.size;
|
|
2712
|
+
}
|
|
2713
|
+
/**
|
|
2714
|
+
* 调试执行碰撞检测(带详细日志)
|
|
2715
|
+
*/
|
|
2716
|
+
debugRun() {
|
|
2717
|
+
const { padding: e, viewportMargin: t } = this.options, s = window.innerWidth, i = window.innerHeight;
|
|
2718
|
+
console.log("=== CollisionManager debugRun ==="), console.log("padding:", e, "viewportMargin:", t);
|
|
2719
|
+
const r = [];
|
|
2720
|
+
this.labels.forEach((n) => {
|
|
2721
|
+
const a = n.node.element;
|
|
2722
|
+
if (!a) {
|
|
2723
|
+
console.log("Skipping: element is null");
|
|
2724
|
+
return;
|
|
2725
|
+
}
|
|
2726
|
+
const h = a.style.display === "none";
|
|
2727
|
+
h && (a.style.visibility = "hidden", a.style.display = "");
|
|
2728
|
+
const m = a.getBoundingClientRect();
|
|
2729
|
+
if (h && (a.style.display = "none", a.style.visibility = ""), m.width === 0 || m.height === 0) {
|
|
2730
|
+
console.log("Skipping: rect is 0", m);
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
const p = m.right >= -t && m.left <= s + t && m.bottom >= -t && m.top <= i + t;
|
|
2734
|
+
console.log(`Entry priority=${n.priority}, inViewport=${p}`), p ? (n.bounds = m, r.push(n)) : (this.setNodeVisibility(n.node, !1), n.visible = !1);
|
|
2735
|
+
}), console.log("Entries in viewport:", r.length), r.sort((n, a) => a.priority - n.priority), console.log("Sorted entries:", r.map((n) => n.priority));
|
|
2736
|
+
const o = [];
|
|
2737
|
+
for (const n of r) {
|
|
2738
|
+
if (!n.bounds) continue;
|
|
2739
|
+
const a = this.checkCollision(n.bounds, o, e);
|
|
2740
|
+
console.log(`Processing priority=${n.priority}, hasCollision=${a}, occupiedRects.length=${o.length}`), a ? (this.setNodeVisibility(n.node, !1), n.visible = !1) : (this.setNodeVisibility(n.node, !0), n.visible = !0, o.push(n.bounds));
|
|
2741
|
+
}
|
|
2742
|
+
console.log("Final visible count:", this.getVisibleCount());
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* 清空所有标签
|
|
2746
|
+
*/
|
|
2747
|
+
clear() {
|
|
2748
|
+
this.labels.clear();
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* 销毁管理器
|
|
2752
|
+
*/
|
|
2753
|
+
dispose() {
|
|
2754
|
+
this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.labels.clear();
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
const Ae = {
|
|
2587
2758
|
zIndex: "auto"
|
|
2588
2759
|
};
|
|
2589
|
-
class
|
|
2590
|
-
constructor(e) {
|
|
2591
|
-
this.container = e;
|
|
2760
|
+
class Js {
|
|
2761
|
+
constructor(e, t) {
|
|
2762
|
+
this.container = e, this.collisionManager = new Qs(t == null ? void 0 : t.collision);
|
|
2592
2763
|
}
|
|
2593
2764
|
addRenderer(e, t) {
|
|
2594
|
-
const s = t.container || this.container,
|
|
2595
|
-
|
|
2765
|
+
const s = D(D({}, Ae), t), i = s.container || this.container, r = i.offsetWidth, o = i.offsetHeight, n = e === "css2d" ? new $s() : new qs();
|
|
2766
|
+
n.domElement.style.position = "absolute", n.domElement.style.top = "0", n.domElement.style.pointerEvents = "none", n.domElement.style.zIndex = s.zIndex, n.setSize(r, o), i.appendChild(n.domElement), e === "css2d" ? this.css2Drenderer = n : e === "css3d" && (this.css3Drenderer = n);
|
|
2596
2767
|
}
|
|
2597
2768
|
setSize(e, t) {
|
|
2598
2769
|
var s, i;
|
|
@@ -2600,14 +2771,14 @@ class Qs {
|
|
|
2600
2771
|
}
|
|
2601
2772
|
render(e, t) {
|
|
2602
2773
|
var s, i;
|
|
2603
|
-
(s = this.css2Drenderer) == null || s.render(e, t), (i = this.css3Drenderer) == null || i.render(e, t);
|
|
2774
|
+
(s = this.css2Drenderer) == null || s.render(e, t), (i = this.css3Drenderer) == null || i.render(e, t), this.collisionManager.update(t);
|
|
2604
2775
|
}
|
|
2605
2776
|
dispose() {
|
|
2606
2777
|
var e, t;
|
|
2607
|
-
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
2778
|
+
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0, this.collisionManager.dispose();
|
|
2608
2779
|
}
|
|
2609
2780
|
}
|
|
2610
|
-
class
|
|
2781
|
+
class ei {
|
|
2611
2782
|
constructor(e) {
|
|
2612
2783
|
this.helpers = {}, this.options = e;
|
|
2613
2784
|
}
|
|
@@ -2616,7 +2787,7 @@ class Js {
|
|
|
2616
2787
|
let i = this.helpers[t];
|
|
2617
2788
|
if (i === void 0) {
|
|
2618
2789
|
if (e.isScene)
|
|
2619
|
-
i = new
|
|
2790
|
+
i = new ke(100);
|
|
2620
2791
|
else if (e.isCamera)
|
|
2621
2792
|
i = new $t(e);
|
|
2622
2793
|
else if (e.isPointLight)
|
|
@@ -2628,13 +2799,13 @@ class Js {
|
|
|
2628
2799
|
else if (e.isHemisphereLight)
|
|
2629
2800
|
i = new Qt(e, 10);
|
|
2630
2801
|
else if (e.isRectAreaLight)
|
|
2631
|
-
i = new
|
|
2802
|
+
i = new us(e);
|
|
2632
2803
|
else {
|
|
2633
|
-
const r = new
|
|
2804
|
+
const r = new lt();
|
|
2634
2805
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2635
|
-
i = new
|
|
2806
|
+
i = new ze(r);
|
|
2636
2807
|
const o = i.material;
|
|
2637
|
-
o.userData.object = e, o.depthTest = !1, o.transparent = !0;
|
|
2808
|
+
o.userData.object = e, o.userData.lastMatrixWorld = e.matrixWorld.clone(), o.depthTest = !1, o.transparent = !0;
|
|
2638
2809
|
} else
|
|
2639
2810
|
return;
|
|
2640
2811
|
}
|
|
@@ -2642,7 +2813,7 @@ class Js {
|
|
|
2642
2813
|
}
|
|
2643
2814
|
}
|
|
2644
2815
|
addViewHelper() {
|
|
2645
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2816
|
+
const { cameraController: e, container: t } = this.options, s = new fs(e.camera, t);
|
|
2646
2817
|
t.addEventListener("pointerdown", (i) => {
|
|
2647
2818
|
i.preventDefault(), s.handleClick(i);
|
|
2648
2819
|
}), this.viewHelper = s;
|
|
@@ -2664,7 +2835,7 @@ class Js {
|
|
|
2664
2835
|
}
|
|
2665
2836
|
removeAllExcludeScene() {
|
|
2666
2837
|
Object.keys(this.helpers).forEach((e) => {
|
|
2667
|
-
this.helpers[e] instanceof
|
|
2838
|
+
this.helpers[e] instanceof ke || this.remove({
|
|
2668
2839
|
uuid: e
|
|
2669
2840
|
});
|
|
2670
2841
|
});
|
|
@@ -2673,9 +2844,11 @@ class Js {
|
|
|
2673
2844
|
var r, o;
|
|
2674
2845
|
const { cameraController: i } = this.options;
|
|
2675
2846
|
Object.values(this.helpers).forEach((n) => {
|
|
2676
|
-
if (n.update && n.update(), n instanceof
|
|
2677
|
-
const a = n.material, { object: h } = a.userData;
|
|
2678
|
-
h &&
|
|
2847
|
+
if (n.update && n.update(), n instanceof ze) {
|
|
2848
|
+
const a = n.material, { object: h, lastMatrixWorld: m } = a.userData;
|
|
2849
|
+
h && !h.matrixWorld.equals(
|
|
2850
|
+
m || h.matrixWorld
|
|
2851
|
+
) && (n.box.setFromObject(h, !0), a.userData.lastMatrixWorld = h.matrixWorld.clone());
|
|
2679
2852
|
}
|
|
2680
2853
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
2681
2854
|
...i.camera.position.toArray()
|
|
@@ -2692,66 +2865,70 @@ class Js {
|
|
|
2692
2865
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2693
2866
|
}
|
|
2694
2867
|
}
|
|
2695
|
-
function
|
|
2868
|
+
function Pe(c) {
|
|
2696
2869
|
let e = !1, t = [];
|
|
2697
|
-
return
|
|
2870
|
+
return (...s) => {
|
|
2698
2871
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
2699
2872
|
e = !1, c(...t);
|
|
2700
2873
|
}));
|
|
2701
2874
|
};
|
|
2702
2875
|
}
|
|
2703
|
-
class
|
|
2876
|
+
class ti {
|
|
2704
2877
|
constructor(e) {
|
|
2705
2878
|
var t;
|
|
2706
2879
|
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 = {
|
|
2707
2880
|
move: !1,
|
|
2708
2881
|
down: !1
|
|
2709
|
-
}, this.pencil = e, this.domElement = ((t = e.options.controls) == null ? void 0 : t.domElement) || e.options.container;
|
|
2882
|
+
}, this.hasEnterOnStopEvent = !1, this.cursorObjects = /* @__PURE__ */ new Map(), this.cursorListenerAdded = !1, this.moveStopTimer = null, this.moveStopDelay = 150, this.lastMoveEvent = null, this.lastMoveActiveObjects = /* @__PURE__ */ new Set(), this.lastMoveRealActiveObject = null, this.triggeredEnterOnStopObjects = /* @__PURE__ */ new Set(), this.pencil = e, this.domElement = ((t = e.options.controls) == null ? void 0 : t.domElement) || e.options.container;
|
|
2710
2883
|
}
|
|
2711
2884
|
addPickListener(e) {
|
|
2712
|
-
const t = /* @__PURE__ */ new Set(["move", "enter", "leave"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
2885
|
+
const t = /* @__PURE__ */ new Set(["move", "enter", "leave", "enterOnStop"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
2713
2886
|
var v;
|
|
2714
2887
|
if (!this.enabled)
|
|
2715
2888
|
return;
|
|
2716
2889
|
r.preventDefault();
|
|
2717
2890
|
const o = e === "move" ? t : s, n = [];
|
|
2718
|
-
if (this.pickFunctionsMap.forEach((
|
|
2719
|
-
o.has(
|
|
2720
|
-
objArr:
|
|
2891
|
+
if (this.pickFunctionsMap.forEach((f) => {
|
|
2892
|
+
o.has(f.type) && n.push(te(D({}, f), {
|
|
2893
|
+
objArr: f.objArr instanceof Function ? f.objArr() : f.objArr
|
|
2721
2894
|
}));
|
|
2722
2895
|
}), n.length === 0) return;
|
|
2723
2896
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2724
2897
|
const a = this.objCallbackMap;
|
|
2725
|
-
for (const
|
|
2726
|
-
for (const u of
|
|
2727
|
-
if (!u.object3d
|
|
2898
|
+
for (const f of n)
|
|
2899
|
+
for (const u of f.objArr) {
|
|
2900
|
+
if (!u.object3d) continue;
|
|
2728
2901
|
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
2729
2902
|
const g = a.get(u);
|
|
2730
|
-
g.has(
|
|
2903
|
+
g.has(f.type) || g.set(f.type, []), g.get(f.type).push(f.cb);
|
|
2731
2904
|
}
|
|
2732
2905
|
if (a.size === 0) return;
|
|
2733
|
-
const h = [...a.keys()].map((
|
|
2906
|
+
const h = [...a.keys()].map((f) => f.object3d), m = (v = this.pencil.pick(r, h, !1)) == null ? void 0 : v.intersects;
|
|
2734
2907
|
if (!m || m.length === 0)
|
|
2735
2908
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2736
2909
|
else {
|
|
2737
|
-
const
|
|
2738
|
-
this.processIntersection(
|
|
2910
|
+
const f = m[0];
|
|
2911
|
+
this.processIntersection(f, r, e);
|
|
2739
2912
|
}
|
|
2913
|
+
e === "move" && this.hasEnterOnStopEvent && (this.handleMoveStop(r), this.triggeredEnterOnStopObjects.forEach((f) => {
|
|
2914
|
+
this.activeObjects.has(f) || this.triggeredEnterOnStopObjects.delete(f);
|
|
2915
|
+
}));
|
|
2740
2916
|
const p = this.prevActiveObjects;
|
|
2741
2917
|
this.prevActiveObjects = this.activeObjects, this.activeObjects = p, this.activeObjects.clear();
|
|
2742
2918
|
};
|
|
2743
2919
|
this.domElement.addEventListener(
|
|
2744
2920
|
`pointer${e}`,
|
|
2745
|
-
|
|
2921
|
+
Pe(i),
|
|
2746
2922
|
{ passive: !1 }
|
|
2747
2923
|
);
|
|
2748
2924
|
}
|
|
2749
2925
|
processIntersection(e, t, s) {
|
|
2750
|
-
|
|
2926
|
+
var n;
|
|
2927
|
+
const i = this.objCallbackMap, r = (n = e.index) != null ? n : -1;
|
|
2751
2928
|
let o = e.object;
|
|
2752
2929
|
for (; o; ) {
|
|
2753
|
-
const
|
|
2754
|
-
|
|
2930
|
+
const a = this.pencil.lead.objMap.get(o);
|
|
2931
|
+
a && a.visible && (this.activeObject || (this.activeObject = a), i.has(a) && this.activeObjects.add(a)), o = o.parent;
|
|
2755
2932
|
}
|
|
2756
2933
|
s === "move" ? this.handleLeaveEvents(t) : s === "down" && this.handleDownOutside(t), this.processObjectHierarchy(t, s, r);
|
|
2757
2934
|
}
|
|
@@ -2801,8 +2978,8 @@ class ei {
|
|
|
2801
2978
|
if (m) {
|
|
2802
2979
|
const p = (v) => {
|
|
2803
2980
|
v.preventDefault();
|
|
2804
|
-
const
|
|
2805
|
-
if (!r && Math.abs(v.clientX - e.clientX) <=
|
|
2981
|
+
const f = 5;
|
|
2982
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= f && Math.abs(v.clientY - e.clientY) <= f)
|
|
2806
2983
|
for (const u of m)
|
|
2807
2984
|
u({
|
|
2808
2985
|
baseObject: n,
|
|
@@ -2840,18 +3017,105 @@ class ei {
|
|
|
2840
3017
|
});
|
|
2841
3018
|
});
|
|
2842
3019
|
}
|
|
3020
|
+
/** 处理鼠标停止移动事件 */
|
|
3021
|
+
handleMoveStop(e) {
|
|
3022
|
+
this.moveStopTimer !== null && clearTimeout(this.moveStopTimer), this.lastMoveEvent = e, this.lastMoveActiveObjects.clear(), this.activeObjects.forEach((t) => this.lastMoveActiveObjects.add(t)), this.lastMoveRealActiveObject = this.activeObject, this.moveStopTimer = window.setTimeout(() => {
|
|
3023
|
+
this.triggerEnterOnStop();
|
|
3024
|
+
}, this.moveStopDelay);
|
|
3025
|
+
}
|
|
3026
|
+
/** 触发 enterOnStop 事件 */
|
|
3027
|
+
triggerEnterOnStop() {
|
|
3028
|
+
if (!this.lastMoveEvent || this.lastMoveActiveObjects.size === 0) return;
|
|
3029
|
+
const e = this.lastMoveEvent, t = this.objCallbackMap;
|
|
3030
|
+
let s = !1;
|
|
3031
|
+
const i = () => {
|
|
3032
|
+
s = !0;
|
|
3033
|
+
};
|
|
3034
|
+
for (const r of this.lastMoveActiveObjects) {
|
|
3035
|
+
if (s) break;
|
|
3036
|
+
const o = t.get(r);
|
|
3037
|
+
if (!o) continue;
|
|
3038
|
+
const n = o.get("enterOnStop");
|
|
3039
|
+
if (n && !this.triggeredEnterOnStopObjects.has(r)) {
|
|
3040
|
+
this.triggeredEnterOnStopObjects.add(r);
|
|
3041
|
+
for (const a of n)
|
|
3042
|
+
a({
|
|
3043
|
+
baseObject: r,
|
|
3044
|
+
realBaseObject: this.lastMoveRealActiveObject,
|
|
3045
|
+
mouseEvent: e,
|
|
3046
|
+
sp: i
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
this.moveStopTimer = null;
|
|
3051
|
+
}
|
|
3052
|
+
/** 重置鼠标样式 */
|
|
3053
|
+
resetCursor() {
|
|
3054
|
+
this.domElement.style.cursor = "";
|
|
3055
|
+
}
|
|
3056
|
+
/** 添加 cursor 检测监听器 */
|
|
3057
|
+
addCursorListener() {
|
|
3058
|
+
if (this.cursorListenerAdded) return;
|
|
3059
|
+
this.cursorListenerAdded = !0;
|
|
3060
|
+
const e = (t) => {
|
|
3061
|
+
var o;
|
|
3062
|
+
if (!this.enabled)
|
|
3063
|
+
return;
|
|
3064
|
+
this.cursorObjects.size === 0 && this.resetCursor();
|
|
3065
|
+
const s = [...this.cursorObjects.keys()].filter((n) => n.object3d).map((n) => n.object3d);
|
|
3066
|
+
if (s.length === 0) {
|
|
3067
|
+
this.resetCursor();
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
const i = this.pencil.pick(t, s, !1);
|
|
3071
|
+
if (!((o = i == null ? void 0 : i.intersects) != null && o.length)) {
|
|
3072
|
+
this.resetCursor();
|
|
3073
|
+
return;
|
|
3074
|
+
}
|
|
3075
|
+
let r = i.intersects[0].object;
|
|
3076
|
+
for (; r; ) {
|
|
3077
|
+
const n = this.pencil.lead.objMap.get(r);
|
|
3078
|
+
if (n && this.cursorObjects.has(n)) {
|
|
3079
|
+
this.domElement.style.cursor = this.cursorObjects.get(n);
|
|
3080
|
+
return;
|
|
3081
|
+
}
|
|
3082
|
+
r = r.parent;
|
|
3083
|
+
}
|
|
3084
|
+
this.resetCursor();
|
|
3085
|
+
};
|
|
3086
|
+
this.domElement.addEventListener("pointermove", Pe(e), {
|
|
3087
|
+
passive: !0
|
|
3088
|
+
});
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* 启用物体的 cursor 检测
|
|
3092
|
+
* @param obj 要检测的 BaseObject
|
|
3093
|
+
* @param cursor 鼠标样式,默认 'pointer'
|
|
3094
|
+
*/
|
|
3095
|
+
enableCursor(e, t = "pointer") {
|
|
3096
|
+
this.cursorObjects.set(e, t), this.addCursorListener();
|
|
3097
|
+
}
|
|
3098
|
+
/**
|
|
3099
|
+
* 禁用物体的 cursor 检测
|
|
3100
|
+
* @param obj 要移除的 BaseObject
|
|
3101
|
+
*/
|
|
3102
|
+
disableCursor(e) {
|
|
3103
|
+
this.cursorObjects.delete(e);
|
|
3104
|
+
}
|
|
2843
3105
|
handlePick(e, t, s) {
|
|
2844
3106
|
let i = t;
|
|
2845
3107
|
i === "mousemove" ? i = "move" : i === "mouseenter" ? i = "enter" : i === "mouseleave" && (i = "leave"), this.pickFunctionsMapIndex += 1;
|
|
2846
3108
|
const r = this.pickFunctionsMapIndex;
|
|
2847
|
-
return this.pickFunctionsMap.set(r, { objArr: e, type: i, cb: s }), this.pickListener.move || Array.from(this.pickFunctionsMap.values()).some(
|
|
2848
|
-
(n) => ["move", "enter", "leave"].includes(n.type)
|
|
3109
|
+
return this.pickFunctionsMap.set(r, { objArr: e, type: i, cb: s }), i === "enterOnStop" && (this.hasEnterOnStopEvent = !0), this.pickListener.move || Array.from(this.pickFunctionsMap.values()).some(
|
|
3110
|
+
(n) => ["move", "enter", "leave", "enterOnStop"].includes(n.type)
|
|
2849
3111
|
) && (this.pickListener.move = !0, this.addPickListener("move")), this.pickListener.down || Array.from(this.pickFunctionsMap.values()).some(
|
|
2850
3112
|
(n) => ["down", "downOutside", "click"].includes(n.type)
|
|
2851
3113
|
) && (this.pickListener.down = !0, this.addPickListener("down")), r;
|
|
2852
3114
|
}
|
|
2853
3115
|
removePick(e) {
|
|
2854
|
-
this.pickFunctionsMap.delete(e)
|
|
3116
|
+
this.pickFunctionsMap.delete(e), this.hasEnterOnStopEvent = Array.from(this.pickFunctionsMap.values()).some(
|
|
3117
|
+
(t) => t.type === "enterOnStop"
|
|
3118
|
+
);
|
|
2855
3119
|
}
|
|
2856
3120
|
handlePickNode(e, t, s) {
|
|
2857
3121
|
if (t === "downOutside")
|
|
@@ -2867,7 +3131,7 @@ class ei {
|
|
|
2867
3131
|
mouseEvent: p
|
|
2868
3132
|
}));
|
|
2869
3133
|
}, m = `pointer${t}`;
|
|
2870
|
-
a.element.addEventListener(m,
|
|
3134
|
+
a.element.addEventListener(m, Pe(h), !1), o.push({ arr: a, type: m, listener: h });
|
|
2871
3135
|
}
|
|
2872
3136
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2873
3137
|
}
|
|
@@ -2884,21 +3148,21 @@ class ei {
|
|
|
2884
3148
|
}
|
|
2885
3149
|
}
|
|
2886
3150
|
dispose() {
|
|
2887
|
-
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
|
|
3151
|
+
this.moveStopTimer !== null && (clearTimeout(this.moveStopTimer), this.moveStopTimer = null), this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.lastMoveActiveObjects.clear(), this.triggeredEnterOnStopObjects.clear(), this.objCallbackMap.clear(), this.cursorObjects.clear();
|
|
2888
3152
|
}
|
|
2889
3153
|
}
|
|
2890
|
-
class
|
|
3154
|
+
class si extends ti {
|
|
2891
3155
|
constructor(e, t) {
|
|
2892
|
-
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new
|
|
3156
|
+
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 ct(), {
|
|
2893
3157
|
key: "@Scene",
|
|
2894
3158
|
name: "场景",
|
|
2895
3159
|
mList: !1
|
|
2896
|
-
}), this.group = this.createBaseObject(new
|
|
3160
|
+
}), this.group = this.createBaseObject(new Ce(), {
|
|
2897
3161
|
key: "@Group",
|
|
2898
3162
|
name: "物体组",
|
|
2899
3163
|
target: this.scene,
|
|
2900
3164
|
mList: !1
|
|
2901
|
-
}), this.prefabGroup = this.createBaseObject(new
|
|
3165
|
+
}), this.prefabGroup = this.createBaseObject(new Ce(), {
|
|
2902
3166
|
key: "@PrefabGroup",
|
|
2903
3167
|
name: "预制组",
|
|
2904
3168
|
target: this.scene,
|
|
@@ -2909,9 +3173,11 @@ class ti extends ei {
|
|
|
2909
3173
|
return this.objectsPm.values();
|
|
2910
3174
|
}
|
|
2911
3175
|
createBaseObject(e, t = {}) {
|
|
2912
|
-
const s =
|
|
3176
|
+
const s = D({
|
|
2913
3177
|
mList: !0
|
|
2914
|
-
}, t)
|
|
3178
|
+
}, t);
|
|
3179
|
+
e instanceof Ce && (e.raycast = (r, o) => r.intersectObjects(e.children, !0, o));
|
|
3180
|
+
const i = new ls();
|
|
2915
3181
|
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key && (i.key = s.key), !s.key && s.target)
|
|
2916
3182
|
if (s.target.key === "@Scene" && e instanceof Jt)
|
|
2917
3183
|
i.key = "@Camera";
|
|
@@ -2954,12 +3220,12 @@ class ti extends ei {
|
|
|
2954
3220
|
}
|
|
2955
3221
|
draw(e, t, s) {
|
|
2956
3222
|
return se(this, null, function* () {
|
|
2957
|
-
var p, v,
|
|
3223
|
+
var p, v, f;
|
|
2958
3224
|
const i = this.objectNamesToFactories.get(String(e));
|
|
2959
3225
|
if (!i)
|
|
2960
3226
|
throw new Error(`Unrecognized factory: ${String(e)}`);
|
|
2961
3227
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
2962
|
-
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (v = t.prefab) != null ? v : !1, a = (
|
|
3228
|
+
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (v = t.prefab) != null ? v : !1, a = (f = t.create) != null ? f : !0, h = new i().create(t);
|
|
2963
3229
|
let m;
|
|
2964
3230
|
if (r === null)
|
|
2965
3231
|
m = null;
|
|
@@ -2993,7 +3259,7 @@ class ti extends ei {
|
|
|
2993
3259
|
{
|
|
2994
3260
|
type: t.type,
|
|
2995
3261
|
key: t.key,
|
|
2996
|
-
uId:
|
|
3262
|
+
uId: _s()
|
|
2997
3263
|
},
|
|
2998
3264
|
s
|
|
2999
3265
|
) : (e.key = i, e.keyType = o, e.keyUId = n, e.keyName = r, this.objects.set(i, e), i);
|
|
@@ -3067,7 +3333,7 @@ class ti extends ei {
|
|
|
3067
3333
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectWrapChindIdMap.clear(), this.objectNamesToFactories.clear();
|
|
3068
3334
|
}
|
|
3069
3335
|
}
|
|
3070
|
-
class
|
|
3336
|
+
class ii extends ee {
|
|
3071
3337
|
get lead() {
|
|
3072
3338
|
return this.controller;
|
|
3073
3339
|
}
|
|
@@ -3075,7 +3341,7 @@ class si extends ee {
|
|
|
3075
3341
|
super(), this.options = e;
|
|
3076
3342
|
}
|
|
3077
3343
|
addLead(e, t, s) {
|
|
3078
|
-
const { pencil: i } = this.options, r = new
|
|
3344
|
+
const { pencil: i } = this.options, r = new si(i, {
|
|
3079
3345
|
scene: e,
|
|
3080
3346
|
mList: t
|
|
3081
3347
|
});
|
|
@@ -3097,12 +3363,12 @@ class si extends ee {
|
|
|
3097
3363
|
});
|
|
3098
3364
|
}
|
|
3099
3365
|
}
|
|
3100
|
-
class
|
|
3366
|
+
class ri extends dt {
|
|
3101
3367
|
constructor(e) {
|
|
3102
3368
|
super(e);
|
|
3103
3369
|
}
|
|
3104
3370
|
load(e, t, s, i) {
|
|
3105
|
-
const r = new
|
|
3371
|
+
const r = new Me(this.manager);
|
|
3106
3372
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3107
3373
|
e,
|
|
3108
3374
|
(o) => {
|
|
@@ -3118,7 +3384,7 @@ class ii extends pt {
|
|
|
3118
3384
|
);
|
|
3119
3385
|
}
|
|
3120
3386
|
}
|
|
3121
|
-
class
|
|
3387
|
+
class it extends dt {
|
|
3122
3388
|
constructor(e) {
|
|
3123
3389
|
super(e), this.options = { type: "image" };
|
|
3124
3390
|
}
|
|
@@ -3128,7 +3394,7 @@ class rt extends pt {
|
|
|
3128
3394
|
load(e, t, s, i) {
|
|
3129
3395
|
let r, o;
|
|
3130
3396
|
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new es(o)) : r = new fe();
|
|
3131
|
-
const n = new
|
|
3397
|
+
const n = new Me(this.manager);
|
|
3132
3398
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3133
3399
|
e,
|
|
3134
3400
|
(a) => {
|
|
@@ -3136,13 +3402,13 @@ class rt extends pt {
|
|
|
3136
3402
|
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3137
3403
|
h = h.slice(0, a.size, p);
|
|
3138
3404
|
const v = () => {
|
|
3139
|
-
o.removeEventListener("load",
|
|
3140
|
-
},
|
|
3405
|
+
o.removeEventListener("load", f, !1), o.removeEventListener("error", u, !1);
|
|
3406
|
+
}, f = () => {
|
|
3141
3407
|
v(), r.needsUpdate = !0, t && t(r);
|
|
3142
3408
|
}, u = (y) => {
|
|
3143
3409
|
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3144
3410
|
};
|
|
3145
|
-
o.addEventListener("load",
|
|
3411
|
+
o.addEventListener("load", f, !1), o.addEventListener("error", u, !1);
|
|
3146
3412
|
const g = window.URL.createObjectURL(h);
|
|
3147
3413
|
o.src = g;
|
|
3148
3414
|
},
|
|
@@ -3151,7 +3417,7 @@ class rt extends pt {
|
|
|
3151
3417
|
), r;
|
|
3152
3418
|
}
|
|
3153
3419
|
}
|
|
3154
|
-
const
|
|
3420
|
+
const oi = {
|
|
3155
3421
|
images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
|
|
3156
3422
|
media: ["mp4", "webm", "ogg"],
|
|
3157
3423
|
gltf: ["gltf", "glb"],
|
|
@@ -3160,9 +3426,9 @@ const ri = {
|
|
|
3160
3426
|
exr: ["exr"],
|
|
3161
3427
|
lottie: ["lottie.json"]
|
|
3162
3428
|
};
|
|
3163
|
-
class
|
|
3429
|
+
class ni {
|
|
3164
3430
|
constructor(e) {
|
|
3165
|
-
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options =
|
|
3431
|
+
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = D({
|
|
3166
3432
|
simpleTexture4deleted: !1,
|
|
3167
3433
|
prefix: ""
|
|
3168
3434
|
}, e), this.loadingManager = new ts(
|
|
@@ -3203,31 +3469,31 @@ class oi {
|
|
|
3203
3469
|
if (e.endsWith("json.gzip") || e.endsWith("json.gz"))
|
|
3204
3470
|
return "gzipJson";
|
|
3205
3471
|
} else return;
|
|
3206
|
-
for (const [i, r] of Object.entries(
|
|
3472
|
+
for (const [i, r] of Object.entries(oi))
|
|
3207
3473
|
if (r.includes(t))
|
|
3208
3474
|
return i;
|
|
3209
3475
|
}
|
|
3210
3476
|
getLoader(e, t) {
|
|
3211
3477
|
if (e === "images")
|
|
3212
|
-
return this.textureLoader || (this.textureLoader = new
|
|
3478
|
+
return this.textureLoader || (this.textureLoader = new it(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
3213
3479
|
if (e === "media")
|
|
3214
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
3480
|
+
return this.videoTextureLoader || (this.videoTextureLoader = new it(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3215
3481
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3216
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new
|
|
3482
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new ys(), 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;
|
|
3217
3483
|
if (e === "gltf")
|
|
3218
3484
|
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3219
3485
|
if (e === "lottie")
|
|
3220
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
3486
|
+
return this.lottieLoader || (this.lottieLoader = new Os(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3221
3487
|
if (e === "gzipJson")
|
|
3222
|
-
return this.gzipJsonLoader || (this.gzipJsonLoader = new
|
|
3488
|
+
return this.gzipJsonLoader || (this.gzipJsonLoader = new ri(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3223
3489
|
if (e === "json")
|
|
3224
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
3490
|
+
return this.jsonLoader || (this.jsonLoader = new Me(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3225
3491
|
if (e === "exr")
|
|
3226
|
-
return this.exrLoader || (this.exrLoader = new
|
|
3492
|
+
return this.exrLoader || (this.exrLoader = new vs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3227
3493
|
}
|
|
3228
3494
|
add(e, t) {
|
|
3229
3495
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
3230
|
-
const i =
|
|
3496
|
+
const i = D({
|
|
3231
3497
|
src: s
|
|
3232
3498
|
}, t);
|
|
3233
3499
|
this.loadObj.push(i);
|
|
@@ -3259,7 +3525,7 @@ class oi {
|
|
|
3259
3525
|
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3260
3526
|
if (!s)
|
|
3261
3527
|
return;
|
|
3262
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3528
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = gs();
|
|
3263
3529
|
if (i) {
|
|
3264
3530
|
if (this.assets.has(e))
|
|
3265
3531
|
return this.assets.get(e);
|
|
@@ -3312,10 +3578,10 @@ class oi {
|
|
|
3312
3578
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3313
3579
|
}
|
|
3314
3580
|
}
|
|
3315
|
-
const
|
|
3581
|
+
const ai = {
|
|
3316
3582
|
prefix: ""
|
|
3317
3583
|
};
|
|
3318
|
-
class
|
|
3584
|
+
class li extends ee {
|
|
3319
3585
|
get loader() {
|
|
3320
3586
|
return this.controller;
|
|
3321
3587
|
}
|
|
@@ -3323,7 +3589,7 @@ class ai extends ee {
|
|
|
3323
3589
|
super(), this.options = e;
|
|
3324
3590
|
}
|
|
3325
3591
|
addLoader(e, t) {
|
|
3326
|
-
const { loaderParams: s } = this.options, i = new
|
|
3592
|
+
const { loaderParams: s } = this.options, i = new ni(te(D({}, s), {
|
|
3327
3593
|
scene: e
|
|
3328
3594
|
}));
|
|
3329
3595
|
return this.addController(i, t);
|
|
@@ -3334,7 +3600,7 @@ class ai extends ee {
|
|
|
3334
3600
|
});
|
|
3335
3601
|
}
|
|
3336
3602
|
}
|
|
3337
|
-
class
|
|
3603
|
+
class hi {
|
|
3338
3604
|
constructor(e) {
|
|
3339
3605
|
this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
|
|
3340
3606
|
}
|
|
@@ -3420,7 +3686,7 @@ class li {
|
|
|
3420
3686
|
}
|
|
3421
3687
|
disposeMaterial(e) {
|
|
3422
3688
|
if (!e) return;
|
|
3423
|
-
const t = new
|
|
3689
|
+
const t = new Se();
|
|
3424
3690
|
t.track(Array.isArray(e) ? e : [e]), t.dispose();
|
|
3425
3691
|
}
|
|
3426
3692
|
remove(e) {
|
|
@@ -3557,11 +3823,11 @@ class li {
|
|
|
3557
3823
|
});
|
|
3558
3824
|
}
|
|
3559
3825
|
dispose() {
|
|
3560
|
-
const e = new
|
|
3826
|
+
const e = new Se();
|
|
3561
3827
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3562
3828
|
}
|
|
3563
3829
|
}
|
|
3564
|
-
class
|
|
3830
|
+
class ci extends ee {
|
|
3565
3831
|
get mList() {
|
|
3566
3832
|
return this.controller;
|
|
3567
3833
|
}
|
|
@@ -3569,7 +3835,7 @@ class hi extends ee {
|
|
|
3569
3835
|
super(), this.options = e;
|
|
3570
3836
|
}
|
|
3571
3837
|
addMList(e, t) {
|
|
3572
|
-
const { pencil: s } = this.options, i = new
|
|
3838
|
+
const { pencil: s } = this.options, i = new hi(s);
|
|
3573
3839
|
return this.addController(i, t);
|
|
3574
3840
|
}
|
|
3575
3841
|
removePage(e) {
|
|
@@ -3578,19 +3844,19 @@ class hi extends ee {
|
|
|
3578
3844
|
});
|
|
3579
3845
|
}
|
|
3580
3846
|
}
|
|
3581
|
-
const
|
|
3847
|
+
const di = {
|
|
3582
3848
|
antialias: !1,
|
|
3583
3849
|
devicePixelRatio: window.devicePixelRatio,
|
|
3584
3850
|
powerPreference: "high-performance",
|
|
3585
3851
|
toneMappingExposure: 1,
|
|
3586
3852
|
alpha: !1,
|
|
3587
|
-
outputColorSpace:
|
|
3853
|
+
outputColorSpace: Es.sRGB,
|
|
3588
3854
|
logarithmicDepthBuffer: !1,
|
|
3589
3855
|
preserveDrawingBuffer: !1,
|
|
3590
3856
|
stencil: !1,
|
|
3591
3857
|
depth: !1
|
|
3592
3858
|
};
|
|
3593
|
-
class
|
|
3859
|
+
class pi {
|
|
3594
3860
|
constructor(e) {
|
|
3595
3861
|
this.options = e;
|
|
3596
3862
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
@@ -3602,7 +3868,7 @@ class di {
|
|
|
3602
3868
|
outputColorSpace: m,
|
|
3603
3869
|
logarithmicDepthBuffer: p,
|
|
3604
3870
|
preserveDrawingBuffer: v,
|
|
3605
|
-
stencil:
|
|
3871
|
+
stencil: f,
|
|
3606
3872
|
depth: u
|
|
3607
3873
|
} = i, g = new is({
|
|
3608
3874
|
alpha: r,
|
|
@@ -3610,7 +3876,7 @@ class di {
|
|
|
3610
3876
|
powerPreference: a,
|
|
3611
3877
|
logarithmicDepthBuffer: p,
|
|
3612
3878
|
preserveDrawingBuffer: v,
|
|
3613
|
-
stencil:
|
|
3879
|
+
stencil: f,
|
|
3614
3880
|
depth: u
|
|
3615
3881
|
});
|
|
3616
3882
|
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = h, g.outputColorSpace = m, this.renderer = g;
|
|
@@ -3634,10 +3900,10 @@ class di {
|
|
|
3634
3900
|
this.setSize(0, 0), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose(), (s = this.renderer) == null || s.forceContextLoss();
|
|
3635
3901
|
}
|
|
3636
3902
|
}
|
|
3637
|
-
const
|
|
3903
|
+
const mi = {
|
|
3638
3904
|
background: null
|
|
3639
3905
|
};
|
|
3640
|
-
class
|
|
3906
|
+
class ui extends ee {
|
|
3641
3907
|
get scene() {
|
|
3642
3908
|
return this.controller;
|
|
3643
3909
|
}
|
|
@@ -3645,12 +3911,12 @@ class mi extends ee {
|
|
|
3645
3911
|
super(), this.options = e;
|
|
3646
3912
|
}
|
|
3647
3913
|
addScene(e, t) {
|
|
3648
|
-
const s = new
|
|
3914
|
+
const s = new ct();
|
|
3649
3915
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
3650
3916
|
}
|
|
3651
3917
|
removePage(e) {
|
|
3652
3918
|
super.removePage(e, (t) => {
|
|
3653
|
-
const s = new
|
|
3919
|
+
const s = new Se();
|
|
3654
3920
|
s.track(t), s.dispose();
|
|
3655
3921
|
});
|
|
3656
3922
|
}
|
|
@@ -3660,7 +3926,7 @@ class mi extends ee {
|
|
|
3660
3926
|
});
|
|
3661
3927
|
}
|
|
3662
3928
|
}
|
|
3663
|
-
class
|
|
3929
|
+
class fi {
|
|
3664
3930
|
constructor(e) {
|
|
3665
3931
|
this.event = new ye.EventEmitter();
|
|
3666
3932
|
const { renderer: t, scene: s, camera: i } = e, r = new Ts(
|
|
@@ -3729,11 +3995,11 @@ class ui {
|
|
|
3729
3995
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3730
3996
|
}
|
|
3731
3997
|
}
|
|
3732
|
-
const
|
|
3998
|
+
const _i = {
|
|
3733
3999
|
antialias: !0,
|
|
3734
4000
|
devicePixelRatio: window.devicePixelRatio
|
|
3735
4001
|
};
|
|
3736
|
-
class
|
|
4002
|
+
class gi {
|
|
3737
4003
|
constructor(e) {
|
|
3738
4004
|
this.options = e;
|
|
3739
4005
|
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
|
|
@@ -3755,8 +4021,8 @@ class _i {
|
|
|
3755
4021
|
const _e = class _e {
|
|
3756
4022
|
constructor(e) {
|
|
3757
4023
|
var r, o;
|
|
3758
|
-
this.raycaster = new
|
|
3759
|
-
isMergeableObject:
|
|
4024
|
+
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ye.EventEmitter(), this.timer = new ns(), this.userData = {}, this.pageActiveIndex = 0, this.pages = new Et(), this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this._isDispose = !1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = Dt(_e.options, e, {
|
|
4025
|
+
isMergeableObject: bs
|
|
3760
4026
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3761
4027
|
const {
|
|
3762
4028
|
container: t,
|
|
@@ -3805,7 +4071,7 @@ const _e = class _e {
|
|
|
3805
4071
|
return this.mListController.mList;
|
|
3806
4072
|
}
|
|
3807
4073
|
tweenUpdateRaf() {
|
|
3808
|
-
|
|
4074
|
+
Oe.update(), this.TweenRaf = requestAnimationFrame(this.tweenUpdateRaf.bind(this));
|
|
3809
4075
|
}
|
|
3810
4076
|
use(e, ...t) {
|
|
3811
4077
|
this.installPlugins.has(e.pluginName) ? console.log("plugin already installed") : typeof e.install == "function" && (e.install(this, ...t), this.installPlugins.set(e.pluginName, e));
|
|
@@ -3814,16 +4080,16 @@ const _e = class _e {
|
|
|
3814
4080
|
sceneOptions: e,
|
|
3815
4081
|
cameraOptions: t
|
|
3816
4082
|
} = {}) {
|
|
3817
|
-
const s = this.
|
|
4083
|
+
const s = this.pages.getMinDisabledLayer(), i = this.cameraController.addPerspectiveCamera(
|
|
3818
4084
|
t,
|
|
3819
4085
|
s
|
|
3820
4086
|
), r = this.sceneController.addScene(e, s);
|
|
3821
4087
|
r.add(i), this.controlsController.addCameraControls(i, s), this.loaderController.addLoader(r, s);
|
|
3822
4088
|
const o = this.mListController.addMList(null, s);
|
|
3823
|
-
return this.leadController.addLead(r, o, s), this.
|
|
4089
|
+
return this.leadController.addLead(r, o, s), this.pages.enable(s), s;
|
|
3824
4090
|
}
|
|
3825
4091
|
removePage(e) {
|
|
3826
|
-
this.
|
|
4092
|
+
this.controlsController.removePage(e), this.loaderController.removePage(e), this.leadController.removePage(e), this.cameraController.removePage(e), this.sceneController.removePage(e), this.mListController.removePage(e), this.pages.disable(e), this.pageActiveIndex === e && (this.render(), this.showPage(0));
|
|
3827
4093
|
}
|
|
3828
4094
|
showPage(e) {
|
|
3829
4095
|
var s;
|
|
@@ -3832,7 +4098,7 @@ const _e = class _e {
|
|
|
3832
4098
|
this.sceneController.setPageActive(e), t && ((s = this.cssRendererController) == null || s.render(t, this.camera)), this.cameraController.setPageActive(e), this.controlsController.setPageActive(e), this.loaderController.setPageActive(e), this.mListController.setPageActive(e), this.leadController.setPageActive(e), this.pageActiveIndex = e;
|
|
3833
4099
|
}
|
|
3834
4100
|
init() {
|
|
3835
|
-
var
|
|
4101
|
+
var _;
|
|
3836
4102
|
const {
|
|
3837
4103
|
container: e,
|
|
3838
4104
|
WebGPUTHREE: t,
|
|
@@ -3841,16 +4107,16 @@ const _e = class _e {
|
|
|
3841
4107
|
renderer: r,
|
|
3842
4108
|
controls: o,
|
|
3843
4109
|
loader: n
|
|
3844
|
-
} = this.options, { width: a, height: h } = this.getSize(), m = t ? new
|
|
4110
|
+
} = this.options, { width: a, height: h } = this.getSize(), m = t ? new gi({
|
|
3845
4111
|
width: a,
|
|
3846
4112
|
height: h,
|
|
3847
4113
|
//@ts-ignore
|
|
3848
4114
|
renderer: this.options.WebGPURenderer,
|
|
3849
|
-
rendererParams:
|
|
3850
|
-
}) : new
|
|
4115
|
+
rendererParams: _i
|
|
4116
|
+
}) : new pi({
|
|
3851
4117
|
width: a,
|
|
3852
4118
|
height: h,
|
|
3853
|
-
rendererParams: te(
|
|
4119
|
+
rendererParams: te(D({}, r), {
|
|
3854
4120
|
antialias: !1
|
|
3855
4121
|
})
|
|
3856
4122
|
});
|
|
@@ -3858,31 +4124,31 @@ const _e = class _e {
|
|
|
3858
4124
|
const p = new Ds({
|
|
3859
4125
|
width: a,
|
|
3860
4126
|
height: h
|
|
3861
|
-
}), v = new
|
|
4127
|
+
}), v = new ui({}), f = new Ks({
|
|
3862
4128
|
controlsParams: {
|
|
3863
|
-
domElement: (
|
|
4129
|
+
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : m.renderer.domElement
|
|
3864
4130
|
}
|
|
3865
|
-
}), u = new
|
|
3866
|
-
loaderParams:
|
|
4131
|
+
}), u = new li({
|
|
4132
|
+
loaderParams: D({
|
|
3867
4133
|
anisotropy: this.maxAnisotropy
|
|
3868
4134
|
}, n)
|
|
3869
|
-
}), g = new
|
|
4135
|
+
}), g = new ci({
|
|
3870
4136
|
pencil: this
|
|
3871
|
-
}), y = new
|
|
4137
|
+
}), y = new ii({
|
|
3872
4138
|
pencil: this
|
|
3873
4139
|
});
|
|
3874
|
-
this.sceneController = v, this.cameraController = p, this.controlsController =
|
|
4140
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = f, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3875
4141
|
const l = this.addPage({
|
|
3876
4142
|
sceneOptions: this.options.scene,
|
|
3877
4143
|
cameraOptions: this.options.camera
|
|
3878
4144
|
});
|
|
3879
4145
|
if (this.showPage(l), s) {
|
|
3880
|
-
const
|
|
4146
|
+
const C = new ei({
|
|
3881
4147
|
container: e,
|
|
3882
4148
|
sceneController: v,
|
|
3883
4149
|
cameraController: p
|
|
3884
4150
|
});
|
|
3885
|
-
|
|
4151
|
+
C.add(v.scene), this.helperController = C, i && C.addViewHelper();
|
|
3886
4152
|
}
|
|
3887
4153
|
e.appendChild(m.renderer.domElement);
|
|
3888
4154
|
}
|
|
@@ -3899,7 +4165,7 @@ const _e = class _e {
|
|
|
3899
4165
|
cameraController: this.cameraController,
|
|
3900
4166
|
composerParams: r
|
|
3901
4167
|
});
|
|
3902
|
-
this.composerController = o, e && o.addBloomPass(
|
|
4168
|
+
this.composerController = o, e && o.addBloomPass(D({}, t)), s && o.addSSAOPass(D({}, i)), o.addOutputPass();
|
|
3903
4169
|
}
|
|
3904
4170
|
initCSSRenderer() {
|
|
3905
4171
|
const {
|
|
@@ -3910,12 +4176,12 @@ const _e = class _e {
|
|
|
3910
4176
|
css3DRendererParams: r
|
|
3911
4177
|
} = this.options;
|
|
3912
4178
|
if (t || s) {
|
|
3913
|
-
const o = new
|
|
4179
|
+
const o = new Js(e, i);
|
|
3914
4180
|
t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
|
|
3915
4181
|
}
|
|
3916
4182
|
}
|
|
3917
4183
|
initTransformControls() {
|
|
3918
|
-
const e = new
|
|
4184
|
+
const e = new fi({
|
|
3919
4185
|
camera: this.camera,
|
|
3920
4186
|
renderer: this.renderer,
|
|
3921
4187
|
scene: this.scene
|
|
@@ -4004,7 +4270,7 @@ const _e = class _e {
|
|
|
4004
4270
|
var s, i, r, o, n, a;
|
|
4005
4271
|
if (!this.camera || !this.scene)
|
|
4006
4272
|
return;
|
|
4007
|
-
this.event.emit("beforeRender"), this.timer.update(),
|
|
4273
|
+
this.event.emit("beforeRender"), this.timer.update(), Oe.update();
|
|
4008
4274
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
4009
4275
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((h) => {
|
|
4010
4276
|
var m;
|
|
@@ -4053,11 +4319,11 @@ const _e = class _e {
|
|
|
4053
4319
|
}
|
|
4054
4320
|
}
|
|
4055
4321
|
dispose() {
|
|
4056
|
-
var e, t, s, i, r, o, n, a, h, m, p, v,
|
|
4057
|
-
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(),
|
|
4322
|
+
var e, t, s, i, r, o, n, a, h, m, p, v, f, u;
|
|
4323
|
+
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(), Oe.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4058
4324
|
var y;
|
|
4059
4325
|
(y = g.dispose) == null || y.call(g);
|
|
4060
|
-
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (
|
|
4326
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (v = this.mListController) == null || v.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (f = this.stats) == null || f.dom.remove(), (u = this.renderer) == null || u.domElement.remove(), this._isDispose = !0;
|
|
4061
4327
|
}
|
|
4062
4328
|
};
|
|
4063
4329
|
_e.options = {
|
|
@@ -4066,26 +4332,26 @@ _e.options = {
|
|
|
4066
4332
|
viewHelper: he,
|
|
4067
4333
|
controls: !0,
|
|
4068
4334
|
transformControls: he,
|
|
4069
|
-
renderer:
|
|
4335
|
+
renderer: di,
|
|
4070
4336
|
composer: Zs,
|
|
4071
|
-
scene:
|
|
4072
|
-
camera:
|
|
4337
|
+
scene: mi,
|
|
4338
|
+
camera: bt,
|
|
4073
4339
|
bloom: !1,
|
|
4074
4340
|
bloomParams: Ys,
|
|
4075
4341
|
ssao: !1,
|
|
4076
|
-
loader:
|
|
4342
|
+
loader: ai,
|
|
4077
4343
|
ssaoParams: Vs,
|
|
4078
4344
|
css2DRenderer: !1,
|
|
4079
|
-
css2DRendererParams:
|
|
4345
|
+
css2DRendererParams: D({}, Ae),
|
|
4080
4346
|
css3DRenderer: !1,
|
|
4081
|
-
css3DRendererParams:
|
|
4347
|
+
css3DRendererParams: D({}, Ae)
|
|
4082
4348
|
};
|
|
4083
|
-
let
|
|
4084
|
-
const
|
|
4349
|
+
let rt = _e;
|
|
4350
|
+
const qi = J.ACTION;
|
|
4085
4351
|
export {
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4352
|
+
ls as BaseObject,
|
|
4353
|
+
rt as Pencil,
|
|
4354
|
+
Se as ResourceTracker,
|
|
4355
|
+
qi as cameraControlsAction,
|
|
4356
|
+
rt as default
|
|
4091
4357
|
};
|