gl-draw 0.14.35 → 0.14.36
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.d.ts +19 -19
- package/dist/core/CSSRenderer/index.d.ts +2 -2
- package/dist/core/Camera.d.ts +10 -10
- package/dist/core/Composer.d.ts +9 -9
- package/dist/core/Controls.d.ts +2 -2
- package/dist/core/Helper.d.ts +3 -3
- package/dist/core/Lead/Lead.d.ts +5 -5
- package/dist/core/Lead/index.d.ts +2 -2
- package/dist/core/Loader/GzipJSONLoader.d.ts +4 -4
- package/dist/core/Loader/Loader.d.ts +22 -22
- package/dist/core/Loader/TextureLoader.d.ts +4 -4
- package/dist/core/Loader/index.d.ts +2 -2
- package/dist/core/Pencil.d.ts +11 -11
- package/dist/core/Renderer.d.ts +3 -3
- package/dist/core/ResourceTracker.d.ts +4 -4
- package/dist/core/Scene.d.ts +5 -5
- package/dist/core/TransformControls/index.d.ts +5 -5
- package/dist/core/WebGPURenderer.d.ts +2 -2
- package/dist/effect/index.js +3 -3
- package/dist/effect/index.module.js +41 -41
- package/dist/effect/scan.d.ts +3 -3
- package/dist/effect/scan2.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.module.js +526 -557
- package/dist/index.module2.js +251 -255
- package/dist/index2.js +5 -5
- package/dist/objects/conicPolygon/index.d.ts +3 -3
- package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +23 -3
- package/dist/objects/extrudePolygon/ExtrudeGeometry2.d.ts +2 -2
- package/dist/objects/extrudePolygon/createGeometry.d.ts +22 -22
- package/dist/objects/extrudePolygon/getSplitTexture.d.ts +2 -2
- package/dist/objects/extrudePolygon/index.d.ts +9 -9
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +539 -565
- package/dist/objects/light/index.d.ts +6 -6
- package/dist/objects/line/index.d.ts +4 -4
- package/dist/objects/line/meshLine/MeshLineGeometry.d.ts +15 -15
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +14 -14
- package/dist/objects/line/meshLine/index.d.ts +0 -1
- package/dist/objects/line2/createGeometry.d.ts +3 -3
- package/dist/objects/line2/index.d.ts +5 -5
- package/dist/objects/node/index.d.ts +3 -3
- package/dist/objects/pie/index.d.ts +67 -4
- package/dist/objects/scene/index.d.ts +2 -2
- package/dist/parseVector.js +1 -1
- package/dist/parseVector.module.js +10 -10
- package/dist/plugins/Worker/createGeometry.d.ts +2 -2
- package/dist/plugins/Worker/getAttributes/coords2Vector.d.ts +2 -2
- package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +1 -2
- package/dist/plugins/Worker/getAttributes/line2.d.ts +1 -2
- package/dist/plugins/Worker/getAttributes/splitPolygonsByLongitudeDifference.d.ts +2 -2
- package/dist/plugins/Worker/index.d.ts +8 -8
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +91 -91
- package/dist/utils/Sprite2Points.d.ts +2 -2
- package/dist/utils/colorCorrection.d.ts +4 -4
- package/dist/utils/parseVector.d.ts +3 -3
- package/dist/utils/uvGenerator.d.ts +4 -4
- package/dist/uvGenerator.js +1 -1
- package/dist/uvGenerator.module.js +46 -67
- package/package.json +1 -1
- package/dist/objects/fix.d.ts +0 -5
- package/dist/objects/line/meshLine/raycast.d.ts +0 -3
package/dist/index.module.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Lt = Object.defineProperty, St = Object.defineProperties;
|
|
2
|
+
var At = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ae = Object.getOwnPropertySymbols;
|
|
4
|
+
var Mt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Me = (l, e, t) => e in l ? Lt(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, U = (l, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
7
|
+
Mt.call(e, t) && Me(l, t, e[t]);
|
|
8
|
+
if (Ae)
|
|
9
|
+
for (var t of Ae(e))
|
|
10
|
+
Dt.call(e, t) && Me(l, t, e[t]);
|
|
11
11
|
return l;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, ee = (l, e) => St(l, At(e));
|
|
13
|
+
var te = (l, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (h) => {
|
|
15
15
|
try {
|
|
16
16
|
a(t.next(h));
|
|
@@ -26,24 +26,23 @@ var J = (l, e, t) => new Promise((s, i) => {
|
|
|
26
26
|
}, a = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(r, o);
|
|
27
27
|
a((t = t.apply(l, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import { UnrealBloomPass as Ht } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
29
|
+
import { WebGLRenderer as Rt, Vector2 as V, Vector3 as I, PerspectiveCamera as Ut, Matrix4 as W, Scene as ot, AxesHelper as De, CameraHelper as zt, PointLightHelper as kt, DirectionalLightHelper as Ft, SpotLightHelper as Nt, HemisphereLightHelper as Ht, Box3 as nt, Box3Helper as Re, MathUtils as It, Vector4 as jt, Quaternion as at, Spherical as Vt, Sphere as Bt, Raycaster as ht, REVISION as Yt, Object3D as Zt, UniformsUtils as Wt, RawShaderMaterial as Gt, ShaderMaterial as Kt, MeshBasicMaterial as Xt, PointsMaterial as lt, SpriteMaterial as ct, Layers as qt, WebGLRenderTarget as $t, HalfFloatType as Qt, Loader as dt, Texture as fe, VideoTexture as pt, FileLoader as Le, LoadingManager as Jt, DataTexture as es, Mesh as ts } from "three";
|
|
30
|
+
import { Timer as ss } from "three/examples/jsm/misc/Timer";
|
|
31
|
+
import * as Ce from "@tweenjs/tween.js";
|
|
32
|
+
import is from "deepmerge";
|
|
33
|
+
import rs from "stats-gl";
|
|
34
|
+
import { C as os, c as ns, i as as } from "./isPlainObject.module.js";
|
|
35
|
+
import { R as hs, M as mt, B as ls, G as Ue } from "./index.module2.js";
|
|
36
|
+
import { RectAreaLightHelper as cs } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
37
|
+
import { ViewHelper as ds } from "three/examples/jsm/helpers/ViewHelper";
|
|
38
|
+
import { TransformControls as ps } from "three/examples/jsm/controls/TransformControls";
|
|
39
|
+
import { EffectComposer as ze } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
40
|
+
import { RenderPass as ms } from "three/examples/jsm/postprocessing/RenderPass";
|
|
41
|
+
import { SSAOPass as us } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
42
|
+
import { FullScreenQuad as ke } from "three/examples/jsm/postprocessing/Pass";
|
|
43
|
+
import { OutputPass as fs } from "three/examples/jsm/postprocessing/OutputPass";
|
|
44
|
+
import { ShaderPass as _s } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
45
|
+
import { UnrealBloomPass as gs } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
47
46
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
48
47
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
49
48
|
import "d3-geo";
|
|
@@ -54,12 +53,12 @@ import "three/examples/jsm/lines/LineSegments2";
|
|
|
54
53
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
55
54
|
import "three/examples/jsm/lines/LineMaterial";
|
|
56
55
|
import "three-bvh-csg";
|
|
57
|
-
import { GLTFLoader as
|
|
58
|
-
import { DRACOLoader as
|
|
59
|
-
import { EXRLoader as
|
|
60
|
-
import { LottieLoader as
|
|
61
|
-
import { makePromiseCreator as
|
|
62
|
-
const
|
|
56
|
+
import { GLTFLoader as Fe } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
+
import { DRACOLoader as vs } from "three/examples/jsm/loaders/DRACOLoader";
|
|
58
|
+
import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
|
|
59
|
+
import { LottieLoader as Cs } from "three/examples/jsm/loaders/LottieLoader";
|
|
60
|
+
import { makePromiseCreator as Es, generateUUID as Ne } from "esus-lite";
|
|
61
|
+
const M = {
|
|
63
62
|
LEFT: 1,
|
|
64
63
|
RIGHT: 2,
|
|
65
64
|
MIDDLE: 4
|
|
@@ -85,71 +84,71 @@ const D = {
|
|
|
85
84
|
TOUCH_SCREEN_PAN: 131072,
|
|
86
85
|
TOUCH_DOLLY_SCREEN_PAN: 262144,
|
|
87
86
|
TOUCH_ZOOM_SCREEN_PAN: 524288
|
|
88
|
-
}),
|
|
87
|
+
}), G = {
|
|
89
88
|
NONE: 0,
|
|
90
89
|
IN: 1,
|
|
91
90
|
OUT: -1
|
|
92
91
|
};
|
|
93
|
-
function
|
|
92
|
+
function Y(l) {
|
|
94
93
|
return l.isPerspectiveCamera;
|
|
95
94
|
}
|
|
96
95
|
function j(l) {
|
|
97
96
|
return l.isOrthographicCamera;
|
|
98
97
|
}
|
|
99
|
-
const
|
|
100
|
-
function
|
|
98
|
+
const K = Math.PI * 2, He = Math.PI / 2, ut = 1e-5, se = Math.PI / 180;
|
|
99
|
+
function k(l, e, t) {
|
|
101
100
|
return Math.max(e, Math.min(t, l));
|
|
102
101
|
}
|
|
103
|
-
function
|
|
102
|
+
function A(l, e = ut) {
|
|
104
103
|
return Math.abs(l) < e;
|
|
105
104
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
105
|
+
function L(l, e, t = ut) {
|
|
106
|
+
return A(l - e, t);
|
|
108
107
|
}
|
|
109
|
-
function
|
|
108
|
+
function Ie(l, e) {
|
|
110
109
|
return Math.round(l / e) * e;
|
|
111
110
|
}
|
|
112
|
-
function
|
|
111
|
+
function ie(l) {
|
|
113
112
|
return isFinite(l) ? l : l < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
114
113
|
}
|
|
115
|
-
function
|
|
114
|
+
function re(l) {
|
|
116
115
|
return Math.abs(l) < Number.MAX_VALUE ? l : l * (1 / 0);
|
|
117
116
|
}
|
|
118
|
-
function
|
|
117
|
+
function le(l, e, t, s, i = 1 / 0, r) {
|
|
119
118
|
s = Math.max(1e-4, s);
|
|
120
119
|
const o = 2 / s, a = o * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
121
120
|
let d = l - e;
|
|
122
121
|
const f = e, p = i * s;
|
|
123
|
-
d =
|
|
122
|
+
d = k(d, -p, p), e = l - d;
|
|
124
123
|
const C = (t.value + o * d) * r;
|
|
125
124
|
t.value = (t.value - o * C) * h;
|
|
126
125
|
let v = e + (d + C) * h;
|
|
127
126
|
return f - l > 0 == v > f && (v = f, t.value = (v - f) / r), v;
|
|
128
127
|
}
|
|
129
|
-
function
|
|
128
|
+
function je(l, e, t, s, i = 1 / 0, r, o) {
|
|
130
129
|
s = Math.max(1e-4, s);
|
|
131
130
|
const a = 2 / s, h = a * r, d = 1 / (1 + h + 0.48 * h * h + 0.235 * h * h * h);
|
|
132
131
|
let f = e.x, p = e.y, C = e.z, v = l.x - f, m = l.y - p, u = l.z - C;
|
|
133
132
|
const g = f, n = p, _ = C, E = i * s, y = E * E, w = v * v + m * m + u * u;
|
|
134
133
|
if (w > y) {
|
|
135
|
-
const
|
|
136
|
-
v = v /
|
|
134
|
+
const ye = Math.sqrt(w);
|
|
135
|
+
v = v / ye * E, m = m / ye * E, u = u / ye * E;
|
|
137
136
|
}
|
|
138
137
|
f = l.x - v, p = l.y - m, C = l.z - u;
|
|
139
|
-
const
|
|
140
|
-
t.x = (t.x - a *
|
|
141
|
-
const
|
|
142
|
-
return
|
|
138
|
+
const O = (t.x + a * v) * r, b = (t.y + a * m) * r, D = (t.z + a * u) * r;
|
|
139
|
+
t.x = (t.x - a * O) * d, t.y = (t.y - a * b) * d, t.z = (t.z - a * D) * d, o.x = f + (v + O) * d, o.y = p + (m + b) * d, o.z = C + (u + D) * d;
|
|
140
|
+
const B = g - l.x, he = n - l.y, wt = _ - l.z, xt = o.x - g, bt = o.y - n, Pt = o.z - _;
|
|
141
|
+
return B * xt + he * bt + wt * Pt > 0 && (o.x = g, o.y = n, o.z = _, t.x = (o.x - g) / r, t.y = (o.y - n) / r, t.z = (o.z - _) / r), o;
|
|
143
142
|
}
|
|
144
|
-
function
|
|
143
|
+
function Ee(l, e) {
|
|
145
144
|
e.set(0, 0), l.forEach((t) => {
|
|
146
145
|
e.x += t.clientX, e.y += t.clientY;
|
|
147
146
|
}), e.x /= l.length, e.y /= l.length;
|
|
148
147
|
}
|
|
149
|
-
function
|
|
148
|
+
function Oe(l, e) {
|
|
150
149
|
return j(l) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
151
150
|
}
|
|
152
|
-
class
|
|
151
|
+
class Os {
|
|
153
152
|
constructor() {
|
|
154
153
|
this._listeners = {};
|
|
155
154
|
}
|
|
@@ -213,51 +212,11 @@ class Yt {
|
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
214
|
}
|
|
216
|
-
const
|
|
217
|
-
let
|
|
218
|
-
class
|
|
219
|
-
/**
|
|
220
|
-
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
221
|
-
*
|
|
222
|
-
* e.g
|
|
223
|
-
* ```javascript
|
|
224
|
-
* CameraControls.install( { THREE: THREE } );
|
|
225
|
-
* ```
|
|
226
|
-
*
|
|
227
|
-
* Note: If you do not wish to use enter three.js to reduce file size(tree-shaking for example), make a subset to install.
|
|
228
|
-
*
|
|
229
|
-
* ```js
|
|
230
|
-
* import {
|
|
231
|
-
* Vector2,
|
|
232
|
-
* Vector3,
|
|
233
|
-
* Vector4,
|
|
234
|
-
* Quaternion,
|
|
235
|
-
* Matrix4,
|
|
236
|
-
* Spherical,
|
|
237
|
-
* Box3,
|
|
238
|
-
* Sphere,
|
|
239
|
-
* Raycaster,
|
|
240
|
-
* MathUtils,
|
|
241
|
-
* } from 'three';
|
|
242
|
-
*
|
|
243
|
-
* const subsetOfTHREE = {
|
|
244
|
-
* Vector2 : Vector2,
|
|
245
|
-
* Vector3 : Vector3,
|
|
246
|
-
* Vector4 : Vector4,
|
|
247
|
-
* Quaternion: Quaternion,
|
|
248
|
-
* Matrix4 : Matrix4,
|
|
249
|
-
* Spherical : Spherical,
|
|
250
|
-
* Box3 : Box3,
|
|
251
|
-
* Sphere : Sphere,
|
|
252
|
-
* Raycaster : Raycaster,
|
|
253
|
-
* };
|
|
254
|
-
|
|
255
|
-
* CameraControls.install( { THREE: subsetOfTHREE } );
|
|
256
|
-
* ```
|
|
257
|
-
* @category Statics
|
|
258
|
-
*/
|
|
215
|
+
const ce = 1 / 8, Ts = /Mac/.test(navigator.platform);
|
|
216
|
+
let T, Ve, de, Te, R, x, P, X, oe, F, N, Z, Be, Ye, z, ne, q, Ze, we, We, xe, be, pe;
|
|
217
|
+
class J extends Os {
|
|
259
218
|
static install(e) {
|
|
260
|
-
|
|
219
|
+
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), de = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), R = new T.Vector2(), x = new T.Vector3(), P = new T.Vector3(), X = new T.Vector3(), oe = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Be = new T.Vector3(), Ye = new T.Vector3(), z = new T.Spherical(), ne = new T.Spherical(), q = new T.Box3(), Ze = new T.Box3(), we = new T.Sphere(), We = new T.Quaternion(), xe = new T.Quaternion(), be = new T.Matrix4(), pe = new T.Raycaster();
|
|
261
220
|
}
|
|
262
221
|
/**
|
|
263
222
|
* list all ACTIONs
|
|
@@ -285,14 +244,14 @@ class $ extends Yt {
|
|
|
285
244
|
*/
|
|
286
245
|
constructor(e, t) {
|
|
287
246
|
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 = () => {
|
|
288
|
-
}, this._enabled = !0, this._state = c.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 =
|
|
289
|
-
let w,
|
|
290
|
-
if (
|
|
291
|
-
const
|
|
292
|
-
w = this.truckSpeed * n *
|
|
247
|
+
}, this._enabled = !0, this._state = c.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 = G.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 = (n, _, E, y) => {
|
|
248
|
+
let w, O;
|
|
249
|
+
if (Y(this._camera)) {
|
|
250
|
+
const b = x.copy(this._camera.position).sub(this._target), D = this._camera.getEffectiveFOV() * se, B = b.length() * Math.tan(D * 0.5);
|
|
251
|
+
w = this.truckSpeed * n * B / this._elementRect.height, O = this.truckSpeed * _ * B / this._elementRect.height;
|
|
293
252
|
} else if (j(this._camera)) {
|
|
294
|
-
const
|
|
295
|
-
w = this.truckSpeed * n * (
|
|
253
|
+
const b = this._camera;
|
|
254
|
+
w = this.truckSpeed * n * (b.right - b.left) / b.zoom / this._elementRect.width, O = this.truckSpeed * _ * (b.top - b.bottom) / b.zoom / this._elementRect.height;
|
|
296
255
|
} else
|
|
297
256
|
return;
|
|
298
257
|
y ? (E ? this.setFocalOffset(
|
|
@@ -300,63 +259,63 @@ class $ extends Yt {
|
|
|
300
259
|
this._focalOffsetEnd.y,
|
|
301
260
|
this._focalOffsetEnd.z,
|
|
302
261
|
!0
|
|
303
|
-
) : this.truck(w, 0, !0), this.forward(-
|
|
262
|
+
) : this.truck(w, 0, !0), this.forward(-O, !0)) : E ? this.setFocalOffset(
|
|
304
263
|
this._focalOffsetEnd.x + w,
|
|
305
|
-
this._focalOffsetEnd.y +
|
|
264
|
+
this._focalOffsetEnd.y + O,
|
|
306
265
|
this._focalOffsetEnd.z,
|
|
307
266
|
!0
|
|
308
|
-
) : this.truck(w,
|
|
267
|
+
) : this.truck(w, O, !0);
|
|
309
268
|
}, this._rotateInternal = (n, _) => {
|
|
310
|
-
const E =
|
|
269
|
+
const E = K * this.azimuthRotateSpeed * n / this._elementRect.height, y = K * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
311
270
|
this.rotate(E, y, !0);
|
|
312
271
|
}, this._dollyInternal = (n, _, E) => {
|
|
313
|
-
const y = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius,
|
|
314
|
-
|
|
272
|
+
const y = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, O = this._sphericalEnd.radius * y, b = k(
|
|
273
|
+
O,
|
|
315
274
|
this.minDistance,
|
|
316
275
|
this.maxDistance
|
|
317
|
-
),
|
|
318
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(
|
|
276
|
+
), D = b - O;
|
|
277
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(O, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(D, !0), this._dollyToNoClamp(b, !0)) : this._dollyToNoClamp(b, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? O : b) - w, this._dollyControlCoord.set(_, E)), this._lastDollyDirection = Math.sign(-n);
|
|
319
278
|
}, this._zoomInternal = (n, _, E) => {
|
|
320
|
-
const y = Math.pow(0.95, n * this.dollySpeed), w = this._zoom,
|
|
321
|
-
this.zoomTo(
|
|
322
|
-
}, typeof
|
|
279
|
+
const y = Math.pow(0.95, n * this.dollySpeed), w = this._zoom, O = this._zoom * y;
|
|
280
|
+
this.zoomTo(O, !0), this.dollyToCursor && (this._changedZoom += O - w, this._dollyControlCoord.set(_, E));
|
|
281
|
+
}, typeof T == "undefined" && console.error(
|
|
323
282
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
324
|
-
), this._camera = e, this._yAxisUpSpace = new
|
|
283
|
+
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
325
284
|
this._camera.up,
|
|
326
|
-
|
|
327
|
-
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = c.NONE, this._target = new
|
|
328
|
-
|
|
285
|
+
de
|
|
286
|
+
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = c.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.Spherical().setFromVector3(
|
|
287
|
+
x.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
329
288
|
), 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 = [
|
|
330
|
-
new
|
|
331
|
-
new
|
|
332
|
-
new
|
|
333
|
-
new
|
|
334
|
-
], this._updateNearPlaneCorners(), this._boundary = new
|
|
335
|
-
new
|
|
336
|
-
new
|
|
337
|
-
), 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
|
|
289
|
+
new T.Vector3(),
|
|
290
|
+
new T.Vector3(),
|
|
291
|
+
new T.Vector3(),
|
|
292
|
+
new T.Vector3()
|
|
293
|
+
], this._updateNearPlaneCorners(), this._boundary = new T.Box3(
|
|
294
|
+
new T.Vector3(-1 / 0, -1 / 0, -1 / 0),
|
|
295
|
+
new T.Vector3(1 / 0, 1 / 0, 1 / 0)
|
|
296
|
+
), 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 T.Vector2(), this.mouseButtons = {
|
|
338
297
|
left: c.ROTATE,
|
|
339
298
|
middle: c.DOLLY,
|
|
340
299
|
right: c.TRUCK,
|
|
341
|
-
wheel:
|
|
300
|
+
wheel: Y(this._camera) ? c.DOLLY : j(this._camera) ? c.ZOOM : c.NONE
|
|
342
301
|
}, this.touches = {
|
|
343
302
|
one: c.TOUCH_ROTATE,
|
|
344
|
-
two:
|
|
303
|
+
two: Y(this._camera) ? c.TOUCH_DOLLY_TRUCK : j(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
|
|
345
304
|
three: c.TOUCH_TRUCK
|
|
346
305
|
};
|
|
347
|
-
const s = new
|
|
306
|
+
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (n) => {
|
|
348
307
|
if (!this._enabled || !this._domElement) return;
|
|
349
308
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
350
|
-
const y = this._domElement.getBoundingClientRect(), w = (n.clientX - y.left) / (y.right - y.left),
|
|
351
|
-
if (w < this._interactiveArea.left || w > this._interactiveArea.right ||
|
|
309
|
+
const y = this._domElement.getBoundingClientRect(), w = (n.clientX - y.left) / (y.right - y.left), O = (n.clientY - y.top) / (y.bottom - y.top);
|
|
310
|
+
if (w < this._interactiveArea.left || w > this._interactiveArea.right || O < this._interactiveArea.top || O > this._interactiveArea.bottom)
|
|
352
311
|
return;
|
|
353
312
|
}
|
|
354
|
-
const _ = n.pointerType !== "mouse" ? null : (n.buttons &
|
|
313
|
+
const _ = n.pointerType !== "mouse" ? null : (n.buttons & M.LEFT) === M.LEFT ? M.LEFT : (n.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (n.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
|
|
355
314
|
if (_ !== null) {
|
|
356
315
|
const y = this._findPointerByMouseButton(_);
|
|
357
316
|
y && this._disposePointer(y);
|
|
358
317
|
}
|
|
359
|
-
if ((n.buttons &
|
|
318
|
+
if ((n.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
360
319
|
return;
|
|
361
320
|
const E = {
|
|
362
321
|
pointerId: n.pointerId,
|
|
@@ -395,7 +354,7 @@ class $ extends Yt {
|
|
|
395
354
|
break;
|
|
396
355
|
}
|
|
397
356
|
else
|
|
398
|
-
(!this._isDragging && this._lockedPointer || this._isDragging && (n.buttons &
|
|
357
|
+
(!this._isDragging && this._lockedPointer || this._isDragging && (n.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (n.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (n.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
399
358
|
v();
|
|
400
359
|
}
|
|
401
360
|
}, h = (n) => {
|
|
@@ -425,15 +384,15 @@ class $ extends Yt {
|
|
|
425
384
|
const f = (n) => {
|
|
426
385
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === c.NONE) return;
|
|
427
386
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
387
|
+
const O = this._domElement.getBoundingClientRect(), b = (n.clientX - O.left) / (O.right - O.left), D = (n.clientY - O.top) / (O.bottom - O.top);
|
|
388
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || D < this._interactiveArea.top || D > this._interactiveArea.bottom)
|
|
430
389
|
return;
|
|
431
390
|
}
|
|
432
391
|
if (n.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === c.ROTATE || this.mouseButtons.wheel === c.TRUCK) {
|
|
433
|
-
const
|
|
434
|
-
d -
|
|
392
|
+
const O = performance.now();
|
|
393
|
+
d - O < 1e3 && this._getClientRect(this._elementRect), d = O;
|
|
435
394
|
}
|
|
436
|
-
const _ =
|
|
395
|
+
const _ = Ts ? -1 : -3, E = n.deltaMode === 1 || n.ctrlKey ? n.deltaY / _ : n.deltaY / (_ * 10), y = this.dollyToCursor ? (n.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (n.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
437
396
|
switch (this.mouseButtons.wheel) {
|
|
438
397
|
case c.ROTATE: {
|
|
439
398
|
this._rotateInternal(n.deltaX, n.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -463,7 +422,7 @@ class $ extends Yt {
|
|
|
463
422
|
this.dispatchEvent({ type: "control" });
|
|
464
423
|
}, p = (n) => {
|
|
465
424
|
if (!(!this._domElement || !this._enabled)) {
|
|
466
|
-
if (this.mouseButtons.right ===
|
|
425
|
+
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
467
426
|
const _ = n instanceof PointerEvent ? n.pointerId : 0, E = this._findPointerById(_);
|
|
468
427
|
E && this._disposePointer(E), this._domElement.ownerDocument.removeEventListener(
|
|
469
428
|
"pointermove",
|
|
@@ -479,11 +438,11 @@ class $ extends Yt {
|
|
|
479
438
|
}
|
|
480
439
|
}, C = (n) => {
|
|
481
440
|
if (!this._enabled) return;
|
|
482
|
-
if (
|
|
483
|
-
const E =
|
|
441
|
+
if (Ee(this._activePointers, R), this._getClientRect(this._elementRect), s.copy(R), i.copy(R), this._activePointers.length >= 2) {
|
|
442
|
+
const E = R.x - this._activePointers[1].clientX, y = R.y - this._activePointers[1].clientY, w = Math.sqrt(E * E + y * y);
|
|
484
443
|
r.set(0, w);
|
|
485
|
-
const
|
|
486
|
-
i.set(
|
|
444
|
+
const O = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, b = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
445
|
+
i.set(O, b);
|
|
487
446
|
}
|
|
488
447
|
if (this._state = 0, !n)
|
|
489
448
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
@@ -500,33 +459,33 @@ class $ extends Yt {
|
|
|
500
459
|
break;
|
|
501
460
|
}
|
|
502
461
|
else
|
|
503
|
-
!this._lockedPointer && (n.buttons &
|
|
462
|
+
!this._lockedPointer && (n.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (n.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (n.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
504
463
|
((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.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 & c.TRUCK) === c.TRUCK || (this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & c.DOLLY) === c.DOLLY || (this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & c.ZOOM) === c.ZOOM || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
505
464
|
}, v = () => {
|
|
506
465
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
507
|
-
this._dragNeedsUpdate = !1,
|
|
508
|
-
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, E = _ ? -_.deltaX : i.x -
|
|
509
|
-
if (i.copy(
|
|
510
|
-
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0,
|
|
466
|
+
this._dragNeedsUpdate = !1, Ee(this._activePointers, R);
|
|
467
|
+
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, E = _ ? -_.deltaX : i.x - R.x, y = _ ? -_.deltaY : i.y - R.y;
|
|
468
|
+
if (i.copy(R), ((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(E, y), this._isUserControllingRotate = !0), (this._state & c.DOLLY) === c.DOLLY || (this._state & c.ZOOM) === c.ZOOM) {
|
|
469
|
+
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, O = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, b = this.dollyDragInverted ? -1 : 1;
|
|
511
470
|
(this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
|
|
512
|
-
|
|
471
|
+
b * y * ce,
|
|
513
472
|
w,
|
|
514
|
-
|
|
473
|
+
O
|
|
515
474
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
516
|
-
|
|
475
|
+
b * y * ce,
|
|
517
476
|
w,
|
|
518
|
-
|
|
477
|
+
O
|
|
519
478
|
), this._isUserControllingZoom = !0);
|
|
520
479
|
}
|
|
521
480
|
if ((this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) {
|
|
522
|
-
const w =
|
|
523
|
-
r.set(0,
|
|
524
|
-
const
|
|
525
|
-
(this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(
|
|
481
|
+
const w = R.x - this._activePointers[1].clientX, O = R.y - this._activePointers[1].clientY, b = Math.sqrt(w * w + O * O), D = r.y - b;
|
|
482
|
+
r.set(0, b);
|
|
483
|
+
const B = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, he = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
484
|
+
(this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(D * ce, B, he), this._isUserControllingDolly = !0) : (this._zoomInternal(D * ce, B, he), this._isUserControllingZoom = !0);
|
|
526
485
|
}
|
|
527
486
|
((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(E, y, !1, !1), this._isUserControllingTruck = !0), ((this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(E, y, !1, !0), this._isUserControllingTruck = !0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._truckInternal(E, y, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
528
487
|
}, m = () => {
|
|
529
|
-
|
|
488
|
+
Ee(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(
|
|
530
489
|
"pointermove",
|
|
531
490
|
a,
|
|
532
491
|
{ passive: !1 }
|
|
@@ -688,11 +647,11 @@ class $ extends Yt {
|
|
|
688
647
|
* @category Properties
|
|
689
648
|
*/
|
|
690
649
|
set interactiveArea(e) {
|
|
691
|
-
this._interactiveArea.width =
|
|
650
|
+
this._interactiveArea.width = k(e.width, 0, 1), this._interactiveArea.height = k(e.height, 0, 1), this._interactiveArea.x = k(
|
|
692
651
|
e.x,
|
|
693
652
|
0,
|
|
694
653
|
1 - this._interactiveArea.width
|
|
695
|
-
), this._interactiveArea.y =
|
|
654
|
+
), this._interactiveArea.y = k(
|
|
696
655
|
e.y,
|
|
697
656
|
0,
|
|
698
657
|
1 - this._interactiveArea.height
|
|
@@ -830,17 +789,17 @@ class $ extends Yt {
|
|
|
830
789
|
*/
|
|
831
790
|
rotateTo(e, t, s = !1) {
|
|
832
791
|
this._isUserControllingRotate = !1;
|
|
833
|
-
const i =
|
|
792
|
+
const i = k(
|
|
834
793
|
e,
|
|
835
794
|
this.minAzimuthAngle,
|
|
836
795
|
this.maxAzimuthAngle
|
|
837
|
-
), r =
|
|
796
|
+
), r = k(t, this.minPolarAngle, this.maxPolarAngle);
|
|
838
797
|
this._sphericalEnd.theta = i, this._sphericalEnd.phi = r, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, s || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi);
|
|
839
|
-
const o = !s ||
|
|
798
|
+
const o = !s || L(
|
|
840
799
|
this._spherical.theta,
|
|
841
800
|
this._sphericalEnd.theta,
|
|
842
801
|
this.restThreshold
|
|
843
|
-
) &&
|
|
802
|
+
) && L(
|
|
844
803
|
this._spherical.phi,
|
|
845
804
|
this._sphericalEnd.phi,
|
|
846
805
|
this.restThreshold
|
|
@@ -863,15 +822,15 @@ class $ extends Yt {
|
|
|
863
822
|
* @category Methods
|
|
864
823
|
*/
|
|
865
824
|
dollyTo(e, t = !1) {
|
|
866
|
-
return this._isUserControllingDolly = !1, this._lastDollyDirection =
|
|
867
|
-
|
|
825
|
+
return this._isUserControllingDolly = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0, this._dollyToNoClamp(
|
|
826
|
+
k(e, this.minDistance, this.maxDistance),
|
|
868
827
|
t
|
|
869
828
|
);
|
|
870
829
|
}
|
|
871
830
|
_dollyToNoClamp(e, t = !1) {
|
|
872
831
|
const s = this._sphericalEnd.radius;
|
|
873
832
|
if (this.colliderMeshes.length >= 1) {
|
|
874
|
-
const o = this._collisionTest(), a =
|
|
833
|
+
const o = this._collisionTest(), a = L(
|
|
875
834
|
o,
|
|
876
835
|
this._spherical.radius
|
|
877
836
|
);
|
|
@@ -883,7 +842,7 @@ class $ extends Yt {
|
|
|
883
842
|
} else
|
|
884
843
|
this._sphericalEnd.radius = e;
|
|
885
844
|
this._needsUpdate = !0, t || (this._spherical.radius = this._sphericalEnd.radius);
|
|
886
|
-
const r = !t ||
|
|
845
|
+
const r = !t || L(
|
|
887
846
|
this._spherical.radius,
|
|
888
847
|
this._sphericalEnd.radius,
|
|
889
848
|
this.restThreshold
|
|
@@ -899,9 +858,9 @@ class $ extends Yt {
|
|
|
899
858
|
*/
|
|
900
859
|
dollyInFixed(e, t = !1) {
|
|
901
860
|
this._targetEnd.add(
|
|
902
|
-
this._getCameraDirection(
|
|
861
|
+
this._getCameraDirection(oe).multiplyScalar(e)
|
|
903
862
|
), t || this._target.copy(this._targetEnd);
|
|
904
|
-
const s = !t ||
|
|
863
|
+
const s = !t || L(this._target.x, this._targetEnd.x, this.restThreshold) && L(this._target.y, this._targetEnd.y, this.restThreshold) && L(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
905
864
|
return this._createOnRestPromise(s);
|
|
906
865
|
}
|
|
907
866
|
/**
|
|
@@ -922,8 +881,8 @@ class $ extends Yt {
|
|
|
922
881
|
* @category Methods
|
|
923
882
|
*/
|
|
924
883
|
zoomTo(e, t = !1) {
|
|
925
|
-
this._isUserControllingZoom = !1, this._zoomEnd =
|
|
926
|
-
const s = !t ||
|
|
884
|
+
this._isUserControllingZoom = !1, this._zoomEnd = k(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
|
|
885
|
+
const s = !t || L(this._zoom, this._zoomEnd, this.restThreshold);
|
|
927
886
|
return this._changedZoom = 0, this._createOnRestPromise(s);
|
|
928
887
|
}
|
|
929
888
|
/**
|
|
@@ -941,8 +900,8 @@ class $ extends Yt {
|
|
|
941
900
|
* @category Methods
|
|
942
901
|
*/
|
|
943
902
|
truck(e, t, s = !1) {
|
|
944
|
-
this._camera.updateMatrix(),
|
|
945
|
-
const i =
|
|
903
|
+
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
904
|
+
const i = x.copy(F).add(N), r = P.copy(this._targetEnd).add(i);
|
|
946
905
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
947
906
|
}
|
|
948
907
|
/**
|
|
@@ -952,8 +911,8 @@ class $ extends Yt {
|
|
|
952
911
|
* @category Methods
|
|
953
912
|
*/
|
|
954
913
|
forward(e, t = !1) {
|
|
955
|
-
|
|
956
|
-
const s =
|
|
914
|
+
x.setFromMatrixColumn(this._camera.matrix, 0), x.crossVectors(this._camera.up, x), x.multiplyScalar(e);
|
|
915
|
+
const s = P.copy(this._targetEnd).add(x);
|
|
957
916
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
958
917
|
}
|
|
959
918
|
/**
|
|
@@ -963,10 +922,10 @@ class $ extends Yt {
|
|
|
963
922
|
* @category Methods
|
|
964
923
|
*/
|
|
965
924
|
elevate(e, t = !1) {
|
|
966
|
-
return
|
|
967
|
-
this._targetEnd.x +
|
|
968
|
-
this._targetEnd.y +
|
|
969
|
-
this._targetEnd.z +
|
|
925
|
+
return x.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
926
|
+
this._targetEnd.x + x.x,
|
|
927
|
+
this._targetEnd.y + x.y,
|
|
928
|
+
this._targetEnd.z + x.z,
|
|
970
929
|
t
|
|
971
930
|
);
|
|
972
931
|
}
|
|
@@ -980,9 +939,9 @@ class $ extends Yt {
|
|
|
980
939
|
*/
|
|
981
940
|
moveTo(e, t, s, i = !1) {
|
|
982
941
|
this._isUserControllingTruck = !1;
|
|
983
|
-
const r =
|
|
942
|
+
const r = x.set(e, t, s).sub(this._targetEnd);
|
|
984
943
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
985
|
-
const o = !i ||
|
|
944
|
+
const o = !i || L(this._target.x, this._targetEnd.x, this.restThreshold) && L(this._target.y, this._targetEnd.y, this.restThreshold) && L(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
986
945
|
return this._createOnRestPromise(o);
|
|
987
946
|
}
|
|
988
947
|
/**
|
|
@@ -995,7 +954,7 @@ class $ extends Yt {
|
|
|
995
954
|
* @category Methods
|
|
996
955
|
*/
|
|
997
956
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
998
|
-
const a =
|
|
957
|
+
const a = x.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
999
958
|
return this.setPosition(
|
|
1000
959
|
a.x,
|
|
1001
960
|
a.y,
|
|
@@ -1023,18 +982,18 @@ class $ extends Yt {
|
|
|
1023
982
|
paddingBottom: o = 0,
|
|
1024
983
|
paddingTop: a = 0
|
|
1025
984
|
} = {}) {
|
|
1026
|
-
const h = [], d = e.isBox3 ?
|
|
985
|
+
const h = [], d = e.isBox3 ? q.copy(e) : q.setFromObject(e);
|
|
1027
986
|
d.isEmpty() && (console.warn(
|
|
1028
987
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
1029
988
|
), Promise.resolve());
|
|
1030
|
-
const f =
|
|
989
|
+
const f = Ie(this._sphericalEnd.theta, He), p = Ie(this._sphericalEnd.phi, He);
|
|
1031
990
|
h.push(this.rotateTo(f, p, t));
|
|
1032
|
-
const C =
|
|
1033
|
-
m && v.multiply(xe.setFromAxisAngle(
|
|
1034
|
-
const u =
|
|
1035
|
-
|
|
1036
|
-
const g = u.getSize(
|
|
1037
|
-
if (
|
|
991
|
+
const C = x.setFromSpherical(this._sphericalEnd).normalize(), v = We.setFromUnitVectors(C, Te), m = L(Math.abs(C.y), 1);
|
|
992
|
+
m && v.multiply(xe.setFromAxisAngle(de, f)), v.multiply(this._yAxisUpSpaceInverse);
|
|
993
|
+
const u = Ze.makeEmpty();
|
|
994
|
+
P.copy(d.min).applyQuaternion(v), u.expandByPoint(P), P.copy(d.min).setX(d.max.x).applyQuaternion(v), u.expandByPoint(P), P.copy(d.min).setY(d.max.y).applyQuaternion(v), u.expandByPoint(P), P.copy(d.max).setZ(d.min.z).applyQuaternion(v), u.expandByPoint(P), P.copy(d.min).setZ(d.max.z).applyQuaternion(v), u.expandByPoint(P), P.copy(d.max).setY(d.min.y).applyQuaternion(v), u.expandByPoint(P), P.copy(d.max).setX(d.min.x).applyQuaternion(v), u.expandByPoint(P), P.copy(d.max).applyQuaternion(v), u.expandByPoint(P), u.min.x -= i, u.min.y -= o, u.max.x += r, u.max.y += a, v.setFromUnitVectors(Te, C), m && v.premultiply(xe.invert()), v.premultiply(this._yAxisUpSpace);
|
|
995
|
+
const g = u.getSize(x), n = u.getCenter(P).applyQuaternion(v);
|
|
996
|
+
if (Y(this._camera)) {
|
|
1038
997
|
const _ = this.getDistanceToFitBox(
|
|
1039
998
|
g.x,
|
|
1040
999
|
g.y,
|
|
@@ -1059,7 +1018,7 @@ class $ extends Yt {
|
|
|
1059
1018
|
* @category Methods
|
|
1060
1019
|
*/
|
|
1061
1020
|
fitToSphere(e, t) {
|
|
1062
|
-
const s = [], r = "isObject3D" in e ?
|
|
1021
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, we) : we.copy(e);
|
|
1063
1022
|
if (s.push(
|
|
1064
1023
|
this.moveTo(
|
|
1065
1024
|
r.center.x,
|
|
@@ -1067,7 +1026,7 @@ class $ extends Yt {
|
|
|
1067
1026
|
r.center.z,
|
|
1068
1027
|
t
|
|
1069
1028
|
)
|
|
1070
|
-
),
|
|
1029
|
+
), Y(this._camera)) {
|
|
1071
1030
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1072
1031
|
s.push(this.dollyTo(o, t));
|
|
1073
1032
|
} else if (j(this._camera)) {
|
|
@@ -1088,20 +1047,20 @@ class $ extends Yt {
|
|
|
1088
1047
|
* @category Methods
|
|
1089
1048
|
*/
|
|
1090
1049
|
setLookAt(e, t, s, i, r, o, a = !1) {
|
|
1091
|
-
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection =
|
|
1092
|
-
const h =
|
|
1050
|
+
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0;
|
|
1051
|
+
const h = P.set(i, r, o), d = x.set(e, t, s);
|
|
1093
1052
|
this._targetEnd.copy(h), this._sphericalEnd.setFromVector3(
|
|
1094
1053
|
d.sub(h).applyQuaternion(this._yAxisUpSpace)
|
|
1095
1054
|
), this.normalizeRotations(), this._needsUpdate = !0, a || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1096
|
-
const f = !a ||
|
|
1055
|
+
const f = !a || L(this._target.x, this._targetEnd.x, this.restThreshold) && L(this._target.y, this._targetEnd.y, this.restThreshold) && L(this._target.z, this._targetEnd.z, this.restThreshold) && L(
|
|
1097
1056
|
this._spherical.theta,
|
|
1098
1057
|
this._sphericalEnd.theta,
|
|
1099
1058
|
this.restThreshold
|
|
1100
|
-
) &&
|
|
1059
|
+
) && L(
|
|
1101
1060
|
this._spherical.phi,
|
|
1102
1061
|
this._sphericalEnd.phi,
|
|
1103
1062
|
this.restThreshold
|
|
1104
|
-
) &&
|
|
1063
|
+
) && L(
|
|
1105
1064
|
this._spherical.radius,
|
|
1106
1065
|
this._sphericalEnd.radius,
|
|
1107
1066
|
this.restThreshold
|
|
@@ -1127,35 +1086,35 @@ class $ extends Yt {
|
|
|
1127
1086
|
* @category Methods
|
|
1128
1087
|
*/
|
|
1129
1088
|
lerpLookAt(e, t, s, i, r, o, a, h, d, f, p, C, v, m = !1) {
|
|
1130
|
-
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection =
|
|
1131
|
-
const u =
|
|
1132
|
-
|
|
1089
|
+
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = G.NONE, this._changedDolly = 0;
|
|
1090
|
+
const u = x.set(i, r, o), g = P.set(e, t, s);
|
|
1091
|
+
z.setFromVector3(
|
|
1133
1092
|
g.sub(u).applyQuaternion(this._yAxisUpSpace)
|
|
1134
1093
|
);
|
|
1135
|
-
const n =
|
|
1136
|
-
|
|
1094
|
+
const n = X.set(f, p, C), _ = P.set(a, h, d);
|
|
1095
|
+
ne.setFromVector3(
|
|
1137
1096
|
_.sub(n).applyQuaternion(this._yAxisUpSpace)
|
|
1138
1097
|
), this._targetEnd.copy(u.lerp(n, v));
|
|
1139
|
-
const E =
|
|
1098
|
+
const E = ne.theta - z.theta, y = ne.phi - z.phi, w = ne.radius - z.radius;
|
|
1140
1099
|
this._sphericalEnd.set(
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1100
|
+
z.radius + w * v,
|
|
1101
|
+
z.phi + y * v,
|
|
1102
|
+
z.theta + E * v
|
|
1144
1103
|
), this.normalizeRotations(), this._needsUpdate = !0, m || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1145
|
-
const
|
|
1104
|
+
const O = !m || L(this._target.x, this._targetEnd.x, this.restThreshold) && L(this._target.y, this._targetEnd.y, this.restThreshold) && L(this._target.z, this._targetEnd.z, this.restThreshold) && L(
|
|
1146
1105
|
this._spherical.theta,
|
|
1147
1106
|
this._sphericalEnd.theta,
|
|
1148
1107
|
this.restThreshold
|
|
1149
|
-
) &&
|
|
1108
|
+
) && L(
|
|
1150
1109
|
this._spherical.phi,
|
|
1151
1110
|
this._sphericalEnd.phi,
|
|
1152
1111
|
this.restThreshold
|
|
1153
|
-
) &&
|
|
1112
|
+
) && L(
|
|
1154
1113
|
this._spherical.radius,
|
|
1155
1114
|
this._sphericalEnd.radius,
|
|
1156
1115
|
this.restThreshold
|
|
1157
1116
|
);
|
|
1158
|
-
return this._createOnRestPromise(
|
|
1117
|
+
return this._createOnRestPromise(O);
|
|
1159
1118
|
}
|
|
1160
1119
|
/**
|
|
1161
1120
|
* Set angle and distance by given position.
|
|
@@ -1187,7 +1146,7 @@ class $ extends Yt {
|
|
|
1187
1146
|
* @category Methods
|
|
1188
1147
|
*/
|
|
1189
1148
|
setTarget(e, t, s, i = !1) {
|
|
1190
|
-
const r = this.getPosition(
|
|
1149
|
+
const r = this.getPosition(x), o = this.setLookAt(
|
|
1191
1150
|
r.x,
|
|
1192
1151
|
r.y,
|
|
1193
1152
|
r.z,
|
|
@@ -1196,7 +1155,7 @@ class $ extends Yt {
|
|
|
1196
1155
|
s,
|
|
1197
1156
|
i
|
|
1198
1157
|
);
|
|
1199
|
-
return this._sphericalEnd.phi =
|
|
1158
|
+
return this._sphericalEnd.phi = k(
|
|
1200
1159
|
this._sphericalEnd.phi,
|
|
1201
1160
|
this.minPolarAngle,
|
|
1202
1161
|
this.maxPolarAngle
|
|
@@ -1212,15 +1171,15 @@ class $ extends Yt {
|
|
|
1212
1171
|
*/
|
|
1213
1172
|
setFocalOffset(e, t, s, i = !1) {
|
|
1214
1173
|
this._isUserControllingOffset = !1, this._focalOffsetEnd.set(e, t, s), this._needsUpdate = !0, i || this._focalOffset.copy(this._focalOffsetEnd);
|
|
1215
|
-
const r = !i ||
|
|
1174
|
+
const r = !i || L(
|
|
1216
1175
|
this._focalOffset.x,
|
|
1217
1176
|
this._focalOffsetEnd.x,
|
|
1218
1177
|
this.restThreshold
|
|
1219
|
-
) &&
|
|
1178
|
+
) && L(
|
|
1220
1179
|
this._focalOffset.y,
|
|
1221
1180
|
this._focalOffsetEnd.y,
|
|
1222
1181
|
this.restThreshold
|
|
1223
|
-
) &&
|
|
1182
|
+
) && L(
|
|
1224
1183
|
this._focalOffset.z,
|
|
1225
1184
|
this._focalOffsetEnd.z,
|
|
1226
1185
|
this.restThreshold
|
|
@@ -1236,9 +1195,9 @@ class $ extends Yt {
|
|
|
1236
1195
|
* @category Methods
|
|
1237
1196
|
*/
|
|
1238
1197
|
setOrbitPoint(e, t, s) {
|
|
1239
|
-
this._camera.updateMatrixWorld(),
|
|
1240
|
-
const i =
|
|
1241
|
-
|
|
1198
|
+
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1199
|
+
const i = x.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1200
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), x.copy(F).add(N).add(Z), x.z = x.z + r, this.dollyTo(r, !1), this.setFocalOffset(-x.x, x.y, -x.z, !1), this.moveTo(e, t, s, !1);
|
|
1242
1201
|
}
|
|
1243
1202
|
/**
|
|
1244
1203
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1266,7 +1225,7 @@ class $ extends Yt {
|
|
|
1266
1225
|
this._viewport = null;
|
|
1267
1226
|
return;
|
|
1268
1227
|
}
|
|
1269
|
-
this._viewport = this._viewport || new
|
|
1228
|
+
this._viewport = this._viewport || new T.Vector4(), typeof e == "number" ? this._viewport.set(e, t, s, i) : this._viewport.copy(e);
|
|
1270
1229
|
}
|
|
1271
1230
|
/**
|
|
1272
1231
|
* Calculate the distance to fit the box.
|
|
@@ -1277,9 +1236,9 @@ class $ extends Yt {
|
|
|
1277
1236
|
* @category Methods
|
|
1278
1237
|
*/
|
|
1279
1238
|
getDistanceToFitBox(e, t, s, i = !1) {
|
|
1280
|
-
if (
|
|
1239
|
+
if (Oe(this._camera, "getDistanceToFitBox"))
|
|
1281
1240
|
return this._spherical.radius;
|
|
1282
|
-
const r = e / t, o = this._camera.getEffectiveFOV() *
|
|
1241
|
+
const r = e / t, o = this._camera.getEffectiveFOV() * se, a = this._camera.aspect;
|
|
1283
1242
|
return ((i ? r > a : r < a) ? t : e / a) * 0.5 / Math.tan(o * 0.5) + s * 0.5;
|
|
1284
1243
|
}
|
|
1285
1244
|
/**
|
|
@@ -1289,9 +1248,9 @@ class $ extends Yt {
|
|
|
1289
1248
|
* @category Methods
|
|
1290
1249
|
*/
|
|
1291
1250
|
getDistanceToFitSphere(e) {
|
|
1292
|
-
if (
|
|
1251
|
+
if (Oe(this._camera, "getDistanceToFitSphere"))
|
|
1293
1252
|
return this._spherical.radius;
|
|
1294
|
-
const t = this._camera.getEffectiveFOV() *
|
|
1253
|
+
const t = this._camera.getEffectiveFOV() * se, s = Math.atan(Math.tan(t * 0.5) * this._camera.aspect) * 2, i = 1 < this._camera.aspect ? t : s;
|
|
1295
1254
|
return e / Math.sin(i * 0.5);
|
|
1296
1255
|
}
|
|
1297
1256
|
/**
|
|
@@ -1301,7 +1260,7 @@ class $ extends Yt {
|
|
|
1301
1260
|
* @category Methods
|
|
1302
1261
|
*/
|
|
1303
1262
|
getTarget(e, t = !0) {
|
|
1304
|
-
return (e && e.isVector3 ? e : new
|
|
1263
|
+
return (e && e.isVector3 ? e : new T.Vector3()).copy(t ? this._targetEnd : this._target);
|
|
1305
1264
|
}
|
|
1306
1265
|
/**
|
|
1307
1266
|
* Returns the camera position.
|
|
@@ -1310,7 +1269,7 @@ class $ extends Yt {
|
|
|
1310
1269
|
* @category Methods
|
|
1311
1270
|
*/
|
|
1312
1271
|
getPosition(e, t = !0) {
|
|
1313
|
-
return (e && e.isVector3 ? e : new
|
|
1272
|
+
return (e && e.isVector3 ? e : new T.Vector3()).setFromSpherical(t ? this._sphericalEnd : this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t ? this._targetEnd : this._target);
|
|
1314
1273
|
}
|
|
1315
1274
|
/**
|
|
1316
1275
|
* Returns the spherical coordinates of the orbit.
|
|
@@ -1319,7 +1278,7 @@ class $ extends Yt {
|
|
|
1319
1278
|
* @category Methods
|
|
1320
1279
|
*/
|
|
1321
1280
|
getSpherical(e, t = !0) {
|
|
1322
|
-
return (e || new
|
|
1281
|
+
return (e || new T.Spherical()).copy(t ? this._sphericalEnd : this._spherical);
|
|
1323
1282
|
}
|
|
1324
1283
|
/**
|
|
1325
1284
|
* Returns the focal offset, which is how much the camera appears to be translated in screen parallel coordinates.
|
|
@@ -1328,7 +1287,7 @@ class $ extends Yt {
|
|
|
1328
1287
|
* @category Methods
|
|
1329
1288
|
*/
|
|
1330
1289
|
getFocalOffset(e, t = !0) {
|
|
1331
|
-
return (e && e.isVector3 ? e : new
|
|
1290
|
+
return (e && e.isVector3 ? e : new T.Vector3()).copy(
|
|
1332
1291
|
t ? this._focalOffsetEnd : this._focalOffset
|
|
1333
1292
|
);
|
|
1334
1293
|
}
|
|
@@ -1337,7 +1296,7 @@ class $ extends Yt {
|
|
|
1337
1296
|
* @category Methods
|
|
1338
1297
|
*/
|
|
1339
1298
|
normalizeRotations() {
|
|
1340
|
-
this._sphericalEnd.theta = this._sphericalEnd.theta %
|
|
1299
|
+
this._sphericalEnd.theta = this._sphericalEnd.theta % K, this._sphericalEnd.theta < 0 && (this._sphericalEnd.theta += K), this._spherical.theta += K * Math.round((this._sphericalEnd.theta - this._spherical.theta) / K);
|
|
1341
1300
|
}
|
|
1342
1301
|
/**
|
|
1343
1302
|
* stop all transitions.
|
|
@@ -1351,9 +1310,9 @@ class $ extends Yt {
|
|
|
1351
1310
|
* @category Methods
|
|
1352
1311
|
*/
|
|
1353
1312
|
reset(e = !1) {
|
|
1354
|
-
if (!
|
|
1313
|
+
if (!L(this._camera.up.x, this._cameraUp0.x) || !L(this._camera.up.y, this._cameraUp0.y) || !L(this._camera.up.z, this._cameraUp0.z)) {
|
|
1355
1314
|
this._camera.up.copy(this._cameraUp0);
|
|
1356
|
-
const s = this.getPosition(
|
|
1315
|
+
const s = this.getPosition(x);
|
|
1357
1316
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1358
1317
|
}
|
|
1359
1318
|
const t = [
|
|
@@ -1389,7 +1348,7 @@ class $ extends Yt {
|
|
|
1389
1348
|
* @category Methods
|
|
1390
1349
|
*/
|
|
1391
1350
|
updateCameraUp() {
|
|
1392
|
-
this._yAxisUpSpace.setFromUnitVectors(this._camera.up,
|
|
1351
|
+
this._yAxisUpSpace.setFromUnitVectors(this._camera.up, de), this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert();
|
|
1393
1352
|
}
|
|
1394
1353
|
/**
|
|
1395
1354
|
* Apply current camera-up direction to the camera.
|
|
@@ -1397,9 +1356,9 @@ class $ extends Yt {
|
|
|
1397
1356
|
* @category Methods
|
|
1398
1357
|
*/
|
|
1399
1358
|
applyCameraUp() {
|
|
1400
|
-
const e =
|
|
1359
|
+
const e = x.subVectors(this._target, this._camera.position).normalize(), t = P.crossVectors(e, this._camera.up);
|
|
1401
1360
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1402
|
-
const s = this.getPosition(
|
|
1361
|
+
const s = this.getPosition(x);
|
|
1403
1362
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1404
1363
|
}
|
|
1405
1364
|
/**
|
|
@@ -1410,15 +1369,15 @@ class $ extends Yt {
|
|
|
1410
1369
|
* @category Methods
|
|
1411
1370
|
*/
|
|
1412
1371
|
update(e) {
|
|
1413
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r =
|
|
1372
|
+
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 = Ye.subVectors(
|
|
1414
1373
|
this._focalOffsetEnd,
|
|
1415
1374
|
this._focalOffset
|
|
1416
1375
|
), a = this._zoomEnd - this._zoom;
|
|
1417
|
-
if (
|
|
1376
|
+
if (A(t))
|
|
1418
1377
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1419
1378
|
else {
|
|
1420
1379
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1421
|
-
this._spherical.theta =
|
|
1380
|
+
this._spherical.theta = le(
|
|
1422
1381
|
this._spherical.theta,
|
|
1423
1382
|
this._sphericalEnd.theta,
|
|
1424
1383
|
this._thetaVelocity,
|
|
@@ -1427,11 +1386,11 @@ class $ extends Yt {
|
|
|
1427
1386
|
e
|
|
1428
1387
|
), this._needsUpdate = !0;
|
|
1429
1388
|
}
|
|
1430
|
-
if (
|
|
1389
|
+
if (A(s))
|
|
1431
1390
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1432
1391
|
else {
|
|
1433
1392
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1434
|
-
this._spherical.phi =
|
|
1393
|
+
this._spherical.phi = le(
|
|
1435
1394
|
this._spherical.phi,
|
|
1436
1395
|
this._sphericalEnd.phi,
|
|
1437
1396
|
this._phiVelocity,
|
|
@@ -1440,11 +1399,11 @@ class $ extends Yt {
|
|
|
1440
1399
|
e
|
|
1441
1400
|
), this._needsUpdate = !0;
|
|
1442
1401
|
}
|
|
1443
|
-
if (
|
|
1402
|
+
if (A(i))
|
|
1444
1403
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1445
1404
|
else {
|
|
1446
1405
|
const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
1447
|
-
this._spherical.radius =
|
|
1406
|
+
this._spherical.radius = le(
|
|
1448
1407
|
this._spherical.radius,
|
|
1449
1408
|
this._sphericalEnd.radius,
|
|
1450
1409
|
this._radiusVelocity,
|
|
@@ -1453,11 +1412,11 @@ class $ extends Yt {
|
|
|
1453
1412
|
e
|
|
1454
1413
|
), this._needsUpdate = !0;
|
|
1455
1414
|
}
|
|
1456
|
-
if (
|
|
1415
|
+
if (A(r.x) && A(r.y) && A(r.z))
|
|
1457
1416
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1458
1417
|
else {
|
|
1459
1418
|
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
1460
|
-
|
|
1419
|
+
je(
|
|
1461
1420
|
this._target,
|
|
1462
1421
|
this._targetEnd,
|
|
1463
1422
|
this._targetVelocity,
|
|
@@ -1467,11 +1426,11 @@ class $ extends Yt {
|
|
|
1467
1426
|
this._target
|
|
1468
1427
|
), this._needsUpdate = !0;
|
|
1469
1428
|
}
|
|
1470
|
-
if (
|
|
1429
|
+
if (A(o.x) && A(o.y) && A(o.z))
|
|
1471
1430
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1472
1431
|
else {
|
|
1473
1432
|
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
1474
|
-
|
|
1433
|
+
je(
|
|
1475
1434
|
this._focalOffset,
|
|
1476
1435
|
this._focalOffsetEnd,
|
|
1477
1436
|
this._focalOffsetVelocity,
|
|
@@ -1481,11 +1440,11 @@ class $ extends Yt {
|
|
|
1481
1440
|
this._focalOffset
|
|
1482
1441
|
), this._needsUpdate = !0;
|
|
1483
1442
|
}
|
|
1484
|
-
if (
|
|
1443
|
+
if (A(a))
|
|
1485
1444
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1486
1445
|
else {
|
|
1487
1446
|
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
1488
|
-
this._zoom =
|
|
1447
|
+
this._zoom = le(
|
|
1489
1448
|
this._zoom,
|
|
1490
1449
|
this._zoomEnd,
|
|
1491
1450
|
this._zoomVelocity,
|
|
@@ -1495,46 +1454,46 @@ class $ extends Yt {
|
|
|
1495
1454
|
);
|
|
1496
1455
|
}
|
|
1497
1456
|
if (this.dollyToCursor) {
|
|
1498
|
-
if (
|
|
1499
|
-
const p = this._spherical.radius - this._lastDistance, C = this._camera, v = this._getCameraDirection(
|
|
1457
|
+
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1458
|
+
const p = this._spherical.radius - this._lastDistance, C = this._camera, v = this._getCameraDirection(oe), m = x.copy(v).cross(C.up).normalize();
|
|
1500
1459
|
m.lengthSq() === 0 && (m.x = 1);
|
|
1501
|
-
const u =
|
|
1460
|
+
const u = P.crossVectors(m, v), g = this._sphericalEnd.radius * Math.tan(C.getEffectiveFOV() * se * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, E = X.copy(this._targetEnd).add(
|
|
1502
1461
|
m.multiplyScalar(
|
|
1503
1462
|
this._dollyControlCoord.x * g * C.aspect
|
|
1504
1463
|
)
|
|
1505
1464
|
).add(
|
|
1506
1465
|
u.multiplyScalar(this._dollyControlCoord.y * g)
|
|
1507
|
-
), y =
|
|
1508
|
-
if (this.infinityDolly && (w ||
|
|
1466
|
+
), y = x.copy(this._targetEnd).lerp(E, _), w = this._lastDollyDirection === G.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === G.OUT && this.maxDistance <= this._spherical.radius;
|
|
1467
|
+
if (this.infinityDolly && (w || O)) {
|
|
1509
1468
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1510
|
-
const
|
|
1511
|
-
y.add(
|
|
1469
|
+
const D = P.copy(v).multiplyScalar(-p);
|
|
1470
|
+
y.add(D);
|
|
1512
1471
|
}
|
|
1513
1472
|
this._boundary.clampPoint(y, y);
|
|
1514
|
-
const
|
|
1515
|
-
this._targetEnd.copy(y), this._target.add(
|
|
1473
|
+
const b = P.subVectors(y, this._targetEnd);
|
|
1474
|
+
this._targetEnd.copy(y), this._target.add(b), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1516
1475
|
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1517
|
-
const p = this._zoom - this._lastZoom, C = this._camera, v =
|
|
1476
|
+
const p = this._zoom - this._lastZoom, C = this._camera, v = x.set(
|
|
1518
1477
|
this._dollyControlCoord.x,
|
|
1519
1478
|
this._dollyControlCoord.y,
|
|
1520
1479
|
(C.near + C.far) / (C.near - C.far)
|
|
1521
|
-
).unproject(C), m =
|
|
1480
|
+
).unproject(C), m = P.set(0, 0, -1).applyQuaternion(C.quaternion), u = X.copy(v).add(m.multiplyScalar(-v.dot(C.up))), n = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(oe), E = this._targetEnd.dot(_), y = x.copy(this._targetEnd).lerp(u, n), w = y.dot(_), O = _.multiplyScalar(
|
|
1522
1481
|
w - E
|
|
1523
1482
|
);
|
|
1524
|
-
y.sub(
|
|
1525
|
-
const
|
|
1526
|
-
this._targetEnd.copy(y), this._target.add(
|
|
1483
|
+
y.sub(O), this._boundary.clampPoint(y, y);
|
|
1484
|
+
const b = P.subVectors(y, this._targetEnd);
|
|
1485
|
+
this._targetEnd.copy(y), this._target.add(b), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
|
|
1527
1486
|
}
|
|
1528
1487
|
}
|
|
1529
1488
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1530
1489
|
const h = this._collisionTest();
|
|
1531
|
-
this._spherical.radius = Math.min(this._spherical.radius, h), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!
|
|
1490
|
+
this._spherical.radius = Math.min(this._spherical.radius, h), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), x.copy(F).add(N).add(Z), this._camera.position.add(x), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1532
1491
|
this._camera.position.copy(this._target),
|
|
1533
|
-
|
|
1492
|
+
x.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1534
1493
|
1
|
|
1535
1494
|
);
|
|
1536
1495
|
const f = this._needsUpdate;
|
|
1537
|
-
return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }),
|
|
1496
|
+
return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), A(t, this.restThreshold) && A(s, this.restThreshold) && A(i, this.restThreshold) && A(r.x, this.restThreshold) && A(r.y, this.restThreshold) && A(r.z, this.restThreshold) && A(o.x, this.restThreshold) && A(o.y, this.restThreshold) && A(o.z, this.restThreshold) && A(a, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !f && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = f, this._needsUpdate = !1, f;
|
|
1538
1497
|
}
|
|
1539
1498
|
/**
|
|
1540
1499
|
* Get all state in JSON string
|
|
@@ -1544,20 +1503,20 @@ class $ extends Yt {
|
|
|
1544
1503
|
return JSON.stringify({
|
|
1545
1504
|
enabled: this._enabled,
|
|
1546
1505
|
minDistance: this.minDistance,
|
|
1547
|
-
maxDistance:
|
|
1506
|
+
maxDistance: ie(this.maxDistance),
|
|
1548
1507
|
minZoom: this.minZoom,
|
|
1549
|
-
maxZoom:
|
|
1508
|
+
maxZoom: ie(this.maxZoom),
|
|
1550
1509
|
minPolarAngle: this.minPolarAngle,
|
|
1551
|
-
maxPolarAngle:
|
|
1552
|
-
minAzimuthAngle:
|
|
1553
|
-
maxAzimuthAngle:
|
|
1510
|
+
maxPolarAngle: ie(this.maxPolarAngle),
|
|
1511
|
+
minAzimuthAngle: ie(this.minAzimuthAngle),
|
|
1512
|
+
maxAzimuthAngle: ie(this.maxAzimuthAngle),
|
|
1554
1513
|
smoothTime: this.smoothTime,
|
|
1555
1514
|
draggingSmoothTime: this.draggingSmoothTime,
|
|
1556
1515
|
dollySpeed: this.dollySpeed,
|
|
1557
1516
|
truckSpeed: this.truckSpeed,
|
|
1558
1517
|
dollyToCursor: this.dollyToCursor,
|
|
1559
1518
|
target: this._targetEnd.toArray(),
|
|
1560
|
-
position:
|
|
1519
|
+
position: x.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1561
1520
|
zoom: this._zoomEnd,
|
|
1562
1521
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1563
1522
|
target0: this._target0.toArray(),
|
|
@@ -1574,9 +1533,9 @@ class $ extends Yt {
|
|
|
1574
1533
|
*/
|
|
1575
1534
|
fromJSON(e, t = !1) {
|
|
1576
1535
|
const s = JSON.parse(e);
|
|
1577
|
-
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance =
|
|
1578
|
-
|
|
1579
|
-
), this.rotateTo(
|
|
1536
|
+
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = re(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = re(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = re(s.maxPolarAngle), this.minAzimuthAngle = re(s.minAzimuthAngle), this.maxAzimuthAngle = re(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), z.setFromVector3(
|
|
1537
|
+
x.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1538
|
+
), this.rotateTo(z.theta, z.phi, t), this.dollyTo(z.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1580
1539
|
s.focalOffset[0],
|
|
1581
1540
|
s.focalOffset[1],
|
|
1582
1541
|
s.focalOffset[2],
|
|
@@ -1632,7 +1591,7 @@ class $ extends Yt {
|
|
|
1632
1591
|
const i = t.lengthSq();
|
|
1633
1592
|
if (i === 0)
|
|
1634
1593
|
return e;
|
|
1635
|
-
const r =
|
|
1594
|
+
const r = P.copy(t).add(e), a = this._boundary.clampPoint(r, X).sub(r), h = a.lengthSq();
|
|
1636
1595
|
if (h === 0)
|
|
1637
1596
|
return e.add(t);
|
|
1638
1597
|
if (h === i)
|
|
@@ -1641,12 +1600,12 @@ class $ extends Yt {
|
|
|
1641
1600
|
return e.add(t).add(a);
|
|
1642
1601
|
{
|
|
1643
1602
|
const d = 1 + s * h / t.dot(a);
|
|
1644
|
-
return e.add(
|
|
1603
|
+
return e.add(P.copy(t).multiplyScalar(d)).add(a.multiplyScalar(1 - s));
|
|
1645
1604
|
}
|
|
1646
1605
|
}
|
|
1647
1606
|
_updateNearPlaneCorners() {
|
|
1648
|
-
if (
|
|
1649
|
-
const e = this._camera, t = e.near, s = e.getEffectiveFOV() *
|
|
1607
|
+
if (Y(this._camera)) {
|
|
1608
|
+
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * se, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1650
1609
|
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);
|
|
1651
1610
|
} else if (j(this._camera)) {
|
|
1652
1611
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
@@ -1656,16 +1615,16 @@ class $ extends Yt {
|
|
|
1656
1615
|
// lateUpdate
|
|
1657
1616
|
_collisionTest() {
|
|
1658
1617
|
let e = 1 / 0;
|
|
1659
|
-
if (!(this.colliderMeshes.length >= 1) ||
|
|
1618
|
+
if (!(this.colliderMeshes.length >= 1) || Oe(this._camera, "_collisionTest"))
|
|
1660
1619
|
return e;
|
|
1661
|
-
const s = this._getTargetDirection(
|
|
1662
|
-
|
|
1620
|
+
const s = this._getTargetDirection(oe);
|
|
1621
|
+
be.lookAt(Ve, s, this._camera.up);
|
|
1663
1622
|
for (let i = 0; i < 4; i++) {
|
|
1664
|
-
const r =
|
|
1665
|
-
r.applyMatrix4(
|
|
1666
|
-
const o =
|
|
1667
|
-
|
|
1668
|
-
const a =
|
|
1623
|
+
const r = P.copy(this._nearPlaneCorners[i]);
|
|
1624
|
+
r.applyMatrix4(be);
|
|
1625
|
+
const o = X.addVectors(this._target, r);
|
|
1626
|
+
pe.set(o, s), pe.far = this._spherical.radius + 1;
|
|
1627
|
+
const a = pe.intersectObjects(this.colliderMeshes);
|
|
1669
1628
|
a.length !== 0 && a[0].distance < e && (e = a[0].distance);
|
|
1670
1629
|
}
|
|
1671
1630
|
return e;
|
|
@@ -1731,11 +1690,11 @@ class $ extends Yt {
|
|
|
1731
1690
|
".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."
|
|
1732
1691
|
);
|
|
1733
1692
|
}
|
|
1734
|
-
static createBoundingSphere(e, t = new
|
|
1693
|
+
static createBoundingSphere(e, t = new T.Sphere()) {
|
|
1735
1694
|
const s = t, i = s.center;
|
|
1736
|
-
|
|
1737
|
-
o.isMesh &&
|
|
1738
|
-
}),
|
|
1695
|
+
q.makeEmpty(), e.traverseVisible((o) => {
|
|
1696
|
+
o.isMesh && q.expandByObject(o);
|
|
1697
|
+
}), q.getCenter(i);
|
|
1739
1698
|
let r = 0;
|
|
1740
1699
|
return e.traverseVisible((o) => {
|
|
1741
1700
|
if (!o.isMesh) return;
|
|
@@ -1745,64 +1704,64 @@ class $ extends Yt {
|
|
|
1745
1704
|
h.applyMatrix4(a.matrixWorld);
|
|
1746
1705
|
const f = h.attributes.position;
|
|
1747
1706
|
for (let p = 0, C = f.count; p < C; p++)
|
|
1748
|
-
|
|
1707
|
+
x.fromBufferAttribute(f, p), r = Math.max(r, i.distanceToSquared(x));
|
|
1749
1708
|
}), s.radius = Math.sqrt(r), s;
|
|
1750
1709
|
}
|
|
1751
1710
|
}
|
|
1752
|
-
var
|
|
1711
|
+
var Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ge = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1753
1712
|
return Function.prototype.apply.call(e, t, s);
|
|
1754
|
-
},
|
|
1755
|
-
|
|
1713
|
+
}, ue;
|
|
1714
|
+
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
1756
1715
|
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
1757
|
-
} :
|
|
1716
|
+
} : ue = function(e) {
|
|
1758
1717
|
return Object.getOwnPropertyNames(e);
|
|
1759
1718
|
};
|
|
1760
|
-
function
|
|
1719
|
+
function ws(l) {
|
|
1761
1720
|
console && console.warn && console.warn(l);
|
|
1762
1721
|
}
|
|
1763
|
-
var
|
|
1722
|
+
var ft = Number.isNaN || function(e) {
|
|
1764
1723
|
return e !== e;
|
|
1765
1724
|
};
|
|
1766
|
-
function
|
|
1767
|
-
|
|
1725
|
+
function S() {
|
|
1726
|
+
S.init.call(this);
|
|
1768
1727
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
var
|
|
1776
|
-
function
|
|
1728
|
+
Se.exports = S;
|
|
1729
|
+
Se.exports.once = Ls;
|
|
1730
|
+
S.EventEmitter = S;
|
|
1731
|
+
S.prototype._events = void 0;
|
|
1732
|
+
S.prototype._eventsCount = 0;
|
|
1733
|
+
S.prototype._maxListeners = void 0;
|
|
1734
|
+
var Ke = 10;
|
|
1735
|
+
function ge(l) {
|
|
1777
1736
|
if (typeof l != "function")
|
|
1778
1737
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof l);
|
|
1779
1738
|
}
|
|
1780
|
-
Object.defineProperty(
|
|
1739
|
+
Object.defineProperty(S, "defaultMaxListeners", {
|
|
1781
1740
|
enumerable: !0,
|
|
1782
1741
|
get: function() {
|
|
1783
|
-
return
|
|
1742
|
+
return Ke;
|
|
1784
1743
|
},
|
|
1785
1744
|
set: function(l) {
|
|
1786
|
-
if (typeof l != "number" || l < 0 ||
|
|
1745
|
+
if (typeof l != "number" || l < 0 || ft(l))
|
|
1787
1746
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + l + ".");
|
|
1788
|
-
|
|
1747
|
+
Ke = l;
|
|
1789
1748
|
}
|
|
1790
1749
|
});
|
|
1791
|
-
|
|
1750
|
+
S.init = function() {
|
|
1792
1751
|
(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;
|
|
1793
1752
|
};
|
|
1794
|
-
|
|
1795
|
-
if (typeof e != "number" || e < 0 ||
|
|
1753
|
+
S.prototype.setMaxListeners = function(e) {
|
|
1754
|
+
if (typeof e != "number" || e < 0 || ft(e))
|
|
1796
1755
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1797
1756
|
return this._maxListeners = e, this;
|
|
1798
1757
|
};
|
|
1799
|
-
function
|
|
1800
|
-
return l._maxListeners === void 0 ?
|
|
1758
|
+
function _t(l) {
|
|
1759
|
+
return l._maxListeners === void 0 ? S.defaultMaxListeners : l._maxListeners;
|
|
1801
1760
|
}
|
|
1802
|
-
|
|
1803
|
-
return
|
|
1761
|
+
S.prototype.getMaxListeners = function() {
|
|
1762
|
+
return _t(this);
|
|
1804
1763
|
};
|
|
1805
|
-
|
|
1764
|
+
S.prototype.emit = function(e) {
|
|
1806
1765
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
1807
1766
|
var i = e === "error", r = this._events;
|
|
1808
1767
|
if (r !== void 0)
|
|
@@ -1820,51 +1779,51 @@ A.prototype.emit = function(e) {
|
|
|
1820
1779
|
if (h === void 0)
|
|
1821
1780
|
return !1;
|
|
1822
1781
|
if (typeof h == "function")
|
|
1823
|
-
|
|
1782
|
+
Ge(h, this, t);
|
|
1824
1783
|
else
|
|
1825
|
-
for (var d = h.length, f =
|
|
1826
|
-
|
|
1784
|
+
for (var d = h.length, f = Et(h, d), s = 0; s < d; ++s)
|
|
1785
|
+
Ge(f[s], this, t);
|
|
1827
1786
|
return !0;
|
|
1828
1787
|
};
|
|
1829
|
-
function
|
|
1788
|
+
function gt(l, e, t, s) {
|
|
1830
1789
|
var i, r, o;
|
|
1831
|
-
if (
|
|
1790
|
+
if (ge(t), r = l._events, r === void 0 ? (r = l._events = /* @__PURE__ */ Object.create(null), l._eventsCount = 0) : (r.newListener !== void 0 && (l.emit(
|
|
1832
1791
|
"newListener",
|
|
1833
1792
|
e,
|
|
1834
1793
|
t.listener ? t.listener : t
|
|
1835
1794
|
), r = l._events), o = r[e]), o === void 0)
|
|
1836
1795
|
o = r[e] = t, ++l._eventsCount;
|
|
1837
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i =
|
|
1796
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = _t(l), i > 0 && o.length > i && !o.warned) {
|
|
1838
1797
|
o.warned = !0;
|
|
1839
1798
|
var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1840
|
-
a.name = "MaxListenersExceededWarning", a.emitter = l, a.type = e, a.count = o.length,
|
|
1799
|
+
a.name = "MaxListenersExceededWarning", a.emitter = l, a.type = e, a.count = o.length, ws(a);
|
|
1841
1800
|
}
|
|
1842
1801
|
return l;
|
|
1843
1802
|
}
|
|
1844
|
-
|
|
1845
|
-
return
|
|
1803
|
+
S.prototype.addListener = function(e, t) {
|
|
1804
|
+
return gt(this, e, t, !1);
|
|
1846
1805
|
};
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
return
|
|
1806
|
+
S.prototype.on = S.prototype.addListener;
|
|
1807
|
+
S.prototype.prependListener = function(e, t) {
|
|
1808
|
+
return gt(this, e, t, !0);
|
|
1850
1809
|
};
|
|
1851
|
-
function
|
|
1810
|
+
function xs() {
|
|
1852
1811
|
if (!this.fired)
|
|
1853
1812
|
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);
|
|
1854
1813
|
}
|
|
1855
|
-
function
|
|
1856
|
-
var s = { fired: !1, wrapFn: void 0, target: l, type: e, listener: t }, i =
|
|
1814
|
+
function vt(l, e, t) {
|
|
1815
|
+
var s = { fired: !1, wrapFn: void 0, target: l, type: e, listener: t }, i = xs.bind(s);
|
|
1857
1816
|
return i.listener = t, s.wrapFn = i, i;
|
|
1858
1817
|
}
|
|
1859
|
-
|
|
1860
|
-
return
|
|
1818
|
+
S.prototype.once = function(e, t) {
|
|
1819
|
+
return ge(t), this.on(e, vt(this, e, t)), this;
|
|
1861
1820
|
};
|
|
1862
|
-
|
|
1863
|
-
return
|
|
1821
|
+
S.prototype.prependOnceListener = function(e, t) {
|
|
1822
|
+
return ge(t), this.prependListener(e, vt(this, e, t)), this;
|
|
1864
1823
|
};
|
|
1865
|
-
|
|
1824
|
+
S.prototype.removeListener = function(e, t) {
|
|
1866
1825
|
var s, i, r, o, a;
|
|
1867
|
-
if (
|
|
1826
|
+
if (ge(t), i = this._events, i === void 0)
|
|
1868
1827
|
return this;
|
|
1869
1828
|
if (s = i[e], s === void 0)
|
|
1870
1829
|
return this;
|
|
@@ -1878,12 +1837,12 @@ A.prototype.removeListener = function(e, t) {
|
|
|
1878
1837
|
}
|
|
1879
1838
|
if (r < 0)
|
|
1880
1839
|
return this;
|
|
1881
|
-
r === 0 ? s.shift() :
|
|
1840
|
+
r === 0 ? s.shift() : bs(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || t);
|
|
1882
1841
|
}
|
|
1883
1842
|
return this;
|
|
1884
1843
|
};
|
|
1885
|
-
|
|
1886
|
-
|
|
1844
|
+
S.prototype.off = S.prototype.removeListener;
|
|
1845
|
+
S.prototype.removeAllListeners = function(e) {
|
|
1887
1846
|
var t, s, i;
|
|
1888
1847
|
if (s = this._events, s === void 0)
|
|
1889
1848
|
return this;
|
|
@@ -1902,24 +1861,24 @@ A.prototype.removeAllListeners = function(e) {
|
|
|
1902
1861
|
this.removeListener(e, t[i]);
|
|
1903
1862
|
return this;
|
|
1904
1863
|
};
|
|
1905
|
-
function
|
|
1864
|
+
function yt(l, e, t) {
|
|
1906
1865
|
var s = l._events;
|
|
1907
1866
|
if (s === void 0)
|
|
1908
1867
|
return [];
|
|
1909
1868
|
var i = s[e];
|
|
1910
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ?
|
|
1869
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Ps(i) : Et(i, i.length);
|
|
1911
1870
|
}
|
|
1912
|
-
|
|
1913
|
-
return
|
|
1871
|
+
S.prototype.listeners = function(e) {
|
|
1872
|
+
return yt(this, e, !0);
|
|
1914
1873
|
};
|
|
1915
|
-
|
|
1916
|
-
return
|
|
1874
|
+
S.prototype.rawListeners = function(e) {
|
|
1875
|
+
return yt(this, e, !1);
|
|
1917
1876
|
};
|
|
1918
|
-
|
|
1919
|
-
return typeof l.listenerCount == "function" ? l.listenerCount(e) :
|
|
1877
|
+
S.listenerCount = function(l, e) {
|
|
1878
|
+
return typeof l.listenerCount == "function" ? l.listenerCount(e) : Ct.call(l, e);
|
|
1920
1879
|
};
|
|
1921
|
-
|
|
1922
|
-
function
|
|
1880
|
+
S.prototype.listenerCount = Ct;
|
|
1881
|
+
function Ct(l) {
|
|
1923
1882
|
var e = this._events;
|
|
1924
1883
|
if (e !== void 0) {
|
|
1925
1884
|
var t = e[l];
|
|
@@ -1930,25 +1889,25 @@ function ht(l) {
|
|
|
1930
1889
|
}
|
|
1931
1890
|
return 0;
|
|
1932
1891
|
}
|
|
1933
|
-
|
|
1934
|
-
return this._eventsCount > 0 ?
|
|
1892
|
+
S.prototype.eventNames = function() {
|
|
1893
|
+
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1935
1894
|
};
|
|
1936
|
-
function
|
|
1895
|
+
function Et(l, e) {
|
|
1937
1896
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1938
1897
|
t[s] = l[s];
|
|
1939
1898
|
return t;
|
|
1940
1899
|
}
|
|
1941
|
-
function
|
|
1900
|
+
function bs(l, e) {
|
|
1942
1901
|
for (; e + 1 < l.length; e++)
|
|
1943
1902
|
l[e] = l[e + 1];
|
|
1944
1903
|
l.pop();
|
|
1945
1904
|
}
|
|
1946
|
-
function
|
|
1905
|
+
function Ps(l) {
|
|
1947
1906
|
for (var e = new Array(l.length), t = 0; t < e.length; ++t)
|
|
1948
1907
|
e[t] = l[t].listener || l[t];
|
|
1949
1908
|
return e;
|
|
1950
1909
|
}
|
|
1951
|
-
function
|
|
1910
|
+
function Ls(l, e) {
|
|
1952
1911
|
return new Promise(function(t, s) {
|
|
1953
1912
|
function i(o) {
|
|
1954
1913
|
l.removeListener(e, r), s(o);
|
|
@@ -1956,13 +1915,13 @@ function qt(l, e) {
|
|
|
1956
1915
|
function r() {
|
|
1957
1916
|
typeof l.removeListener == "function" && l.removeListener("error", i), t([].slice.call(arguments));
|
|
1958
1917
|
}
|
|
1959
|
-
|
|
1918
|
+
Ot(l, e, r, { once: !0 }), e !== "error" && Ss(l, i, { once: !0 });
|
|
1960
1919
|
});
|
|
1961
1920
|
}
|
|
1962
|
-
function
|
|
1963
|
-
typeof l.on == "function" &&
|
|
1921
|
+
function Ss(l, e, t) {
|
|
1922
|
+
typeof l.on == "function" && Ot(l, "error", e, t);
|
|
1964
1923
|
}
|
|
1965
|
-
function
|
|
1924
|
+
function Ot(l, e, t, s) {
|
|
1966
1925
|
if (typeof l.on == "function")
|
|
1967
1926
|
s.once ? l.once(e, t) : l.on(e, t);
|
|
1968
1927
|
else if (typeof l.addEventListener == "function")
|
|
@@ -1972,20 +1931,20 @@ function ct(l, e, t, s) {
|
|
|
1972
1931
|
else
|
|
1973
1932
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof l);
|
|
1974
1933
|
}
|
|
1975
|
-
var
|
|
1976
|
-
const
|
|
1934
|
+
var ve = Se.exports;
|
|
1935
|
+
const As = {
|
|
1977
1936
|
antialias: !1,
|
|
1978
1937
|
devicePixelRatio: window.devicePixelRatio,
|
|
1979
1938
|
powerPreference: "high-performance",
|
|
1980
1939
|
toneMappingExposure: 1,
|
|
1981
1940
|
alpha: !1,
|
|
1982
|
-
outputColorSpace:
|
|
1941
|
+
outputColorSpace: os.sRGB,
|
|
1983
1942
|
logarithmicDepthBuffer: !1,
|
|
1984
1943
|
preserveDrawingBuffer: !1,
|
|
1985
1944
|
stencil: !1,
|
|
1986
1945
|
depth: !1
|
|
1987
1946
|
};
|
|
1988
|
-
class
|
|
1947
|
+
class Ms {
|
|
1989
1948
|
constructor(e) {
|
|
1990
1949
|
this.options = e;
|
|
1991
1950
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
@@ -1999,7 +1958,7 @@ class Jt {
|
|
|
1999
1958
|
preserveDrawingBuffer: C,
|
|
2000
1959
|
stencil: v,
|
|
2001
1960
|
depth: m
|
|
2002
|
-
} = i, u = new
|
|
1961
|
+
} = i, u = new Rt({
|
|
2003
1962
|
alpha: r,
|
|
2004
1963
|
antialias: a,
|
|
2005
1964
|
powerPreference: h,
|
|
@@ -2025,7 +1984,7 @@ class Jt {
|
|
|
2025
1984
|
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(a));
|
|
2026
1985
|
}
|
|
2027
1986
|
setViewPadding(e = 0, t = 0, s = 0, i = 0) {
|
|
2028
|
-
const { width: r, height: o } = this.renderer.getSize(new
|
|
1987
|
+
const { width: r, height: o } = this.renderer.getSize(new V()), a = {
|
|
2029
1988
|
x: i,
|
|
2030
1989
|
y: s,
|
|
2031
1990
|
width: r - i - t,
|
|
@@ -2038,11 +1997,11 @@ class Jt {
|
|
|
2038
1997
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
2039
1998
|
}
|
|
2040
1999
|
}
|
|
2041
|
-
const
|
|
2000
|
+
const Ds = {
|
|
2042
2001
|
antialias: !0,
|
|
2043
2002
|
devicePixelRatio: window.devicePixelRatio
|
|
2044
2003
|
};
|
|
2045
|
-
class
|
|
2004
|
+
class Rs {
|
|
2046
2005
|
constructor(e) {
|
|
2047
2006
|
this.options = e;
|
|
2048
2007
|
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: a } = i, h = new r({
|
|
@@ -2061,7 +2020,7 @@ class ts {
|
|
|
2061
2020
|
this.setSize(1, 1), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose();
|
|
2062
2021
|
}
|
|
2063
2022
|
}
|
|
2064
|
-
let
|
|
2023
|
+
let Us = class {
|
|
2065
2024
|
constructor() {
|
|
2066
2025
|
this.mask = 1;
|
|
2067
2026
|
}
|
|
@@ -2087,12 +2046,12 @@ let ss = class {
|
|
|
2087
2046
|
return (this.mask & (1 << e | 0)) !== 0;
|
|
2088
2047
|
}
|
|
2089
2048
|
};
|
|
2090
|
-
class
|
|
2049
|
+
class ae {
|
|
2091
2050
|
constructor() {
|
|
2092
|
-
this.event = new
|
|
2051
|
+
this.event = new ve.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
2093
2052
|
}
|
|
2094
2053
|
addController(e, t) {
|
|
2095
|
-
const s = new
|
|
2054
|
+
const s = new Us();
|
|
2096
2055
|
return s.disableAll(), t !== void 0 && s.set(t), this.controllerMap.set(e, s), t === this.activeIndex && this.activeControllerSet.add(e), e;
|
|
2097
2056
|
}
|
|
2098
2057
|
removePage(e, t) {
|
|
@@ -2120,21 +2079,21 @@ class ne {
|
|
|
2120
2079
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
2121
2080
|
}
|
|
2122
2081
|
}
|
|
2123
|
-
const
|
|
2082
|
+
const Tt = {
|
|
2124
2083
|
fov: 45,
|
|
2125
2084
|
near: 1,
|
|
2126
2085
|
far: 1e3,
|
|
2127
|
-
up: new
|
|
2086
|
+
up: new I(0, 1, 0)
|
|
2128
2087
|
};
|
|
2129
|
-
class
|
|
2088
|
+
class zs extends ae {
|
|
2130
2089
|
constructor(e) {
|
|
2131
2090
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2132
2091
|
}
|
|
2133
2092
|
get camera() {
|
|
2134
2093
|
return this.controller;
|
|
2135
2094
|
}
|
|
2136
|
-
addPerspectiveCamera(e =
|
|
2137
|
-
const { fov: s, far: i, near: r, up: o, aspect: a } = e, h = a != null ? a : this.width / this.height, d = new
|
|
2095
|
+
addPerspectiveCamera(e = Tt, t) {
|
|
2096
|
+
const { fov: s, far: i, near: r, up: o, aspect: a } = e, h = a != null ? a : this.width / this.height, d = new Ut(s, h, r, i);
|
|
2138
2097
|
return d.up = o, this.addController(d, t);
|
|
2139
2098
|
}
|
|
2140
2099
|
setPageActive(e) {
|
|
@@ -2167,7 +2126,7 @@ class is extends ne {
|
|
|
2167
2126
|
const t = e;
|
|
2168
2127
|
(!this.camera.matrixWorld.equals(t.matrixWorld) || this.camera.far !== t.far || this.camera.near !== t.near || this.camera.fov !== t.fov || this.camera.aspect !== t.aspect) && this.camera.copy(t);
|
|
2169
2128
|
} else {
|
|
2170
|
-
const t = e, s = t.viewMatrix, i = t.inverseViewMatrix, r = new
|
|
2129
|
+
const t = e, s = t.viewMatrix, i = t.inverseViewMatrix, r = new W(
|
|
2171
2130
|
i[0],
|
|
2172
2131
|
i[4],
|
|
2173
2132
|
i[8],
|
|
@@ -2184,7 +2143,7 @@ class is extends ne {
|
|
|
2184
2143
|
i[7],
|
|
2185
2144
|
i[11],
|
|
2186
2145
|
i[15]
|
|
2187
|
-
), o = new
|
|
2146
|
+
), o = new W(
|
|
2188
2147
|
s[0],
|
|
2189
2148
|
s[4],
|
|
2190
2149
|
s[8],
|
|
@@ -2206,10 +2165,10 @@ class is extends ne {
|
|
|
2206
2165
|
}
|
|
2207
2166
|
}
|
|
2208
2167
|
}
|
|
2209
|
-
const
|
|
2168
|
+
const ks = {
|
|
2210
2169
|
background: null
|
|
2211
2170
|
};
|
|
2212
|
-
class
|
|
2171
|
+
class Fs extends ae {
|
|
2213
2172
|
get scene() {
|
|
2214
2173
|
return this.controller;
|
|
2215
2174
|
}
|
|
@@ -2217,12 +2176,12 @@ class os extends ne {
|
|
|
2217
2176
|
super(), this.options = e;
|
|
2218
2177
|
}
|
|
2219
2178
|
addScene(e, t) {
|
|
2220
|
-
const s = new
|
|
2179
|
+
const s = new ot();
|
|
2221
2180
|
return e != null && e.background && (s.background = e.background), this.addController(s, t);
|
|
2222
2181
|
}
|
|
2223
2182
|
removePage(e) {
|
|
2224
2183
|
super.removePage(e, (t) => {
|
|
2225
|
-
const s = new
|
|
2184
|
+
const s = new hs();
|
|
2226
2185
|
s.track(t), s.dispose();
|
|
2227
2186
|
});
|
|
2228
2187
|
}
|
|
@@ -2232,7 +2191,7 @@ class os extends ne {
|
|
|
2232
2191
|
});
|
|
2233
2192
|
}
|
|
2234
2193
|
}
|
|
2235
|
-
class
|
|
2194
|
+
class Ns {
|
|
2236
2195
|
constructor(e) {
|
|
2237
2196
|
this.helpers = {}, this.options = e;
|
|
2238
2197
|
}
|
|
@@ -2241,23 +2200,23 @@ class ns {
|
|
|
2241
2200
|
let i = this.helpers[t];
|
|
2242
2201
|
if (i === void 0) {
|
|
2243
2202
|
if (e.isScene)
|
|
2244
|
-
i = new
|
|
2203
|
+
i = new De(100);
|
|
2245
2204
|
else if (e.isCamera)
|
|
2246
|
-
i = new
|
|
2205
|
+
i = new zt(e);
|
|
2247
2206
|
else if (e.isPointLight)
|
|
2248
|
-
i = new
|
|
2207
|
+
i = new kt(e, 1);
|
|
2249
2208
|
else if (e.isDirectionalLight)
|
|
2250
|
-
i = new
|
|
2209
|
+
i = new Ft(e, 1);
|
|
2251
2210
|
else if (e.isSpotLight)
|
|
2252
|
-
i = new
|
|
2211
|
+
i = new Nt(e);
|
|
2253
2212
|
else if (e.isHemisphereLight)
|
|
2254
|
-
i = new
|
|
2213
|
+
i = new Ht(e, 10);
|
|
2255
2214
|
else if (e.isRectAreaLight)
|
|
2256
|
-
i = new
|
|
2215
|
+
i = new cs(e);
|
|
2257
2216
|
else {
|
|
2258
|
-
const r = new
|
|
2217
|
+
const r = new nt();
|
|
2259
2218
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2260
|
-
i = new
|
|
2219
|
+
i = new Re(r);
|
|
2261
2220
|
const o = i.material;
|
|
2262
2221
|
o.userData.object = e, o.depthTest = !1, o.transparent = !0;
|
|
2263
2222
|
} else
|
|
@@ -2267,7 +2226,7 @@ class ns {
|
|
|
2267
2226
|
}
|
|
2268
2227
|
}
|
|
2269
2228
|
addViewHelper() {
|
|
2270
|
-
const { cameraController: e, container: t } = this.options, s = new
|
|
2229
|
+
const { cameraController: e, container: t } = this.options, s = new ds(e.camera, t);
|
|
2271
2230
|
t.addEventListener("pointerdown", (i) => {
|
|
2272
2231
|
i.preventDefault(), s.handleClick(i);
|
|
2273
2232
|
}), this.viewHelper = s;
|
|
@@ -2289,7 +2248,7 @@ class ns {
|
|
|
2289
2248
|
}
|
|
2290
2249
|
removeAllExcludeScene() {
|
|
2291
2250
|
Object.keys(this.helpers).forEach((e) => {
|
|
2292
|
-
this.helpers[e] instanceof
|
|
2251
|
+
this.helpers[e] instanceof De || this.remove({
|
|
2293
2252
|
uuid: e
|
|
2294
2253
|
});
|
|
2295
2254
|
});
|
|
@@ -2298,7 +2257,7 @@ class ns {
|
|
|
2298
2257
|
var r, o;
|
|
2299
2258
|
const { cameraController: i } = this.options;
|
|
2300
2259
|
Object.values(this.helpers).forEach((a) => {
|
|
2301
|
-
if (a.update && a.update(), a instanceof
|
|
2260
|
+
if (a.update && a.update(), a instanceof Re) {
|
|
2302
2261
|
const h = a.material, { object: d } = h.userData;
|
|
2303
2262
|
d && a.box.setFromObject(d, !0);
|
|
2304
2263
|
}
|
|
@@ -2317,15 +2276,27 @@ class ns {
|
|
|
2317
2276
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2318
2277
|
}
|
|
2319
2278
|
}
|
|
2320
|
-
class
|
|
2279
|
+
class Hs extends ae {
|
|
2321
2280
|
constructor(e) {
|
|
2322
|
-
super(), this.autoRotateSpeed = 0, this.options = e
|
|
2281
|
+
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2282
|
+
const t = {
|
|
2283
|
+
Vector2: V,
|
|
2284
|
+
Vector3: I,
|
|
2285
|
+
Vector4: jt,
|
|
2286
|
+
Quaternion: at,
|
|
2287
|
+
Matrix4: W,
|
|
2288
|
+
Spherical: Vt,
|
|
2289
|
+
Box3: nt,
|
|
2290
|
+
Sphere: Bt,
|
|
2291
|
+
Raycaster: ht
|
|
2292
|
+
};
|
|
2293
|
+
J.install({ THREE: t });
|
|
2323
2294
|
}
|
|
2324
2295
|
get cameraControls() {
|
|
2325
2296
|
return this.controller;
|
|
2326
2297
|
}
|
|
2327
2298
|
addCameraControls(e, t) {
|
|
2328
|
-
const { domElement: s } = this.options.controlsParams, i = new
|
|
2299
|
+
const { domElement: s } = this.options.controlsParams, i = new J(e, s);
|
|
2329
2300
|
return i.setLookAt(0, 0, 400, 0, 0, 0, !1), this.addController(i, t);
|
|
2330
2301
|
}
|
|
2331
2302
|
setPageActive(e) {
|
|
@@ -2349,19 +2320,19 @@ class as extends ne {
|
|
|
2349
2320
|
});
|
|
2350
2321
|
}
|
|
2351
2322
|
update(e, t) {
|
|
2352
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2323
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * It.DEG2RAD);
|
|
2353
2324
|
}
|
|
2354
2325
|
}
|
|
2355
|
-
class
|
|
2326
|
+
class Is {
|
|
2356
2327
|
constructor(e) {
|
|
2357
|
-
this.event = new
|
|
2358
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
2328
|
+
this.event = new ve.EventEmitter();
|
|
2329
|
+
const { renderer: t, scene: s, camera: i } = e, r = new ps(
|
|
2359
2330
|
i,
|
|
2360
2331
|
t.domElement
|
|
2361
2332
|
);
|
|
2362
2333
|
if (r.getHelper) {
|
|
2363
2334
|
const o = r.getHelper();
|
|
2364
|
-
if (s.add(o), +
|
|
2335
|
+
if (s.add(o), +Yt < 170) {
|
|
2365
2336
|
const a = r._root;
|
|
2366
2337
|
a.dispose = () => {
|
|
2367
2338
|
a.traverse((h) => {
|
|
@@ -2371,7 +2342,7 @@ class hs {
|
|
|
2371
2342
|
r.disconnect(), a.dispose();
|
|
2372
2343
|
};
|
|
2373
2344
|
}
|
|
2374
|
-
} else r instanceof
|
|
2345
|
+
} else r instanceof Zt && s.add(r);
|
|
2375
2346
|
this.controls = r, this.addEvent();
|
|
2376
2347
|
}
|
|
2377
2348
|
get detach() {
|
|
@@ -2421,8 +2392,8 @@ class hs {
|
|
|
2421
2392
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
2422
2393
|
}
|
|
2423
2394
|
}
|
|
2424
|
-
const
|
|
2425
|
-
class
|
|
2395
|
+
const Xe = new I(), js = new at(), qe = new I(), H = new W(), Vs = new W();
|
|
2396
|
+
class Bs {
|
|
2426
2397
|
/**
|
|
2427
2398
|
* Constructs a new CSS3D renderer.
|
|
2428
2399
|
*
|
|
@@ -2449,8 +2420,8 @@ class ds {
|
|
|
2449
2420
|
n.view && n.view.enabled ? (d.style.transform = `translate( ${-n.view.offsetX * (s / n.view.width)}px, ${-n.view.offsetY * (i / n.view.height)}px )`, d.style.transform += `scale( ${n.view.fullWidth / n.view.width}, ${n.view.fullHeight / n.view.height} )`) : d.style.transform = "", g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), n.parent === null && n.matrixWorldAutoUpdate === !0 && n.updateMatrixWorld();
|
|
2450
2421
|
let E, y;
|
|
2451
2422
|
n.isOrthographicCamera && (E = -(n.right + n.left) / 2, y = (n.top + n.bottom) / 2);
|
|
2452
|
-
const w = n.view && n.view.enabled ? n.view.height / n.view.fullHeight : 1,
|
|
2453
|
-
a.camera.style !==
|
|
2423
|
+
const w = n.view && n.view.enabled ? n.view.height / n.view.fullHeight : 1, O = n.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + p(E) + "px," + p(y) + "px)" + C(n.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + C(n.matrixWorldInverse), D = (n.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + O + "translate(" + r + "px," + o + "px)";
|
|
2424
|
+
a.camera.style !== D && (f.style.transform = D, a.camera.style = D), u(g, g, n);
|
|
2454
2425
|
}, this.setSize = function(g, n) {
|
|
2455
2426
|
s = g, i = n, r = s / 2, o = i / 2, h.style.width = g + "px", h.style.height = n + "px", d.style.width = g + "px", d.style.height = n + "px", f.style.width = g + "px", f.style.height = n + "px";
|
|
2456
2427
|
};
|
|
@@ -2479,13 +2450,13 @@ class ds {
|
|
|
2479
2450
|
const y = g.layers.test(_.layers) === !0, w = g.element;
|
|
2480
2451
|
if (w.style.display = y === !0 ? "" : "none", y === !0) {
|
|
2481
2452
|
g.onBeforeRender(t, n, _);
|
|
2482
|
-
let
|
|
2483
|
-
g.isCSS3DSprite ? (
|
|
2484
|
-
const
|
|
2485
|
-
if (
|
|
2486
|
-
w.style.transform =
|
|
2487
|
-
const
|
|
2488
|
-
a.objects.set(g,
|
|
2453
|
+
let O;
|
|
2454
|
+
g.isCSS3DSprite ? (H.copy(_.matrixWorldInverse), H.transpose(), g.rotation2D !== 0 && H.multiply(Vs.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Xe, js, qe), H.setPosition(Xe), H.scale(qe), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, O = v(H)) : O = v(g.matrixWorld);
|
|
2455
|
+
const b = a.objects.get(g);
|
|
2456
|
+
if (b === void 0 || b.style !== O) {
|
|
2457
|
+
w.style.transform = O;
|
|
2458
|
+
const D = { style: O };
|
|
2459
|
+
a.objects.set(g, D);
|
|
2489
2460
|
}
|
|
2490
2461
|
w.parentNode !== f && f.appendChild(w), g.onAfterRender(t, n, _);
|
|
2491
2462
|
}
|
|
@@ -2495,8 +2466,8 @@ class ds {
|
|
|
2495
2466
|
}
|
|
2496
2467
|
}
|
|
2497
2468
|
}
|
|
2498
|
-
const
|
|
2499
|
-
class
|
|
2469
|
+
const $ = new I(), $e = new W(), Qe = new W(), Je = new I(), et = new I();
|
|
2470
|
+
class Ys {
|
|
2500
2471
|
/**
|
|
2501
2472
|
* Constructs a new CSS2D renderer.
|
|
2502
2473
|
*
|
|
@@ -2514,7 +2485,7 @@ class ps {
|
|
|
2514
2485
|
height: i
|
|
2515
2486
|
};
|
|
2516
2487
|
}, this.render = function(m, u) {
|
|
2517
|
-
m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), u.parent === null && u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(),
|
|
2488
|
+
m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), u.parent === null && u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), $e.copy(u.matrixWorldInverse), Qe.multiplyMatrices(u.projectionMatrix, $e), f(m, m, u), v(m);
|
|
2518
2489
|
}, this.setSize = function(m, u) {
|
|
2519
2490
|
s = m, i = u, r = s / 2, o = i / 2, h.style.width = m + "px", h.style.height = u + "px";
|
|
2520
2491
|
};
|
|
@@ -2529,9 +2500,9 @@ class ps {
|
|
|
2529
2500
|
return;
|
|
2530
2501
|
}
|
|
2531
2502
|
if (m.isCSS2DObject) {
|
|
2532
|
-
|
|
2533
|
-
const n =
|
|
2534
|
-
_.style.display = n === !0 ? "" : "none", n === !0 && (m.onBeforeRender(t, u, g), _.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (
|
|
2503
|
+
$.setFromMatrixPosition(m.matrixWorld), $.applyMatrix4(Qe);
|
|
2504
|
+
const n = $.z >= -1 && $.z <= 1 && m.layers.test(g.layers) === !0, _ = m.element;
|
|
2505
|
+
_.style.display = n === !0 ? "" : "none", n === !0 && (m.onBeforeRender(t, u, g), _.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + ($.x * r + r) + "px," + (-$.y * o + o) + "px)", _.parentNode !== h && h.appendChild(_), m.onAfterRender(t, u, g));
|
|
2535
2506
|
const E = {
|
|
2536
2507
|
distanceToCameraSquared: p(g, m)
|
|
2537
2508
|
};
|
|
@@ -2541,7 +2512,7 @@ class ps {
|
|
|
2541
2512
|
f(m.children[n], u, g);
|
|
2542
2513
|
}
|
|
2543
2514
|
function p(m, u) {
|
|
2544
|
-
return
|
|
2515
|
+
return Je.setFromMatrixPosition(m.matrixWorld), et.setFromMatrixPosition(u.matrixWorld), Je.distanceToSquared(et);
|
|
2545
2516
|
}
|
|
2546
2517
|
function C(m) {
|
|
2547
2518
|
const u = [];
|
|
@@ -2561,15 +2532,15 @@ class ps {
|
|
|
2561
2532
|
}
|
|
2562
2533
|
}
|
|
2563
2534
|
}
|
|
2564
|
-
const
|
|
2535
|
+
const tt = {
|
|
2565
2536
|
zIndex: "auto"
|
|
2566
2537
|
};
|
|
2567
|
-
class
|
|
2538
|
+
class Zs {
|
|
2568
2539
|
constructor(e) {
|
|
2569
2540
|
this.container = e;
|
|
2570
2541
|
}
|
|
2571
2542
|
addRenderer(e, t) {
|
|
2572
|
-
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new
|
|
2543
|
+
const s = t.container || this.container, i = s.offsetWidth, r = s.offsetHeight, o = e === "css2d" ? new Ys() : new Bs();
|
|
2573
2544
|
o.domElement.style.position = "absolute", o.domElement.style.top = "0", o.domElement.style.pointerEvents = "none", o.domElement.style.zIndex = t.zIndex, o.setSize(i, r), s.appendChild(o.domElement), e === "css2d" ? this.css2Drenderer = o : e === "css3d" && (this.css3Drenderer = o);
|
|
2574
2545
|
}
|
|
2575
2546
|
setSize(e, t) {
|
|
@@ -2585,7 +2556,7 @@ class ms {
|
|
|
2585
2556
|
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
2586
2557
|
}
|
|
2587
2558
|
}
|
|
2588
|
-
const
|
|
2559
|
+
const Ws = {
|
|
2589
2560
|
name: "OutputShader",
|
|
2590
2561
|
uniforms: {
|
|
2591
2562
|
tDiffuse: { value: null },
|
|
@@ -2679,21 +2650,21 @@ const us = {
|
|
|
2679
2650
|
}`
|
|
2680
2651
|
)
|
|
2681
2652
|
};
|
|
2682
|
-
class
|
|
2653
|
+
class Gs extends fs {
|
|
2683
2654
|
constructor() {
|
|
2684
2655
|
super();
|
|
2685
|
-
const e =
|
|
2686
|
-
this.uniforms =
|
|
2656
|
+
const e = Ws;
|
|
2657
|
+
this.uniforms = Wt.clone(e.uniforms), this.material = new Gt({
|
|
2687
2658
|
name: e.name,
|
|
2688
2659
|
uniforms: this.uniforms,
|
|
2689
2660
|
vertexShader: e.vertexShader,
|
|
2690
2661
|
fragmentShader: e.fragmentShader
|
|
2691
|
-
}), this.fsQuad ? this.fsQuad = new
|
|
2662
|
+
}), this.fsQuad ? this.fsQuad = new ke(this.material) : this._fsQuad && (this._fsQuad = new ke(this.material));
|
|
2692
2663
|
}
|
|
2693
2664
|
}
|
|
2694
|
-
const
|
|
2695
|
-
const e = new
|
|
2696
|
-
new
|
|
2665
|
+
const Ks = (l) => {
|
|
2666
|
+
const e = new _s(
|
|
2667
|
+
new Kt({
|
|
2697
2668
|
uniforms: {
|
|
2698
2669
|
baseTexture: { value: null },
|
|
2699
2670
|
bloomTexture: { value: l.renderTarget2.texture },
|
|
@@ -2727,38 +2698,38 @@ const _s = (l) => {
|
|
|
2727
2698
|
"baseTexture"
|
|
2728
2699
|
);
|
|
2729
2700
|
return e.needsSwap = !0, e;
|
|
2730
|
-
},
|
|
2701
|
+
}, Pe = 1, me = !1, Xs = new Xt({ color: "black" }), qs = new lt({
|
|
2731
2702
|
color: "black",
|
|
2732
2703
|
sizeAttenuation: !1
|
|
2733
|
-
}),
|
|
2704
|
+
}), $s = new lt({
|
|
2734
2705
|
color: "black",
|
|
2735
2706
|
sizeAttenuation: !0
|
|
2736
|
-
}),
|
|
2707
|
+
}), Qs = new ct({
|
|
2737
2708
|
color: "black",
|
|
2738
2709
|
sizeAttenuation: !0
|
|
2739
|
-
}),
|
|
2710
|
+
}), Js = new ct({
|
|
2740
2711
|
color: "black",
|
|
2741
2712
|
sizeAttenuation: !1
|
|
2742
|
-
}),
|
|
2713
|
+
}), ei = new mt({
|
|
2743
2714
|
color: "black",
|
|
2744
2715
|
sizeAttenuation: 0,
|
|
2745
2716
|
lineWidth: 0
|
|
2746
|
-
}),
|
|
2717
|
+
}), ti = {
|
|
2747
2718
|
kernelRadius: 8,
|
|
2748
2719
|
minDistance: 5e-3,
|
|
2749
2720
|
maxDistance: 0.1
|
|
2750
|
-
},
|
|
2721
|
+
}, si = {
|
|
2751
2722
|
threshold: 0,
|
|
2752
2723
|
strength: 0.4,
|
|
2753
2724
|
radius: 0.1,
|
|
2754
2725
|
bloomAlphaType: 0
|
|
2755
|
-
},
|
|
2726
|
+
}, ii = {
|
|
2756
2727
|
multisampling: 4,
|
|
2757
2728
|
premultiplieAlpha: !1
|
|
2758
2729
|
};
|
|
2759
|
-
class
|
|
2730
|
+
class ri {
|
|
2760
2731
|
constructor(e) {
|
|
2761
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2732
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new qt(), this.bloomMaterials = {}, this.bloomVisible = {}, this.pipViewportState = null, this.options = e;
|
|
2762
2733
|
const {
|
|
2763
2734
|
rendererController: t,
|
|
2764
2735
|
sceneController: s,
|
|
@@ -2766,18 +2737,16 @@ class bs {
|
|
|
2766
2737
|
composerParams: r
|
|
2767
2738
|
} = e, { renderer: o } = t;
|
|
2768
2739
|
this.renderer = o;
|
|
2769
|
-
const { multisampling: a } = r, { maxSamples: h } = o.capabilities, d = o.getDrawingBufferSize(
|
|
2770
|
-
new O.Vector2()
|
|
2771
|
-
), f = new O.WebGLRenderTarget(
|
|
2740
|
+
const { multisampling: a } = r, { maxSamples: h } = o.capabilities, d = o.getDrawingBufferSize(new V()), f = new $t(
|
|
2772
2741
|
d.width,
|
|
2773
2742
|
d.height,
|
|
2774
2743
|
{
|
|
2775
2744
|
samples: Math.min(a, h),
|
|
2776
|
-
type:
|
|
2745
|
+
type: Qt
|
|
2777
2746
|
}
|
|
2778
|
-
), p = new
|
|
2747
|
+
), p = new ze(o, f), C = this.getSize();
|
|
2779
2748
|
p.setSize(C.width, C.height);
|
|
2780
|
-
const v = new
|
|
2749
|
+
const v = new ms(
|
|
2781
2750
|
s.scene,
|
|
2782
2751
|
i.camera
|
|
2783
2752
|
);
|
|
@@ -2794,28 +2763,28 @@ class bs {
|
|
|
2794
2763
|
this.renderPass.scene = e, this.ssaoPass && (this.ssaoPass.scene = e), this.scene = e;
|
|
2795
2764
|
}
|
|
2796
2765
|
addOutputPass() {
|
|
2797
|
-
const { premultiplieAlpha: e } = this.options.composerParams, t = new
|
|
2766
|
+
const { premultiplieAlpha: e } = this.options.composerParams, t = new Gs();
|
|
2798
2767
|
this.outputPass = t, this.setPremultiplieAlpha(e), this.finalComposer.addPass(t);
|
|
2799
2768
|
}
|
|
2800
2769
|
setPremultiplieAlpha(e) {
|
|
2801
2770
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2802
2771
|
}
|
|
2803
2772
|
addSSAOPass(e) {
|
|
2804
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new
|
|
2773
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new V()), o = r.width, a = r.height, h = new us(t, s, o, a);
|
|
2805
2774
|
h.kernelRadius = e.kernelRadius, h.minDistance = e.minDistance, h.maxDistance = e.maxDistance, this.ssaoPass = h, this.finalComposer.addPass(h);
|
|
2806
2775
|
}
|
|
2807
2776
|
addBloomPass(e) {
|
|
2808
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, a = new
|
|
2809
|
-
new
|
|
2777
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, a = new gs(
|
|
2778
|
+
new V(window.innerWidth, window.innerHeight),
|
|
2810
2779
|
i,
|
|
2811
2780
|
r,
|
|
2812
2781
|
s
|
|
2813
2782
|
);
|
|
2814
2783
|
this.bloomPass = a;
|
|
2815
|
-
const h = new
|
|
2784
|
+
const h = new ze(t);
|
|
2816
2785
|
h.renderToScreen = !1, h.addPass(this.renderPass), h.addPass(a), this.bloomComposer = h;
|
|
2817
|
-
const d =
|
|
2818
|
-
d.uniforms.bloomAlphaType.value = o, this.bloomComposer = h, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(
|
|
2786
|
+
const d = Ks(h);
|
|
2787
|
+
d.uniforms.bloomAlphaType.value = o, this.bloomComposer = h, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(Pe);
|
|
2819
2788
|
}
|
|
2820
2789
|
setBloomSelection(e, t) {
|
|
2821
2790
|
if (!this.bloomComposer) {
|
|
@@ -2824,7 +2793,7 @@ class bs {
|
|
|
2824
2793
|
}
|
|
2825
2794
|
e.traverse((s) => {
|
|
2826
2795
|
const { object3d: i } = s;
|
|
2827
|
-
i && (t ? (this.bloomSelection.add(s), i.layers.enable(
|
|
2796
|
+
i && (t ? (this.bloomSelection.add(s), i.layers.enable(Pe)) : (this.bloomSelection.delete(s), i.layers.disable(Pe)));
|
|
2828
2797
|
}), this.bloomSelection.size === 0 ? this.bloomComposerActive = !1 : this.bloomComposerActive = !0;
|
|
2829
2798
|
}
|
|
2830
2799
|
enable() {
|
|
@@ -2849,7 +2818,7 @@ class bs {
|
|
|
2849
2818
|
s.traverse((i) => {
|
|
2850
2819
|
var h;
|
|
2851
2820
|
const r = i, o = i, a = i;
|
|
2852
|
-
(h = r.material) != null && h.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material =
|
|
2821
|
+
(h = r.material) != null && h.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = Qs : o.material = Js : r.material instanceof mt ? r.material = ei : a.isPoints ? a.material.sizeAttenuation ? a.material = $s : a.material = qs : r.material = Xs);
|
|
2853
2822
|
});
|
|
2854
2823
|
}), e.forEach((s) => {
|
|
2855
2824
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2865,7 +2834,7 @@ class bs {
|
|
|
2865
2834
|
this.bloomComposerActive && this.bloomComposer ? (this.mixPass.enabled = !0, this.darkenNonBloomed(), this.bloomComposer.render(), this.restoreNonBloomed()) : this.mixPass && (this.mixPass.enabled = !1), this.finalComposer.render();
|
|
2866
2835
|
}
|
|
2867
2836
|
getSize() {
|
|
2868
|
-
return this.renderer.getSize(new
|
|
2837
|
+
return this.renderer.getSize(new V());
|
|
2869
2838
|
}
|
|
2870
2839
|
render() {
|
|
2871
2840
|
if (!this.active) return;
|
|
@@ -2873,7 +2842,7 @@ class bs {
|
|
|
2873
2842
|
if (this.finalComposerRender(), this.pipViewportState) {
|
|
2874
2843
|
e.setPageActive(31), e.setAspect(
|
|
2875
2844
|
this.pipViewportState.width / this.pipViewportState.height
|
|
2876
|
-
), t.setViewport(
|
|
2845
|
+
), t.setViewport(ee(U({}, this.pipViewportState), {
|
|
2877
2846
|
scissor: !0,
|
|
2878
2847
|
scissorTest: !0
|
|
2879
2848
|
})), this.finalComposerRender(), e.setPageActive(s.activeIndex);
|
|
@@ -2893,7 +2862,7 @@ class bs {
|
|
|
2893
2862
|
this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomSelection.clear(), this.finalComposer.dispose(), (e = this.bloomComposer) == null || e.dispose();
|
|
2894
2863
|
}
|
|
2895
2864
|
}
|
|
2896
|
-
class
|
|
2865
|
+
class st extends dt {
|
|
2897
2866
|
constructor(e) {
|
|
2898
2867
|
super(e), this.options = { type: "image" };
|
|
2899
2868
|
}
|
|
@@ -2902,8 +2871,8 @@ class Qe extends O.Loader {
|
|
|
2902
2871
|
}
|
|
2903
2872
|
load(e, t, s, i) {
|
|
2904
2873
|
let r, o;
|
|
2905
|
-
this.options.type === "image" ? (o = document.createElement("img"), r = new
|
|
2906
|
-
const a = new
|
|
2874
|
+
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new pt(o)) : r = new fe();
|
|
2875
|
+
const a = new Le(this.manager);
|
|
2907
2876
|
return a.setResponseType("blob"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
|
|
2908
2877
|
e,
|
|
2909
2878
|
(h) => {
|
|
@@ -2926,12 +2895,12 @@ class Qe extends O.Loader {
|
|
|
2926
2895
|
), r;
|
|
2927
2896
|
}
|
|
2928
2897
|
}
|
|
2929
|
-
class
|
|
2898
|
+
class oi extends dt {
|
|
2930
2899
|
constructor(e) {
|
|
2931
2900
|
super(e);
|
|
2932
2901
|
}
|
|
2933
2902
|
load(e, t, s, i) {
|
|
2934
|
-
const r = new
|
|
2903
|
+
const r = new Le(this.manager);
|
|
2935
2904
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
2936
2905
|
e,
|
|
2937
2906
|
(o) => {
|
|
@@ -2947,7 +2916,7 @@ class Ps extends O.Loader {
|
|
|
2947
2916
|
);
|
|
2948
2917
|
}
|
|
2949
2918
|
}
|
|
2950
|
-
const
|
|
2919
|
+
const ni = {
|
|
2951
2920
|
images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
|
|
2952
2921
|
media: ["mp4", "webm", "ogg"],
|
|
2953
2922
|
gltf: ["gltf", "glb"],
|
|
@@ -2956,12 +2925,12 @@ const Ls = {
|
|
|
2956
2925
|
exr: ["exr"],
|
|
2957
2926
|
lottie: ["lottie.json"]
|
|
2958
2927
|
};
|
|
2959
|
-
class
|
|
2928
|
+
class ai {
|
|
2960
2929
|
constructor(e) {
|
|
2961
|
-
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new
|
|
2930
|
+
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ve.EventEmitter(), this.options = U({
|
|
2962
2931
|
simpleTexture4deleted: !1,
|
|
2963
2932
|
prefix: ""
|
|
2964
|
-
}, e), this.loadingManager = new
|
|
2933
|
+
}, e), this.loadingManager = new Jt(
|
|
2965
2934
|
() => {
|
|
2966
2935
|
},
|
|
2967
2936
|
(t, s, i) => {
|
|
@@ -2985,7 +2954,7 @@ class Ss {
|
|
|
2985
2954
|
const s = this.assets.get(e);
|
|
2986
2955
|
if (!s) {
|
|
2987
2956
|
if ((t === "images" || t === "media" || t === "exr") && this.options.simpleTexture4deleted && this.delLoadArr.includes(e))
|
|
2988
|
-
return new
|
|
2957
|
+
return new fe();
|
|
2989
2958
|
console.warn(`Asset ${e} not found`);
|
|
2990
2959
|
}
|
|
2991
2960
|
return s;
|
|
@@ -2999,31 +2968,31 @@ class Ss {
|
|
|
2999
2968
|
if (e.endsWith("json.gzip"))
|
|
3000
2969
|
return "gzipJson";
|
|
3001
2970
|
} else return;
|
|
3002
|
-
for (const [i, r] of Object.entries(
|
|
2971
|
+
for (const [i, r] of Object.entries(ni))
|
|
3003
2972
|
if (r.includes(t))
|
|
3004
2973
|
return i;
|
|
3005
2974
|
}
|
|
3006
2975
|
getLoader(e, t) {
|
|
3007
2976
|
if (e === "images")
|
|
3008
|
-
return this.textureLoader || (this.textureLoader = new
|
|
2977
|
+
return this.textureLoader || (this.textureLoader = new st(this.loadingManager), this.options.prefix && this.textureLoader.setPath(this.options.prefix)), this.textureLoader;
|
|
3009
2978
|
if (e === "media")
|
|
3010
|
-
return this.videoTextureLoader || (this.videoTextureLoader = new
|
|
2979
|
+
return this.videoTextureLoader || (this.videoTextureLoader = new st(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3011
2980
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3012
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
2981
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Fe(this.loadingManager), this.dracoLoader = new vs(), 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;
|
|
3013
2982
|
if (e === "gltf")
|
|
3014
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
2983
|
+
return this.gltfLoader || (this.gltfLoader = new Fe(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3015
2984
|
if (e === "lottie")
|
|
3016
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
2985
|
+
return this.lottieLoader || (this.lottieLoader = new Cs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3017
2986
|
if (e === "gzipJson")
|
|
3018
|
-
return this.gzipJsonLoader || (this.gzipJsonLoader = new
|
|
2987
|
+
return this.gzipJsonLoader || (this.gzipJsonLoader = new oi(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3019
2988
|
if (e === "json")
|
|
3020
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
2989
|
+
return this.jsonLoader || (this.jsonLoader = new Le(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3021
2990
|
if (e === "exr")
|
|
3022
|
-
return this.exrLoader || (this.exrLoader = new
|
|
2991
|
+
return this.exrLoader || (this.exrLoader = new ys(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3023
2992
|
}
|
|
3024
2993
|
add(e, t) {
|
|
3025
2994
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
3026
|
-
const i =
|
|
2995
|
+
const i = U({
|
|
3027
2996
|
src: s
|
|
3028
2997
|
}, t);
|
|
3029
2998
|
this.loadObj.push(i);
|
|
@@ -3038,11 +3007,11 @@ class Ss {
|
|
|
3038
3007
|
get textureAssets() {
|
|
3039
3008
|
const e = /* @__PURE__ */ new Map();
|
|
3040
3009
|
return this.assets.forEach((t, s) => {
|
|
3041
|
-
(t instanceof
|
|
3010
|
+
(t instanceof fe || t instanceof es || t instanceof pt) && e.set(s, t);
|
|
3042
3011
|
}), e;
|
|
3043
3012
|
}
|
|
3044
3013
|
loadAll() {
|
|
3045
|
-
return
|
|
3014
|
+
return te(this, null, function* () {
|
|
3046
3015
|
const e = this.loadObj.filter((t) => !this.delLoadArr.includes(t.src));
|
|
3047
3016
|
return yield Promise.all(
|
|
3048
3017
|
e.map((t) => this.load(t.src, t))
|
|
@@ -3050,12 +3019,12 @@ class Ss {
|
|
|
3050
3019
|
});
|
|
3051
3020
|
}
|
|
3052
3021
|
load(e, t) {
|
|
3053
|
-
return
|
|
3022
|
+
return te(this, null, function* () {
|
|
3054
3023
|
var a, h;
|
|
3055
3024
|
const s = (a = t == null ? void 0 : t.type) != null ? a : this.getAssetType(e);
|
|
3056
3025
|
if (!s)
|
|
3057
3026
|
return;
|
|
3058
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3027
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = Es();
|
|
3059
3028
|
if (i) {
|
|
3060
3029
|
if (this.assets.has(e))
|
|
3061
3030
|
return this.assets.get(e);
|
|
@@ -3065,7 +3034,7 @@ class Ss {
|
|
|
3065
3034
|
try {
|
|
3066
3035
|
const d = yield o.loadAsync(e);
|
|
3067
3036
|
if (this.assets.set(e, d), r.resolve(d), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3068
|
-
(t == null ? void 0 : t.colorCorrection) !== !1 &&
|
|
3037
|
+
(t == null ? void 0 : t.colorCorrection) !== !1 && ns({ texture: d });
|
|
3069
3038
|
const f = (h = t == null ? void 0 : t.anisotropy) != null ? h : this.options.anisotropy;
|
|
3070
3039
|
d.anisotropy = f;
|
|
3071
3040
|
}
|
|
@@ -3109,10 +3078,10 @@ class Ss {
|
|
|
3109
3078
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3110
3079
|
}
|
|
3111
3080
|
}
|
|
3112
|
-
const
|
|
3081
|
+
const hi = {
|
|
3113
3082
|
prefix: ""
|
|
3114
3083
|
};
|
|
3115
|
-
class
|
|
3084
|
+
class li extends ae {
|
|
3116
3085
|
get loader() {
|
|
3117
3086
|
return this.controller;
|
|
3118
3087
|
}
|
|
@@ -3120,7 +3089,7 @@ class Ms extends ne {
|
|
|
3120
3089
|
super(), this.options = e;
|
|
3121
3090
|
}
|
|
3122
3091
|
addLoader(e, t) {
|
|
3123
|
-
const { loaderParams: s } = this.options, i = new
|
|
3092
|
+
const { loaderParams: s } = this.options, i = new ai(ee(U({}, s), {
|
|
3124
3093
|
scene: e
|
|
3125
3094
|
}));
|
|
3126
3095
|
return this.addController(i, t);
|
|
@@ -3131,16 +3100,16 @@ class Ms extends ne {
|
|
|
3131
3100
|
});
|
|
3132
3101
|
}
|
|
3133
3102
|
}
|
|
3134
|
-
class
|
|
3103
|
+
class ci extends ls {
|
|
3135
3104
|
constructor(e) {
|
|
3136
|
-
super(), this.options =
|
|
3105
|
+
super(), this.options = U({}, e);
|
|
3137
3106
|
}
|
|
3138
3107
|
create() {
|
|
3139
3108
|
var e;
|
|
3140
|
-
this.object3d = (e = this.options.scene) != null ? e : new
|
|
3109
|
+
this.object3d = (e = this.options.scene) != null ? e : new ot();
|
|
3141
3110
|
}
|
|
3142
3111
|
}
|
|
3143
|
-
function
|
|
3112
|
+
function it(l) {
|
|
3144
3113
|
let e = !1, t = [];
|
|
3145
3114
|
return function(...s) {
|
|
3146
3115
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
@@ -3148,7 +3117,7 @@ function Je(l) {
|
|
|
3148
3117
|
}));
|
|
3149
3118
|
};
|
|
3150
3119
|
}
|
|
3151
|
-
class
|
|
3120
|
+
class di {
|
|
3152
3121
|
constructor(e) {
|
|
3153
3122
|
var t;
|
|
3154
3123
|
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.prevActiveObjects = /* @__PURE__ */ new Set(), this.objCallbackMap = /* @__PURE__ */ new Map(), this.pickListener = {
|
|
@@ -3164,7 +3133,7 @@ class Rs {
|
|
|
3164
3133
|
r.preventDefault();
|
|
3165
3134
|
const o = e === "move" ? t : s, a = [];
|
|
3166
3135
|
if (this.pickFunctionsMap.forEach((m) => {
|
|
3167
|
-
o.has(m.type) && a.push(
|
|
3136
|
+
o.has(m.type) && a.push(ee(U({}, m), {
|
|
3168
3137
|
objArr: m.objArr instanceof Function ? m.objArr() : m.objArr
|
|
3169
3138
|
}));
|
|
3170
3139
|
}), a.length === 0) return;
|
|
@@ -3181,7 +3150,7 @@ class Rs {
|
|
|
3181
3150
|
const f = d.map((m) => m.object3d);
|
|
3182
3151
|
f.forEach((m) => {
|
|
3183
3152
|
m.isGroup && m.traverse((u) => {
|
|
3184
|
-
u instanceof
|
|
3153
|
+
u instanceof ts && f.push(u);
|
|
3185
3154
|
});
|
|
3186
3155
|
});
|
|
3187
3156
|
const p = (v = this.pencil.pick(r, f, !1)) == null ? void 0 : v.intersects;
|
|
@@ -3197,7 +3166,7 @@ class Rs {
|
|
|
3197
3166
|
};
|
|
3198
3167
|
this.domElement.addEventListener(
|
|
3199
3168
|
`pointer${e}`,
|
|
3200
|
-
|
|
3169
|
+
it(i),
|
|
3201
3170
|
{ passive: !1 }
|
|
3202
3171
|
);
|
|
3203
3172
|
}
|
|
@@ -3321,7 +3290,7 @@ class Rs {
|
|
|
3321
3290
|
mouseEvent: p
|
|
3322
3291
|
}));
|
|
3323
3292
|
}, f = `pointer${t}`;
|
|
3324
|
-
h.element.addEventListener(f,
|
|
3293
|
+
h.element.addEventListener(f, it(d), !1), o.push({ arr: h, type: f, listener: d });
|
|
3325
3294
|
}
|
|
3326
3295
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
3327
3296
|
}
|
|
@@ -3341,11 +3310,11 @@ class Rs {
|
|
|
3341
3310
|
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
|
|
3342
3311
|
}
|
|
3343
3312
|
}
|
|
3344
|
-
class
|
|
3313
|
+
class pi extends di {
|
|
3345
3314
|
constructor(e, t) {
|
|
3346
|
-
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.scene = new
|
|
3315
|
+
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.scene = new ci({
|
|
3347
3316
|
scene: t.scene
|
|
3348
|
-
}), this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.key = "Scene", this.scene.object3d.name = "场景", this.group = new
|
|
3317
|
+
}), this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.key = "Scene", this.scene.object3d.name = "场景", this.group = new Ue(), this.group.create(), this.group.lead = this, this.group.pencil = e, this.group.key = "@Group", this.group.object3d.name = "物体组", this.prefabGroup = new Ue(), this.prefabGroup.create(), this.prefabGroup.lead = this, this.prefabGroup.pencil = e, this.prefabGroup.key = "@PrefabGroup", this.prefabGroup.object3d.name = "预制组", this.scene.add(this.group.object3d, this.prefabGroup.object3d), this.objects.set("@Scene", this.scene), this.objects.set("@Group", this.group), this.objects.set("@PrefabGroup", this.prefabGroup), this.objMap.set(this.scene.object3d, this.scene), this.objMap.set(this.group.object3d, this.group), this.objMap.set(this.prefabGroup.object3d, this.prefabGroup);
|
|
3349
3318
|
}
|
|
3350
3319
|
get objectsPromise() {
|
|
3351
3320
|
return this.objectsPm.values();
|
|
@@ -3373,7 +3342,7 @@ class Us extends Rs {
|
|
|
3373
3342
|
}), r;
|
|
3374
3343
|
}
|
|
3375
3344
|
draw(e, t, s) {
|
|
3376
|
-
return
|
|
3345
|
+
return te(this, null, function* () {
|
|
3377
3346
|
var r, o, a, h;
|
|
3378
3347
|
const i = this.objectNamesToFactories.get(e);
|
|
3379
3348
|
if (i) {
|
|
@@ -3402,7 +3371,7 @@ class Us extends Rs {
|
|
|
3402
3371
|
const [, a] = s.split("#");
|
|
3403
3372
|
o = o.replace("$p:", a);
|
|
3404
3373
|
}
|
|
3405
|
-
return this.objects.has(o) && (o.includes("#") ? o += `-${
|
|
3374
|
+
return this.objects.has(o) && (o.includes("#") ? o += `-${Ne()}` : o += `#${Ne()}`), e.key = o, this.objects.set(o, e), o;
|
|
3406
3375
|
}
|
|
3407
3376
|
updateBaseObjectKey(e, t) {
|
|
3408
3377
|
var o;
|
|
@@ -3420,7 +3389,7 @@ class Us extends Rs {
|
|
|
3420
3389
|
return this.pencil.event.emit("updateKey", e, r, s), r;
|
|
3421
3390
|
}
|
|
3422
3391
|
addBaseObject(e, t, s) {
|
|
3423
|
-
return
|
|
3392
|
+
return te(this, null, function* () {
|
|
3424
3393
|
yield e.create(), e.object3d && (s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render(), this.pencil.event.emit("draw", e);
|
|
3425
3394
|
});
|
|
3426
3395
|
}
|
|
@@ -3464,7 +3433,7 @@ class Us extends Rs {
|
|
|
3464
3433
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectNamesToFactories.clear();
|
|
3465
3434
|
}
|
|
3466
3435
|
}
|
|
3467
|
-
class
|
|
3436
|
+
class mi extends ae {
|
|
3468
3437
|
get lead() {
|
|
3469
3438
|
return this.controller;
|
|
3470
3439
|
}
|
|
@@ -3472,7 +3441,7 @@ class zs extends ne {
|
|
|
3472
3441
|
super(), this.options = e;
|
|
3473
3442
|
}
|
|
3474
3443
|
addLead(e, t) {
|
|
3475
|
-
const { pencil: s } = this.options, i = new
|
|
3444
|
+
const { pencil: s } = this.options, i = new pi(s, {
|
|
3476
3445
|
scene: e
|
|
3477
3446
|
});
|
|
3478
3447
|
return this.addController(i, t);
|
|
@@ -3493,11 +3462,11 @@ class zs extends ne {
|
|
|
3493
3462
|
});
|
|
3494
3463
|
}
|
|
3495
3464
|
}
|
|
3496
|
-
const
|
|
3465
|
+
const _e = class _e {
|
|
3497
3466
|
constructor(e) {
|
|
3498
3467
|
var r, o;
|
|
3499
|
-
this.raycaster = new
|
|
3500
|
-
isMergeableObject:
|
|
3468
|
+
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ve.EventEmitter(), this.timer = new ss(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = is(_e.options, e, {
|
|
3469
|
+
isMergeableObject: as
|
|
3501
3470
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3502
3471
|
const {
|
|
3503
3472
|
container: t,
|
|
@@ -3505,7 +3474,7 @@ const ue = class ue {
|
|
|
3505
3474
|
transformControls: i
|
|
3506
3475
|
} = this.options;
|
|
3507
3476
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3508
|
-
const a = new
|
|
3477
|
+
const a = new rs({
|
|
3509
3478
|
horizontal: !1
|
|
3510
3479
|
});
|
|
3511
3480
|
a.dom.style.position = "absolute", a.init(this.renderer), t.appendChild(a.dom), this.stats = a;
|
|
@@ -3543,7 +3512,7 @@ const ue = class ue {
|
|
|
3543
3512
|
return this.leadController.lead;
|
|
3544
3513
|
}
|
|
3545
3514
|
tweenUpdateRaf() {
|
|
3546
|
-
|
|
3515
|
+
Ce.update(), this.TweenRaf = requestAnimationFrame(this.tweenUpdateRaf.bind(this));
|
|
3547
3516
|
}
|
|
3548
3517
|
use(e, ...t) {
|
|
3549
3518
|
this.installPlugins.has(e.pluginName) ? console.log("plugin already installed") : typeof e.install == "function" && (e.install(this, ...t), this.installPlugins.set(e.pluginName, e));
|
|
@@ -3577,29 +3546,29 @@ const ue = class ue {
|
|
|
3577
3546
|
renderer: r,
|
|
3578
3547
|
controls: o,
|
|
3579
3548
|
loader: a
|
|
3580
|
-
} = this.options, { width: h, height: d } = this.getSize(), f = t ? new
|
|
3549
|
+
} = this.options, { width: h, height: d } = this.getSize(), f = t ? new Rs({
|
|
3581
3550
|
width: h,
|
|
3582
3551
|
height: d,
|
|
3583
3552
|
renderer: t.WebGPURenderer,
|
|
3584
|
-
rendererParams:
|
|
3585
|
-
}) : new
|
|
3553
|
+
rendererParams: Ds
|
|
3554
|
+
}) : new Ms({
|
|
3586
3555
|
width: h,
|
|
3587
3556
|
height: d,
|
|
3588
|
-
rendererParams:
|
|
3557
|
+
rendererParams: ee(U({}, r), {
|
|
3589
3558
|
antialias: !1
|
|
3590
3559
|
})
|
|
3591
|
-
}), p = new
|
|
3560
|
+
}), p = new zs({
|
|
3592
3561
|
width: h,
|
|
3593
3562
|
height: d
|
|
3594
|
-
}), C = new
|
|
3563
|
+
}), C = new Fs({}), v = new Hs({
|
|
3595
3564
|
controlsParams: {
|
|
3596
3565
|
domElement: (n = o == null ? void 0 : o.domElement) != null ? n : f.renderer.domElement
|
|
3597
3566
|
}
|
|
3598
|
-
}), m = new
|
|
3599
|
-
loaderParams:
|
|
3567
|
+
}), m = new li({
|
|
3568
|
+
loaderParams: U({
|
|
3600
3569
|
anisotropy: f.renderer.capabilities.getMaxAnisotropy()
|
|
3601
3570
|
}, a)
|
|
3602
|
-
}), u = new
|
|
3571
|
+
}), u = new mi({
|
|
3603
3572
|
pencil: this
|
|
3604
3573
|
});
|
|
3605
3574
|
this.sceneController = C, this.cameraController = p, this.controlsController = v, this.rendererController = f, this.loaderController = m, this.leadController = u;
|
|
@@ -3608,7 +3577,7 @@ const ue = class ue {
|
|
|
3608
3577
|
cameraOptions: this.options.camera
|
|
3609
3578
|
});
|
|
3610
3579
|
if (this.showPage(g), s) {
|
|
3611
|
-
const _ = new
|
|
3580
|
+
const _ = new Ns({
|
|
3612
3581
|
container: e,
|
|
3613
3582
|
sceneController: C,
|
|
3614
3583
|
cameraController: p
|
|
@@ -3624,13 +3593,13 @@ const ue = class ue {
|
|
|
3624
3593
|
ssao: s,
|
|
3625
3594
|
ssaoParams: i,
|
|
3626
3595
|
composer: r
|
|
3627
|
-
} = this.options, o = new
|
|
3596
|
+
} = this.options, o = new ri({
|
|
3628
3597
|
rendererController: this.rendererController,
|
|
3629
3598
|
sceneController: this.sceneController,
|
|
3630
3599
|
cameraController: this.cameraController,
|
|
3631
3600
|
composerParams: r
|
|
3632
3601
|
});
|
|
3633
|
-
this.composerController = o, e && o.addBloomPass(
|
|
3602
|
+
this.composerController = o, e && o.addBloomPass(U({}, t)), s && o.addSSAOPass(U({}, i)), o.addOutputPass();
|
|
3634
3603
|
}
|
|
3635
3604
|
initCSSRenderer() {
|
|
3636
3605
|
const {
|
|
@@ -3641,12 +3610,12 @@ const ue = class ue {
|
|
|
3641
3610
|
css3DRendererParams: r
|
|
3642
3611
|
} = this.options;
|
|
3643
3612
|
if (t || s) {
|
|
3644
|
-
const o = new
|
|
3613
|
+
const o = new Zs(e);
|
|
3645
3614
|
t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
|
|
3646
3615
|
}
|
|
3647
3616
|
}
|
|
3648
3617
|
initTransformControls() {
|
|
3649
|
-
const e = new
|
|
3618
|
+
const e = new Is({
|
|
3650
3619
|
camera: this.camera,
|
|
3651
3620
|
renderer: this.renderer,
|
|
3652
3621
|
scene: this.scene
|
|
@@ -3684,7 +3653,7 @@ const ue = class ue {
|
|
|
3684
3653
|
composerController: o,
|
|
3685
3654
|
cssRendererController: a,
|
|
3686
3655
|
leadController: h
|
|
3687
|
-
} = this, d = this.renderer.getSize(new
|
|
3656
|
+
} = this, d = this.renderer.getSize(new V());
|
|
3688
3657
|
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), a == null || a.setSize(e, t), h.setSize(e, t), this.installPlugins.forEach((f) => {
|
|
3689
3658
|
var p;
|
|
3690
3659
|
(p = f.setSize) == null || p.call(f, e, t);
|
|
@@ -3707,7 +3676,7 @@ const ue = class ue {
|
|
|
3707
3676
|
r !== o && (this.rendererController.setPixelRatio(r), (a = this.composerController) == null || a.setPixelRatio(r));
|
|
3708
3677
|
}
|
|
3709
3678
|
pick(e, t, s = !0) {
|
|
3710
|
-
const { raycaster: i, options: r } = this, { container: o } = r, a = new
|
|
3679
|
+
const { raycaster: i, options: r } = this, { container: o } = r, a = new V(), h = o.getBoundingClientRect();
|
|
3711
3680
|
if (a.x = (e.clientX - h.left) / (h.right - h.left) * 2 - 1, a.y = -((e.clientY - h.top) / (h.bottom - h.top)) * 2 + 1, this.camera && this.scene) {
|
|
3712
3681
|
i.setFromCamera(a, this.camera);
|
|
3713
3682
|
const d = i.intersectObjects(
|
|
@@ -3726,7 +3695,7 @@ const ue = class ue {
|
|
|
3726
3695
|
var s, i, r, o, a, h;
|
|
3727
3696
|
if (!this.camera || !this.scene)
|
|
3728
3697
|
return;
|
|
3729
|
-
this.timer.update(),
|
|
3698
|
+
this.timer.update(), Ce.update();
|
|
3730
3699
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3731
3700
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((d) => {
|
|
3732
3701
|
var f;
|
|
@@ -3774,38 +3743,38 @@ const ue = class ue {
|
|
|
3774
3743
|
}
|
|
3775
3744
|
dispose() {
|
|
3776
3745
|
var e, t, s, i, r, o, a, h, d, f, p, C, v;
|
|
3777
|
-
this.stop(), this.timer.dispose(),
|
|
3746
|
+
this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((m) => {
|
|
3778
3747
|
var u;
|
|
3779
3748
|
(u = m.dispose) == null || u.call(m);
|
|
3780
3749
|
}), (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(), (a = this.helperController) == null || a.dispose(), (h = this.composerController) == null || h.dispose(), (d = this.rendererController) == null || d.dispose(), (f = this.loaderController) == null || f.dispose(), (p = this.leadController) == null || p.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (C = this.stats) == null || C.dom.remove(), (v = this.renderer) == null || v.domElement.remove();
|
|
3781
3750
|
}
|
|
3782
3751
|
};
|
|
3783
|
-
|
|
3784
|
-
stats:
|
|
3785
|
-
helper:
|
|
3786
|
-
viewHelper:
|
|
3752
|
+
_e.options = {
|
|
3753
|
+
stats: me,
|
|
3754
|
+
helper: me,
|
|
3755
|
+
viewHelper: me,
|
|
3787
3756
|
controls: !0,
|
|
3788
|
-
transformControls:
|
|
3789
|
-
renderer:
|
|
3790
|
-
composer:
|
|
3791
|
-
scene:
|
|
3792
|
-
camera:
|
|
3757
|
+
transformControls: me,
|
|
3758
|
+
renderer: As,
|
|
3759
|
+
composer: ii,
|
|
3760
|
+
scene: ks,
|
|
3761
|
+
camera: Tt,
|
|
3793
3762
|
bloom: !1,
|
|
3794
|
-
bloomParams:
|
|
3763
|
+
bloomParams: si,
|
|
3795
3764
|
ssao: !1,
|
|
3796
|
-
loader:
|
|
3797
|
-
ssaoParams:
|
|
3765
|
+
loader: hi,
|
|
3766
|
+
ssaoParams: ti,
|
|
3798
3767
|
css2DRenderer: !1,
|
|
3799
|
-
css2DRendererParams:
|
|
3768
|
+
css2DRendererParams: U({}, tt),
|
|
3800
3769
|
css3DRenderer: !1,
|
|
3801
|
-
css3DRendererParams:
|
|
3770
|
+
css3DRendererParams: U({}, tt)
|
|
3802
3771
|
};
|
|
3803
|
-
let
|
|
3804
|
-
const
|
|
3772
|
+
let rt = _e;
|
|
3773
|
+
const Ki = J.ACTION;
|
|
3805
3774
|
export {
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3775
|
+
ls as BaseObject,
|
|
3776
|
+
rt as Pencil,
|
|
3777
|
+
hs as ResourceTracker,
|
|
3778
|
+
Ki as cameraControlsAction,
|
|
3779
|
+
rt as default
|
|
3811
3780
|
};
|