@thatopen/components 2.0.4 → 2.0.6
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/Grids/src/simple-grid.d.ts +1 -3
- package/dist/fragments/FragmentsManager/index.d.ts +1 -0
- package/dist/fragments/IfcLoader/src/ifc-metadata-reader.d.ts +2 -1
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +586 -566
- package/dist/namespace.d.ts +1536 -1536
- package/package.json +5 -21
package/dist/index.mjs
CHANGED
|
@@ -92,26 +92,26 @@ function Ae(l) {
|
|
|
92
92
|
return 2 * (s * t + t * e + e * s);
|
|
93
93
|
}
|
|
94
94
|
function Gs(l, s, t, e, 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, R = -1 / 0;
|
|
96
96
|
const C = i !== null;
|
|
97
97
|
for (let T = s * 6, F = (s + t) * 6; T < F; T += 6) {
|
|
98
98
|
const f = l[T + 0], m = l[T + 1], O = f - m, S = f + m;
|
|
99
99
|
O < o && (o = O), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
|
|
100
100
|
const _ = l[T + 2], N = l[T + 3], L = _ - N, M = _ + N;
|
|
101
|
-
L < n && (n = L), M > c && (c = M), C && _ <
|
|
101
|
+
L < n && (n = L), M > c && (c = M), C && _ < E && (E = _), C && _ > A && (A = _);
|
|
102
102
|
const y = l[T + 4], x = l[T + 5], b = y - x, B = y + x;
|
|
103
|
-
b < r && (r = b), B >
|
|
103
|
+
b < r && (r = b), B > h && (h = B), C && y < u && (u = y), C && y > R && (R = y);
|
|
104
104
|
}
|
|
105
|
-
e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] =
|
|
105
|
+
e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] = h, C && (i[0] = d, i[1] = E, i[2] = u, i[3] = p, i[4] = A, i[5] = R);
|
|
106
106
|
}
|
|
107
107
|
function ho(l, s, t, e) {
|
|
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 = s * 6, d = (s + 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
|
e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = c;
|
|
@@ -121,14 +121,14 @@ function Eo(l, s) {
|
|
|
121
121
|
const t = l.attributes.position, e = l.index ? l.index.array : null, i = Ce(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, R = E + 2;
|
|
128
128
|
e && (p = e[p], A = e[A], R = e[R]), n || (p = p * c + a, A = A * c + a, R = R * c + a);
|
|
129
129
|
for (let C = 0; C < 3; C++) {
|
|
130
130
|
let T, F, f;
|
|
131
|
-
n ? (T = t[
|
|
131
|
+
n ? (T = t[h[C]](p), F = t[h[C]](A), f = t[h[C]](R)) : (T = r[p + C], F = r[A + C], f = r[R + C]);
|
|
132
132
|
let m = T;
|
|
133
133
|
F < m && (m = F), f < m && (m = f);
|
|
134
134
|
let O = T;
|
|
@@ -155,16 +155,16 @@ function Io(l, s, t, e, i, o) {
|
|
|
155
155
|
else if (o === io) {
|
|
156
156
|
const a = Ae(l);
|
|
157
157
|
let c = Ys * i;
|
|
158
|
-
const
|
|
159
|
-
for (let
|
|
160
|
-
const u = s[
|
|
158
|
+
const h = e * 6, d = (e + i) * 6;
|
|
159
|
+
for (let E = 0; E < 3; E++) {
|
|
160
|
+
const u = s[E], R = (s[E + 3] - u) / wt;
|
|
161
161
|
if (i < wt / 4) {
|
|
162
162
|
const C = [...Ut];
|
|
163
163
|
C.length = i;
|
|
164
164
|
let T = 0;
|
|
165
|
-
for (let f =
|
|
165
|
+
for (let f = h; f < d; f += 6, T++) {
|
|
166
166
|
const m = C[T];
|
|
167
|
-
m.candidate = t[f + 2 *
|
|
167
|
+
m.candidate = t[f + 2 * E], m.count = 0;
|
|
168
168
|
const {
|
|
169
169
|
bounds: O,
|
|
170
170
|
leftCacheBounds: S,
|
|
@@ -181,8 +181,8 @@ function Io(l, s, t, e, i, o) {
|
|
|
181
181
|
for (; f + 1 < F && C[f + 1].candidate === m.candidate; )
|
|
182
182
|
C.splice(f + 1, 1), F--;
|
|
183
183
|
}
|
|
184
|
-
for (let f =
|
|
185
|
-
const m = t[f + 2 *
|
|
184
|
+
for (let f = h; f < d; f += 6) {
|
|
185
|
+
const m = t[f + 2 * E];
|
|
186
186
|
for (let O = 0; O < F; O++) {
|
|
187
187
|
const S = C[O];
|
|
188
188
|
m >= S.candidate ? je(f, t, S.rightCacheBounds) : (je(f, t, S.leftCacheBounds), S.count++);
|
|
@@ -195,7 +195,7 @@ function Io(l, s, t, e, i, o) {
|
|
|
195
195
|
let M = 0;
|
|
196
196
|
S !== 0 && (M = Ae(N) / a);
|
|
197
197
|
const y = vi + Ys * (L * O + M * S);
|
|
198
|
-
y < c && (n =
|
|
198
|
+
y < c && (n = E, c = y, r = m.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
201
201
|
for (let F = 0; F < wt; F++) {
|
|
@@ -205,8 +205,8 @@ function Io(l, s, t, e, i, o) {
|
|
|
205
205
|
for (let O = 0; O < 3; O++)
|
|
206
206
|
m[O] = 1 / 0, m[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) / R);
|
|
210
210
|
O >= wt && (O = wt - 1);
|
|
211
211
|
const S = Ut[O];
|
|
212
212
|
S.count++, je(F, t, S.bounds);
|
|
@@ -226,7 +226,7 @@ function Io(l, s, t, e, i, o) {
|
|
|
226
226
|
const M = i - T;
|
|
227
227
|
M !== 0 && (L = Ae(_) / a);
|
|
228
228
|
const y = vi + Ys * (N * T + L * M);
|
|
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 po(l, s, t, e, 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 = s[n * 3 +
|
|
258
|
-
s[n * 3 +
|
|
256
|
+
for (let h = 0; h < 3; h++) {
|
|
257
|
+
let d = s[n * 3 + h];
|
|
258
|
+
s[n * 3 + h] = s[r * 3 + h], s[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 Co(l, s, t, e, 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 To(l, s) {
|
|
|
293
293
|
return n;
|
|
294
294
|
}
|
|
295
295
|
function mo(l, s) {
|
|
296
|
-
const t = l.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, c = Ce(t),
|
|
296
|
+
const t = l.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, c = Ce(t), h = l._indirectBuffer;
|
|
297
297
|
let d = !1;
|
|
298
|
-
const
|
|
298
|
+
const E = new Float32Array(6), u = new Float32Array(6), p = Eo(t, E), A = s.indirect ? Co : po, R = [], C = s.indirect ? Dn(t) : Un(t);
|
|
299
299
|
if (C.length === 1) {
|
|
300
300
|
const f = C[0], m = new $e();
|
|
301
|
-
m.boundingData =
|
|
301
|
+
m.boundingData = E, ho(p, f.offset, f.count, u), F(m, f.offset, f.count, u), R.push(m);
|
|
302
302
|
} else
|
|
303
303
|
for (let f of C) {
|
|
304
304
|
const m = new $e();
|
|
@@ -314,7 +314,7 @@ function mo(l, s) {
|
|
|
314
314
|
const N = Io(f.boundingData, S, p, m, O, r);
|
|
315
315
|
if (N.axis === -1)
|
|
316
316
|
return T(m + O), f.offset = m, f.count = O, f;
|
|
317
|
-
const L = A(
|
|
317
|
+
const L = A(h, e, p, m, O, N);
|
|
318
318
|
if (L === m || L === m + O)
|
|
319
319
|
T(m + O), f.offset = m, f.count = O;
|
|
320
320
|
else {
|
|
@@ -336,29 +336,29 @@ function Ro(l, s) {
|
|
|
336
336
|
let i, o, n;
|
|
337
337
|
const r = [], a = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
|
|
338
338
|
for (let d = 0; d < e.length; d++) {
|
|
339
|
-
const
|
|
340
|
-
let u = c(
|
|
339
|
+
const E = e[d];
|
|
340
|
+
let u = c(E);
|
|
341
341
|
const p = new a(Ts * 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, R = E.boundingData;
|
|
351
351
|
for (let C = 0; C < 6; C++)
|
|
352
352
|
i[u + C] = R[C];
|
|
353
353
|
if (A) {
|
|
354
|
-
const C =
|
|
354
|
+
const C = E.offset, T = E.count;
|
|
355
355
|
return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Us, d + Ts;
|
|
356
356
|
} else {
|
|
357
|
-
const C =
|
|
357
|
+
const C = E.left, T = E.right, F = E.splitAxis;
|
|
358
358
|
let f;
|
|
359
|
-
if (f =
|
|
359
|
+
if (f = h(d + Ts, 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, T), o[u + 7] = F, f;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -393,8 +393,8 @@ Mt.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 @@ Mt.prototype.setFromBox = function() {
|
|
|
404
404
|
const Ao = function() {
|
|
405
405
|
const l = new w(), s = new w(), t = new w();
|
|
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 = s;
|
|
408
408
|
t.subVectors(r, c), l.subVectors(i.end, i.start), s.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), R = a.dot(a) * u - E * E;
|
|
410
410
|
let C, T;
|
|
411
|
-
R !== 0 ? C = (d *
|
|
411
|
+
R !== 0 ? C = (d * E - p * u) / R : C = 0, T = (d + C * E) / u, n.x = C, n.y = T;
|
|
412
412
|
};
|
|
413
413
|
}(), Oi = function() {
|
|
414
414
|
const l = new pe(), s = new w(), t = new w();
|
|
@@ -425,16 +425,16 @@ const Ao = 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, s), o.closestPointToPoint(
|
|
434
|
-
n.copy(
|
|
432
|
+
const E = s, u = t;
|
|
433
|
+
if (i.closestPointToPoint(d, !0, s), 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 Ao = function() {
|
|
|
442
442
|
}(), Fo = function() {
|
|
443
443
|
const l = new w(), s = new w(), t = new Fi(), e = new Lt();
|
|
444
444
|
return function(o, n) {
|
|
445
|
-
const { radius: r, center: a } = o, { a: c, b:
|
|
446
|
-
if (e.start = c, e.end =
|
|
445
|
+
const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
|
|
446
|
+
if (e.start = c, e.end = h, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = h, e.end = d, e.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 Ie {
|
|
|
467
467
|
update() {
|
|
468
468
|
const s = this.a, t = this.b, e = 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(s, t),
|
|
472
|
-
const d = o[2],
|
|
473
|
-
d.subVectors(t, e),
|
|
470
|
+
const c = o[1], h = n[1];
|
|
471
|
+
c.subVectors(s, t), h.setFromPoints(c, i);
|
|
472
|
+
const d = o[2], E = n[2];
|
|
473
|
+
d.subVectors(t, e), E.setFromPoints(d, i);
|
|
474
474
|
const u = o[3], p = n[3];
|
|
475
475
|
u.subVectors(e, s), p.setFromPoints(u, i), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(r, s), this.needsUpdate = !1;
|
|
476
476
|
}
|
|
@@ -479,28 +479,28 @@ Ft.prototype.closestPointToSegment = function() {
|
|
|
479
479
|
const l = new w(), s = new w(), t = new Lt();
|
|
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, s), h = l.distanceToSquared(s), h < d && (d = h, o && o.copy(l), n && n.copy(s));
|
|
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(), s = new Array(3), t = new Array(3), e = new Mt(), i = new Mt(), o = new w(), n = new w(), r = new w(), a = new w(), c = new w(),
|
|
491
|
+
const l = new Ft(), s = new Array(3), t = new Array(3), e = new Mt(), i = new Mt(), o = new w(), n = new w(), r = new w(), a = new w(), c = new w(), h = new Lt(), d = new Lt(), E = new Lt(), u = new w();
|
|
492
492
|
function p(A, R, C) {
|
|
493
493
|
const T = A.points;
|
|
494
494
|
let F = 0, f = -1;
|
|
495
495
|
for (let m = 0; m < 3; m++) {
|
|
496
|
-
const { start: O, end: S } =
|
|
497
|
-
O.copy(T[m]), S.copy(T[(m + 1) % 3]),
|
|
496
|
+
const { start: O, end: S } = h;
|
|
497
|
+
O.copy(T[m]), S.copy(T[(m + 1) % 3]), h.delta(n);
|
|
498
498
|
const _ = zs(R.distanceToPoint(O));
|
|
499
499
|
if (zs(R.normal.dot(n)) && _) {
|
|
500
|
-
C.copy(
|
|
500
|
+
C.copy(h), F = 2;
|
|
501
501
|
break;
|
|
502
502
|
}
|
|
503
|
-
const N = R.intersectLine(
|
|
503
|
+
const N = R.intersectLine(h, u);
|
|
504
504
|
if (!N && _ && u.copy(O), (N || _) && !zs(u.distanceTo(S))) {
|
|
505
505
|
if (F <= 1)
|
|
506
506
|
(F === 1 ? C.start : C.end).copy(u), _ && (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 (m !== 2)
|
|
549
549
|
return !1;
|
|
550
|
-
const O = p(R, F,
|
|
551
|
-
if (O === 1 && this.containsPoint(
|
|
552
|
-
return C && (C.start.copy(
|
|
550
|
+
const O = p(R, 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 x =
|
|
557
|
-
|
|
555
|
+
if (d.delta(r), E.delta(a), r.dot(a) < 0) {
|
|
556
|
+
let x = E.start;
|
|
557
|
+
E.start = E.end, E.end = x;
|
|
558
558
|
}
|
|
559
|
-
const S = d.start.dot(r), _ = d.end.dot(r), N =
|
|
560
|
-
return S !== L && N !== _ && M === y ? !1 : (C && (c.subVectors(d.start,
|
|
559
|
+
const S = d.start.dot(r), _ = d.end.dot(r), N = E.start.dot(r), L = E.end.dot(r), M = _ < N, y = S < L;
|
|
560
|
+
return S !== L && N !== _ && M === 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 ? e : 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
|
-
e.set(this[
|
|
585
|
+
const E = t[d], u = t[(d + 1) % 3];
|
|
586
|
+
e.set(this[E], this[u]);
|
|
587
587
|
for (let p = 0; p < 3; p++) {
|
|
588
588
|
const A = t[p], R = t[(p + 1) % 3];
|
|
589
589
|
i.set(n[A], n[R]), Oi(e, i, l, s);
|
|
590
590
|
const C = l.distanceToSquared(s);
|
|
591
|
-
C <
|
|
591
|
+
C < h && (h = C, r && r.copy(l), a && a.copy(s));
|
|
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 s = this.matrix, t = this.min, e = 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 ? e.x : t.x, u.y =
|
|
614
|
+
const E = 1 * c | 2 * h | 4 * d, u = i[E];
|
|
615
|
+
u.x = c ? e.x : t.x, u.y = h ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
|
|
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 = e.x, l.max = i.x, r[0].isSeparated(l) || (l.min = e.y, l.max = i.y, r[1].isSeparated(l)) || (l.min = e.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
|
s[0] = n.a, s[1] = n.b, s[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, s), 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, s), e.setFromPoints(i, d), t.isSeparated(e))
|
|
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, e), n.closestPointToPoint(e, i), a && a.copy(e), 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 R = 0; R < 8; R++) {
|
|
688
688
|
const C = u[R];
|
|
689
|
-
i.copy(C).clamp(d,
|
|
689
|
+
i.copy(C).clamp(d, E);
|
|
690
690
|
const T = C.distanceToSquared(i);
|
|
691
|
-
if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T <
|
|
691
|
+
if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T < h))
|
|
692
692
|
return Math.sqrt(T);
|
|
693
693
|
}
|
|
694
694
|
let A = 0;
|
|
@@ -698,14 +698,14 @@ at.prototype.distanceToBox = function() {
|
|
|
698
698
|
const F = (R + 1) % 3, f = (R + 2) % 3, m = C << F | T << f, O = 1 << R | C << F | T << f, S = u[m], _ = u[O];
|
|
699
699
|
s[A].set(S, _);
|
|
700
700
|
const L = l[R], M = l[F], y = l[f], x = t[A], b = x.start, B = x.end;
|
|
701
|
-
b[L] = d[L], b[M] = C ? d[M] :
|
|
701
|
+
b[L] = d[L], b[M] = C ? d[M] : E[M], b[y] = T ? d[y] : E[M], B[L] = E[L], B[M] = C ? d[M] : E[M], B[y] = T ? d[y] : E[M], A++;
|
|
702
702
|
}
|
|
703
703
|
for (let R = 0; R <= 1; R++)
|
|
704
704
|
for (let C = 0; C <= 1; C++)
|
|
705
705
|
for (let T = 0; T <= 1; T++) {
|
|
706
|
-
i.x = R ?
|
|
706
|
+
i.x = R ? E.x : d.x, i.y = C ? E.y : d.y, i.z = T ? E.z : d.z, this.closestPointToPoint(i, e);
|
|
707
707
|
const F = i.distanceToSquared(e);
|
|
708
|
-
if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F <
|
|
708
|
+
if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F < h))
|
|
709
709
|
return Math.sqrt(F);
|
|
710
710
|
}
|
|
711
711
|
for (let R = 0; R < 12; R++) {
|
|
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
|
|
|
714
714
|
const F = t[T];
|
|
715
715
|
Oi(C, F, e, i);
|
|
716
716
|
const f = e.distanceToSquared(i);
|
|
717
|
-
if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f <
|
|
717
|
+
if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f < h))
|
|
718
718
|
return Math.sqrt(f);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -781,10 +781,10 @@ function _o(l, s, t, e, i, o) {
|
|
|
781
781
|
}
|
|
782
782
|
function ai(l, s, t, e, 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 $(l, r, Yt), e(
|
|
784
|
+
let h = l * 2;
|
|
785
|
+
if (ht(h, a)) {
|
|
786
|
+
const E = Et(l, c), u = ft(h, a);
|
|
787
|
+
return $(l, r, Yt), e(E, u, !1, n, o + l, Yt);
|
|
788
788
|
} else {
|
|
789
789
|
let L = function(y) {
|
|
790
790
|
const { uint16Array: x, uint32Array: b } = Z;
|
|
@@ -799,10 +799,10 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
799
799
|
y = Ct(y, b), B = y * 2;
|
|
800
800
|
return Et(y, b) + ft(B, x);
|
|
801
801
|
};
|
|
802
|
-
const
|
|
803
|
-
let p =
|
|
802
|
+
const E = pt(l), u = Ct(l, c);
|
|
803
|
+
let p = E, A = u, R, C, T, F;
|
|
804
804
|
if (i && (T = Yt, F = fe, $(p, r, T), $(A, r, F), R = i(T), C = i(F), C < R)) {
|
|
805
|
-
p = u, A =
|
|
805
|
+
p = u, A = E;
|
|
806
806
|
const y = R;
|
|
807
807
|
R = C, C = y, T = F;
|
|
808
808
|
}
|
|
@@ -849,12 +849,12 @@ function No(l, s, t = {}, e = 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) => (Fe.copy(s).clamp(h.min, h.max), Fe.distanceToSquared(s)),
|
|
853
|
+
intersectsBounds: (h, d, E) => E < r && E < n,
|
|
854
|
+
intersectsTriangle: (h, d) => {
|
|
855
|
+
h.closestPointToPoint(s, Fe);
|
|
856
|
+
const E = s.distanceToSquared(Fe);
|
|
857
|
+
return E < r && (Hs.copy(Fe), r = E, a = d), E < o;
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
), r === 1 / 0)
|
|
@@ -875,14 +875,14 @@ function Lo(l, s, t, e, i, o, n, r, a) {
|
|
|
875
875
|
const c = Po(l, ee, se, ie, ss, a);
|
|
876
876
|
if (c) {
|
|
877
877
|
e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), c.uv = Ie.getInterpolation(ss, ee, se, ie, Je, ts, es, new pe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), c.uv1 = Ie.getInterpolation(ss, ee, se, ie, Je, ts, es, new pe())), t && (Gi.fromBufferAttribute(t, o), zi.fromBufferAttribute(t, n), Hi.fromBufferAttribute(t, r), c.normal = Ie.getInterpolation(ss, ee, se, ie, Gi, zi, Hi, new w()), 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 w(),
|
|
883
883
|
materialIndex: 0
|
|
884
884
|
};
|
|
885
|
-
Ie.getNormal(ee, se, ie,
|
|
885
|
+
Ie.getNormal(ee, se, ie, h.normal), c.face = h, c.faceIndex = o;
|
|
886
886
|
}
|
|
887
887
|
return c;
|
|
888
888
|
}
|
|
@@ -891,7 +891,7 @@ function xs(l, s, t, e, 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, s);
|
|
895
895
|
return p ? (p.faceIndex = e, i && i.push(p), p) : null;
|
|
896
896
|
}
|
|
897
897
|
function et(l, s, t, e) {
|
|
@@ -907,7 +907,7 @@ function yo(l, s, t, e, i, o) {
|
|
|
907
907
|
function wo(l, s, t, e, i) {
|
|
908
908
|
const { geometry: o, _indirectBuffer: n } = l;
|
|
909
909
|
let r = 1 / 0, a = null;
|
|
910
|
-
for (let c = e,
|
|
910
|
+
for (let c = e, h = e + i; c < h; c++) {
|
|
911
911
|
let d;
|
|
912
912
|
d = xs(o, s, t, c), d && d.distance < r && (a = d, r = d.distance);
|
|
913
913
|
}
|
|
@@ -915,9 +915,9 @@ function wo(l, s, t, e, i) {
|
|
|
915
915
|
}
|
|
916
916
|
function Mo(l, s, t, e, 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 = s + l; h < d; h++) {
|
|
919
|
+
let E;
|
|
920
|
+
if (E = h, et(n, E * 3, a, c), n.needsUpdate = !0, e(n, E, i, o))
|
|
921
921
|
return !0;
|
|
922
922
|
}
|
|
923
923
|
return !1;
|
|
@@ -926,22 +926,22 @@ function Do(l, s = null) {
|
|
|
926
926
|
s && Array.isArray(s) && (s = new Set(s));
|
|
927
927
|
const t = l.geometry, e = 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], T = r[A + 14];
|
|
936
936
|
let F = 1 / 0, f = 1 / 0, m = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
|
|
937
937
|
for (let N = 3 * C, L = 3 * (C + T); N < L; N++) {
|
|
938
938
|
let M = e[N];
|
|
939
939
|
const y = i.getX(M), x = i.getY(M), b = i.getZ(M);
|
|
940
940
|
y < F && (F = y), y > O && (O = y), x < f && (f = x), x > S && (S = x), b < m && (m = b), b > _ && (_ = b);
|
|
941
941
|
}
|
|
942
|
-
return a[
|
|
942
|
+
return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== m || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = m, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
|
|
943
943
|
} else {
|
|
944
|
-
const C =
|
|
944
|
+
const C = E + 8, T = n[E + 6], F = C + u, f = T + u;
|
|
945
945
|
let m = p, O = !1, S = !1;
|
|
946
946
|
s ? m || (O = s.has(F), S = s.has(f), m = !O && !S) : (O = !0, S = !0);
|
|
947
947
|
const _ = m || O, N = m || S;
|
|
@@ -953,7 +953,7 @@ function Do(l, s = null) {
|
|
|
953
953
|
if (y)
|
|
954
954
|
for (let x = 0; x < 3; x++) {
|
|
955
955
|
const b = C + x, B = T + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
|
|
956
|
-
a[
|
|
956
|
+
a[E + x] = H < st ? H : st, a[E + x + 3] = q > Q ? q : Q;
|
|
957
957
|
}
|
|
958
958
|
return y;
|
|
959
959
|
}
|
|
@@ -966,14 +966,14 @@ function zt(l, s, t, e) {
|
|
|
966
966
|
function Uo(l, s, t, e, i, o) {
|
|
967
967
|
const { geometry: n, _indirectBuffer: r } = l;
|
|
968
968
|
for (let a = e, c = e + i; a < c; a++) {
|
|
969
|
-
let
|
|
970
|
-
xs(n, s, t,
|
|
969
|
+
let h = r ? r[a] : a;
|
|
970
|
+
xs(n, s, t, h, o);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
973
|
function xo(l, s, t, e, i) {
|
|
974
974
|
const { geometry: o, _indirectBuffer: n } = l;
|
|
975
975
|
let r = 1 / 0, a = null;
|
|
976
|
-
for (let c = e,
|
|
976
|
+
for (let c = e, h = e + i; c < h; c++) {
|
|
977
977
|
let d;
|
|
978
978
|
d = xs(o, s, t, n ? n[c] : c), d && d.distance < r && (a = d, r = d.distance);
|
|
979
979
|
}
|
|
@@ -981,9 +981,9 @@ function xo(l, s, t, e, i) {
|
|
|
981
981
|
}
|
|
982
982
|
function bo(l, s, t, e, 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 = s + l; h < d; h++) {
|
|
985
|
+
let E;
|
|
986
|
+
if (E = t.resolveTriangleIndex(h), et(n, E * 3, a, c), n.needsUpdate = !0, e(n, E, i, o))
|
|
987
987
|
return !0;
|
|
988
988
|
}
|
|
989
989
|
return !1;
|
|
@@ -995,11 +995,11 @@ function vo(l, s, t, e, i) {
|
|
|
995
995
|
function ci(l, s, t, e, i) {
|
|
996
996
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
997
997
|
if (ht(a, n)) {
|
|
998
|
-
const
|
|
999
|
-
yo(s, t, e,
|
|
998
|
+
const h = Et(l, r), d = ft(a, n);
|
|
999
|
+
yo(s, t, e, h, d, i);
|
|
1000
1000
|
} else {
|
|
1001
|
-
const
|
|
1002
|
-
zt(
|
|
1001
|
+
const h = pt(l);
|
|
1002
|
+
zt(h, o, e, Wi) && ci(h, s, t, e, i);
|
|
1003
1003
|
const d = Ct(l, r);
|
|
1004
1004
|
zt(d, o, e, Wi) && ci(d, s, t, e, i);
|
|
1005
1005
|
}
|
|
@@ -1014,16 +1014,16 @@ function li(l, s, t, e) {
|
|
|
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 wo(s, t, e, c,
|
|
1017
|
+
const c = Et(l, n), h = ft(r, o);
|
|
1018
|
+
return wo(s, t, e, c, h);
|
|
1019
1019
|
} else {
|
|
1020
|
-
const c = xn(l, n),
|
|
1020
|
+
const c = xn(l, n), h = Bo[c], E = e.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 R = zt(u, i, e, Xi) ? li(u, s, t, e) : null;
|
|
1024
1024
|
if (R) {
|
|
1025
|
-
const F = R.point[
|
|
1026
|
-
if (
|
|
1025
|
+
const F = R.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, s, t, e, 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(), Zi.set(t.boundingBox.min, t.boundingBox.max, e), i = Zi), ht(a, n)) {
|
|
1046
|
-
const
|
|
1046
|
+
const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
|
|
1047
1047
|
if (Oe.copy(e).invert(), t.boundsTree)
|
|
1048
1048
|
return $(l, o, ns), ns.matrix.copy(Oe), ns.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1049
1049
|
intersectsBounds: (T) => ns.intersectsBox(T),
|
|
1050
1050
|
intersectsTriangle: (T) => {
|
|
1051
1051
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
1052
1052
|
for (let F = A * 3, f = (R + A) * 3; F < f; F += 3)
|
|
1053
|
-
if (et(oe, F, d,
|
|
1053
|
+
if (et(oe, F, d, E), oe.needsUpdate = !0, T.intersectsTriangle(oe))
|
|
1054
1054
|
return !0;
|
|
1055
1055
|
return !1;
|
|
1056
1056
|
}
|
|
1057
1057
|
});
|
|
1058
1058
|
for (let C = A * 3, T = (R + A) * 3; C < T; C += 3) {
|
|
1059
|
-
et(ne, C, d,
|
|
1059
|
+
et(ne, C, d, E), ne.a.applyMatrix4(Oe), ne.b.applyMatrix4(Oe), ne.c.applyMatrix4(Oe), ne.needsUpdate = !0;
|
|
1060
1060
|
for (let F = 0, f = u.count; F < f; F += 3)
|
|
1061
1061
|
if (et(oe, F, u, p), oe.needsUpdate = !0, ne.intersectsTriangle(oe))
|
|
1062
1062
|
return !0;
|
|
1063
1063
|
}
|
|
1064
1064
|
} else {
|
|
1065
|
-
const
|
|
1066
|
-
return $(
|
|
1065
|
+
const h = l + 8, d = r[l + 6];
|
|
1066
|
+
return $(h, o, is), !!(i.intersectsBox(is) && hi(h, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && hi(d, s, t, e, i)));
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
1069
|
const os = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Go = /* @__PURE__ */ new w(), zo = /* @__PURE__ */ new w(), Ho = /* @__PURE__ */ new w(), ko = /* @__PURE__ */ new w();
|
|
1070
1070
|
function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1071
1071
|
s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
|
|
1072
|
-
const r = l.geometry, a = r.attributes.position, c = r.index,
|
|
1072
|
+
const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
|
|
1073
1073
|
let p = Go, A = zo, R = null, C = null;
|
|
1074
1074
|
i && (R = Ho, C = ko);
|
|
1075
1075
|
let T = 1 / 0, F = null, f = null;
|
|
@@ -1084,10 +1084,10 @@ function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1084
1084
|
intersectsBounds: (_, N, L) => L < T && L < n,
|
|
1085
1085
|
intersectsRange: (_, N) => {
|
|
1086
1086
|
for (let L = _, M = _ + N; L < M; L++) {
|
|
1087
|
-
et(u, 3 * L, d,
|
|
1087
|
+
et(u, 3 * L, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1088
1088
|
for (let y = m, x = m + O; y < x; y++) {
|
|
1089
|
-
et(
|
|
1090
|
-
const b =
|
|
1089
|
+
et(E, 3 * y, c, a), E.needsUpdate = !0;
|
|
1090
|
+
const b = E.distanceToTriangle(u, p, R);
|
|
1091
1091
|
if (b < T && (A.copy(p), C && C.copy(R), T = b, F = y, f = L), b < o)
|
|
1092
1092
|
return !0;
|
|
1093
1093
|
}
|
|
@@ -1097,10 +1097,10 @@ function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1097
1097
|
{
|
|
1098
1098
|
const S = Ce(s);
|
|
1099
1099
|
for (let _ = 0, N = S; _ < N; _++) {
|
|
1100
|
-
et(u, 3 * _, d,
|
|
1100
|
+
et(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1101
1101
|
for (let L = m, M = m + O; L < M; L++) {
|
|
1102
|
-
et(
|
|
1103
|
-
const y =
|
|
1102
|
+
et(E, 3 * L, c, a), E.needsUpdate = !0;
|
|
1103
|
+
const y = E.distanceToTriangle(u, p, R);
|
|
1104
1104
|
if (y < T && (A.copy(p), C && C.copy(R), T = y, F = L, f = _), y < o)
|
|
1105
1105
|
return !0;
|
|
1106
1106
|
}
|
|
@@ -1108,19 +1108,19 @@ function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
), It.releasePrimitive(
|
|
1111
|
+
), It.releasePrimitive(E), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), A.applyMatrix4(os), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
|
|
1112
1112
|
}
|
|
1113
1113
|
function Xo(l, s = null) {
|
|
1114
1114
|
s && Array.isArray(s) && (s = new Set(s));
|
|
1115
1115
|
const t = l.geometry, e = 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], T = r[A + 14];
|
|
1124
1124
|
let F = 1 / 0, f = 1 / 0, m = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
|
|
1125
1125
|
for (let N = C, L = C + T; N < L; N++) {
|
|
1126
1126
|
const M = 3 * l.resolveTriangleIndex(N);
|
|
@@ -1131,9 +1131,9 @@ function Xo(l, s = null) {
|
|
|
1131
1131
|
b < F && (F = b), b > O && (O = b), B < f && (f = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
return a[
|
|
1134
|
+
return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== m || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = m, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
|
|
1135
1135
|
} else {
|
|
1136
|
-
const C =
|
|
1136
|
+
const C = E + 8, T = n[E + 6], F = C + u, f = T + u;
|
|
1137
1137
|
let m = p, O = !1, S = !1;
|
|
1138
1138
|
s ? m || (O = s.has(F), S = s.has(f), m = !O && !S) : (O = !0, S = !0);
|
|
1139
1139
|
const _ = m || O, N = m || S;
|
|
@@ -1145,7 +1145,7 @@ function Xo(l, s = null) {
|
|
|
1145
1145
|
if (y)
|
|
1146
1146
|
for (let x = 0; x < 3; x++) {
|
|
1147
1147
|
const b = C + x, B = T + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
|
|
1148
|
-
a[
|
|
1148
|
+
a[E + x] = H < st ? H : st, a[E + x + 3] = q > Q ? q : Q;
|
|
1149
1149
|
}
|
|
1150
1150
|
return y;
|
|
1151
1151
|
}
|
|
@@ -1158,11 +1158,11 @@ function Zo(l, s, t, e, i) {
|
|
|
1158
1158
|
function Ei(l, s, t, e, i) {
|
|
1159
1159
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
1160
1160
|
if (ht(a, n)) {
|
|
1161
|
-
const
|
|
1162
|
-
Uo(s, t, e,
|
|
1161
|
+
const h = Et(l, r), d = ft(a, n);
|
|
1162
|
+
Uo(s, t, e, h, d, i);
|
|
1163
1163
|
} else {
|
|
1164
|
-
const
|
|
1165
|
-
zt(
|
|
1164
|
+
const h = pt(l);
|
|
1165
|
+
zt(h, o, e, Qi) && Ei(h, s, t, e, i);
|
|
1166
1166
|
const d = Ct(l, r);
|
|
1167
1167
|
zt(d, o, e, Qi) && Ei(d, s, t, e, i);
|
|
1168
1168
|
}
|
|
@@ -1177,16 +1177,16 @@ function di(l, s, t, e) {
|
|
|
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 xo(s, t, e, c,
|
|
1180
|
+
const c = Et(l, n), h = ft(r, o);
|
|
1181
|
+
return xo(s, t, e, c, h);
|
|
1182
1182
|
} else {
|
|
1183
|
-
const c = xn(l, n),
|
|
1183
|
+
const c = xn(l, n), h = Qo[c], E = e.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 R = zt(u, i, e, ji) ? di(u, s, t, e) : null;
|
|
1187
1187
|
if (R) {
|
|
1188
|
-
const F = R.point[
|
|
1189
|
-
if (
|
|
1188
|
+
const F = R.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, s, t, e, 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(), qi.set(t.boundingBox.min, t.boundingBox.max, e), i = qi), ht(a, n)) {
|
|
1209
|
-
const
|
|
1209
|
+
const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
|
|
1210
1210
|
if (Se.copy(e).invert(), t.boundsTree)
|
|
1211
1211
|
return $(l, o, as), as.matrix.copy(Se), as.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1212
1212
|
intersectsBounds: (T) => as.intersectsBox(T),
|
|
1213
1213
|
intersectsTriangle: (T) => {
|
|
1214
1214
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
1215
1215
|
for (let F = A, f = R + A; F < f; F++)
|
|
1216
|
-
if (et(ae, 3 * s.resolveTriangleIndex(F), d,
|
|
1216
|
+
if (et(ae, 3 * s.resolveTriangleIndex(F), d, E), ae.needsUpdate = !0, T.intersectsTriangle(ae))
|
|
1217
1217
|
return !0;
|
|
1218
1218
|
return !1;
|
|
1219
1219
|
}
|
|
1220
1220
|
});
|
|
1221
1221
|
for (let C = A, T = R + A; C < T; C++) {
|
|
1222
1222
|
const F = s.resolveTriangleIndex(C);
|
|
1223
|
-
et(re, 3 * F, d,
|
|
1223
|
+
et(re, 3 * F, d, E), re.a.applyMatrix4(Se), re.b.applyMatrix4(Se), re.c.applyMatrix4(Se), re.needsUpdate = !0;
|
|
1224
1224
|
for (let f = 0, m = u.count; f < m; f += 3)
|
|
1225
1225
|
if (et(ae, f, u, p), ae.needsUpdate = !0, re.intersectsTriangle(ae))
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
}
|
|
1228
1228
|
} else {
|
|
1229
|
-
const
|
|
1230
|
-
return $(
|
|
1229
|
+
const h = l + 8, d = r[l + 6];
|
|
1230
|
+
return $(h, o, rs), !!(i.intersectsBox(rs) && ui(h, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && ui(d, s, t, e, i)));
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
const cs = /* @__PURE__ */ new yt(), Ws = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), $o = /* @__PURE__ */ new w(), Ko = /* @__PURE__ */ new w(), Jo = /* @__PURE__ */ new w(), tr = /* @__PURE__ */ new w();
|
|
1234
1234
|
function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1235
1235
|
s.boundingBox || s.computeBoundingBox(), Ws.set(s.boundingBox.min, s.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 = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
|
|
1237
1237
|
let p = $o, A = Ko, R = null, C = null;
|
|
1238
1238
|
i && (R = Jo, C = tr);
|
|
1239
1239
|
let T = 1 / 0, F = null, f = null;
|
|
@@ -1250,11 +1250,11 @@ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1250
1250
|
intersectsRange: (_, N) => {
|
|
1251
1251
|
for (let L = _, M = _ + N; L < M; L++) {
|
|
1252
1252
|
const y = S.resolveTriangleIndex(L);
|
|
1253
|
-
et(u, 3 * y, d,
|
|
1253
|
+
et(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1254
1254
|
for (let x = m, b = m + O; x < b; x++) {
|
|
1255
1255
|
const B = l.resolveTriangleIndex(x);
|
|
1256
|
-
et(
|
|
1257
|
-
const H =
|
|
1256
|
+
et(E, 3 * B, c, a), E.needsUpdate = !0;
|
|
1257
|
+
const H = E.distanceToTriangle(u, p, R);
|
|
1258
1258
|
if (H < T && (A.copy(p), C && C.copy(R), T = H, F = x, f = L), H < o)
|
|
1259
1259
|
return !0;
|
|
1260
1260
|
}
|
|
@@ -1264,11 +1264,11 @@ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1264
1264
|
} else {
|
|
1265
1265
|
const S = Ce(s);
|
|
1266
1266
|
for (let _ = 0, N = S; _ < N; _++) {
|
|
1267
|
-
et(u, 3 * _, d,
|
|
1267
|
+
et(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1268
1268
|
for (let L = m, M = m + O; L < M; L++) {
|
|
1269
1269
|
const y = l.resolveTriangleIndex(L);
|
|
1270
|
-
et(
|
|
1271
|
-
const x =
|
|
1270
|
+
et(E, 3 * y, c, a), E.needsUpdate = !0;
|
|
1271
|
+
const x = E.distanceToTriangle(u, p, R);
|
|
1272
1272
|
if (x < T && (A.copy(p), C && C.copy(R), T = x, F = L, f = _), x < o)
|
|
1273
1273
|
return !0;
|
|
1274
1274
|
}
|
|
@@ -1276,7 +1276,7 @@ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
|
-
), It.releasePrimitive(
|
|
1279
|
+
), It.releasePrimitive(E), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(cs), A.applyMatrix4(cs), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
|
|
1280
1280
|
}
|
|
1281
1281
|
function sr() {
|
|
1282
1282
|
return typeof SharedArrayBuffer < "u";
|
|
@@ -1290,11 +1290,11 @@ function ir(l, s, t, e) {
|
|
|
1290
1290
|
const i = l._roots, o = s._roots;
|
|
1291
1291
|
let n, r = 0, a = 0;
|
|
1292
1292
|
const c = new yt().copy(t).invert();
|
|
1293
|
-
for (let
|
|
1294
|
-
be.setBuffer(i[
|
|
1295
|
-
const
|
|
1296
|
-
$(0, be.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
|
+
be.setBuffer(i[h]), a = 0;
|
|
1295
|
+
const E = vt.getPrimitive();
|
|
1296
|
+
$(0, be.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 ir(l, s, t, e) {
|
|
|
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), be.clearBuffer(), r += i[h].length, n)
|
|
1311
1311
|
break;
|
|
1312
1312
|
}
|
|
1313
1313
|
return Qs = !1, n;
|
|
1314
1314
|
}
|
|
1315
|
-
function Tt(l, s, t, e, 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, R =
|
|
1315
|
+
function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
|
|
1316
|
+
let d, E;
|
|
1317
|
+
h ? (d = As, E = be) : (d = be, E = As);
|
|
1318
|
+
const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, R = E.float32Array, C = E.uint32Array, T = E.uint16Array, F = l * 2, f = s * 2, m = ht(F, A), O = ht(f, T);
|
|
1319
1319
|
let S = !1;
|
|
1320
1320
|
if (O && m)
|
|
1321
|
-
|
|
1321
|
+
h ? S = i(
|
|
1322
1322
|
Et(s, C),
|
|
1323
1323
|
ft(s * 2, T),
|
|
1324
1324
|
Et(l, p),
|
|
@@ -1354,7 +1354,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1354
1354
|
a,
|
|
1355
1355
|
r + 1,
|
|
1356
1356
|
_,
|
|
1357
|
-
!
|
|
1357
|
+
!h
|
|
1358
1358
|
) || y && Tt(
|
|
1359
1359
|
s,
|
|
1360
1360
|
L,
|
|
@@ -1366,7 +1366,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1366
1366
|
a,
|
|
1367
1367
|
r + 1,
|
|
1368
1368
|
_,
|
|
1369
|
-
!
|
|
1369
|
+
!h
|
|
1370
1370
|
), vt.releasePrimitive(_);
|
|
1371
1371
|
} else {
|
|
1372
1372
|
const _ = pt(s), N = Ct(s, C);
|
|
@@ -1384,7 +1384,7 @@ function Tt(l, s, t, e, 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, s, t, e, 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 (L)
|
|
1402
1402
|
if (m)
|
|
@@ -1411,7 +1411,7 @@ function Tt(l, s, t, e, 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, s, t, e, 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
|
_,
|
|
1436
1436
|
b,
|
|
@@ -1442,7 +1442,7 @@ function Tt(l, s, t, e, 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 (M)
|
|
@@ -1458,7 +1458,7 @@ function Tt(l, s, t, e, 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, s, t, e, 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
|
b,
|
|
@@ -1489,7 +1489,7 @@ function Tt(l, s, t, e, 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 Si {
|
|
|
1565
1565
|
const e = this._roots[t], i = new Uint32Array(e), o = new Uint16Array(e);
|
|
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
|
-
s(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
|
+
s(a, h, new Float32Array(e, r * 4, 6), d, E);
|
|
1572
1572
|
} else {
|
|
1573
|
-
const d = r + Ts / 4,
|
|
1574
|
-
s(a,
|
|
1573
|
+
const d = r + Ts / 4, E = i[r + 6], u = i[r + 7];
|
|
1574
|
+
s(a, h, new Float32Array(e, 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(s, t = Di) {
|
|
1580
|
-
const e = 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 e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Zo : vo;
|
|
1581
|
+
for (let d = 0, E = e.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, s, o), r) {
|
|
1584
1584
|
const A = a[d].materialIndex;
|
|
1585
1585
|
for (let R = p, C = o.length; R < C; R++)
|
|
1586
1586
|
o[R].face.materialIndex = A;
|
|
@@ -1591,9 +1591,9 @@ class Si {
|
|
|
1591
1591
|
raycastFirst(s, t = Di) {
|
|
1592
1592
|
const e = 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 ? jo : Yo;
|
|
1595
|
+
for (let d = 0, E = e.length; d < E; d++) {
|
|
1596
|
+
const u = n ? t[a[d].materialIndex].side : c, p = h(this, d, u, s);
|
|
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 Si {
|
|
|
1615
1615
|
} = s;
|
|
1616
1616
|
if (n && r) {
|
|
1617
1617
|
const d = n;
|
|
1618
|
-
n = (
|
|
1618
|
+
n = (E, u, p, A, R) => d(E, u, p, A, R) ? !0 : e(E, u, this, r, p, A, t);
|
|
1619
1619
|
} else
|
|
1620
|
-
n || (r ? n = (d,
|
|
1620
|
+
n || (r ? n = (d, E, u, p) => e(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 Si {
|
|
|
1638
1638
|
et(n, A * 3, r, a);
|
|
1639
1639
|
} : (p) => {
|
|
1640
1640
|
et(n, p * 3, r, a);
|
|
1641
|
-
},
|
|
1641
|
+
}, h = It.getPrimitive(), d = s.geometry.index, E = s.geometry.attributes.position, u = s.indirect ? (p) => {
|
|
1642
1642
|
const A = s.resolveTriangleIndex(p);
|
|
1643
|
-
et(
|
|
1643
|
+
et(h, A * 3, d, E);
|
|
1644
1644
|
} : (p) => {
|
|
1645
|
-
et(
|
|
1645
|
+
et(h, p * 3, d, E);
|
|
1646
1646
|
};
|
|
1647
1647
|
if (o) {
|
|
1648
1648
|
const p = (A, R, C, T, F, f, m, O) => {
|
|
1649
1649
|
for (let S = C, _ = C + T; S < _; S++) {
|
|
1650
|
-
u(S),
|
|
1650
|
+
u(S), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
|
|
1651
1651
|
for (let N = A, L = A + R; N < L; N++)
|
|
1652
|
-
if (c(N), n.needsUpdate = !0, o(n,
|
|
1652
|
+
if (c(N), n.needsUpdate = !0, o(n, h, N, S, F, f, m, O))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
1655
1655
|
return !1;
|
|
@@ -1987,11 +1987,11 @@ class ur {
|
|
|
1987
1987
|
const e = this.faces;
|
|
1988
1988
|
let i = -1 / 0, o = 1 / 0;
|
|
1989
1989
|
for (let n = 0, r = e.length; n < r; n++) {
|
|
1990
|
-
const a = e[n], c = a.distanceToPoint(s.origin),
|
|
1991
|
-
if (c > 0 &&
|
|
1990
|
+
const a = e[n], c = a.distanceToPoint(s.origin), h = a.normal.dot(s.direction);
|
|
1991
|
+
if (c > 0 && h >= 0)
|
|
1992
1992
|
return null;
|
|
1993
|
-
const d =
|
|
1994
|
-
if (!(d <= 0) && (
|
|
1993
|
+
const d = h !== 0 ? -c / h : 0;
|
|
1994
|
+
if (!(d <= 0) && (h > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
|
|
1995
1995
|
return null;
|
|
1996
1996
|
}
|
|
1997
1997
|
return i !== -1 / 0 ? s.at(i, t) : s.at(o, t), t;
|
|
@@ -2075,15 +2075,15 @@ class ur {
|
|
|
2075
2075
|
computeInitialHull() {
|
|
2076
2076
|
const s = this.vertices, t = this.computeExtremes(), e = t.min, i = t.max;
|
|
2077
2077
|
let o = 0, n = 0;
|
|
2078
|
-
for (let
|
|
2079
|
-
const u = i[
|
|
2080
|
-
u > o && (o = u, n =
|
|
2078
|
+
for (let E = 0; E < 3; E++) {
|
|
2079
|
+
const u = i[E].point.getComponent(E) - e[E].point.getComponent(E);
|
|
2080
|
+
u > o && (o = u, n = E);
|
|
2081
2081
|
}
|
|
2082
2082
|
const r = e[n], a = i[n];
|
|
2083
|
-
let c,
|
|
2083
|
+
let c, h;
|
|
2084
2084
|
o = 0, tn.set(r.point, a.point);
|
|
2085
|
-
for (let
|
|
2086
|
-
const p = s[
|
|
2085
|
+
for (let E = 0, u = this.vertices.length; E < u; E++) {
|
|
2086
|
+
const p = s[E];
|
|
2087
2087
|
if (p !== r && p !== a) {
|
|
2088
2088
|
tn.closestPointToPoint(p.point, !0, en);
|
|
2089
2089
|
const A = en.distanceToSquared(p.point);
|
|
@@ -2091,42 +2091,42 @@ class ur {
|
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
2093
|
o = -1, qs.setFromCoplanarPoints(r.point, a.point, c.point);
|
|
2094
|
-
for (let
|
|
2095
|
-
const p = s[
|
|
2094
|
+
for (let E = 0, u = this.vertices.length; E < u; E++) {
|
|
2095
|
+
const p = s[E];
|
|
2096
2096
|
if (p !== r && p !== a && p !== c) {
|
|
2097
2097
|
const A = Math.abs(qs.distanceToPoint(p.point));
|
|
2098
|
-
A > o && (o = A,
|
|
2098
|
+
A > o && (o = A, h = p);
|
|
2099
2099
|
}
|
|
2100
2100
|
}
|
|
2101
2101
|
const d = [];
|
|
2102
|
-
if (qs.distanceToPoint(
|
|
2102
|
+
if (qs.distanceToPoint(h.point) < 0) {
|
|
2103
2103
|
d.push(
|
|
2104
2104
|
Rt.create(r, a, c),
|
|
2105
|
-
Rt.create(
|
|
2106
|
-
Rt.create(
|
|
2107
|
-
Rt.create(
|
|
2105
|
+
Rt.create(h, a, r),
|
|
2106
|
+
Rt.create(h, c, a),
|
|
2107
|
+
Rt.create(h, r, c)
|
|
2108
2108
|
);
|
|
2109
|
-
for (let
|
|
2110
|
-
const u = (
|
|
2111
|
-
d[
|
|
2109
|
+
for (let E = 0; E < 3; E++) {
|
|
2110
|
+
const u = (E + 1) % 3;
|
|
2111
|
+
d[E + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[E + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
|
|
2112
2112
|
}
|
|
2113
2113
|
} else {
|
|
2114
2114
|
d.push(
|
|
2115
2115
|
Rt.create(r, c, a),
|
|
2116
|
-
Rt.create(
|
|
2117
|
-
Rt.create(
|
|
2118
|
-
Rt.create(
|
|
2116
|
+
Rt.create(h, r, a),
|
|
2117
|
+
Rt.create(h, a, c),
|
|
2118
|
+
Rt.create(h, c, r)
|
|
2119
2119
|
);
|
|
2120
|
-
for (let
|
|
2121
|
-
const u = (
|
|
2122
|
-
d[
|
|
2120
|
+
for (let E = 0; E < 3; E++) {
|
|
2121
|
+
const u = (E + 1) % 3;
|
|
2122
|
+
d[E + 1].getEdge(2).setTwin(d[0].getEdge((3 - E) % 3)), d[E + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
|
-
for (let
|
|
2126
|
-
this.faces.push(d[
|
|
2127
|
-
for (let
|
|
2128
|
-
const p = s[
|
|
2129
|
-
if (p !== r && p !== a && p !== c && p !==
|
|
2125
|
+
for (let E = 0; E < 4; E++)
|
|
2126
|
+
this.faces.push(d[E]);
|
|
2127
|
+
for (let E = 0, u = s.length; E < u; E++) {
|
|
2128
|
+
const p = s[E];
|
|
2129
|
+
if (p !== r && p !== a && p !== c && p !== h) {
|
|
2130
2130
|
o = this.tolerance;
|
|
2131
2131
|
let A = null;
|
|
2132
2132
|
for (let R = 0; R < 4; R++) {
|
|
@@ -2322,15 +2322,15 @@ function Cr(l, s) {
|
|
|
2322
2322
|
let t = 0, e = 1;
|
|
2323
2323
|
const i = l.elements;
|
|
2324
2324
|
for (let c = 0; c < 3; c++) {
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2325
|
+
const h = Math.abs(i[Nt(Ii[c], fi[c])]);
|
|
2326
|
+
h > t && (t = h, e = c);
|
|
2327
2327
|
}
|
|
2328
2328
|
let o = 1, n = 0;
|
|
2329
2329
|
const r = fi[e], a = Ii[e];
|
|
2330
2330
|
if (Math.abs(i[Nt(a, r)]) > Number.EPSILON) {
|
|
2331
|
-
const c = i[Nt(a, a)],
|
|
2331
|
+
const c = i[Nt(a, a)], h = i[Nt(r, r)], d = i[Nt(a, r)], E = (c - h) / 2 / d;
|
|
2332
2332
|
let u;
|
|
2333
|
-
|
|
2333
|
+
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;
|
|
2334
2334
|
}
|
|
2335
2335
|
return s.identity(), s.elements[Nt(r, r)] = o, s.elements[Nt(a, a)] = o, s.elements[Nt(a, r)] = n, s.elements[Nt(r, a)] = -n, s;
|
|
2336
2336
|
}
|
|
@@ -2368,12 +2368,12 @@ function mr(l) {
|
|
|
2368
2368
|
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);
|
|
2369
2369
|
}
|
|
2370
2370
|
}
|
|
2371
|
-
const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(),
|
|
2371
|
+
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();
|
|
2372
2372
|
let A = 0, R = 0, C = 0, T = 0, F = 0, f = 0, m = 0;
|
|
2373
2373
|
for (let it = 0, Zt = n.length; it < Zt; it += 9) {
|
|
2374
|
-
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),
|
|
2375
|
-
const tt =
|
|
2376
|
-
p.add(
|
|
2374
|
+
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);
|
|
2375
|
+
const tt = E.crossVectors(h, d).length() / 2;
|
|
2376
|
+
p.add(E.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (tt / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (tt / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (tt / 12);
|
|
2377
2377
|
}
|
|
2378
2378
|
p.divideScalar(A), R /= A, C /= A, T /= A, F /= A, f /= A, m /= A, R -= p.x * p.x, C -= p.x * p.y, T -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, m -= p.z * p.z;
|
|
2379
2379
|
const O = new g.Matrix3();
|
|
@@ -3184,25 +3184,25 @@ function Es(l, s, t, e, i = 1 / 0, o) {
|
|
|
3184
3184
|
e = Math.max(1e-4, e);
|
|
3185
3185
|
const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
|
|
3186
3186
|
let c = l - s;
|
|
3187
|
-
const
|
|
3187
|
+
const h = s, d = i * e;
|
|
3188
3188
|
c = mt(c, -d, d), s = l - c;
|
|
3189
|
-
const
|
|
3190
|
-
t.value = (t.value - n *
|
|
3191
|
-
let u = s + (c +
|
|
3192
|
-
return
|
|
3189
|
+
const E = (t.value + n * c) * o;
|
|
3190
|
+
t.value = (t.value - n * E) * a;
|
|
3191
|
+
let u = s + (c + E) * a;
|
|
3192
|
+
return h - l > 0 == u > h && (u = h, t.value = (u - h) / o), u;
|
|
3193
3193
|
}
|
|
3194
3194
|
function an(l, s, t, e, i = 1 / 0, o, n) {
|
|
3195
3195
|
e = Math.max(1e-4, e);
|
|
3196
3196
|
const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
3197
|
-
let
|
|
3198
|
-
const R =
|
|
3197
|
+
let h = s.x, d = s.y, E = s.z, u = l.x - h, p = l.y - d, A = l.z - E;
|
|
3198
|
+
const R = h, C = d, T = E, F = i * e, f = F * F, m = u * u + p * p + A * A;
|
|
3199
3199
|
if (m > f) {
|
|
3200
3200
|
const B = Math.sqrt(m);
|
|
3201
3201
|
u = u / B * F, p = p / B * F, A = A / B * F;
|
|
3202
3202
|
}
|
|
3203
|
-
|
|
3203
|
+
h = l.x - u, d = l.y - p, E = l.z - A;
|
|
3204
3204
|
const O = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * A) * o;
|
|
3205
|
-
t.x = (t.x - r * O) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x =
|
|
3205
|
+
t.x = (t.x - r * O) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = h + (u + O) * c, n.y = d + (p + S) * c, n.z = E + (A + _) * c;
|
|
3206
3206
|
const N = R - l.x, L = C - l.y, M = T - l.z, y = n.x - R, x = n.y - C, b = n.z - T;
|
|
3207
3207
|
return N * y + L * x + M * b > 0 && (n.x = R, n.y = C, n.z = T, t.x = (n.x - R) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
|
|
3208
3208
|
}
|
|
@@ -3408,7 +3408,7 @@ class ot extends gr {
|
|
|
3408
3408
|
deltaY: 0,
|
|
3409
3409
|
mouseButton: m
|
|
3410
3410
|
};
|
|
3411
|
-
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup",
|
|
3411
|
+
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);
|
|
3412
3412
|
}, r = (f) => {
|
|
3413
3413
|
if (!this._enabled || !this._domElement || this._lockedPointer)
|
|
3414
3414
|
return;
|
|
@@ -3454,7 +3454,7 @@ class ot extends gr {
|
|
|
3454
3454
|
}, c = (f) => {
|
|
3455
3455
|
const m = this._lockedPointer || this._findPointerById(1);
|
|
3456
3456
|
m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.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), R());
|
|
3457
|
-
},
|
|
3457
|
+
}, h = (f) => {
|
|
3458
3458
|
const m = this._findPointerById(f.pointerId);
|
|
3459
3459
|
if (!(m && m === this._lockedPointer)) {
|
|
3460
3460
|
if (m && this._disposePointer(m), f.pointerType === "touch")
|
|
@@ -3480,7 +3480,7 @@ class ot extends gr {
|
|
|
3480
3480
|
const f = this._findPointerById(1);
|
|
3481
3481
|
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = P.NONE, C());
|
|
3482
3482
|
};
|
|
3483
|
-
let
|
|
3483
|
+
let E = -1;
|
|
3484
3484
|
const u = (f) => {
|
|
3485
3485
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === P.NONE)
|
|
3486
3486
|
return;
|
|
@@ -3491,7 +3491,7 @@ class ot extends gr {
|
|
|
3491
3491
|
}
|
|
3492
3492
|
if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === P.ROTATE || this.mouseButtons.wheel === P.TRUCK) {
|
|
3493
3493
|
const N = performance.now();
|
|
3494
|
-
|
|
3494
|
+
E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
|
|
3495
3495
|
}
|
|
3496
3496
|
const m = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / m : f.deltaY / (m * 10), S = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3497
3497
|
switch (this.mouseButtons.wheel) {
|
|
@@ -3521,7 +3521,7 @@ class ot extends gr {
|
|
|
3521
3521
|
if (!(!this._domElement || !this._enabled)) {
|
|
3522
3522
|
if (this.mouseButtons.right === ot.ACTION.NONE) {
|
|
3523
3523
|
const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(m);
|
|
3524
|
-
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup",
|
|
3524
|
+
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);
|
|
3525
3525
|
return;
|
|
3526
3526
|
}
|
|
3527
3527
|
f.preventDefault();
|
|
@@ -3569,7 +3569,7 @@ class ot extends gr {
|
|
|
3569
3569
|
}
|
|
3570
3570
|
((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, S, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
3571
3571
|
}, C = () => {
|
|
3572
|
-
Ks(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",
|
|
3572
|
+
Ks(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" }));
|
|
3573
3573
|
};
|
|
3574
3574
|
this.lockPointer = () => {
|
|
3575
3575
|
!this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
|
|
@@ -3579,7 +3579,7 @@ class ot extends gr {
|
|
|
3579
3579
|
deltaX: 0,
|
|
3580
3580
|
deltaY: 0,
|
|
3581
3581
|
mouseButton: null
|
|
3582
|
-
}, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup",
|
|
3582
|
+
}, 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", T), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), A());
|
|
3583
3583
|
}, this.unlockPointer = () => {
|
|
3584
3584
|
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), document.exitPointerLock(), this.cancel(), this._domElement && (this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3585
3585
|
};
|
|
@@ -3589,9 +3589,9 @@ class ot extends gr {
|
|
|
3589
3589
|
this.unlockPointer();
|
|
3590
3590
|
};
|
|
3591
3591
|
this._addAllEventListeners = (f) => {
|
|
3592
|
-
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Nr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel",
|
|
3592
|
+
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Nr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
|
|
3593
3593
|
}, this._removeAllEventListeners = () => {
|
|
3594
|
-
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",
|
|
3594
|
+
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", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3595
3595
|
}, this.cancel = () => {
|
|
3596
3596
|
this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
|
|
3597
3597
|
}, t && this.connect(t), this.update(0);
|
|
@@ -3958,12 +3958,12 @@ class ot extends gr {
|
|
|
3958
3958
|
fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
|
|
3959
3959
|
const a = [], c = s.isBox3 ? ue.copy(s) : ue.setFromObject(s);
|
|
3960
3960
|
c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
|
|
3961
|
-
const
|
|
3962
|
-
a.push(this.rotateTo(
|
|
3963
|
-
const
|
|
3964
|
-
p && u.multiply(si.setFromAxisAngle(us,
|
|
3961
|
+
const h = rn(this._sphericalEnd.theta, on), d = rn(this._sphericalEnd.phi, on);
|
|
3962
|
+
a.push(this.rotateTo(h, d, t));
|
|
3963
|
+
const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = dn.setFromUnitVectors(E, ti), p = k(Math.abs(E.y), 1);
|
|
3964
|
+
p && u.multiply(si.setFromAxisAngle(us, h)), u.multiply(this._yAxisUpSpaceInverse);
|
|
3965
3965
|
const A = En.makeEmpty();
|
|
3966
|
-
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,
|
|
3966
|
+
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);
|
|
3967
3967
|
const R = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
|
|
3968
3968
|
if (Qt(this._camera)) {
|
|
3969
3969
|
const T = this.getDistanceToFitBox(R.x, R.y, R.z, e);
|
|
@@ -4006,8 +4006,8 @@ class ot extends gr {
|
|
|
4006
4006
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
|
|
4007
4007
|
const a = z.set(i, o, n), c = G.set(s, t, e);
|
|
4008
4008
|
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));
|
|
4009
|
-
const
|
|
4010
|
-
return this._createOnRestPromise(
|
|
4009
|
+
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);
|
|
4010
|
+
return this._createOnRestPromise(h);
|
|
4011
4011
|
}
|
|
4012
4012
|
/**
|
|
4013
4013
|
* Similar to setLookAt, but it interpolates between two states.
|
|
@@ -4027,11 +4027,11 @@ class ot extends gr {
|
|
|
4027
4027
|
* @param enableTransition
|
|
4028
4028
|
* @category Methods
|
|
4029
4029
|
*/
|
|
4030
|
-
lerpLookAt(s, t, e, i, o, n, r, a, c,
|
|
4030
|
+
lerpLookAt(s, t, e, i, o, n, r, a, c, h, d, E, u, p = !1) {
|
|
4031
4031
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
|
|
4032
4032
|
const A = G.set(i, o, n), R = z.set(s, t, e);
|
|
4033
4033
|
dt.setFromVector3(R.sub(A).applyQuaternion(this._yAxisUpSpace));
|
|
4034
|
-
const C = de.set(
|
|
4034
|
+
const C = de.set(h, d, E), T = z.set(r, a, c);
|
|
4035
4035
|
we.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
|
|
4036
4036
|
const F = we.theta - dt.theta, f = we.phi - dt.phi, m = we.radius - dt.radius;
|
|
4037
4037
|
this._sphericalEnd.set(dt.radius + m * 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));
|
|
@@ -4277,9 +4277,9 @@ class ot extends gr {
|
|
|
4277
4277
|
}
|
|
4278
4278
|
if (this.dollyToCursor) {
|
|
4279
4279
|
if (Qt(this._camera) && this._changedDolly !== 0) {
|
|
4280
|
-
const d = this._spherical.radius - this._lastDistance,
|
|
4280
|
+
const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(E.up).normalize();
|
|
4281
4281
|
p.lengthSq() === 0 && (p.x = 1);
|
|
4282
|
-
const A = z.crossVectors(p, u), R = this._sphericalEnd.radius * Math.tan(
|
|
4282
|
+
const A = z.crossVectors(p, u), R = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Ne * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = de.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * R * E.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * R)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === he.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === he.OUT && this.maxDistance <= this._spherical.radius;
|
|
4283
4283
|
if (this.infinityDolly && (m || O)) {
|
|
4284
4284
|
this._sphericalEnd.radius -= d, this._spherical.radius -= d;
|
|
4285
4285
|
const _ = z.copy(u).multiplyScalar(-d);
|
|
@@ -4289,7 +4289,7 @@ class ot extends gr {
|
|
|
4289
4289
|
const S = z.subVectors(f, this._targetEnd);
|
|
4290
4290
|
this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
|
|
4291
4291
|
} else if (bt(this._camera) && this._changedZoom !== 0) {
|
|
4292
|
-
const d = this._zoom - this._lastZoom,
|
|
4292
|
+
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 = de.copy(u).add(p.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(ye), F = this._targetEnd.dot(T), f = G.copy(this._targetEnd).lerp(A, C), m = f.dot(T), O = T.multiplyScalar(m - F);
|
|
4293
4293
|
f.sub(O), this._boundary.clampPoint(f, f);
|
|
4294
4294
|
const S = z.subVectors(f, this._targetEnd);
|
|
4295
4295
|
this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
|
|
@@ -4298,8 +4298,8 @@ class ot extends gr {
|
|
|
4298
4298
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
4299
4299
|
const a = this._collisionTest();
|
|
4300
4300
|
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), St.setFromMatrixColumn(this._camera.matrix, 1), jt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), St.multiplyScalar(-this._focalOffset.y), jt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(St).add(jt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
|
|
4301
|
-
const
|
|
4302
|
-
return
|
|
4301
|
+
const h = this._needsUpdate;
|
|
4302
|
+
return h && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : h ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !h && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = h, this._needsUpdate = !1, h;
|
|
4303
4303
|
}
|
|
4304
4304
|
/**
|
|
4305
4305
|
* Get all state in JSON string
|
|
@@ -4490,9 +4490,9 @@ class ot extends gr {
|
|
|
4490
4490
|
return;
|
|
4491
4491
|
const r = n, a = r.geometry.clone();
|
|
4492
4492
|
a.applyMatrix4(r.matrixWorld);
|
|
4493
|
-
const
|
|
4494
|
-
for (let d = 0,
|
|
4495
|
-
G.fromBufferAttribute(
|
|
4493
|
+
const h = a.attributes.position;
|
|
4494
|
+
for (let d = 0, E = h.count; d < E; d++)
|
|
4495
|
+
G.fromBufferAttribute(h, d), o = Math.max(o, i.distanceToSquared(G));
|
|
4496
4496
|
}), e.radius = Math.sqrt(o), e;
|
|
4497
4497
|
}
|
|
4498
4498
|
}
|
|
@@ -4801,9 +4801,6 @@ class Pr {
|
|
|
4801
4801
|
set fade(s) {
|
|
4802
4802
|
this._fade = s ? 3 : 0, this.material.uniforms.uFade.value = this._fade;
|
|
4803
4803
|
}
|
|
4804
|
-
[Symbol.dispose]() {
|
|
4805
|
-
throw new Error("Method not implemented.");
|
|
4806
|
-
}
|
|
4807
4804
|
/** {@link Disposable.dispose} */
|
|
4808
4805
|
dispose() {
|
|
4809
4806
|
this.setupEvents(!1), this.components.get(Ht).destroy(this.three), this.onDisposed.trigger(), this.onDisposed.reset(), this.world = null, this.components = null;
|
|
@@ -4875,8 +4872,8 @@ class Lr extends ri {
|
|
|
4875
4872
|
}), o[T] = F, i[T] = F, e[T] = F;
|
|
4876
4873
|
}
|
|
4877
4874
|
n("camera", s), 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);
|
|
4878
|
-
const r = new w(), a = new w(), c = new Pt(),
|
|
4879
|
-
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart",
|
|
4875
|
+
const r = new w(), a = new w(), c = new Pt(), h = new Pt(), d = new w(), E = new Pt(), u = new w(), p = new w(), A = new w(), R = 0, C = new w();
|
|
4876
|
+
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", R), n("eye", C), this._offset = new w(), this._startNorm = new w(), this._endNorm = new w(), this._cameraScale = new w(), this._parentPosition = new w(), this._parentQuaternion = new Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new w(), this._worldScaleStart = new w(), this._worldQuaternionInv = new Pt(), this._worldScale = new w(), this._positionStart = new w(), this._quaternionStart = new Pt(), this._scaleStart = new w(), this._getPointer = yr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = wr.bind(this), this._onPointerMove = Dr.bind(this), this._onPointerUp = Ur.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
4880
4877
|
}
|
|
4881
4878
|
// updateMatrixWorld updates key transformation variables
|
|
4882
4879
|
updateMatrixWorld() {
|
|
@@ -5038,12 +5035,12 @@ class xr extends ri {
|
|
|
5038
5035
|
a.color.setHex(16711680), a.opacity = 0.5;
|
|
5039
5036
|
const c = s.clone();
|
|
5040
5037
|
c.color.setHex(65280), c.opacity = 0.5;
|
|
5041
|
-
const
|
|
5042
|
-
|
|
5038
|
+
const h = s.clone();
|
|
5039
|
+
h.color.setHex(255), h.opacity = 0.5;
|
|
5043
5040
|
const d = s.clone();
|
|
5044
5041
|
d.opacity = 0.25;
|
|
5045
|
-
const
|
|
5046
|
-
|
|
5042
|
+
const E = s.clone();
|
|
5043
|
+
E.color.setHex(16776960), E.opacity = 0.25, s.clone().color.setHex(16776960);
|
|
5047
5044
|
const p = s.clone();
|
|
5048
5045
|
p.color.setHex(7895160);
|
|
5049
5046
|
const A = new ct(0, 0.04, 0.1, 12);
|
|
@@ -5082,7 +5079,7 @@ class xr extends ri {
|
|
|
5082
5079
|
[new v(new Qe(0.1, 0), d.clone()), [0, 0, 0]]
|
|
5083
5080
|
],
|
|
5084
5081
|
XY: [
|
|
5085
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5082
|
+
[new v(new rt(0.15, 0.15, 0.01), h.clone()), [0.15, 0.15, 0]]
|
|
5086
5083
|
],
|
|
5087
5084
|
YZ: [
|
|
5088
5085
|
[new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
@@ -5148,7 +5145,7 @@ class xr extends ri {
|
|
|
5148
5145
|
[new v(F(0.5, 0.5), r), null, [0, Math.PI / 2, 0]]
|
|
5149
5146
|
],
|
|
5150
5147
|
E: [
|
|
5151
|
-
[new v(F(0.75, 1),
|
|
5148
|
+
[new v(F(0.75, 1), E), null, [0, Math.PI / 2, 0]]
|
|
5152
5149
|
]
|
|
5153
5150
|
}, N = {
|
|
5154
5151
|
AXIS: [
|
|
@@ -5187,7 +5184,7 @@ class xr extends ri {
|
|
|
5187
5184
|
[new v(R, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
5188
5185
|
],
|
|
5189
5186
|
XY: [
|
|
5190
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5187
|
+
[new v(new rt(0.15, 0.15, 0.01), h), [0.15, 0.15, 0]]
|
|
5191
5188
|
],
|
|
5192
5189
|
YZ: [
|
|
5193
5190
|
[new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
@@ -5853,22 +5850,22 @@ class Gr extends Vr {
|
|
|
5853
5850
|
let a;
|
|
5854
5851
|
if (Array.isArray(o)) {
|
|
5855
5852
|
let d = !0;
|
|
5856
|
-
const
|
|
5853
|
+
const E = [];
|
|
5857
5854
|
for (const u of o)
|
|
5858
|
-
nn.isTransparent(u) ?
|
|
5855
|
+
nn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
|
|
5859
5856
|
if (d) {
|
|
5860
5857
|
n.dispose(), this.isProcessing = !1;
|
|
5861
5858
|
return;
|
|
5862
5859
|
}
|
|
5863
|
-
a =
|
|
5860
|
+
a = E;
|
|
5864
5861
|
} else if (nn.isTransparent(o)) {
|
|
5865
5862
|
n.dispose(), this.isProcessing = !1;
|
|
5866
5863
|
return;
|
|
5867
5864
|
} else
|
|
5868
5865
|
a = n;
|
|
5869
5866
|
this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
|
|
5870
|
-
const c = e ? t.count : 1,
|
|
5871
|
-
e ?
|
|
5867
|
+
const c = e ? t.count : 1, h = new g.InstancedMesh(i, a, c);
|
|
5868
|
+
e ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new g.Matrix4()), t.visible = !1, h.applyMatrix4(t.matrix), h.updateMatrix(), this.scene.add(h), this.colorMeshes.set(t.uuid, h), this.increaseColor(), this.isProcessing = !1;
|
|
5872
5869
|
}
|
|
5873
5870
|
remove(t) {
|
|
5874
5871
|
if (this.isProcessing) {
|
|
@@ -6288,10 +6285,10 @@ class oa extends ke {
|
|
|
6288
6285
|
}
|
|
6289
6286
|
const a = new g.Box3(n, r), c = new g.Vector3();
|
|
6290
6287
|
a.getSize(c);
|
|
6291
|
-
const
|
|
6292
|
-
a.getCenter(
|
|
6293
|
-
const d = Math.max(c.x, c.y, c.z) * e,
|
|
6294
|
-
await this.controls.fitToSphere(
|
|
6288
|
+
const h = new g.Vector3();
|
|
6289
|
+
a.getCenter(h);
|
|
6290
|
+
const d = Math.max(c.x, c.y, c.z) * e, E = new g.Sphere(h, d);
|
|
6291
|
+
await this.controls.fitToSphere(E, !0);
|
|
6295
6292
|
}
|
|
6296
6293
|
/**
|
|
6297
6294
|
* Allows or prevents all user input.
|
|
@@ -6389,16 +6386,16 @@ const At = class At extends J {
|
|
|
6389
6386
|
const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
|
|
6390
6387
|
if (e && t instanceof Vt.FragmentMesh)
|
|
6391
6388
|
for (const c of e) {
|
|
6392
|
-
const
|
|
6393
|
-
if (
|
|
6394
|
-
for (const d of
|
|
6389
|
+
const h = t.fragment.getInstancesIDs(c);
|
|
6390
|
+
if (h)
|
|
6391
|
+
for (const d of h)
|
|
6395
6392
|
a.add(d);
|
|
6396
6393
|
}
|
|
6397
6394
|
else
|
|
6398
6395
|
a.add(0);
|
|
6399
6396
|
for (const c of a) {
|
|
6400
|
-
const
|
|
6401
|
-
r && (t.getMatrixAt(c, n),
|
|
6397
|
+
const h = i.min.clone(), d = i.max.clone();
|
|
6398
|
+
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);
|
|
6402
6399
|
}
|
|
6403
6400
|
}
|
|
6404
6401
|
static getFragmentBounds(t) {
|
|
@@ -6411,8 +6408,8 @@ const At = class At extends J {
|
|
|
6411
6408
|
c += 2;
|
|
6412
6409
|
continue;
|
|
6413
6410
|
}
|
|
6414
|
-
const
|
|
6415
|
-
d < n.x && (n.x = d),
|
|
6411
|
+
const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
|
|
6412
|
+
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);
|
|
6416
6413
|
}
|
|
6417
6414
|
return new g.Box3(n, r);
|
|
6418
6415
|
}
|
|
@@ -6581,9 +6578,9 @@ const Li = /* @__PURE__ */ new Set([
|
|
|
6581
6578
|
for (const c of r) {
|
|
6582
6579
|
if (Li.has(c))
|
|
6583
6580
|
continue;
|
|
6584
|
-
const
|
|
6585
|
-
for (const
|
|
6586
|
-
const u = t.GetLine(0,
|
|
6581
|
+
const h = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
|
|
6582
|
+
for (const E of d) {
|
|
6583
|
+
const u = t.GetLine(0, E, h, i);
|
|
6587
6584
|
n[u.expressID] = u;
|
|
6588
6585
|
}
|
|
6589
6586
|
}
|
|
@@ -6639,10 +6636,11 @@ const Ps = class Ps extends J {
|
|
|
6639
6636
|
* @returns The loaded FragmentsGroup.
|
|
6640
6637
|
*/
|
|
6641
6638
|
load(t, e) {
|
|
6642
|
-
const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n,
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6639
|
+
const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n, name: r, properties: a, relationsMap: c } = o, h = this._loader.import(t);
|
|
6640
|
+
r && (h.name = r);
|
|
6641
|
+
for (const d of h.items)
|
|
6642
|
+
d.group = h, this.list.set(d.id, d);
|
|
6643
|
+
return n && this.coordinate([h]), this.groups.set(h.uuid, h), a && h.setLocalProperties(a), c && this.components.get(We).setRelationMap(h, c), this.onFragmentsLoaded.trigger(h), h;
|
|
6646
6644
|
}
|
|
6647
6645
|
/**
|
|
6648
6646
|
* Export the specified fragments.
|
|
@@ -7977,8 +7975,8 @@ class Gt {
|
|
|
7977
7975
|
const a = await s.getProperties(r.value);
|
|
7978
7976
|
if (!a || !a.UnitType || !a.UnitType.value || a.UnitType.value !== "LENGTHUNIT")
|
|
7979
7977
|
continue;
|
|
7980
|
-
let
|
|
7981
|
-
return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (
|
|
7978
|
+
let h = 1, d = 1;
|
|
7979
|
+
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;
|
|
7982
7980
|
}
|
|
7983
7981
|
return 1;
|
|
7984
7982
|
}
|
|
@@ -7997,17 +7995,17 @@ class Gt {
|
|
|
7997
7995
|
const o = e ?? (async () => {
|
|
7998
7996
|
}), n = {}, r = s.getAllPropertiesIDs();
|
|
7999
7997
|
for (const c of r) {
|
|
8000
|
-
const
|
|
8001
|
-
if (!
|
|
7998
|
+
const h = await s.getProperties(c);
|
|
7999
|
+
if (!h)
|
|
8002
8000
|
continue;
|
|
8003
|
-
const d =
|
|
8001
|
+
const d = h.type === t, E = Object.keys(h).find(
|
|
8004
8002
|
(C) => C.startsWith("Relating")
|
|
8005
|
-
), u = Object.keys(
|
|
8003
|
+
), u = Object.keys(h).find(
|
|
8006
8004
|
(C) => C.startsWith("Related")
|
|
8007
8005
|
);
|
|
8008
|
-
if (!(d &&
|
|
8006
|
+
if (!(d && E && u))
|
|
8009
8007
|
continue;
|
|
8010
|
-
const p = await s.getProperties((a = E
|
|
8008
|
+
const p = await s.getProperties((a = h[E]) == null ? void 0 : a.value), A = h[u];
|
|
8011
8009
|
if (!p || !A || !(A && Array.isArray(A)))
|
|
8012
8010
|
continue;
|
|
8013
8011
|
const R = A.map((C) => C.value);
|
|
@@ -8249,11 +8247,11 @@ const Qr = /* @__PURE__ */ new Map([
|
|
|
8249
8247
|
const r = this._relToAttributesMap.get(i);
|
|
8250
8248
|
if (!r)
|
|
8251
8249
|
return;
|
|
8252
|
-
const { forRelated: a, forRelating: c } = r,
|
|
8253
|
-
|
|
8254
|
-
for (const
|
|
8255
|
-
const u = e.get(
|
|
8256
|
-
A.push(o), u.set(p, A), e.set(
|
|
8250
|
+
const { forRelated: a, forRelating: c } = r, h = e.get(o) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(c);
|
|
8251
|
+
h.set(d, n), e.set(o, h);
|
|
8252
|
+
for (const E of n) {
|
|
8253
|
+
const u = e.get(E) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(a), A = u.get(p) ?? [];
|
|
8254
|
+
A.push(o), u.set(p, A), e.set(E, u);
|
|
8257
8255
|
}
|
|
8258
8256
|
}
|
|
8259
8257
|
);
|
|
@@ -8274,18 +8272,18 @@ const Qr = /* @__PURE__ */ new Map([
|
|
|
8274
8272
|
if (!n)
|
|
8275
8273
|
continue;
|
|
8276
8274
|
const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
|
|
8277
|
-
for (let
|
|
8275
|
+
for (let h = 0; h < c.size(); h++) {
|
|
8278
8276
|
const d = await t.properties.getItemProperties(
|
|
8279
8277
|
e,
|
|
8280
|
-
c.get(
|
|
8281
|
-
),
|
|
8278
|
+
c.get(h)
|
|
8279
|
+
), E = Object.keys(d).find(
|
|
8282
8280
|
(T) => T.startsWith("Relating")
|
|
8283
8281
|
), u = Object.keys(d).find(
|
|
8284
8282
|
(T) => T.startsWith("Related")
|
|
8285
8283
|
);
|
|
8286
|
-
if (!(
|
|
8284
|
+
if (!(E && u))
|
|
8287
8285
|
continue;
|
|
8288
|
-
const p = d[
|
|
8286
|
+
const p = d[E].value, A = d[u].map((T) => T.value), R = i.get(p) ?? /* @__PURE__ */ new Map(), C = this._inverseAttributes.indexOf(a);
|
|
8289
8287
|
R.set(C, A), i.set(p, R);
|
|
8290
8288
|
for (const T of A) {
|
|
8291
8289
|
const F = i.get(T) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(r), m = F.get(f) ?? [];
|
|
@@ -8483,48 +8481,48 @@ class Yn {
|
|
|
8483
8481
|
e.add(i.get(c));
|
|
8484
8482
|
const o = s.GetLineIDsWithType(0, U.IFCRELAGGREGATES), n = o.size();
|
|
8485
8483
|
for (let c = 0; c < n; c++) {
|
|
8486
|
-
const
|
|
8484
|
+
const h = o.get(c), d = s.GetLine(0, h);
|
|
8487
8485
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8488
8486
|
continue;
|
|
8489
|
-
const
|
|
8487
|
+
const E = d.RelatingObject.value, u = d.RelatedObjects;
|
|
8490
8488
|
for (const p of u) {
|
|
8491
8489
|
const A = p.value;
|
|
8492
|
-
e.has(A) && (this.itemsByFloor[A] =
|
|
8490
|
+
e.has(A) && (this.itemsByFloor[A] = E);
|
|
8493
8491
|
}
|
|
8494
8492
|
}
|
|
8495
8493
|
const r = {}, a = t.size();
|
|
8496
8494
|
for (let c = 0; c < a; c++) {
|
|
8497
|
-
const
|
|
8495
|
+
const h = t.get(c), d = s.GetLine(0, h);
|
|
8498
8496
|
if (!d || !d.RelatingStructure || !d.RelatedElements)
|
|
8499
8497
|
continue;
|
|
8500
|
-
const
|
|
8501
|
-
if (e.has(
|
|
8498
|
+
const E = d.RelatingStructure.value, u = d.RelatedElements;
|
|
8499
|
+
if (e.has(E))
|
|
8502
8500
|
for (const p of u) {
|
|
8503
|
-
r[
|
|
8501
|
+
r[E] || (r[E] = []);
|
|
8504
8502
|
const A = p.value;
|
|
8505
|
-
r[
|
|
8503
|
+
r[E].push(A);
|
|
8506
8504
|
}
|
|
8507
8505
|
else
|
|
8508
8506
|
for (const p of u) {
|
|
8509
8507
|
const A = p.value;
|
|
8510
|
-
this.itemsByFloor[A] =
|
|
8508
|
+
this.itemsByFloor[A] = E;
|
|
8511
8509
|
}
|
|
8512
8510
|
}
|
|
8513
8511
|
for (const c in r) {
|
|
8514
|
-
const
|
|
8515
|
-
if (
|
|
8512
|
+
const h = this.itemsByFloor[c];
|
|
8513
|
+
if (h !== void 0) {
|
|
8516
8514
|
const d = r[c];
|
|
8517
|
-
for (const
|
|
8518
|
-
this.itemsByFloor[
|
|
8515
|
+
for (const E of d)
|
|
8516
|
+
this.itemsByFloor[E] = h;
|
|
8519
8517
|
}
|
|
8520
8518
|
}
|
|
8521
8519
|
for (let c = 0; c < n; c++) {
|
|
8522
|
-
const
|
|
8520
|
+
const h = o.get(c), d = s.GetLine(0, h);
|
|
8523
8521
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8524
8522
|
continue;
|
|
8525
|
-
const
|
|
8523
|
+
const E = d.RelatingObject.value, u = d.RelatedObjects;
|
|
8526
8524
|
for (const p of u) {
|
|
8527
|
-
const A = p.value, R = this.itemsByFloor[
|
|
8525
|
+
const A = p.value, R = this.itemsByFloor[E];
|
|
8528
8526
|
R !== void 0 && (this.itemsByFloor[A] = R);
|
|
8529
8527
|
}
|
|
8530
8528
|
}
|
|
@@ -8594,22 +8592,22 @@ class Vn {
|
|
|
8594
8592
|
for (const o of s) {
|
|
8595
8593
|
const n = {};
|
|
8596
8594
|
if (o.data)
|
|
8597
|
-
for (const
|
|
8598
|
-
const [u, p] =
|
|
8595
|
+
for (const E of o.data) {
|
|
8596
|
+
const [u, p] = E.split(": "), A = parseFloat(p);
|
|
8599
8597
|
n[u] = A || p;
|
|
8600
8598
|
}
|
|
8601
8599
|
const { points: r } = o, a = new Float32Array(r.length * 3);
|
|
8602
|
-
for (let
|
|
8603
|
-
const { x: u, y: p, z: A } = r[
|
|
8604
|
-
a[
|
|
8600
|
+
for (let E = 0; E < r.length; E++) {
|
|
8601
|
+
const { x: u, y: p, z: A } = r[E];
|
|
8602
|
+
a[E * 3] = u, a[E * 3 + 1] = p, a[E * 3 + 2] = A || 0;
|
|
8605
8603
|
}
|
|
8606
|
-
const c = new g.BufferAttribute(a, 3),
|
|
8607
|
-
|
|
8604
|
+
const c = new g.BufferAttribute(a, 3), h = new g.EdgesGeometry();
|
|
8605
|
+
h.setAttribute("position", c);
|
|
8608
8606
|
const d = new Vt.CurveMesh(
|
|
8609
8607
|
i,
|
|
8610
8608
|
n,
|
|
8611
8609
|
t,
|
|
8612
|
-
|
|
8610
|
+
h,
|
|
8613
8611
|
this.defLineMat
|
|
8614
8612
|
);
|
|
8615
8613
|
e.push(d.curve), i++;
|
|
@@ -8618,19 +8616,38 @@ class Vn {
|
|
|
8618
8616
|
}
|
|
8619
8617
|
}
|
|
8620
8618
|
class Gn {
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
const
|
|
8624
|
-
if (!
|
|
8625
|
-
return
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8619
|
+
getNameInfo(s) {
|
|
8620
|
+
var d;
|
|
8621
|
+
const t = {}, { arguments: e } = s.GetHeaderLine(0, U.FILE_NAME) || {};
|
|
8622
|
+
if (!e)
|
|
8623
|
+
return t;
|
|
8624
|
+
const [
|
|
8625
|
+
i,
|
|
8626
|
+
o,
|
|
8627
|
+
n,
|
|
8628
|
+
r,
|
|
8629
|
+
a,
|
|
8630
|
+
c,
|
|
8631
|
+
h
|
|
8632
|
+
] = e;
|
|
8633
|
+
if (i != null && i.value && (t.name = i.value), o != null && o.value && (t.creationDate = new Date(o.value)), n) {
|
|
8634
|
+
t.author = {};
|
|
8635
|
+
const [E, u] = n;
|
|
8636
|
+
E != null && E.value && (t.author.name = E.value), u != null && u.value && (t.author.email = u.value);
|
|
8637
|
+
}
|
|
8638
|
+
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;
|
|
8639
|
+
}
|
|
8640
|
+
getDescriptionInfo(s) {
|
|
8641
|
+
var n;
|
|
8642
|
+
const t = {}, { arguments: e } = s.GetHeaderLine(0, U.FILE_DESCRIPTION) || {};
|
|
8643
|
+
if (!e)
|
|
8644
|
+
return t;
|
|
8645
|
+
const [i, o] = e;
|
|
8646
|
+
if ((n = i[0]) != null && n.value) {
|
|
8647
|
+
const r = i[0].value.match(/\[([^\]]+)\]/);
|
|
8648
|
+
r[1] && (t.viewDefinition = r[1]);
|
|
8649
|
+
}
|
|
8650
|
+
return o != null && o.value && (t.implementationLevel = o.value), t;
|
|
8634
8651
|
}
|
|
8635
8652
|
}
|
|
8636
8653
|
const Ge = class Ge extends J {
|
|
@@ -8678,43 +8695,45 @@ const Ge = class Ge extends J {
|
|
|
8678
8695
|
}
|
|
8679
8696
|
async getAllGeometries() {
|
|
8680
8697
|
this._spatialTree.setUp(this.webIfc);
|
|
8681
|
-
const t = this.webIfc.GetIfcEntityList(0), e = new Vt.FragmentsGroup()
|
|
8698
|
+
const t = this.webIfc.GetIfcEntityList(0), e = new Vt.FragmentsGroup();
|
|
8682
8699
|
e.ifcMetadata = {
|
|
8683
|
-
name:
|
|
8684
|
-
description:
|
|
8700
|
+
name: "",
|
|
8701
|
+
description: "",
|
|
8702
|
+
...this._metaData.getNameInfo(this.webIfc),
|
|
8703
|
+
...this._metaData.getDescriptionInfo(this.webIfc),
|
|
8685
8704
|
schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
|
|
8686
8705
|
maxExpressID: this.webIfc.GetMaxExpressID(0)
|
|
8687
8706
|
};
|
|
8688
|
-
const
|
|
8689
|
-
for (const
|
|
8690
|
-
if (!this.webIfc.IsIfcElement(
|
|
8707
|
+
const i = [];
|
|
8708
|
+
for (const n of t) {
|
|
8709
|
+
if (!this.webIfc.IsIfcElement(n) && n !== U.IFCSPACE || this.settings.excludedCategories.has(n))
|
|
8691
8710
|
continue;
|
|
8692
|
-
const
|
|
8693
|
-
for (let
|
|
8694
|
-
const h =
|
|
8695
|
-
|
|
8696
|
-
const
|
|
8697
|
-
e.data.set(h, [[], [
|
|
8711
|
+
const r = this.webIfc.GetLineIDsWithType(0, n), a = r.size();
|
|
8712
|
+
for (let c = 0; c < a; c++) {
|
|
8713
|
+
const h = r.get(c);
|
|
8714
|
+
i.push(h);
|
|
8715
|
+
const d = this._spatialTree.itemsByFloor[h] || 0;
|
|
8716
|
+
e.data.set(h, [[], [d, n]]);
|
|
8698
8717
|
}
|
|
8699
8718
|
}
|
|
8700
|
-
this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0,
|
|
8701
|
-
this.getMesh(
|
|
8719
|
+
this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0, i, (n) => {
|
|
8720
|
+
this.getMesh(n, e);
|
|
8702
8721
|
});
|
|
8703
|
-
for (const
|
|
8704
|
-
const { index:
|
|
8705
|
-
e.keyFragments.set(
|
|
8722
|
+
for (const n of this._visitedFragments) {
|
|
8723
|
+
const { index: r, fragment: a } = n[1];
|
|
8724
|
+
e.keyFragments.set(r, a.id);
|
|
8706
8725
|
}
|
|
8707
|
-
for (const
|
|
8708
|
-
const
|
|
8709
|
-
if (!
|
|
8726
|
+
for (const n of e.items) {
|
|
8727
|
+
const r = this._fragmentInstances.get(n.id);
|
|
8728
|
+
if (!r)
|
|
8710
8729
|
throw new Error("Fragment not found!");
|
|
8711
|
-
const
|
|
8712
|
-
for (const [
|
|
8713
|
-
|
|
8714
|
-
|
|
8730
|
+
const a = [];
|
|
8731
|
+
for (const [c, h] of r)
|
|
8732
|
+
a.push(h);
|
|
8733
|
+
n.add(a);
|
|
8715
8734
|
}
|
|
8716
|
-
const
|
|
8717
|
-
return e.coordinationMatrix.fromArray(
|
|
8735
|
+
const o = this.webIfc.GetCoordinationMatrix(0);
|
|
8736
|
+
return e.coordinationMatrix.fromArray(o), e.civilData = this._civil.read(this.webIfc), e;
|
|
8718
8737
|
}
|
|
8719
8738
|
cleanUp() {
|
|
8720
8739
|
this.webIfc = null, this.webIfc = new U.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
|
|
@@ -8722,14 +8741,14 @@ const Ge = class Ge extends J {
|
|
|
8722
8741
|
getMesh(t, e) {
|
|
8723
8742
|
const i = t.geometries.size(), o = t.expressID;
|
|
8724
8743
|
for (let n = 0; n < i; n++) {
|
|
8725
|
-
const r = t.geometries.get(n), { x: a, y: c, z:
|
|
8744
|
+
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}`;
|
|
8726
8745
|
if (!this._visitedFragments.has(p)) {
|
|
8727
|
-
const m = this.getGeometry(this.webIfc, u), O =
|
|
8746
|
+
const m = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, S = new Vt.Fragment(m, O, 1);
|
|
8728
8747
|
e.add(S.mesh), e.items.push(S);
|
|
8729
8748
|
const _ = this._visitedFragments.size;
|
|
8730
8749
|
this._visitedFragments.set(p, { index: _, fragment: S });
|
|
8731
8750
|
}
|
|
8732
|
-
const A = new g.Color().setRGB(a, c,
|
|
8751
|
+
const A = new g.Color().setRGB(a, c, h, "srgb"), R = new g.Matrix4();
|
|
8733
8752
|
R.fromArray(r.flatTransformation);
|
|
8734
8753
|
const C = this._visitedFragments.get(p);
|
|
8735
8754
|
if (C === void 0)
|
|
@@ -8760,10 +8779,10 @@ const Ge = class Ge extends J {
|
|
|
8760
8779
|
i.GetVertexData(),
|
|
8761
8780
|
i.GetVertexDataSize()
|
|
8762
8781
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
8763
|
-
for (let
|
|
8764
|
-
r[
|
|
8765
|
-
const c = new g.BufferGeometry(),
|
|
8766
|
-
return c.setAttribute("position",
|
|
8782
|
+
for (let E = 0; E < n.length; E += 6)
|
|
8783
|
+
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];
|
|
8784
|
+
const c = new g.BufferGeometry(), h = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
|
|
8785
|
+
return c.setAttribute("position", h), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
|
|
8767
8786
|
}
|
|
8768
8787
|
async autoSetWasm() {
|
|
8769
8788
|
const t = await fetch(
|
|
@@ -8846,23 +8865,23 @@ const Bt = class Bt extends J {
|
|
|
8846
8865
|
}
|
|
8847
8866
|
}
|
|
8848
8867
|
async newPset(t, e, i) {
|
|
8849
|
-
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new U[o].IfcLabel(e), c = i ? new U[o].IfcText(i) : null,
|
|
8868
|
+
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new U[o].IfcLabel(e), c = i ? new U[o].IfcText(i) : null, h = new U[o].IfcPropertySet(
|
|
8850
8869
|
r,
|
|
8851
8870
|
n,
|
|
8852
8871
|
a,
|
|
8853
8872
|
c,
|
|
8854
8873
|
[]
|
|
8855
8874
|
);
|
|
8856
|
-
|
|
8857
|
-
const d = this.newGUID(t),
|
|
8875
|
+
h.expressID = this.increaseMaxID(t);
|
|
8876
|
+
const d = this.newGUID(t), E = new U[o].IfcRelDefinesByProperties(
|
|
8858
8877
|
d,
|
|
8859
8878
|
n,
|
|
8860
8879
|
null,
|
|
8861
8880
|
null,
|
|
8862
8881
|
[],
|
|
8863
|
-
new U.Handle(
|
|
8882
|
+
new U.Handle(h.expressID)
|
|
8864
8883
|
);
|
|
8865
|
-
return
|
|
8884
|
+
return E.expressID = this.increaseMaxID(t), await this.setData(t, h, E), { pset: h, rel: E };
|
|
8866
8885
|
}
|
|
8867
8886
|
async removePset(t, ...e) {
|
|
8868
8887
|
for (const i of e) {
|
|
@@ -8931,10 +8950,10 @@ const Bt = class Bt extends J {
|
|
|
8931
8950
|
async saveToIfc(t, e) {
|
|
8932
8951
|
const i = this.components.get(Ri), o = i.webIfc, n = await i.readIfcFile(e), r = this.changeMap[t.uuid] ?? [];
|
|
8933
8952
|
for (const c of r) {
|
|
8934
|
-
const
|
|
8935
|
-
if (
|
|
8953
|
+
const h = await t.getProperties(c);
|
|
8954
|
+
if (h)
|
|
8936
8955
|
try {
|
|
8937
|
-
o.WriteLine(n,
|
|
8956
|
+
o.WriteLine(n, h);
|
|
8938
8957
|
} catch {
|
|
8939
8958
|
}
|
|
8940
8959
|
else
|
|
@@ -8967,8 +8986,8 @@ const Bt = class Bt extends J {
|
|
|
8967
8986
|
get() {
|
|
8968
8987
|
return this._value;
|
|
8969
8988
|
},
|
|
8970
|
-
async set(
|
|
8971
|
-
this._value =
|
|
8989
|
+
async set(h) {
|
|
8990
|
+
this._value = h, c.trigger(h);
|
|
8972
8991
|
}
|
|
8973
8992
|
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = c, c;
|
|
8974
8993
|
}
|
|
@@ -8992,8 +9011,8 @@ const Ls = class Ls extends J {
|
|
|
8992
9011
|
else
|
|
8993
9012
|
for (const a of r) {
|
|
8994
9013
|
const c = n[a];
|
|
8995
|
-
for (const
|
|
8996
|
-
delete c[
|
|
9014
|
+
for (const h of i)
|
|
9015
|
+
delete c[h];
|
|
8997
9016
|
Object.values(c).length === 0 && delete n[a];
|
|
8998
9017
|
}
|
|
8999
9018
|
}
|
|
@@ -9028,13 +9047,13 @@ const Ls = class Ls extends J {
|
|
|
9028
9047
|
continue;
|
|
9029
9048
|
}
|
|
9030
9049
|
for (const c of a) {
|
|
9031
|
-
const
|
|
9032
|
-
if (
|
|
9033
|
-
for (const d in
|
|
9050
|
+
const h = this.list[r][c];
|
|
9051
|
+
if (h)
|
|
9052
|
+
for (const d in h) {
|
|
9034
9053
|
o[d] || (o[d] = /* @__PURE__ */ new Map());
|
|
9035
|
-
for (const
|
|
9036
|
-
const u = o[d].get(
|
|
9037
|
-
u === void 0 ? o[d].set(
|
|
9054
|
+
for (const E of h[d]) {
|
|
9055
|
+
const u = o[d].get(E);
|
|
9056
|
+
u === void 0 ? o[d].set(E, 1) : o[d].set(E, u + 1);
|
|
9038
9057
|
}
|
|
9039
9058
|
}
|
|
9040
9059
|
}
|
|
@@ -9042,10 +9061,10 @@ const Ls = class Ls extends J {
|
|
|
9042
9061
|
const n = {};
|
|
9043
9062
|
for (const r in o) {
|
|
9044
9063
|
const a = o[r];
|
|
9045
|
-
for (const [c,
|
|
9046
|
-
if (
|
|
9064
|
+
for (const [c, h] of a) {
|
|
9065
|
+
if (h === void 0)
|
|
9047
9066
|
throw new Error("Malformed fragments map!");
|
|
9048
|
-
|
|
9067
|
+
h === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
|
|
9049
9068
|
}
|
|
9050
9069
|
}
|
|
9051
9070
|
return n;
|
|
@@ -9058,8 +9077,8 @@ const Ls = class Ls extends J {
|
|
|
9058
9077
|
for (const [n, r] of e.data) {
|
|
9059
9078
|
const a = r[0];
|
|
9060
9079
|
for (const c of a) {
|
|
9061
|
-
const
|
|
9062
|
-
|
|
9080
|
+
const h = e.keyFragments.get(c);
|
|
9081
|
+
h && (o[h] || (o[h] = /* @__PURE__ */ new Set()), o[h].add(n));
|
|
9063
9082
|
}
|
|
9064
9083
|
}
|
|
9065
9084
|
}
|
|
@@ -9074,9 +9093,9 @@ const Ls = class Ls extends J {
|
|
|
9074
9093
|
const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
|
|
9075
9094
|
e[a] || (e[a] = {});
|
|
9076
9095
|
const c = e[a];
|
|
9077
|
-
for (const [
|
|
9078
|
-
const
|
|
9079
|
-
for (const u of
|
|
9096
|
+
for (const [h, d] of t.data) {
|
|
9097
|
+
const E = d[0];
|
|
9098
|
+
for (const u of E) {
|
|
9080
9099
|
const p = t.keyFragments.get(u);
|
|
9081
9100
|
if (!p)
|
|
9082
9101
|
throw new Error("Fragment ID not found!");
|
|
@@ -9127,17 +9146,17 @@ const Ls = class Ls extends J {
|
|
|
9127
9146
|
), c = await t.getProperties(r);
|
|
9128
9147
|
if (!(a && c))
|
|
9129
9148
|
continue;
|
|
9130
|
-
const
|
|
9149
|
+
const h = (n = c.Name) == null ? void 0 : n.value;
|
|
9131
9150
|
for (const d of a) {
|
|
9132
|
-
this.saveItem(t, o,
|
|
9133
|
-
const
|
|
9151
|
+
this.saveItem(t, o, h, d);
|
|
9152
|
+
const E = e.getEntityRelations(
|
|
9134
9153
|
t,
|
|
9135
9154
|
Number(d),
|
|
9136
9155
|
"IsDecomposedBy"
|
|
9137
9156
|
);
|
|
9138
|
-
if (
|
|
9139
|
-
for (const u of
|
|
9140
|
-
this.saveItem(t, o,
|
|
9157
|
+
if (E)
|
|
9158
|
+
for (const u of E)
|
|
9159
|
+
this.saveItem(t, o, h, u);
|
|
9141
9160
|
}
|
|
9142
9161
|
}
|
|
9143
9162
|
}
|
|
@@ -9198,12 +9217,12 @@ const ys = class ys extends J {
|
|
|
9198
9217
|
const r = e.list[this.groupName], a = new g.Matrix4();
|
|
9199
9218
|
for (const c in r) {
|
|
9200
9219
|
a.elements[13] = n * o * this.height;
|
|
9201
|
-
for (const
|
|
9202
|
-
const d = i.list.get(
|
|
9220
|
+
for (const h in r[c]) {
|
|
9221
|
+
const d = i.list.get(h), E = c + h, u = this.list.has(E);
|
|
9203
9222
|
if (!d || t && u || !t && !u)
|
|
9204
9223
|
continue;
|
|
9205
|
-
t ? this.list.add(
|
|
9206
|
-
const p = r[c][
|
|
9224
|
+
t ? this.list.add(E) : this.list.delete(E);
|
|
9225
|
+
const p = r[c][h];
|
|
9207
9226
|
d.applyTransform(p, a);
|
|
9208
9227
|
}
|
|
9209
9228
|
n++;
|
|
@@ -9304,47 +9323,47 @@ class $r extends J {
|
|
|
9304
9323
|
U.IFCBUILDINGSTOREY,
|
|
9305
9324
|
U.IFCSPACE
|
|
9306
9325
|
]);
|
|
9307
|
-
for (const
|
|
9308
|
-
e.add(
|
|
9326
|
+
for (const h of n)
|
|
9327
|
+
e.add(h);
|
|
9309
9328
|
let r = 0.01, a = 0;
|
|
9310
|
-
for (const
|
|
9311
|
-
if (a++, Li.has(
|
|
9329
|
+
for (const h of e) {
|
|
9330
|
+
if (a++, Li.has(h))
|
|
9312
9331
|
continue;
|
|
9313
|
-
const d = n.has(
|
|
9332
|
+
const d = n.has(h), E = this.webIfc.GetLineIDsWithType(0, h), u = E.size();
|
|
9314
9333
|
let p = 0;
|
|
9315
9334
|
for (let R = 0; R < u - t; R += t) {
|
|
9316
9335
|
const C = {};
|
|
9317
9336
|
for (let T = 0; T < t; T++) {
|
|
9318
9337
|
p++;
|
|
9319
|
-
const F =
|
|
9338
|
+
const F = E.get(R + T);
|
|
9320
9339
|
try {
|
|
9321
9340
|
const f = this.webIfc.GetLine(0, F, d);
|
|
9322
|
-
i.includes(
|
|
9341
|
+
i.includes(h) && this.getIndices(f, F, o), C[f.expressID] = f;
|
|
9323
9342
|
} catch {
|
|
9324
9343
|
console.log(`Could not get property: ${F}`);
|
|
9325
9344
|
}
|
|
9326
9345
|
}
|
|
9327
|
-
await this.onPropertiesStreamed.trigger({ type:
|
|
9346
|
+
await this.onPropertiesStreamed.trigger({ type: h, data: C });
|
|
9328
9347
|
}
|
|
9329
9348
|
if (p !== u) {
|
|
9330
9349
|
const R = {};
|
|
9331
9350
|
for (let C = p; C < u; C++) {
|
|
9332
|
-
const T =
|
|
9351
|
+
const T = E.get(C);
|
|
9333
9352
|
try {
|
|
9334
9353
|
const F = this.webIfc.GetLine(0, T, d);
|
|
9335
|
-
i.includes(
|
|
9354
|
+
i.includes(h) && this.getIndices(F, T, o), R[F.expressID] = F;
|
|
9336
9355
|
} catch {
|
|
9337
9356
|
console.log(`Could not get property: ${T}`);
|
|
9338
9357
|
}
|
|
9339
9358
|
}
|
|
9340
|
-
await this.onPropertiesStreamed.trigger({ type:
|
|
9359
|
+
await this.onPropertiesStreamed.trigger({ type: h, data: R });
|
|
9341
9360
|
}
|
|
9342
9361
|
const A = a / e.size;
|
|
9343
9362
|
A > r && (r += 0.01, r = Math.max(r, A), await this.onProgress.trigger(Math.round(r * 100) / 100));
|
|
9344
9363
|
}
|
|
9345
9364
|
const c = [];
|
|
9346
|
-
for (const [
|
|
9347
|
-
c.push([
|
|
9365
|
+
for (const [h, d] of o)
|
|
9366
|
+
c.push([h, ...d]);
|
|
9348
9367
|
await this.onIndicesStreamed.trigger(c);
|
|
9349
9368
|
}
|
|
9350
9369
|
getIndices(t, e, i) {
|
|
@@ -9419,49 +9438,50 @@ const Ms = class Ms extends J {
|
|
|
9419
9438
|
async streamAllGeometries() {
|
|
9420
9439
|
const { minGeometrySize: t, minAssetsSize: e } = this.settings;
|
|
9421
9440
|
this._spatialTree.setUp(this.webIfc);
|
|
9422
|
-
const i = this.webIfc.GetIfcEntityList(0), o = [[]], n = new Vt.FragmentsGroup()
|
|
9441
|
+
const i = this.webIfc.GetIfcEntityList(0), o = [[]], n = new Vt.FragmentsGroup();
|
|
9423
9442
|
n.ifcMetadata = {
|
|
9424
|
-
name:
|
|
9425
|
-
description:
|
|
9443
|
+
name: "",
|
|
9444
|
+
description: "",
|
|
9445
|
+
...this._metaData.getNameInfo(this.webIfc),
|
|
9446
|
+
...this._metaData.getDescriptionInfo(this.webIfc),
|
|
9426
9447
|
schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
|
|
9427
9448
|
maxExpressID: this.webIfc.GetMaxExpressID(0)
|
|
9428
9449
|
};
|
|
9429
|
-
let
|
|
9430
|
-
for (const
|
|
9431
|
-
if (!this.webIfc.IsIfcElement(
|
|
9450
|
+
let r = 0, a = 0;
|
|
9451
|
+
for (const R of i) {
|
|
9452
|
+
if (!this.webIfc.IsIfcElement(R) && R !== U.IFCSPACE || this.settings.excludedCategories.has(R))
|
|
9432
9453
|
continue;
|
|
9433
|
-
const
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
n.data.set(O, [[], [S, T]]), c++;
|
|
9454
|
+
const C = this.webIfc.GetLineIDsWithType(0, R), T = C.size();
|
|
9455
|
+
for (let F = 0; F < T; F++) {
|
|
9456
|
+
r > t && (r = 0, a++, o.push([]));
|
|
9457
|
+
const f = C.get(F);
|
|
9458
|
+
o[a].push(f);
|
|
9459
|
+
const m = this._spatialTree.itemsByFloor[f] || 0;
|
|
9460
|
+
n.data.set(f, [[], [m, R]]), r++;
|
|
9441
9461
|
}
|
|
9442
9462
|
}
|
|
9443
9463
|
this._spatialTree.cleanUp();
|
|
9444
|
-
let
|
|
9445
|
-
for (const
|
|
9446
|
-
h++, this.webIfc.StreamMeshes(0,
|
|
9447
|
-
this.getMesh(this.webIfc,
|
|
9464
|
+
let c = 0.01, h = 0;
|
|
9465
|
+
for (const R of o) {
|
|
9466
|
+
h++, this.webIfc.StreamMeshes(0, R, (T) => {
|
|
9467
|
+
this.getMesh(this.webIfc, T, n);
|
|
9448
9468
|
}), this._geometryCount > t && await this.streamGeometries(), this._assets.length > e && await this.streamAssets();
|
|
9449
|
-
const
|
|
9450
|
-
|
|
9469
|
+
const C = h / o.length;
|
|
9470
|
+
C > c && (c += 0.01, c = Math.max(c, C), this.onProgress.trigger(Math.round(c * 100) / 100));
|
|
9451
9471
|
}
|
|
9452
9472
|
this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
|
|
9453
|
-
const { opaque:
|
|
9454
|
-
for (const [
|
|
9455
|
-
n.keyFragments.set(
|
|
9456
|
-
const
|
|
9457
|
-
for (const
|
|
9458
|
-
const [
|
|
9459
|
-
|
|
9460
|
-
}
|
|
9461
|
-
const
|
|
9462
|
-
n.coordinationMatrix.fromArray(
|
|
9463
|
-
const
|
|
9464
|
-
this.onIfcLoaded.trigger(
|
|
9473
|
+
const { opaque: d, transparent: E } = n.geometryIDs;
|
|
9474
|
+
for (const [R, { index: C, uuid: T }] of this._visitedGeometries)
|
|
9475
|
+
n.keyFragments.set(C, T), (R > 1 ? d : E).set(R, C);
|
|
9476
|
+
const u = n.data.keys();
|
|
9477
|
+
for (const R of u) {
|
|
9478
|
+
const [C] = n.data.get(R);
|
|
9479
|
+
C.length || n.data.delete(R);
|
|
9480
|
+
}
|
|
9481
|
+
const p = this.webIfc.GetCoordinationMatrix(0);
|
|
9482
|
+
n.coordinationMatrix.fromArray(p), n.civilData = this._civil.read(this.webIfc);
|
|
9483
|
+
const A = this._groupSerializer.export(n);
|
|
9484
|
+
this.onIfcLoaded.trigger(A), n.dispose(!0);
|
|
9465
9485
|
}
|
|
9466
9486
|
cleanUp() {
|
|
9467
9487
|
this.webIfc = null, this.webIfc = new U.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
|
|
@@ -9469,13 +9489,13 @@ const Ms = class Ms extends J {
|
|
|
9469
9489
|
getMesh(t, e, i) {
|
|
9470
9490
|
const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
|
|
9471
9491
|
for (let a = 0; a < o; a++) {
|
|
9472
|
-
const c = e.geometries.get(a),
|
|
9473
|
-
if (!this._visitedGeometries.has(
|
|
9474
|
-
this._visitedGeometries.has(
|
|
9492
|
+
const c = e.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
|
|
9493
|
+
if (!this._visitedGeometries.has(E)) {
|
|
9494
|
+
this._visitedGeometries.has(h) || this.getGeometry(t, h);
|
|
9475
9495
|
const m = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
|
|
9476
|
-
this._visitedGeometries.set(
|
|
9496
|
+
this._visitedGeometries.set(E, { uuid: O, index: m });
|
|
9477
9497
|
}
|
|
9478
|
-
const u = this._visitedGeometries.get(
|
|
9498
|
+
const u = this._visitedGeometries.get(E);
|
|
9479
9499
|
if (u === void 0)
|
|
9480
9500
|
throw new Error("Error getting geometry data for streaming!");
|
|
9481
9501
|
const p = i.data.get(n);
|
|
@@ -9483,7 +9503,7 @@ const Ms = class Ms extends J {
|
|
|
9483
9503
|
throw new Error("Data not found!");
|
|
9484
9504
|
p[0].push(u.index);
|
|
9485
9505
|
const { x: A, y: R, z: C, w: T } = c.color, F = [A, R, C, T], f = c.flatTransformation;
|
|
9486
|
-
r.geometries.push({ color: F, geometryID:
|
|
9506
|
+
r.geometries.push({ color: F, geometryID: h, transformation: f });
|
|
9487
9507
|
}
|
|
9488
9508
|
this._assets.push(r);
|
|
9489
9509
|
}
|
|
@@ -9497,12 +9517,12 @@ const Ms = class Ms extends J {
|
|
|
9497
9517
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
9498
9518
|
for (let u = 0; u < n.length; u += 6)
|
|
9499
9519
|
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];
|
|
9500
|
-
const c = mr(r),
|
|
9501
|
-
let
|
|
9520
|
+
const c = mr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
|
|
9521
|
+
let E = !1;
|
|
9502
9522
|
for (let u = 0; u < r.length - 2; u += 3) {
|
|
9503
9523
|
const p = r[u], A = r[u + 1], R = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
|
|
9504
9524
|
if (Rr(d, [p, A, R], [C, T, F])) {
|
|
9505
|
-
|
|
9525
|
+
E = !0;
|
|
9506
9526
|
break;
|
|
9507
9527
|
}
|
|
9508
9528
|
}
|
|
@@ -9510,8 +9530,8 @@ const Ms = class Ms extends J {
|
|
|
9510
9530
|
position: r,
|
|
9511
9531
|
normal: a,
|
|
9512
9532
|
index: o,
|
|
9513
|
-
boundingBox:
|
|
9514
|
-
hasHoles:
|
|
9533
|
+
boundingBox: h,
|
|
9534
|
+
hasHoles: E
|
|
9515
9535
|
}), i.delete(), this._geometryCount++;
|
|
9516
9536
|
}
|
|
9517
9537
|
async streamAssets() {
|
|
@@ -9571,15 +9591,15 @@ class Kr extends J {
|
|
|
9571
9591
|
for (const c of e) {
|
|
9572
9592
|
if (n++, Li.has(c))
|
|
9573
9593
|
continue;
|
|
9574
|
-
const
|
|
9594
|
+
const h = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), E = d.size();
|
|
9575
9595
|
let u = 0;
|
|
9576
|
-
for (let A = 0; A <
|
|
9596
|
+
for (let A = 0; A < E - t; A += t) {
|
|
9577
9597
|
const R = {};
|
|
9578
9598
|
for (let C = 0; C < t; C++) {
|
|
9579
9599
|
u++;
|
|
9580
9600
|
const T = d.get(A + C);
|
|
9581
9601
|
try {
|
|
9582
|
-
const F = this.webIfc.GetLine(0, T,
|
|
9602
|
+
const F = this.webIfc.GetLine(0, T, h);
|
|
9583
9603
|
R[F.expressID] = F;
|
|
9584
9604
|
} catch {
|
|
9585
9605
|
console.log(`Could not get property: ${T}`);
|
|
@@ -9587,12 +9607,12 @@ class Kr extends J {
|
|
|
9587
9607
|
}
|
|
9588
9608
|
await this.onPropertiesStreamed.trigger({ type: c, data: R });
|
|
9589
9609
|
}
|
|
9590
|
-
if (u !==
|
|
9610
|
+
if (u !== E) {
|
|
9591
9611
|
const A = {};
|
|
9592
|
-
for (let R = u; R <
|
|
9612
|
+
for (let R = u; R < E; R++) {
|
|
9593
9613
|
const C = d.get(R);
|
|
9594
9614
|
try {
|
|
9595
|
-
const T = this.webIfc.GetLine(0, C,
|
|
9615
|
+
const T = this.webIfc.GetLine(0, C, h);
|
|
9596
9616
|
A[T.expressID] = T;
|
|
9597
9617
|
} catch {
|
|
9598
9618
|
console.log(`Could not get property: ${C}`);
|
|
@@ -9625,60 +9645,60 @@ const Ds = class Ds extends J {
|
|
|
9625
9645
|
i,
|
|
9626
9646
|
t
|
|
9627
9647
|
), a = [];
|
|
9628
|
-
for (let
|
|
9629
|
-
const { plane: u, edges: p } = this.getFaceData(
|
|
9648
|
+
for (let E = 0; E < n.length / 3; E++) {
|
|
9649
|
+
const { plane: u, edges: p } = this.getFaceData(E, i, t);
|
|
9630
9650
|
if (u.equals(r)) {
|
|
9631
|
-
a.push({ index:
|
|
9651
|
+
a.push({ index: E, edges: p });
|
|
9632
9652
|
for (const { id: A, points: R, distance: C } of p)
|
|
9633
9653
|
o.set(A, { points: R, distance: C });
|
|
9634
9654
|
}
|
|
9635
9655
|
}
|
|
9636
9656
|
let c = 0;
|
|
9637
|
-
const
|
|
9638
|
-
for (const { index:
|
|
9657
|
+
const h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
|
|
9658
|
+
for (const { index: E, edges: u } of a) {
|
|
9639
9659
|
const p = /* @__PURE__ */ new Map();
|
|
9640
9660
|
for (const { id: m } of u)
|
|
9641
|
-
if (
|
|
9642
|
-
const O =
|
|
9661
|
+
if (h.has(m)) {
|
|
9662
|
+
const O = h.get(m);
|
|
9643
9663
|
p.set(m, O);
|
|
9644
9664
|
}
|
|
9645
9665
|
const A = u.map((m) => m.id);
|
|
9646
9666
|
if (!p.size) {
|
|
9647
9667
|
const m = c++;
|
|
9648
9668
|
for (const { id: O } of u)
|
|
9649
|
-
|
|
9669
|
+
h.set(O, m);
|
|
9650
9670
|
d.set(m, {
|
|
9651
9671
|
edges: new Set(A),
|
|
9652
|
-
indices: /* @__PURE__ */ new Set([
|
|
9672
|
+
indices: /* @__PURE__ */ new Set([E])
|
|
9653
9673
|
});
|
|
9654
9674
|
continue;
|
|
9655
9675
|
}
|
|
9656
9676
|
let R = null;
|
|
9657
9677
|
const C = /* @__PURE__ */ new Set(), T = new Set(A);
|
|
9658
9678
|
for (const [m, O] of p) {
|
|
9659
|
-
R === null ? R = O : O !== R && C.add(O),
|
|
9679
|
+
R === null ? R = O : O !== R && C.add(O), h.delete(m);
|
|
9660
9680
|
const { edges: S } = d.get(O);
|
|
9661
9681
|
S.delete(m), T.delete(m);
|
|
9662
9682
|
}
|
|
9663
9683
|
if (R === null)
|
|
9664
9684
|
throw new Error("Error computing face!");
|
|
9665
9685
|
const F = d.get(R), { indices: f } = F;
|
|
9666
|
-
f.add(
|
|
9686
|
+
f.add(E);
|
|
9667
9687
|
for (const m of T) {
|
|
9668
|
-
|
|
9688
|
+
h.set(m, R);
|
|
9669
9689
|
const { edges: O } = F;
|
|
9670
9690
|
O.add(m);
|
|
9671
9691
|
}
|
|
9672
9692
|
for (const m of C) {
|
|
9673
9693
|
const O = d.get(m), { edges: S, indices: _ } = O, N = d.get(R), { edges: L, indices: M } = N;
|
|
9674
9694
|
for (const y of S)
|
|
9675
|
-
L.add(y),
|
|
9695
|
+
L.add(y), h.set(y, R);
|
|
9676
9696
|
for (const y of _)
|
|
9677
9697
|
M.add(y);
|
|
9678
9698
|
d.delete(m);
|
|
9679
9699
|
}
|
|
9680
9700
|
}
|
|
9681
|
-
for (const [
|
|
9701
|
+
for (const [E, { indices: u, edges: p }] of d)
|
|
9682
9702
|
if (u.has(e)) {
|
|
9683
9703
|
const A = [];
|
|
9684
9704
|
for (const R of p) {
|
|
@@ -9696,21 +9716,21 @@ const Ds = class Ds extends J {
|
|
|
9696
9716
|
getFaceData(t, e, i) {
|
|
9697
9717
|
const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal: c } = o;
|
|
9698
9718
|
this.round(n), this.round(r), this.round(a), this.round(c);
|
|
9699
|
-
const
|
|
9719
|
+
const h = [
|
|
9700
9720
|
{ id: `${n.x}|${n.y}|${n.z}`, value: n },
|
|
9701
9721
|
{ id: `${r.x}|${r.y}|${r.z}`, value: r },
|
|
9702
9722
|
{ id: `${a.x}|${a.y}|${a.z}`, value: a }
|
|
9703
9723
|
];
|
|
9704
|
-
|
|
9724
|
+
h.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
|
|
9705
9725
|
const [
|
|
9706
|
-
{ id: d, value:
|
|
9726
|
+
{ id: d, value: E },
|
|
9707
9727
|
{ id: u, value: p },
|
|
9708
9728
|
{ id: A, value: R }
|
|
9709
|
-
] =
|
|
9729
|
+
] = h, C = [
|
|
9710
9730
|
{
|
|
9711
9731
|
id: `${d}|${u}`,
|
|
9712
|
-
distance:
|
|
9713
|
-
points: [
|
|
9732
|
+
distance: E.distanceTo(p),
|
|
9733
|
+
points: [E, p]
|
|
9714
9734
|
},
|
|
9715
9735
|
{
|
|
9716
9736
|
id: `${u}|${A}`,
|
|
@@ -9719,8 +9739,8 @@ const Ds = class Ds extends J {
|
|
|
9719
9739
|
},
|
|
9720
9740
|
{
|
|
9721
9741
|
id: `${d}|${A}`,
|
|
9722
|
-
distance:
|
|
9723
|
-
points: [
|
|
9742
|
+
distance: E.distanceTo(R),
|
|
9743
|
+
points: [E, R]
|
|
9724
9744
|
}
|
|
9725
9745
|
], T = new g.Plane();
|
|
9726
9746
|
return T.setFromNormalAndCoplanarPoint(c, n), T.constant = Math.round(T.constant * 10) / 10, { plane: T, edges: C };
|
|
@@ -9728,14 +9748,14 @@ const Ds = class Ds extends J {
|
|
|
9728
9748
|
getVerticesAndNormal(t, e, i) {
|
|
9729
9749
|
if (!t.geometry.index)
|
|
9730
9750
|
throw new Error("Geometry must be indexed!");
|
|
9731
|
-
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3,
|
|
9751
|
+
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), E = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[h], n[h + 1], n[h + 2]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[c], r[c + 1], r[c + 2]), R = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (p.x + A.x + R.x) / 3, T = (p.y + A.y + R.y) / 3, F = (p.z + A.z + R.z) / 3, f = new g.Vector3(C, T, F);
|
|
9732
9752
|
if (i !== void 0 && t instanceof g.InstancedMesh) {
|
|
9733
9753
|
const m = new g.Matrix4();
|
|
9734
9754
|
t.getMatrixAt(i, m);
|
|
9735
9755
|
const O = new g.Matrix4();
|
|
9736
|
-
O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m),
|
|
9756
|
+
O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m), E.applyMatrix4(m), u.applyMatrix4(m);
|
|
9737
9757
|
}
|
|
9738
|
-
return { p1: d, p2:
|
|
9758
|
+
return { p1: d, p2: E, p3: u, faceNormal: f };
|
|
9739
9759
|
}
|
|
9740
9760
|
round(t) {
|
|
9741
9761
|
t.x = Math.trunc(t.x * 1e3) / 1e3, t.y = Math.trunc(t.y * 1e3) / 1e3, t.z = Math.trunc(t.z * 1e3) / 1e3;
|