gl-draw 0.14.29 → 0.14.30
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/index.js +2 -2
- package/dist/index.module.js +219 -219
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -2,29 +2,29 @@ var ft = Object.defineProperty, _t = Object.defineProperties;
|
|
|
2
2
|
var gt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Le = Object.getOwnPropertySymbols;
|
|
4
4
|
var vt = Object.prototype.hasOwnProperty, yt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Se = (
|
|
5
|
+
var Se = (l, e, t) => e in l ? ft(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, z = (l, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
vt.call(e, t) && Se(
|
|
7
|
+
vt.call(e, t) && Se(l, t, e[t]);
|
|
8
8
|
if (Le)
|
|
9
9
|
for (var t of Le(e))
|
|
10
|
-
yt.call(e, t) && Se(
|
|
11
|
-
return
|
|
12
|
-
}, Q = (
|
|
13
|
-
var J = (
|
|
14
|
-
var r = (
|
|
10
|
+
yt.call(e, t) && Se(l, t, e[t]);
|
|
11
|
+
return l;
|
|
12
|
+
}, Q = (l, e) => _t(l, gt(e));
|
|
13
|
+
var J = (l, e, t) => new Promise((s, i) => {
|
|
14
|
+
var r = (h) => {
|
|
15
15
|
try {
|
|
16
|
-
n(t.next(
|
|
16
|
+
n(t.next(h));
|
|
17
17
|
} catch (d) {
|
|
18
18
|
i(d);
|
|
19
19
|
}
|
|
20
|
-
}, o = (
|
|
20
|
+
}, o = (h) => {
|
|
21
21
|
try {
|
|
22
|
-
n(t.throw(
|
|
22
|
+
n(t.throw(h));
|
|
23
23
|
} catch (d) {
|
|
24
24
|
i(d);
|
|
25
25
|
}
|
|
26
|
-
}, n = (
|
|
27
|
-
n((t = t.apply(
|
|
26
|
+
}, n = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(r, o);
|
|
27
|
+
n((t = t.apply(l, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as O from "three";
|
|
30
30
|
import { Vector3 as oe, Quaternion as Ct, Matrix4 as fe, UniformsUtils as Et, RawShaderMaterial as Ot } from "three";
|
|
@@ -89,64 +89,64 @@ const D = {
|
|
|
89
89
|
IN: 1,
|
|
90
90
|
OUT: -1
|
|
91
91
|
};
|
|
92
|
-
function B(
|
|
93
|
-
return
|
|
92
|
+
function B(l) {
|
|
93
|
+
return l.isPerspectiveCamera;
|
|
94
94
|
}
|
|
95
|
-
function j(
|
|
96
|
-
return
|
|
95
|
+
function j(l) {
|
|
96
|
+
return l.isOrthographicCamera;
|
|
97
97
|
}
|
|
98
98
|
const W = Math.PI * 2, Ue = Math.PI / 2, tt = 1e-5, ee = Math.PI / 180;
|
|
99
|
-
function F(
|
|
100
|
-
return Math.max(e, Math.min(t,
|
|
99
|
+
function F(l, e, t) {
|
|
100
|
+
return Math.max(e, Math.min(t, l));
|
|
101
101
|
}
|
|
102
|
-
function M(
|
|
103
|
-
return Math.abs(
|
|
102
|
+
function M(l, e = tt) {
|
|
103
|
+
return Math.abs(l) < e;
|
|
104
104
|
}
|
|
105
|
-
function S(
|
|
106
|
-
return M(
|
|
105
|
+
function S(l, e, t = tt) {
|
|
106
|
+
return M(l - e, t);
|
|
107
107
|
}
|
|
108
|
-
function ze(
|
|
109
|
-
return Math.round(
|
|
108
|
+
function ze(l, e) {
|
|
109
|
+
return Math.round(l / e) * e;
|
|
110
110
|
}
|
|
111
|
-
function te(
|
|
112
|
-
return isFinite(
|
|
111
|
+
function te(l) {
|
|
112
|
+
return isFinite(l) ? l : l < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
113
113
|
}
|
|
114
|
-
function se(
|
|
115
|
-
return Math.abs(
|
|
114
|
+
function se(l) {
|
|
115
|
+
return Math.abs(l) < Number.MAX_VALUE ? l : l * (1 / 0);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function he(l, e, t, s, i = 1 / 0, r) {
|
|
118
118
|
s = Math.max(1e-4, s);
|
|
119
|
-
const o = 2 / s, n = o * r,
|
|
120
|
-
let d =
|
|
119
|
+
const o = 2 / s, n = o * r, h = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
120
|
+
let d = l - e;
|
|
121
121
|
const f = e, p = i * s;
|
|
122
|
-
d = F(d, -p, p), e =
|
|
122
|
+
d = F(d, -p, p), e = l - d;
|
|
123
123
|
const C = (t.value + o * d) * r;
|
|
124
|
-
t.value = (t.value - o * C) *
|
|
125
|
-
let v = e + (d + C) *
|
|
126
|
-
return f -
|
|
124
|
+
t.value = (t.value - o * C) * h;
|
|
125
|
+
let v = e + (d + C) * h;
|
|
126
|
+
return f - l > 0 == v > f && (v = f, t.value = (v - f) / r), v;
|
|
127
127
|
}
|
|
128
|
-
function ke(
|
|
128
|
+
function ke(l, e, t, s, i = 1 / 0, r, o) {
|
|
129
129
|
s = Math.max(1e-4, s);
|
|
130
|
-
const n = 2 / s,
|
|
131
|
-
let f = e.x, p = e.y, C = e.z, v =
|
|
130
|
+
const n = 2 / s, h = n * r, d = 1 / (1 + h + 0.48 * h * h + 0.235 * h * h * h);
|
|
131
|
+
let f = e.x, p = e.y, C = e.z, v = l.x - f, m = l.y - p, u = l.z - C;
|
|
132
132
|
const g = f, a = p, _ = C, E = i * s, y = E * E, w = v * v + m * m + u * u;
|
|
133
133
|
if (w > y) {
|
|
134
134
|
const ve = Math.sqrt(w);
|
|
135
135
|
v = v / ve * E, m = m / ve * E, u = u / ve * E;
|
|
136
136
|
}
|
|
137
|
-
f =
|
|
137
|
+
f = l.x - v, p = l.y - m, C = l.z - u;
|
|
138
138
|
const T = (t.x + n * v) * r, P = (t.y + n * m) * r, R = (t.z + n * u) * r;
|
|
139
139
|
t.x = (t.x - n * T) * d, t.y = (t.y - n * P) * d, t.z = (t.z - n * R) * d, o.x = f + (v + T) * d, o.y = p + (m + P) * d, o.z = C + (u + R) * d;
|
|
140
|
-
const V = g -
|
|
140
|
+
const V = g - l.x, ae = a - l.y, dt = _ - l.z, pt = o.x - g, mt = o.y - a, ut = o.z - _;
|
|
141
141
|
return V * pt + ae * mt + dt * ut > 0 && (o.x = g, o.y = a, o.z = _, t.x = (o.x - g) / r, t.y = (o.y - a) / r, t.z = (o.z - _) / r), o;
|
|
142
142
|
}
|
|
143
|
-
function Ce(
|
|
144
|
-
e.set(0, 0),
|
|
143
|
+
function Ce(l, e) {
|
|
144
|
+
e.set(0, 0), l.forEach((t) => {
|
|
145
145
|
e.x += t.clientX, e.y += t.clientY;
|
|
146
|
-
}), e.x /=
|
|
146
|
+
}), e.x /= l.length, e.y /= l.length;
|
|
147
147
|
}
|
|
148
|
-
function Ee(
|
|
149
|
-
return j(
|
|
148
|
+
function Ee(l, e) {
|
|
149
|
+
return j(l) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
150
150
|
}
|
|
151
151
|
class Yt {
|
|
152
152
|
constructor() {
|
|
@@ -212,7 +212,7 @@ class Yt {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const
|
|
215
|
+
const le = 1 / 8, Zt = /Mac/.test(navigator.platform);
|
|
216
216
|
let x, Fe, ce, Oe, U, b, L, G, ie, N, H, Y, Ne, He, k, re, K, Ie, Te, je, xe, we, de;
|
|
217
217
|
class $ extends Yt {
|
|
218
218
|
/**
|
|
@@ -371,12 +371,12 @@ class $ extends Yt {
|
|
|
371
371
|
{ passive: !1 }
|
|
372
372
|
), this._domElement.ownerDocument.removeEventListener(
|
|
373
373
|
"pointerup",
|
|
374
|
-
|
|
374
|
+
h
|
|
375
375
|
), this._domElement.ownerDocument.addEventListener(
|
|
376
376
|
"pointermove",
|
|
377
377
|
n,
|
|
378
378
|
{ passive: !1 }
|
|
379
|
-
), this._domElement.ownerDocument.addEventListener("pointerup",
|
|
379
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, C(a);
|
|
380
380
|
}, n = (a) => {
|
|
381
381
|
a.cancelable && a.preventDefault();
|
|
382
382
|
const _ = a.pointerId, E = this._lockedPointer || this._findPointerById(_);
|
|
@@ -397,7 +397,7 @@ class $ extends Yt {
|
|
|
397
397
|
(!this._isDragging && this._lockedPointer || this._isDragging && (a.buttons & D.LEFT) === D.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (a.buttons & D.MIDDLE) === D.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (a.buttons & D.RIGHT) === D.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
398
398
|
v();
|
|
399
399
|
}
|
|
400
|
-
},
|
|
400
|
+
}, h = (a) => {
|
|
401
401
|
const _ = this._findPointerById(a.pointerId);
|
|
402
402
|
if (!(_ && _ === this._lockedPointer)) {
|
|
403
403
|
if (_ && this._disposePointer(_), a.pointerType === "touch")
|
|
@@ -470,7 +470,7 @@ class $ extends Yt {
|
|
|
470
470
|
{ passive: !1 }
|
|
471
471
|
), this._domElement.ownerDocument.removeEventListener(
|
|
472
472
|
"pointerup",
|
|
473
|
-
|
|
473
|
+
h
|
|
474
474
|
);
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
@@ -508,11 +508,11 @@ class $ extends Yt {
|
|
|
508
508
|
if (i.copy(U), ((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) {
|
|
509
509
|
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, T = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, P = this.dollyDragInverted ? -1 : 1;
|
|
510
510
|
(this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
|
|
511
|
-
P * y *
|
|
511
|
+
P * y * le,
|
|
512
512
|
w,
|
|
513
513
|
T
|
|
514
514
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
515
|
-
P * y *
|
|
515
|
+
P * y * le,
|
|
516
516
|
w,
|
|
517
517
|
T
|
|
518
518
|
), this._isUserControllingZoom = !0);
|
|
@@ -521,7 +521,7 @@ class $ extends Yt {
|
|
|
521
521
|
const w = U.x - this._activePointers[1].clientX, T = U.y - this._activePointers[1].clientY, P = Math.sqrt(w * w + T * T), R = r.y - P;
|
|
522
522
|
r.set(0, P);
|
|
523
523
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, ae = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
524
|
-
(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(R *
|
|
524
|
+
(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(R * le, V, ae), this._isUserControllingDolly = !0) : (this._zoomInternal(R * le, V, ae), this._isUserControllingZoom = !0);
|
|
525
525
|
}
|
|
526
526
|
((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" });
|
|
527
527
|
}, m = () => {
|
|
@@ -531,7 +531,7 @@ class $ extends Yt {
|
|
|
531
531
|
{ passive: !1 }
|
|
532
532
|
), this._domElement.ownerDocument.removeEventListener(
|
|
533
533
|
"pointerup",
|
|
534
|
-
|
|
534
|
+
h
|
|
535
535
|
), this.dispatchEvent({ type: "controlend" }));
|
|
536
536
|
};
|
|
537
537
|
this.lockPointer = () => {
|
|
@@ -548,7 +548,7 @@ class $ extends Yt {
|
|
|
548
548
|
{ passive: !1 }
|
|
549
549
|
), this._domElement.ownerDocument.removeEventListener(
|
|
550
550
|
"pointerup",
|
|
551
|
-
|
|
551
|
+
h
|
|
552
552
|
), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener(
|
|
553
553
|
"pointerlockchange",
|
|
554
554
|
u
|
|
@@ -559,7 +559,7 @@ class $ extends Yt {
|
|
|
559
559
|
"pointermove",
|
|
560
560
|
n,
|
|
561
561
|
{ passive: !1 }
|
|
562
|
-
), this._domElement.ownerDocument.addEventListener("pointerup",
|
|
562
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", h), C());
|
|
563
563
|
}, this.unlockPointer = () => {
|
|
564
564
|
var a, _, E;
|
|
565
565
|
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (a = this._domElement) === null || a === void 0 || a.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
|
|
@@ -576,11 +576,11 @@ class $ extends Yt {
|
|
|
576
576
|
this.unlockPointer();
|
|
577
577
|
};
|
|
578
578
|
this._addAllEventListeners = (a) => {
|
|
579
|
-
this._domElement = a, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel",
|
|
579
|
+
this._domElement = a, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", f, {
|
|
580
580
|
passive: !1
|
|
581
581
|
}), this._domElement.addEventListener("contextmenu", p);
|
|
582
582
|
}, this._removeAllEventListeners = () => {
|
|
583
|
-
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel",
|
|
583
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", h), this._domElement.removeEventListener("wheel", f, {
|
|
584
584
|
passive: !1
|
|
585
585
|
}), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
|
|
586
586
|
"pointermove",
|
|
@@ -588,7 +588,7 @@ class $ extends Yt {
|
|
|
588
588
|
{ passive: !1 }
|
|
589
589
|
), this._domElement.ownerDocument.removeEventListener(
|
|
590
590
|
"pointerup",
|
|
591
|
-
|
|
591
|
+
h
|
|
592
592
|
), this._domElement.ownerDocument.removeEventListener(
|
|
593
593
|
"pointerlockchange",
|
|
594
594
|
u
|
|
@@ -1022,12 +1022,12 @@ class $ extends Yt {
|
|
|
1022
1022
|
paddingBottom: o = 0,
|
|
1023
1023
|
paddingTop: n = 0
|
|
1024
1024
|
} = {}) {
|
|
1025
|
-
const
|
|
1025
|
+
const h = [], d = e.isBox3 ? K.copy(e) : K.setFromObject(e);
|
|
1026
1026
|
d.isEmpty() && (console.warn(
|
|
1027
1027
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
1028
1028
|
), Promise.resolve());
|
|
1029
1029
|
const f = ze(this._sphericalEnd.theta, Ue), p = ze(this._sphericalEnd.phi, Ue);
|
|
1030
|
-
|
|
1030
|
+
h.push(this.rotateTo(f, p, t));
|
|
1031
1031
|
const C = b.setFromSpherical(this._sphericalEnd).normalize(), v = je.setFromUnitVectors(C, Oe), m = S(Math.abs(C.y), 1);
|
|
1032
1032
|
m && v.multiply(xe.setFromAxisAngle(ce, f)), v.multiply(this._yAxisUpSpaceInverse);
|
|
1033
1033
|
const u = Ie.makeEmpty();
|
|
@@ -1040,16 +1040,16 @@ class $ extends Yt {
|
|
|
1040
1040
|
g.z,
|
|
1041
1041
|
s
|
|
1042
1042
|
);
|
|
1043
|
-
|
|
1043
|
+
h.push(
|
|
1044
1044
|
this.moveTo(a.x, a.y, a.z, t)
|
|
1045
|
-
),
|
|
1045
|
+
), h.push(this.dollyTo(_, t)), h.push(this.setFocalOffset(0, 0, 0, t));
|
|
1046
1046
|
} else if (j(this._camera)) {
|
|
1047
1047
|
const _ = this._camera, E = _.right - _.left, y = _.top - _.bottom, w = s ? Math.max(E / g.x, y / g.y) : Math.min(E / g.x, y / g.y);
|
|
1048
|
-
|
|
1048
|
+
h.push(
|
|
1049
1049
|
this.moveTo(a.x, a.y, a.z, t)
|
|
1050
|
-
),
|
|
1050
|
+
), h.push(this.zoomTo(w, t)), h.push(this.setFocalOffset(0, 0, 0, t));
|
|
1051
1051
|
}
|
|
1052
|
-
return Promise.all(
|
|
1052
|
+
return Promise.all(h);
|
|
1053
1053
|
}
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Fit the viewport to the sphere or the bounding sphere of the object.
|
|
@@ -1070,7 +1070,7 @@ class $ extends Yt {
|
|
|
1070
1070
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1071
1071
|
s.push(this.dollyTo(o, t));
|
|
1072
1072
|
} else if (j(this._camera)) {
|
|
1073
|
-
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom,
|
|
1073
|
+
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, h = 2 * r.radius, d = Math.min(o / h, n / h);
|
|
1074
1074
|
s.push(this.zoomTo(d, t));
|
|
1075
1075
|
}
|
|
1076
1076
|
return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
|
|
@@ -1088,9 +1088,9 @@ class $ extends Yt {
|
|
|
1088
1088
|
*/
|
|
1089
1089
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1090
1090
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
|
|
1091
|
-
const
|
|
1092
|
-
this._targetEnd.copy(
|
|
1093
|
-
d.sub(
|
|
1091
|
+
const h = L.set(i, r, o), d = b.set(e, t, s);
|
|
1092
|
+
this._targetEnd.copy(h), this._sphericalEnd.setFromVector3(
|
|
1093
|
+
d.sub(h).applyQuaternion(this._yAxisUpSpace)
|
|
1094
1094
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1095
1095
|
const f = !n || S(this._target.x, this._targetEnd.x, this.restThreshold) && S(this._target.y, this._targetEnd.y, this.restThreshold) && S(this._target.z, this._targetEnd.z, this.restThreshold) && S(
|
|
1096
1096
|
this._spherical.theta,
|
|
@@ -1125,13 +1125,13 @@ class $ extends Yt {
|
|
|
1125
1125
|
* @param enableTransition
|
|
1126
1126
|
* @category Methods
|
|
1127
1127
|
*/
|
|
1128
|
-
lerpLookAt(e, t, s, i, r, o, n,
|
|
1128
|
+
lerpLookAt(e, t, s, i, r, o, n, h, d, f, p, C, v, m = !1) {
|
|
1129
1129
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
|
|
1130
1130
|
const u = b.set(i, r, o), g = L.set(e, t, s);
|
|
1131
1131
|
k.setFromVector3(
|
|
1132
1132
|
g.sub(u).applyQuaternion(this._yAxisUpSpace)
|
|
1133
1133
|
);
|
|
1134
|
-
const a = G.set(f, p, C), _ = L.set(n,
|
|
1134
|
+
const a = G.set(f, p, C), _ = L.set(n, h, d);
|
|
1135
1135
|
re.setFromVector3(
|
|
1136
1136
|
_.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1137
1137
|
), this._targetEnd.copy(u.lerp(a, v));
|
|
@@ -1417,7 +1417,7 @@ class $ extends Yt {
|
|
|
1417
1417
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1418
1418
|
else {
|
|
1419
1419
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1420
|
-
this._spherical.theta =
|
|
1420
|
+
this._spherical.theta = he(
|
|
1421
1421
|
this._spherical.theta,
|
|
1422
1422
|
this._sphericalEnd.theta,
|
|
1423
1423
|
this._thetaVelocity,
|
|
@@ -1430,7 +1430,7 @@ class $ extends Yt {
|
|
|
1430
1430
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1431
1431
|
else {
|
|
1432
1432
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1433
|
-
this._spherical.phi =
|
|
1433
|
+
this._spherical.phi = he(
|
|
1434
1434
|
this._spherical.phi,
|
|
1435
1435
|
this._sphericalEnd.phi,
|
|
1436
1436
|
this._phiVelocity,
|
|
@@ -1443,7 +1443,7 @@ class $ extends Yt {
|
|
|
1443
1443
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1444
1444
|
else {
|
|
1445
1445
|
const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
1446
|
-
this._spherical.radius =
|
|
1446
|
+
this._spherical.radius = he(
|
|
1447
1447
|
this._spherical.radius,
|
|
1448
1448
|
this._sphericalEnd.radius,
|
|
1449
1449
|
this._radiusVelocity,
|
|
@@ -1484,7 +1484,7 @@ class $ extends Yt {
|
|
|
1484
1484
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1485
1485
|
else {
|
|
1486
1486
|
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
1487
|
-
this._zoom =
|
|
1487
|
+
this._zoom = he(
|
|
1488
1488
|
this._zoom,
|
|
1489
1489
|
this._zoomEnd,
|
|
1490
1490
|
this._zoomVelocity,
|
|
@@ -1526,8 +1526,8 @@ class $ extends Yt {
|
|
|
1526
1526
|
}
|
|
1527
1527
|
}
|
|
1528
1528
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1529
|
-
const
|
|
1530
|
-
this._spherical.radius = Math.min(this._spherical.radius,
|
|
1529
|
+
const h = this._collisionTest();
|
|
1530
|
+
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), (!M(this._focalOffset.x) || !M(this._focalOffset.y) || !M(this._focalOffset.z)) && (N.setFromMatrixColumn(this._camera.matrix, 0), H.setFromMatrixColumn(this._camera.matrix, 1), Y.setFromMatrixColumn(this._camera.matrix, 2), N.multiplyScalar(this._focalOffset.x), H.multiplyScalar(-this._focalOffset.y), Y.multiplyScalar(this._focalOffset.z), b.copy(N).add(H).add(Y), this._camera.position.add(b), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1531
1531
|
this._camera.position.copy(this._target),
|
|
1532
1532
|
b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1533
1533
|
1
|
|
@@ -1631,15 +1631,15 @@ class $ extends Yt {
|
|
|
1631
1631
|
const i = t.lengthSq();
|
|
1632
1632
|
if (i === 0)
|
|
1633
1633
|
return e;
|
|
1634
|
-
const r = L.copy(t).add(e), n = this._boundary.clampPoint(r, G).sub(r),
|
|
1635
|
-
if (
|
|
1634
|
+
const r = L.copy(t).add(e), n = this._boundary.clampPoint(r, G).sub(r), h = n.lengthSq();
|
|
1635
|
+
if (h === 0)
|
|
1636
1636
|
return e.add(t);
|
|
1637
|
-
if (
|
|
1637
|
+
if (h === i)
|
|
1638
1638
|
return e;
|
|
1639
1639
|
if (s === 0)
|
|
1640
1640
|
return e.add(t).add(n);
|
|
1641
1641
|
{
|
|
1642
|
-
const d = 1 + s *
|
|
1642
|
+
const d = 1 + s * h / t.dot(n);
|
|
1643
1643
|
return e.add(L.copy(t).multiplyScalar(d)).add(n.multiplyScalar(1 - s));
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
@@ -1740,9 +1740,9 @@ class $ extends Yt {
|
|
|
1740
1740
|
if (!o.isMesh) return;
|
|
1741
1741
|
const n = o;
|
|
1742
1742
|
if (!n.geometry) return;
|
|
1743
|
-
const
|
|
1744
|
-
|
|
1745
|
-
const f =
|
|
1743
|
+
const h = n.geometry.clone();
|
|
1744
|
+
h.applyMatrix4(n.matrixWorld);
|
|
1745
|
+
const f = h.attributes.position;
|
|
1746
1746
|
for (let p = 0, C = f.count; p < C; p++)
|
|
1747
1747
|
b.fromBufferAttribute(f, p), r = Math.max(r, i.distanceToSquared(b));
|
|
1748
1748
|
}), s.radius = Math.sqrt(r), s;
|
|
@@ -1756,8 +1756,8 @@ q && typeof q.ownKeys == "function" ? me = q.ownKeys : Object.getOwnPropertySymb
|
|
|
1756
1756
|
} : me = function(e) {
|
|
1757
1757
|
return Object.getOwnPropertyNames(e);
|
|
1758
1758
|
};
|
|
1759
|
-
function Wt(
|
|
1760
|
-
console && console.warn && console.warn(
|
|
1759
|
+
function Wt(l) {
|
|
1760
|
+
console && console.warn && console.warn(l);
|
|
1761
1761
|
}
|
|
1762
1762
|
var st = Number.isNaN || function(e) {
|
|
1763
1763
|
return e !== e;
|
|
@@ -1772,19 +1772,19 @@ A.prototype._events = void 0;
|
|
|
1772
1772
|
A.prototype._eventsCount = 0;
|
|
1773
1773
|
A.prototype._maxListeners = void 0;
|
|
1774
1774
|
var Be = 10;
|
|
1775
|
-
function _e(
|
|
1776
|
-
if (typeof
|
|
1777
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof
|
|
1775
|
+
function _e(l) {
|
|
1776
|
+
if (typeof l != "function")
|
|
1777
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof l);
|
|
1778
1778
|
}
|
|
1779
1779
|
Object.defineProperty(A, "defaultMaxListeners", {
|
|
1780
1780
|
enumerable: !0,
|
|
1781
1781
|
get: function() {
|
|
1782
1782
|
return Be;
|
|
1783
1783
|
},
|
|
1784
|
-
set: function(
|
|
1785
|
-
if (typeof
|
|
1786
|
-
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' +
|
|
1787
|
-
Be =
|
|
1784
|
+
set: function(l) {
|
|
1785
|
+
if (typeof l != "number" || l < 0 || st(l))
|
|
1786
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + l + ".");
|
|
1787
|
+
Be = l;
|
|
1788
1788
|
}
|
|
1789
1789
|
});
|
|
1790
1790
|
A.init = function() {
|
|
@@ -1795,8 +1795,8 @@ A.prototype.setMaxListeners = function(e) {
|
|
|
1795
1795
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1796
1796
|
return this._maxListeners = e, this;
|
|
1797
1797
|
};
|
|
1798
|
-
function it(
|
|
1799
|
-
return
|
|
1798
|
+
function it(l) {
|
|
1799
|
+
return l._maxListeners === void 0 ? A.defaultMaxListeners : l._maxListeners;
|
|
1800
1800
|
}
|
|
1801
1801
|
A.prototype.getMaxListeners = function() {
|
|
1802
1802
|
return it(this);
|
|
@@ -1815,30 +1815,30 @@ A.prototype.emit = function(e) {
|
|
|
1815
1815
|
var n = new Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
|
|
1816
1816
|
throw n.context = o, n;
|
|
1817
1817
|
}
|
|
1818
|
-
var
|
|
1819
|
-
if (
|
|
1818
|
+
var h = r[e];
|
|
1819
|
+
if (h === void 0)
|
|
1820
1820
|
return !1;
|
|
1821
|
-
if (typeof
|
|
1822
|
-
Ve(
|
|
1821
|
+
if (typeof h == "function")
|
|
1822
|
+
Ve(h, this, t);
|
|
1823
1823
|
else
|
|
1824
|
-
for (var d =
|
|
1824
|
+
for (var d = h.length, f = ht(h, d), s = 0; s < d; ++s)
|
|
1825
1825
|
Ve(f[s], this, t);
|
|
1826
1826
|
return !0;
|
|
1827
1827
|
};
|
|
1828
|
-
function rt(
|
|
1828
|
+
function rt(l, e, t, s) {
|
|
1829
1829
|
var i, r, o;
|
|
1830
|
-
if (_e(t), r =
|
|
1830
|
+
if (_e(t), r = l._events, r === void 0 ? (r = l._events = /* @__PURE__ */ Object.create(null), l._eventsCount = 0) : (r.newListener !== void 0 && (l.emit(
|
|
1831
1831
|
"newListener",
|
|
1832
1832
|
e,
|
|
1833
1833
|
t.listener ? t.listener : t
|
|
1834
|
-
), r =
|
|
1835
|
-
o = r[e] = t, ++
|
|
1836
|
-
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = it(
|
|
1834
|
+
), r = l._events), o = r[e]), o === void 0)
|
|
1835
|
+
o = r[e] = t, ++l._eventsCount;
|
|
1836
|
+
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = it(l), i > 0 && o.length > i && !o.warned) {
|
|
1837
1837
|
o.warned = !0;
|
|
1838
1838
|
var n = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1839
|
-
n.name = "MaxListenersExceededWarning", n.emitter =
|
|
1839
|
+
n.name = "MaxListenersExceededWarning", n.emitter = l, n.type = e, n.count = o.length, Wt(n);
|
|
1840
1840
|
}
|
|
1841
|
-
return
|
|
1841
|
+
return l;
|
|
1842
1842
|
}
|
|
1843
1843
|
A.prototype.addListener = function(e, t) {
|
|
1844
1844
|
return rt(this, e, t, !1);
|
|
@@ -1851,8 +1851,8 @@ function Gt() {
|
|
|
1851
1851
|
if (!this.fired)
|
|
1852
1852
|
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);
|
|
1853
1853
|
}
|
|
1854
|
-
function ot(
|
|
1855
|
-
var s = { fired: !1, wrapFn: void 0, target:
|
|
1854
|
+
function ot(l, e, t) {
|
|
1855
|
+
var s = { fired: !1, wrapFn: void 0, target: l, type: e, listener: t }, i = Gt.bind(s);
|
|
1856
1856
|
return i.listener = t, s.wrapFn = i, i;
|
|
1857
1857
|
}
|
|
1858
1858
|
A.prototype.once = function(e, t) {
|
|
@@ -1901,12 +1901,12 @@ A.prototype.removeAllListeners = function(e) {
|
|
|
1901
1901
|
this.removeListener(e, t[i]);
|
|
1902
1902
|
return this;
|
|
1903
1903
|
};
|
|
1904
|
-
function nt(
|
|
1905
|
-
var s =
|
|
1904
|
+
function nt(l, e, t) {
|
|
1905
|
+
var s = l._events;
|
|
1906
1906
|
if (s === void 0)
|
|
1907
1907
|
return [];
|
|
1908
1908
|
var i = s[e];
|
|
1909
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Xt(i) :
|
|
1909
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? Xt(i) : ht(i, i.length);
|
|
1910
1910
|
}
|
|
1911
1911
|
A.prototype.listeners = function(e) {
|
|
1912
1912
|
return nt(this, e, !0);
|
|
@@ -1914,14 +1914,14 @@ A.prototype.listeners = function(e) {
|
|
|
1914
1914
|
A.prototype.rawListeners = function(e) {
|
|
1915
1915
|
return nt(this, e, !1);
|
|
1916
1916
|
};
|
|
1917
|
-
A.listenerCount = function(
|
|
1918
|
-
return typeof
|
|
1917
|
+
A.listenerCount = function(l, e) {
|
|
1918
|
+
return typeof l.listenerCount == "function" ? l.listenerCount(e) : at.call(l, e);
|
|
1919
1919
|
};
|
|
1920
1920
|
A.prototype.listenerCount = at;
|
|
1921
|
-
function at(
|
|
1921
|
+
function at(l) {
|
|
1922
1922
|
var e = this._events;
|
|
1923
1923
|
if (e !== void 0) {
|
|
1924
|
-
var t = e[
|
|
1924
|
+
var t = e[l];
|
|
1925
1925
|
if (typeof t == "function")
|
|
1926
1926
|
return 1;
|
|
1927
1927
|
if (t !== void 0)
|
|
@@ -1932,44 +1932,44 @@ function at(h) {
|
|
|
1932
1932
|
A.prototype.eventNames = function() {
|
|
1933
1933
|
return this._eventsCount > 0 ? me(this._events) : [];
|
|
1934
1934
|
};
|
|
1935
|
-
function
|
|
1935
|
+
function ht(l, e) {
|
|
1936
1936
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1937
|
-
t[s] =
|
|
1937
|
+
t[s] = l[s];
|
|
1938
1938
|
return t;
|
|
1939
1939
|
}
|
|
1940
|
-
function Kt(
|
|
1941
|
-
for (; e + 1 <
|
|
1942
|
-
|
|
1943
|
-
|
|
1940
|
+
function Kt(l, e) {
|
|
1941
|
+
for (; e + 1 < l.length; e++)
|
|
1942
|
+
l[e] = l[e + 1];
|
|
1943
|
+
l.pop();
|
|
1944
1944
|
}
|
|
1945
|
-
function Xt(
|
|
1946
|
-
for (var e = new Array(
|
|
1947
|
-
e[t] =
|
|
1945
|
+
function Xt(l) {
|
|
1946
|
+
for (var e = new Array(l.length), t = 0; t < e.length; ++t)
|
|
1947
|
+
e[t] = l[t].listener || l[t];
|
|
1948
1948
|
return e;
|
|
1949
1949
|
}
|
|
1950
|
-
function qt(
|
|
1950
|
+
function qt(l, e) {
|
|
1951
1951
|
return new Promise(function(t, s) {
|
|
1952
1952
|
function i(o) {
|
|
1953
|
-
|
|
1953
|
+
l.removeListener(e, r), s(o);
|
|
1954
1954
|
}
|
|
1955
1955
|
function r() {
|
|
1956
|
-
typeof
|
|
1956
|
+
typeof l.removeListener == "function" && l.removeListener("error", i), t([].slice.call(arguments));
|
|
1957
1957
|
}
|
|
1958
|
-
|
|
1958
|
+
lt(l, e, r, { once: !0 }), e !== "error" && $t(l, i, { once: !0 });
|
|
1959
1959
|
});
|
|
1960
1960
|
}
|
|
1961
|
-
function $t(
|
|
1962
|
-
typeof
|
|
1961
|
+
function $t(l, e, t) {
|
|
1962
|
+
typeof l.on == "function" && lt(l, "error", e, t);
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1965
|
-
if (typeof
|
|
1966
|
-
s.once ?
|
|
1967
|
-
else if (typeof
|
|
1968
|
-
|
|
1969
|
-
s.once &&
|
|
1964
|
+
function lt(l, e, t, s) {
|
|
1965
|
+
if (typeof l.on == "function")
|
|
1966
|
+
s.once ? l.once(e, t) : l.on(e, t);
|
|
1967
|
+
else if (typeof l.addEventListener == "function")
|
|
1968
|
+
l.addEventListener(e, function i(r) {
|
|
1969
|
+
s.once && l.removeEventListener(e, i), t(r);
|
|
1970
1970
|
});
|
|
1971
1971
|
else
|
|
1972
|
-
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof
|
|
1972
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof l);
|
|
1973
1973
|
}
|
|
1974
1974
|
var ge = Pe.exports;
|
|
1975
1975
|
const Qt = {
|
|
@@ -1991,7 +1991,7 @@ class Jt {
|
|
|
1991
1991
|
alpha: r,
|
|
1992
1992
|
devicePixelRatio: o,
|
|
1993
1993
|
antialias: n,
|
|
1994
|
-
powerPreference:
|
|
1994
|
+
powerPreference: h,
|
|
1995
1995
|
toneMappingExposure: d,
|
|
1996
1996
|
outputColorSpace: f,
|
|
1997
1997
|
logarithmicDepthBuffer: p,
|
|
@@ -2001,7 +2001,7 @@ class Jt {
|
|
|
2001
2001
|
} = i, u = new O.WebGLRenderer({
|
|
2002
2002
|
alpha: r,
|
|
2003
2003
|
antialias: n,
|
|
2004
|
-
powerPreference:
|
|
2004
|
+
powerPreference: h,
|
|
2005
2005
|
logarithmicDepthBuffer: p,
|
|
2006
2006
|
preserveDrawingBuffer: C,
|
|
2007
2007
|
stencil: v,
|
|
@@ -2019,8 +2019,8 @@ class Jt {
|
|
|
2019
2019
|
this.renderer.render(e, t);
|
|
2020
2020
|
}
|
|
2021
2021
|
setViewport(e) {
|
|
2022
|
-
var
|
|
2023
|
-
const { x: t, y: s, width: i, height: r } = e, o = (
|
|
2022
|
+
var h, d;
|
|
2023
|
+
const { x: t, y: s, width: i, height: r } = e, o = (h = e.scissor) != null ? h : !1, n = (d = e.scissorTest) != null ? d : !1;
|
|
2024
2024
|
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(n));
|
|
2025
2025
|
}
|
|
2026
2026
|
setViewPadding(e = 0, t = 0, s = 0, i = 0) {
|
|
@@ -2044,10 +2044,10 @@ const es = {
|
|
|
2044
2044
|
class ts {
|
|
2045
2045
|
constructor(e) {
|
|
2046
2046
|
this.options = e;
|
|
2047
|
-
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i,
|
|
2047
|
+
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, h = new r({
|
|
2048
2048
|
antialias: n
|
|
2049
2049
|
});
|
|
2050
|
-
|
|
2050
|
+
h.setSize(t, s), h.setPixelRatio(o), this.renderer = h;
|
|
2051
2051
|
}
|
|
2052
2052
|
setSize(e, t) {
|
|
2053
2053
|
this.renderer.setSize(e, t);
|
|
@@ -2133,7 +2133,7 @@ class is extends ne {
|
|
|
2133
2133
|
return this.controller;
|
|
2134
2134
|
}
|
|
2135
2135
|
addPerspectiveCamera(e = ct, t) {
|
|
2136
|
-
const { fov: s, far: i, near: r, up: o, aspect: n } = e,
|
|
2136
|
+
const { fov: s, far: i, near: r, up: o, aspect: n } = e, h = n != null ? n : this.width / this.height, d = new O.PerspectiveCamera(s, h, r, i);
|
|
2137
2137
|
return d.up = o, this.addController(d, t);
|
|
2138
2138
|
}
|
|
2139
2139
|
setSize(e, t) {
|
|
@@ -2193,7 +2193,7 @@ class is extends ne {
|
|
|
2193
2193
|
s[7],
|
|
2194
2194
|
s[11],
|
|
2195
2195
|
s[15]
|
|
2196
|
-
), { width: n, height:
|
|
2196
|
+
), { width: n, height: h } = this, d = n / h;
|
|
2197
2197
|
(this.camera.fov !== t.fov || this.camera.aspect !== d || !this.camera.matrixWorld.equals(r) || !this.camera.matrixWorldInverse.equals(o)) && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix(), this.camera.matrixAutoUpdate = !1, this.camera.matrixWorld.copy(r), this.camera.matrixWorldInverse.copy(o), this.camera.aspect = d, this.camera.updateProjectionMatrix());
|
|
2198
2198
|
}
|
|
2199
2199
|
}
|
|
@@ -2291,7 +2291,7 @@ class ns {
|
|
|
2291
2291
|
const { cameraController: i } = this.options;
|
|
2292
2292
|
Object.values(this.helpers).forEach((n) => {
|
|
2293
2293
|
if (n.update && n.update(), n instanceof O.Box3Helper) {
|
|
2294
|
-
const
|
|
2294
|
+
const h = n.material, { object: d } = h.userData;
|
|
2295
2295
|
d && n.box.setFromObject(d, !0);
|
|
2296
2296
|
}
|
|
2297
2297
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
@@ -2344,7 +2344,7 @@ class as extends ne {
|
|
|
2344
2344
|
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * O.MathUtils.DEG2RAD);
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
2347
|
-
class
|
|
2347
|
+
class hs {
|
|
2348
2348
|
constructor(e) {
|
|
2349
2349
|
this.event = new ge.EventEmitter();
|
|
2350
2350
|
const { renderer: t, scene: s, camera: i } = e, r = new Rt(
|
|
@@ -2356,8 +2356,8 @@ class ls {
|
|
|
2356
2356
|
if (s.add(o), +O.REVISION < 170) {
|
|
2357
2357
|
const n = r._root;
|
|
2358
2358
|
n.dispose = () => {
|
|
2359
|
-
n.traverse((
|
|
2360
|
-
|
|
2359
|
+
n.traverse((h) => {
|
|
2360
|
+
h.geometry && h.geometry.dispose(), h.material && h.material.dispose();
|
|
2361
2361
|
});
|
|
2362
2362
|
}, r.dispose = () => {
|
|
2363
2363
|
r.disconnect(), n.dispose();
|
|
@@ -2413,7 +2413,7 @@ class ls {
|
|
|
2413
2413
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
2414
2414
|
}
|
|
2415
2415
|
}
|
|
2416
|
-
const Ye = new oe(),
|
|
2416
|
+
const Ye = new oe(), ls = new Ct(), Ze = new oe(), I = new fe(), cs = new fe();
|
|
2417
2417
|
class ds {
|
|
2418
2418
|
constructor(e = {}) {
|
|
2419
2419
|
const t = this;
|
|
@@ -2421,10 +2421,10 @@ class ds {
|
|
|
2421
2421
|
const n = {
|
|
2422
2422
|
camera: { style: "" },
|
|
2423
2423
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2424
|
-
},
|
|
2425
|
-
|
|
2424
|
+
}, h = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2425
|
+
h.style.overflow = "hidden", this.domElement = h;
|
|
2426
2426
|
const d = document.createElement("div");
|
|
2427
|
-
d.style.transformOrigin = "0 0", d.style.pointerEvents = "none",
|
|
2427
|
+
d.style.transformOrigin = "0 0", d.style.pointerEvents = "none", h.appendChild(d);
|
|
2428
2428
|
const f = document.createElement("div");
|
|
2429
2429
|
f.style.transformStyle = "preserve-3d", d.appendChild(f), this.getSize = function() {
|
|
2430
2430
|
return {
|
|
@@ -2439,7 +2439,7 @@ class ds {
|
|
|
2439
2439
|
const w = a.view && a.view.enabled ? a.view.height / a.view.fullHeight : 1, T = a.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + p(E) + "px," + p(y) + "px)" + C(a.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + C(a.matrixWorldInverse), R = (a.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + T + "translate(" + r + "px," + o + "px)";
|
|
2440
2440
|
n.camera.style !== R && (f.style.transform = R, n.camera.style = R), u(g, g, a);
|
|
2441
2441
|
}, this.setSize = function(g, a) {
|
|
2442
|
-
s = g, i = a, r = s / 2, o = i / 2,
|
|
2442
|
+
s = g, i = a, r = s / 2, o = i / 2, h.style.width = g + "px", h.style.height = a + "px", d.style.width = g + "px", d.style.height = a + "px", f.style.width = g + "px", f.style.height = a + "px";
|
|
2443
2443
|
};
|
|
2444
2444
|
function p(g) {
|
|
2445
2445
|
return Math.abs(g) < 1e-10 ? 0 : g;
|
|
@@ -2467,7 +2467,7 @@ class ds {
|
|
|
2467
2467
|
if (w.style.display = y === !0 ? "" : "none", y === !0) {
|
|
2468
2468
|
g.onBeforeRender(t, a, _);
|
|
2469
2469
|
let T;
|
|
2470
|
-
g.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), g.rotation2D !== 0 && I.multiply(cs.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Ye,
|
|
2470
|
+
g.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), g.rotation2D !== 0 && I.multiply(cs.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Ye, ls, Ze), I.setPosition(Ye), I.scale(Ze), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, T = v(I)) : T = v(g.matrixWorld);
|
|
2471
2471
|
const P = n.objects.get(g);
|
|
2472
2472
|
if (P === void 0 || P.style !== T) {
|
|
2473
2473
|
w.style.transform = T;
|
|
@@ -2489,8 +2489,8 @@ class ps {
|
|
|
2489
2489
|
let s, i, r, o;
|
|
2490
2490
|
const n = {
|
|
2491
2491
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2492
|
-
},
|
|
2493
|
-
|
|
2492
|
+
}, h = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2493
|
+
h.style.overflow = "hidden", this.domElement = h, this.getSize = function() {
|
|
2494
2494
|
return {
|
|
2495
2495
|
width: s,
|
|
2496
2496
|
height: i
|
|
@@ -2498,7 +2498,7 @@ class ps {
|
|
|
2498
2498
|
}, this.render = function(m, u) {
|
|
2499
2499
|
m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), u.parent === null && u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), We.copy(u.matrixWorldInverse), Ge.multiplyMatrices(u.projectionMatrix, We), f(m, m, u), v(m);
|
|
2500
2500
|
}, this.setSize = function(m, u) {
|
|
2501
|
-
s = m, i = u, r = s / 2, o = i / 2,
|
|
2501
|
+
s = m, i = u, r = s / 2, o = i / 2, h.style.width = m + "px", h.style.height = u + "px";
|
|
2502
2502
|
};
|
|
2503
2503
|
function d(m) {
|
|
2504
2504
|
m.isCSS2DObject && (m.element.style.display = "none");
|
|
@@ -2513,7 +2513,7 @@ class ps {
|
|
|
2513
2513
|
if (m.isCSS2DObject) {
|
|
2514
2514
|
X.setFromMatrixPosition(m.matrixWorld), X.applyMatrix4(Ge);
|
|
2515
2515
|
const a = X.z >= -1 && X.z <= 1 && m.layers.test(g.layers) === !0, _ = m.element;
|
|
2516
|
-
_.style.display = a === !0 ? "" : "none", a === !0 && (m.onBeforeRender(t, u, g), _.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (X.x * r + r) + "px," + (-X.y * o + o) + "px)", _.parentNode !==
|
|
2516
|
+
_.style.display = a === !0 ? "" : "none", a === !0 && (m.onBeforeRender(t, u, g), _.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (X.x * r + r) + "px," + (-X.y * o + o) + "px)", _.parentNode !== h && h.appendChild(_), m.onAfterRender(t, u, g));
|
|
2517
2517
|
const E = {
|
|
2518
2518
|
distanceToCameraSquared: p(g, m)
|
|
2519
2519
|
};
|
|
@@ -2669,12 +2669,12 @@ class fs extends Ft {
|
|
|
2669
2669
|
}), this.fsQuad = new kt(this.material);
|
|
2670
2670
|
}
|
|
2671
2671
|
}
|
|
2672
|
-
const _s = (
|
|
2672
|
+
const _s = (l) => {
|
|
2673
2673
|
const e = new Nt(
|
|
2674
2674
|
new O.ShaderMaterial({
|
|
2675
2675
|
uniforms: {
|
|
2676
2676
|
baseTexture: { value: null },
|
|
2677
|
-
bloomTexture: { value:
|
|
2677
|
+
bloomTexture: { value: l.renderTarget2.texture },
|
|
2678
2678
|
bloomAlphaType: { value: 0 }
|
|
2679
2679
|
},
|
|
2680
2680
|
vertexShader: `
|
|
@@ -2744,13 +2744,13 @@ class bs {
|
|
|
2744
2744
|
composerParams: r
|
|
2745
2745
|
} = e, { renderer: o } = t;
|
|
2746
2746
|
this.renderer = o;
|
|
2747
|
-
const { multisampling: n } = r, { maxSamples:
|
|
2747
|
+
const { multisampling: n } = r, { maxSamples: h } = o.capabilities, d = o.getDrawingBufferSize(
|
|
2748
2748
|
new O.Vector2()
|
|
2749
2749
|
), f = new O.WebGLRenderTarget(
|
|
2750
2750
|
d.width,
|
|
2751
2751
|
d.height,
|
|
2752
2752
|
{
|
|
2753
|
-
samples: Math.min(n,
|
|
2753
|
+
samples: Math.min(n, h),
|
|
2754
2754
|
type: O.HalfFloatType
|
|
2755
2755
|
}
|
|
2756
2756
|
), p = new Me(o, f), C = this.getSize();
|
|
@@ -2779,8 +2779,8 @@ class bs {
|
|
|
2779
2779
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2780
2780
|
}
|
|
2781
2781
|
addSSAOPass(e) {
|
|
2782
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new O.Vector2()), o = r.width, n = r.height,
|
|
2783
|
-
|
|
2782
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new O.Vector2()), o = r.width, n = r.height, h = new zt(t, s, o, n);
|
|
2783
|
+
h.kernelRadius = e.kernelRadius, h.minDistance = e.minDistance, h.maxDistance = e.maxDistance, this.ssaoPass = h, this.finalComposer.addPass(h);
|
|
2784
2784
|
}
|
|
2785
2785
|
addBloomPass(e) {
|
|
2786
2786
|
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, n = new Ht(
|
|
@@ -2790,10 +2790,10 @@ class bs {
|
|
|
2790
2790
|
s
|
|
2791
2791
|
);
|
|
2792
2792
|
this.bloomPass = n;
|
|
2793
|
-
const
|
|
2794
|
-
|
|
2795
|
-
const d = _s(
|
|
2796
|
-
d.uniforms.bloomAlphaType.value = o, this.bloomComposer =
|
|
2793
|
+
const h = new Me(t);
|
|
2794
|
+
h.renderToScreen = !1, h.addPass(this.renderPass), h.addPass(n), this.bloomComposer = h;
|
|
2795
|
+
const d = _s(h);
|
|
2796
|
+
d.uniforms.bloomAlphaType.value = o, this.bloomComposer = h, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(be);
|
|
2797
2797
|
}
|
|
2798
2798
|
toggleBloomSelection(e, t) {
|
|
2799
2799
|
if (!this.bloomComposer) {
|
|
@@ -2830,9 +2830,9 @@ class bs {
|
|
|
2830
2830
|
s.isTransformControls || s.isTransformControlsRoot || s.type === "RectAreaLightHelper" ? e.push(s) : t.push(s);
|
|
2831
2831
|
}), t.forEach((s) => {
|
|
2832
2832
|
s.traverse((i) => {
|
|
2833
|
-
var
|
|
2833
|
+
var h;
|
|
2834
2834
|
const r = i, o = i, n = i;
|
|
2835
|
-
(
|
|
2835
|
+
(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 = Cs : o.material = Es : r.material instanceof et ? r.material = Os : n.isPoints ? n.material.sizeAttenuation ? n.material = ys : n.material = vs : r.material = gs);
|
|
2836
2836
|
});
|
|
2837
2837
|
}), e.forEach((s) => {
|
|
2838
2838
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2888,10 +2888,10 @@ class $e extends O.Loader {
|
|
|
2888
2888
|
const n = new O.FileLoader(this.manager);
|
|
2889
2889
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
2890
2890
|
e,
|
|
2891
|
-
(
|
|
2892
|
-
let d =
|
|
2891
|
+
(h) => {
|
|
2892
|
+
let d = h;
|
|
2893
2893
|
const f = e.split(".").pop(), p = this.options.type === "image" ? `image/${f || "png"}` : `video/${f || "mp4"}`;
|
|
2894
|
-
d = d.slice(0,
|
|
2894
|
+
d = d.slice(0, h.size, p);
|
|
2895
2895
|
const C = () => {
|
|
2896
2896
|
o.removeEventListener("load", v, !1), o.removeEventListener("error", m, !1);
|
|
2897
2897
|
}, v = () => {
|
|
@@ -2917,7 +2917,7 @@ class Ps extends O.Loader {
|
|
|
2917
2917
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
2918
2918
|
e,
|
|
2919
2919
|
(o) => {
|
|
2920
|
-
const n = o,
|
|
2920
|
+
const n = o, h = new DecompressionStream("gzip"), d = n.stream().pipeThrough(h);
|
|
2921
2921
|
new Response(d).json().then((p) => {
|
|
2922
2922
|
t == null || t(p);
|
|
2923
2923
|
}).catch((p) => {
|
|
@@ -3033,7 +3033,7 @@ class Ss {
|
|
|
3033
3033
|
}
|
|
3034
3034
|
load(e, t) {
|
|
3035
3035
|
return J(this, null, function* () {
|
|
3036
|
-
var n,
|
|
3036
|
+
var n, h;
|
|
3037
3037
|
const s = (n = t == null ? void 0 : t.type) != null ? n : this.getAssetType(e);
|
|
3038
3038
|
if (!s)
|
|
3039
3039
|
return;
|
|
@@ -3048,7 +3048,7 @@ class Ss {
|
|
|
3048
3048
|
const d = yield o.loadAsync(e);
|
|
3049
3049
|
if (this.assets.set(e, d), r.resolve(d), s === "images" || s === "media" || s === "exr" || s === "lottie") {
|
|
3050
3050
|
(t == null ? void 0 : t.colorCorrection) !== !1 && Pt({ texture: d });
|
|
3051
|
-
const f = (
|
|
3051
|
+
const f = (h = t == null ? void 0 : t.anisotropy) != null ? h : this.options.anisotropy;
|
|
3052
3052
|
d.anisotropy = f;
|
|
3053
3053
|
}
|
|
3054
3054
|
return d;
|
|
@@ -3065,14 +3065,14 @@ class Ss {
|
|
|
3065
3065
|
const t = /* @__PURE__ */ new Set(), s = this.textureAssets;
|
|
3066
3066
|
e.traverse((r) => {
|
|
3067
3067
|
const o = r;
|
|
3068
|
-
o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((
|
|
3068
|
+
o.material && (Array.isArray(o.material) ? o.material : [o.material]).forEach((h) => {
|
|
3069
3069
|
[
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3070
|
+
h.map,
|
|
3071
|
+
h.emissiveMap,
|
|
3072
|
+
h.normalMap,
|
|
3073
|
+
h.roughnessMap,
|
|
3074
|
+
h.metalnessMap,
|
|
3075
|
+
h.aoMap
|
|
3076
3076
|
].forEach((d) => {
|
|
3077
3077
|
if (d) {
|
|
3078
3078
|
const f = this.getSrcByAsset(d, s);
|
|
@@ -3122,11 +3122,11 @@ class Ds extends At {
|
|
|
3122
3122
|
this.object3d = (e = this.options.scene) != null ? e : new O.Scene();
|
|
3123
3123
|
}
|
|
3124
3124
|
}
|
|
3125
|
-
function Qe(
|
|
3125
|
+
function Qe(l) {
|
|
3126
3126
|
let e = !1, t = [];
|
|
3127
3127
|
return function(...s) {
|
|
3128
3128
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
3129
|
-
e = !1,
|
|
3129
|
+
e = !1, l(...t);
|
|
3130
3130
|
}));
|
|
3131
3131
|
};
|
|
3132
3132
|
}
|
|
@@ -3151,12 +3151,12 @@ class Rs {
|
|
|
3151
3151
|
}));
|
|
3152
3152
|
}), n.length === 0) return;
|
|
3153
3153
|
this.activeObjects.clear(), this.objCallbackMap.clear();
|
|
3154
|
-
const
|
|
3154
|
+
const h = this.objCallbackMap, d = [];
|
|
3155
3155
|
for (const m of n)
|
|
3156
3156
|
for (const u of m.objArr) {
|
|
3157
3157
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
3158
|
-
|
|
3159
|
-
const g =
|
|
3158
|
+
h.has(u) || (h.set(u, /* @__PURE__ */ new Map()), d.push(u));
|
|
3159
|
+
const g = h.get(u);
|
|
3160
3160
|
g.has(m.type) || g.set(m.type, []), g.get(m.type).push(m.cb);
|
|
3161
3161
|
}
|
|
3162
3162
|
if (d.length === 0) return;
|
|
@@ -3203,10 +3203,10 @@ class Rs {
|
|
|
3203
3203
|
};
|
|
3204
3204
|
for (const n of this.activeObjects) {
|
|
3205
3205
|
if (r) break;
|
|
3206
|
-
const
|
|
3207
|
-
if (
|
|
3206
|
+
const h = i.get(n);
|
|
3207
|
+
if (h)
|
|
3208
3208
|
if (t === "move") {
|
|
3209
|
-
const d =
|
|
3209
|
+
const d = h.get("enter");
|
|
3210
3210
|
if (d && !this.prevActiveObjects.has(n))
|
|
3211
3211
|
for (const p of d)
|
|
3212
3212
|
p({
|
|
@@ -3215,7 +3215,7 @@ class Rs {
|
|
|
3215
3215
|
sp: o,
|
|
3216
3216
|
intersectionIndex: s
|
|
3217
3217
|
});
|
|
3218
|
-
const f =
|
|
3218
|
+
const f = h.get("move");
|
|
3219
3219
|
if (f)
|
|
3220
3220
|
for (const p of f)
|
|
3221
3221
|
p({
|
|
@@ -3225,7 +3225,7 @@ class Rs {
|
|
|
3225
3225
|
intersectionIndex: s
|
|
3226
3226
|
});
|
|
3227
3227
|
} else {
|
|
3228
|
-
const d =
|
|
3228
|
+
const d = h.get("down");
|
|
3229
3229
|
if (d)
|
|
3230
3230
|
for (const p of d)
|
|
3231
3231
|
p({
|
|
@@ -3234,7 +3234,7 @@ class Rs {
|
|
|
3234
3234
|
sp: o,
|
|
3235
3235
|
intersectionIndex: s
|
|
3236
3236
|
});
|
|
3237
|
-
const f =
|
|
3237
|
+
const f = h.get("click");
|
|
3238
3238
|
if (f) {
|
|
3239
3239
|
const p = (C) => {
|
|
3240
3240
|
C.preventDefault();
|
|
@@ -3295,15 +3295,15 @@ class Rs {
|
|
|
3295
3295
|
this.pickNodeFunctionsMapIndex += 1;
|
|
3296
3296
|
const i = this.pickNodeFunctionsMapIndex, r = e instanceof Function ? e() : e, o = [];
|
|
3297
3297
|
for (const n of r) {
|
|
3298
|
-
const
|
|
3299
|
-
|
|
3298
|
+
const h = n;
|
|
3299
|
+
h.element.style.pointerEvents = "auto";
|
|
3300
3300
|
const d = (p) => {
|
|
3301
3301
|
this.enabled && (p.preventDefault(), s({
|
|
3302
|
-
baseObject:
|
|
3302
|
+
baseObject: h,
|
|
3303
3303
|
mouseEvent: p
|
|
3304
3304
|
}));
|
|
3305
3305
|
}, f = `pointer${t}`;
|
|
3306
|
-
|
|
3306
|
+
h.element.addEventListener(f, Qe(d), !1), o.push({ arr: h, type: f, listener: d });
|
|
3307
3307
|
}
|
|
3308
3308
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
3309
3309
|
}
|
|
@@ -3327,7 +3327,7 @@ class Us extends Rs {
|
|
|
3327
3327
|
constructor(e, t) {
|
|
3328
3328
|
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 Ds({
|
|
3329
3329
|
scene: t.scene
|
|
3330
|
-
}), this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.key = "Scene", this.group = new Ae(), this.group.create(), this.group.lead = this, this.group.pencil = e, this.group.key = "@Group", this.prefabGroup = new Ae(), this.prefabGroup.create(), this.prefabGroup.lead = this, this.prefabGroup.pencil = e, this.prefabGroup.key = "@PrefabGroup", 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);
|
|
3330
|
+
}), this.scene.create(), this.scene.lead = this, this.scene.pencil = e, this.scene.key = "Scene", this.scene.object3d.name = "场景", this.group = new Ae(), this.group.create(), this.group.lead = this, this.group.pencil = e, this.group.key = "@Group", this.group.object3d.name = "物体组", this.prefabGroup = new Ae(), 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);
|
|
3331
3331
|
}
|
|
3332
3332
|
get objectsPromise() {
|
|
3333
3333
|
return this.objectsPm.values();
|
|
@@ -3356,13 +3356,13 @@ class Us extends Rs {
|
|
|
3356
3356
|
}
|
|
3357
3357
|
draw(e, t, s) {
|
|
3358
3358
|
return J(this, null, function* () {
|
|
3359
|
-
var r, o, n,
|
|
3359
|
+
var r, o, n, h;
|
|
3360
3360
|
const i = this.objectNamesToFactories.get(e);
|
|
3361
3361
|
if (i) {
|
|
3362
3362
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3363
3363
|
const d = t.target, f = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, C = (n = t.create) != null ? n : !0, v = new i().create(t);
|
|
3364
3364
|
let m;
|
|
3365
|
-
return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (
|
|
3365
|
+
return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (h = d == null ? void 0 : d.objectType) != null && h.startsWith("BaseObject") || d ? m = d : p ? m = this.prefabGroup : m = this.group, C === !1 ? v.create = () => {
|
|
3366
3366
|
} : C !== !0 && (v.create = () => {
|
|
3367
3367
|
C(v);
|
|
3368
3368
|
}), v.pencil = this.pencil, v.lead = this, v.prefab = p, v.objectType = `BaseObject#${e}`, v.objectOptions = t, this.setBaseObjectKey(
|
|
@@ -3389,8 +3389,8 @@ class Us extends Rs {
|
|
|
3389
3389
|
updateBaseObjectKey(e, t) {
|
|
3390
3390
|
var o;
|
|
3391
3391
|
let s;
|
|
3392
|
-
for (const [n,
|
|
3393
|
-
if (
|
|
3392
|
+
for (const [n, h] of this.objects.entries())
|
|
3393
|
+
if (h === e) {
|
|
3394
3394
|
s = n;
|
|
3395
3395
|
break;
|
|
3396
3396
|
}
|
|
@@ -3559,19 +3559,19 @@ const ue = class ue {
|
|
|
3559
3559
|
renderer: r,
|
|
3560
3560
|
controls: o,
|
|
3561
3561
|
loader: n
|
|
3562
|
-
} = this.options, { width:
|
|
3563
|
-
width:
|
|
3562
|
+
} = this.options, { width: h, height: d } = this.getSize(), f = t ? new ts({
|
|
3563
|
+
width: h,
|
|
3564
3564
|
height: d,
|
|
3565
3565
|
renderer: t.WebGPURenderer,
|
|
3566
3566
|
rendererParams: es
|
|
3567
3567
|
}) : new Jt({
|
|
3568
|
-
width:
|
|
3568
|
+
width: h,
|
|
3569
3569
|
height: d,
|
|
3570
3570
|
rendererParams: Q(z({}, r), {
|
|
3571
3571
|
antialias: !1
|
|
3572
3572
|
})
|
|
3573
3573
|
}), p = new is({
|
|
3574
|
-
width:
|
|
3574
|
+
width: h,
|
|
3575
3575
|
height: d
|
|
3576
3576
|
}), C = new os({}), v = new as({
|
|
3577
3577
|
controlsParams: {
|
|
@@ -3628,7 +3628,7 @@ const ue = class ue {
|
|
|
3628
3628
|
}
|
|
3629
3629
|
}
|
|
3630
3630
|
initTransformControls() {
|
|
3631
|
-
const e = new
|
|
3631
|
+
const e = new hs({
|
|
3632
3632
|
camera: this.camera,
|
|
3633
3633
|
renderer: this.renderer,
|
|
3634
3634
|
scene: this.scene
|
|
@@ -3665,9 +3665,9 @@ const ue = class ue {
|
|
|
3665
3665
|
cameraController: r,
|
|
3666
3666
|
composerController: o,
|
|
3667
3667
|
cssRendererController: n,
|
|
3668
|
-
leadController:
|
|
3668
|
+
leadController: h
|
|
3669
3669
|
} = this, d = this.renderer.getSize(new O.Vector2());
|
|
3670
|
-
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t),
|
|
3670
|
+
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), n == null || n.setSize(e, t), h.setSize(e, t), this.installPlugins.forEach((f) => {
|
|
3671
3671
|
var p;
|
|
3672
3672
|
(p = f.setSize) == null || p.call(f, e, t);
|
|
3673
3673
|
}), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
@@ -3689,8 +3689,8 @@ const ue = class ue {
|
|
|
3689
3689
|
r !== o && (this.rendererController.setPixelRatio(r), (n = this.composerController) == null || n.setPixelRatio(r));
|
|
3690
3690
|
}
|
|
3691
3691
|
pick(e, t, s = !0) {
|
|
3692
|
-
const { raycaster: i, options: r } = this, { container: o } = r, n = new O.Vector2(),
|
|
3693
|
-
if (n.x = (e.clientX -
|
|
3692
|
+
const { raycaster: i, options: r } = this, { container: o } = r, n = new O.Vector2(), h = o.getBoundingClientRect();
|
|
3693
|
+
if (n.x = (e.clientX - h.left) / (h.right - h.left) * 2 - 1, n.y = -((e.clientY - h.top) / (h.bottom - h.top)) * 2 + 1, this.camera && this.scene) {
|
|
3694
3694
|
i.setFromCamera(n, this.camera);
|
|
3695
3695
|
const d = i.intersectObjects(
|
|
3696
3696
|
t || this.scene.children,
|
|
@@ -3705,7 +3705,7 @@ const ue = class ue {
|
|
|
3705
3705
|
}
|
|
3706
3706
|
}
|
|
3707
3707
|
render() {
|
|
3708
|
-
var s, i, r, o, n,
|
|
3708
|
+
var s, i, r, o, n, h;
|
|
3709
3709
|
if (!this.camera || !this.scene)
|
|
3710
3710
|
return;
|
|
3711
3711
|
this.timer.update(), ye.update();
|
|
@@ -3717,7 +3717,7 @@ const ue = class ue {
|
|
|
3717
3717
|
e,
|
|
3718
3718
|
this.controlsController,
|
|
3719
3719
|
this.cameraTarget
|
|
3720
|
-
), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (n = this.cssRendererController) == null || n.render(this.scene, this.camera), (
|
|
3720
|
+
), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (n = this.cssRendererController) == null || n.render(this.scene, this.camera), (h = this.stats) == null || h.update(), this.event.emit("render", { delta: e, elapsed: t });
|
|
3721
3721
|
}
|
|
3722
3722
|
start() {
|
|
3723
3723
|
window.cancelAnimationFrame(this.TweenRaf), this.renderer.setAnimationLoop(this.render.bind(this)), this.event.emit("start");
|
|
@@ -3768,11 +3768,11 @@ const ue = class ue {
|
|
|
3768
3768
|
}
|
|
3769
3769
|
}
|
|
3770
3770
|
dispose() {
|
|
3771
|
-
var e, t, s, i, r, o, n,
|
|
3771
|
+
var e, t, s, i, r, o, n, h, d, f, p, C, v;
|
|
3772
3772
|
this.stop(), this.timer.dispose(), ye.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((m) => {
|
|
3773
3773
|
var u;
|
|
3774
3774
|
(u = m.dispose) == null || u.call(m);
|
|
3775
|
-
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (
|
|
3775
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (n = this.helperController) == null || n.dispose(), (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();
|
|
3776
3776
|
}
|
|
3777
3777
|
};
|
|
3778
3778
|
ue.options = {
|