gl-draw 0.17.0-beta.2 → 0.17.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/BaseObject/index.d.ts +3 -3
- package/dist/core/Composer.d.ts +5 -5
- package/dist/core/Pages/Pages.d.ts +1 -0
- package/dist/core/Pencil.d.ts +1 -1
- package/dist/core/pass/OutputPass.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +284 -285
- package/dist/index.module2.js +1100 -0
- package/dist/index2.js +140 -0
- package/dist/objects/extrudePolygon/createGeometry.d.ts +2 -1
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +373 -420
- package/dist/objects/node/index.d.ts +4 -2
- package/dist/objects/pie/index.d.ts +2 -1
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +2 -3
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
- package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +2 -4
- package/dist/plugins/Worker/getAttributes/getCoordinatesArr.d.ts +5 -1
- package/dist/plugins/Worker/getAttributes/getMessage.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/line.d.ts +2 -2
- package/dist/plugins/Worker/getAttributes/line2.d.ts +2 -2
- package/dist/plugins/Worker/getAttributes/splitPolygonsByLongitudeDifference.d.ts +5 -2
- package/dist/plugins/Worker/index.d.ts +3 -3
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +79 -59
- package/package.json +1 -1
- package/dist/WebGPULineSegments2.js +0 -140
- package/dist/WebGPULineSegments2.module.js +0 -1031
package/dist/index.module.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var Pt = Object.defineProperty,
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var Mt = Object.prototype.hasOwnProperty,
|
|
5
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, At = Object.defineProperties;
|
|
2
|
+
var St = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Se = Object.getOwnPropertySymbols;
|
|
4
|
+
var Mt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Me = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, U = (c, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
Mt.call(e, t) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
7
|
+
Mt.call(e, t) && Me(c, t, e[t]);
|
|
8
|
+
if (Se)
|
|
9
|
+
for (var t of Se(e))
|
|
10
|
+
Dt.call(e, t) && Me(c, t, e[t]);
|
|
11
11
|
return c;
|
|
12
|
-
}, te = (c, e) =>
|
|
12
|
+
}, te = (c, e) => At(c, St(e));
|
|
13
13
|
var se = (c, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (a) => {
|
|
15
15
|
try {
|
|
@@ -27,14 +27,14 @@ var se = (c, e, t) => new Promise((s, i) => {
|
|
|
27
27
|
n((t = t.apply(c, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as Ce from "@tweenjs/tween.js";
|
|
30
|
-
import
|
|
30
|
+
import Rt 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 H, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as Ft, RawShaderMaterial as Nt, MeshBasicMaterial as It, PointsMaterial as ot, SpriteMaterial as nt, Color as Ht, Layers as jt, 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 De, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as Re, Scene as ct, Group as Ue, Camera as Jt, Loader as dt, FileLoader as Pe, 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 Le, I as he } from "./index.module2.js";
|
|
34
|
+
import { EffectComposer as ke } 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,18 +45,18 @@ import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
|
45
45
|
import "three-bvh-csg";
|
|
46
46
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
47
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
48
|
-
import { ShaderPass as
|
|
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
|
|
56
|
-
import { GLTFLoader as
|
|
57
|
-
import { LottieLoader as
|
|
58
|
-
import { a as
|
|
59
|
-
import { TransformControls 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 ze } 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
|
+
import { GLTFLoader as Fe } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
+
import { LottieLoader as Cs } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
|
+
import { a as Os, C as Es, i as Ts } from "./isPlainObject.module.js";
|
|
59
|
+
import { TransformControls as ws } from "three/examples/jsm/controls/TransformControls";
|
|
60
60
|
const M = {
|
|
61
61
|
LEFT: 1,
|
|
62
62
|
RIGHT: 2,
|
|
@@ -91,20 +91,20 @@ const M = {
|
|
|
91
91
|
function Y(c) {
|
|
92
92
|
return c.isPerspectiveCamera;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function j(c) {
|
|
95
95
|
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2,
|
|
97
|
+
const $ = Math.PI * 2, Ne = 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
|
|
101
|
+
function S(c, e = mt) {
|
|
102
102
|
return Math.abs(c) < e;
|
|
103
103
|
}
|
|
104
|
-
function P(c, e, t =
|
|
105
|
-
return
|
|
104
|
+
function P(c, e, t = mt) {
|
|
105
|
+
return S(c - e, t);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function Ie(c, e) {
|
|
108
108
|
return Math.round(c / e) * e;
|
|
109
109
|
}
|
|
110
110
|
function re(c) {
|
|
@@ -134,20 +134,20 @@ function He(c, e, t, s, i = 1 / 0, r, o) {
|
|
|
134
134
|
_ = _ / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
135
|
}
|
|
136
136
|
m = c.x - _, p = c.y - u, v = c.z - g;
|
|
137
|
-
const E = (t.x + n * _) * r,
|
|
138
|
-
t.x = (t.x - n * E) * h, t.y = (t.y - n *
|
|
139
|
-
const V = y - c.x, le = l - c.y, wt = f - c.z,
|
|
140
|
-
return V *
|
|
137
|
+
const E = (t.x + n * _) * r, x = (t.y + n * u) * r, D = (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 * D) * h, o.x = m + (_ + E) * h, o.y = p + (u + x) * h, o.z = v + (g + D) * h;
|
|
139
|
+
const V = y - c.x, le = l - c.y, wt = f - c.z, bt = o.x - y, xt = o.y - l, Lt = o.z - f;
|
|
140
|
+
return V * bt + le * xt + wt * Lt > 0 && (o.x = y, o.y = l, o.z = f, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - f) / r), o;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Oe(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
|
|
148
|
-
return
|
|
147
|
+
function Ee(c, e) {
|
|
148
|
+
return j(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
|
-
class
|
|
150
|
+
class bs {
|
|
151
151
|
constructor() {
|
|
152
152
|
this._listeners = {};
|
|
153
153
|
}
|
|
@@ -212,10 +212,10 @@ class ws {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
-
let T,
|
|
216
|
-
class J extends
|
|
215
|
+
let T, je, pe, Te, R, b, L, G, ne, F, N, Z, Be, Ve, k, ae, X, Ye, we, Ze, be, xe, me;
|
|
216
|
+
class J extends bs {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE,
|
|
218
|
+
T = e.THREE, je = Object.freeze(new T.Vector3(0, 0, 0)), pe = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), R = new T.Vector2(), b = new T.Vector3(), L = new T.Vector3(), G = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Be = new T.Vector3(), Ve = new T.Vector3(), k = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), Ye = new T.Box3(), we = new T.Sphere(), Ze = new T.Quaternion(), be = new T.Quaternion(), xe = new T.Matrix4(), me = new T.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -246,11 +246,11 @@ class J extends ws {
|
|
|
246
246
|
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, f, O, C) => {
|
|
247
247
|
let w, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const
|
|
249
|
+
const x = b.copy(this._camera.position).sub(this._target), D = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(D * 0.5);
|
|
250
250
|
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * f * V / this._elementRect.height;
|
|
251
|
-
} else if (
|
|
252
|
-
const
|
|
253
|
-
w = this.truckSpeed * l * (
|
|
251
|
+
} else if (j(this._camera)) {
|
|
252
|
+
const x = this._camera;
|
|
253
|
+
w = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * f * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
256
|
C ? (O ? this.setFocalOffset(
|
|
@@ -268,12 +268,12 @@ class J extends ws {
|
|
|
268
268
|
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * f / this._elementRect.height;
|
|
269
269
|
this.rotate(O, C, !0);
|
|
270
270
|
}, this._dollyInternal = (l, f, O) => {
|
|
271
|
-
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C,
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), w = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, x = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
|
-
),
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(
|
|
275
|
+
), D = x - E;
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(D, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - w, this._dollyControlCoord.set(f, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
277
|
}, this._zoomInternal = (l, f, O) => {
|
|
278
278
|
const C = Math.pow(0.95, l * this.dollySpeed), w = this._zoom, E = this._zoom * C;
|
|
279
279
|
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - w, this._dollyControlCoord.set(f, O));
|
|
@@ -283,7 +283,7 @@ class J extends ws {
|
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
285
|
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
286
|
-
|
|
286
|
+
b.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
288
|
new T.Vector3(),
|
|
289
289
|
new T.Vector3(),
|
|
@@ -296,10 +296,10 @@ class J extends ws {
|
|
|
296
296
|
left: d.ROTATE,
|
|
297
297
|
middle: d.DOLLY,
|
|
298
298
|
right: d.TRUCK,
|
|
299
|
-
wheel: Y(this._camera) ? d.DOLLY :
|
|
299
|
+
wheel: Y(this._camera) ? d.DOLLY : j(this._camera) ? d.ZOOM : d.NONE
|
|
300
300
|
}, this.touches = {
|
|
301
301
|
one: d.TOUCH_ROTATE,
|
|
302
|
-
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK :
|
|
302
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : j(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
303
303
|
three: d.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
@@ -383,8 +383,8 @@ 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), D = (l.clientY - E.top) / (E.bottom - E.top);
|
|
387
|
+
if (x < this._interactiveArea.left || x > this._interactiveArea.right || D < this._interactiveArea.top || D > 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) {
|
|
@@ -437,11 +437,11 @@ class J extends ws {
|
|
|
437
437
|
}
|
|
438
438
|
}, v = (l) => {
|
|
439
439
|
if (!this._enabled) return;
|
|
440
|
-
if (
|
|
441
|
-
const O =
|
|
440
|
+
if (Oe(this._activePointers, R), this._getClientRect(this._elementRect), s.copy(R), i.copy(R), this._activePointers.length >= 2) {
|
|
441
|
+
const O = R.x - this._activePointers[1].clientX, C = R.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
|
|
442
442
|
r.set(0, w);
|
|
443
|
-
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
444
|
-
i.set(E,
|
|
443
|
+
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, 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);
|
|
@@ -462,29 +462,29 @@ class J extends ws {
|
|
|
462
462
|
((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & d.TRUCK) === d.TRUCK || (this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & d.DOLLY) === d.DOLLY || (this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & d.ZOOM) === d.ZOOM || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
463
463
|
}, _ = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
|
-
this._dragNeedsUpdate = !1,
|
|
466
|
-
const f = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = f ? -f.deltaX : i.x -
|
|
467
|
-
if (i.copy(
|
|
468
|
-
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0,
|
|
465
|
+
this._dragNeedsUpdate = !1, Oe(this._activePointers, R);
|
|
466
|
+
const f = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = f ? -f.deltaX : i.x - R.x, C = f ? -f.deltaY : i.y - R.y;
|
|
467
|
+
if (i.copy(R), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
+
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
|
|
469
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
470
|
-
|
|
470
|
+
x * C * de,
|
|
471
471
|
w,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
|
-
|
|
474
|
+
x * C * de,
|
|
475
475
|
w,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
479
|
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
480
|
-
const w =
|
|
481
|
-
r.set(0,
|
|
480
|
+
const w = R.x - this._activePointers[1].clientX, E = R.y - this._activePointers[1].clientY, x = Math.sqrt(w * w + E * E), D = 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
|
-
(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(
|
|
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(D * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(D * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
485
485
|
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, C, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(O, C, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
486
|
}, u = () => {
|
|
487
|
-
|
|
487
|
+
Oe(this._activePointers, R), i.copy(R), 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 }
|
|
@@ -900,7 +900,7 @@ class J extends ws {
|
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
902
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
903
|
-
const i =
|
|
903
|
+
const i = b.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -910,8 +910,8 @@ class J extends ws {
|
|
|
910
910
|
* @category Methods
|
|
911
911
|
*/
|
|
912
912
|
forward(e, t = !1) {
|
|
913
|
-
|
|
914
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
b.setFromMatrixColumn(this._camera.matrix, 0), b.crossVectors(this._camera.up, b), b.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(b);
|
|
915
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -921,10 +921,10 @@ class J extends 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 b.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
925
|
+
this._targetEnd.x + b.x,
|
|
926
|
+
this._targetEnd.y + b.y,
|
|
927
|
+
this._targetEnd.z + b.z,
|
|
928
928
|
t
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -938,7 +938,7 @@ class J extends ws {
|
|
|
938
938
|
*/
|
|
939
939
|
moveTo(e, t, s, i = !1) {
|
|
940
940
|
this._isUserControllingTruck = !1;
|
|
941
|
-
const r =
|
|
941
|
+
const r = b.set(e, t, s).sub(this._targetEnd);
|
|
942
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
943
943
|
const o = !i || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
944
944
|
return this._createOnRestPromise(o);
|
|
@@ -953,7 +953,7 @@ class J extends ws {
|
|
|
953
953
|
* @category Methods
|
|
954
954
|
*/
|
|
955
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
956
|
-
const n =
|
|
956
|
+
const n = b.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
957
957
|
return this.setPosition(
|
|
958
958
|
n.x,
|
|
959
959
|
n.y,
|
|
@@ -985,13 +985,13 @@ class J extends 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 = Ie(this._sphericalEnd.theta, Ne), p = Ie(this._sphericalEnd.phi, Ne);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const v =
|
|
990
|
+
const v = b.setFromSpherical(this._sphericalEnd).normalize(), _ = Ze.setFromUnitVectors(v, Te), u = P(Math.abs(v.y), 1);
|
|
991
991
|
u && _.multiply(be.setFromAxisAngle(pe, m)), _.multiply(this._yAxisUpSpaceInverse);
|
|
992
|
-
const g =
|
|
993
|
-
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(
|
|
994
|
-
const y = g.getSize(
|
|
992
|
+
const g = Ye.makeEmpty();
|
|
993
|
+
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(Te, v), u && _.premultiply(be.invert()), _.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(_);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
996
|
const f = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
@@ -1002,7 +1002,7 @@ class J extends ws {
|
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
1004
|
), a.push(this.dollyTo(f, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
|
-
} else if (
|
|
1005
|
+
} else if (j(this._camera)) {
|
|
1006
1006
|
const f = this._camera, O = f.right - f.left, C = f.top - f.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
@@ -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,
|
|
@@ -1028,7 +1028,7 @@ class J extends ws {
|
|
|
1028
1028
|
), Y(this._camera)) {
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
|
-
} else if (
|
|
1031
|
+
} else if (j(this._camera)) {
|
|
1032
1032
|
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, h = Math.min(o / a, n / a);
|
|
1033
1033
|
s.push(this.zoomTo(h, t));
|
|
1034
1034
|
}
|
|
@@ -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 = b.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
1052
|
h.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -1086,7 +1086,7 @@ class J extends ws {
|
|
|
1086
1086
|
*/
|
|
1087
1087
|
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, _, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g =
|
|
1089
|
+
const g = b.set(i, r, o), y = L.set(e, t, s);
|
|
1090
1090
|
k.setFromVector3(
|
|
1091
1091
|
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
@@ -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(b), o = this.setLookAt(
|
|
1149
1149
|
r.x,
|
|
1150
1150
|
r.y,
|
|
1151
1151
|
r.z,
|
|
@@ -1195,8 +1195,8 @@ class J extends ws {
|
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
1197
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1198
|
-
const i =
|
|
1199
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1198
|
+
const i = b.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1199
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), b.copy(F).add(N).add(Z), b.z = b.z + r, this.dollyTo(r, !1), this.setFocalOffset(-b.x, b.y, -b.z, !1), this.moveTo(e, t, s, !1);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -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 (Ee(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 (Ee(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);
|
|
@@ -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(b);
|
|
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 = b.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1359
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1360
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(b);
|
|
1361
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
@@ -1368,11 +1368,11 @@ 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 = Be.subVectors(this._targetEnd, this._target), o = Ve.subVectors(
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
1375
|
-
if (
|
|
1375
|
+
if (S(t))
|
|
1376
1376
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1377
1377
|
else {
|
|
1378
1378
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1385,7 +1385,7 @@ class J extends ws {
|
|
|
1385
1385
|
e
|
|
1386
1386
|
), this._needsUpdate = !0;
|
|
1387
1387
|
}
|
|
1388
|
-
if (
|
|
1388
|
+
if (S(s))
|
|
1389
1389
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1390
1390
|
else {
|
|
1391
1391
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1398,7 +1398,7 @@ class J extends ws {
|
|
|
1398
1398
|
e
|
|
1399
1399
|
), this._needsUpdate = !0;
|
|
1400
1400
|
}
|
|
1401
|
-
if (
|
|
1401
|
+
if (S(i))
|
|
1402
1402
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1403
1403
|
else {
|
|
1404
1404
|
const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1411,7 +1411,7 @@ class J extends ws {
|
|
|
1411
1411
|
e
|
|
1412
1412
|
), this._needsUpdate = !0;
|
|
1413
1413
|
}
|
|
1414
|
-
if (
|
|
1414
|
+
if (S(r.x) && S(r.y) && S(r.z))
|
|
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;
|
|
@@ -1425,7 +1425,7 @@ class J extends ws {
|
|
|
1425
1425
|
this._target
|
|
1426
1426
|
), this._needsUpdate = !0;
|
|
1427
1427
|
}
|
|
1428
|
-
if (
|
|
1428
|
+
if (S(o.x) && S(o.y) && S(o.z))
|
|
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;
|
|
@@ -1439,7 +1439,7 @@ class J extends ws {
|
|
|
1439
1439
|
this._focalOffset
|
|
1440
1440
|
), this._needsUpdate = !0;
|
|
1441
1441
|
}
|
|
1442
|
-
if (
|
|
1442
|
+
if (S(n))
|
|
1443
1443
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1444
1444
|
else {
|
|
1445
1445
|
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1454,7 +1454,7 @@ 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, _ = this._getCameraDirection(ne), u =
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne), u = b.copy(_).cross(v.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
1459
|
const g = L.crossVectors(u, _), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), f = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
@@ -1462,37 +1462,37 @@ class J extends ws {
|
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
), C =
|
|
1465
|
+
), C = b.copy(this._targetEnd).lerp(O, f), w = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
1466
|
if (this.infinityDolly && (w || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
-
const
|
|
1469
|
-
C.add(
|
|
1468
|
+
const D = L.copy(_).multiplyScalar(-p);
|
|
1469
|
+
C.add(D);
|
|
1470
1470
|
}
|
|
1471
1471
|
this._boundary.clampPoint(C, C);
|
|
1472
|
-
const
|
|
1473
|
-
this._targetEnd.copy(C), this._target.add(
|
|
1474
|
-
} else if (
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera, _ =
|
|
1472
|
+
const x = L.subVectors(C, this._targetEnd);
|
|
1473
|
+
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= p, S(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
|
+
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, _ = b.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(u.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, f = this._getCameraDirection(ne), O = this._targetEnd.dot(f), C =
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(u.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, f = this._getCameraDirection(ne), O = this._targetEnd.dot(f), C = b.copy(this._targetEnd).lerp(g, l), w = C.dot(f), E = f.multiplyScalar(
|
|
1480
1480
|
w - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1483
|
-
const
|
|
1484
|
-
this._targetEnd.copy(C), this._target.add(
|
|
1483
|
+
const x = L.subVectors(C, this._targetEnd);
|
|
1484
|
+
this._targetEnd.copy(C), this._target.add(x), this._changedZoom -= p, S(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), (!
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), b.copy(F).add(N).add(Z), this._camera.position.add(b), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
|
-
|
|
1491
|
+
b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const m = this._needsUpdate;
|
|
1495
|
-
return m && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : m ? (this.dispatchEvent({ type: "update" }),
|
|
1495
|
+
return m && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : m ? (this.dispatchEvent({ type: "update" }), S(t, this.restThreshold) && S(s, this.restThreshold) && S(i, this.restThreshold) && S(r.x, this.restThreshold) && S(r.y, this.restThreshold) && S(r.z, this.restThreshold) && S(o.x, this.restThreshold) && S(o.y, this.restThreshold) && S(o.z, this.restThreshold) && S(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !m && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = m, this._needsUpdate = !1, m;
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
1498
1498
|
* Get all state in JSON string
|
|
@@ -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: b.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1519
1519
|
zoom: this._zoomEnd,
|
|
1520
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1521
1521
|
target0: this._target0.toArray(),
|
|
@@ -1533,7 +1533,7 @@ class J extends 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
|
+
b.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],
|
|
@@ -1606,7 +1606,7 @@ class J extends ws {
|
|
|
1606
1606
|
if (Y(this._camera)) {
|
|
1607
1607
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1608
1608
|
this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
|
|
1609
|
-
} else if (
|
|
1609
|
+
} else if (j(this._camera)) {
|
|
1610
1610
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
1611
1611
|
this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
|
|
1612
1612
|
}
|
|
@@ -1614,13 +1614,13 @@ 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) || Ee(this._camera, "_collisionTest"))
|
|
1618
1618
|
return e;
|
|
1619
1619
|
const s = this._getTargetDirection(ne);
|
|
1620
|
-
|
|
1620
|
+
xe.lookAt(je, s, this._camera.up);
|
|
1621
1621
|
for (let i = 0; i < 4; i++) {
|
|
1622
1622
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1623
|
-
r.applyMatrix4(
|
|
1623
|
+
r.applyMatrix4(xe);
|
|
1624
1624
|
const o = G.addVectors(this._target, r);
|
|
1625
1625
|
me.set(o, s), me.far = this._spherical.radius + 1;
|
|
1626
1626
|
const n = me.intersectObjects(this.colliderMeshes);
|
|
@@ -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
|
+
b.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(b));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null,
|
|
1710
|
+
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, We = 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,52 +1715,52 @@ 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
|
-
function
|
|
1725
|
-
|
|
1724
|
+
function A() {
|
|
1725
|
+
A.init.call(this);
|
|
1726
1726
|
}
|
|
1727
|
-
Ae.exports =
|
|
1728
|
-
Ae.exports.once =
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
var
|
|
1727
|
+
Ae.exports = A;
|
|
1728
|
+
Ae.exports.once = Ms;
|
|
1729
|
+
A.EventEmitter = A;
|
|
1730
|
+
A.prototype._events = void 0;
|
|
1731
|
+
A.prototype._eventsCount = 0;
|
|
1732
|
+
A.prototype._maxListeners = void 0;
|
|
1733
|
+
var Ke = 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);
|
|
1737
1737
|
}
|
|
1738
|
-
Object.defineProperty(
|
|
1738
|
+
Object.defineProperty(A, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
|
-
return
|
|
1741
|
+
return Ke;
|
|
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
|
+
Ke = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
|
-
|
|
1749
|
+
A.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
|
-
|
|
1753
|
-
if (typeof e != "number" || e < 0 ||
|
|
1752
|
+
A.prototype.setMaxListeners = function(e) {
|
|
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
|
|
1758
|
-
return c._maxListeners === void 0 ?
|
|
1757
|
+
function ft(c) {
|
|
1758
|
+
return c._maxListeners === void 0 ? A.defaultMaxListeners : c._maxListeners;
|
|
1759
1759
|
}
|
|
1760
|
-
|
|
1761
|
-
return
|
|
1760
|
+
A.prototype.getMaxListeners = function() {
|
|
1761
|
+
return ft(this);
|
|
1762
1762
|
};
|
|
1763
|
-
|
|
1763
|
+
A.prototype.emit = function(e) {
|
|
1764
1764
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
1765
1765
|
var i = e === "error", r = this._events;
|
|
1766
1766
|
if (r !== void 0)
|
|
@@ -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
|
+
We(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var h = a.length, m =
|
|
1784
|
-
|
|
1783
|
+
for (var h = a.length, m = Ct(a, h), s = 0; s < h; ++s)
|
|
1784
|
+
We(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,35 +1792,35 @@ 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
|
-
|
|
1803
|
-
return
|
|
1802
|
+
A.prototype.addListener = function(e, t) {
|
|
1803
|
+
return _t(this, e, t, !1);
|
|
1804
1804
|
};
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
return
|
|
1805
|
+
A.prototype.on = A.prototype.addListener;
|
|
1806
|
+
A.prototype.prependListener = function(e, t) {
|
|
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
|
-
|
|
1818
|
-
return ge(t), this.on(e,
|
|
1817
|
+
A.prototype.once = function(e, t) {
|
|
1818
|
+
return ge(t), this.on(e, gt(this, e, t)), this;
|
|
1819
1819
|
};
|
|
1820
|
-
|
|
1821
|
-
return ge(t), this.prependListener(e,
|
|
1820
|
+
A.prototype.prependOnceListener = function(e, t) {
|
|
1821
|
+
return ge(t), this.prependListener(e, gt(this, e, t)), this;
|
|
1822
1822
|
};
|
|
1823
|
-
|
|
1823
|
+
A.prototype.removeListener = function(e, t) {
|
|
1824
1824
|
var s, i, r, o, n;
|
|
1825
1825
|
if (ge(t), i = this._events, i === void 0)
|
|
1826
1826
|
return this;
|
|
@@ -1836,12 +1836,12 @@ 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() : As(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
|
};
|
|
1843
|
-
|
|
1844
|
-
|
|
1843
|
+
A.prototype.off = A.prototype.removeListener;
|
|
1844
|
+
A.prototype.removeAllListeners = function(e) {
|
|
1845
1845
|
var t, s, i;
|
|
1846
1846
|
if (s = this._events, s === void 0)
|
|
1847
1847
|
return this;
|
|
@@ -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 ? Ss(i) :
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ss(i) : Ct(i, i.length);
|
|
1869
1869
|
}
|
|
1870
|
-
|
|
1871
|
-
return
|
|
1870
|
+
A.prototype.listeners = function(e) {
|
|
1871
|
+
return yt(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
|
-
|
|
1874
|
-
return
|
|
1873
|
+
A.prototype.rawListeners = function(e) {
|
|
1874
|
+
return yt(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
|
-
|
|
1877
|
-
return typeof c.listenerCount == "function" ? c.listenerCount(e) :
|
|
1876
|
+
A.listenerCount = function(c, e) {
|
|
1877
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(e) : vt.call(c, e);
|
|
1878
1878
|
};
|
|
1879
|
-
|
|
1880
|
-
function
|
|
1879
|
+
A.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];
|
|
@@ -1888,15 +1888,15 @@ function Ct(c) {
|
|
|
1888
1888
|
}
|
|
1889
1889
|
return 0;
|
|
1890
1890
|
}
|
|
1891
|
-
|
|
1891
|
+
A.prototype.eventNames = function() {
|
|
1892
1892
|
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function Ct(c, e) {
|
|
1895
1895
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1896
1896
|
t[s] = c[s];
|
|
1897
1897
|
return t;
|
|
1898
1898
|
}
|
|
1899
|
-
function
|
|
1899
|
+
function As(c, e) {
|
|
1900
1900
|
for (; e + 1 < c.length; e++)
|
|
1901
1901
|
c[e] = c[e + 1];
|
|
1902
1902
|
c.pop();
|
|
@@ -1906,7 +1906,7 @@ function Ss(c) {
|
|
|
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
|
+
Ot(c, e, r, { once: !0 }), e !== "error" && Ds(c, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
|
-
function
|
|
1921
|
-
typeof c.on == "function" &&
|
|
1920
|
+
function Ds(c, e, t) {
|
|
1921
|
+
typeof c.on == "function" && Ot(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Ot(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")
|
|
@@ -1931,7 +1931,7 @@ function Et(c, e, t, s) {
|
|
|
1931
1931
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof c);
|
|
1932
1932
|
}
|
|
1933
1933
|
var ye = Ae.exports;
|
|
1934
|
-
let
|
|
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) {
|
|
@@ -1995,9 +2001,9 @@ const Tt = {
|
|
|
1995
2001
|
fov: 45,
|
|
1996
2002
|
near: 1,
|
|
1997
2003
|
far: 1e3,
|
|
1998
|
-
up: new
|
|
2004
|
+
up: new H(0, 1, 0)
|
|
1999
2005
|
};
|
|
2000
|
-
class
|
|
2006
|
+
class Rs extends ee {
|
|
2001
2007
|
constructor(e) {
|
|
2002
2008
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2003
2009
|
}
|
|
@@ -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,7 +2213,7 @@ 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;
|
|
@@ -2216,26 +2222,26 @@ class zs extends ps {
|
|
|
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 ze(this.material) : this._fsQuad && (this._fsQuad = new ze(this.material));
|
|
2220
2226
|
}
|
|
2221
2227
|
}
|
|
2222
|
-
const Fs = new It({ color: "black" }), Ns = new
|
|
2228
|
+
const Fs = new It({ color: "black" }), Ns = new ot({
|
|
2223
2229
|
color: "black",
|
|
2224
2230
|
sizeAttenuation: !1
|
|
2225
|
-
}), Is = new
|
|
2231
|
+
}), Is = new ot({
|
|
2226
2232
|
color: "black",
|
|
2227
2233
|
sizeAttenuation: !0
|
|
2228
|
-
}),
|
|
2234
|
+
}), Hs = new nt({
|
|
2229
2235
|
color: "black",
|
|
2230
2236
|
sizeAttenuation: !0
|
|
2231
|
-
}),
|
|
2237
|
+
}), js = 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
|
+
}), $e = new Ht(0), Vs = {
|
|
2239
2245
|
kernelRadius: 8,
|
|
2240
2246
|
minDistance: 5e-3,
|
|
2241
2247
|
maxDistance: 0.1
|
|
@@ -2250,7 +2256,7 @@ const Fs = new It({ color: "black" }), Ns = new nt({
|
|
|
2250
2256
|
};
|
|
2251
2257
|
class Ws {
|
|
2252
2258
|
constructor(e) {
|
|
2253
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2259
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new jt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2254
2260
|
const {
|
|
2255
2261
|
rendererController: t,
|
|
2256
2262
|
sceneController: s,
|
|
@@ -2265,9 +2271,9 @@ class Ws {
|
|
|
2265
2271
|
samples: Math.min(n, a),
|
|
2266
2272
|
type: Vt
|
|
2267
2273
|
}
|
|
2268
|
-
), p = new
|
|
2274
|
+
), p = new ke(o, m), v = this.getSize();
|
|
2269
2275
|
p.setSize(v.width, v.height);
|
|
2270
|
-
const _ = new
|
|
2276
|
+
const _ = new hs(
|
|
2271
2277
|
s.scene,
|
|
2272
2278
|
i.camera
|
|
2273
2279
|
);
|
|
@@ -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 ke(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 = Hs : n.material = js : o.material instanceof pt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = Is : a.material = Ns : 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 = $e;
|
|
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 === $e) {
|
|
2363
2362
|
const e = this.scene.userData._backgroundOriginal;
|
|
2364
2363
|
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2365
2364
|
}
|
|
@@ -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: H,
|
|
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 H(), Ge = new W(), Xe = new W(), qe = new H(), Qe = new H();
|
|
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(), Ge.copy(g.matrixWorldInverse), Xe.multiplyMatrices(g.projectionMatrix, Ge), m(u, u, g), this.sortObjects && _(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,7 +2476,7 @@ class $s {
|
|
|
2477
2476
|
return;
|
|
2478
2477
|
}
|
|
2479
2478
|
if (u.isCSS2DObject) {
|
|
2480
|
-
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(
|
|
2479
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Xe);
|
|
2481
2480
|
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, f = u.element;
|
|
2482
2481
|
f.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), f.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", f.parentNode !== a && a.appendChild(f), u.onAfterRender(t, g, y));
|
|
2483
2482
|
const O = {
|
|
@@ -2489,7 +2488,7 @@ class $s {
|
|
|
2489
2488
|
m(u.children[l], g, y);
|
|
2490
2489
|
}
|
|
2491
2490
|
function p(u, g) {
|
|
2492
|
-
return
|
|
2491
|
+
return qe.setFromMatrixPosition(u.matrixWorld), Qe.setFromMatrixPosition(g.matrixWorld), qe.distanceToSquared(Qe);
|
|
2493
2492
|
}
|
|
2494
2493
|
function v(u) {
|
|
2495
2494
|
const g = [];
|
|
@@ -2509,7 +2508,7 @@ class $s {
|
|
|
2509
2508
|
}
|
|
2510
2509
|
}
|
|
2511
2510
|
}
|
|
2512
|
-
const
|
|
2511
|
+
const Je = new H(), Gs = new at(), et = new H(), I = new W(), Xs = new W();
|
|
2513
2512
|
class qs {
|
|
2514
2513
|
/**
|
|
2515
2514
|
* Constructs a new CSS3D renderer.
|
|
@@ -2537,8 +2536,8 @@ class qs {
|
|
|
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
2537
|
let O, C;
|
|
2539
2538
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2540
|
-
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + f + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + f + "px)" + v(l.matrixWorldInverse),
|
|
2541
|
-
n.camera.style !==
|
|
2539
|
+
const w = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${w} )scale(` + f + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${w} )translateZ(` + f + "px)" + v(l.matrixWorldInverse), D = (l.isPerspectiveCamera ? "perspective(" + f + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2540
|
+
n.camera.style !== D && (m.style.transform = D, n.camera.style = D), 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";
|
|
2544
2543
|
};
|
|
@@ -2568,12 +2567,12 @@ class qs {
|
|
|
2568
2567
|
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2569
2568
|
y.onBeforeRender(t, l, f);
|
|
2570
2569
|
let E;
|
|
2571
|
-
y.isCSS3DSprite ? (I.copy(f.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Xs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(
|
|
2572
|
-
const
|
|
2573
|
-
if (
|
|
2570
|
+
y.isCSS3DSprite ? (I.copy(f.matrixWorldInverse), I.transpose(), y.rotation2D !== 0 && I.multiply(Xs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(Je, Gs, et), I.setPosition(Je), I.scale(et), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, E = _(I)) : E = _(y.matrixWorld);
|
|
2571
|
+
const x = n.objects.get(y);
|
|
2572
|
+
if (x === void 0 || x.style !== E) {
|
|
2574
2573
|
w.style.transform = E;
|
|
2575
|
-
const
|
|
2576
|
-
n.objects.set(y,
|
|
2574
|
+
const D = { style: E };
|
|
2575
|
+
n.objects.set(y, D);
|
|
2577
2576
|
}
|
|
2578
2577
|
w.parentNode !== m && m.appendChild(w), y.onAfterRender(t, l, f);
|
|
2579
2578
|
}
|
|
@@ -2583,7 +2582,7 @@ class qs {
|
|
|
2583
2582
|
}
|
|
2584
2583
|
}
|
|
2585
2584
|
}
|
|
2586
|
-
const
|
|
2585
|
+
const tt = {
|
|
2587
2586
|
zIndex: "auto"
|
|
2588
2587
|
};
|
|
2589
2588
|
class Qs {
|
|
@@ -2628,11 +2627,11 @@ class Js {
|
|
|
2628
2627
|
else if (e.isHemisphereLight)
|
|
2629
2628
|
i = new Qt(e, 10);
|
|
2630
2629
|
else if (e.isRectAreaLight)
|
|
2631
|
-
i = new
|
|
2630
|
+
i = new us(e);
|
|
2632
2631
|
else {
|
|
2633
|
-
const r = new
|
|
2632
|
+
const r = new lt();
|
|
2634
2633
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2635
|
-
i = new
|
|
2634
|
+
i = new Re(r);
|
|
2636
2635
|
const o = i.material;
|
|
2637
2636
|
o.userData.object = e, o.depthTest = !1, o.transparent = !0;
|
|
2638
2637
|
} else
|
|
@@ -2642,7 +2641,7 @@ class Js {
|
|
|
2642
2641
|
}
|
|
2643
2642
|
}
|
|
2644
2643
|
addViewHelper() {
|
|
2645
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2644
|
+
const { cameraController: e, container: t } = this.options, s = new fs(e.camera, t);
|
|
2646
2645
|
t.addEventListener("pointerdown", (i) => {
|
|
2647
2646
|
i.preventDefault(), s.handleClick(i);
|
|
2648
2647
|
}), this.viewHelper = s;
|
|
@@ -2673,7 +2672,7 @@ class Js {
|
|
|
2673
2672
|
var r, o;
|
|
2674
2673
|
const { cameraController: i } = this.options;
|
|
2675
2674
|
Object.values(this.helpers).forEach((n) => {
|
|
2676
|
-
if (n.update && n.update(), n instanceof
|
|
2675
|
+
if (n.update && n.update(), n instanceof Re) {
|
|
2677
2676
|
const a = n.material, { object: h } = a.userData;
|
|
2678
2677
|
h && n.box.setFromObject(h, !0);
|
|
2679
2678
|
}
|
|
@@ -2692,7 +2691,7 @@ class Js {
|
|
|
2692
2691
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2693
2692
|
}
|
|
2694
2693
|
}
|
|
2695
|
-
function
|
|
2694
|
+
function st(c) {
|
|
2696
2695
|
let e = !1, t = [];
|
|
2697
2696
|
return function(...s) {
|
|
2698
2697
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
@@ -2742,7 +2741,7 @@ class ei {
|
|
|
2742
2741
|
};
|
|
2743
2742
|
this.domElement.addEventListener(
|
|
2744
2743
|
`pointer${e}`,
|
|
2745
|
-
|
|
2744
|
+
st(i),
|
|
2746
2745
|
{ passive: !1 }
|
|
2747
2746
|
);
|
|
2748
2747
|
}
|
|
@@ -2867,7 +2866,7 @@ class ei {
|
|
|
2867
2866
|
mouseEvent: p
|
|
2868
2867
|
}));
|
|
2869
2868
|
}, m = `pointer${t}`;
|
|
2870
|
-
a.element.addEventListener(m,
|
|
2869
|
+
a.element.addEventListener(m, st(h), !1), o.push({ arr: a, type: m, listener: h });
|
|
2871
2870
|
}
|
|
2872
2871
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2873
2872
|
}
|
|
@@ -2889,16 +2888,16 @@ class ei {
|
|
|
2889
2888
|
}
|
|
2890
2889
|
class ti extends ei {
|
|
2891
2890
|
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
|
|
2891
|
+
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
2892
|
key: "@Scene",
|
|
2894
2893
|
name: "场景",
|
|
2895
2894
|
mList: !1
|
|
2896
|
-
}), this.group = this.createBaseObject(new
|
|
2895
|
+
}), this.group = this.createBaseObject(new Ue(), {
|
|
2897
2896
|
key: "@Group",
|
|
2898
2897
|
name: "物体组",
|
|
2899
2898
|
target: this.scene,
|
|
2900
2899
|
mList: !1
|
|
2901
|
-
}), this.prefabGroup = this.createBaseObject(new
|
|
2900
|
+
}), this.prefabGroup = this.createBaseObject(new Ue(), {
|
|
2902
2901
|
key: "@PrefabGroup",
|
|
2903
2902
|
name: "预制组",
|
|
2904
2903
|
target: this.scene,
|
|
@@ -2911,7 +2910,7 @@ class ti extends ei {
|
|
|
2911
2910
|
createBaseObject(e, t = {}) {
|
|
2912
2911
|
const s = U({
|
|
2913
2912
|
mList: !0
|
|
2914
|
-
}, t), i = new
|
|
2913
|
+
}, t), i = new ls();
|
|
2915
2914
|
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
2915
|
if (s.target.key === "@Scene" && e instanceof Jt)
|
|
2917
2916
|
i.key = "@Camera";
|
|
@@ -2993,7 +2992,7 @@ class ti extends ei {
|
|
|
2993
2992
|
{
|
|
2994
2993
|
type: t.type,
|
|
2995
2994
|
key: t.key,
|
|
2996
|
-
uId:
|
|
2995
|
+
uId: _s()
|
|
2997
2996
|
},
|
|
2998
2997
|
s
|
|
2999
2998
|
) : (e.key = i, e.keyType = o, e.keyUId = n, e.keyName = r, this.objects.set(i, e), i);
|
|
@@ -3097,12 +3096,12 @@ class si extends ee {
|
|
|
3097
3096
|
});
|
|
3098
3097
|
}
|
|
3099
3098
|
}
|
|
3100
|
-
class ii extends
|
|
3099
|
+
class ii extends dt {
|
|
3101
3100
|
constructor(e) {
|
|
3102
3101
|
super(e);
|
|
3103
3102
|
}
|
|
3104
3103
|
load(e, t, s, i) {
|
|
3105
|
-
const r = new
|
|
3104
|
+
const r = new Pe(this.manager);
|
|
3106
3105
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3107
3106
|
e,
|
|
3108
3107
|
(o) => {
|
|
@@ -3118,7 +3117,7 @@ class ii extends pt {
|
|
|
3118
3117
|
);
|
|
3119
3118
|
}
|
|
3120
3119
|
}
|
|
3121
|
-
class
|
|
3120
|
+
class it extends dt {
|
|
3122
3121
|
constructor(e) {
|
|
3123
3122
|
super(e), this.options = { type: "image" };
|
|
3124
3123
|
}
|
|
@@ -3128,7 +3127,7 @@ class rt extends pt {
|
|
|
3128
3127
|
load(e, t, s, i) {
|
|
3129
3128
|
let r, o;
|
|
3130
3129
|
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
|
|
3130
|
+
const n = new Pe(this.manager);
|
|
3132
3131
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3133
3132
|
e,
|
|
3134
3133
|
(a) => {
|
|
@@ -3209,21 +3208,21 @@ class oi {
|
|
|
3209
3208
|
}
|
|
3210
3209
|
getLoader(e, t) {
|
|
3211
3210
|
if (e === "images")
|
|
3212
|
-
return this.textureLoader || (this.textureLoader = new
|
|
3211
|
+
return this.textureLoader || (this.textureLoader = new it(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
3213
3212
|
if (e === "media")
|
|
3214
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
3213
|
+
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
3214
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3216
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3215
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Fe(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
3216
|
if (e === "gltf")
|
|
3218
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3217
|
+
return this.gltfLoader || (this.gltfLoader = new Fe(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3219
3218
|
if (e === "lottie")
|
|
3220
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
3219
|
+
return this.lottieLoader || (this.lottieLoader = new Cs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3221
3220
|
if (e === "gzipJson")
|
|
3222
3221
|
return this.gzipJsonLoader || (this.gzipJsonLoader = new ii(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3223
3222
|
if (e === "json")
|
|
3224
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
3223
|
+
return this.jsonLoader || (this.jsonLoader = new Pe(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3225
3224
|
if (e === "exr")
|
|
3226
|
-
return this.exrLoader || (this.exrLoader = new
|
|
3225
|
+
return this.exrLoader || (this.exrLoader = new vs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3227
3226
|
}
|
|
3228
3227
|
add(e, t) {
|
|
3229
3228
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
@@ -3259,7 +3258,7 @@ class oi {
|
|
|
3259
3258
|
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3260
3259
|
if (!s)
|
|
3261
3260
|
return;
|
|
3262
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3261
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = gs();
|
|
3263
3262
|
if (i) {
|
|
3264
3263
|
if (this.assets.has(e))
|
|
3265
3264
|
return this.assets.get(e);
|
|
@@ -3420,7 +3419,7 @@ class li {
|
|
|
3420
3419
|
}
|
|
3421
3420
|
disposeMaterial(e) {
|
|
3422
3421
|
if (!e) return;
|
|
3423
|
-
const t = new
|
|
3422
|
+
const t = new Le();
|
|
3424
3423
|
t.track(Array.isArray(e) ? e : [e]), t.dispose();
|
|
3425
3424
|
}
|
|
3426
3425
|
remove(e) {
|
|
@@ -3513,7 +3512,7 @@ class li {
|
|
|
3513
3512
|
});
|
|
3514
3513
|
}
|
|
3515
3514
|
applyColorSpaceToMaterials(e) {
|
|
3516
|
-
|
|
3515
|
+
Os({ material: e });
|
|
3517
3516
|
}
|
|
3518
3517
|
material2array(e) {
|
|
3519
3518
|
return Array.isArray(e) ? e : [e];
|
|
@@ -3557,7 +3556,7 @@ class li {
|
|
|
3557
3556
|
});
|
|
3558
3557
|
}
|
|
3559
3558
|
dispose() {
|
|
3560
|
-
const e = new
|
|
3559
|
+
const e = new Le();
|
|
3561
3560
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3562
3561
|
}
|
|
3563
3562
|
}
|
|
@@ -3584,7 +3583,7 @@ const ci = {
|
|
|
3584
3583
|
powerPreference: "high-performance",
|
|
3585
3584
|
toneMappingExposure: 1,
|
|
3586
3585
|
alpha: !1,
|
|
3587
|
-
outputColorSpace:
|
|
3586
|
+
outputColorSpace: Es.sRGB,
|
|
3588
3587
|
logarithmicDepthBuffer: !1,
|
|
3589
3588
|
preserveDrawingBuffer: !1,
|
|
3590
3589
|
stencil: !1,
|
|
@@ -3645,12 +3644,12 @@ class mi extends ee {
|
|
|
3645
3644
|
super(), this.options = e;
|
|
3646
3645
|
}
|
|
3647
3646
|
addScene(e, t) {
|
|
3648
|
-
const s = new
|
|
3647
|
+
const s = new ct();
|
|
3649
3648
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
3650
3649
|
}
|
|
3651
3650
|
removePage(e) {
|
|
3652
3651
|
super.removePage(e, (t) => {
|
|
3653
|
-
const s = new
|
|
3652
|
+
const s = new Le();
|
|
3654
3653
|
s.track(t), s.dispose();
|
|
3655
3654
|
});
|
|
3656
3655
|
}
|
|
@@ -3663,7 +3662,7 @@ class mi extends ee {
|
|
|
3663
3662
|
class ui {
|
|
3664
3663
|
constructor(e) {
|
|
3665
3664
|
this.event = new ye.EventEmitter();
|
|
3666
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
3665
|
+
const { renderer: t, scene: s, camera: i } = e, r = new ws(
|
|
3667
3666
|
i,
|
|
3668
3667
|
t.domElement
|
|
3669
3668
|
);
|
|
@@ -3755,8 +3754,8 @@ class _i {
|
|
|
3755
3754
|
const _e = class _e {
|
|
3756
3755
|
constructor(e) {
|
|
3757
3756
|
var r, o;
|
|
3758
|
-
this.raycaster = new
|
|
3759
|
-
isMergeableObject:
|
|
3757
|
+
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new H(), this._cameraTarget = new H(), this.event = new ye.EventEmitter(), this.timer = new ns(), this.userData = {}, this.pageActiveIndex = 0, this.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 = Rt(_e.options, e, {
|
|
3758
|
+
isMergeableObject: Ts
|
|
3760
3759
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3761
3760
|
const {
|
|
3762
3761
|
container: t,
|
|
@@ -3814,16 +3813,16 @@ const _e = class _e {
|
|
|
3814
3813
|
sceneOptions: e,
|
|
3815
3814
|
cameraOptions: t
|
|
3816
3815
|
} = {}) {
|
|
3817
|
-
const s = this.
|
|
3816
|
+
const s = this.pages.getMinDisabledLayer(), i = this.cameraController.addPerspectiveCamera(
|
|
3818
3817
|
t,
|
|
3819
3818
|
s
|
|
3820
3819
|
), r = this.sceneController.addScene(e, s);
|
|
3821
3820
|
r.add(i), this.controlsController.addCameraControls(i, s), this.loaderController.addLoader(r, s);
|
|
3822
3821
|
const o = this.mListController.addMList(null, s);
|
|
3823
|
-
return this.leadController.addLead(r, o, s), this.
|
|
3822
|
+
return this.leadController.addLead(r, o, s), this.pages.enable(s), s;
|
|
3824
3823
|
}
|
|
3825
3824
|
removePage(e) {
|
|
3826
|
-
this.
|
|
3825
|
+
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
3826
|
}
|
|
3828
3827
|
showPage(e) {
|
|
3829
3828
|
var s;
|
|
@@ -3855,7 +3854,7 @@ const _e = class _e {
|
|
|
3855
3854
|
})
|
|
3856
3855
|
});
|
|
3857
3856
|
this.rendererController = m;
|
|
3858
|
-
const p = new
|
|
3857
|
+
const p = new Rs({
|
|
3859
3858
|
width: a,
|
|
3860
3859
|
height: h
|
|
3861
3860
|
}), v = new mi({}), _ = new Ks({
|
|
@@ -4076,16 +4075,16 @@ _e.options = {
|
|
|
4076
4075
|
loader: ni,
|
|
4077
4076
|
ssaoParams: Vs,
|
|
4078
4077
|
css2DRenderer: !1,
|
|
4079
|
-
css2DRendererParams: U({},
|
|
4078
|
+
css2DRendererParams: U({}, tt),
|
|
4080
4079
|
css3DRenderer: !1,
|
|
4081
|
-
css3DRendererParams: U({},
|
|
4080
|
+
css3DRendererParams: U({}, tt)
|
|
4082
4081
|
};
|
|
4083
|
-
let
|
|
4082
|
+
let rt = _e;
|
|
4084
4083
|
const Xi = J.ACTION;
|
|
4085
4084
|
export {
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4085
|
+
ls as BaseObject,
|
|
4086
|
+
rt as Pencil,
|
|
4087
|
+
Le as ResourceTracker,
|
|
4089
4088
|
Xi as cameraControlsAction,
|
|
4090
|
-
|
|
4089
|
+
rt as default
|
|
4091
4090
|
};
|