@thatopen/components 2.1.3 → 2.1.4
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/Components/index.d.ts +1 -1
- package/dist/fragments/FragmentsManager/index.d.ts +2 -3
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +305 -312
- package/dist/namespace.d.ts +2126 -2127
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var kn = Object.defineProperty;
|
|
2
2
|
var Wn = (l, s, t) => s in l ? kn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
|
|
3
3
|
var I = (l, s, t) => (Wn(l, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
|
-
import * as
|
|
5
|
-
import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as Lt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as
|
|
4
|
+
import * as g from "three";
|
|
5
|
+
import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as Lt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as Ot, BackSide as Zn, DoubleSide as Ln, FrontSide as wi, Mesh as v, Ray as Qn, Raycaster as jn, Quaternion as Pt, Object3D as ri, Euler as qn, MeshBasicMaterial as yn, LineBasicMaterial as Kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as me, PlaneGeometry as Jn } from "three";
|
|
6
6
|
import * as Vt from "@thatopen/fragments";
|
|
7
7
|
import { Serializer as to } from "@thatopen/fragments";
|
|
8
8
|
import * as b from "web-ifc";
|
|
@@ -95,8 +95,8 @@ function Gs(l, s, t, e, i = null) {
|
|
|
95
95
|
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, h = -1 / 0, d = 1 / 0, E = 1 / 0, u = 1 / 0, f = -1 / 0, R = -1 / 0, m = -1 / 0;
|
|
96
96
|
const C = i !== null;
|
|
97
97
|
for (let A = s * 6, F = (s + t) * 6; A < F; A += 6) {
|
|
98
|
-
const p = l[A + 0], T = l[A + 1],
|
|
99
|
-
|
|
98
|
+
const p = l[A + 0], T = l[A + 1], O = p - T, _ = p + T;
|
|
99
|
+
O < o && (o = O), _ > a && (a = _), C && p < d && (d = p), C && p > f && (f = p);
|
|
100
100
|
const S = l[A + 2], N = l[A + 3], L = S - N, w = S + N;
|
|
101
101
|
L < n && (n = L), w > c && (c = w), C && S < E && (E = S), C && S > R && (R = S);
|
|
102
102
|
const y = l[A + 4], U = l[A + 5], x = y - U, B = y + U;
|
|
@@ -131,10 +131,10 @@ function ho(l, s) {
|
|
|
131
131
|
n ? (A = t[h[C]](f), F = t[h[C]](R), p = t[h[C]](m)) : (A = r[f + C], F = r[R + C], p = r[m + C]);
|
|
132
132
|
let T = A;
|
|
133
133
|
F < T && (T = F), p < T && (T = p);
|
|
134
|
-
let
|
|
135
|
-
F >
|
|
136
|
-
const _ = (
|
|
137
|
-
o[u + S + 0] = T + _, o[u + S + 1] = _ + (Math.abs(T) + _) * io, T < s[C] && (s[C] = T),
|
|
134
|
+
let O = A;
|
|
135
|
+
F > O && (O = F), p > O && (O = p);
|
|
136
|
+
const _ = (O - T) / 2, S = C * 2;
|
|
137
|
+
o[u + S + 0] = T + _, o[u + S + 1] = _ + (Math.abs(T) + _) * io, T < s[C] && (s[C] = T), O > s[C + 3] && (s[C + 3] = O);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
return o;
|
|
@@ -166,13 +166,13 @@ function uo(l, s, t, e, i, o) {
|
|
|
166
166
|
const T = C[A];
|
|
167
167
|
T.candidate = t[p + 2 * E], T.count = 0;
|
|
168
168
|
const {
|
|
169
|
-
bounds:
|
|
169
|
+
bounds: O,
|
|
170
170
|
leftCacheBounds: _,
|
|
171
171
|
rightCacheBounds: S
|
|
172
172
|
} = T;
|
|
173
173
|
for (let N = 0; N < 3; N++)
|
|
174
|
-
S[N] = 1 / 0, S[N + 3] = -1 / 0, _[N] = 1 / 0, _[N + 3] = -1 / 0,
|
|
175
|
-
Qe(p, t,
|
|
174
|
+
S[N] = 1 / 0, S[N + 3] = -1 / 0, _[N] = 1 / 0, _[N + 3] = -1 / 0, O[N] = 1 / 0, O[N + 3] = -1 / 0;
|
|
175
|
+
Qe(p, t, O);
|
|
176
176
|
}
|
|
177
177
|
C.sort(Eo);
|
|
178
178
|
let F = i;
|
|
@@ -183,18 +183,18 @@ function uo(l, s, t, e, i, o) {
|
|
|
183
183
|
}
|
|
184
184
|
for (let p = h; p < d; p += 6) {
|
|
185
185
|
const T = t[p + 2 * E];
|
|
186
|
-
for (let
|
|
187
|
-
const _ = C[
|
|
186
|
+
for (let O = 0; O < F; O++) {
|
|
187
|
+
const _ = C[O];
|
|
188
188
|
T >= _.candidate ? Qe(p, t, _.rightCacheBounds) : (Qe(p, t, _.leftCacheBounds), _.count++);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
for (let p = 0; p < F; p++) {
|
|
192
|
-
const T = C[p],
|
|
192
|
+
const T = C[p], O = T.count, _ = i - T.count, S = T.leftCacheBounds, N = T.rightCacheBounds;
|
|
193
193
|
let L = 0;
|
|
194
|
-
|
|
194
|
+
O !== 0 && (L = Re(S) / a);
|
|
195
195
|
let w = 0;
|
|
196
196
|
_ !== 0 && (w = Re(N) / a);
|
|
197
|
-
const y = bi + Ys * (L *
|
|
197
|
+
const y = bi + Ys * (L * O + w * _);
|
|
198
198
|
y < c && (n = E, c = y, r = T.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
@@ -202,13 +202,13 @@ function uo(l, s, t, e, i, o) {
|
|
|
202
202
|
const p = Ut[F];
|
|
203
203
|
p.count = 0, p.candidate = u + m + F * m;
|
|
204
204
|
const T = p.bounds;
|
|
205
|
-
for (let
|
|
206
|
-
T[
|
|
205
|
+
for (let O = 0; O < 3; O++)
|
|
206
|
+
T[O] = 1 / 0, T[O + 3] = -1 / 0;
|
|
207
207
|
}
|
|
208
208
|
for (let F = h; F < d; F += 6) {
|
|
209
|
-
let
|
|
210
|
-
|
|
211
|
-
const _ = Ut[
|
|
209
|
+
let O = ~~((t[F + 2 * E] - u) / m);
|
|
210
|
+
O >= Mt && (O = Mt - 1);
|
|
211
|
+
const _ = Ut[O];
|
|
212
212
|
_.count++, Qe(F, t, _.bounds);
|
|
213
213
|
}
|
|
214
214
|
const C = Ut[Mt - 1];
|
|
@@ -219,8 +219,8 @@ function uo(l, s, t, e, i, o) {
|
|
|
219
219
|
}
|
|
220
220
|
let A = 0;
|
|
221
221
|
for (let F = 0; F < Mt - 1; F++) {
|
|
222
|
-
const p = Ut[F], T = p.count,
|
|
223
|
-
T !== 0 && (A === 0 ? Bi(
|
|
222
|
+
const p = Ut[F], T = p.count, O = p.bounds, S = Ut[F + 1].rightCacheBounds;
|
|
223
|
+
T !== 0 && (A === 0 ? Bi(O, je) : Yi(O, je, je)), A += T;
|
|
224
224
|
let N = 0, L = 0;
|
|
225
225
|
A !== 0 && (N = Re(je) / a);
|
|
226
226
|
const w = i - A;
|
|
@@ -308,20 +308,20 @@ function To(l, s) {
|
|
|
308
308
|
function A(p) {
|
|
309
309
|
a && a(p / c);
|
|
310
310
|
}
|
|
311
|
-
function F(p, T,
|
|
312
|
-
if (!d && S >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))),
|
|
313
|
-
return A(T +
|
|
314
|
-
const N = uo(p.boundingData, _, f, T,
|
|
311
|
+
function F(p, T, O, _ = null, S = 0) {
|
|
312
|
+
if (!d && S >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))), O <= n || S >= i)
|
|
313
|
+
return A(T + O), p.offset = T, p.count = O, p;
|
|
314
|
+
const N = uo(p.boundingData, _, f, T, O, r);
|
|
315
315
|
if (N.axis === -1)
|
|
316
|
-
return A(T +
|
|
317
|
-
const L = R(h, e, f, T,
|
|
318
|
-
if (L === T || L === T +
|
|
319
|
-
A(T +
|
|
316
|
+
return A(T + O), p.offset = T, p.count = O, p;
|
|
317
|
+
const L = R(h, e, f, T, O, N);
|
|
318
|
+
if (L === T || L === T + O)
|
|
319
|
+
A(T + O), p.offset = T, p.count = O;
|
|
320
320
|
else {
|
|
321
321
|
p.splitAxis = N.axis;
|
|
322
322
|
const w = new qe(), y = T, U = L - T;
|
|
323
323
|
p.left = w, w.boundingData = new Float32Array(6), Gs(f, y, U, w.boundingData, u), F(w, y, U, u, S + 1);
|
|
324
|
-
const x = new qe(), B = L, H =
|
|
324
|
+
const x = new qe(), B = L, H = O - U;
|
|
325
325
|
p.right = x, x.boundingData = new Float32Array(6), Gs(f, B, H, x.boundingData, u), F(x, B, H, u, S + 1);
|
|
326
326
|
}
|
|
327
327
|
return p;
|
|
@@ -410,7 +410,7 @@ const Ro = function() {
|
|
|
410
410
|
let C, A;
|
|
411
411
|
m !== 0 ? C = (d * E - f * u) / m : C = 0, A = (d + C * E) / u, n.x = C, n.y = A;
|
|
412
412
|
};
|
|
413
|
-
}(),
|
|
413
|
+
}(), Oi = function() {
|
|
414
414
|
const l = new fe(), s = new M(), t = new M();
|
|
415
415
|
return function(i, o, n, r) {
|
|
416
416
|
Ro(i, o, l);
|
|
@@ -482,7 +482,7 @@ Ft.prototype.closestPointToSegment = function() {
|
|
|
482
482
|
let h, d = 1 / 0;
|
|
483
483
|
for (let E = 0; E < 3; E++) {
|
|
484
484
|
const u = (E + 1) % 3;
|
|
485
|
-
t.start.copy(c[E]), t.end.copy(c[u]),
|
|
485
|
+
t.start.copy(c[E]), t.end.copy(c[u]), Oi(t, i, l, s), h = l.distanceToSquared(s), h < d && (d = h, o && o.copy(l), n && n.copy(s));
|
|
486
486
|
}
|
|
487
487
|
return this.closestPointToPoint(r, l), h = r.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), h = a.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
|
|
488
488
|
};
|
|
@@ -493,15 +493,15 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
493
493
|
const A = R.points;
|
|
494
494
|
let F = 0, p = -1;
|
|
495
495
|
for (let T = 0; T < 3; T++) {
|
|
496
|
-
const { start:
|
|
497
|
-
|
|
498
|
-
const S = zs(m.distanceToPoint(
|
|
496
|
+
const { start: O, end: _ } = h;
|
|
497
|
+
O.copy(A[T]), _.copy(A[(T + 1) % 3]), h.delta(n);
|
|
498
|
+
const S = zs(m.distanceToPoint(O));
|
|
499
499
|
if (zs(m.normal.dot(n)) && S) {
|
|
500
500
|
C.copy(h), F = 2;
|
|
501
501
|
break;
|
|
502
502
|
}
|
|
503
503
|
const N = m.intersectLine(h, u);
|
|
504
|
-
if (!N && S && u.copy(
|
|
504
|
+
if (!N && S && u.copy(O), (N || S) && !zs(u.distanceTo(_))) {
|
|
505
505
|
if (F <= 1)
|
|
506
506
|
(F === 1 ? C.start : C.end).copy(u), S && (p = F);
|
|
507
507
|
else if (F >= 2) {
|
|
@@ -518,10 +518,10 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
518
518
|
this.needsUpdate && this.update(), m.isExtendedTriangle ? m.needsUpdate && m.update() : (l.copy(m), l.update(), m = l);
|
|
519
519
|
const F = this.plane, p = m.plane;
|
|
520
520
|
if (Math.abs(F.normal.dot(p.normal)) > 1 - 1e-10) {
|
|
521
|
-
const T = this.satBounds,
|
|
521
|
+
const T = this.satBounds, O = this.satAxes;
|
|
522
522
|
t[0] = m.a, t[1] = m.b, t[2] = m.c;
|
|
523
523
|
for (let N = 0; N < 4; N++) {
|
|
524
|
-
const L = T[N], w =
|
|
524
|
+
const L = T[N], w = O[N];
|
|
525
525
|
if (e.setFromPoints(w, t), L.isSeparated(e))
|
|
526
526
|
return !1;
|
|
527
527
|
}
|
|
@@ -533,7 +533,7 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
533
533
|
return !1;
|
|
534
534
|
}
|
|
535
535
|
for (let N = 0; N < 4; N++) {
|
|
536
|
-
const L =
|
|
536
|
+
const L = O[N];
|
|
537
537
|
for (let w = 0; w < 4; w++) {
|
|
538
538
|
const y = S[w];
|
|
539
539
|
if (o.crossVectors(L, y), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
|
|
@@ -547,10 +547,10 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
547
547
|
return C && (C.start.copy(d.end), C.end.copy(d.end)), !0;
|
|
548
548
|
if (T !== 2)
|
|
549
549
|
return !1;
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
550
|
+
const O = f(m, F, E);
|
|
551
|
+
if (O === 1 && this.containsPoint(E.end))
|
|
552
552
|
return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
|
|
553
|
-
if (
|
|
553
|
+
if (O !== 2)
|
|
554
554
|
return !1;
|
|
555
555
|
if (d.delta(r), E.delta(a), r.dot(a) < 0) {
|
|
556
556
|
let U = E.start;
|
|
@@ -586,7 +586,7 @@ Ft.prototype.distanceToTriangle = function() {
|
|
|
586
586
|
e.set(this[E], this[u]);
|
|
587
587
|
for (let f = 0; f < 3; f++) {
|
|
588
588
|
const R = t[f], m = t[(f + 1) % 3];
|
|
589
|
-
i.set(n[R], n[m]),
|
|
589
|
+
i.set(n[R], n[m]), Oi(e, i, l, s);
|
|
590
590
|
const C = l.distanceToSquared(s);
|
|
591
591
|
C < h && (h = C, r && r.copy(l), a && a.copy(s));
|
|
592
592
|
}
|
|
@@ -695,7 +695,7 @@ at.prototype.distanceToBox = function() {
|
|
|
695
695
|
for (let m = 0; m < 3; m++)
|
|
696
696
|
for (let C = 0; C <= 1; C++)
|
|
697
697
|
for (let A = 0; A <= 1; A++) {
|
|
698
|
-
const F = (m + 1) % 3, p = (m + 2) % 3, T = C << F | A << p,
|
|
698
|
+
const F = (m + 1) % 3, p = (m + 2) % 3, T = C << F | A << p, O = 1 << m | C << F | A << p, _ = u[T], S = u[O];
|
|
699
699
|
s[R].set(_, S);
|
|
700
700
|
const L = l[m], w = l[F], y = l[p], U = t[R], x = U.start, B = U.end;
|
|
701
701
|
x[L] = d[L], x[w] = C ? d[w] : E[w], x[y] = A ? d[y] : E[w], B[L] = E[L], B[w] = C ? d[w] : E[w], B[y] = A ? d[y] : E[w], R++;
|
|
@@ -712,7 +712,7 @@ at.prototype.distanceToBox = function() {
|
|
|
712
712
|
const C = s[m];
|
|
713
713
|
for (let A = 0; A < 12; A++) {
|
|
714
714
|
const F = t[A];
|
|
715
|
-
|
|
715
|
+
Oi(C, F, e, i);
|
|
716
716
|
const p = e.distanceToSquared(i);
|
|
717
717
|
if (p < f && (f = p, a && a.copy(e), c && c.copy(i), p < h))
|
|
718
718
|
return Math.sqrt(p);
|
|
@@ -721,7 +721,7 @@ at.prototype.distanceToBox = function() {
|
|
|
721
721
|
return Math.sqrt(f);
|
|
722
722
|
};
|
|
723
723
|
}();
|
|
724
|
-
class
|
|
724
|
+
class gi {
|
|
725
725
|
constructor(s) {
|
|
726
726
|
this._getNewPrimitive = s, this._primitives = [];
|
|
727
727
|
}
|
|
@@ -733,12 +733,12 @@ class Oi {
|
|
|
733
733
|
this._primitives.push(s);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
class
|
|
736
|
+
class Oo extends gi {
|
|
737
737
|
constructor() {
|
|
738
738
|
super(() => new Ft());
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const It = /* @__PURE__ */ new
|
|
741
|
+
const It = /* @__PURE__ */ new Oo();
|
|
742
742
|
function Et(l, s) {
|
|
743
743
|
return s[l + 15] === 65535;
|
|
744
744
|
}
|
|
@@ -757,7 +757,7 @@ function Ct(l, s) {
|
|
|
757
757
|
function Un(l, s) {
|
|
758
758
|
return s[l + 7];
|
|
759
759
|
}
|
|
760
|
-
class
|
|
760
|
+
class go {
|
|
761
761
|
constructor() {
|
|
762
762
|
this.float32Array = null, this.uint16Array = null, this.uint32Array = null;
|
|
763
763
|
const s = [];
|
|
@@ -769,9 +769,9 @@ class Oo {
|
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
const Z = new
|
|
772
|
+
const Z = new go();
|
|
773
773
|
let Yt, Ie;
|
|
774
|
-
const Jt = [], Ke = /* @__PURE__ */ new
|
|
774
|
+
const Jt = [], Ke = /* @__PURE__ */ new gi(() => new Ot());
|
|
775
775
|
function _o(l, s, t, e, i, o) {
|
|
776
776
|
Yt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Yt, Ie), Z.setBuffer(l._roots[s]);
|
|
777
777
|
const n = ai(0, l.geometry, t, e, i, o);
|
|
@@ -808,12 +808,12 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
808
808
|
}
|
|
809
809
|
A || (A = Yt, K(f, r, A));
|
|
810
810
|
const p = Et(f * 2, a), T = t(A, p, m, n + 1, o + f);
|
|
811
|
-
let
|
|
811
|
+
let O;
|
|
812
812
|
if (T === xi) {
|
|
813
813
|
const y = L(f), x = w(f) - y;
|
|
814
|
-
|
|
814
|
+
O = e(y, x, !0, n + 1, o + f, A);
|
|
815
815
|
} else
|
|
816
|
-
|
|
816
|
+
O = T && ai(
|
|
817
817
|
f,
|
|
818
818
|
s,
|
|
819
819
|
t,
|
|
@@ -822,7 +822,7 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
822
822
|
o,
|
|
823
823
|
n + 1
|
|
824
824
|
);
|
|
825
|
-
if (
|
|
825
|
+
if (O)
|
|
826
826
|
return !0;
|
|
827
827
|
F = Ie, K(R, r, F);
|
|
828
828
|
const _ = Et(R * 2, a), S = t(F, _, C, n + 1, o + R);
|
|
@@ -933,18 +933,18 @@ function wo(l, s = null) {
|
|
|
933
933
|
const R = E * 2;
|
|
934
934
|
if (r[R + 15] === Us) {
|
|
935
935
|
const C = n[E + 6], A = r[R + 14];
|
|
936
|
-
let F = 1 / 0, p = 1 / 0, T = 1 / 0,
|
|
936
|
+
let F = 1 / 0, p = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
|
|
937
937
|
for (let N = 3 * C, L = 3 * (C + A); N < L; N++) {
|
|
938
938
|
let w = e[N];
|
|
939
939
|
const y = i.getX(w), U = i.getY(w), x = i.getZ(w);
|
|
940
|
-
y < F && (F = y), y >
|
|
940
|
+
y < F && (F = y), y > O && (O = y), U < p && (p = U), U > _ && (_ = U), x < T && (T = x), x > S && (S = x);
|
|
941
941
|
}
|
|
942
|
-
return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !==
|
|
942
|
+
return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
|
|
943
943
|
} else {
|
|
944
944
|
const C = E + 8, A = n[E + 6], F = C + u, p = A + u;
|
|
945
|
-
let T = f,
|
|
946
|
-
s ? T || (
|
|
947
|
-
const S = T ||
|
|
945
|
+
let T = f, O = !1, _ = !1;
|
|
946
|
+
s ? T || (O = s.has(F), _ = s.has(p), T = !O && !_) : (O = !0, _ = !0);
|
|
947
|
+
const S = T || O, N = T || _;
|
|
948
948
|
let L = !1;
|
|
949
949
|
S && (L = d(C, u, T));
|
|
950
950
|
let w = !1;
|
|
@@ -959,7 +959,7 @@ function wo(l, s = null) {
|
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
|
-
const Hi = /* @__PURE__ */ new
|
|
962
|
+
const Hi = /* @__PURE__ */ new Ot();
|
|
963
963
|
function Gt(l, s, t, e) {
|
|
964
964
|
return K(l, s, Hi), t.intersectBox(Hi, e);
|
|
965
965
|
}
|
|
@@ -1033,7 +1033,7 @@ function li(l, s, t, e) {
|
|
|
1033
1033
|
return m && A ? m.distance <= A.distance ? m : A : m || A || null;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
const ss = /* @__PURE__ */ new
|
|
1036
|
+
const ss = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new Ft(), ne = /* @__PURE__ */ new Ft(), Fe = /* @__PURE__ */ new yt(), Xi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
|
|
1037
1037
|
function Yo(l, s, t, e) {
|
|
1038
1038
|
Z.setBuffer(l._roots[s]);
|
|
1039
1039
|
const i = hi(0, l, t, e);
|
|
@@ -1066,26 +1066,26 @@ function hi(l, s, t, e, i = null) {
|
|
|
1066
1066
|
return K(h, o, ss), !!(i.intersectsBox(ss) && hi(h, s, t, e, i) || (K(d, o, ss), i.intersectsBox(ss) && hi(d, s, t, e, i)));
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
|
-
const ns = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(),
|
|
1069
|
+
const ns = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), Oe = /* @__PURE__ */ new at(), Vo = /* @__PURE__ */ new M(), Go = /* @__PURE__ */ new M(), zo = /* @__PURE__ */ new M(), Ho = /* @__PURE__ */ new M();
|
|
1070
1070
|
function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1071
1071
|
s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
|
|
1072
1072
|
const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
|
|
1073
1073
|
let f = Vo, R = Go, m = null, C = null;
|
|
1074
1074
|
i && (m = zo, C = Ho);
|
|
1075
1075
|
let A = 1 / 0, F = null, p = null;
|
|
1076
|
-
return ns.copy(t).invert(),
|
|
1076
|
+
return ns.copy(t).invert(), Oe.matrix.copy(ns), l.shapecast(
|
|
1077
1077
|
{
|
|
1078
1078
|
boundsTraverseOrder: (T) => ks.distanceToBox(T),
|
|
1079
|
-
intersectsBounds: (T,
|
|
1080
|
-
intersectsRange: (T,
|
|
1079
|
+
intersectsBounds: (T, O, _) => _ < A && _ < n ? (O && (Oe.min.copy(T.min), Oe.max.copy(T.max), Oe.needsUpdate = !0), !0) : !1,
|
|
1080
|
+
intersectsRange: (T, O) => {
|
|
1081
1081
|
if (s.boundsTree)
|
|
1082
1082
|
return s.boundsTree.shapecast({
|
|
1083
|
-
boundsTraverseOrder: (S) =>
|
|
1083
|
+
boundsTraverseOrder: (S) => Oe.distanceToBox(S),
|
|
1084
1084
|
intersectsBounds: (S, N, L) => L < A && L < n,
|
|
1085
1085
|
intersectsRange: (S, N) => {
|
|
1086
1086
|
for (let L = S, w = S + N; L < w; L++) {
|
|
1087
1087
|
tt(u, 3 * L, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1088
|
-
for (let y = T, U = T +
|
|
1088
|
+
for (let y = T, U = T + O; y < U; y++) {
|
|
1089
1089
|
tt(E, 3 * y, c, a), E.needsUpdate = !0;
|
|
1090
1090
|
const x = E.distanceToTriangle(u, f, m);
|
|
1091
1091
|
if (x < A && (R.copy(f), C && C.copy(m), A = x, F = y, p = L), x < o)
|
|
@@ -1098,7 +1098,7 @@ function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1098
1098
|
const _ = pe(s);
|
|
1099
1099
|
for (let S = 0, N = _; S < N; S++) {
|
|
1100
1100
|
tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1101
|
-
for (let L = T, w = T +
|
|
1101
|
+
for (let L = T, w = T + O; L < w; L++) {
|
|
1102
1102
|
tt(E, 3 * L, c, a), E.needsUpdate = !0;
|
|
1103
1103
|
const y = E.distanceToTriangle(u, f, m);
|
|
1104
1104
|
if (y < A && (R.copy(f), C && C.copy(m), A = y, F = L, p = S), y < o)
|
|
@@ -1121,22 +1121,22 @@ function Wo(l, s = null) {
|
|
|
1121
1121
|
const R = E * 2;
|
|
1122
1122
|
if (r[R + 15] === Us) {
|
|
1123
1123
|
const C = n[E + 6], A = r[R + 14];
|
|
1124
|
-
let F = 1 / 0, p = 1 / 0, T = 1 / 0,
|
|
1124
|
+
let F = 1 / 0, p = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
|
|
1125
1125
|
for (let N = C, L = C + A; N < L; N++) {
|
|
1126
1126
|
const w = 3 * l.resolveTriangleIndex(N);
|
|
1127
1127
|
for (let y = 0; y < 3; y++) {
|
|
1128
1128
|
let U = w + y;
|
|
1129
1129
|
U = e ? e[U] : U;
|
|
1130
1130
|
const x = i.getX(U), B = i.getY(U), H = i.getZ(U);
|
|
1131
|
-
x < F && (F = x), x >
|
|
1131
|
+
x < F && (F = x), x > O && (O = x), B < p && (p = B), B > _ && (_ = B), H < T && (T = H), H > S && (S = H);
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !==
|
|
1134
|
+
return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
|
|
1135
1135
|
} else {
|
|
1136
1136
|
const C = E + 8, A = n[E + 6], F = C + u, p = A + u;
|
|
1137
|
-
let T = f,
|
|
1138
|
-
s ? T || (
|
|
1139
|
-
const S = T ||
|
|
1137
|
+
let T = f, O = !1, _ = !1;
|
|
1138
|
+
s ? T || (O = s.has(F), _ = s.has(p), T = !O && !_) : (O = !0, _ = !0);
|
|
1139
|
+
const S = T || O, N = T || _;
|
|
1140
1140
|
let L = !1;
|
|
1141
1141
|
S && (L = d(C, u, T));
|
|
1142
1142
|
let w = !1;
|
|
@@ -1196,7 +1196,7 @@ function di(l, s, t, e) {
|
|
|
1196
1196
|
return m && A ? m.distance <= A.distance ? m : A : m || A || null;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
const os = /* @__PURE__ */ new
|
|
1199
|
+
const os = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new Ft(), re = /* @__PURE__ */ new Ft(), ge = /* @__PURE__ */ new yt(), ji = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
|
|
1200
1200
|
function jo(l, s, t, e) {
|
|
1201
1201
|
Z.setBuffer(l._roots[s]);
|
|
1202
1202
|
const i = ui(0, l, t, e);
|
|
@@ -1207,8 +1207,8 @@ function ui(l, s, t, e, i = null) {
|
|
|
1207
1207
|
let a = l * 2;
|
|
1208
1208
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, e), i = ji), Et(a, n)) {
|
|
1209
1209
|
const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, R = dt(l, r), m = ft(a, n);
|
|
1210
|
-
if (
|
|
1211
|
-
return K(l, o, rs), rs.matrix.copy(
|
|
1210
|
+
if (ge.copy(e).invert(), t.boundsTree)
|
|
1211
|
+
return K(l, o, rs), rs.matrix.copy(ge), rs.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1212
1212
|
intersectsBounds: (A) => rs.intersectsBox(A),
|
|
1213
1213
|
intersectsTriangle: (A) => {
|
|
1214
1214
|
A.a.applyMatrix4(e), A.b.applyMatrix4(e), A.c.applyMatrix4(e), A.needsUpdate = !0;
|
|
@@ -1220,7 +1220,7 @@ function ui(l, s, t, e, i = null) {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
for (let C = R, A = m + R; C < A; C++) {
|
|
1222
1222
|
const F = s.resolveTriangleIndex(C);
|
|
1223
|
-
tt(oe, 3 * F, d, E), oe.a.applyMatrix4(
|
|
1223
|
+
tt(oe, 3 * F, d, E), oe.a.applyMatrix4(ge), oe.b.applyMatrix4(ge), oe.c.applyMatrix4(ge), oe.needsUpdate = !0;
|
|
1224
1224
|
for (let p = 0, T = u.count; p < T; p += 3)
|
|
1225
1225
|
if (tt(re, p, u, f), re.needsUpdate = !0, oe.intersectsTriangle(re))
|
|
1226
1226
|
return !0;
|
|
@@ -1240,8 +1240,8 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1240
1240
|
return as.copy(t).invert(), _e.matrix.copy(as), l.shapecast(
|
|
1241
1241
|
{
|
|
1242
1242
|
boundsTraverseOrder: (T) => Ws.distanceToBox(T),
|
|
1243
|
-
intersectsBounds: (T,
|
|
1244
|
-
intersectsRange: (T,
|
|
1243
|
+
intersectsBounds: (T, O, _) => _ < A && _ < n ? (O && (_e.min.copy(T.min), _e.max.copy(T.max), _e.needsUpdate = !0), !0) : !1,
|
|
1244
|
+
intersectsRange: (T, O) => {
|
|
1245
1245
|
if (s.boundsTree) {
|
|
1246
1246
|
const _ = s.boundsTree;
|
|
1247
1247
|
return _.shapecast({
|
|
@@ -1251,7 +1251,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1251
1251
|
for (let L = S, w = S + N; L < w; L++) {
|
|
1252
1252
|
const y = _.resolveTriangleIndex(L);
|
|
1253
1253
|
tt(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1254
|
-
for (let U = T, x = T +
|
|
1254
|
+
for (let U = T, x = T + O; U < x; U++) {
|
|
1255
1255
|
const B = l.resolveTriangleIndex(U);
|
|
1256
1256
|
tt(E, 3 * B, c, a), E.needsUpdate = !0;
|
|
1257
1257
|
const H = E.distanceToTriangle(u, f, m);
|
|
@@ -1265,7 +1265,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1265
1265
|
const _ = pe(s);
|
|
1266
1266
|
for (let S = 0, N = _; S < N; S++) {
|
|
1267
1267
|
tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1268
|
-
for (let L = T, w = T +
|
|
1268
|
+
for (let L = T, w = T + O; L < w; L++) {
|
|
1269
1269
|
const y = l.resolveTriangleIndex(L);
|
|
1270
1270
|
tt(E, 3 * y, c, a), E.needsUpdate = !0;
|
|
1271
1271
|
const U = E.distanceToTriangle(u, f, m);
|
|
@@ -1281,7 +1281,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1281
1281
|
function er() {
|
|
1282
1282
|
return typeof SharedArrayBuffer < "u";
|
|
1283
1283
|
}
|
|
1284
|
-
const xe = new Z.constructor(), As = new Z.constructor(), vt = new
|
|
1284
|
+
const xe = new Z.constructor(), As = new Z.constructor(), vt = new gi(() => new Ot()), ae = new Ot(), ce = new Ot(), Xs = new Ot(), Zs = new Ot();
|
|
1285
1285
|
let Qs = !1;
|
|
1286
1286
|
function sr(l, s, t, e) {
|
|
1287
1287
|
if (Qs)
|
|
@@ -1315,9 +1315,9 @@ function sr(l, s, t, e) {
|
|
|
1315
1315
|
function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
1316
1316
|
let d, E;
|
|
1317
1317
|
h ? (d = As, E = xe) : (d = xe, E = As);
|
|
1318
|
-
const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T = Et(F, R),
|
|
1318
|
+
const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T = Et(F, R), O = Et(p, A);
|
|
1319
1319
|
let _ = !1;
|
|
1320
|
-
if (
|
|
1320
|
+
if (O && T)
|
|
1321
1321
|
h ? _ = i(
|
|
1322
1322
|
dt(s, C),
|
|
1323
1323
|
ft(s * 2, A),
|
|
@@ -1337,7 +1337,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
|
1337
1337
|
a,
|
|
1338
1338
|
n + s
|
|
1339
1339
|
);
|
|
1340
|
-
else if (
|
|
1340
|
+
else if (O) {
|
|
1341
1341
|
const S = vt.getPrimitive();
|
|
1342
1342
|
K(s, m, S), S.applyMatrix4(t);
|
|
1343
1343
|
const N = pt(l), L = Ct(l, f);
|
|
@@ -1495,7 +1495,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
return _;
|
|
1497
1497
|
}
|
|
1498
|
-
const cs = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new
|
|
1498
|
+
const cs = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new Ot();
|
|
1499
1499
|
class _i {
|
|
1500
1500
|
static serialize(s, t = {}) {
|
|
1501
1501
|
t = {
|
|
@@ -1554,7 +1554,7 @@ class _i {
|
|
|
1554
1554
|
[Vs]: !1
|
|
1555
1555
|
}, t), t.useSharedArrayBuffer && !er())
|
|
1556
1556
|
throw new Error("MeshBVH: SharedArrayBuffer is not available.");
|
|
1557
|
-
this.geometry = s, this._roots = null, this._indirectBuffer = null, t[Vs] || (mo(this, t), !s.boundingBox && t.setBoundingBox && (s.boundingBox = this.getBoundingBox(new
|
|
1557
|
+
this.geometry = s, this._roots = null, this._indirectBuffer = null, t[Vs] || (mo(this, t), !s.boundingBox && t.setBoundingBox && (s.boundingBox = this.getBoundingBox(new Ot())));
|
|
1558
1558
|
const { _indirectBuffer: e } = this;
|
|
1559
1559
|
this.resolveTriangleIndex = t.indirect ? (i) => e[i] : (i) => i;
|
|
1560
1560
|
}
|
|
@@ -1645,19 +1645,19 @@ class _i {
|
|
|
1645
1645
|
tt(h, f * 3, d, E);
|
|
1646
1646
|
};
|
|
1647
1647
|
if (o) {
|
|
1648
|
-
const f = (R, m, C, A, F, p, T,
|
|
1648
|
+
const f = (R, m, C, A, F, p, T, O) => {
|
|
1649
1649
|
for (let _ = C, S = C + A; _ < S; _++) {
|
|
1650
1650
|
u(_), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
|
|
1651
1651
|
for (let N = R, L = R + m; N < L; N++)
|
|
1652
|
-
if (c(N), n.needsUpdate = !0, o(n, h, N, _, F, p, T,
|
|
1652
|
+
if (c(N), n.needsUpdate = !0, o(n, h, N, _, F, p, T, O))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
1655
1655
|
return !1;
|
|
1656
1656
|
};
|
|
1657
1657
|
if (i) {
|
|
1658
1658
|
const R = i;
|
|
1659
|
-
i = function(m, C, A, F, p, T,
|
|
1660
|
-
return R(m, C, A, F, p, T,
|
|
1659
|
+
i = function(m, C, A, F, p, T, O, _) {
|
|
1660
|
+
return R(m, C, A, F, p, T, O, _) ? !0 : f(m, C, A, F, p, T, O, _);
|
|
1661
1661
|
};
|
|
1662
1662
|
} else
|
|
1663
1663
|
i = f;
|
|
@@ -2364,7 +2364,7 @@ function Cr(l, s) {
|
|
|
2364
2364
|
let t = 0, e = 0;
|
|
2365
2365
|
const i = 10;
|
|
2366
2366
|
s.unitary.identity(), s.diagonal.copy(l);
|
|
2367
|
-
const o = s.unitary, n = s.diagonal, r = new
|
|
2367
|
+
const o = s.unitary, n = s.diagonal, r = new g.Matrix3(), a = new g.Matrix3(), c = Number.EPSILON * Ir(n);
|
|
2368
2368
|
for (; e < i && fr(n) > c; )
|
|
2369
2369
|
pr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
|
|
2370
2370
|
return s;
|
|
@@ -2373,13 +2373,13 @@ function Tr(l) {
|
|
|
2373
2373
|
const s = [];
|
|
2374
2374
|
for (let it = 0; it < l.length - 2; it += 3) {
|
|
2375
2375
|
const Xt = l[it], J = l[it + 1], $t = l[it + 2];
|
|
2376
|
-
s.push(new
|
|
2376
|
+
s.push(new g.Vector3(Xt, J, $t));
|
|
2377
2377
|
}
|
|
2378
2378
|
const t = new dr();
|
|
2379
2379
|
t.setFromPoints(s);
|
|
2380
2380
|
const e = {
|
|
2381
|
-
unitary: new
|
|
2382
|
-
diagonal: new
|
|
2381
|
+
unitary: new g.Matrix3(),
|
|
2382
|
+
diagonal: new g.Matrix3()
|
|
2383
2383
|
}, i = t.faces, o = [], n = [];
|
|
2384
2384
|
for (let it = 0, Xt = i.length; it < Xt; it++) {
|
|
2385
2385
|
const J = i[it];
|
|
@@ -2394,7 +2394,7 @@ function Tr(l) {
|
|
|
2394
2394
|
n.push(bs.point.x, bs.point.y, bs.point.z), n.push(vs.point.x, vs.point.y, vs.point.z), n.push(Bs.point.x, Bs.point.y, Bs.point.z);
|
|
2395
2395
|
}
|
|
2396
2396
|
}
|
|
2397
|
-
const r = new
|
|
2397
|
+
const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(), h = new g.Vector3(), d = new g.Vector3(), E = new g.Vector3(), u = new g.Vector3(), f = new g.Vector3();
|
|
2398
2398
|
let R = 0, m = 0, C = 0, A = 0, F = 0, p = 0, T = 0;
|
|
2399
2399
|
for (let it = 0, Xt = n.length; it < Xt; it += 9) {
|
|
2400
2400
|
r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), h.subVectors(a, r), d.subVectors(c, r);
|
|
@@ -2402,9 +2402,9 @@ function Tr(l) {
|
|
|
2402
2402
|
f.add(E.copy(u).multiplyScalar(J)), R += J, m += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (J / 12), A += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (J / 12), p += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), T += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
|
|
2403
2403
|
}
|
|
2404
2404
|
f.divideScalar(R), m /= R, C /= R, A /= R, F /= R, p /= R, T /= R, m -= f.x * f.x, C -= f.x * f.y, A -= f.x * f.z, F -= f.y * f.y, p -= f.y * f.z, T -= f.z * f.z;
|
|
2405
|
-
const
|
|
2406
|
-
|
|
2407
|
-
const _ = e.unitary, S = new
|
|
2405
|
+
const O = new g.Matrix3();
|
|
2406
|
+
O.elements[0] = m, O.elements[1] = C, O.elements[2] = A, O.elements[3] = C, O.elements[4] = F, O.elements[5] = p, O.elements[6] = A, O.elements[7] = p, O.elements[8] = T, Cr(O, e);
|
|
2407
|
+
const _ = e.unitary, S = new g.Vector3(), N = new g.Vector3(), L = new g.Vector3();
|
|
2408
2408
|
_.extractBasis(S, N, L);
|
|
2409
2409
|
let w = -1 / 0, y = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
|
|
2410
2410
|
for (let it = 0, Xt = s.length; it < Xt; it++) {
|
|
@@ -2412,17 +2412,17 @@ function Tr(l) {
|
|
|
2412
2412
|
w = Math.max(S.dot(J), w), y = Math.max(N.dot(J), y), U = Math.max(L.dot(J), U), x = Math.min(S.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(L.dot(J), H);
|
|
2413
2413
|
}
|
|
2414
2414
|
S.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + y)), L.multiplyScalar(0.5 * (H + U));
|
|
2415
|
-
const q = new
|
|
2415
|
+
const q = new g.Vector3(), st = new g.Vector3(), Q = new g.Matrix3();
|
|
2416
2416
|
q.add(S).add(N).add(L), st.x = w - x, st.y = y - B, st.z = U - H, st.multiplyScalar(0.5), Q.copy(_);
|
|
2417
|
-
const { x: Ht, y: kt, z: Wt } = st, We = new
|
|
2417
|
+
const { x: Ht, y: kt, z: Wt } = st, We = new g.Matrix4();
|
|
2418
2418
|
We.makeScale(Ht * 2, kt * 2, Wt * 2);
|
|
2419
|
-
const Ce = new
|
|
2419
|
+
const Ce = new g.Matrix4();
|
|
2420
2420
|
Ce.makeTranslation(-Ht, -kt, -Wt);
|
|
2421
|
-
const yi = new
|
|
2421
|
+
const yi = new g.Matrix4();
|
|
2422
2422
|
yi.makeTranslation(q.x, q.y, q.z);
|
|
2423
|
-
const Mi = new
|
|
2423
|
+
const Mi = new g.Matrix4();
|
|
2424
2424
|
Mi.setFromMatrix3(Q);
|
|
2425
|
-
const Te = new
|
|
2425
|
+
const Te = new g.Matrix4();
|
|
2426
2426
|
return Te.multiply(yi), Te.multiply(Mi), Te.multiply(Ce), Te.multiply(We), { center: q, halfSizes: st, rotation: Q, transformation: Te };
|
|
2427
2427
|
}
|
|
2428
2428
|
function mr(l, s, t) {
|
|
@@ -2832,7 +2832,7 @@ class ea extends et {
|
|
|
2832
2832
|
return n ? (this.workingPlane ? Math.abs(this.workingPlane.distanceToPoint(n)) < 1e-3 : !0) ? ((this._pickedPoint === null || !this._pickedPoint.equals(n)) && (this._pickedPoint = n.clone(), this.onVertexFound.trigger(this._pickedPoint)), this._pickedPoint) : (this._pickedPoint = null, this._pickedPoint) : (this._pickedPoint !== null && (this.onVertexLost.trigger(), this._pickedPoint = null), this._pickedPoint);
|
|
2833
2833
|
}
|
|
2834
2834
|
getClosestVertex(t) {
|
|
2835
|
-
let e = new
|
|
2835
|
+
let e = new g.Vector3(), i = !1, o = Number.MAX_SAFE_INTEGER;
|
|
2836
2836
|
const n = this.getVertices(t);
|
|
2837
2837
|
if (n === null)
|
|
2838
2838
|
return null;
|
|
@@ -2848,7 +2848,7 @@ class ea extends et {
|
|
|
2848
2848
|
const e = t.object;
|
|
2849
2849
|
if (!t.face || !e)
|
|
2850
2850
|
return null;
|
|
2851
|
-
const i = e.geometry, o = new
|
|
2851
|
+
const i = e.geometry, o = new g.Matrix4(), { instanceId: n } = t, r = n !== void 0, a = e instanceof g.InstancedMesh;
|
|
2852
2852
|
return a && r && e.getMatrixAt(n, o), [
|
|
2853
2853
|
this.getVertex(t.face.a, i),
|
|
2854
2854
|
this.getVertex(t.face.b, i),
|
|
@@ -2859,7 +2859,7 @@ class ea extends et {
|
|
|
2859
2859
|
if (t === void 0)
|
|
2860
2860
|
return null;
|
|
2861
2861
|
const i = e.attributes.position;
|
|
2862
|
-
return new
|
|
2862
|
+
return new g.Vector3(
|
|
2863
2863
|
i.getX(t),
|
|
2864
2864
|
i.getY(t),
|
|
2865
2865
|
i.getZ(t)
|
|
@@ -2889,7 +2889,7 @@ const Fs = class Fs {
|
|
|
2889
2889
|
e.enabled && e.isUpdateable() && e.update(s);
|
|
2890
2890
|
requestAnimationFrame(this.update);
|
|
2891
2891
|
});
|
|
2892
|
-
this._clock = new
|
|
2892
|
+
this._clock = new g.Clock(), Fs.setupBVH();
|
|
2893
2893
|
}
|
|
2894
2894
|
/**
|
|
2895
2895
|
* Adds a component to the list of components.
|
|
@@ -2962,18 +2962,18 @@ const Fs = class Fs {
|
|
|
2962
2962
|
this._clock.stop(), this.onDisposed.trigger(), this.onDisposed.reset();
|
|
2963
2963
|
}
|
|
2964
2964
|
static setupBVH() {
|
|
2965
|
-
|
|
2965
|
+
g.BufferGeometry.prototype.computeBoundsTree = or, g.BufferGeometry.prototype.disposeBoundsTree = rr, g.Mesh.prototype.raycast = nr;
|
|
2966
2966
|
}
|
|
2967
2967
|
};
|
|
2968
2968
|
/**
|
|
2969
2969
|
* The version of the @thatopen/components library.
|
|
2970
2970
|
*/
|
|
2971
|
-
I(Fs, "release", "2.1.
|
|
2971
|
+
I(Fs, "release", "2.1.4");
|
|
2972
2972
|
let pi = Fs;
|
|
2973
2973
|
class Rr {
|
|
2974
2974
|
constructor(s) {
|
|
2975
2975
|
I(this, "_event");
|
|
2976
|
-
I(this, "_position", new
|
|
2976
|
+
I(this, "_position", new g.Vector2());
|
|
2977
2977
|
/** {@link Disposable.onDisposed} */
|
|
2978
2978
|
I(this, "onDisposed", new D());
|
|
2979
2979
|
I(this, "updateMouseInfo", (s) => {
|
|
@@ -3019,7 +3019,7 @@ class Ar {
|
|
|
3019
3019
|
* A reference to the Three.js Raycaster instance.
|
|
3020
3020
|
* This is used for raycasting operations.
|
|
3021
3021
|
*/
|
|
3022
|
-
I(this, "three", new
|
|
3022
|
+
I(this, "three", new g.Raycaster());
|
|
3023
3023
|
/**
|
|
3024
3024
|
* A reference to the world instance to which this Raycaster belongs.
|
|
3025
3025
|
* This is used to access the camera and meshes.
|
|
@@ -3077,7 +3077,7 @@ class Ar {
|
|
|
3077
3077
|
);
|
|
3078
3078
|
}
|
|
3079
3079
|
}
|
|
3080
|
-
const
|
|
3080
|
+
const Os = class Os extends et {
|
|
3081
3081
|
constructor(t) {
|
|
3082
3082
|
super(t);
|
|
3083
3083
|
/** {@link Component.enabled} */
|
|
@@ -3089,7 +3089,7 @@ const gs = class gs extends et {
|
|
|
3089
3089
|
I(this, "list", /* @__PURE__ */ new Map());
|
|
3090
3090
|
/** {@link Disposable.onDisposed} */
|
|
3091
3091
|
I(this, "onDisposed", new D());
|
|
3092
|
-
t.add(
|
|
3092
|
+
t.add(Os.uuid, this);
|
|
3093
3093
|
}
|
|
3094
3094
|
/**
|
|
3095
3095
|
* Retrieves a SimpleRaycaster instance for the given world.
|
|
@@ -3129,8 +3129,8 @@ const gs = class gs extends et {
|
|
|
3129
3129
|
* A unique identifier for the component.
|
|
3130
3130
|
* This UUID is used to register the component within the Components system.
|
|
3131
3131
|
*/
|
|
3132
|
-
I(
|
|
3133
|
-
let ze =
|
|
3132
|
+
I(Os, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
|
|
3133
|
+
let ze = Os;
|
|
3134
3134
|
class Fr extends Si {
|
|
3135
3135
|
constructor() {
|
|
3136
3136
|
super(...arguments);
|
|
@@ -3249,26 +3249,26 @@ class sa extends lr {
|
|
|
3249
3249
|
*/
|
|
3250
3250
|
I(this, "config", {
|
|
3251
3251
|
directionalLight: {
|
|
3252
|
-
color: new
|
|
3252
|
+
color: new g.Color("white"),
|
|
3253
3253
|
intensity: 1.5,
|
|
3254
|
-
position: new
|
|
3254
|
+
position: new g.Vector3(5, 10, 3)
|
|
3255
3255
|
},
|
|
3256
3256
|
ambientLight: {
|
|
3257
|
-
color: new
|
|
3257
|
+
color: new g.Color("white"),
|
|
3258
3258
|
intensity: 1
|
|
3259
3259
|
}
|
|
3260
3260
|
});
|
|
3261
|
-
this.three = new
|
|
3261
|
+
this.three = new g.Scene(), this.three.background = new g.Color(2107698);
|
|
3262
3262
|
}
|
|
3263
3263
|
/** {@link Configurable.setup} */
|
|
3264
3264
|
setup(t) {
|
|
3265
3265
|
this.config = { ...this.config, ...t };
|
|
3266
|
-
const e = new
|
|
3266
|
+
const e = new g.DirectionalLight(
|
|
3267
3267
|
this.config.directionalLight.color,
|
|
3268
3268
|
this.config.directionalLight.intensity
|
|
3269
3269
|
);
|
|
3270
3270
|
e.position.copy(this.config.directionalLight.position);
|
|
3271
|
-
const i = new
|
|
3271
|
+
const i = new g.AmbientLight(
|
|
3272
3272
|
this.config.ambientLight.color,
|
|
3273
3273
|
this.config.ambientLight.intensity
|
|
3274
3274
|
);
|
|
@@ -3309,7 +3309,7 @@ class ia extends cr {
|
|
|
3309
3309
|
return;
|
|
3310
3310
|
this._resizing = !0, this.onContainerUpdated.trigger();
|
|
3311
3311
|
const e = t ? t.x : this.container.clientWidth, i = t ? t.y : this.container.clientHeight;
|
|
3312
|
-
this.three.setSize(e, i), this.onResize.trigger(new
|
|
3312
|
+
this.three.setSize(e, i), this.onResize.trigger(new g.Vector2(e, i)), this._resizing = !1;
|
|
3313
3313
|
});
|
|
3314
3314
|
I(this, "resizeEvent", () => {
|
|
3315
3315
|
this.resize();
|
|
@@ -3318,14 +3318,14 @@ class ia extends cr {
|
|
|
3318
3318
|
t.preventDefault(), this.enabled = !1;
|
|
3319
3319
|
});
|
|
3320
3320
|
I(this, "onContextBack", () => {
|
|
3321
|
-
this.three.setRenderTarget(null), this.three.dispose(), this.three = new
|
|
3321
|
+
this.three.setRenderTarget(null), this.three.dispose(), this.three = new g.WebGLRenderer({
|
|
3322
3322
|
canvas: this._canvas,
|
|
3323
3323
|
antialias: !0,
|
|
3324
3324
|
alpha: !0,
|
|
3325
3325
|
...this._parameters
|
|
3326
3326
|
}), this.enabled = !0;
|
|
3327
3327
|
});
|
|
3328
|
-
this.container = e, this._parameters = i, this.three = new
|
|
3328
|
+
this.container = e, this._parameters = i, this.three = new g.WebGLRenderer({
|
|
3329
3329
|
antialias: !0,
|
|
3330
3330
|
alpha: !0,
|
|
3331
3331
|
...i
|
|
@@ -3347,7 +3347,7 @@ class ia extends cr {
|
|
|
3347
3347
|
}
|
|
3348
3348
|
/** {@link Resizeable.getSize}. */
|
|
3349
3349
|
getSize() {
|
|
3350
|
-
return new
|
|
3350
|
+
return new g.Vector2(
|
|
3351
3351
|
this.three.domElement.clientWidth,
|
|
3352
3352
|
this.three.domElement.clientHeight
|
|
3353
3353
|
);
|
|
@@ -3448,8 +3448,8 @@ function rn(l, s, t, e, i = 1 / 0, o, n) {
|
|
|
3448
3448
|
u = u / B * F, f = f / B * F, R = R / B * F;
|
|
3449
3449
|
}
|
|
3450
3450
|
h = l.x - u, d = l.y - f, E = l.z - R;
|
|
3451
|
-
const
|
|
3452
|
-
t.x = (t.x - r *
|
|
3451
|
+
const O = (t.x + r * u) * o, _ = (t.y + r * f) * o, S = (t.z + r * R) * o;
|
|
3452
|
+
t.x = (t.x - r * O) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x = h + (u + O) * c, n.y = d + (f + _) * c, n.z = E + (R + S) * c;
|
|
3453
3453
|
const N = m - l.x, L = C - l.y, w = A - l.z, y = n.x - m, U = n.y - C, x = n.z - A;
|
|
3454
3454
|
return N * y + L * U + w * x > 0 && (n.x = m, n.y = C, n.z = A, t.x = (n.x - m) / o, t.y = (n.y - C) / o, t.z = (n.z - A) / o), n;
|
|
3455
3455
|
}
|
|
@@ -3461,7 +3461,7 @@ function $s(l, s) {
|
|
|
3461
3461
|
function Js(l, s) {
|
|
3462
3462
|
return bt(l) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
|
|
3463
3463
|
}
|
|
3464
|
-
class
|
|
3464
|
+
class Or {
|
|
3465
3465
|
constructor() {
|
|
3466
3466
|
this._listeners = {};
|
|
3467
3467
|
}
|
|
@@ -3525,9 +3525,9 @@ class gr {
|
|
|
3525
3525
|
}
|
|
3526
3526
|
}
|
|
3527
3527
|
}
|
|
3528
|
-
const
|
|
3529
|
-
let Y, an, ds, ti, lt, G, z, Ee, Le,
|
|
3530
|
-
class ot extends
|
|
3528
|
+
const gr = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Sr = !(bn && "PointerEvent" in window);
|
|
3529
|
+
let Y, an, ds, ti, lt, G, z, Ee, Le, gt, _t, Qt, cn, ln, ut, ye, de, hn, ei, En, si, ii, us;
|
|
3530
|
+
class ot extends Or {
|
|
3531
3531
|
/**
|
|
3532
3532
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
3533
3533
|
*
|
|
@@ -3569,7 +3569,7 @@ class ot extends gr {
|
|
|
3569
3569
|
* @category Statics
|
|
3570
3570
|
*/
|
|
3571
3571
|
static install(s) {
|
|
3572
|
-
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(),
|
|
3572
|
+
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(), gt = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), ut = new Y.Spherical(), ye = new Y.Spherical(), de = new Y.Box3(), hn = new Y.Box3(), ei = new Y.Sphere(), En = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), us = new Y.Raycaster();
|
|
3573
3573
|
}
|
|
3574
3574
|
/**
|
|
3575
3575
|
* list all ACTIONs
|
|
@@ -3597,7 +3597,7 @@ class ot extends gr {
|
|
|
3597
3597
|
*/
|
|
3598
3598
|
constructor(s, t) {
|
|
3599
3599
|
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.verticalDragToForward = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
3600
|
-
}, this._enabled = !0, this._state = P.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 = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (p, T,
|
|
3600
|
+
}, this._enabled = !0, this._state = P.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 = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (p, T, O) => {
|
|
3601
3601
|
let _, S;
|
|
3602
3602
|
if (Zt(this._camera)) {
|
|
3603
3603
|
const N = G.copy(this._camera.position).sub(this._target), L = this._camera.getEffectiveFOV() * Se, w = N.length() * Math.tan(L * 0.5);
|
|
@@ -3607,16 +3607,16 @@ class ot extends gr {
|
|
|
3607
3607
|
_ = p * (N.right - N.left) / N.zoom / this._elementRect.width, S = T * (N.top - N.bottom) / N.zoom / this._elementRect.height;
|
|
3608
3608
|
} else
|
|
3609
3609
|
return;
|
|
3610
|
-
this.verticalDragToForward ? (
|
|
3610
|
+
this.verticalDragToForward ? (O ? this.setFocalOffset(this._focalOffsetEnd.x + _, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(_, 0, !0), this.forward(-S, !0)) : O ? this.setFocalOffset(this._focalOffsetEnd.x + _, this._focalOffsetEnd.y + S, this._focalOffsetEnd.z, !0) : this.truck(_, S, !0);
|
|
3611
3611
|
}, this._rotateInternal = (p, T) => {
|
|
3612
|
-
const
|
|
3613
|
-
this.rotate(
|
|
3614
|
-
}, this._dollyInternal = (p, T,
|
|
3612
|
+
const O = he * this.azimuthRotateSpeed * p / this._elementRect.height, _ = he * this.polarRotateSpeed * T / this._elementRect.height;
|
|
3613
|
+
this.rotate(O, _, !0);
|
|
3614
|
+
}, this._dollyInternal = (p, T, O) => {
|
|
3615
3615
|
const _ = Math.pow(0.95, -p * this.dollySpeed), S = this._sphericalEnd.radius, N = this._sphericalEnd.radius * _, L = mt(N, this.minDistance, this.maxDistance), w = L - N;
|
|
3616
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - S, this._dollyControlCoord.set(T,
|
|
3617
|
-
}, this._zoomInternal = (p, T,
|
|
3616
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - S, this._dollyControlCoord.set(T, O)), this._lastDollyDirection = Math.sign(-p);
|
|
3617
|
+
}, this._zoomInternal = (p, T, O) => {
|
|
3618
3618
|
const _ = Math.pow(0.95, p * this.dollySpeed), S = this._zoom, N = this._zoom * _;
|
|
3619
|
-
this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - S, this._dollyControlCoord.set(T,
|
|
3619
|
+
this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - S, this._dollyControlCoord.set(T, O));
|
|
3620
3620
|
}, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, ds), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = P.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), 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 = [
|
|
3621
3621
|
new Y.Vector3(),
|
|
3622
3622
|
new Y.Vector3(),
|
|
@@ -3647,7 +3647,7 @@ class ot extends gr {
|
|
|
3647
3647
|
}
|
|
3648
3648
|
if ((p.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
|
|
3649
3649
|
return;
|
|
3650
|
-
const
|
|
3650
|
+
const O = {
|
|
3651
3651
|
pointerId: p.pointerId,
|
|
3652
3652
|
clientX: p.clientX,
|
|
3653
3653
|
clientY: p.clientY,
|
|
@@ -3655,7 +3655,7 @@ class ot extends gr {
|
|
|
3655
3655
|
deltaY: 0,
|
|
3656
3656
|
mouseButton: T
|
|
3657
3657
|
};
|
|
3658
|
-
this._activePointers.push(
|
|
3658
|
+
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, R(p);
|
|
3659
3659
|
}, r = (p) => {
|
|
3660
3660
|
if (!this._enabled || !this._domElement || this._lockedPointer)
|
|
3661
3661
|
return;
|
|
@@ -3669,7 +3669,7 @@ class ot extends gr {
|
|
|
3669
3669
|
const _ = this._findPointerByMouseButton(T);
|
|
3670
3670
|
_ && this._disposePointer(_);
|
|
3671
3671
|
}
|
|
3672
|
-
const
|
|
3672
|
+
const O = {
|
|
3673
3673
|
pointerId: 1,
|
|
3674
3674
|
clientX: p.clientX,
|
|
3675
3675
|
clientY: p.clientY,
|
|
@@ -3677,12 +3677,12 @@ class ot extends gr {
|
|
|
3677
3677
|
deltaY: 0,
|
|
3678
3678
|
mouseButton: (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.LEFT ? V.MIDDLE : (p.buttons & V.RIGHT) === V.LEFT ? V.RIGHT : null
|
|
3679
3679
|
};
|
|
3680
|
-
this._activePointers.push(
|
|
3680
|
+
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", c), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(p);
|
|
3681
3681
|
}, a = (p) => {
|
|
3682
3682
|
p.cancelable && p.preventDefault();
|
|
3683
|
-
const T = p.pointerId,
|
|
3684
|
-
if (
|
|
3685
|
-
if (
|
|
3683
|
+
const T = p.pointerId, O = this._lockedPointer || this._findPointerById(T);
|
|
3684
|
+
if (O) {
|
|
3685
|
+
if (O.clientX = p.clientX, O.clientY = p.clientY, O.deltaX = p.movementX, O.deltaY = p.movementY, this._state = 0, p.pointerType === "touch")
|
|
3686
3686
|
switch (this._activePointers.length) {
|
|
3687
3687
|
case 1:
|
|
3688
3688
|
this._state = this.touches.one;
|
|
@@ -3740,7 +3740,7 @@ class ot extends gr {
|
|
|
3740
3740
|
const N = performance.now();
|
|
3741
3741
|
E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
|
|
3742
3742
|
}
|
|
3743
|
-
const T = _r ? -1 : -3,
|
|
3743
|
+
const T = _r ? -1 : -3, O = p.deltaMode === 1 ? p.deltaY / T : p.deltaY / (T * 10), _ = this.dollyToCursor ? (p.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (p.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3744
3744
|
switch (this.mouseButtons.wheel) {
|
|
3745
3745
|
case P.ROTATE: {
|
|
3746
3746
|
this._rotateInternal(p.deltaX, p.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -3755,11 +3755,11 @@ class ot extends gr {
|
|
|
3755
3755
|
break;
|
|
3756
3756
|
}
|
|
3757
3757
|
case P.DOLLY: {
|
|
3758
|
-
this._dollyInternal(-
|
|
3758
|
+
this._dollyInternal(-O, _, S), this._isUserControllingDolly = !0;
|
|
3759
3759
|
break;
|
|
3760
3760
|
}
|
|
3761
3761
|
case P.ZOOM: {
|
|
3762
|
-
this._zoomInternal(-
|
|
3762
|
+
this._zoomInternal(-O, _, S), this._isUserControllingZoom = !0;
|
|
3763
3763
|
break;
|
|
3764
3764
|
}
|
|
3765
3765
|
}
|
|
@@ -3767,8 +3767,8 @@ class ot extends gr {
|
|
|
3767
3767
|
}, f = (p) => {
|
|
3768
3768
|
if (!(!this._domElement || !this._enabled)) {
|
|
3769
3769
|
if (this.mouseButtons.right === ot.ACTION.NONE) {
|
|
3770
|
-
const T = p instanceof PointerEvent ? p.pointerId : (p instanceof MouseEvent, 0),
|
|
3771
|
-
|
|
3770
|
+
const T = p instanceof PointerEvent ? p.pointerId : (p instanceof MouseEvent, 0), O = this._findPointerById(T);
|
|
3771
|
+
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
|
|
3772
3772
|
return;
|
|
3773
3773
|
}
|
|
3774
3774
|
p.preventDefault();
|
|
@@ -3777,7 +3777,7 @@ class ot extends gr {
|
|
|
3777
3777
|
if (!this._enabled)
|
|
3778
3778
|
return;
|
|
3779
3779
|
if ($s(this._activePointers, lt), this._getClientRect(this._elementRect), e.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
|
|
3780
|
-
const
|
|
3780
|
+
const O = lt.x - this._activePointers[1].clientX, _ = lt.y - this._activePointers[1].clientY, S = Math.sqrt(O * O + _ * _);
|
|
3781
3781
|
o.set(0, S);
|
|
3782
3782
|
const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, L = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
3783
3783
|
i.set(N, L);
|
|
@@ -3803,8 +3803,8 @@ class ot extends gr {
|
|
|
3803
3803
|
if (!this._enabled || !this._dragNeedsUpdate)
|
|
3804
3804
|
return;
|
|
3805
3805
|
this._dragNeedsUpdate = !1, $s(this._activePointers, lt);
|
|
3806
|
-
const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null,
|
|
3807
|
-
if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(
|
|
3806
|
+
const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = T ? -T.deltaX : i.x - lt.x, _ = T ? -T.deltaY : i.y - lt.y;
|
|
3807
|
+
if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, _), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
|
|
3808
3808
|
const S = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, L = this.dollyDragInverted ? -1 : 1;
|
|
3809
3809
|
(this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(L * _ * Es, S, N), this._isUserControllingDolly = !0) : (this._zoomInternal(L * _ * Es, S, N), this._isUserControllingZoom = !0);
|
|
3810
3810
|
}
|
|
@@ -3814,7 +3814,7 @@ class ot extends gr {
|
|
|
3814
3814
|
const y = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3815
3815
|
(this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * Es, y, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * Es, y, U), this._isUserControllingZoom = !0);
|
|
3816
3816
|
}
|
|
3817
|
-
((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(
|
|
3817
|
+
((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, _, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, _, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
3818
3818
|
}, C = () => {
|
|
3819
3819
|
$s(this._activePointers, lt), i.copy(lt), 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("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
|
|
3820
3820
|
};
|
|
@@ -4137,8 +4137,8 @@ class ot extends gr {
|
|
|
4137
4137
|
* @category Methods
|
|
4138
4138
|
*/
|
|
4139
4139
|
truck(s, t, e = !1) {
|
|
4140
|
-
this._camera.updateMatrix(),
|
|
4141
|
-
const i = G.copy(
|
|
4140
|
+
this._camera.updateMatrix(), gt.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), gt.multiplyScalar(s), _t.multiplyScalar(-t);
|
|
4141
|
+
const i = G.copy(gt).add(_t), o = z.copy(this._targetEnd).add(i);
|
|
4142
4142
|
return this.moveTo(o.x, o.y, o.z, e);
|
|
4143
4143
|
}
|
|
4144
4144
|
/**
|
|
@@ -4282,8 +4282,8 @@ class ot extends gr {
|
|
|
4282
4282
|
ye.setFromVector3(A.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
|
|
4283
4283
|
const F = ye.theta - ut.theta, p = ye.phi - ut.phi, T = ye.radius - ut.radius;
|
|
4284
4284
|
this._sphericalEnd.set(ut.radius + T * u, ut.phi + p * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, f || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
4285
|
-
const
|
|
4286
|
-
return this._createOnRestPromise(
|
|
4285
|
+
const O = !f || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
|
|
4286
|
+
return this._createOnRestPromise(O);
|
|
4287
4287
|
}
|
|
4288
4288
|
/**
|
|
4289
4289
|
* Set angle and distance by given position.
|
|
@@ -4332,9 +4332,9 @@ class ot extends gr {
|
|
|
4332
4332
|
* @category Methods
|
|
4333
4333
|
*/
|
|
4334
4334
|
setOrbitPoint(s, t, e) {
|
|
4335
|
-
this._camera.updateMatrixWorld(),
|
|
4335
|
+
this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), _t.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
4336
4336
|
const i = G.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
|
|
4337
|
-
|
|
4337
|
+
gt.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(gt).add(_t).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
|
|
4338
4338
|
}
|
|
4339
4339
|
/**
|
|
4340
4340
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -4526,8 +4526,8 @@ class ot extends gr {
|
|
|
4526
4526
|
if (Zt(this._camera) && this._changedDolly !== 0) {
|
|
4527
4527
|
const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(Le), f = G.copy(u).cross(E.up).normalize();
|
|
4528
4528
|
f.lengthSq() === 0 && (f.x = 1);
|
|
4529
|
-
const R = z.crossVectors(f, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Se * 0.5), A = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * m)), p = G.copy(this._targetEnd).lerp(F, A), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance,
|
|
4530
|
-
if (this.infinityDolly && (T ||
|
|
4529
|
+
const R = z.crossVectors(f, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Se * 0.5), A = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * m)), p = G.copy(this._targetEnd).lerp(F, A), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
|
|
4530
|
+
if (this.infinityDolly && (T || O)) {
|
|
4531
4531
|
this._sphericalEnd.radius -= d, this._spherical.radius -= d;
|
|
4532
4532
|
const S = z.copy(u).multiplyScalar(-d);
|
|
4533
4533
|
p.add(S);
|
|
@@ -4536,15 +4536,15 @@ class ot extends gr {
|
|
|
4536
4536
|
const _ = z.subVectors(p, this._targetEnd);
|
|
4537
4537
|
this._targetEnd.copy(p), this._target.add(_), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
|
|
4538
4538
|
} else if (bt(this._camera) && this._changedZoom !== 0) {
|
|
4539
|
-
const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), f = z.set(0, 0, -1).applyQuaternion(E.quaternion), R = Ee.copy(u).add(f.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, A = this._getCameraDirection(Le), F = this._targetEnd.dot(A), p = G.copy(this._targetEnd).lerp(R, C), T = p.dot(A),
|
|
4540
|
-
p.sub(
|
|
4539
|
+
const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), f = z.set(0, 0, -1).applyQuaternion(E.quaternion), R = Ee.copy(u).add(f.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, A = this._getCameraDirection(Le), F = this._targetEnd.dot(A), p = G.copy(this._targetEnd).lerp(R, C), T = p.dot(A), O = A.multiplyScalar(T - F);
|
|
4540
|
+
p.sub(O), this._boundary.clampPoint(p, p);
|
|
4541
4541
|
const _ = z.subVectors(p, this._targetEnd);
|
|
4542
4542
|
this._targetEnd.copy(p), this._target.add(_), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
|
|
4543
4543
|
}
|
|
4544
4544
|
}
|
|
4545
4545
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
4546
4546
|
const a = this._collisionTest();
|
|
4547
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(),
|
|
4547
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
|
|
4548
4548
|
const h = this._needsUpdate;
|
|
4549
4549
|
return h && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : h ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !h && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = h, this._needsUpdate = !1, h;
|
|
4550
4550
|
}
|
|
@@ -4598,7 +4598,7 @@ class ot extends gr {
|
|
|
4598
4598
|
console.warn("camera-controls is already connected.");
|
|
4599
4599
|
return;
|
|
4600
4600
|
}
|
|
4601
|
-
s.setAttribute("data-camera-controls-version",
|
|
4601
|
+
s.setAttribute("data-camera-controls-version", gr), this._addAllEventListeners(s), this._getClientRect(this._elementRect);
|
|
4602
4602
|
}
|
|
4603
4603
|
/**
|
|
4604
4604
|
* Detach all internal event handlers to disable drag control.
|
|
@@ -4770,7 +4770,7 @@ class He extends ar {
|
|
|
4770
4770
|
I(this, "updateAspect", () => {
|
|
4771
4771
|
var t;
|
|
4772
4772
|
if (!(!this.currentWorld || !this.currentWorld.renderer)) {
|
|
4773
|
-
if (this.three instanceof
|
|
4773
|
+
if (this.three instanceof g.OrthographicCamera) {
|
|
4774
4774
|
this.onAspectUpdated.trigger();
|
|
4775
4775
|
return;
|
|
4776
4776
|
}
|
|
@@ -4835,8 +4835,8 @@ class He extends ar {
|
|
|
4835
4835
|
this.enabled && (this.onBeforeUpdate.trigger(this), this.controls.update(t), this.onAfterUpdate.trigger(this));
|
|
4836
4836
|
}
|
|
4837
4837
|
setupCamera() {
|
|
4838
|
-
const t = window.innerWidth / window.innerHeight, e = new
|
|
4839
|
-
return e.position.set(50, 50, 50), e.lookAt(new
|
|
4838
|
+
const t = window.innerWidth / window.innerHeight, e = new g.PerspectiveCamera(60, t, 1, 1e3);
|
|
4839
|
+
return e.position.set(50, 50, 50), e.lookAt(new g.Vector3(0, 0, 0)), e;
|
|
4840
4840
|
}
|
|
4841
4841
|
newCameraControls() {
|
|
4842
4842
|
if (!this.currentWorld)
|
|
@@ -4852,21 +4852,21 @@ class He extends ar {
|
|
|
4852
4852
|
}
|
|
4853
4853
|
static getSubsetOfThree() {
|
|
4854
4854
|
return {
|
|
4855
|
-
MOUSE:
|
|
4856
|
-
Vector2:
|
|
4857
|
-
Vector3:
|
|
4858
|
-
Vector4:
|
|
4859
|
-
Quaternion:
|
|
4860
|
-
Matrix4:
|
|
4861
|
-
Spherical:
|
|
4862
|
-
Box3:
|
|
4863
|
-
Sphere:
|
|
4864
|
-
Raycaster:
|
|
4865
|
-
MathUtils:
|
|
4855
|
+
MOUSE: g.MOUSE,
|
|
4856
|
+
Vector2: g.Vector2,
|
|
4857
|
+
Vector3: g.Vector3,
|
|
4858
|
+
Vector4: g.Vector4,
|
|
4859
|
+
Quaternion: g.Quaternion,
|
|
4860
|
+
Matrix4: g.Matrix4,
|
|
4861
|
+
Spherical: g.Spherical,
|
|
4862
|
+
Box3: g.Box3,
|
|
4863
|
+
Sphere: g.Sphere,
|
|
4864
|
+
Raycaster: g.Raycaster,
|
|
4865
|
+
MathUtils: g.MathUtils
|
|
4866
4866
|
};
|
|
4867
4867
|
}
|
|
4868
4868
|
}
|
|
4869
|
-
const
|
|
4869
|
+
const gs = class gs extends et {
|
|
4870
4870
|
constructor(t) {
|
|
4871
4871
|
super(t);
|
|
4872
4872
|
/** {@link Updateable.onAfterUpdate} */
|
|
@@ -4892,7 +4892,7 @@ const Os = class Os extends et {
|
|
|
4892
4892
|
I(this, "list", /* @__PURE__ */ new Map());
|
|
4893
4893
|
/** {@link Component.enabled} */
|
|
4894
4894
|
I(this, "enabled", !0);
|
|
4895
|
-
t.add(
|
|
4895
|
+
t.add(gs.uuid, this);
|
|
4896
4896
|
}
|
|
4897
4897
|
/**
|
|
4898
4898
|
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
@@ -4948,8 +4948,8 @@ const Os = class Os extends et {
|
|
|
4948
4948
|
* A unique identifier for the component.
|
|
4949
4949
|
* This UUID is used to register the component within the Components system.
|
|
4950
4950
|
*/
|
|
4951
|
-
I(
|
|
4952
|
-
let Ci =
|
|
4951
|
+
I(gs, "uuid", "fdb61dc4-2ec1-4966-b83d-54ea795fad4a");
|
|
4952
|
+
let Ci = gs;
|
|
4953
4953
|
class Nr {
|
|
4954
4954
|
constructor(s, t, e) {
|
|
4955
4955
|
/** {@link Disposable.onDisposed} */
|
|
@@ -4967,8 +4967,8 @@ class Nr {
|
|
|
4967
4967
|
this.world = t;
|
|
4968
4968
|
const { color: i, size1: o, size2: n, distance: r } = e;
|
|
4969
4969
|
this.components = s;
|
|
4970
|
-
const a = new
|
|
4971
|
-
side:
|
|
4970
|
+
const a = new g.PlaneGeometry(2, 2, 1, 1), c = new g.ShaderMaterial({
|
|
4971
|
+
side: g.DoubleSide,
|
|
4972
4972
|
uniforms: {
|
|
4973
4973
|
uSize1: {
|
|
4974
4974
|
value: o
|
|
@@ -5057,7 +5057,7 @@ class Nr {
|
|
|
5057
5057
|
derivatives: !0
|
|
5058
5058
|
}
|
|
5059
5059
|
});
|
|
5060
|
-
this.three = new
|
|
5060
|
+
this.three = new g.Mesh(a, c), this.three.frustumCulled = !1, t.scene.three.add(this.three), this.setupEvents(!0);
|
|
5061
5061
|
}
|
|
5062
5062
|
/** {@link Hideable.visible} */
|
|
5063
5063
|
get visible() {
|
|
@@ -5107,7 +5107,7 @@ const _s = class _s extends et {
|
|
|
5107
5107
|
* The default configuration for grid creation.
|
|
5108
5108
|
*/
|
|
5109
5109
|
I(this, "config", {
|
|
5110
|
-
color: new
|
|
5110
|
+
color: new g.Color(12303291),
|
|
5111
5111
|
size1: 1,
|
|
5112
5112
|
size2: 10,
|
|
5113
5113
|
distance: 500
|
|
@@ -5402,7 +5402,7 @@ class Ur extends ri {
|
|
|
5402
5402
|
XZ: [
|
|
5403
5403
|
[new v(new rt(0.15, 0.15, 0.01), c.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5404
5404
|
]
|
|
5405
|
-
},
|
|
5405
|
+
}, O = {
|
|
5406
5406
|
X: [
|
|
5407
5407
|
[new v(new ct(0.2, 0, 0.6, 4), e), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
5408
5408
|
[new v(new ct(0.2, 0, 0.6, 4), e), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
@@ -5557,7 +5557,7 @@ class Ur extends ri {
|
|
|
5557
5557
|
}
|
|
5558
5558
|
return H;
|
|
5559
5559
|
}
|
|
5560
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), this.add(this.gizmo.rotate = x(S)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(
|
|
5560
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), this.add(this.gizmo.rotate = x(S)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(O)), this.add(this.picker.rotate = x(L)), this.add(this.picker.scale = x(y)), this.add(this.helper.translate = x(_)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
5561
5561
|
}
|
|
5562
5562
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
5563
5563
|
updateMatrixWorld(s) {
|
|
@@ -5643,7 +5643,7 @@ class Pi {
|
|
|
5643
5643
|
/**
|
|
5644
5644
|
* The THREE.js Plane object representing the clipping plane.
|
|
5645
5645
|
*/
|
|
5646
|
-
I(this, "three", new
|
|
5646
|
+
I(this, "three", new g.Plane());
|
|
5647
5647
|
/** The components instance to which this plane belongs. */
|
|
5648
5648
|
I(this, "components");
|
|
5649
5649
|
/** The world instance to which this plane belongs. */
|
|
@@ -5654,10 +5654,10 @@ class Pi {
|
|
|
5654
5654
|
I(this, "_visible", !0);
|
|
5655
5655
|
I(this, "_enabled", !0);
|
|
5656
5656
|
I(this, "_controlsActive", !1);
|
|
5657
|
-
I(this, "_arrowBoundBox", new
|
|
5657
|
+
I(this, "_arrowBoundBox", new g.Mesh());
|
|
5658
5658
|
I(this, "_planeMesh");
|
|
5659
5659
|
I(this, "_controls");
|
|
5660
|
-
I(this, "_hiddenMaterial", new
|
|
5660
|
+
I(this, "_hiddenMaterial", new g.MeshBasicMaterial({
|
|
5661
5661
|
visible: !1
|
|
5662
5662
|
}));
|
|
5663
5663
|
/** {@link Updateable.update} */
|
|
@@ -5747,7 +5747,7 @@ class Pi {
|
|
|
5747
5747
|
this._enabled = !1, this.onDraggingStarted.reset(), this.onDraggingEnded.reset(), this._helper.removeFromParent(), this.world.renderer && this.world.renderer.setPlane(!1, this.three), this._arrowBoundBox.removeFromParent(), this._arrowBoundBox.geometry.dispose(), this._planeMesh.geometry.dispose(), this._controls.removeFromParent(), this._controls.dispose(), this.onDisposed.trigger(), this.onDisposed.reset();
|
|
5748
5748
|
}
|
|
5749
5749
|
reset() {
|
|
5750
|
-
const s = new
|
|
5750
|
+
const s = new g.Vector3(1, 0, 0), t = new g.Vector3();
|
|
5751
5751
|
this.normal.equals(s) || (this.normal.copy(s), this._helper.lookAt(s)), this.origin.copy(t), this._helper.position.copy(t), this._helper.updateMatrix();
|
|
5752
5752
|
}
|
|
5753
5753
|
toggleControls(s) {
|
|
@@ -5769,7 +5769,7 @@ class Pi {
|
|
|
5769
5769
|
s.attach(this._helper), s.showX = !1, s.showY = !1, s.setSpace("local"), this.createArrowBoundingBox(), s.children[0].children[0].add(this._arrowBoundBox);
|
|
5770
5770
|
}
|
|
5771
5771
|
createArrowBoundingBox() {
|
|
5772
|
-
this._arrowBoundBox.geometry = new
|
|
5772
|
+
this._arrowBoundBox.geometry = new g.CylinderGeometry(0.18, 0.18, 1.2), this._arrowBoundBox.material = this._hiddenMaterial, this._arrowBoundBox.rotateX(Math.PI / 2), this._arrowBoundBox.updateMatrix(), this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix);
|
|
5773
5773
|
}
|
|
5774
5774
|
notifyDraggingChanged(s) {
|
|
5775
5775
|
s.value ? this.onDraggingStarted.trigger() : this.onDraggingEnded.trigger();
|
|
@@ -5778,11 +5778,11 @@ class Pi {
|
|
|
5778
5778
|
this.world.camera.enabled = this._visible;
|
|
5779
5779
|
}
|
|
5780
5780
|
newHelper() {
|
|
5781
|
-
const s = new
|
|
5781
|
+
const s = new g.Object3D();
|
|
5782
5782
|
return s.lookAt(this.normal), s.position.copy(this.origin), this._planeMesh.position.z += 0.01, s.add(this._planeMesh), this.world.scene.three.add(s), s;
|
|
5783
5783
|
}
|
|
5784
5784
|
static newPlaneMesh(s, t) {
|
|
5785
|
-
const e = new
|
|
5785
|
+
const e = new g.PlaneGeometry(1), i = new g.Mesh(e, t);
|
|
5786
5786
|
return i.scale.set(s, s, s), i;
|
|
5787
5787
|
}
|
|
5788
5788
|
}
|
|
@@ -5844,9 +5844,9 @@ const ve = class ve extends et {
|
|
|
5844
5844
|
*/
|
|
5845
5845
|
I(this, "list", []);
|
|
5846
5846
|
/** The material used in all the clipping planes. */
|
|
5847
|
-
I(this, "_material", new
|
|
5847
|
+
I(this, "_material", new g.MeshBasicMaterial({
|
|
5848
5848
|
color: 12255487,
|
|
5849
|
-
side:
|
|
5849
|
+
side: g.DoubleSide,
|
|
5850
5850
|
transparent: !0,
|
|
5851
5851
|
opacity: 0.2
|
|
5852
5852
|
}));
|
|
@@ -5976,7 +5976,7 @@ const ve = class ve extends et {
|
|
|
5976
5976
|
var a;
|
|
5977
5977
|
if (!t.renderer)
|
|
5978
5978
|
throw new Error("The given world must have a renderer!");
|
|
5979
|
-
const i = e.point.distanceTo(new
|
|
5979
|
+
const i = e.point.distanceTo(new g.Vector3(0, 0, 0)), o = (a = e.face) == null ? void 0 : a.normal;
|
|
5980
5980
|
if (!i || !o)
|
|
5981
5981
|
return null;
|
|
5982
5982
|
const n = this.getWorldNormal(e, o), r = this.newPlane(t, e.point, n.negate());
|
|
@@ -5985,11 +5985,11 @@ const ve = class ve extends et {
|
|
|
5985
5985
|
getWorldNormal(t, e) {
|
|
5986
5986
|
const i = t.object;
|
|
5987
5987
|
let o = t.object.matrixWorld.clone();
|
|
5988
|
-
if (i instanceof
|
|
5989
|
-
const c = new
|
|
5988
|
+
if (i instanceof g.InstancedMesh && t.instanceId !== void 0) {
|
|
5989
|
+
const c = new g.Matrix4();
|
|
5990
5990
|
i.getMatrixAt(t.instanceId, c), o = c.multiply(o);
|
|
5991
5991
|
}
|
|
5992
|
-
const r = new
|
|
5992
|
+
const r = new g.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
|
|
5993
5993
|
return this.normalizePlaneDirectionY(a), a;
|
|
5994
5994
|
}
|
|
5995
5995
|
normalizePlaneDirectionY(t) {
|
|
@@ -6086,7 +6086,7 @@ class Yr {
|
|
|
6086
6086
|
I(this, "autoUpdate", !0);
|
|
6087
6087
|
I(this, "updateInterval", 1e3);
|
|
6088
6088
|
I(this, "worker");
|
|
6089
|
-
I(this, "scene", new
|
|
6089
|
+
I(this, "scene", new g.Scene());
|
|
6090
6090
|
I(this, "_width", 512);
|
|
6091
6091
|
I(this, "_height", 512);
|
|
6092
6092
|
I(this, "_availableColor", 1);
|
|
@@ -6123,7 +6123,7 @@ class Yr {
|
|
|
6123
6123
|
});
|
|
6124
6124
|
if (!t.renderer)
|
|
6125
6125
|
throw new Error("The given world must have a renderer!");
|
|
6126
|
-
this.components = s, this.applySettings(e), this.world = t, this.renderer = new
|
|
6126
|
+
this.components = s, this.applySettings(e), this.world = t, this.renderer = new g.WebGLRenderer(), this.renderTarget = new g.WebGLRenderTarget(this._width, this._height), this.bufferSize = this._width * this._height * 4, this._buffer = new Uint8Array(this.bufferSize), this.renderer.clippingPlanes = t.renderer.clippingPlanes;
|
|
6127
6127
|
const i = `
|
|
6128
6128
|
addEventListener("message", (event) => {
|
|
6129
6129
|
const { buffer } = event.data;
|
|
@@ -6208,7 +6208,7 @@ class Vr extends Yr {
|
|
|
6208
6208
|
I(this, "_currentVisibleMeshes", /* @__PURE__ */ new Set());
|
|
6209
6209
|
I(this, "_recentlyHiddenMeshes", /* @__PURE__ */ new Set());
|
|
6210
6210
|
I(this, "_intervalID", null);
|
|
6211
|
-
I(this, "_transparentMat", new
|
|
6211
|
+
I(this, "_transparentMat", new g.MeshBasicMaterial({
|
|
6212
6212
|
transparent: !0,
|
|
6213
6213
|
opacity: 0
|
|
6214
6214
|
}));
|
|
@@ -6260,7 +6260,7 @@ class Vr extends Yr {
|
|
|
6260
6260
|
return;
|
|
6261
6261
|
}
|
|
6262
6262
|
this.isProcessing = !0;
|
|
6263
|
-
const e = t instanceof
|
|
6263
|
+
const e = t instanceof g.InstancedMesh, { geometry: i, material: o } = t, { colorMaterial: n, code: r } = this.getAvailableMaterial();
|
|
6264
6264
|
let a;
|
|
6265
6265
|
if (Array.isArray(o)) {
|
|
6266
6266
|
let d = !0;
|
|
@@ -6278,8 +6278,8 @@ class Vr extends Yr {
|
|
|
6278
6278
|
} else
|
|
6279
6279
|
a = n;
|
|
6280
6280
|
this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
|
|
6281
|
-
const c = e ? t.count : 1, h = new
|
|
6282
|
-
e ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new
|
|
6281
|
+
const c = e ? t.count : 1, h = new g.InstancedMesh(i, a, c);
|
|
6282
|
+
e ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new g.Matrix4()), t.visible = !1, t.updateWorldMatrix(!0, !1), h.applyMatrix4(t.matrixWorld), h.updateMatrix(), this.scene.add(h), this.colorMeshes.set(t.uuid, h), this.increaseColor(), this.isProcessing = !1;
|
|
6283
6283
|
}
|
|
6284
6284
|
/**
|
|
6285
6285
|
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
@@ -6303,17 +6303,17 @@ class Vr extends Yr {
|
|
|
6303
6303
|
this._colorCodeMeshMap.delete(o), this._meshIDColorCodeMap.delete(t.uuid), this.colorMeshes.delete(t.uuid), i.geometry = void 0, i.material = [], e.destroy(i, !0), this._recentlyHiddenMeshes.delete(t), this._currentVisibleMeshes.delete(t), this.isProcessing = !1;
|
|
6304
6304
|
}
|
|
6305
6305
|
getAvailableMaterial() {
|
|
6306
|
-
const { r: t, g: e, b: i, code: o } = this.getAvailableColor(), n =
|
|
6307
|
-
|
|
6308
|
-
const r = new
|
|
6306
|
+
const { r: t, g: e, b: i, code: o } = this.getAvailableColor(), n = g.ColorManagement.enabled;
|
|
6307
|
+
g.ColorManagement.enabled = !1;
|
|
6308
|
+
const r = new g.Color(`rgb(${t}, ${e}, ${i})`);
|
|
6309
6309
|
if (!this.world.renderer)
|
|
6310
6310
|
throw new Error("Renderer not found in the world!");
|
|
6311
|
-
const a = this.world.renderer.clippingPlanes, c = new
|
|
6311
|
+
const a = this.world.renderer.clippingPlanes, c = new g.MeshBasicMaterial({
|
|
6312
6312
|
color: r,
|
|
6313
6313
|
clippingPlanes: a,
|
|
6314
|
-
side:
|
|
6314
|
+
side: g.DoubleSide
|
|
6315
6315
|
});
|
|
6316
|
-
return
|
|
6316
|
+
return g.ColorManagement.enabled = n, { colorMaterial: c, code: o };
|
|
6317
6317
|
}
|
|
6318
6318
|
}
|
|
6319
6319
|
const Be = class Be extends et {
|
|
@@ -6401,12 +6401,12 @@ class Gr {
|
|
|
6401
6401
|
* The override material for the minimap.
|
|
6402
6402
|
* It is used to render the depth information of the world onto the minimap.
|
|
6403
6403
|
*/
|
|
6404
|
-
I(this, "overrideMaterial", new
|
|
6404
|
+
I(this, "overrideMaterial", new g.MeshDepthMaterial());
|
|
6405
6405
|
/**
|
|
6406
6406
|
* The background color of the minimap.
|
|
6407
6407
|
* It is used to set the background color of the minimap's renderer.
|
|
6408
6408
|
*/
|
|
6409
|
-
I(this, "backgroundColor", new
|
|
6409
|
+
I(this, "backgroundColor", new g.Color(395274));
|
|
6410
6410
|
/**
|
|
6411
6411
|
* The WebGL renderer for the minimap.
|
|
6412
6412
|
* It is used to render the minimap onto the screen.
|
|
@@ -6425,11 +6425,11 @@ class Gr {
|
|
|
6425
6425
|
I(this, "_lockRotation", !0);
|
|
6426
6426
|
I(this, "_camera");
|
|
6427
6427
|
I(this, "_plane");
|
|
6428
|
-
I(this, "_size", new
|
|
6429
|
-
I(this, "_tempVector1", new
|
|
6430
|
-
I(this, "_tempVector2", new
|
|
6431
|
-
I(this, "_tempTarget", new
|
|
6432
|
-
I(this, "down", new
|
|
6428
|
+
I(this, "_size", new g.Vector2(320, 160));
|
|
6429
|
+
I(this, "_tempVector1", new g.Vector3());
|
|
6430
|
+
I(this, "_tempVector2", new g.Vector3());
|
|
6431
|
+
I(this, "_tempTarget", new g.Vector3());
|
|
6432
|
+
I(this, "down", new g.Vector3(0, -1, 0));
|
|
6433
6433
|
I(this, "updatePlanes", () => {
|
|
6434
6434
|
if (!this.world.renderer)
|
|
6435
6435
|
throw new Error("The given world must have a renderer!");
|
|
@@ -6440,14 +6440,14 @@ class Gr {
|
|
|
6440
6440
|
});
|
|
6441
6441
|
if (this.world = s, !this.world.renderer)
|
|
6442
6442
|
throw new Error("The given world must have a renderer!");
|
|
6443
|
-
this.renderer = new
|
|
6443
|
+
this.renderer = new g.WebGLRenderer(), this.renderer.setSize(this._size.x, this._size.y);
|
|
6444
6444
|
const t = 1, e = this._size.x / this._size.y;
|
|
6445
|
-
this._camera = new
|
|
6445
|
+
this._camera = new g.OrthographicCamera(
|
|
6446
6446
|
t * e / -2,
|
|
6447
6447
|
t * e / 2,
|
|
6448
6448
|
t / 2,
|
|
6449
6449
|
t / -2
|
|
6450
|
-
), this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes), this._camera.position.set(0, 200, 0), this._camera.zoom = 0.1, this._camera.rotation.x = -Math.PI / 2, this._plane = new
|
|
6450
|
+
), this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes), this._camera.position.set(0, 200, 0), this._camera.zoom = 0.1, this._camera.rotation.x = -Math.PI / 2, this._plane = new g.Plane(this.down, 200), this.updatePlanes();
|
|
6451
6451
|
}
|
|
6452
6452
|
/**
|
|
6453
6453
|
* Gets or sets whether the minimap rotation is locked.
|
|
@@ -6496,7 +6496,7 @@ class Gr {
|
|
|
6496
6496
|
const s = this.world.scene.three, t = this.world.camera;
|
|
6497
6497
|
if (!t.hasCameraControls())
|
|
6498
6498
|
throw new Error("The given world must use camera controls!");
|
|
6499
|
-
if (!(s instanceof
|
|
6499
|
+
if (!(s instanceof g.Scene))
|
|
6500
6500
|
throw new Error("The given world must have a THREE.Scene as a root!");
|
|
6501
6501
|
const e = t.controls;
|
|
6502
6502
|
if (e.getPosition(this._tempVector1), this._camera.position.x = this._tempVector1.x, this._camera.position.z = this._tempVector1.z, this.frontOffset !== 0 && (e.getTarget(this._tempVector2), this._tempVector2.sub(this._tempVector1), this._tempVector2.normalize().multiplyScalar(this.frontOffset), this._camera.position.x += this._tempVector2.x, this._camera.position.z += this._tempVector2.z), !this._lockRotation) {
|
|
@@ -6601,7 +6601,7 @@ class zr {
|
|
|
6601
6601
|
}
|
|
6602
6602
|
}
|
|
6603
6603
|
setupFirstPersonCamera() {
|
|
6604
|
-
const s = this.camera.controls, t = new
|
|
6604
|
+
const s = this.camera.controls, t = new g.Vector3();
|
|
6605
6605
|
s.distance--, s.getPosition(t), s.minDistance = 1, s.maxDistance = 1, s.distance = 1, s.moveTo(
|
|
6606
6606
|
t.x,
|
|
6607
6607
|
t.y,
|
|
@@ -6624,11 +6624,11 @@ class Hr {
|
|
|
6624
6624
|
activateOrbitControls() {
|
|
6625
6625
|
const s = this.camera.controls;
|
|
6626
6626
|
s.minDistance = 1, s.maxDistance = 300;
|
|
6627
|
-
const t = new
|
|
6627
|
+
const t = new g.Vector3();
|
|
6628
6628
|
s.getPosition(t);
|
|
6629
6629
|
const e = t.length();
|
|
6630
6630
|
s.distance = e, s.truckSpeed = 2;
|
|
6631
|
-
const { rotation: i } = this.camera.three, o = new
|
|
6631
|
+
const { rotation: i } = this.camera.three, o = new g.Vector3(0, 0, -1).applyEuler(i), n = t.addScaledVector(o, e);
|
|
6632
6632
|
s.moveTo(n.x, n.y, n.z);
|
|
6633
6633
|
}
|
|
6634
6634
|
}
|
|
@@ -6705,9 +6705,9 @@ class Wr {
|
|
|
6705
6705
|
const s = this._component.currentWorld;
|
|
6706
6706
|
if (!s || !s.renderer)
|
|
6707
6707
|
return null;
|
|
6708
|
-
const t = new
|
|
6708
|
+
const t = new g.Vector3();
|
|
6709
6709
|
this._component.threePersp.getWorldDirection(t);
|
|
6710
|
-
const e = new
|
|
6710
|
+
const e = new g.Vector3();
|
|
6711
6711
|
this._component.controls.getTarget(e);
|
|
6712
6712
|
const o = e.clone().sub(this._component.threePersp.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.threePersp, c = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
|
|
6713
6713
|
return { width: c * r, height: c };
|
|
@@ -6798,16 +6798,16 @@ class na extends He {
|
|
|
6798
6798
|
async fit(t, e = 1.5) {
|
|
6799
6799
|
if (!this.enabled)
|
|
6800
6800
|
return;
|
|
6801
|
-
const i = Number.MAX_VALUE, o = Number.MIN_VALUE, n = new
|
|
6801
|
+
const i = Number.MAX_VALUE, o = Number.MIN_VALUE, n = new g.Vector3(i, i, i), r = new g.Vector3(o, o, o);
|
|
6802
6802
|
for (const u of t) {
|
|
6803
|
-
const f = new
|
|
6803
|
+
const f = new g.Box3().setFromObject(u);
|
|
6804
6804
|
f.min.x < n.x && (n.x = f.min.x), f.min.y < n.y && (n.y = f.min.y), f.min.z < n.z && (n.z = f.min.z), f.max.x > r.x && (r.x = f.max.x), f.max.y > r.y && (r.y = f.max.y), f.max.z > r.z && (r.z = f.max.z);
|
|
6805
6805
|
}
|
|
6806
|
-
const a = new
|
|
6806
|
+
const a = new g.Box3(n, r), c = new g.Vector3();
|
|
6807
6807
|
a.getSize(c);
|
|
6808
|
-
const h = new
|
|
6808
|
+
const h = new g.Vector3();
|
|
6809
6809
|
a.getCenter(h);
|
|
6810
|
-
const d = Math.max(c.x, c.y, c.z) * e, E = new
|
|
6810
|
+
const d = Math.max(c.x, c.y, c.z) * e, E = new g.Sphere(h, d);
|
|
6811
6811
|
await this.controls.fitToSphere(E, !0);
|
|
6812
6812
|
}
|
|
6813
6813
|
/**
|
|
@@ -6826,7 +6826,7 @@ class na extends He {
|
|
|
6826
6826
|
}
|
|
6827
6827
|
newOrthoCamera() {
|
|
6828
6828
|
const t = window.innerWidth / window.innerHeight;
|
|
6829
|
-
return new
|
|
6829
|
+
return new g.OrthographicCamera(
|
|
6830
6830
|
this._frustumSize * t / -2,
|
|
6831
6831
|
this._frustumSize * t / 2,
|
|
6832
6832
|
this._frustumSize / 2,
|
|
@@ -7209,6 +7209,7 @@ const Ns = class Ns extends et {
|
|
|
7209
7209
|
*/
|
|
7210
7210
|
I(this, "groups", /* @__PURE__ */ new Map());
|
|
7211
7211
|
I(this, "baseCoordinationModel", "");
|
|
7212
|
+
I(this, "baseCoordinationMatrix", new g.Matrix4());
|
|
7212
7213
|
/** {@link Component.enabled} */
|
|
7213
7214
|
I(this, "enabled", !0);
|
|
7214
7215
|
I(this, "_loader", new to());
|
|
@@ -7317,26 +7318,18 @@ const Ns = class Ns extends et {
|
|
|
7317
7318
|
* All other models are then transformed to match the base model's coordinate system.
|
|
7318
7319
|
*
|
|
7319
7320
|
* @param models - The models to apply coordinate transformation to.
|
|
7320
|
-
* If not provided, all
|
|
7321
|
-
*
|
|
7322
|
-
* @returns {void}
|
|
7321
|
+
* If not provided, all models are used.
|
|
7323
7322
|
*/
|
|
7324
7323
|
coordinate(t = Array.from(this.groups.values())) {
|
|
7325
7324
|
if (this.baseCoordinationModel.length === 0) {
|
|
7326
|
-
const
|
|
7327
|
-
if (!
|
|
7325
|
+
const i = t.pop();
|
|
7326
|
+
if (!i)
|
|
7328
7327
|
return;
|
|
7329
|
-
this.baseCoordinationModel =
|
|
7330
|
-
}
|
|
7331
|
-
if (!t.length)
|
|
7332
|
-
return;
|
|
7333
|
-
const i = this.groups.get(this.baseCoordinationModel);
|
|
7334
|
-
if (!i) {
|
|
7335
|
-
console.log("No base model found for coordination!");
|
|
7336
|
-
return;
|
|
7328
|
+
this.baseCoordinationModel = i.uuid, this.baseCoordinationMatrix = i.coordinationMatrix.clone();
|
|
7337
7329
|
}
|
|
7338
|
-
|
|
7339
|
-
|
|
7330
|
+
if (t.length)
|
|
7331
|
+
for (const i of t)
|
|
7332
|
+
i.coordinationMatrix.equals(this.baseCoordinationMatrix) || (i.position.set(0, 0, 0), i.rotation.set(0, 0, 0), i.scale.set(1, 1, 1), i.updateMatrix(), i.applyMatrix4(i.coordinationMatrix.clone().invert()), i.applyMatrix4(this.baseCoordinationMatrix));
|
|
7340
7333
|
}
|
|
7341
7334
|
};
|
|
7342
7335
|
/**
|
|
@@ -7364,7 +7357,7 @@ const At = class At extends et {
|
|
|
7364
7357
|
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
7365
7358
|
*/
|
|
7366
7359
|
static getDimensions(t) {
|
|
7367
|
-
const { min: e, max: i } = t, o = Math.abs(i.x - e.x), n = Math.abs(i.y - e.y), r = Math.abs(i.z - e.z), a = new
|
|
7360
|
+
const { min: e, max: i } = t, o = Math.abs(i.x - e.x), n = Math.abs(i.y - e.y), r = Math.abs(i.z - e.z), a = new g.Vector3();
|
|
7368
7361
|
return a.subVectors(i, e).divideScalar(2).add(e), { width: o, height: n, depth: r, center: a };
|
|
7369
7362
|
}
|
|
7370
7363
|
/**
|
|
@@ -7389,7 +7382,7 @@ const At = class At extends et {
|
|
|
7389
7382
|
*/
|
|
7390
7383
|
static newBound(t) {
|
|
7391
7384
|
const e = t ? 1 : -1;
|
|
7392
|
-
return new
|
|
7385
|
+
return new g.Vector3(
|
|
7393
7386
|
e * Number.MAX_VALUE,
|
|
7394
7387
|
e * Number.MAX_VALUE,
|
|
7395
7388
|
e * Number.MAX_VALUE
|
|
@@ -7423,7 +7416,7 @@ const At = class At extends et {
|
|
|
7423
7416
|
const o = i || this.newBound(!1), n = e || this.newBound(!0);
|
|
7424
7417
|
for (const r of t)
|
|
7425
7418
|
r.x < n.x && (n.x = r.x), r.y < n.y && (n.y = r.y), r.z < n.z && (n.z = r.z), r.x > o.x && (o.x = r.x), r.y > o.y && (o.y = r.y), r.z > o.z && (o.z = r.z);
|
|
7426
|
-
return new
|
|
7419
|
+
return new g.Box3(e, i);
|
|
7427
7420
|
}
|
|
7428
7421
|
/** {@link Disposable.dispose} */
|
|
7429
7422
|
dispose() {
|
|
@@ -7449,7 +7442,7 @@ const At = class At extends et {
|
|
|
7449
7442
|
*/
|
|
7450
7443
|
get() {
|
|
7451
7444
|
const t = this._absoluteMin.clone(), e = this._absoluteMax.clone();
|
|
7452
|
-
return new
|
|
7445
|
+
return new g.Box3(t, e);
|
|
7453
7446
|
}
|
|
7454
7447
|
/**
|
|
7455
7448
|
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
@@ -7470,8 +7463,8 @@ const At = class At extends et {
|
|
|
7470
7463
|
* ```
|
|
7471
7464
|
*/
|
|
7472
7465
|
getSphere() {
|
|
7473
|
-
const t = this._absoluteMin.clone(), e = this._absoluteMax.clone(), i = Math.abs((e.x - t.x) / 2), o = Math.abs((e.y - t.y) / 2), n = Math.abs((e.z - t.z) / 2), r = new
|
|
7474
|
-
return new
|
|
7466
|
+
const t = this._absoluteMin.clone(), e = this._absoluteMax.clone(), i = Math.abs((e.x - t.x) / 2), o = Math.abs((e.y - t.y) / 2), n = Math.abs((e.z - t.z) / 2), r = new g.Vector3(t.x + i, t.y + o, t.z + n), a = r.distanceTo(t);
|
|
7467
|
+
return new g.Sphere(r, a);
|
|
7475
7468
|
}
|
|
7476
7469
|
/**
|
|
7477
7470
|
* Returns a THREE.Mesh instance representing the bounding box.
|
|
@@ -7493,7 +7486,7 @@ const At = class At extends et {
|
|
|
7493
7486
|
* ```
|
|
7494
7487
|
*/
|
|
7495
7488
|
getMesh() {
|
|
7496
|
-
const t = new
|
|
7489
|
+
const t = new g.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new g.BoxGeometry(i, o, n), c = new g.Mesh(a);
|
|
7497
7490
|
return this._meshes.push(c), c.position.copy(r), c;
|
|
7498
7491
|
}
|
|
7499
7492
|
/**
|
|
@@ -7556,7 +7549,7 @@ const At = class At extends et {
|
|
|
7556
7549
|
return;
|
|
7557
7550
|
const i = At.getFragmentBounds(t);
|
|
7558
7551
|
t.updateMatrixWorld();
|
|
7559
|
-
const o = t.matrixWorld, n = new
|
|
7552
|
+
const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
|
|
7560
7553
|
if (e && t instanceof Vt.FragmentMesh)
|
|
7561
7554
|
for (const c of e) {
|
|
7562
7555
|
const h = t.fragment.getInstancesIDs(c);
|
|
@@ -7604,7 +7597,7 @@ const At = class At extends et {
|
|
|
7604
7597
|
}
|
|
7605
7598
|
}
|
|
7606
7599
|
static getFragmentBounds(t) {
|
|
7607
|
-
const e = t.geometry.attributes.position, i = Number.MAX_VALUE, o = -i, n = new
|
|
7600
|
+
const e = t.geometry.attributes.position, i = Number.MAX_VALUE, o = -i, n = new g.Vector3(i, i, i), r = new g.Vector3(o, o, o);
|
|
7608
7601
|
if (!t.geometry.index)
|
|
7609
7602
|
throw new Error("Geometry must be indexed!");
|
|
7610
7603
|
const a = Array.from(t.geometry.index.array);
|
|
@@ -7616,7 +7609,7 @@ const At = class At extends et {
|
|
|
7616
7609
|
const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
|
|
7617
7610
|
d < n.x && (n.x = d), E < n.y && (n.y = E), u < n.z && (n.z = u), d > r.x && (r.x = d), E > r.y && (r.y = E), u > r.z && (r.z = u);
|
|
7618
7611
|
}
|
|
7619
|
-
return new
|
|
7612
|
+
return new g.Box3(n, r);
|
|
7620
7613
|
}
|
|
7621
7614
|
};
|
|
7622
7615
|
I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
|
|
@@ -9262,7 +9255,7 @@ class Qr {
|
|
|
9262
9255
|
}
|
|
9263
9256
|
getScaleMatrix() {
|
|
9264
9257
|
const s = this.factor;
|
|
9265
|
-
return new
|
|
9258
|
+
return new g.Matrix4().fromArray([
|
|
9266
9259
|
s,
|
|
9267
9260
|
0,
|
|
9268
9261
|
0,
|
|
@@ -9398,7 +9391,7 @@ class Li {
|
|
|
9398
9391
|
}
|
|
9399
9392
|
class Vn {
|
|
9400
9393
|
constructor() {
|
|
9401
|
-
I(this, "defLineMat", new
|
|
9394
|
+
I(this, "defLineMat", new g.LineBasicMaterial({ color: 16777215 }));
|
|
9402
9395
|
}
|
|
9403
9396
|
read(s) {
|
|
9404
9397
|
const t = s.GetAllAlignments(0), e = s.GetAllCrossSections2D(0), i = s.GetAllCrossSections3D(0), o = {
|
|
@@ -9415,7 +9408,7 @@ class Vn {
|
|
|
9415
9408
|
const i = new Vt.Alignment();
|
|
9416
9409
|
i.absolute = this.getCurves(e.curve3D, i), i.horizontal = this.getCurves(e.horizontal, i), i.vertical = this.getCurves(e.vertical, i), t.set(t.size, i);
|
|
9417
9410
|
}
|
|
9418
|
-
return { alignments: t, coordinationMatrix: new
|
|
9411
|
+
return { alignments: t, coordinationMatrix: new g.Matrix4() };
|
|
9419
9412
|
}
|
|
9420
9413
|
}
|
|
9421
9414
|
getCurves(s, t) {
|
|
@@ -9433,7 +9426,7 @@ class Vn {
|
|
|
9433
9426
|
const { x: u, y: f, z: R } = r[E];
|
|
9434
9427
|
a[E * 3] = u, a[E * 3 + 1] = f, a[E * 3 + 2] = R || 0;
|
|
9435
9428
|
}
|
|
9436
|
-
const c = new
|
|
9429
|
+
const c = new g.BufferAttribute(a, 3), h = new g.EdgesGeometry();
|
|
9437
9430
|
h.setAttribute("position", c);
|
|
9438
9431
|
const d = new Vt.CurveMesh(
|
|
9439
9432
|
i,
|
|
@@ -9506,13 +9499,13 @@ const Ve = class Ve extends et {
|
|
|
9506
9499
|
I(this, "webIfc", new b.IfcAPI());
|
|
9507
9500
|
/** {@link Component.enabled} */
|
|
9508
9501
|
I(this, "enabled", !0);
|
|
9509
|
-
I(this, "_material", new
|
|
9502
|
+
I(this, "_material", new g.MeshLambertMaterial());
|
|
9510
9503
|
I(this, "_spatialTree", new Yn());
|
|
9511
9504
|
I(this, "_metaData", new Gn());
|
|
9512
9505
|
I(this, "_fragmentInstances", /* @__PURE__ */ new Map());
|
|
9513
9506
|
I(this, "_civil", new Vn());
|
|
9514
9507
|
I(this, "_visitedFragments", /* @__PURE__ */ new Map());
|
|
9515
|
-
I(this, "_materialT", new
|
|
9508
|
+
I(this, "_materialT", new g.MeshLambertMaterial({
|
|
9516
9509
|
transparent: !0,
|
|
9517
9510
|
opacity: 0.5
|
|
9518
9511
|
}));
|
|
@@ -9660,12 +9653,12 @@ const Ve = class Ve extends et {
|
|
|
9660
9653
|
for (let n = 0; n < i; n++) {
|
|
9661
9654
|
const r = t.geometries.get(n), { x: a, y: c, z: h, w: d } = r.color, E = d !== 1, { geometryExpressID: u } = r, f = `${u}-${E}`;
|
|
9662
9655
|
if (!this._visitedFragments.has(f)) {
|
|
9663
|
-
const T = this.getGeometry(this.webIfc, u),
|
|
9656
|
+
const T = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, _ = new Vt.Fragment(T, O, 1);
|
|
9664
9657
|
e.add(_.mesh), e.items.push(_);
|
|
9665
9658
|
const S = this._visitedFragments.size;
|
|
9666
9659
|
this._visitedFragments.set(f, { index: S, fragment: _ });
|
|
9667
9660
|
}
|
|
9668
|
-
const R = new
|
|
9661
|
+
const R = new g.Color().setRGB(a, c, h, "srgb"), m = new g.Matrix4();
|
|
9669
9662
|
m.fromArray(r.flatTransformation);
|
|
9670
9663
|
const C = this._visitedFragments.get(f);
|
|
9671
9664
|
if (C === void 0)
|
|
@@ -9698,7 +9691,7 @@ const Ve = class Ve extends et {
|
|
|
9698
9691
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
9699
9692
|
for (let E = 0; E < n.length; E += 6)
|
|
9700
9693
|
r[E / 2] = n[E], r[E / 2 + 1] = n[E + 1], r[E / 2 + 2] = n[E + 2], a[E / 2] = n[E + 3], a[E / 2 + 1] = n[E + 4], a[E / 2 + 2] = n[E + 5];
|
|
9701
|
-
const c = new
|
|
9694
|
+
const c = new g.BufferGeometry(), h = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
|
|
9702
9695
|
return c.setAttribute("position", h), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
|
|
9703
9696
|
}
|
|
9704
9697
|
async autoSetWasm() {
|
|
@@ -10081,7 +10074,7 @@ const Bt = class Bt extends et {
|
|
|
10081
10074
|
* This UUID is used to register the component within the Components system.
|
|
10082
10075
|
*/
|
|
10083
10076
|
I(Bt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
|
|
10084
|
-
let
|
|
10077
|
+
let On = Bt;
|
|
10085
10078
|
const Ls = class Ls extends et {
|
|
10086
10079
|
constructor(t) {
|
|
10087
10080
|
super(t);
|
|
@@ -10478,7 +10471,7 @@ const ys = class ys extends et {
|
|
|
10478
10471
|
return;
|
|
10479
10472
|
const e = this.components.get(Ai), i = this.components.get(ht), o = t ? 1 : -1;
|
|
10480
10473
|
let n = 0;
|
|
10481
|
-
const r = e.list[this.groupName], a = new
|
|
10474
|
+
const r = e.list[this.groupName], a = new g.Matrix4();
|
|
10482
10475
|
for (const c in r) {
|
|
10483
10476
|
a.elements[13] = n * o * this.height;
|
|
10484
10477
|
for (const h in r[c].map) {
|
|
@@ -10498,7 +10491,7 @@ const ys = class ys extends et {
|
|
|
10498
10491
|
* This UUID is used to register the component within the Components system.
|
|
10499
10492
|
*/
|
|
10500
10493
|
I(ys, "uuid", "d260618b-ce88-4c7d-826c-6debb91de3e2");
|
|
10501
|
-
let
|
|
10494
|
+
let gn = ys;
|
|
10502
10495
|
const Ms = class Ms extends et {
|
|
10503
10496
|
constructor(t) {
|
|
10504
10497
|
super(t);
|
|
@@ -10688,8 +10681,8 @@ const ws = class ws extends et {
|
|
|
10688
10681
|
const _ = (T == null ? void 0 : T.GlobalId.value) || (T == null ? void 0 : T.GlobalId);
|
|
10689
10682
|
n.globalToExpressIDs.set(_, p);
|
|
10690
10683
|
}
|
|
10691
|
-
const
|
|
10692
|
-
n.data.set(p, [[], [
|
|
10684
|
+
const O = this._spatialTree.itemsByFloor[p] || 0;
|
|
10685
|
+
n.data.set(p, [[], [O, m]]), r++;
|
|
10693
10686
|
}
|
|
10694
10687
|
}
|
|
10695
10688
|
this._spatialTree.cleanUp();
|
|
@@ -10724,8 +10717,8 @@ const ws = class ws extends et {
|
|
|
10724
10717
|
const c = e.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
|
|
10725
10718
|
if (!this._visitedGeometries.has(E)) {
|
|
10726
10719
|
this._visitedGeometries.has(h) || this.getGeometry(t, h);
|
|
10727
|
-
const T = this._visitedGeometries.size,
|
|
10728
|
-
this._visitedGeometries.set(E, { uuid:
|
|
10720
|
+
const T = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
|
|
10721
|
+
this._visitedGeometries.set(E, { uuid: O, index: T });
|
|
10729
10722
|
}
|
|
10730
10723
|
const u = this._visitedGeometries.get(E);
|
|
10731
10724
|
if (u === void 0)
|
|
@@ -10928,7 +10921,7 @@ const Ds = class Ds extends et {
|
|
|
10928
10921
|
* @returns The distance from the point to the line segment.
|
|
10929
10922
|
*/
|
|
10930
10923
|
static distanceFromPointToLine(t, e, i, o = !1) {
|
|
10931
|
-
const n = new
|
|
10924
|
+
const n = new g.Line3(), r = new g.Vector3();
|
|
10932
10925
|
return n.set(e, i), n.closestPointToPoint(t, o, r), r.distanceTo(t);
|
|
10933
10926
|
}
|
|
10934
10927
|
/**
|
|
@@ -10962,14 +10955,14 @@ const Ds = class Ds extends et {
|
|
|
10962
10955
|
const f = /* @__PURE__ */ new Map();
|
|
10963
10956
|
for (const { id: T } of u)
|
|
10964
10957
|
if (h.has(T)) {
|
|
10965
|
-
const
|
|
10966
|
-
f.set(T,
|
|
10958
|
+
const O = h.get(T);
|
|
10959
|
+
f.set(T, O);
|
|
10967
10960
|
}
|
|
10968
10961
|
const R = u.map((T) => T.id);
|
|
10969
10962
|
if (!f.size) {
|
|
10970
10963
|
const T = c++;
|
|
10971
|
-
for (const { id:
|
|
10972
|
-
h.set(
|
|
10964
|
+
for (const { id: O } of u)
|
|
10965
|
+
h.set(O, T);
|
|
10973
10966
|
d.set(T, {
|
|
10974
10967
|
edges: new Set(R),
|
|
10975
10968
|
indices: /* @__PURE__ */ new Set([E])
|
|
@@ -10978,9 +10971,9 @@ const Ds = class Ds extends et {
|
|
|
10978
10971
|
}
|
|
10979
10972
|
let m = null;
|
|
10980
10973
|
const C = /* @__PURE__ */ new Set(), A = new Set(R);
|
|
10981
|
-
for (const [T,
|
|
10982
|
-
m === null ? m =
|
|
10983
|
-
const { edges: _ } = d.get(
|
|
10974
|
+
for (const [T, O] of f) {
|
|
10975
|
+
m === null ? m = O : O !== m && C.add(O), h.delete(T);
|
|
10976
|
+
const { edges: _ } = d.get(O);
|
|
10984
10977
|
_.delete(T), A.delete(T);
|
|
10985
10978
|
}
|
|
10986
10979
|
if (m === null)
|
|
@@ -10989,11 +10982,11 @@ const Ds = class Ds extends et {
|
|
|
10989
10982
|
p.add(E);
|
|
10990
10983
|
for (const T of A) {
|
|
10991
10984
|
h.set(T, m);
|
|
10992
|
-
const { edges:
|
|
10993
|
-
|
|
10985
|
+
const { edges: O } = F;
|
|
10986
|
+
O.add(T);
|
|
10994
10987
|
}
|
|
10995
10988
|
for (const T of C) {
|
|
10996
|
-
const
|
|
10989
|
+
const O = d.get(T), { edges: _, indices: S } = O, N = d.get(m), { edges: L, indices: w } = N;
|
|
10997
10990
|
for (const y of _)
|
|
10998
10991
|
L.add(y), h.set(y, m);
|
|
10999
10992
|
for (const y of S)
|
|
@@ -11025,12 +11018,12 @@ const Ds = class Ds extends et {
|
|
|
11025
11018
|
getVerticesAndNormal(t, e, i) {
|
|
11026
11019
|
if (!t.geometry.index)
|
|
11027
11020
|
throw new Error("Geometry must be indexed!");
|
|
11028
|
-
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new
|
|
11029
|
-
if (i !== void 0 && t instanceof
|
|
11030
|
-
const T = new
|
|
11021
|
+
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), E = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[h], n[h + 1], n[h + 2]), f = new g.Vector3(r[a], r[a + 1], r[a + 2]), R = new g.Vector3(r[c], r[c + 1], r[c + 2]), m = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (f.x + R.x + m.x) / 3, A = (f.y + R.y + m.y) / 3, F = (f.z + R.z + m.z) / 3, p = new g.Vector3(C, A, F);
|
|
11022
|
+
if (i !== void 0 && t instanceof g.InstancedMesh) {
|
|
11023
|
+
const T = new g.Matrix4();
|
|
11031
11024
|
t.getMatrixAt(i, T);
|
|
11032
|
-
const
|
|
11033
|
-
|
|
11025
|
+
const O = new g.Matrix4();
|
|
11026
|
+
O.extractRotation(T), p.applyMatrix4(O), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
|
|
11034
11027
|
}
|
|
11035
11028
|
return { p1: d, p2: E, p3: u, faceNormal: p };
|
|
11036
11029
|
}
|
|
@@ -11058,7 +11051,7 @@ const Ds = class Ds extends et {
|
|
|
11058
11051
|
* @throws Will throw an error if the fragment manager is not available.
|
|
11059
11052
|
*/
|
|
11060
11053
|
getVolumeFromFragments(t) {
|
|
11061
|
-
const e = this.components.get(ht), i = new
|
|
11054
|
+
const e = this.components.get(ht), i = new g.Matrix4(), o = [];
|
|
11062
11055
|
for (const r in t) {
|
|
11063
11056
|
const a = e.list.get(r);
|
|
11064
11057
|
if (!a)
|
|
@@ -11069,7 +11062,7 @@ const Ds = class Ds extends et {
|
|
|
11069
11062
|
const f = a.getInstancesIDs(u);
|
|
11070
11063
|
f && (h += f.size);
|
|
11071
11064
|
}
|
|
11072
|
-
const d = new
|
|
11065
|
+
const d = new g.InstancedMesh(
|
|
11073
11066
|
a.mesh.geometry,
|
|
11074
11067
|
void 0,
|
|
11075
11068
|
h
|
|
@@ -11134,23 +11127,23 @@ const Ds = class Ds extends et {
|
|
|
11134
11127
|
distance: E.distanceTo(m),
|
|
11135
11128
|
points: [E, m]
|
|
11136
11129
|
}
|
|
11137
|
-
], A = new
|
|
11130
|
+
], A = new g.Plane();
|
|
11138
11131
|
return A.setFromNormalAndCoplanarPoint(c, n), A.constant = Math.round(A.constant * 10) / 10, { plane: A, edges: C };
|
|
11139
11132
|
}
|
|
11140
11133
|
// https://stackoverflow.com/a/1568551
|
|
11141
11134
|
getVolumeOfMesh(t) {
|
|
11142
11135
|
let e = 0;
|
|
11143
|
-
const i = new
|
|
11136
|
+
const i = new g.Vector3(), o = new g.Vector3(), n = new g.Vector3(), { index: r } = t.geometry, a = t.geometry.attributes.position.array;
|
|
11144
11137
|
if (!r)
|
|
11145
11138
|
return console.warn("Geometry must be indexed to compute its volume!"), 0;
|
|
11146
11139
|
const c = [];
|
|
11147
|
-
if (t instanceof
|
|
11140
|
+
if (t instanceof g.InstancedMesh)
|
|
11148
11141
|
for (let d = 0; d < t.count; d++) {
|
|
11149
|
-
const E = new
|
|
11142
|
+
const E = new g.Matrix4();
|
|
11150
11143
|
t.getMatrixAt(d, E), c.push(E);
|
|
11151
11144
|
}
|
|
11152
11145
|
else
|
|
11153
|
-
c.push(new
|
|
11146
|
+
c.push(new g.Matrix4().identity());
|
|
11154
11147
|
const { matrixWorld: h } = t;
|
|
11155
11148
|
for (let d = 0; d < r.array.length - 2; d += 3)
|
|
11156
11149
|
for (const E of c) {
|
|
@@ -11186,7 +11179,7 @@ export {
|
|
|
11186
11179
|
Ti as Cullers,
|
|
11187
11180
|
zt as Disposer,
|
|
11188
11181
|
D as Event,
|
|
11189
|
-
|
|
11182
|
+
gn as Exploder,
|
|
11190
11183
|
zr as FirstPersonMode,
|
|
11191
11184
|
ht as FragmentsManager,
|
|
11192
11185
|
vn as GeometryTypes,
|
|
@@ -11199,7 +11192,7 @@ export {
|
|
|
11199
11192
|
Sn as IfcGeometryTiler,
|
|
11200
11193
|
mi as IfcJsonExporter,
|
|
11201
11194
|
Ri as IfcLoader,
|
|
11202
|
-
|
|
11195
|
+
On as IfcPropertiesManager,
|
|
11203
11196
|
Kr as IfcPropertiesTiler,
|
|
11204
11197
|
Kt as IfcPropertiesUtils,
|
|
11205
11198
|
ke as IfcRelationsIndexer,
|