@thatopen/components 2.0.20 → 2.0.22
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/index.cjs +5 -5
- package/dist/index.mjs +519 -505
- package/dist/namespace.d.ts +1259 -1259
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -92,26 +92,26 @@ function Re(l) {
|
|
|
92
92
|
return 2 * (e * t + t * s + s * e);
|
|
93
93
|
}
|
|
94
94
|
function Gs(l, e, t, s, i = null) {
|
|
95
|
-
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0,
|
|
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, p = -1 / 0, A = -1 / 0, m = -1 / 0;
|
|
96
96
|
const C = i !== null;
|
|
97
97
|
for (let R = e * 6, F = (e + t) * 6; R < F; R += 6) {
|
|
98
98
|
const f = l[R + 0], T = l[R + 1], O = f - T, _ = f + T;
|
|
99
99
|
O < o && (o = O), _ > a && (a = _), C && f < d && (d = f), C && f > p && (p = f);
|
|
100
100
|
const S = l[R + 2], N = l[R + 3], P = S - N, w = S + N;
|
|
101
|
-
P < n && (n = P), w > c && (c = w), C && S <
|
|
101
|
+
P < n && (n = P), w > c && (c = w), C && S < E && (E = S), C && S > A && (A = S);
|
|
102
102
|
const y = l[R + 4], U = l[R + 5], x = y - U, B = y + U;
|
|
103
|
-
x < r && (r = x), B >
|
|
103
|
+
x < r && (r = x), B > h && (h = B), C && y < u && (u = y), C && y > m && (m = y);
|
|
104
104
|
}
|
|
105
|
-
s[0] = o, s[1] = n, s[2] = r, s[3] = a, s[4] = c, s[5] =
|
|
105
|
+
s[0] = o, s[1] = n, s[2] = r, s[3] = a, s[4] = c, s[5] = h, C && (i[0] = d, i[1] = E, i[2] = u, i[3] = p, i[4] = A, i[5] = m);
|
|
106
106
|
}
|
|
107
107
|
function lo(l, e, t, s) {
|
|
108
108
|
let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
|
|
109
|
-
for (let
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const u = l[
|
|
109
|
+
for (let h = e * 6, d = (e + t) * 6; h < d; h += 6) {
|
|
110
|
+
const E = l[h + 0];
|
|
111
|
+
E < i && (i = E), E > r && (r = E);
|
|
112
|
+
const u = l[h + 2];
|
|
113
113
|
u < o && (o = u), u > a && (a = u);
|
|
114
|
-
const p = l[
|
|
114
|
+
const p = l[h + 4];
|
|
115
115
|
p < n && (n = p), p > c && (c = p);
|
|
116
116
|
}
|
|
117
117
|
s[0] = i, s[1] = o, s[2] = n, s[3] = r, s[4] = a, s[5] = c;
|
|
@@ -121,14 +121,14 @@ function ho(l, e) {
|
|
|
121
121
|
const t = l.attributes.position, s = l.index ? l.index.array : null, i = pe(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
|
|
122
122
|
let c = 3;
|
|
123
123
|
t.isInterleavedBufferAttribute && (c = t.data.stride);
|
|
124
|
-
const
|
|
124
|
+
const h = ["getX", "getY", "getZ"];
|
|
125
125
|
for (let d = 0; d < i; d++) {
|
|
126
|
-
const
|
|
127
|
-
let p =
|
|
126
|
+
const E = d * 3, u = d * 6;
|
|
127
|
+
let p = E + 0, A = E + 1, m = E + 2;
|
|
128
128
|
s && (p = s[p], A = s[A], m = s[m]), n || (p = p * c + a, A = A * c + a, m = m * c + a);
|
|
129
129
|
for (let C = 0; C < 3; C++) {
|
|
130
130
|
let R, F, f;
|
|
131
|
-
n ? (R = t[
|
|
131
|
+
n ? (R = t[h[C]](p), F = t[h[C]](A), f = t[h[C]](m)) : (R = r[p + C], F = r[A + C], f = r[m + C]);
|
|
132
132
|
let T = R;
|
|
133
133
|
F < T && (T = F), f < T && (T = f);
|
|
134
134
|
let O = R;
|
|
@@ -155,16 +155,16 @@ function uo(l, e, t, s, i, o) {
|
|
|
155
155
|
else if (o === so) {
|
|
156
156
|
const a = Re(l);
|
|
157
157
|
let c = Ys * i;
|
|
158
|
-
const
|
|
159
|
-
for (let
|
|
160
|
-
const u = e[
|
|
158
|
+
const h = s * 6, d = (s + i) * 6;
|
|
159
|
+
for (let E = 0; E < 3; E++) {
|
|
160
|
+
const u = e[E], m = (e[E + 3] - u) / Mt;
|
|
161
161
|
if (i < Mt / 4) {
|
|
162
162
|
const C = [...Ut];
|
|
163
163
|
C.length = i;
|
|
164
164
|
let R = 0;
|
|
165
|
-
for (let f =
|
|
165
|
+
for (let f = h; f < d; f += 6, R++) {
|
|
166
166
|
const T = C[R];
|
|
167
|
-
T.candidate = t[f + 2 *
|
|
167
|
+
T.candidate = t[f + 2 * E], T.count = 0;
|
|
168
168
|
const {
|
|
169
169
|
bounds: O,
|
|
170
170
|
leftCacheBounds: _,
|
|
@@ -181,8 +181,8 @@ function uo(l, e, t, s, i, o) {
|
|
|
181
181
|
for (; f + 1 < F && C[f + 1].candidate === T.candidate; )
|
|
182
182
|
C.splice(f + 1, 1), F--;
|
|
183
183
|
}
|
|
184
|
-
for (let f =
|
|
185
|
-
const T = t[f + 2 *
|
|
184
|
+
for (let f = h; f < d; f += 6) {
|
|
185
|
+
const T = t[f + 2 * E];
|
|
186
186
|
for (let O = 0; O < F; O++) {
|
|
187
187
|
const _ = C[O];
|
|
188
188
|
T >= _.candidate ? Qe(f, t, _.rightCacheBounds) : (Qe(f, t, _.leftCacheBounds), _.count++);
|
|
@@ -195,7 +195,7 @@ function uo(l, e, t, s, i, o) {
|
|
|
195
195
|
let w = 0;
|
|
196
196
|
_ !== 0 && (w = Re(N) / a);
|
|
197
197
|
const y = bi + Ys * (P * O + w * _);
|
|
198
|
-
y < c && (n =
|
|
198
|
+
y < c && (n = E, c = y, r = T.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
201
201
|
for (let F = 0; F < Mt; F++) {
|
|
@@ -205,8 +205,8 @@ function uo(l, e, t, s, i, o) {
|
|
|
205
205
|
for (let O = 0; O < 3; O++)
|
|
206
206
|
T[O] = 1 / 0, T[O + 3] = -1 / 0;
|
|
207
207
|
}
|
|
208
|
-
for (let F =
|
|
209
|
-
let O = ~~((t[F + 2 *
|
|
208
|
+
for (let F = h; F < d; F += 6) {
|
|
209
|
+
let O = ~~((t[F + 2 * E] - u) / m);
|
|
210
210
|
O >= Mt && (O = Mt - 1);
|
|
211
211
|
const _ = Ut[O];
|
|
212
212
|
_.count++, Qe(F, t, _.bounds);
|
|
@@ -226,7 +226,7 @@ function uo(l, e, t, s, i, o) {
|
|
|
226
226
|
const w = i - R;
|
|
227
227
|
w !== 0 && (P = Re(S) / a);
|
|
228
228
|
const y = bi + Ys * (N * R + P * w);
|
|
229
|
-
y < c && (n =
|
|
229
|
+
y < c && (n = E, c = y, r = f.candidate);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -253,13 +253,13 @@ function fo(l, e, t, s, i, o) {
|
|
|
253
253
|
for (; n <= r && t[r * 6 + c] >= a; )
|
|
254
254
|
r--;
|
|
255
255
|
if (n < r) {
|
|
256
|
-
for (let
|
|
257
|
-
let d = e[n * 3 +
|
|
258
|
-
e[n * 3 +
|
|
256
|
+
for (let h = 0; h < 3; h++) {
|
|
257
|
+
let d = e[n * 3 + h];
|
|
258
|
+
e[n * 3 + h] = e[r * 3 + h], e[r * 3 + h] = d;
|
|
259
259
|
}
|
|
260
|
-
for (let
|
|
261
|
-
let d = t[n * 6 +
|
|
262
|
-
t[n * 6 +
|
|
260
|
+
for (let h = 0; h < 6; h++) {
|
|
261
|
+
let d = t[n * 6 + h];
|
|
262
|
+
t[n * 6 + h] = t[r * 6 + h], t[r * 6 + h] = d;
|
|
263
263
|
}
|
|
264
264
|
n++, r--;
|
|
265
265
|
} else
|
|
@@ -275,11 +275,11 @@ function po(l, e, t, s, i, o) {
|
|
|
275
275
|
for (; n <= r && t[r * 6 + c] >= a; )
|
|
276
276
|
r--;
|
|
277
277
|
if (n < r) {
|
|
278
|
-
let
|
|
279
|
-
l[n] = l[r], l[r] =
|
|
278
|
+
let h = l[n];
|
|
279
|
+
l[n] = l[r], l[r] = h;
|
|
280
280
|
for (let d = 0; d < 6; d++) {
|
|
281
|
-
let
|
|
282
|
-
t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] =
|
|
281
|
+
let E = t[n * 6 + d];
|
|
282
|
+
t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = E;
|
|
283
283
|
}
|
|
284
284
|
n++, r--;
|
|
285
285
|
} else
|
|
@@ -293,12 +293,12 @@ function Co(l, e) {
|
|
|
293
293
|
return n;
|
|
294
294
|
}
|
|
295
295
|
function To(l, e) {
|
|
296
|
-
const t = l.geometry, s = t.index ? t.index.array : null, i = e.maxDepth, o = e.verbose, n = e.maxLeafTris, r = e.strategy, a = e.onProgress, c = pe(t),
|
|
296
|
+
const t = l.geometry, s = t.index ? t.index.array : null, i = e.maxDepth, o = e.verbose, n = e.maxLeafTris, r = e.strategy, a = e.onProgress, c = pe(t), h = l._indirectBuffer;
|
|
297
297
|
let d = !1;
|
|
298
|
-
const
|
|
298
|
+
const E = new Float32Array(6), u = new Float32Array(6), p = ho(t, E), A = e.indirect ? po : fo, m = [], C = e.indirect ? wn(t) : Dn(t);
|
|
299
299
|
if (C.length === 1) {
|
|
300
300
|
const f = C[0], T = new qe();
|
|
301
|
-
T.boundingData =
|
|
301
|
+
T.boundingData = E, lo(p, f.offset, f.count, u), F(T, f.offset, f.count, u), m.push(T);
|
|
302
302
|
} else
|
|
303
303
|
for (let f of C) {
|
|
304
304
|
const T = new qe();
|
|
@@ -314,7 +314,7 @@ function To(l, e) {
|
|
|
314
314
|
const N = uo(f.boundingData, _, p, T, O, r);
|
|
315
315
|
if (N.axis === -1)
|
|
316
316
|
return R(T + O), f.offset = T, f.count = O, f;
|
|
317
|
-
const P = A(
|
|
317
|
+
const P = A(h, s, p, T, O, N);
|
|
318
318
|
if (P === T || P === T + O)
|
|
319
319
|
R(T + O), f.offset = T, f.count = O;
|
|
320
320
|
else {
|
|
@@ -336,29 +336,29 @@ function mo(l, e) {
|
|
|
336
336
|
let i, o, n;
|
|
337
337
|
const r = [], a = e.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
|
|
338
338
|
for (let d = 0; d < s.length; d++) {
|
|
339
|
-
const
|
|
340
|
-
let u = c(
|
|
339
|
+
const E = s[d];
|
|
340
|
+
let u = c(E);
|
|
341
341
|
const p = new a(Cs * u);
|
|
342
|
-
i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p),
|
|
342
|
+
i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), h(0, E), r.push(p);
|
|
343
343
|
}
|
|
344
344
|
l._roots = r;
|
|
345
345
|
return;
|
|
346
346
|
function c(d) {
|
|
347
347
|
return d.count ? 1 : 1 + c(d.left) + c(d.right);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
const u = d / 4, p = d / 2, A = !!
|
|
349
|
+
function h(d, E) {
|
|
350
|
+
const u = d / 4, p = d / 2, A = !!E.count, m = E.boundingData;
|
|
351
351
|
for (let C = 0; C < 6; C++)
|
|
352
352
|
i[u + C] = m[C];
|
|
353
353
|
if (A) {
|
|
354
|
-
const C =
|
|
354
|
+
const C = E.offset, R = E.count;
|
|
355
355
|
return o[u + 6] = C, n[p + 14] = R, n[p + 15] = Us, d + Cs;
|
|
356
356
|
} else {
|
|
357
|
-
const C =
|
|
357
|
+
const C = E.left, R = E.right, F = E.splitAxis;
|
|
358
358
|
let f;
|
|
359
|
-
if (f =
|
|
359
|
+
if (f = h(d + Cs, C), f / 4 > Math.pow(2, 32))
|
|
360
360
|
throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");
|
|
361
|
-
return o[u + 6] = f / 4, f =
|
|
361
|
+
return o[u + 6] = f / 4, f = h(f, R), o[u + 7] = F, f;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -393,8 +393,8 @@ wt.prototype.setFromBox = function() {
|
|
|
393
393
|
let n = 1 / 0, r = -1 / 0;
|
|
394
394
|
for (let a = 0; a <= 1; a++)
|
|
395
395
|
for (let c = 0; c <= 1; c++)
|
|
396
|
-
for (let
|
|
397
|
-
l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z *
|
|
396
|
+
for (let h = 0; h <= 1; h++) {
|
|
397
|
+
l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * h + o.z * (1 - h);
|
|
398
398
|
const d = t.dot(l);
|
|
399
399
|
n = Math.min(d, n), r = Math.max(d, r);
|
|
400
400
|
}
|
|
@@ -404,11 +404,11 @@ wt.prototype.setFromBox = function() {
|
|
|
404
404
|
const Ro = function() {
|
|
405
405
|
const l = new M(), e = new M(), t = new M();
|
|
406
406
|
return function(i, o, n) {
|
|
407
|
-
const r = i.start, a = l, c = o.start,
|
|
407
|
+
const r = i.start, a = l, c = o.start, h = e;
|
|
408
408
|
t.subVectors(r, c), l.subVectors(i.end, i.start), e.subVectors(o.end, o.start);
|
|
409
|
-
const d = t.dot(
|
|
409
|
+
const d = t.dot(h), E = h.dot(a), u = h.dot(h), p = t.dot(a), m = a.dot(a) * u - E * E;
|
|
410
410
|
let C, R;
|
|
411
|
-
m !== 0 ? C = (d *
|
|
411
|
+
m !== 0 ? C = (d * E - p * u) / m : C = 0, R = (d + C * E) / u, n.x = C, n.y = R;
|
|
412
412
|
};
|
|
413
413
|
}(), Oi = function() {
|
|
414
414
|
const l = new fe(), e = new M(), t = new M();
|
|
@@ -425,16 +425,16 @@ const Ro = function() {
|
|
|
425
425
|
a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
|
|
426
426
|
return;
|
|
427
427
|
} else {
|
|
428
|
-
let
|
|
429
|
-
a < 0 ?
|
|
428
|
+
let h;
|
|
429
|
+
a < 0 ? h = i.start : h = i.end;
|
|
430
430
|
let d;
|
|
431
431
|
c < 0 ? d = o.start : d = o.end;
|
|
432
|
-
const
|
|
433
|
-
if (i.closestPointToPoint(d, !0, e), o.closestPointToPoint(
|
|
434
|
-
n.copy(
|
|
432
|
+
const E = e, u = t;
|
|
433
|
+
if (i.closestPointToPoint(d, !0, e), o.closestPointToPoint(h, !0, t), E.distanceToSquared(d) <= u.distanceToSquared(h)) {
|
|
434
|
+
n.copy(E), r.copy(d);
|
|
435
435
|
return;
|
|
436
436
|
} else {
|
|
437
|
-
n.copy(
|
|
437
|
+
n.copy(h), r.copy(u);
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -442,8 +442,8 @@ const Ro = function() {
|
|
|
442
442
|
}(), Ao = function() {
|
|
443
443
|
const l = new M(), e = new M(), t = new Fi(), s = new Pt();
|
|
444
444
|
return function(o, n) {
|
|
445
|
-
const { radius: r, center: a } = o, { a: c, b:
|
|
446
|
-
if (s.start = c, s.end =
|
|
445
|
+
const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
|
|
446
|
+
if (s.start = c, s.end = h, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (s.start = c, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (s.start = h, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
|
|
447
447
|
return !0;
|
|
448
448
|
const A = n.getPlane(t);
|
|
449
449
|
if (Math.abs(A.distanceToPoint(a)) <= r) {
|
|
@@ -467,10 +467,10 @@ class Ft extends ue {
|
|
|
467
467
|
update() {
|
|
468
468
|
const e = this.a, t = this.b, s = this.c, i = this.points, o = this.satAxes, n = this.satBounds, r = o[0], a = n[0];
|
|
469
469
|
this.getNormal(r), a.setFromPoints(r, i);
|
|
470
|
-
const c = o[1],
|
|
471
|
-
c.subVectors(e, t),
|
|
472
|
-
const d = o[2],
|
|
473
|
-
d.subVectors(t, s),
|
|
470
|
+
const c = o[1], h = n[1];
|
|
471
|
+
c.subVectors(e, t), h.setFromPoints(c, i);
|
|
472
|
+
const d = o[2], E = n[2];
|
|
473
|
+
d.subVectors(t, s), E.setFromPoints(d, i);
|
|
474
474
|
const u = o[3], p = n[3];
|
|
475
475
|
u.subVectors(s, e), p.setFromPoints(u, i), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(r, e), this.needsUpdate = !1;
|
|
476
476
|
}
|
|
@@ -479,28 +479,28 @@ Ft.prototype.closestPointToSegment = function() {
|
|
|
479
479
|
const l = new M(), e = new M(), t = new Pt();
|
|
480
480
|
return function(i, o = null, n = null) {
|
|
481
481
|
const { start: r, end: a } = i, c = this.points;
|
|
482
|
-
let
|
|
483
|
-
for (let
|
|
484
|
-
const u = (
|
|
485
|
-
t.start.copy(c[
|
|
482
|
+
let h, d = 1 / 0;
|
|
483
|
+
for (let E = 0; E < 3; E++) {
|
|
484
|
+
const u = (E + 1) % 3;
|
|
485
|
+
t.start.copy(c[E]), t.end.copy(c[u]), Oi(t, i, l, e), h = l.distanceToSquared(e), h < d && (d = h, o && o.copy(l), n && n.copy(e));
|
|
486
486
|
}
|
|
487
|
-
return this.closestPointToPoint(r, l),
|
|
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
|
};
|
|
489
489
|
}();
|
|
490
490
|
Ft.prototype.intersectsTriangle = function() {
|
|
491
|
-
const l = new Ft(), e = new Array(3), t = new Array(3), s = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(),
|
|
491
|
+
const l = new Ft(), e = new Array(3), t = new Array(3), s = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), h = new Pt(), d = new Pt(), E = new Pt(), u = new M();
|
|
492
492
|
function p(A, m, C) {
|
|
493
493
|
const R = A.points;
|
|
494
494
|
let F = 0, f = -1;
|
|
495
495
|
for (let T = 0; T < 3; T++) {
|
|
496
|
-
const { start: O, end: _ } =
|
|
497
|
-
O.copy(R[T]), _.copy(R[(T + 1) % 3]),
|
|
496
|
+
const { start: O, end: _ } = h;
|
|
497
|
+
O.copy(R[T]), _.copy(R[(T + 1) % 3]), h.delta(n);
|
|
498
498
|
const S = zs(m.distanceToPoint(O));
|
|
499
499
|
if (zs(m.normal.dot(n)) && S) {
|
|
500
|
-
C.copy(
|
|
500
|
+
C.copy(h), F = 2;
|
|
501
501
|
break;
|
|
502
502
|
}
|
|
503
|
-
const N = m.intersectLine(
|
|
503
|
+
const N = m.intersectLine(h, u);
|
|
504
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 && (f = F);
|
|
@@ -547,17 +547,17 @@ 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 O = p(m, F,
|
|
551
|
-
if (O === 1 && this.containsPoint(
|
|
552
|
-
return C && (C.start.copy(
|
|
550
|
+
const O = p(m, F, E);
|
|
551
|
+
if (O === 1 && this.containsPoint(E.end))
|
|
552
|
+
return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
|
|
553
553
|
if (O !== 2)
|
|
554
554
|
return !1;
|
|
555
|
-
if (d.delta(r),
|
|
556
|
-
let U =
|
|
557
|
-
|
|
555
|
+
if (d.delta(r), E.delta(a), r.dot(a) < 0) {
|
|
556
|
+
let U = E.start;
|
|
557
|
+
E.start = E.end, E.end = U;
|
|
558
558
|
}
|
|
559
|
-
const _ = d.start.dot(r), S = d.end.dot(r), N =
|
|
560
|
-
return _ !== P && N !== S && w === y ? !1 : (C && (c.subVectors(d.start,
|
|
559
|
+
const _ = d.start.dot(r), S = d.end.dot(r), N = E.start.dot(r), P = E.end.dot(r), w = S < N, y = _ < P;
|
|
560
|
+
return _ !== P && N !== S && w === y ? !1 : (C && (c.subVectors(d.start, E.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(E.start), c.subVectors(d.end, E.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(E.end)), !0);
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}();
|
|
@@ -573,25 +573,25 @@ Ft.prototype.distanceToTriangle = function() {
|
|
|
573
573
|
const c = r || a ? s : null;
|
|
574
574
|
if (this.intersectsTriangle(n, c))
|
|
575
575
|
return (r || a) && (r && c.getCenter(r), a && c.getCenter(a)), 0;
|
|
576
|
-
let
|
|
576
|
+
let h = 1 / 0;
|
|
577
577
|
for (let d = 0; d < 3; d++) {
|
|
578
|
-
let
|
|
578
|
+
let E;
|
|
579
579
|
const u = t[d], p = n[u];
|
|
580
|
-
this.closestPointToPoint(p, l),
|
|
580
|
+
this.closestPointToPoint(p, l), E = p.distanceToSquared(l), E < h && (h = E, r && r.copy(l), a && a.copy(p));
|
|
581
581
|
const A = this[u];
|
|
582
|
-
n.closestPointToPoint(A, l),
|
|
582
|
+
n.closestPointToPoint(A, l), E = A.distanceToSquared(l), E < h && (h = E, r && r.copy(A), a && a.copy(l));
|
|
583
583
|
}
|
|
584
584
|
for (let d = 0; d < 3; d++) {
|
|
585
|
-
const
|
|
586
|
-
s.set(this[
|
|
585
|
+
const E = t[d], u = t[(d + 1) % 3];
|
|
586
|
+
s.set(this[E], this[u]);
|
|
587
587
|
for (let p = 0; p < 3; p++) {
|
|
588
588
|
const A = t[p], m = t[(p + 1) % 3];
|
|
589
589
|
i.set(n[A], n[m]), Oi(s, i, l, e);
|
|
590
590
|
const C = l.distanceToSquared(e);
|
|
591
|
-
C <
|
|
591
|
+
C < h && (h = C, r && r.copy(l), a && a.copy(e));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
return Math.sqrt(
|
|
594
|
+
return Math.sqrt(h);
|
|
595
595
|
};
|
|
596
596
|
}();
|
|
597
597
|
class at {
|
|
@@ -609,15 +609,15 @@ at.prototype.update = /* @__PURE__ */ function() {
|
|
|
609
609
|
return function() {
|
|
610
610
|
const e = this.matrix, t = this.min, s = this.max, i = this.points;
|
|
611
611
|
for (let c = 0; c <= 1; c++)
|
|
612
|
-
for (let
|
|
612
|
+
for (let h = 0; h <= 1; h++)
|
|
613
613
|
for (let d = 0; d <= 1; d++) {
|
|
614
|
-
const
|
|
615
|
-
u.x = c ? s.x : t.x, u.y =
|
|
614
|
+
const E = 1 * c | 2 * h | 4 * d, u = i[E];
|
|
615
|
+
u.x = c ? s.x : t.x, u.y = h ? s.y : t.y, u.z = d ? s.z : t.z, u.applyMatrix4(e);
|
|
616
616
|
}
|
|
617
617
|
const o = this.satBounds, n = this.satAxes, r = i[0];
|
|
618
618
|
for (let c = 0; c < 3; c++) {
|
|
619
|
-
const
|
|
620
|
-
|
|
619
|
+
const h = n[c], d = o[c], E = 1 << c, u = i[E];
|
|
620
|
+
h.subVectors(r, u), d.setFromPoints(h, i);
|
|
621
621
|
}
|
|
622
622
|
const a = this.alignedSatBounds;
|
|
623
623
|
a[0].setFromPointsField(i, "x"), a[1].setFromPointsField(i, "y"), a[2].setFromPointsField(i, "z"), this.invMatrix.copy(this.matrix).invert(), this.needsUpdate = !1;
|
|
@@ -631,8 +631,8 @@ at.prototype.intersectsBox = function() {
|
|
|
631
631
|
if (l.min = s.x, l.max = i.x, r[0].isSeparated(l) || (l.min = s.y, l.max = i.y, r[1].isSeparated(l)) || (l.min = s.z, l.max = i.z, r[2].isSeparated(l)))
|
|
632
632
|
return !1;
|
|
633
633
|
for (let a = 0; a < 3; a++) {
|
|
634
|
-
const c = n[a],
|
|
635
|
-
if (l.setFromBox(c, t),
|
|
634
|
+
const c = n[a], h = o[a];
|
|
635
|
+
if (l.setFromBox(c, t), h.isSeparated(l))
|
|
636
636
|
return !1;
|
|
637
637
|
}
|
|
638
638
|
return !0;
|
|
@@ -644,21 +644,21 @@ at.prototype.intersectsTriangle = function() {
|
|
|
644
644
|
this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (l.copy(n), l.update(), n = l);
|
|
645
645
|
const r = this.satBounds, a = this.satAxes;
|
|
646
646
|
e[0] = n.a, e[1] = n.b, e[2] = n.c;
|
|
647
|
-
for (let
|
|
648
|
-
const u = r[
|
|
647
|
+
for (let E = 0; E < 3; E++) {
|
|
648
|
+
const u = r[E], p = a[E];
|
|
649
649
|
if (t.setFromPoints(p, e), u.isSeparated(t))
|
|
650
650
|
return !1;
|
|
651
651
|
}
|
|
652
|
-
const c = n.satBounds,
|
|
653
|
-
for (let
|
|
654
|
-
const u = c[
|
|
652
|
+
const c = n.satBounds, h = n.satAxes, d = this.points;
|
|
653
|
+
for (let E = 0; E < 3; E++) {
|
|
654
|
+
const u = c[E], p = h[E];
|
|
655
655
|
if (t.setFromPoints(p, d), u.isSeparated(t))
|
|
656
656
|
return !1;
|
|
657
657
|
}
|
|
658
|
-
for (let
|
|
659
|
-
const u = a[
|
|
658
|
+
for (let E = 0; E < 3; E++) {
|
|
659
|
+
const u = a[E];
|
|
660
660
|
for (let p = 0; p < 4; p++) {
|
|
661
|
-
const A =
|
|
661
|
+
const A = h[p];
|
|
662
662
|
if (i.crossVectors(u, A), t.setFromPoints(i, e), s.setFromPoints(i, d), t.isSeparated(s))
|
|
663
663
|
return !1;
|
|
664
664
|
}
|
|
@@ -682,13 +682,13 @@ at.prototype.distanceToBox = function() {
|
|
|
682
682
|
return function(n, r = 0, a = null, c = null) {
|
|
683
683
|
if (this.needsUpdate && this.update(), this.intersectsBox(n))
|
|
684
684
|
return (a || c) && (n.getCenter(i), this.closestPointToPoint(i, s), n.closestPointToPoint(s, i), a && a.copy(s), c && c.copy(i)), 0;
|
|
685
|
-
const
|
|
685
|
+
const h = r * r, d = n.min, E = n.max, u = this.points;
|
|
686
686
|
let p = 1 / 0;
|
|
687
687
|
for (let m = 0; m < 8; m++) {
|
|
688
688
|
const C = u[m];
|
|
689
|
-
i.copy(C).clamp(d,
|
|
689
|
+
i.copy(C).clamp(d, E);
|
|
690
690
|
const R = C.distanceToSquared(i);
|
|
691
|
-
if (R < p && (p = R, a && a.copy(C), c && c.copy(i), R <
|
|
691
|
+
if (R < p && (p = R, a && a.copy(C), c && c.copy(i), R < h))
|
|
692
692
|
return Math.sqrt(R);
|
|
693
693
|
}
|
|
694
694
|
let A = 0;
|
|
@@ -698,14 +698,14 @@ at.prototype.distanceToBox = function() {
|
|
|
698
698
|
const F = (m + 1) % 3, f = (m + 2) % 3, T = C << F | R << f, O = 1 << m | C << F | R << f, _ = u[T], S = u[O];
|
|
699
699
|
e[A].set(_, S);
|
|
700
700
|
const P = l[m], w = l[F], y = l[f], U = t[A], x = U.start, B = U.end;
|
|
701
|
-
x[P] = d[P], x[w] = C ? d[w] :
|
|
701
|
+
x[P] = d[P], x[w] = C ? d[w] : E[w], x[y] = R ? d[y] : E[w], B[P] = E[P], B[w] = C ? d[w] : E[w], B[y] = R ? d[y] : E[w], A++;
|
|
702
702
|
}
|
|
703
703
|
for (let m = 0; m <= 1; m++)
|
|
704
704
|
for (let C = 0; C <= 1; C++)
|
|
705
705
|
for (let R = 0; R <= 1; R++) {
|
|
706
|
-
i.x = m ?
|
|
706
|
+
i.x = m ? E.x : d.x, i.y = C ? E.y : d.y, i.z = R ? E.z : d.z, this.closestPointToPoint(i, s);
|
|
707
707
|
const F = i.distanceToSquared(s);
|
|
708
|
-
if (F < p && (p = F, a && a.copy(s), c && c.copy(i), F <
|
|
708
|
+
if (F < p && (p = F, a && a.copy(s), c && c.copy(i), F < h))
|
|
709
709
|
return Math.sqrt(F);
|
|
710
710
|
}
|
|
711
711
|
for (let m = 0; m < 12; m++) {
|
|
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
|
|
|
714
714
|
const F = t[R];
|
|
715
715
|
Oi(C, F, s, i);
|
|
716
716
|
const f = s.distanceToSquared(i);
|
|
717
|
-
if (f < p && (p = f, a && a.copy(s), c && c.copy(i), f <
|
|
717
|
+
if (f < p && (p = f, a && a.copy(s), c && c.copy(i), f < h))
|
|
718
718
|
return Math.sqrt(f);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -781,10 +781,10 @@ function _o(l, e, t, s, i, o) {
|
|
|
781
781
|
}
|
|
782
782
|
function ai(l, e, t, s, i = null, o = 0, n = 0) {
|
|
783
783
|
const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
|
|
784
|
-
let
|
|
785
|
-
if (ht(
|
|
786
|
-
const
|
|
787
|
-
return K(l, r, Yt), s(
|
|
784
|
+
let h = l * 2;
|
|
785
|
+
if (ht(h, a)) {
|
|
786
|
+
const E = Et(l, c), u = ft(h, a);
|
|
787
|
+
return K(l, r, Yt), s(E, u, !1, n, o + l, Yt);
|
|
788
788
|
} else {
|
|
789
789
|
let P = function(y) {
|
|
790
790
|
const { uint16Array: U, uint32Array: x } = Z;
|
|
@@ -799,10 +799,10 @@ function ai(l, e, t, s, i = null, o = 0, n = 0) {
|
|
|
799
799
|
y = Ct(y, x), B = y * 2;
|
|
800
800
|
return Et(y, x) + ft(B, U);
|
|
801
801
|
};
|
|
802
|
-
const
|
|
803
|
-
let p =
|
|
802
|
+
const E = pt(l), u = Ct(l, c);
|
|
803
|
+
let p = E, A = u, m, C, R, F;
|
|
804
804
|
if (i && (R = Yt, F = Ie, K(p, r, R), K(A, r, F), m = i(R), C = i(F), C < m)) {
|
|
805
|
-
p = u, A =
|
|
805
|
+
p = u, A = E;
|
|
806
806
|
const y = m;
|
|
807
807
|
m = C, C = y, R = F;
|
|
808
808
|
}
|
|
@@ -849,12 +849,12 @@ function So(l, e, t = {}, s = 0, i = 1 / 0) {
|
|
|
849
849
|
let r = 1 / 0, a = null;
|
|
850
850
|
if (l.shapecast(
|
|
851
851
|
{
|
|
852
|
-
boundsTraverseOrder: (
|
|
853
|
-
intersectsBounds: (
|
|
854
|
-
intersectsTriangle: (
|
|
855
|
-
|
|
856
|
-
const
|
|
857
|
-
return
|
|
852
|
+
boundsTraverseOrder: (h) => (Ae.copy(e).clamp(h.min, h.max), Ae.distanceToSquared(e)),
|
|
853
|
+
intersectsBounds: (h, d, E) => E < r && E < n,
|
|
854
|
+
intersectsTriangle: (h, d) => {
|
|
855
|
+
h.closestPointToPoint(e, Ae);
|
|
856
|
+
const E = e.distanceToSquared(Ae);
|
|
857
|
+
return E < r && (Hs.copy(Ae), r = E, a = d), E < o;
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
), r === 1 / 0)
|
|
@@ -875,14 +875,14 @@ function Lo(l, e, t, s, i, o, n, r, a) {
|
|
|
875
875
|
const c = No(l, te, ee, se, es, a);
|
|
876
876
|
if (c) {
|
|
877
877
|
s && ($e.fromBufferAttribute(s, o), Je.fromBufferAttribute(s, n), ts.fromBufferAttribute(s, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(es, te, ee, se, Vi, Gi, zi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
|
|
878
|
-
const
|
|
878
|
+
const h = {
|
|
879
879
|
a: o,
|
|
880
880
|
b: n,
|
|
881
881
|
c: r,
|
|
882
882
|
normal: new M(),
|
|
883
883
|
materialIndex: 0
|
|
884
884
|
};
|
|
885
|
-
ue.getNormal(te, ee, se,
|
|
885
|
+
ue.getNormal(te, ee, se, h.normal), c.face = h, c.faceIndex = o;
|
|
886
886
|
}
|
|
887
887
|
return c;
|
|
888
888
|
}
|
|
@@ -891,7 +891,7 @@ function xs(l, e, t, s, i) {
|
|
|
891
891
|
let n = o + 0, r = o + 1, a = o + 2;
|
|
892
892
|
const c = l.index;
|
|
893
893
|
l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
|
|
894
|
-
const { position:
|
|
894
|
+
const { position: h, normal: d, uv: E, uv1: u } = l.attributes, p = Lo(t, h, d, E, u, n, r, a, e);
|
|
895
895
|
return p ? (p.faceIndex = s, i && i.push(p), p) : null;
|
|
896
896
|
}
|
|
897
897
|
function tt(l, e, t, s) {
|
|
@@ -907,7 +907,7 @@ function Po(l, e, t, s, i, o) {
|
|
|
907
907
|
function yo(l, e, t, s, i) {
|
|
908
908
|
const { geometry: o, _indirectBuffer: n } = l;
|
|
909
909
|
let r = 1 / 0, a = null;
|
|
910
|
-
for (let c = s,
|
|
910
|
+
for (let c = s, h = s + i; c < h; c++) {
|
|
911
911
|
let d;
|
|
912
912
|
d = xs(o, e, t, c), d && d.distance < r && (a = d, r = d.distance);
|
|
913
913
|
}
|
|
@@ -915,9 +915,9 @@ function yo(l, e, t, s, i) {
|
|
|
915
915
|
}
|
|
916
916
|
function Mo(l, e, t, s, i, o, n) {
|
|
917
917
|
const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
|
|
918
|
-
for (let
|
|
919
|
-
let
|
|
920
|
-
if (
|
|
918
|
+
for (let h = l, d = e + l; h < d; h++) {
|
|
919
|
+
let E;
|
|
920
|
+
if (E = h, tt(n, E * 3, a, c), n.needsUpdate = !0, s(n, E, i, o))
|
|
921
921
|
return !0;
|
|
922
922
|
}
|
|
923
923
|
return !1;
|
|
@@ -926,22 +926,22 @@ function wo(l, e = null) {
|
|
|
926
926
|
e && Array.isArray(e) && (e = new Set(e));
|
|
927
927
|
const t = l.geometry, s = t.index ? t.index.array : null, i = t.attributes.position;
|
|
928
928
|
let o, n, r, a, c = 0;
|
|
929
|
-
const
|
|
930
|
-
for (let
|
|
931
|
-
o = E
|
|
932
|
-
function d(
|
|
933
|
-
const A =
|
|
929
|
+
const h = l._roots;
|
|
930
|
+
for (let E = 0, u = h.length; E < u; E++)
|
|
931
|
+
o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
|
|
932
|
+
function d(E, u, p = !1) {
|
|
933
|
+
const A = E * 2;
|
|
934
934
|
if (r[A + 15] === Us) {
|
|
935
|
-
const C = n[
|
|
935
|
+
const C = n[E + 6], R = r[A + 14];
|
|
936
936
|
let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
|
|
937
937
|
for (let N = 3 * C, P = 3 * (C + R); N < P; N++) {
|
|
938
938
|
let w = s[N];
|
|
939
939
|
const y = i.getX(w), U = i.getY(w), x = i.getZ(w);
|
|
940
940
|
y < F && (F = y), y > O && (O = y), U < f && (f = U), U > _ && (_ = U), x < T && (T = x), x > S && (S = x);
|
|
941
941
|
}
|
|
942
|
-
return a[
|
|
942
|
+
return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
|
|
943
943
|
} else {
|
|
944
|
-
const C =
|
|
944
|
+
const C = E + 8, R = n[E + 6], F = C + u, f = R + u;
|
|
945
945
|
let T = p, O = !1, _ = !1;
|
|
946
946
|
e ? T || (O = e.has(F), _ = e.has(f), T = !O && !_) : (O = !0, _ = !0);
|
|
947
947
|
const S = T || O, N = T || _;
|
|
@@ -953,7 +953,7 @@ function wo(l, e = null) {
|
|
|
953
953
|
if (y)
|
|
954
954
|
for (let U = 0; U < 3; U++) {
|
|
955
955
|
const x = C + U, B = R + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
|
|
956
|
-
a[
|
|
956
|
+
a[E + U] = H < st ? H : st, a[E + U + 3] = q > Q ? q : Q;
|
|
957
957
|
}
|
|
958
958
|
return y;
|
|
959
959
|
}
|
|
@@ -966,14 +966,14 @@ function Gt(l, e, t, s) {
|
|
|
966
966
|
function Do(l, e, t, s, i, o) {
|
|
967
967
|
const { geometry: n, _indirectBuffer: r } = l;
|
|
968
968
|
for (let a = s, c = s + i; a < c; a++) {
|
|
969
|
-
let
|
|
970
|
-
xs(n, e, t,
|
|
969
|
+
let h = r ? r[a] : a;
|
|
970
|
+
xs(n, e, t, h, o);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
973
|
function Uo(l, e, t, s, i) {
|
|
974
974
|
const { geometry: o, _indirectBuffer: n } = l;
|
|
975
975
|
let r = 1 / 0, a = null;
|
|
976
|
-
for (let c = s,
|
|
976
|
+
for (let c = s, h = s + i; c < h; c++) {
|
|
977
977
|
let d;
|
|
978
978
|
d = xs(o, e, t, n ? n[c] : c), d && d.distance < r && (a = d, r = d.distance);
|
|
979
979
|
}
|
|
@@ -981,9 +981,9 @@ function Uo(l, e, t, s, i) {
|
|
|
981
981
|
}
|
|
982
982
|
function xo(l, e, t, s, i, o, n) {
|
|
983
983
|
const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
|
|
984
|
-
for (let
|
|
985
|
-
let
|
|
986
|
-
if (
|
|
984
|
+
for (let h = l, d = e + l; h < d; h++) {
|
|
985
|
+
let E;
|
|
986
|
+
if (E = t.resolveTriangleIndex(h), tt(n, E * 3, a, c), n.needsUpdate = !0, s(n, E, i, o))
|
|
987
987
|
return !0;
|
|
988
988
|
}
|
|
989
989
|
return !1;
|
|
@@ -995,11 +995,11 @@ function bo(l, e, t, s, i) {
|
|
|
995
995
|
function ci(l, e, t, s, i) {
|
|
996
996
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
997
997
|
if (ht(a, n)) {
|
|
998
|
-
const
|
|
999
|
-
Po(e, t, s,
|
|
998
|
+
const h = Et(l, r), d = ft(a, n);
|
|
999
|
+
Po(e, t, s, h, d, i);
|
|
1000
1000
|
} else {
|
|
1001
|
-
const
|
|
1002
|
-
Gt(
|
|
1001
|
+
const h = pt(l);
|
|
1002
|
+
Gt(h, o, s, ki) && ci(h, e, t, s, i);
|
|
1003
1003
|
const d = Ct(l, r);
|
|
1004
1004
|
Gt(d, o, s, ki) && ci(d, e, t, s, i);
|
|
1005
1005
|
}
|
|
@@ -1014,16 +1014,16 @@ function li(l, e, t, s) {
|
|
|
1014
1014
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1015
1015
|
let r = l * 2;
|
|
1016
1016
|
if (ht(r, o)) {
|
|
1017
|
-
const c = Et(l, n),
|
|
1018
|
-
return yo(e, t, s, c,
|
|
1017
|
+
const c = Et(l, n), h = ft(r, o);
|
|
1018
|
+
return yo(e, t, s, c, h);
|
|
1019
1019
|
} else {
|
|
1020
|
-
const c = Un(l, n),
|
|
1020
|
+
const c = Un(l, n), h = vo[c], E = s.direction[h] >= 0;
|
|
1021
1021
|
let u, p;
|
|
1022
|
-
|
|
1022
|
+
E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
|
|
1023
1023
|
const m = Gt(u, i, s, Wi) ? li(u, e, t, s) : null;
|
|
1024
1024
|
if (m) {
|
|
1025
|
-
const F = m.point[
|
|
1026
|
-
if (
|
|
1025
|
+
const F = m.point[h];
|
|
1026
|
+
if (E ? F <= i[p + c] : (
|
|
1027
1027
|
// min bounding data
|
|
1028
1028
|
F >= i[p + c + 3]
|
|
1029
1029
|
))
|
|
@@ -1043,33 +1043,33 @@ function hi(l, e, t, s, i = null) {
|
|
|
1043
1043
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1044
1044
|
let a = l * 2;
|
|
1045
1045
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), Xi.set(t.boundingBox.min, t.boundingBox.max, s), i = Xi), ht(a, n)) {
|
|
1046
|
-
const
|
|
1046
|
+
const h = e.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), m = ft(a, n);
|
|
1047
1047
|
if (Fe.copy(s).invert(), t.boundsTree)
|
|
1048
1048
|
return K(l, o, is), is.matrix.copy(Fe), is.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1049
1049
|
intersectsBounds: (R) => is.intersectsBox(R),
|
|
1050
1050
|
intersectsTriangle: (R) => {
|
|
1051
1051
|
R.a.applyMatrix4(s), R.b.applyMatrix4(s), R.c.applyMatrix4(s), R.needsUpdate = !0;
|
|
1052
1052
|
for (let F = A * 3, f = (m + A) * 3; F < f; F += 3)
|
|
1053
|
-
if (tt(ne, F, d,
|
|
1053
|
+
if (tt(ne, F, d, E), ne.needsUpdate = !0, R.intersectsTriangle(ne))
|
|
1054
1054
|
return !0;
|
|
1055
1055
|
return !1;
|
|
1056
1056
|
}
|
|
1057
1057
|
});
|
|
1058
1058
|
for (let C = A * 3, R = (m + A) * 3; C < R; C += 3) {
|
|
1059
|
-
tt(ie, C, d,
|
|
1059
|
+
tt(ie, C, d, E), ie.a.applyMatrix4(Fe), ie.b.applyMatrix4(Fe), ie.c.applyMatrix4(Fe), ie.needsUpdate = !0;
|
|
1060
1060
|
for (let F = 0, f = u.count; F < f; F += 3)
|
|
1061
1061
|
if (tt(ne, F, u, p), ne.needsUpdate = !0, ie.intersectsTriangle(ne))
|
|
1062
1062
|
return !0;
|
|
1063
1063
|
}
|
|
1064
1064
|
} else {
|
|
1065
|
-
const
|
|
1066
|
-
return K(
|
|
1065
|
+
const h = l + 8, d = r[l + 6];
|
|
1066
|
+
return K(h, o, ss), !!(i.intersectsBox(ss) && hi(h, e, t, s, i) || (K(d, o, ss), i.intersectsBox(ss) && hi(d, e, t, s, i)));
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
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, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1071
1071
|
e.boundingBox || e.computeBoundingBox(), ks.set(e.boundingBox.min, e.boundingBox.max, t), ks.needsUpdate = !0;
|
|
1072
|
-
const r = l.geometry, a = r.attributes.position, c = r.index,
|
|
1072
|
+
const r = l.geometry, a = r.attributes.position, c = r.index, h = e.attributes.position, d = e.index, E = It.getPrimitive(), u = It.getPrimitive();
|
|
1073
1073
|
let p = Vo, A = Go, m = null, C = null;
|
|
1074
1074
|
i && (m = zo, C = Ho);
|
|
1075
1075
|
let R = 1 / 0, F = null, f = null;
|
|
@@ -1084,10 +1084,10 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1084
1084
|
intersectsBounds: (S, N, P) => P < R && P < n,
|
|
1085
1085
|
intersectsRange: (S, N) => {
|
|
1086
1086
|
for (let P = S, w = S + N; P < w; P++) {
|
|
1087
|
-
tt(u, 3 * P, d,
|
|
1087
|
+
tt(u, 3 * P, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1088
1088
|
for (let y = T, U = T + O; y < U; y++) {
|
|
1089
|
-
tt(
|
|
1090
|
-
const x =
|
|
1089
|
+
tt(E, 3 * y, c, a), E.needsUpdate = !0;
|
|
1090
|
+
const x = E.distanceToTriangle(u, p, m);
|
|
1091
1091
|
if (x < R && (A.copy(p), C && C.copy(m), R = x, F = y, f = P), x < o)
|
|
1092
1092
|
return !0;
|
|
1093
1093
|
}
|
|
@@ -1097,10 +1097,10 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1097
1097
|
{
|
|
1098
1098
|
const _ = pe(e);
|
|
1099
1099
|
for (let S = 0, N = _; S < N; S++) {
|
|
1100
|
-
tt(u, 3 * S, d,
|
|
1100
|
+
tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1101
1101
|
for (let P = T, w = T + O; P < w; P++) {
|
|
1102
|
-
tt(
|
|
1103
|
-
const y =
|
|
1102
|
+
tt(E, 3 * P, c, a), E.needsUpdate = !0;
|
|
1103
|
+
const y = E.distanceToTriangle(u, p, m);
|
|
1104
1104
|
if (y < R && (A.copy(p), C && C.copy(m), R = y, F = P, f = S), y < o)
|
|
1105
1105
|
return !0;
|
|
1106
1106
|
}
|
|
@@ -1108,19 +1108,19 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
), It.releasePrimitive(
|
|
1111
|
+
), It.releasePrimitive(E), It.releasePrimitive(u), R === 1 / 0 ? null : (s.point ? s.point.copy(A) : s.point = A.clone(), s.distance = R, s.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(ns), A.applyMatrix4(ns), i.distance = A.sub(i.point).length(), i.faceIndex = f), s);
|
|
1112
1112
|
}
|
|
1113
1113
|
function Wo(l, e = null) {
|
|
1114
1114
|
e && Array.isArray(e) && (e = new Set(e));
|
|
1115
1115
|
const t = l.geometry, s = t.index ? t.index.array : null, i = t.attributes.position;
|
|
1116
1116
|
let o, n, r, a, c = 0;
|
|
1117
|
-
const
|
|
1118
|
-
for (let
|
|
1119
|
-
o = E
|
|
1120
|
-
function d(
|
|
1121
|
-
const A =
|
|
1117
|
+
const h = l._roots;
|
|
1118
|
+
for (let E = 0, u = h.length; E < u; E++)
|
|
1119
|
+
o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
|
|
1120
|
+
function d(E, u, p = !1) {
|
|
1121
|
+
const A = E * 2;
|
|
1122
1122
|
if (r[A + 15] === Us) {
|
|
1123
|
-
const C = n[
|
|
1123
|
+
const C = n[E + 6], R = r[A + 14];
|
|
1124
1124
|
let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
|
|
1125
1125
|
for (let N = C, P = C + R; N < P; N++) {
|
|
1126
1126
|
const w = 3 * l.resolveTriangleIndex(N);
|
|
@@ -1131,9 +1131,9 @@ function Wo(l, e = null) {
|
|
|
1131
1131
|
x < F && (F = x), x > O && (O = x), B < f && (f = B), B > _ && (_ = B), H < T && (T = H), H > S && (S = H);
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
return a[
|
|
1134
|
+
return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
|
|
1135
1135
|
} else {
|
|
1136
|
-
const C =
|
|
1136
|
+
const C = E + 8, R = n[E + 6], F = C + u, f = R + u;
|
|
1137
1137
|
let T = p, O = !1, _ = !1;
|
|
1138
1138
|
e ? T || (O = e.has(F), _ = e.has(f), T = !O && !_) : (O = !0, _ = !0);
|
|
1139
1139
|
const S = T || O, N = T || _;
|
|
@@ -1145,7 +1145,7 @@ function Wo(l, e = null) {
|
|
|
1145
1145
|
if (y)
|
|
1146
1146
|
for (let U = 0; U < 3; U++) {
|
|
1147
1147
|
const x = C + U, B = R + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
|
|
1148
|
-
a[
|
|
1148
|
+
a[E + U] = H < st ? H : st, a[E + U + 3] = q > Q ? q : Q;
|
|
1149
1149
|
}
|
|
1150
1150
|
return y;
|
|
1151
1151
|
}
|
|
@@ -1158,11 +1158,11 @@ function Xo(l, e, t, s, i) {
|
|
|
1158
1158
|
function Ei(l, e, t, s, i) {
|
|
1159
1159
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
1160
1160
|
if (ht(a, n)) {
|
|
1161
|
-
const
|
|
1162
|
-
Do(e, t, s,
|
|
1161
|
+
const h = Et(l, r), d = ft(a, n);
|
|
1162
|
+
Do(e, t, s, h, d, i);
|
|
1163
1163
|
} else {
|
|
1164
|
-
const
|
|
1165
|
-
Gt(
|
|
1164
|
+
const h = pt(l);
|
|
1165
|
+
Gt(h, o, s, Zi) && Ei(h, e, t, s, i);
|
|
1166
1166
|
const d = Ct(l, r);
|
|
1167
1167
|
Gt(d, o, s, Zi) && Ei(d, e, t, s, i);
|
|
1168
1168
|
}
|
|
@@ -1177,16 +1177,16 @@ function di(l, e, t, s) {
|
|
|
1177
1177
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1178
1178
|
let r = l * 2;
|
|
1179
1179
|
if (ht(r, o)) {
|
|
1180
|
-
const c = Et(l, n),
|
|
1181
|
-
return Uo(e, t, s, c,
|
|
1180
|
+
const c = Et(l, n), h = ft(r, o);
|
|
1181
|
+
return Uo(e, t, s, c, h);
|
|
1182
1182
|
} else {
|
|
1183
|
-
const c = Un(l, n),
|
|
1183
|
+
const c = Un(l, n), h = Zo[c], E = s.direction[h] >= 0;
|
|
1184
1184
|
let u, p;
|
|
1185
|
-
|
|
1185
|
+
E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
|
|
1186
1186
|
const m = Gt(u, i, s, Qi) ? di(u, e, t, s) : null;
|
|
1187
1187
|
if (m) {
|
|
1188
|
-
const F = m.point[
|
|
1189
|
-
if (
|
|
1188
|
+
const F = m.point[h];
|
|
1189
|
+
if (E ? F <= i[p + c] : (
|
|
1190
1190
|
// min bounding data
|
|
1191
1191
|
F >= i[p + c + 3]
|
|
1192
1192
|
))
|
|
@@ -1206,34 +1206,34 @@ function ui(l, e, t, s, i = null) {
|
|
|
1206
1206
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1207
1207
|
let a = l * 2;
|
|
1208
1208
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, s), i = ji), ht(a, n)) {
|
|
1209
|
-
const
|
|
1209
|
+
const h = e.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), m = ft(a, n);
|
|
1210
1210
|
if (ge.copy(s).invert(), t.boundsTree)
|
|
1211
1211
|
return K(l, o, rs), rs.matrix.copy(ge), rs.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1212
1212
|
intersectsBounds: (R) => rs.intersectsBox(R),
|
|
1213
1213
|
intersectsTriangle: (R) => {
|
|
1214
1214
|
R.a.applyMatrix4(s), R.b.applyMatrix4(s), R.c.applyMatrix4(s), R.needsUpdate = !0;
|
|
1215
1215
|
for (let F = A, f = m + A; F < f; F++)
|
|
1216
|
-
if (tt(re, 3 * e.resolveTriangleIndex(F), d,
|
|
1216
|
+
if (tt(re, 3 * e.resolveTriangleIndex(F), d, E), re.needsUpdate = !0, R.intersectsTriangle(re))
|
|
1217
1217
|
return !0;
|
|
1218
1218
|
return !1;
|
|
1219
1219
|
}
|
|
1220
1220
|
});
|
|
1221
1221
|
for (let C = A, R = m + A; C < R; C++) {
|
|
1222
1222
|
const F = e.resolveTriangleIndex(C);
|
|
1223
|
-
tt(oe, 3 * F, d,
|
|
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 f = 0, T = u.count; f < T; f += 3)
|
|
1225
1225
|
if (tt(re, f, u, p), re.needsUpdate = !0, oe.intersectsTriangle(re))
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
}
|
|
1228
1228
|
} else {
|
|
1229
|
-
const
|
|
1230
|
-
return K(
|
|
1229
|
+
const h = l + 8, d = r[l + 6];
|
|
1230
|
+
return K(h, o, os), !!(i.intersectsBox(os) && ui(h, e, t, s, i) || (K(d, o, os), i.intersectsBox(os) && ui(d, e, t, s, i)));
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
const as = /* @__PURE__ */ new yt(), Ws = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), qo = /* @__PURE__ */ new M(), Ko = /* @__PURE__ */ new M(), $o = /* @__PURE__ */ new M(), Jo = /* @__PURE__ */ new M();
|
|
1234
1234
|
function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1235
1235
|
e.boundingBox || e.computeBoundingBox(), Ws.set(e.boundingBox.min, e.boundingBox.max, t), Ws.needsUpdate = !0;
|
|
1236
|
-
const r = l.geometry, a = r.attributes.position, c = r.index,
|
|
1236
|
+
const r = l.geometry, a = r.attributes.position, c = r.index, h = e.attributes.position, d = e.index, E = It.getPrimitive(), u = It.getPrimitive();
|
|
1237
1237
|
let p = qo, A = Ko, m = null, C = null;
|
|
1238
1238
|
i && (m = $o, C = Jo);
|
|
1239
1239
|
let R = 1 / 0, F = null, f = null;
|
|
@@ -1250,11 +1250,11 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1250
1250
|
intersectsRange: (S, N) => {
|
|
1251
1251
|
for (let P = S, w = S + N; P < w; P++) {
|
|
1252
1252
|
const y = _.resolveTriangleIndex(P);
|
|
1253
|
-
tt(u, 3 * y, d,
|
|
1253
|
+
tt(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1254
1254
|
for (let U = T, x = T + O; U < x; U++) {
|
|
1255
1255
|
const B = l.resolveTriangleIndex(U);
|
|
1256
|
-
tt(
|
|
1257
|
-
const H =
|
|
1256
|
+
tt(E, 3 * B, c, a), E.needsUpdate = !0;
|
|
1257
|
+
const H = E.distanceToTriangle(u, p, m);
|
|
1258
1258
|
if (H < R && (A.copy(p), C && C.copy(m), R = H, F = U, f = P), H < o)
|
|
1259
1259
|
return !0;
|
|
1260
1260
|
}
|
|
@@ -1264,11 +1264,11 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1264
1264
|
} else {
|
|
1265
1265
|
const _ = pe(e);
|
|
1266
1266
|
for (let S = 0, N = _; S < N; S++) {
|
|
1267
|
-
tt(u, 3 * S, d,
|
|
1267
|
+
tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1268
1268
|
for (let P = T, w = T + O; P < w; P++) {
|
|
1269
1269
|
const y = l.resolveTriangleIndex(P);
|
|
1270
|
-
tt(
|
|
1271
|
-
const U =
|
|
1270
|
+
tt(E, 3 * y, c, a), E.needsUpdate = !0;
|
|
1271
|
+
const U = E.distanceToTriangle(u, p, m);
|
|
1272
1272
|
if (U < R && (A.copy(p), C && C.copy(m), R = U, F = P, f = S), U < o)
|
|
1273
1273
|
return !0;
|
|
1274
1274
|
}
|
|
@@ -1276,7 +1276,7 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
|
-
), It.releasePrimitive(
|
|
1279
|
+
), It.releasePrimitive(E), It.releasePrimitive(u), R === 1 / 0 ? null : (s.point ? s.point.copy(A) : s.point = A.clone(), s.distance = R, s.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(as), A.applyMatrix4(as), i.distance = A.sub(i.point).length(), i.faceIndex = f), s);
|
|
1280
1280
|
}
|
|
1281
1281
|
function er() {
|
|
1282
1282
|
return typeof SharedArrayBuffer < "u";
|
|
@@ -1290,11 +1290,11 @@ function sr(l, e, t, s) {
|
|
|
1290
1290
|
const i = l._roots, o = e._roots;
|
|
1291
1291
|
let n, r = 0, a = 0;
|
|
1292
1292
|
const c = new yt().copy(t).invert();
|
|
1293
|
-
for (let
|
|
1294
|
-
xe.setBuffer(i[
|
|
1295
|
-
const
|
|
1296
|
-
K(0, xe.float32Array,
|
|
1297
|
-
for (let u = 0, p = o.length; u < p && (As.setBuffer(o[
|
|
1293
|
+
for (let h = 0, d = i.length; h < d; h++) {
|
|
1294
|
+
xe.setBuffer(i[h]), a = 0;
|
|
1295
|
+
const E = vt.getPrimitive();
|
|
1296
|
+
K(0, xe.float32Array, E), E.applyMatrix4(c);
|
|
1297
|
+
for (let u = 0, p = o.length; u < p && (As.setBuffer(o[h]), n = Tt(
|
|
1298
1298
|
0,
|
|
1299
1299
|
0,
|
|
1300
1300
|
t,
|
|
@@ -1304,21 +1304,21 @@ function sr(l, e, t, s) {
|
|
|
1304
1304
|
a,
|
|
1305
1305
|
0,
|
|
1306
1306
|
0,
|
|
1307
|
-
|
|
1307
|
+
E
|
|
1308
1308
|
), As.clearBuffer(), a += o[u].length, !n); u++)
|
|
1309
1309
|
;
|
|
1310
|
-
if (vt.releasePrimitive(
|
|
1310
|
+
if (vt.releasePrimitive(E), xe.clearBuffer(), r += i[h].length, n)
|
|
1311
1311
|
break;
|
|
1312
1312
|
}
|
|
1313
1313
|
return Qs = !1, n;
|
|
1314
1314
|
}
|
|
1315
|
-
function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null,
|
|
1316
|
-
let d,
|
|
1317
|
-
|
|
1318
|
-
const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, m =
|
|
1315
|
+
function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
1316
|
+
let d, E;
|
|
1317
|
+
h ? (d = As, E = xe) : (d = xe, E = As);
|
|
1318
|
+
const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, m = E.float32Array, C = E.uint32Array, R = E.uint16Array, F = l * 2, f = e * 2, T = ht(F, A), O = ht(f, R);
|
|
1319
1319
|
let _ = !1;
|
|
1320
1320
|
if (O && T)
|
|
1321
|
-
|
|
1321
|
+
h ? _ = i(
|
|
1322
1322
|
Et(e, C),
|
|
1323
1323
|
ft(e * 2, R),
|
|
1324
1324
|
Et(l, p),
|
|
@@ -1354,7 +1354,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1354
1354
|
a,
|
|
1355
1355
|
r + 1,
|
|
1356
1356
|
S,
|
|
1357
|
-
!
|
|
1357
|
+
!h
|
|
1358
1358
|
) || y && Tt(
|
|
1359
1359
|
e,
|
|
1360
1360
|
P,
|
|
@@ -1366,7 +1366,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1366
1366
|
a,
|
|
1367
1367
|
r + 1,
|
|
1368
1368
|
S,
|
|
1369
|
-
!
|
|
1369
|
+
!h
|
|
1370
1370
|
), vt.releasePrimitive(S);
|
|
1371
1371
|
} else {
|
|
1372
1372
|
const S = pt(e), N = Ct(e, C);
|
|
@@ -1384,7 +1384,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1384
1384
|
r,
|
|
1385
1385
|
a + 1,
|
|
1386
1386
|
c,
|
|
1387
|
-
|
|
1387
|
+
h
|
|
1388
1388
|
) || Tt(
|
|
1389
1389
|
l,
|
|
1390
1390
|
N,
|
|
@@ -1396,7 +1396,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1396
1396
|
r,
|
|
1397
1397
|
a + 1,
|
|
1398
1398
|
c,
|
|
1399
|
-
|
|
1399
|
+
h
|
|
1400
1400
|
);
|
|
1401
1401
|
else if (P)
|
|
1402
1402
|
if (T)
|
|
@@ -1411,7 +1411,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1411
1411
|
r,
|
|
1412
1412
|
a + 1,
|
|
1413
1413
|
c,
|
|
1414
|
-
|
|
1414
|
+
h
|
|
1415
1415
|
);
|
|
1416
1416
|
else {
|
|
1417
1417
|
const y = vt.getPrimitive();
|
|
@@ -1430,7 +1430,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1430
1430
|
a,
|
|
1431
1431
|
r + 1,
|
|
1432
1432
|
y,
|
|
1433
|
-
!
|
|
1433
|
+
!h
|
|
1434
1434
|
) || H && Tt(
|
|
1435
1435
|
S,
|
|
1436
1436
|
x,
|
|
@@ -1442,7 +1442,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1442
1442
|
a,
|
|
1443
1443
|
r + 1,
|
|
1444
1444
|
y,
|
|
1445
|
-
!
|
|
1445
|
+
!h
|
|
1446
1446
|
), vt.releasePrimitive(y);
|
|
1447
1447
|
}
|
|
1448
1448
|
else if (w)
|
|
@@ -1458,7 +1458,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1458
1458
|
r,
|
|
1459
1459
|
a + 1,
|
|
1460
1460
|
c,
|
|
1461
|
-
|
|
1461
|
+
h
|
|
1462
1462
|
);
|
|
1463
1463
|
else {
|
|
1464
1464
|
const y = vt.getPrimitive();
|
|
@@ -1477,7 +1477,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1477
1477
|
a,
|
|
1478
1478
|
r + 1,
|
|
1479
1479
|
y,
|
|
1480
|
-
!
|
|
1480
|
+
!h
|
|
1481
1481
|
) || H && Tt(
|
|
1482
1482
|
N,
|
|
1483
1483
|
x,
|
|
@@ -1489,7 +1489,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1489
1489
|
a,
|
|
1490
1490
|
r + 1,
|
|
1491
1491
|
y,
|
|
1492
|
-
!
|
|
1492
|
+
!h
|
|
1493
1493
|
), vt.releasePrimitive(y);
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
@@ -1565,22 +1565,22 @@ class _i {
|
|
|
1565
1565
|
const s = this._roots[t], i = new Uint32Array(s), o = new Uint16Array(s);
|
|
1566
1566
|
n(0);
|
|
1567
1567
|
function n(r, a = 0) {
|
|
1568
|
-
const c = r * 2,
|
|
1569
|
-
if (
|
|
1570
|
-
const d = i[r + 6],
|
|
1571
|
-
e(a,
|
|
1568
|
+
const c = r * 2, h = o[c + 15] === Us;
|
|
1569
|
+
if (h) {
|
|
1570
|
+
const d = i[r + 6], E = o[c + 14];
|
|
1571
|
+
e(a, h, new Float32Array(s, r * 4, 6), d, E);
|
|
1572
1572
|
} else {
|
|
1573
|
-
const d = r + Cs / 4,
|
|
1574
|
-
e(a,
|
|
1573
|
+
const d = r + Cs / 4, E = i[r + 6], u = i[r + 7];
|
|
1574
|
+
e(a, h, new Float32Array(s, r * 4, 6), u) || (n(d, a + 1), n(E, a + 1));
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
/* Core Cast Functions */
|
|
1579
1579
|
raycast(e, t = wi) {
|
|
1580
|
-
const s = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t,
|
|
1581
|
-
for (let d = 0,
|
|
1580
|
+
const s = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Xo : bo;
|
|
1581
|
+
for (let d = 0, E = s.length; d < E; d++) {
|
|
1582
1582
|
const u = r ? t[a[d].materialIndex].side : c, p = o.length;
|
|
1583
|
-
if (
|
|
1583
|
+
if (h(this, d, u, e, o), r) {
|
|
1584
1584
|
const A = a[d].materialIndex;
|
|
1585
1585
|
for (let m = p, C = o.length; m < C; m++)
|
|
1586
1586
|
o[m].face.materialIndex = A;
|
|
@@ -1591,9 +1591,9 @@ class _i {
|
|
|
1591
1591
|
raycastFirst(e, t = wi) {
|
|
1592
1592
|
const s = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
|
|
1593
1593
|
let r = null;
|
|
1594
|
-
const a = i.groups, c = o ? t.side : t,
|
|
1595
|
-
for (let d = 0,
|
|
1596
|
-
const u = n ? t[a[d].materialIndex].side : c, p =
|
|
1594
|
+
const a = i.groups, c = o ? t.side : t, h = this.indirect ? Qo : Bo;
|
|
1595
|
+
for (let d = 0, E = s.length; d < E; d++) {
|
|
1596
|
+
const u = n ? t[a[d].materialIndex].side : c, p = h(this, d, u, e);
|
|
1597
1597
|
p != null && (r == null || p.distance < r.distance) && (r = p, n && (p.face.materialIndex = a[d].materialIndex));
|
|
1598
1598
|
}
|
|
1599
1599
|
return r;
|
|
@@ -1615,13 +1615,13 @@ class _i {
|
|
|
1615
1615
|
} = e;
|
|
1616
1616
|
if (n && r) {
|
|
1617
1617
|
const d = n;
|
|
1618
|
-
n = (
|
|
1618
|
+
n = (E, u, p, A, m) => d(E, u, p, A, m) ? !0 : s(E, u, this, r, p, A, t);
|
|
1619
1619
|
} else
|
|
1620
|
-
n || (r ? n = (d,
|
|
1620
|
+
n || (r ? n = (d, E, u, p) => s(d, E, this, r, u, p, t) : n = (d, E, u) => u);
|
|
1621
1621
|
let a = !1, c = 0;
|
|
1622
|
-
const
|
|
1623
|
-
for (let d = 0,
|
|
1624
|
-
const u =
|
|
1622
|
+
const h = this._roots;
|
|
1623
|
+
for (let d = 0, E = h.length; d < E; d++) {
|
|
1624
|
+
const u = h[d];
|
|
1625
1625
|
if (a = _o(this, d, o, n, i, c), a)
|
|
1626
1626
|
break;
|
|
1627
1627
|
c += u.byteLength;
|
|
@@ -1638,18 +1638,18 @@ class _i {
|
|
|
1638
1638
|
tt(n, A * 3, r, a);
|
|
1639
1639
|
} : (p) => {
|
|
1640
1640
|
tt(n, p * 3, r, a);
|
|
1641
|
-
},
|
|
1641
|
+
}, h = It.getPrimitive(), d = e.geometry.index, E = e.geometry.attributes.position, u = e.indirect ? (p) => {
|
|
1642
1642
|
const A = e.resolveTriangleIndex(p);
|
|
1643
|
-
tt(
|
|
1643
|
+
tt(h, A * 3, d, E);
|
|
1644
1644
|
} : (p) => {
|
|
1645
|
-
tt(
|
|
1645
|
+
tt(h, p * 3, d, E);
|
|
1646
1646
|
};
|
|
1647
1647
|
if (o) {
|
|
1648
1648
|
const p = (A, m, C, R, F, f, T, O) => {
|
|
1649
1649
|
for (let _ = C, S = C + R; _ < S; _++) {
|
|
1650
|
-
u(_),
|
|
1650
|
+
u(_), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
|
|
1651
1651
|
for (let N = A, P = A + m; N < P; N++)
|
|
1652
|
-
if (c(N), n.needsUpdate = !0, o(n,
|
|
1652
|
+
if (c(N), n.needsUpdate = !0, o(n, h, N, _, F, f, T, O))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
1655
1655
|
return !1;
|
|
@@ -2013,11 +2013,11 @@ class dr {
|
|
|
2013
2013
|
const s = this.faces;
|
|
2014
2014
|
let i = -1 / 0, o = 1 / 0;
|
|
2015
2015
|
for (let n = 0, r = s.length; n < r; n++) {
|
|
2016
|
-
const a = s[n], c = a.distanceToPoint(e.origin),
|
|
2017
|
-
if (c > 0 &&
|
|
2016
|
+
const a = s[n], c = a.distanceToPoint(e.origin), h = a.normal.dot(e.direction);
|
|
2017
|
+
if (c > 0 && h >= 0)
|
|
2018
2018
|
return null;
|
|
2019
|
-
const d =
|
|
2020
|
-
if (!(d <= 0) && (
|
|
2019
|
+
const d = h !== 0 ? -c / h : 0;
|
|
2020
|
+
if (!(d <= 0) && (h > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
|
|
2021
2021
|
return null;
|
|
2022
2022
|
}
|
|
2023
2023
|
return i !== -1 / 0 ? e.at(i, t) : e.at(o, t), t;
|
|
@@ -2101,15 +2101,15 @@ class dr {
|
|
|
2101
2101
|
computeInitialHull() {
|
|
2102
2102
|
const e = this.vertices, t = this.computeExtremes(), s = t.min, i = t.max;
|
|
2103
2103
|
let o = 0, n = 0;
|
|
2104
|
-
for (let
|
|
2105
|
-
const u = i[
|
|
2106
|
-
u > o && (o = u, n =
|
|
2104
|
+
for (let E = 0; E < 3; E++) {
|
|
2105
|
+
const u = i[E].point.getComponent(E) - s[E].point.getComponent(E);
|
|
2106
|
+
u > o && (o = u, n = E);
|
|
2107
2107
|
}
|
|
2108
2108
|
const r = s[n], a = i[n];
|
|
2109
|
-
let c,
|
|
2109
|
+
let c, h;
|
|
2110
2110
|
o = 0, Ji.set(r.point, a.point);
|
|
2111
|
-
for (let
|
|
2112
|
-
const p = e[
|
|
2111
|
+
for (let E = 0, u = this.vertices.length; E < u; E++) {
|
|
2112
|
+
const p = e[E];
|
|
2113
2113
|
if (p !== r && p !== a) {
|
|
2114
2114
|
Ji.closestPointToPoint(p.point, !0, tn);
|
|
2115
2115
|
const A = tn.distanceToSquared(p.point);
|
|
@@ -2117,42 +2117,42 @@ class dr {
|
|
|
2117
2117
|
}
|
|
2118
2118
|
}
|
|
2119
2119
|
o = -1, qs.setFromCoplanarPoints(r.point, a.point, c.point);
|
|
2120
|
-
for (let
|
|
2121
|
-
const p = e[
|
|
2120
|
+
for (let E = 0, u = this.vertices.length; E < u; E++) {
|
|
2121
|
+
const p = e[E];
|
|
2122
2122
|
if (p !== r && p !== a && p !== c) {
|
|
2123
2123
|
const A = Math.abs(qs.distanceToPoint(p.point));
|
|
2124
|
-
A > o && (o = A,
|
|
2124
|
+
A > o && (o = A, h = p);
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
2127
|
const d = [];
|
|
2128
|
-
if (qs.distanceToPoint(
|
|
2128
|
+
if (qs.distanceToPoint(h.point) < 0) {
|
|
2129
2129
|
d.push(
|
|
2130
2130
|
Rt.create(r, a, c),
|
|
2131
|
-
Rt.create(
|
|
2132
|
-
Rt.create(
|
|
2133
|
-
Rt.create(
|
|
2131
|
+
Rt.create(h, a, r),
|
|
2132
|
+
Rt.create(h, c, a),
|
|
2133
|
+
Rt.create(h, r, c)
|
|
2134
2134
|
);
|
|
2135
|
-
for (let
|
|
2136
|
-
const u = (
|
|
2137
|
-
d[
|
|
2135
|
+
for (let E = 0; E < 3; E++) {
|
|
2136
|
+
const u = (E + 1) % 3;
|
|
2137
|
+
d[E + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[E + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
|
|
2138
2138
|
}
|
|
2139
2139
|
} else {
|
|
2140
2140
|
d.push(
|
|
2141
2141
|
Rt.create(r, c, a),
|
|
2142
|
-
Rt.create(
|
|
2143
|
-
Rt.create(
|
|
2144
|
-
Rt.create(
|
|
2142
|
+
Rt.create(h, r, a),
|
|
2143
|
+
Rt.create(h, a, c),
|
|
2144
|
+
Rt.create(h, c, r)
|
|
2145
2145
|
);
|
|
2146
|
-
for (let
|
|
2147
|
-
const u = (
|
|
2148
|
-
d[
|
|
2146
|
+
for (let E = 0; E < 3; E++) {
|
|
2147
|
+
const u = (E + 1) % 3;
|
|
2148
|
+
d[E + 1].getEdge(2).setTwin(d[0].getEdge((3 - E) % 3)), d[E + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
|
-
for (let
|
|
2152
|
-
this.faces.push(d[
|
|
2153
|
-
for (let
|
|
2154
|
-
const p = e[
|
|
2155
|
-
if (p !== r && p !== a && p !== c && p !==
|
|
2151
|
+
for (let E = 0; E < 4; E++)
|
|
2152
|
+
this.faces.push(d[E]);
|
|
2153
|
+
for (let E = 0, u = e.length; E < u; E++) {
|
|
2154
|
+
const p = e[E];
|
|
2155
|
+
if (p !== r && p !== a && p !== c && p !== h) {
|
|
2156
2156
|
o = this.tolerance;
|
|
2157
2157
|
let A = null;
|
|
2158
2158
|
for (let m = 0; m < 4; m++) {
|
|
@@ -2348,15 +2348,15 @@ function pr(l, e) {
|
|
|
2348
2348
|
let t = 0, s = 1;
|
|
2349
2349
|
const i = l.elements;
|
|
2350
2350
|
for (let c = 0; c < 3; c++) {
|
|
2351
|
-
const
|
|
2352
|
-
|
|
2351
|
+
const h = Math.abs(i[Nt(Ii[c], fi[c])]);
|
|
2352
|
+
h > t && (t = h, s = c);
|
|
2353
2353
|
}
|
|
2354
2354
|
let o = 1, n = 0;
|
|
2355
2355
|
const r = fi[s], a = Ii[s];
|
|
2356
2356
|
if (Math.abs(i[Nt(a, r)]) > Number.EPSILON) {
|
|
2357
|
-
const c = i[Nt(a, a)],
|
|
2357
|
+
const c = i[Nt(a, a)], h = i[Nt(r, r)], d = i[Nt(a, r)], E = (c - h) / 2 / d;
|
|
2358
2358
|
let u;
|
|
2359
|
-
|
|
2359
|
+
E < 0 ? u = -1 / (-E + Math.sqrt(1 + E * E)) : u = 1 / (E + Math.sqrt(1 + E * E)), o = 1 / Math.sqrt(1 + u * u), n = u * o;
|
|
2360
2360
|
}
|
|
2361
2361
|
return e.identity(), e.elements[Nt(r, r)] = o, e.elements[Nt(a, a)] = o, e.elements[Nt(a, r)] = n, e.elements[Nt(r, a)] = -n, e;
|
|
2362
2362
|
}
|
|
@@ -2394,12 +2394,12 @@ 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 g.Vector3(), a = new g.Vector3(), c = new g.Vector3(),
|
|
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(), p = new g.Vector3();
|
|
2398
2398
|
let A = 0, m = 0, C = 0, R = 0, F = 0, f = 0, T = 0;
|
|
2399
2399
|
for (let it = 0, Xt = n.length; it < Xt; it += 9) {
|
|
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),
|
|
2401
|
-
const J =
|
|
2402
|
-
p.add(
|
|
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);
|
|
2401
|
+
const J = E.crossVectors(h, d).length() / 2;
|
|
2402
|
+
p.add(E.copy(u).multiplyScalar(J)), A += 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), R += (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), f += (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
|
p.divideScalar(A), m /= A, C /= A, R /= A, F /= A, f /= A, T /= A, m -= p.x * p.x, C -= p.x * p.y, R -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, T -= p.z * p.z;
|
|
2405
2405
|
const O = new g.Matrix3();
|
|
@@ -2964,7 +2964,7 @@ const Fs = class Fs {
|
|
|
2964
2964
|
/**
|
|
2965
2965
|
* The version of the @thatopen/components library.
|
|
2966
2966
|
*/
|
|
2967
|
-
I(Fs, "release", "2.0.
|
|
2967
|
+
I(Fs, "release", "2.0.22");
|
|
2968
2968
|
let pi = Fs;
|
|
2969
2969
|
class Rr {
|
|
2970
2970
|
constructor(e) {
|
|
@@ -3427,25 +3427,25 @@ function hs(l, e, t, s, i = 1 / 0, o) {
|
|
|
3427
3427
|
s = Math.max(1e-4, s);
|
|
3428
3428
|
const n = 2 / s, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
|
|
3429
3429
|
let c = l - e;
|
|
3430
|
-
const
|
|
3430
|
+
const h = e, d = i * s;
|
|
3431
3431
|
c = mt(c, -d, d), e = l - c;
|
|
3432
|
-
const
|
|
3433
|
-
t.value = (t.value - n *
|
|
3434
|
-
let u = e + (c +
|
|
3435
|
-
return
|
|
3432
|
+
const E = (t.value + n * c) * o;
|
|
3433
|
+
t.value = (t.value - n * E) * a;
|
|
3434
|
+
let u = e + (c + E) * a;
|
|
3435
|
+
return h - l > 0 == u > h && (u = h, t.value = (u - h) / o), u;
|
|
3436
3436
|
}
|
|
3437
3437
|
function rn(l, e, t, s, i = 1 / 0, o, n) {
|
|
3438
3438
|
s = Math.max(1e-4, s);
|
|
3439
3439
|
const r = 2 / s, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
3440
|
-
let
|
|
3441
|
-
const m =
|
|
3440
|
+
let h = e.x, d = e.y, E = e.z, u = l.x - h, p = l.y - d, A = l.z - E;
|
|
3441
|
+
const m = h, C = d, R = E, F = i * s, f = F * F, T = u * u + p * p + A * A;
|
|
3442
3442
|
if (T > f) {
|
|
3443
3443
|
const B = Math.sqrt(T);
|
|
3444
3444
|
u = u / B * F, p = p / B * F, A = A / B * F;
|
|
3445
3445
|
}
|
|
3446
|
-
|
|
3446
|
+
h = l.x - u, d = l.y - p, E = l.z - A;
|
|
3447
3447
|
const O = (t.x + r * u) * o, _ = (t.y + r * p) * o, S = (t.z + r * A) * o;
|
|
3448
|
-
t.x = (t.x - r * O) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x =
|
|
3448
|
+
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 + (p + _) * c, n.z = E + (A + S) * c;
|
|
3449
3449
|
const N = m - l.x, P = C - l.y, w = R - l.z, y = n.x - m, U = n.y - C, x = n.z - R;
|
|
3450
3450
|
return N * y + P * U + w * x > 0 && (n.x = m, n.y = C, n.z = R, t.x = (n.x - m) / o, t.y = (n.y - C) / o, t.z = (n.z - R) / o), n;
|
|
3451
3451
|
}
|
|
@@ -3651,7 +3651,7 @@ class ot extends Or {
|
|
|
3651
3651
|
deltaY: 0,
|
|
3652
3652
|
mouseButton: T
|
|
3653
3653
|
};
|
|
3654
|
-
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup",
|
|
3654
|
+
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, A(f);
|
|
3655
3655
|
}, r = (f) => {
|
|
3656
3656
|
if (!this._enabled || !this._domElement || this._lockedPointer)
|
|
3657
3657
|
return;
|
|
@@ -3697,7 +3697,7 @@ class ot extends Or {
|
|
|
3697
3697
|
}, c = (f) => {
|
|
3698
3698
|
const T = this._lockedPointer || this._findPointerById(1);
|
|
3699
3699
|
T && (T.clientX = f.clientX, T.clientY = f.clientY, T.deltaX = f.movementX, T.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), m());
|
|
3700
|
-
},
|
|
3700
|
+
}, h = (f) => {
|
|
3701
3701
|
const T = this._findPointerById(f.pointerId);
|
|
3702
3702
|
if (!(T && T === this._lockedPointer)) {
|
|
3703
3703
|
if (T && this._disposePointer(T), f.pointerType === "touch")
|
|
@@ -3723,7 +3723,7 @@ class ot extends Or {
|
|
|
3723
3723
|
const f = this._findPointerById(1);
|
|
3724
3724
|
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = L.NONE, C());
|
|
3725
3725
|
};
|
|
3726
|
-
let
|
|
3726
|
+
let E = -1;
|
|
3727
3727
|
const u = (f) => {
|
|
3728
3728
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === L.NONE)
|
|
3729
3729
|
return;
|
|
@@ -3734,7 +3734,7 @@ class ot extends Or {
|
|
|
3734
3734
|
}
|
|
3735
3735
|
if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === L.ROTATE || this.mouseButtons.wheel === L.TRUCK) {
|
|
3736
3736
|
const N = performance.now();
|
|
3737
|
-
|
|
3737
|
+
E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
|
|
3738
3738
|
}
|
|
3739
3739
|
const T = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / T : f.deltaY / (T * 10), _ = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3740
3740
|
switch (this.mouseButtons.wheel) {
|
|
@@ -3764,7 +3764,7 @@ class ot extends Or {
|
|
|
3764
3764
|
if (!(!this._domElement || !this._enabled)) {
|
|
3765
3765
|
if (this.mouseButtons.right === ot.ACTION.NONE) {
|
|
3766
3766
|
const T = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(T);
|
|
3767
|
-
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup",
|
|
3767
|
+
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);
|
|
3768
3768
|
return;
|
|
3769
3769
|
}
|
|
3770
3770
|
f.preventDefault();
|
|
@@ -3812,7 +3812,7 @@ class ot extends Or {
|
|
|
3812
3812
|
}
|
|
3813
3813
|
((this._state & L.TRUCK) === L.TRUCK || (this._state & L.TOUCH_TRUCK) === L.TOUCH_TRUCK || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, _, !1), this._isUserControllingTruck = !0), ((this._state & L.OFFSET) === L.OFFSET || (this._state & L.TOUCH_OFFSET) === L.TOUCH_OFFSET || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, _, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
3814
3814
|
}, C = () => {
|
|
3815
|
-
$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",
|
|
3815
|
+
$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" }));
|
|
3816
3816
|
};
|
|
3817
3817
|
this.lockPointer = () => {
|
|
3818
3818
|
!this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
|
|
@@ -3822,7 +3822,7 @@ class ot extends Or {
|
|
|
3822
3822
|
deltaX: 0,
|
|
3823
3823
|
deltaY: 0,
|
|
3824
3824
|
mouseButton: null
|
|
3825
|
-
}, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup",
|
|
3825
|
+
}, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener("pointerlockchange", R), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), A());
|
|
3826
3826
|
}, this.unlockPointer = () => {
|
|
3827
3827
|
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), document.exitPointerLock(), this.cancel(), this._domElement && (this._domElement.ownerDocument.removeEventListener("pointerlockchange", R), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3828
3828
|
};
|
|
@@ -3832,9 +3832,9 @@ class ot extends Or {
|
|
|
3832
3832
|
this.unlockPointer();
|
|
3833
3833
|
};
|
|
3834
3834
|
this._addAllEventListeners = (f) => {
|
|
3835
|
-
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Sr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel",
|
|
3835
|
+
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Sr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
|
|
3836
3836
|
}, this._removeAllEventListeners = () => {
|
|
3837
|
-
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel",
|
|
3837
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", h), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), 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._domElement.ownerDocument.removeEventListener("pointerlockchange", R), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3838
3838
|
}, this.cancel = () => {
|
|
3839
3839
|
this._state !== L.NONE && (this._state = L.NONE, this._activePointers.length = 0, C());
|
|
3840
3840
|
}, t && this.connect(t), this.update(0);
|
|
@@ -4201,12 +4201,12 @@ class ot extends Or {
|
|
|
4201
4201
|
fitToBox(e, t, { cover: s = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
|
|
4202
4202
|
const a = [], c = e.isBox3 ? de.copy(e) : de.setFromObject(e);
|
|
4203
4203
|
c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
|
|
4204
|
-
const
|
|
4205
|
-
a.push(this.rotateTo(
|
|
4206
|
-
const
|
|
4207
|
-
p && u.multiply(si.setFromAxisAngle(ds,
|
|
4204
|
+
const h = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
|
|
4205
|
+
a.push(this.rotateTo(h, d, t));
|
|
4206
|
+
const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(E, ti), p = k(Math.abs(E.y), 1);
|
|
4207
|
+
p && u.multiply(si.setFromAxisAngle(ds, h)), u.multiply(this._yAxisUpSpaceInverse);
|
|
4208
4208
|
const A = hn.makeEmpty();
|
|
4209
|
-
z.copy(c.min).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(ti,
|
|
4209
|
+
z.copy(c.min).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(ti, E), p && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
|
|
4210
4210
|
const m = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
|
|
4211
4211
|
if (Zt(this._camera)) {
|
|
4212
4212
|
const R = this.getDistanceToFitBox(m.x, m.y, m.z, s);
|
|
@@ -4249,8 +4249,8 @@ class ot extends Or {
|
|
|
4249
4249
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
|
|
4250
4250
|
const a = z.set(i, o, n), c = G.set(e, t, s);
|
|
4251
4251
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
4252
|
-
const
|
|
4253
|
-
return this._createOnRestPromise(
|
|
4252
|
+
const h = !r || 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);
|
|
4253
|
+
return this._createOnRestPromise(h);
|
|
4254
4254
|
}
|
|
4255
4255
|
/**
|
|
4256
4256
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -4270,11 +4270,11 @@ class ot extends Or {
|
|
|
4270
4270
|
* @param enableTransition
|
|
4271
4271
|
* @category Methods
|
|
4272
4272
|
*/
|
|
4273
|
-
lerpLookAt(e, t, s, i, o, n, r, a, c,
|
|
4273
|
+
lerpLookAt(e, t, s, i, o, n, r, a, c, h, d, E, u, p = !1) {
|
|
4274
4274
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
|
|
4275
4275
|
const A = G.set(i, o, n), m = z.set(e, t, s);
|
|
4276
4276
|
dt.setFromVector3(m.sub(A).applyQuaternion(this._yAxisUpSpace));
|
|
4277
|
-
const C = Ee.set(
|
|
4277
|
+
const C = Ee.set(h, d, E), R = z.set(r, a, c);
|
|
4278
4278
|
ye.setFromVector3(R.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
|
|
4279
4279
|
const F = ye.theta - dt.theta, f = ye.phi - dt.phi, T = ye.radius - dt.radius;
|
|
4280
4280
|
this._sphericalEnd.set(dt.radius + T * u, dt.phi + f * u, dt.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -4520,9 +4520,9 @@ class ot extends Or {
|
|
|
4520
4520
|
}
|
|
4521
4521
|
if (this.dollyToCursor) {
|
|
4522
4522
|
if (Zt(this._camera) && this._changedDolly !== 0) {
|
|
4523
|
-
const d = this._spherical.radius - this._lastDistance,
|
|
4523
|
+
const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(Pe), p = G.copy(u).cross(E.up).normalize();
|
|
4524
4524
|
p.lengthSq() === 0 && (p.x = 1);
|
|
4525
|
-
const A = z.crossVectors(p, u), m = this._sphericalEnd.radius * Math.tan(
|
|
4525
|
+
const A = z.crossVectors(p, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Se * 0.5), R = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * m)), f = G.copy(this._targetEnd).lerp(F, R), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
|
|
4526
4526
|
if (this.infinityDolly && (T || O)) {
|
|
4527
4527
|
this._sphericalEnd.radius -= d, this._spherical.radius -= d;
|
|
4528
4528
|
const S = z.copy(u).multiplyScalar(-d);
|
|
@@ -4532,7 +4532,7 @@ class ot extends Or {
|
|
|
4532
4532
|
const _ = z.subVectors(f, this._targetEnd);
|
|
4533
4533
|
this._targetEnd.copy(f), this._target.add(_), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
|
|
4534
4534
|
} else if (bt(this._camera) && this._changedZoom !== 0) {
|
|
4535
|
-
const d = this._zoom - this._lastZoom,
|
|
4535
|
+
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), p = z.set(0, 0, -1).applyQuaternion(E.quaternion), A = Ee.copy(u).add(p.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, R = this._getCameraDirection(Pe), F = this._targetEnd.dot(R), f = G.copy(this._targetEnd).lerp(A, C), T = f.dot(R), O = R.multiplyScalar(T - F);
|
|
4536
4536
|
f.sub(O), this._boundary.clampPoint(f, f);
|
|
4537
4537
|
const _ = z.subVectors(f, this._targetEnd);
|
|
4538
4538
|
this._targetEnd.copy(f), this._target.add(_), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
|
|
@@ -4541,8 +4541,8 @@ class ot extends Or {
|
|
|
4541
4541
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
4542
4542
|
const a = this._collisionTest();
|
|
4543
4543
|
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);
|
|
4544
|
-
const
|
|
4545
|
-
return
|
|
4544
|
+
const h = this._needsUpdate;
|
|
4545
|
+
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(s, 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;
|
|
4546
4546
|
}
|
|
4547
4547
|
/**
|
|
4548
4548
|
* Get all state in JSON string
|
|
@@ -4733,9 +4733,9 @@ class ot extends Or {
|
|
|
4733
4733
|
return;
|
|
4734
4734
|
const r = n, a = r.geometry.clone();
|
|
4735
4735
|
a.applyMatrix4(r.matrixWorld);
|
|
4736
|
-
const
|
|
4737
|
-
for (let d = 0,
|
|
4738
|
-
G.fromBufferAttribute(
|
|
4736
|
+
const h = a.attributes.position;
|
|
4737
|
+
for (let d = 0, E = h.count; d < E; d++)
|
|
4738
|
+
G.fromBufferAttribute(h, d), o = Math.max(o, i.distanceToSquared(G));
|
|
4739
4739
|
}), s.radius = Math.sqrt(o), s;
|
|
4740
4740
|
}
|
|
4741
4741
|
}
|
|
@@ -5183,8 +5183,8 @@ class Lr extends ri {
|
|
|
5183
5183
|
}), o[R] = F, i[R] = F, s[R] = F;
|
|
5184
5184
|
}
|
|
5185
5185
|
n("camera", e), n("object", void 0), n("enabled", !0), n("axis", null), n("mode", "translate"), n("translationSnap", null), n("rotationSnap", null), n("scaleSnap", null), n("space", "world"), n("size", 1), n("dragging", !1), n("showX", !0), n("showY", !0), n("showZ", !0);
|
|
5186
|
-
const r = new M(), a = new M(), c = new Lt(),
|
|
5187
|
-
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart",
|
|
5186
|
+
const r = new M(), a = new M(), c = new Lt(), h = new Lt(), d = new M(), E = new Lt(), u = new M(), p = new M(), A = new M(), m = 0, C = new M();
|
|
5187
|
+
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", h), n("cameraPosition", d), n("cameraQuaternion", E), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", m), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new Lt(), this._parentQuaternionInv = new Lt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Lt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Lt(), this._scaleStart = new M(), this._getPointer = Pr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = yr.bind(this), this._onPointerMove = wr.bind(this), this._onPointerUp = Dr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
5188
5188
|
}
|
|
5189
5189
|
// updateMatrixWorld updates key transformation variables
|
|
5190
5190
|
updateMatrixWorld() {
|
|
@@ -5346,12 +5346,12 @@ class Ur extends ri {
|
|
|
5346
5346
|
a.color.setHex(16711680), a.opacity = 0.5;
|
|
5347
5347
|
const c = e.clone();
|
|
5348
5348
|
c.color.setHex(65280), c.opacity = 0.5;
|
|
5349
|
-
const
|
|
5350
|
-
|
|
5349
|
+
const h = e.clone();
|
|
5350
|
+
h.color.setHex(255), h.opacity = 0.5;
|
|
5351
5351
|
const d = e.clone();
|
|
5352
5352
|
d.opacity = 0.25;
|
|
5353
|
-
const
|
|
5354
|
-
|
|
5353
|
+
const E = e.clone();
|
|
5354
|
+
E.color.setHex(16776960), E.opacity = 0.25, e.clone().color.setHex(16776960);
|
|
5355
5355
|
const p = e.clone();
|
|
5356
5356
|
p.color.setHex(7895160);
|
|
5357
5357
|
const A = new ct(0, 0.04, 0.1, 12);
|
|
@@ -5390,7 +5390,7 @@ class Ur extends ri {
|
|
|
5390
5390
|
[new v(new Ze(0.1, 0), d.clone()), [0, 0, 0]]
|
|
5391
5391
|
],
|
|
5392
5392
|
XY: [
|
|
5393
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5393
|
+
[new v(new rt(0.15, 0.15, 0.01), h.clone()), [0.15, 0.15, 0]]
|
|
5394
5394
|
],
|
|
5395
5395
|
YZ: [
|
|
5396
5396
|
[new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
@@ -5456,7 +5456,7 @@ class Ur extends ri {
|
|
|
5456
5456
|
[new v(F(0.5, 0.5), r), null, [0, Math.PI / 2, 0]]
|
|
5457
5457
|
],
|
|
5458
5458
|
E: [
|
|
5459
|
-
[new v(F(0.75, 1),
|
|
5459
|
+
[new v(F(0.75, 1), E), null, [0, Math.PI / 2, 0]]
|
|
5460
5460
|
]
|
|
5461
5461
|
}, N = {
|
|
5462
5462
|
AXIS: [
|
|
@@ -5495,7 +5495,7 @@ class Ur extends ri {
|
|
|
5495
5495
|
[new v(m, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
5496
5496
|
],
|
|
5497
5497
|
XY: [
|
|
5498
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5498
|
+
[new v(new rt(0.15, 0.15, 0.01), h), [0.15, 0.15, 0]]
|
|
5499
5499
|
],
|
|
5500
5500
|
YZ: [
|
|
5501
5501
|
[new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
@@ -6000,11 +6000,12 @@ const ve = class ve extends et {
|
|
|
6000
6000
|
i.renderer.updateClippingPlanes();
|
|
6001
6001
|
const { clippingPlanes: o } = i.renderer;
|
|
6002
6002
|
for (const n of i.meshes)
|
|
6003
|
-
if (
|
|
6004
|
-
|
|
6005
|
-
r
|
|
6006
|
-
|
|
6007
|
-
|
|
6003
|
+
if (n.material)
|
|
6004
|
+
if (Array.isArray(n.material))
|
|
6005
|
+
for (const r of n.material)
|
|
6006
|
+
r.clippingPlanes = o;
|
|
6007
|
+
else
|
|
6008
|
+
n.material.clippingPlanes = o;
|
|
6008
6009
|
}
|
|
6009
6010
|
}
|
|
6010
6011
|
};
|
|
@@ -6250,22 +6251,22 @@ class Vr extends Yr {
|
|
|
6250
6251
|
let a;
|
|
6251
6252
|
if (Array.isArray(o)) {
|
|
6252
6253
|
let d = !0;
|
|
6253
|
-
const
|
|
6254
|
+
const E = [];
|
|
6254
6255
|
for (const u of o)
|
|
6255
|
-
sn.isTransparent(u) ?
|
|
6256
|
+
sn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
|
|
6256
6257
|
if (d) {
|
|
6257
6258
|
n.dispose(), this.isProcessing = !1;
|
|
6258
6259
|
return;
|
|
6259
6260
|
}
|
|
6260
|
-
a =
|
|
6261
|
+
a = E;
|
|
6261
6262
|
} else if (sn.isTransparent(o)) {
|
|
6262
6263
|
n.dispose(), this.isProcessing = !1;
|
|
6263
6264
|
return;
|
|
6264
6265
|
} else
|
|
6265
6266
|
a = n;
|
|
6266
6267
|
this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
|
|
6267
|
-
const c = s ? t.count : 1,
|
|
6268
|
-
s ?
|
|
6268
|
+
const c = s ? t.count : 1, h = new g.InstancedMesh(i, a, c);
|
|
6269
|
+
s ? 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;
|
|
6269
6270
|
}
|
|
6270
6271
|
/**
|
|
6271
6272
|
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
@@ -6791,10 +6792,10 @@ class na extends He {
|
|
|
6791
6792
|
}
|
|
6792
6793
|
const a = new g.Box3(n, r), c = new g.Vector3();
|
|
6793
6794
|
a.getSize(c);
|
|
6794
|
-
const
|
|
6795
|
-
a.getCenter(
|
|
6796
|
-
const d = Math.max(c.x, c.y, c.z) * s,
|
|
6797
|
-
await this.controls.fitToSphere(
|
|
6795
|
+
const h = new g.Vector3();
|
|
6796
|
+
a.getCenter(h);
|
|
6797
|
+
const d = Math.max(c.x, c.y, c.z) * s, E = new g.Sphere(h, d);
|
|
6798
|
+
await this.controls.fitToSphere(E, !0);
|
|
6798
6799
|
}
|
|
6799
6800
|
/**
|
|
6800
6801
|
* Allows or prevents all user input.
|
|
@@ -7042,16 +7043,16 @@ const At = class At extends et {
|
|
|
7042
7043
|
const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
|
|
7043
7044
|
if (s && t instanceof Vt.FragmentMesh)
|
|
7044
7045
|
for (const c of s) {
|
|
7045
|
-
const
|
|
7046
|
-
if (
|
|
7047
|
-
for (const d of
|
|
7046
|
+
const h = t.fragment.getInstancesIDs(c);
|
|
7047
|
+
if (h)
|
|
7048
|
+
for (const d of h)
|
|
7048
7049
|
a.add(d);
|
|
7049
7050
|
}
|
|
7050
7051
|
else
|
|
7051
7052
|
a.add(0);
|
|
7052
7053
|
for (const c of a) {
|
|
7053
|
-
const
|
|
7054
|
-
r && (t.getMatrixAt(c, n),
|
|
7054
|
+
const h = i.min.clone(), d = i.max.clone();
|
|
7055
|
+
r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
|
|
7055
7056
|
}
|
|
7056
7057
|
}
|
|
7057
7058
|
static getFragmentBounds(t) {
|
|
@@ -7064,8 +7065,8 @@ const At = class At extends et {
|
|
|
7064
7065
|
c += 2;
|
|
7065
7066
|
continue;
|
|
7066
7067
|
}
|
|
7067
|
-
const
|
|
7068
|
-
d < n.x && (n.x = d),
|
|
7068
|
+
const h = a[c], d = s.getX(h), E = s.getY(h), u = s.getZ(h);
|
|
7069
|
+
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);
|
|
7069
7070
|
}
|
|
7070
7071
|
return new g.Box3(n, r);
|
|
7071
7072
|
}
|
|
@@ -7234,9 +7235,9 @@ const vn = /* @__PURE__ */ new Set([
|
|
|
7234
7235
|
for (const c of r) {
|
|
7235
7236
|
if (vn.has(c))
|
|
7236
7237
|
continue;
|
|
7237
|
-
const
|
|
7238
|
-
for (const
|
|
7239
|
-
const u = t.GetLine(0,
|
|
7238
|
+
const h = a.has(c) && o, d = t.GetLineIDsWithType(s, c);
|
|
7239
|
+
for (const E of d) {
|
|
7240
|
+
const u = t.GetLine(0, E, h, i);
|
|
7240
7241
|
n[u.expressID] = u;
|
|
7241
7242
|
}
|
|
7242
7243
|
}
|
|
@@ -7320,11 +7321,11 @@ const Ls = class Ls extends et {
|
|
|
7320
7321
|
* @returns The loaded FragmentsGroup.
|
|
7321
7322
|
*/
|
|
7322
7323
|
load(t, s) {
|
|
7323
|
-
const o = { ...{ coordinate: !0 }, ...s }, { coordinate: n, name: r, properties: a, relationsMap: c } = o,
|
|
7324
|
-
r && (
|
|
7325
|
-
for (const d of
|
|
7326
|
-
d.group =
|
|
7327
|
-
return n && this.coordinate([
|
|
7324
|
+
const o = { ...{ coordinate: !0 }, ...s }, { coordinate: n, name: r, properties: a, relationsMap: c } = o, h = this._loader.import(t);
|
|
7325
|
+
r && (h.name = r);
|
|
7326
|
+
for (const d of h.items)
|
|
7327
|
+
d.group = h, this.list.set(d.id, d);
|
|
7328
|
+
return n && this.coordinate([h]), this.groups.set(h.uuid, h), a && h.setLocalProperties(a), c && this.components.get(ke).setRelationMap(h, c), this.onFragmentsLoaded.trigger(h), h;
|
|
7328
7329
|
}
|
|
7329
7330
|
/**
|
|
7330
7331
|
* Export the specified fragmentsgroup to binary data.
|
|
@@ -7525,17 +7526,17 @@ const Xr = /* @__PURE__ */ new Map([
|
|
|
7525
7526
|
}
|
|
7526
7527
|
indexRelations(t, s, i, o) {
|
|
7527
7528
|
const n = Object.keys(s).find(
|
|
7528
|
-
(
|
|
7529
|
+
(E) => E.startsWith("Relating")
|
|
7529
7530
|
), r = Object.keys(s).find(
|
|
7530
|
-
(
|
|
7531
|
+
(E) => E.startsWith("Related")
|
|
7531
7532
|
);
|
|
7532
7533
|
if (!(n && r))
|
|
7533
7534
|
return;
|
|
7534
|
-
const a = s[n].value, c = s[r].map((
|
|
7535
|
-
|
|
7536
|
-
for (const
|
|
7537
|
-
const u = t.get(
|
|
7538
|
-
A.push(a), u.set(p, A), t.set(
|
|
7535
|
+
const a = s[n].value, c = s[r].map((E) => E.value), h = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
|
|
7536
|
+
h.set(d, c), t.set(a, h);
|
|
7537
|
+
for (const E of c) {
|
|
7538
|
+
const u = t.get(E) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(i), A = u.get(p) ?? [];
|
|
7539
|
+
A.push(a), u.set(p, A), t.set(E, u);
|
|
7539
7540
|
}
|
|
7540
7541
|
}
|
|
7541
7542
|
/**
|
|
@@ -7584,8 +7585,8 @@ const Xr = /* @__PURE__ */ new Map([
|
|
|
7584
7585
|
continue;
|
|
7585
7586
|
const { forRelated: r, forRelating: a } = n;
|
|
7586
7587
|
for (const c in o) {
|
|
7587
|
-
const
|
|
7588
|
-
this.indexRelations(s,
|
|
7588
|
+
const h = o[c];
|
|
7589
|
+
this.indexRelations(s, h, r, a);
|
|
7589
7590
|
}
|
|
7590
7591
|
}
|
|
7591
7592
|
return this.setRelationMap(t, s), s;
|
|
@@ -7605,10 +7606,10 @@ const Xr = /* @__PURE__ */ new Map([
|
|
|
7605
7606
|
if (!n)
|
|
7606
7607
|
continue;
|
|
7607
7608
|
const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(s, o);
|
|
7608
|
-
for (let
|
|
7609
|
+
for (let h = 0; h < c.size(); h++) {
|
|
7609
7610
|
const d = await t.properties.getItemProperties(
|
|
7610
7611
|
s,
|
|
7611
|
-
c.get(
|
|
7612
|
+
c.get(h)
|
|
7612
7613
|
);
|
|
7613
7614
|
this.indexRelations(i, d, r, a);
|
|
7614
7615
|
}
|
|
@@ -9033,8 +9034,8 @@ class Kt {
|
|
|
9033
9034
|
const a = await e.getProperties(r.value);
|
|
9034
9035
|
if (!a || !a.UnitType || !a.UnitType.value || a.UnitType.value !== "LENGTHUNIT")
|
|
9035
9036
|
continue;
|
|
9036
|
-
let
|
|
9037
|
-
return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (
|
|
9037
|
+
let h = 1, d = 1;
|
|
9038
|
+
return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (h = 1e-3), d * h;
|
|
9038
9039
|
}
|
|
9039
9040
|
return 1;
|
|
9040
9041
|
}
|
|
@@ -9053,17 +9054,17 @@ class Kt {
|
|
|
9053
9054
|
const o = s ?? (async () => {
|
|
9054
9055
|
}), n = {}, r = e.getAllPropertiesIDs();
|
|
9055
9056
|
for (const c of r) {
|
|
9056
|
-
const
|
|
9057
|
-
if (!
|
|
9057
|
+
const h = await e.getProperties(c);
|
|
9058
|
+
if (!h)
|
|
9058
9059
|
continue;
|
|
9059
|
-
const d =
|
|
9060
|
+
const d = h.type === t, E = Object.keys(h).find(
|
|
9060
9061
|
(C) => C.startsWith("Relating")
|
|
9061
|
-
), u = Object.keys(
|
|
9062
|
+
), u = Object.keys(h).find(
|
|
9062
9063
|
(C) => C.startsWith("Related")
|
|
9063
9064
|
);
|
|
9064
|
-
if (!(d &&
|
|
9065
|
+
if (!(d && E && u))
|
|
9065
9066
|
continue;
|
|
9066
|
-
const p = await e.getProperties((a = E
|
|
9067
|
+
const p = await e.getProperties((a = h[E]) == null ? void 0 : a.value), A = h[u];
|
|
9067
9068
|
if (!p || !A || !(A && Array.isArray(A)))
|
|
9068
9069
|
continue;
|
|
9069
9070
|
const m = A.map((C) => C.value);
|
|
@@ -9230,48 +9231,48 @@ class Yn {
|
|
|
9230
9231
|
s.add(i.get(c));
|
|
9231
9232
|
const o = e.GetLineIDsWithType(0, b.IFCRELAGGREGATES), n = o.size();
|
|
9232
9233
|
for (let c = 0; c < n; c++) {
|
|
9233
|
-
const
|
|
9234
|
+
const h = o.get(c), d = e.GetLine(0, h);
|
|
9234
9235
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
9235
9236
|
continue;
|
|
9236
|
-
const
|
|
9237
|
+
const E = d.RelatingObject.value, u = d.RelatedObjects;
|
|
9237
9238
|
for (const p of u) {
|
|
9238
9239
|
const A = p.value;
|
|
9239
|
-
s.has(A) && (this.itemsByFloor[A] =
|
|
9240
|
+
s.has(A) && (this.itemsByFloor[A] = E);
|
|
9240
9241
|
}
|
|
9241
9242
|
}
|
|
9242
9243
|
const r = {}, a = t.size();
|
|
9243
9244
|
for (let c = 0; c < a; c++) {
|
|
9244
|
-
const
|
|
9245
|
+
const h = t.get(c), d = e.GetLine(0, h);
|
|
9245
9246
|
if (!d || !d.RelatingStructure || !d.RelatedElements)
|
|
9246
9247
|
continue;
|
|
9247
|
-
const
|
|
9248
|
-
if (s.has(
|
|
9248
|
+
const E = d.RelatingStructure.value, u = d.RelatedElements;
|
|
9249
|
+
if (s.has(E))
|
|
9249
9250
|
for (const p of u) {
|
|
9250
|
-
r[
|
|
9251
|
+
r[E] || (r[E] = []);
|
|
9251
9252
|
const A = p.value;
|
|
9252
|
-
r[
|
|
9253
|
+
r[E].push(A);
|
|
9253
9254
|
}
|
|
9254
9255
|
else
|
|
9255
9256
|
for (const p of u) {
|
|
9256
9257
|
const A = p.value;
|
|
9257
|
-
this.itemsByFloor[A] =
|
|
9258
|
+
this.itemsByFloor[A] = E;
|
|
9258
9259
|
}
|
|
9259
9260
|
}
|
|
9260
9261
|
for (const c in r) {
|
|
9261
|
-
const
|
|
9262
|
-
if (
|
|
9262
|
+
const h = this.itemsByFloor[c];
|
|
9263
|
+
if (h !== void 0) {
|
|
9263
9264
|
const d = r[c];
|
|
9264
|
-
for (const
|
|
9265
|
-
this.itemsByFloor[
|
|
9265
|
+
for (const E of d)
|
|
9266
|
+
this.itemsByFloor[E] = h;
|
|
9266
9267
|
}
|
|
9267
9268
|
}
|
|
9268
9269
|
for (let c = 0; c < n; c++) {
|
|
9269
|
-
const
|
|
9270
|
+
const h = o.get(c), d = e.GetLine(0, h);
|
|
9270
9271
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
9271
9272
|
continue;
|
|
9272
|
-
const
|
|
9273
|
+
const E = d.RelatingObject.value, u = d.RelatedObjects;
|
|
9273
9274
|
for (const p of u) {
|
|
9274
|
-
const A = p.value, m = this.itemsByFloor[
|
|
9275
|
+
const A = p.value, m = this.itemsByFloor[E];
|
|
9275
9276
|
m !== void 0 && (this.itemsByFloor[A] = m);
|
|
9276
9277
|
}
|
|
9277
9278
|
}
|
|
@@ -9355,22 +9356,22 @@ class Vn {
|
|
|
9355
9356
|
for (const o of e) {
|
|
9356
9357
|
const n = {};
|
|
9357
9358
|
if (o.data)
|
|
9358
|
-
for (const
|
|
9359
|
-
const [u, p] =
|
|
9359
|
+
for (const E of o.data) {
|
|
9360
|
+
const [u, p] = E.split(": "), A = parseFloat(p);
|
|
9360
9361
|
n[u] = A || p;
|
|
9361
9362
|
}
|
|
9362
9363
|
const { points: r } = o, a = new Float32Array(r.length * 3);
|
|
9363
|
-
for (let
|
|
9364
|
-
const { x: u, y: p, z: A } = r[
|
|
9365
|
-
a[
|
|
9364
|
+
for (let E = 0; E < r.length; E++) {
|
|
9365
|
+
const { x: u, y: p, z: A } = r[E];
|
|
9366
|
+
a[E * 3] = u, a[E * 3 + 1] = p, a[E * 3 + 2] = A || 0;
|
|
9366
9367
|
}
|
|
9367
|
-
const c = new g.BufferAttribute(a, 3),
|
|
9368
|
-
|
|
9368
|
+
const c = new g.BufferAttribute(a, 3), h = new g.EdgesGeometry();
|
|
9369
|
+
h.setAttribute("position", c);
|
|
9369
9370
|
const d = new Vt.CurveMesh(
|
|
9370
9371
|
i,
|
|
9371
9372
|
n,
|
|
9372
9373
|
t,
|
|
9373
|
-
|
|
9374
|
+
h,
|
|
9374
9375
|
this.defLineMat
|
|
9375
9376
|
);
|
|
9376
9377
|
s.push(d.curve), i++;
|
|
@@ -9391,14 +9392,14 @@ class Gn {
|
|
|
9391
9392
|
r,
|
|
9392
9393
|
a,
|
|
9393
9394
|
c,
|
|
9394
|
-
|
|
9395
|
+
h
|
|
9395
9396
|
] = s;
|
|
9396
9397
|
if (i != null && i.value && (t.name = i.value), o != null && o.value && (t.creationDate = new Date(o.value)), n) {
|
|
9397
9398
|
t.author = {};
|
|
9398
|
-
const [
|
|
9399
|
-
|
|
9399
|
+
const [E, u] = n;
|
|
9400
|
+
E != null && E.value && (t.author.name = E.value), u != null && u.value && (t.author.email = u.value);
|
|
9400
9401
|
}
|
|
9401
|
-
return (d = r[0]) != null && d.value && (t.organization = r[0].value), a != null && a.value && (t.preprocessorVersion = a == null ? void 0 : a.value), c != null && c.value && (t.originatingSystem = c == null ? void 0 : c.value),
|
|
9402
|
+
return (d = r[0]) != null && d.value && (t.organization = r[0].value), a != null && a.value && (t.preprocessorVersion = a == null ? void 0 : a.value), c != null && c.value && (t.originatingSystem = c == null ? void 0 : c.value), h != null && h.value && (t.authorization = h == null ? void 0 : h.value), t;
|
|
9402
9403
|
}
|
|
9403
9404
|
getDescriptionInfo(e) {
|
|
9404
9405
|
var n;
|
|
@@ -9497,7 +9498,15 @@ const Ve = class Ve extends et {
|
|
|
9497
9498
|
a.groups.set(o.uuid, o);
|
|
9498
9499
|
for (const c of o.items)
|
|
9499
9500
|
a.list.set(c.id, c), c.mesh.uuid = c.id, c.group = o;
|
|
9500
|
-
|
|
9501
|
+
a.onFragmentsLoaded.trigger(o), s && a.coordinate([o]);
|
|
9502
|
+
for (const [c] of o.data) {
|
|
9503
|
+
const h = r[c];
|
|
9504
|
+
if (!h || !h.GlobalId)
|
|
9505
|
+
continue;
|
|
9506
|
+
const d = h.GlobalId.value || h.GlobalId;
|
|
9507
|
+
o.globalToExpressIDs.set(d, c);
|
|
9508
|
+
}
|
|
9509
|
+
return console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
|
|
9501
9510
|
}
|
|
9502
9511
|
/**
|
|
9503
9512
|
* Reads an IFC file and initializes the Web-IFC library.
|
|
@@ -9553,10 +9562,10 @@ const Ve = class Ve extends et {
|
|
|
9553
9562
|
continue;
|
|
9554
9563
|
const r = this.webIfc.GetLineIDsWithType(0, n), a = r.size();
|
|
9555
9564
|
for (let c = 0; c < a; c++) {
|
|
9556
|
-
const
|
|
9557
|
-
i.push(
|
|
9558
|
-
const d = this._spatialTree.itemsByFloor[
|
|
9559
|
-
s.data.set(
|
|
9565
|
+
const h = r.get(c);
|
|
9566
|
+
i.push(h);
|
|
9567
|
+
const d = this._spatialTree.itemsByFloor[h] || 0;
|
|
9568
|
+
s.data.set(h, [[], [d, n]]);
|
|
9560
9569
|
}
|
|
9561
9570
|
}
|
|
9562
9571
|
this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0, i, (n) => {
|
|
@@ -9571,8 +9580,8 @@ const Ve = class Ve extends et {
|
|
|
9571
9580
|
if (!r)
|
|
9572
9581
|
throw new Error("Fragment not found!");
|
|
9573
9582
|
const a = [];
|
|
9574
|
-
for (const [c,
|
|
9575
|
-
a.push(
|
|
9583
|
+
for (const [c, h] of r)
|
|
9584
|
+
a.push(h);
|
|
9576
9585
|
n.add(a);
|
|
9577
9586
|
}
|
|
9578
9587
|
const o = this.webIfc.GetCoordinationMatrix(0);
|
|
@@ -9581,14 +9590,14 @@ const Ve = class Ve extends et {
|
|
|
9581
9590
|
getMesh(t, s) {
|
|
9582
9591
|
const i = t.geometries.size(), o = t.expressID;
|
|
9583
9592
|
for (let n = 0; n < i; n++) {
|
|
9584
|
-
const r = t.geometries.get(n), { x: a, y: c, z:
|
|
9593
|
+
const r = t.geometries.get(n), { x: a, y: c, z: h, w: d } = r.color, E = d !== 1, { geometryExpressID: u } = r, p = `${u}-${E}`;
|
|
9585
9594
|
if (!this._visitedFragments.has(p)) {
|
|
9586
|
-
const T = this.getGeometry(this.webIfc, u), O =
|
|
9595
|
+
const T = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, _ = new Vt.Fragment(T, O, 1);
|
|
9587
9596
|
s.add(_.mesh), s.items.push(_);
|
|
9588
9597
|
const S = this._visitedFragments.size;
|
|
9589
9598
|
this._visitedFragments.set(p, { index: S, fragment: _ });
|
|
9590
9599
|
}
|
|
9591
|
-
const A = new g.Color().setRGB(a, c,
|
|
9600
|
+
const A = new g.Color().setRGB(a, c, h, "srgb"), m = new g.Matrix4();
|
|
9592
9601
|
m.fromArray(r.flatTransformation);
|
|
9593
9602
|
const C = this._visitedFragments.get(p);
|
|
9594
9603
|
if (C === void 0)
|
|
@@ -9619,10 +9628,10 @@ const Ve = class Ve extends et {
|
|
|
9619
9628
|
i.GetVertexData(),
|
|
9620
9629
|
i.GetVertexDataSize()
|
|
9621
9630
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
9622
|
-
for (let
|
|
9623
|
-
r[
|
|
9624
|
-
const c = new g.BufferGeometry(),
|
|
9625
|
-
return c.setAttribute("position",
|
|
9631
|
+
for (let E = 0; E < n.length; E += 6)
|
|
9632
|
+
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];
|
|
9633
|
+
const c = new g.BufferGeometry(), h = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
|
|
9634
|
+
return c.setAttribute("position", h), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
|
|
9626
9635
|
}
|
|
9627
9636
|
async autoSetWasm() {
|
|
9628
9637
|
const t = await fetch(
|
|
@@ -9751,23 +9760,23 @@ const Bt = class Bt extends et {
|
|
|
9751
9760
|
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
9752
9761
|
*/
|
|
9753
9762
|
async newPset(t, s, i) {
|
|
9754
|
-
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(s), c = i ? new b[o].IfcText(i) : null,
|
|
9763
|
+
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(s), c = i ? new b[o].IfcText(i) : null, h = new b[o].IfcPropertySet(
|
|
9755
9764
|
r,
|
|
9756
9765
|
n,
|
|
9757
9766
|
a,
|
|
9758
9767
|
c,
|
|
9759
9768
|
[]
|
|
9760
9769
|
);
|
|
9761
|
-
|
|
9762
|
-
const d = this.newGUID(t),
|
|
9770
|
+
h.expressID = this.increaseMaxID(t);
|
|
9771
|
+
const d = this.newGUID(t), E = new b[o].IfcRelDefinesByProperties(
|
|
9763
9772
|
d,
|
|
9764
9773
|
n,
|
|
9765
9774
|
null,
|
|
9766
9775
|
null,
|
|
9767
9776
|
[],
|
|
9768
|
-
new b.Handle(
|
|
9777
|
+
new b.Handle(h.expressID)
|
|
9769
9778
|
);
|
|
9770
|
-
return
|
|
9779
|
+
return E.expressID = this.increaseMaxID(t), await this.setData(t, h, E), { pset: h, rel: E };
|
|
9771
9780
|
}
|
|
9772
9781
|
/**
|
|
9773
9782
|
* Removes a Property Set (Pset) from the given model.
|
|
@@ -9913,10 +9922,10 @@ const Bt = class Bt extends et {
|
|
|
9913
9922
|
async saveToIfc(t, s) {
|
|
9914
9923
|
const i = this.components.get(Ri), o = i.webIfc, n = await i.readIfcFile(s), r = this.changeMap[t.uuid] ?? [];
|
|
9915
9924
|
for (const c of r) {
|
|
9916
|
-
const
|
|
9917
|
-
if (
|
|
9925
|
+
const h = await t.getProperties(c);
|
|
9926
|
+
if (h)
|
|
9918
9927
|
try {
|
|
9919
|
-
o.WriteLine(n,
|
|
9928
|
+
o.WriteLine(n, h);
|
|
9920
9929
|
} catch {
|
|
9921
9930
|
}
|
|
9922
9931
|
else
|
|
@@ -9963,8 +9972,8 @@ const Bt = class Bt extends et {
|
|
|
9963
9972
|
get() {
|
|
9964
9973
|
return this._value;
|
|
9965
9974
|
},
|
|
9966
|
-
async set(
|
|
9967
|
-
this._value =
|
|
9975
|
+
async set(h) {
|
|
9976
|
+
this._value = h, c.trigger(h);
|
|
9968
9977
|
}
|
|
9969
9978
|
}), n[i].value = a, this.attributeListeners[t.uuid][s] || (this.attributeListeners[t.uuid][s] = {}), this.attributeListeners[t.uuid][s][i] = c, c;
|
|
9970
9979
|
}
|
|
@@ -10026,8 +10035,8 @@ const Ps = class Ps extends et {
|
|
|
10026
10035
|
else
|
|
10027
10036
|
for (const a of r) {
|
|
10028
10037
|
const c = n[a];
|
|
10029
|
-
for (const
|
|
10030
|
-
delete c[
|
|
10038
|
+
for (const h of i)
|
|
10039
|
+
delete c[h];
|
|
10031
10040
|
Object.values(c).length === 0 && delete n[a];
|
|
10032
10041
|
}
|
|
10033
10042
|
}
|
|
@@ -10082,13 +10091,13 @@ const Ps = class Ps extends et {
|
|
|
10082
10091
|
continue;
|
|
10083
10092
|
}
|
|
10084
10093
|
for (const c of a) {
|
|
10085
|
-
const
|
|
10086
|
-
if (
|
|
10087
|
-
for (const d in
|
|
10094
|
+
const h = this.list[r][c];
|
|
10095
|
+
if (h)
|
|
10096
|
+
for (const d in h) {
|
|
10088
10097
|
o[d] || (o[d] = /* @__PURE__ */ new Map());
|
|
10089
|
-
for (const
|
|
10090
|
-
const u = o[d].get(
|
|
10091
|
-
u === void 0 ? o[d].set(
|
|
10098
|
+
for (const E of h[d]) {
|
|
10099
|
+
const u = o[d].get(E);
|
|
10100
|
+
u === void 0 ? o[d].set(E, 1) : o[d].set(E, u + 1);
|
|
10092
10101
|
}
|
|
10093
10102
|
}
|
|
10094
10103
|
}
|
|
@@ -10096,10 +10105,10 @@ const Ps = class Ps extends et {
|
|
|
10096
10105
|
const n = {};
|
|
10097
10106
|
for (const r in o) {
|
|
10098
10107
|
const a = o[r];
|
|
10099
|
-
for (const [c,
|
|
10100
|
-
if (
|
|
10108
|
+
for (const [c, h] of a) {
|
|
10109
|
+
if (h === void 0)
|
|
10101
10110
|
throw new Error("Malformed fragments map!");
|
|
10102
|
-
|
|
10111
|
+
h === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
|
|
10103
10112
|
}
|
|
10104
10113
|
}
|
|
10105
10114
|
return n;
|
|
@@ -10125,8 +10134,8 @@ const Ps = class Ps extends et {
|
|
|
10125
10134
|
for (const [n, r] of s.data) {
|
|
10126
10135
|
const a = r[0];
|
|
10127
10136
|
for (const c of a) {
|
|
10128
|
-
const
|
|
10129
|
-
|
|
10137
|
+
const h = s.keyFragments.get(c);
|
|
10138
|
+
h && (o[h] || (o[h] = /* @__PURE__ */ new Set()), o[h].add(n));
|
|
10130
10139
|
}
|
|
10131
10140
|
}
|
|
10132
10141
|
}
|
|
@@ -10154,9 +10163,9 @@ const Ps = class Ps extends et {
|
|
|
10154
10163
|
const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
|
|
10155
10164
|
s[a] || (s[a] = {});
|
|
10156
10165
|
const c = s[a];
|
|
10157
|
-
for (const [
|
|
10158
|
-
const
|
|
10159
|
-
for (const u of
|
|
10166
|
+
for (const [h, d] of t.data) {
|
|
10167
|
+
const E = d[0];
|
|
10168
|
+
for (const u of E) {
|
|
10160
10169
|
const p = t.keyFragments.get(u);
|
|
10161
10170
|
if (!p)
|
|
10162
10171
|
throw new Error("Fragment ID not found!");
|
|
@@ -10248,17 +10257,17 @@ const Ps = class Ps extends et {
|
|
|
10248
10257
|
), c = await t.getProperties(r);
|
|
10249
10258
|
if (!(a && c))
|
|
10250
10259
|
continue;
|
|
10251
|
-
const
|
|
10260
|
+
const h = (n = c.Name) == null ? void 0 : n.value;
|
|
10252
10261
|
for (const d of a) {
|
|
10253
|
-
this.saveItem(t, o,
|
|
10254
|
-
const
|
|
10262
|
+
this.saveItem(t, o, h, d);
|
|
10263
|
+
const E = s.getEntityRelations(
|
|
10255
10264
|
t,
|
|
10256
10265
|
Number(d),
|
|
10257
10266
|
"IsDecomposedBy"
|
|
10258
10267
|
);
|
|
10259
|
-
if (
|
|
10260
|
-
for (const u of
|
|
10261
|
-
this.saveItem(t, o,
|
|
10268
|
+
if (E)
|
|
10269
|
+
for (const u of E)
|
|
10270
|
+
this.saveItem(t, o, h, u);
|
|
10262
10271
|
}
|
|
10263
10272
|
}
|
|
10264
10273
|
}
|
|
@@ -10377,12 +10386,12 @@ const ys = class ys extends et {
|
|
|
10377
10386
|
const r = s.list[this.groupName], a = new g.Matrix4();
|
|
10378
10387
|
for (const c in r) {
|
|
10379
10388
|
a.elements[13] = n * o * this.height;
|
|
10380
|
-
for (const
|
|
10381
|
-
const d = i.list.get(
|
|
10389
|
+
for (const h in r[c]) {
|
|
10390
|
+
const d = i.list.get(h), E = c + h, u = this.list.has(E);
|
|
10382
10391
|
if (!d || t && u || !t && !u)
|
|
10383
10392
|
continue;
|
|
10384
|
-
t ? this.list.add(
|
|
10385
|
-
const p = r[c][
|
|
10393
|
+
t ? this.list.add(E) : this.list.delete(E);
|
|
10394
|
+
const p = r[c][h];
|
|
10386
10395
|
d.applyTransform(p, a);
|
|
10387
10396
|
}
|
|
10388
10397
|
n++;
|
|
@@ -10579,23 +10588,28 @@ const ws = class ws extends et {
|
|
|
10579
10588
|
r > t && (r = 0, a++, o.push([]));
|
|
10580
10589
|
const f = C.get(F);
|
|
10581
10590
|
o[a].push(f);
|
|
10582
|
-
const T = this.
|
|
10583
|
-
|
|
10591
|
+
const T = this.webIfc.GetLine(0, f);
|
|
10592
|
+
if (T.GlobalId) {
|
|
10593
|
+
const _ = (T == null ? void 0 : T.GlobalId.value) || (T == null ? void 0 : T.GlobalId);
|
|
10594
|
+
n.globalToExpressIDs.set(_, f);
|
|
10595
|
+
}
|
|
10596
|
+
const O = this._spatialTree.itemsByFloor[f] || 0;
|
|
10597
|
+
n.data.set(f, [[], [O, m]]), r++;
|
|
10584
10598
|
}
|
|
10585
10599
|
}
|
|
10586
10600
|
this._spatialTree.cleanUp();
|
|
10587
|
-
let c = 0.01,
|
|
10601
|
+
let c = 0.01, h = 0;
|
|
10588
10602
|
for (const m of o) {
|
|
10589
|
-
|
|
10603
|
+
h++, this.webIfc.StreamMeshes(0, m, (R) => {
|
|
10590
10604
|
this.getMesh(this.webIfc, R, n);
|
|
10591
10605
|
}), this._geometryCount > t && await this.streamGeometries(), this._assets.length > s && await this.streamAssets();
|
|
10592
|
-
const C =
|
|
10606
|
+
const C = h / o.length;
|
|
10593
10607
|
C > c && (c += 0.01, c = Math.max(c, C), this.onProgress.trigger(Math.round(c * 100) / 100));
|
|
10594
10608
|
}
|
|
10595
10609
|
this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
|
|
10596
|
-
const { opaque: d, transparent:
|
|
10610
|
+
const { opaque: d, transparent: E } = n.geometryIDs;
|
|
10597
10611
|
for (const [m, { index: C, uuid: R }] of this._visitedGeometries)
|
|
10598
|
-
n.keyFragments.set(C, R), (m > 1 ? d :
|
|
10612
|
+
n.keyFragments.set(C, R), (m > 1 ? d : E).set(m, C);
|
|
10599
10613
|
const u = n.data.keys();
|
|
10600
10614
|
for (const m of u) {
|
|
10601
10615
|
const [C] = n.data.get(m);
|
|
@@ -10612,13 +10626,13 @@ const ws = class ws extends et {
|
|
|
10612
10626
|
getMesh(t, s, i) {
|
|
10613
10627
|
const o = s.geometries.size(), n = s.expressID, r = { id: n, geometries: [] };
|
|
10614
10628
|
for (let a = 0; a < o; a++) {
|
|
10615
|
-
const c = s.geometries.get(a),
|
|
10616
|
-
if (!this._visitedGeometries.has(
|
|
10617
|
-
this._visitedGeometries.has(
|
|
10629
|
+
const c = s.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
|
|
10630
|
+
if (!this._visitedGeometries.has(E)) {
|
|
10631
|
+
this._visitedGeometries.has(h) || this.getGeometry(t, h);
|
|
10618
10632
|
const T = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
|
|
10619
|
-
this._visitedGeometries.set(
|
|
10633
|
+
this._visitedGeometries.set(E, { uuid: O, index: T });
|
|
10620
10634
|
}
|
|
10621
|
-
const u = this._visitedGeometries.get(
|
|
10635
|
+
const u = this._visitedGeometries.get(E);
|
|
10622
10636
|
if (u === void 0)
|
|
10623
10637
|
throw new Error("Error getting geometry data for streaming!");
|
|
10624
10638
|
const p = i.data.get(n);
|
|
@@ -10626,7 +10640,7 @@ const ws = class ws extends et {
|
|
|
10626
10640
|
throw new Error("Data not found!");
|
|
10627
10641
|
p[0].push(u.index);
|
|
10628
10642
|
const { x: A, y: m, z: C, w: R } = c.color, F = [A, m, C, R], f = c.flatTransformation;
|
|
10629
|
-
r.geometries.push({ color: F, geometryID:
|
|
10643
|
+
r.geometries.push({ color: F, geometryID: h, transformation: f });
|
|
10630
10644
|
}
|
|
10631
10645
|
this._assets.push(r);
|
|
10632
10646
|
}
|
|
@@ -10640,12 +10654,12 @@ const ws = class ws extends et {
|
|
|
10640
10654
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
10641
10655
|
for (let u = 0; u < n.length; u += 6)
|
|
10642
10656
|
r[u / 2] = n[u], r[u / 2 + 1] = n[u + 1], r[u / 2 + 2] = n[u + 2], a[u / 2] = n[u + 3], a[u / 2 + 1] = n[u + 4], a[u / 2 + 2] = n[u + 5];
|
|
10643
|
-
const c = Tr(r),
|
|
10644
|
-
let
|
|
10657
|
+
const c = Tr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
|
|
10658
|
+
let E = !1;
|
|
10645
10659
|
for (let u = 0; u < r.length - 2; u += 3) {
|
|
10646
10660
|
const p = r[u], A = r[u + 1], m = r[u + 2], C = a[u], R = a[u + 1], F = a[u + 2];
|
|
10647
10661
|
if (mr(d, [p, A, m], [C, R, F])) {
|
|
10648
|
-
|
|
10662
|
+
E = !0;
|
|
10649
10663
|
break;
|
|
10650
10664
|
}
|
|
10651
10665
|
}
|
|
@@ -10653,8 +10667,8 @@ const ws = class ws extends et {
|
|
|
10653
10667
|
position: r,
|
|
10654
10668
|
normal: a,
|
|
10655
10669
|
index: o,
|
|
10656
|
-
boundingBox:
|
|
10657
|
-
hasHoles:
|
|
10670
|
+
boundingBox: h,
|
|
10671
|
+
hasHoles: E
|
|
10658
10672
|
}), i.delete(), this._geometryCount++;
|
|
10659
10673
|
}
|
|
10660
10674
|
async streamAssets() {
|
|
@@ -10758,15 +10772,15 @@ class Kr extends et {
|
|
|
10758
10772
|
for (const c of s) {
|
|
10759
10773
|
if (n++, vn.has(c))
|
|
10760
10774
|
continue;
|
|
10761
|
-
const
|
|
10775
|
+
const h = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), E = d.size();
|
|
10762
10776
|
let u = 0;
|
|
10763
|
-
for (let A = 0; A <
|
|
10777
|
+
for (let A = 0; A < E - t; A += t) {
|
|
10764
10778
|
const m = {};
|
|
10765
10779
|
for (let C = 0; C < t; C++) {
|
|
10766
10780
|
u++;
|
|
10767
10781
|
const R = d.get(A + C);
|
|
10768
10782
|
try {
|
|
10769
|
-
const F = this.webIfc.GetLine(0, R,
|
|
10783
|
+
const F = this.webIfc.GetLine(0, R, h);
|
|
10770
10784
|
m[F.expressID] = F;
|
|
10771
10785
|
} catch {
|
|
10772
10786
|
console.log(`Could not get property: ${R}`);
|
|
@@ -10774,12 +10788,12 @@ class Kr extends et {
|
|
|
10774
10788
|
}
|
|
10775
10789
|
await this.onPropertiesStreamed.trigger({ type: c, data: m });
|
|
10776
10790
|
}
|
|
10777
|
-
if (u !==
|
|
10791
|
+
if (u !== E) {
|
|
10778
10792
|
const A = {};
|
|
10779
|
-
for (let m = u; m <
|
|
10793
|
+
for (let m = u; m < E; m++) {
|
|
10780
10794
|
const C = d.get(m);
|
|
10781
10795
|
try {
|
|
10782
|
-
const R = this.webIfc.GetLine(0, C,
|
|
10796
|
+
const R = this.webIfc.GetLine(0, C, h);
|
|
10783
10797
|
A[R.expressID] = R;
|
|
10784
10798
|
} catch {
|
|
10785
10799
|
console.log(`Could not get property: ${C}`);
|
|
@@ -10839,60 +10853,60 @@ const Ds = class Ds extends et {
|
|
|
10839
10853
|
i,
|
|
10840
10854
|
t
|
|
10841
10855
|
), a = [];
|
|
10842
|
-
for (let
|
|
10843
|
-
const { plane: u, edges: p } = this.getFaceData(
|
|
10856
|
+
for (let E = 0; E < n.length / 3; E++) {
|
|
10857
|
+
const { plane: u, edges: p } = this.getFaceData(E, i, t);
|
|
10844
10858
|
if (u.equals(r)) {
|
|
10845
|
-
a.push({ index:
|
|
10859
|
+
a.push({ index: E, edges: p });
|
|
10846
10860
|
for (const { id: A, points: m, distance: C } of p)
|
|
10847
10861
|
o.set(A, { points: m, distance: C });
|
|
10848
10862
|
}
|
|
10849
10863
|
}
|
|
10850
10864
|
let c = 0;
|
|
10851
|
-
const
|
|
10852
|
-
for (const { index:
|
|
10865
|
+
const h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
|
|
10866
|
+
for (const { index: E, edges: u } of a) {
|
|
10853
10867
|
const p = /* @__PURE__ */ new Map();
|
|
10854
10868
|
for (const { id: T } of u)
|
|
10855
|
-
if (
|
|
10856
|
-
const O =
|
|
10869
|
+
if (h.has(T)) {
|
|
10870
|
+
const O = h.get(T);
|
|
10857
10871
|
p.set(T, O);
|
|
10858
10872
|
}
|
|
10859
10873
|
const A = u.map((T) => T.id);
|
|
10860
10874
|
if (!p.size) {
|
|
10861
10875
|
const T = c++;
|
|
10862
10876
|
for (const { id: O } of u)
|
|
10863
|
-
|
|
10877
|
+
h.set(O, T);
|
|
10864
10878
|
d.set(T, {
|
|
10865
10879
|
edges: new Set(A),
|
|
10866
|
-
indices: /* @__PURE__ */ new Set([
|
|
10880
|
+
indices: /* @__PURE__ */ new Set([E])
|
|
10867
10881
|
});
|
|
10868
10882
|
continue;
|
|
10869
10883
|
}
|
|
10870
10884
|
let m = null;
|
|
10871
10885
|
const C = /* @__PURE__ */ new Set(), R = new Set(A);
|
|
10872
10886
|
for (const [T, O] of p) {
|
|
10873
|
-
m === null ? m = O : O !== m && C.add(O),
|
|
10887
|
+
m === null ? m = O : O !== m && C.add(O), h.delete(T);
|
|
10874
10888
|
const { edges: _ } = d.get(O);
|
|
10875
10889
|
_.delete(T), R.delete(T);
|
|
10876
10890
|
}
|
|
10877
10891
|
if (m === null)
|
|
10878
10892
|
throw new Error("Error computing face!");
|
|
10879
10893
|
const F = d.get(m), { indices: f } = F;
|
|
10880
|
-
f.add(
|
|
10894
|
+
f.add(E);
|
|
10881
10895
|
for (const T of R) {
|
|
10882
|
-
|
|
10896
|
+
h.set(T, m);
|
|
10883
10897
|
const { edges: O } = F;
|
|
10884
10898
|
O.add(T);
|
|
10885
10899
|
}
|
|
10886
10900
|
for (const T of C) {
|
|
10887
10901
|
const O = d.get(T), { edges: _, indices: S } = O, N = d.get(m), { edges: P, indices: w } = N;
|
|
10888
10902
|
for (const y of _)
|
|
10889
|
-
P.add(y),
|
|
10903
|
+
P.add(y), h.set(y, m);
|
|
10890
10904
|
for (const y of S)
|
|
10891
10905
|
w.add(y);
|
|
10892
10906
|
d.delete(T);
|
|
10893
10907
|
}
|
|
10894
10908
|
}
|
|
10895
|
-
for (const [
|
|
10909
|
+
for (const [E, { indices: u, edges: p }] of d)
|
|
10896
10910
|
if (u.has(s)) {
|
|
10897
10911
|
const A = [];
|
|
10898
10912
|
for (const m of p) {
|
|
@@ -10916,14 +10930,14 @@ const Ds = class Ds extends et {
|
|
|
10916
10930
|
getVerticesAndNormal(t, s, i) {
|
|
10917
10931
|
if (!t.geometry.index)
|
|
10918
10932
|
throw new Error("Geometry must be indexed!");
|
|
10919
|
-
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[s * 3] * 3, c = o[s * 3 + 1] * 3,
|
|
10933
|
+
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[s * 3] * 3, c = o[s * 3 + 1] * 3, h = o[s * 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]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[c], r[c + 1], r[c + 2]), m = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (p.x + A.x + m.x) / 3, R = (p.y + A.y + m.y) / 3, F = (p.z + A.z + m.z) / 3, f = new g.Vector3(C, R, F);
|
|
10920
10934
|
if (i !== void 0 && t instanceof g.InstancedMesh) {
|
|
10921
10935
|
const T = new g.Matrix4();
|
|
10922
10936
|
t.getMatrixAt(i, T);
|
|
10923
10937
|
const O = new g.Matrix4();
|
|
10924
|
-
O.extractRotation(T), f.applyMatrix4(O), d.applyMatrix4(T),
|
|
10938
|
+
O.extractRotation(T), f.applyMatrix4(O), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
|
|
10925
10939
|
}
|
|
10926
|
-
return { p1: d, p2:
|
|
10940
|
+
return { p1: d, p2: E, p3: u, faceNormal: f };
|
|
10927
10941
|
}
|
|
10928
10942
|
/**
|
|
10929
10943
|
* Method to round the vector's components to a specified number of decimal places.
|
|
@@ -10938,21 +10952,21 @@ const Ds = class Ds extends et {
|
|
|
10938
10952
|
getFaceData(t, s, i) {
|
|
10939
10953
|
const o = this.getVerticesAndNormal(i, t, s), { p1: n, p2: r, p3: a, faceNormal: c } = o;
|
|
10940
10954
|
this.round(n), this.round(r), this.round(a), this.round(c);
|
|
10941
|
-
const
|
|
10955
|
+
const h = [
|
|
10942
10956
|
{ id: `${n.x}|${n.y}|${n.z}`, value: n },
|
|
10943
10957
|
{ id: `${r.x}|${r.y}|${r.z}`, value: r },
|
|
10944
10958
|
{ id: `${a.x}|${a.y}|${a.z}`, value: a }
|
|
10945
10959
|
];
|
|
10946
|
-
|
|
10960
|
+
h.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
|
|
10947
10961
|
const [
|
|
10948
|
-
{ id: d, value:
|
|
10962
|
+
{ id: d, value: E },
|
|
10949
10963
|
{ id: u, value: p },
|
|
10950
10964
|
{ id: A, value: m }
|
|
10951
|
-
] =
|
|
10965
|
+
] = h, C = [
|
|
10952
10966
|
{
|
|
10953
10967
|
id: `${d}|${u}`,
|
|
10954
|
-
distance:
|
|
10955
|
-
points: [
|
|
10968
|
+
distance: E.distanceTo(p),
|
|
10969
|
+
points: [E, p]
|
|
10956
10970
|
},
|
|
10957
10971
|
{
|
|
10958
10972
|
id: `${u}|${A}`,
|
|
@@ -10961,8 +10975,8 @@ const Ds = class Ds extends et {
|
|
|
10961
10975
|
},
|
|
10962
10976
|
{
|
|
10963
10977
|
id: `${d}|${A}`,
|
|
10964
|
-
distance:
|
|
10965
|
-
points: [
|
|
10978
|
+
distance: E.distanceTo(m),
|
|
10979
|
+
points: [E, m]
|
|
10966
10980
|
}
|
|
10967
10981
|
], R = new g.Plane();
|
|
10968
10982
|
return R.setFromNormalAndCoplanarPoint(c, n), R.constant = Math.round(R.constant * 10) / 10, { plane: R, edges: C };
|