@thatopen/components 2.0.0-alpha.16 → 2.0.0-alpha.17
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/OrthoPerspectiveCamera/index.d.ts +1 -1
- package/dist/core/Worlds/src/simple-renderer.d.ts +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +1155 -1150
- package/dist/namespace.d.ts +1386 -1385
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
1
|
var Hn = Object.defineProperty;
|
|
2
|
-
var kn = (
|
|
3
|
-
var
|
|
2
|
+
var kn = (c, s, t) => s in c ? Hn(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
|
|
3
|
+
var I = (c, s, t) => (kn(c, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
4
|
import * as g from "three";
|
|
5
|
-
import { BufferAttribute as Nn, Vector3 as w, Vector2 as pe, Plane as Ai, Line3 as Lt, Triangle as
|
|
5
|
+
import { BufferAttribute as Nn, Vector3 as w, Vector2 as pe, Plane as Ai, Line3 as Lt, Triangle as Ie, Sphere as Wn, Matrix4 as yt, Box3 as Ot, BackSide as Xn, DoubleSide as Pn, FrontSide as Mi, Mesh as v, Ray as Zn, Raycaster as Qn, Quaternion as Pt, Object3D as oi, Euler as jn, MeshBasicMaterial as Ln, LineBasicMaterial as qn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as Re, PlaneGeometry as Kn } from "three";
|
|
6
6
|
import * as Vt from "@thatopen/fragments";
|
|
7
7
|
import { Serializer as Jn } from "@thatopen/fragments";
|
|
8
8
|
import * as D from "web-ifc";
|
|
9
9
|
const yn = 0, to = 1, eo = 2, xi = 2, Bs = 1.25, bi = 1, Cs = 6 * 4 + 4 + 4, Ds = 65535, so = Math.pow(2, -24), Ys = Symbol("SKIP_GENERATION");
|
|
10
|
-
function io(
|
|
11
|
-
return
|
|
10
|
+
function io(c) {
|
|
11
|
+
return c.index ? c.index.count : c.attributes.position.count;
|
|
12
12
|
}
|
|
13
|
-
function Ce(
|
|
14
|
-
return io(
|
|
13
|
+
function Ce(c) {
|
|
14
|
+
return io(c) / 3;
|
|
15
15
|
}
|
|
16
|
-
function no(
|
|
17
|
-
return
|
|
16
|
+
function no(c, s = ArrayBuffer) {
|
|
17
|
+
return c > 65535 ? new Uint32Array(new s(4 * c)) : new Uint16Array(new s(2 * c));
|
|
18
18
|
}
|
|
19
|
-
function oo(
|
|
20
|
-
if (!
|
|
21
|
-
const t =
|
|
22
|
-
|
|
19
|
+
function oo(c, s) {
|
|
20
|
+
if (!c.index) {
|
|
21
|
+
const t = c.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = no(t, e);
|
|
22
|
+
c.setIndex(new Nn(i, 1));
|
|
23
23
|
for (let o = 0; o < t; o++)
|
|
24
24
|
i[o] = o;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function wn(
|
|
28
|
-
const s = Ce(
|
|
27
|
+
function wn(c) {
|
|
28
|
+
const s = Ce(c), t = c.drawRange, e = t.start / 3, i = (t.start + t.count) / 3, o = Math.max(0, e), n = Math.min(s, i) - o;
|
|
29
29
|
return [{
|
|
30
30
|
offset: Math.floor(o),
|
|
31
31
|
count: Math.floor(n)
|
|
32
32
|
}];
|
|
33
33
|
}
|
|
34
|
-
function Mn(
|
|
35
|
-
if (!
|
|
36
|
-
return wn(
|
|
37
|
-
const s = [], t = /* @__PURE__ */ new Set(), e =
|
|
38
|
-
for (const r of
|
|
39
|
-
const a = r.start / 3,
|
|
40
|
-
t.add(Math.max(i, a)), t.add(Math.min(o,
|
|
34
|
+
function Mn(c) {
|
|
35
|
+
if (!c.groups || !c.groups.length)
|
|
36
|
+
return wn(c);
|
|
37
|
+
const s = [], t = /* @__PURE__ */ new Set(), e = c.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
|
|
38
|
+
for (const r of c.groups) {
|
|
39
|
+
const a = r.start / 3, l = (r.start + r.count) / 3;
|
|
40
|
+
t.add(Math.max(i, a)), t.add(Math.min(o, l));
|
|
41
41
|
}
|
|
42
42
|
const n = Array.from(t.values()).sort((r, a) => r - a);
|
|
43
43
|
for (let r = 0; r < n.length - 1; r++) {
|
|
44
|
-
const a = n[r],
|
|
44
|
+
const a = n[r], l = n[r + 1];
|
|
45
45
|
s.push({
|
|
46
46
|
offset: Math.floor(a),
|
|
47
|
-
count: Math.floor(
|
|
47
|
+
count: Math.floor(l - a)
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return s;
|
|
51
51
|
}
|
|
52
|
-
function ro(
|
|
53
|
-
if (
|
|
52
|
+
function ro(c) {
|
|
53
|
+
if (c.groups.length === 0)
|
|
54
54
|
return !1;
|
|
55
|
-
const s = Ce(
|
|
55
|
+
const s = Ce(c), t = Mn(c).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
|
|
56
56
|
e.count = Math.min(s - e.offset, e.count);
|
|
57
57
|
let i = 0;
|
|
58
58
|
return t.forEach(({ count: o }) => i += o), s !== i;
|
|
59
59
|
}
|
|
60
|
-
function $(
|
|
61
|
-
return t.min.x = s[
|
|
60
|
+
function $(c, s, t) {
|
|
61
|
+
return t.min.x = s[c], t.min.y = s[c + 1], t.min.z = s[c + 2], t.max.x = s[c + 3], t.max.y = s[c + 4], t.max.z = s[c + 5], t;
|
|
62
62
|
}
|
|
63
|
-
function ao(
|
|
64
|
-
|
|
63
|
+
function ao(c) {
|
|
64
|
+
c[0] = c[1] = c[2] = 1 / 0, c[3] = c[4] = c[5] = -1 / 0;
|
|
65
65
|
}
|
|
66
|
-
function vi(
|
|
66
|
+
function vi(c) {
|
|
67
67
|
let s = -1, t = -1 / 0;
|
|
68
68
|
for (let e = 0; e < 3; e++) {
|
|
69
|
-
const i =
|
|
69
|
+
const i = c[e + 3] - c[e];
|
|
70
70
|
i > t && (t = i, s = e);
|
|
71
71
|
}
|
|
72
72
|
return s;
|
|
73
73
|
}
|
|
74
|
-
function Bi(
|
|
75
|
-
s.set(
|
|
74
|
+
function Bi(c, s) {
|
|
75
|
+
s.set(c);
|
|
76
76
|
}
|
|
77
|
-
function Yi(
|
|
77
|
+
function Yi(c, s, t) {
|
|
78
78
|
let e, i;
|
|
79
79
|
for (let o = 0; o < 3; o++) {
|
|
80
80
|
const n = o + 3;
|
|
81
|
-
e =
|
|
81
|
+
e = c[o], i = s[o], t[o] = e < i ? e : i, e = c[n], i = s[n], t[n] = e > i ? e : i;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function Qe(
|
|
84
|
+
function Qe(c, s, t) {
|
|
85
85
|
for (let e = 0; e < 3; e++) {
|
|
86
|
-
const i = s[
|
|
86
|
+
const i = s[c + 2 * e], o = s[c + 2 * e + 1], n = i - o, r = i + o;
|
|
87
87
|
n < t[e] && (t[e] = n), r > t[e + 3] && (t[e + 3] = r);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
function Ae(
|
|
91
|
-
const s =
|
|
90
|
+
function Ae(c) {
|
|
91
|
+
const s = c[3] - c[0], t = c[4] - c[1], e = c[5] - c[2];
|
|
92
92
|
return 2 * (s * t + t * e + e * s);
|
|
93
93
|
}
|
|
94
|
-
function Vs(
|
|
95
|
-
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0,
|
|
94
|
+
function Vs(c, s, t, e, i = null) {
|
|
95
|
+
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, l = -1 / 0, E = -1 / 0, d = 1 / 0, h = 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
|
-
const f =
|
|
98
|
+
const f = c[T + 0], m = c[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
|
-
const _ =
|
|
101
|
-
L < n && (n = L), M >
|
|
102
|
-
const y =
|
|
103
|
-
b < r && (r = b), B > E && (E = B), C && y <
|
|
100
|
+
const _ = c[T + 2], N = c[T + 3], L = _ - N, M = _ + N;
|
|
101
|
+
L < n && (n = L), M > l && (l = M), C && _ < h && (h = _), C && _ > A && (A = _);
|
|
102
|
+
const y = c[T + 4], x = c[T + 5], b = y - x, B = y + x;
|
|
103
|
+
b < r && (r = b), B > E && (E = 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] =
|
|
105
|
+
e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = l, e[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = A, i[5] = R);
|
|
106
106
|
}
|
|
107
|
-
function co(
|
|
108
|
-
let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0,
|
|
107
|
+
function co(c, s, t, e) {
|
|
108
|
+
let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, l = -1 / 0;
|
|
109
109
|
for (let E = s * 6, d = (s + t) * 6; E < d; E += 6) {
|
|
110
|
-
const h =
|
|
110
|
+
const h = c[E + 0];
|
|
111
111
|
h < i && (i = h), h > r && (r = h);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const p =
|
|
115
|
-
p < n && (n = p), p >
|
|
112
|
+
const u = c[E + 2];
|
|
113
|
+
u < o && (o = u), u > a && (a = u);
|
|
114
|
+
const p = c[E + 4];
|
|
115
|
+
p < n && (n = p), p > l && (l = p);
|
|
116
116
|
}
|
|
117
|
-
e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] =
|
|
117
|
+
e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = l;
|
|
118
118
|
}
|
|
119
|
-
function lo(
|
|
119
|
+
function lo(c, s) {
|
|
120
120
|
ao(s);
|
|
121
|
-
const t =
|
|
122
|
-
let
|
|
123
|
-
t.isInterleavedBufferAttribute && (
|
|
121
|
+
const t = c.attributes.position, e = c.index ? c.index.array : null, i = Ce(c), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
|
|
122
|
+
let l = 3;
|
|
123
|
+
t.isInterleavedBufferAttribute && (l = t.data.stride);
|
|
124
124
|
const E = ["getX", "getY", "getZ"];
|
|
125
125
|
for (let d = 0; d < i; d++) {
|
|
126
|
-
const h = d * 3,
|
|
126
|
+
const h = d * 3, u = d * 6;
|
|
127
127
|
let p = h + 0, A = h + 1, R = h + 2;
|
|
128
|
-
e && (p = e[p], A = e[A], R = e[R]), n || (p = p *
|
|
128
|
+
e && (p = e[p], A = e[A], R = e[R]), n || (p = p * l + a, A = A * l + a, R = R * l + a);
|
|
129
129
|
for (let C = 0; C < 3; C++) {
|
|
130
130
|
let T, F, f;
|
|
131
131
|
n ? (T = t[E[C]](p), F = t[E[C]](A), f = t[E[C]](R)) : (T = r[p + C], F = r[A + C], f = r[R + C]);
|
|
@@ -134,30 +134,30 @@ function lo(l, s) {
|
|
|
134
134
|
let O = T;
|
|
135
135
|
F > O && (O = F), f > O && (O = f);
|
|
136
136
|
const S = (O - m) / 2, _ = C * 2;
|
|
137
|
-
o[
|
|
137
|
+
o[u + _ + 0] = m + S, o[u + _ + 1] = S + (Math.abs(m) + S) * so, m < s[C] && (s[C] = m), O > s[C + 3] && (s[C + 3] = O);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
return o;
|
|
141
141
|
}
|
|
142
|
-
const wt = 32, ho = (
|
|
142
|
+
const wt = 32, ho = (c, s) => c.candidate - s.candidate, Ut = new Array(wt).fill().map(() => ({
|
|
143
143
|
count: 0,
|
|
144
144
|
bounds: new Float32Array(6),
|
|
145
145
|
rightCacheBounds: new Float32Array(6),
|
|
146
146
|
leftCacheBounds: new Float32Array(6),
|
|
147
147
|
candidate: 0
|
|
148
148
|
})), je = new Float32Array(6);
|
|
149
|
-
function Eo(
|
|
149
|
+
function Eo(c, s, t, e, i, o) {
|
|
150
150
|
let n = -1, r = 0;
|
|
151
151
|
if (o === yn)
|
|
152
152
|
n = vi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
|
|
153
153
|
else if (o === to)
|
|
154
|
-
n = vi(
|
|
154
|
+
n = vi(c), n !== -1 && (r = uo(t, e, i, n));
|
|
155
155
|
else if (o === eo) {
|
|
156
|
-
const a = Ae(
|
|
157
|
-
let
|
|
156
|
+
const a = Ae(c);
|
|
157
|
+
let l = Bs * i;
|
|
158
158
|
const E = e * 6, d = (e + i) * 6;
|
|
159
159
|
for (let h = 0; h < 3; h++) {
|
|
160
|
-
const
|
|
160
|
+
const u = s[h], R = (s[h + 3] - u) / wt;
|
|
161
161
|
if (i < wt / 4) {
|
|
162
162
|
const C = [...Ut];
|
|
163
163
|
C.length = i;
|
|
@@ -195,18 +195,18 @@ function Eo(l, s, t, e, i, o) {
|
|
|
195
195
|
let M = 0;
|
|
196
196
|
S !== 0 && (M = Ae(N) / a);
|
|
197
197
|
const y = bi + Bs * (L * O + M * S);
|
|
198
|
-
y <
|
|
198
|
+
y < l && (n = h, l = y, r = m.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
201
201
|
for (let F = 0; F < wt; F++) {
|
|
202
202
|
const f = Ut[F];
|
|
203
|
-
f.count = 0, f.candidate =
|
|
203
|
+
f.count = 0, f.candidate = u + R + F * R;
|
|
204
204
|
const m = f.bounds;
|
|
205
205
|
for (let O = 0; O < 3; O++)
|
|
206
206
|
m[O] = 1 / 0, m[O + 3] = -1 / 0;
|
|
207
207
|
}
|
|
208
208
|
for (let F = E; F < d; F += 6) {
|
|
209
|
-
let O = ~~((t[F + 2 * h] -
|
|
209
|
+
let O = ~~((t[F + 2 * h] - u) / R);
|
|
210
210
|
O >= wt && (O = wt - 1);
|
|
211
211
|
const S = Ut[O];
|
|
212
212
|
S.count++, Qe(F, t, S.bounds);
|
|
@@ -226,7 +226,7 @@ function Eo(l, s, t, e, i, o) {
|
|
|
226
226
|
const M = i - T;
|
|
227
227
|
M !== 0 && (L = Ae(_) / a);
|
|
228
228
|
const y = bi + Bs * (N * T + L * M);
|
|
229
|
-
y <
|
|
229
|
+
y < l && (n = h, l = y, r = f.candidate);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -234,23 +234,23 @@ function Eo(l, s, t, e, i, o) {
|
|
|
234
234
|
console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);
|
|
235
235
|
return { axis: n, pos: r };
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function uo(c, s, t, e) {
|
|
238
238
|
let i = 0;
|
|
239
239
|
for (let o = s, n = s + t; o < n; o++)
|
|
240
|
-
i +=
|
|
240
|
+
i += c[o * 6 + e * 2];
|
|
241
241
|
return i / t;
|
|
242
242
|
}
|
|
243
243
|
class qe {
|
|
244
244
|
constructor() {
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Io(c, s, t, e, i, o) {
|
|
248
248
|
let n = e, r = e + i - 1;
|
|
249
|
-
const a = o.pos,
|
|
249
|
+
const a = o.pos, l = o.axis * 2;
|
|
250
250
|
for (; ; ) {
|
|
251
|
-
for (; n <= r && t[n * 6 +
|
|
251
|
+
for (; n <= r && t[n * 6 + l] < a; )
|
|
252
252
|
n++;
|
|
253
|
-
for (; n <= r && t[r * 6 +
|
|
253
|
+
for (; n <= r && t[r * 6 + l] >= a; )
|
|
254
254
|
r--;
|
|
255
255
|
if (n < r) {
|
|
256
256
|
for (let E = 0; E < 3; E++) {
|
|
@@ -266,17 +266,17 @@ function uo(l, s, t, e, i, o) {
|
|
|
266
266
|
return n;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
function fo(
|
|
269
|
+
function fo(c, s, t, e, i, o) {
|
|
270
270
|
let n = e, r = e + i - 1;
|
|
271
|
-
const a = o.pos,
|
|
271
|
+
const a = o.pos, l = o.axis * 2;
|
|
272
272
|
for (; ; ) {
|
|
273
|
-
for (; n <= r && t[n * 6 +
|
|
273
|
+
for (; n <= r && t[n * 6 + l] < a; )
|
|
274
274
|
n++;
|
|
275
|
-
for (; n <= r && t[r * 6 +
|
|
275
|
+
for (; n <= r && t[r * 6 + l] >= a; )
|
|
276
276
|
r--;
|
|
277
277
|
if (n < r) {
|
|
278
|
-
let E =
|
|
279
|
-
|
|
278
|
+
let E = c[n];
|
|
279
|
+
c[n] = c[r], c[r] = E;
|
|
280
280
|
for (let d = 0; d < 6; d++) {
|
|
281
281
|
let h = t[n * 6 + d];
|
|
282
282
|
t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = h;
|
|
@@ -286,27 +286,27 @@ function fo(l, s, t, e, i, o) {
|
|
|
286
286
|
return n;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function po(
|
|
290
|
-
const t = (
|
|
289
|
+
function po(c, s) {
|
|
290
|
+
const t = (c.index ? c.index.count : c.attributes.position.count) / 3, e = t > 2 ** 16, i = e ? 4 : 2, o = s ? new SharedArrayBuffer(t * i) : new ArrayBuffer(t * i), n = e ? new Uint32Array(o) : new Uint16Array(o);
|
|
291
291
|
for (let r = 0, a = n.length; r < a; r++)
|
|
292
292
|
n[r] = r;
|
|
293
293
|
return n;
|
|
294
294
|
}
|
|
295
|
-
function Co(
|
|
296
|
-
const t =
|
|
295
|
+
function Co(c, s) {
|
|
296
|
+
const t = c.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, l = Ce(t), E = c._indirectBuffer;
|
|
297
297
|
let d = !1;
|
|
298
|
-
const h = new Float32Array(6),
|
|
298
|
+
const h = new Float32Array(6), u = new Float32Array(6), p = lo(t, h), A = s.indirect ? fo : Io, R = [], C = s.indirect ? wn(t) : Mn(t);
|
|
299
299
|
if (C.length === 1) {
|
|
300
300
|
const f = C[0], m = new qe();
|
|
301
|
-
m.boundingData = h, co(p, f.offset, f.count,
|
|
301
|
+
m.boundingData = h, co(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 qe();
|
|
305
|
-
m.boundingData = new Float32Array(6), Vs(p, f.offset, f.count, m.boundingData,
|
|
305
|
+
m.boundingData = new Float32Array(6), Vs(p, f.offset, f.count, m.boundingData, u), F(m, f.offset, f.count, u), R.push(m);
|
|
306
306
|
}
|
|
307
307
|
return R;
|
|
308
308
|
function T(f) {
|
|
309
|
-
a && a(f /
|
|
309
|
+
a && a(f / l);
|
|
310
310
|
}
|
|
311
311
|
function F(f, m, O, S = null, _ = 0) {
|
|
312
312
|
if (!d && _ >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))), O <= n || _ >= i)
|
|
@@ -320,45 +320,45 @@ function Co(l, s) {
|
|
|
320
320
|
else {
|
|
321
321
|
f.splitAxis = N.axis;
|
|
322
322
|
const M = new qe(), y = m, x = L - m;
|
|
323
|
-
f.left = M, M.boundingData = new Float32Array(6), Vs(p, y, x, M.boundingData,
|
|
323
|
+
f.left = M, M.boundingData = new Float32Array(6), Vs(p, y, x, M.boundingData, u), F(M, y, x, u, _ + 1);
|
|
324
324
|
const b = new qe(), B = L, H = O - x;
|
|
325
|
-
f.right = b, b.boundingData = new Float32Array(6), Vs(p, B, H, b.boundingData,
|
|
325
|
+
f.right = b, b.boundingData = new Float32Array(6), Vs(p, B, H, b.boundingData, u), F(b, B, H, u, _ + 1);
|
|
326
326
|
}
|
|
327
327
|
return f;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
function To(
|
|
331
|
-
const t =
|
|
332
|
-
s.indirect && (
|
|
330
|
+
function To(c, s) {
|
|
331
|
+
const t = c.geometry;
|
|
332
|
+
s.indirect && (c._indirectBuffer = po(t, s.useSharedArrayBuffer), ro(t) && !s.verbose && console.warn(
|
|
333
333
|
'MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.'
|
|
334
|
-
)),
|
|
335
|
-
const e = Co(
|
|
334
|
+
)), c._indirectBuffer || oo(t, s);
|
|
335
|
+
const e = Co(c, 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
339
|
const h = e[d];
|
|
340
|
-
let
|
|
341
|
-
const p = new a(Cs *
|
|
340
|
+
let u = l(h);
|
|
341
|
+
const p = new a(Cs * u);
|
|
342
342
|
i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), E(0, h), r.push(p);
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
c._roots = r;
|
|
345
345
|
return;
|
|
346
|
-
function
|
|
347
|
-
return d.count ? 1 : 1 +
|
|
346
|
+
function l(d) {
|
|
347
|
+
return d.count ? 1 : 1 + l(d.left) + l(d.right);
|
|
348
348
|
}
|
|
349
349
|
function E(d, h) {
|
|
350
|
-
const
|
|
350
|
+
const u = d / 4, p = d / 2, A = !!h.count, R = h.boundingData;
|
|
351
351
|
for (let C = 0; C < 6; C++)
|
|
352
|
-
i[
|
|
352
|
+
i[u + C] = R[C];
|
|
353
353
|
if (A) {
|
|
354
354
|
const C = h.offset, T = h.count;
|
|
355
|
-
return o[
|
|
355
|
+
return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Ds, d + Cs;
|
|
356
356
|
} else {
|
|
357
357
|
const C = h.left, T = h.right, F = h.splitAxis;
|
|
358
358
|
let f;
|
|
359
359
|
if (f = E(d + Cs, C), f / 4 > Math.pow(2, 32))
|
|
360
360
|
throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");
|
|
361
|
-
return o[
|
|
361
|
+
return o[u + 6] = f / 4, f = E(f, T), o[u + 7] = F, f;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -387,63 +387,63 @@ class Mt {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
Mt.prototype.setFromBox = function() {
|
|
390
|
-
const
|
|
390
|
+
const c = new w();
|
|
391
391
|
return function(t, e) {
|
|
392
392
|
const i = e.min, o = e.max;
|
|
393
393
|
let n = 1 / 0, r = -1 / 0;
|
|
394
394
|
for (let a = 0; a <= 1; a++)
|
|
395
|
-
for (let
|
|
395
|
+
for (let l = 0; l <= 1; l++)
|
|
396
396
|
for (let E = 0; E <= 1; E++) {
|
|
397
|
-
|
|
398
|
-
const d = t.dot(
|
|
397
|
+
c.x = i.x * a + o.x * (1 - a), c.y = i.y * l + o.y * (1 - l), c.z = i.z * E + o.z * (1 - E);
|
|
398
|
+
const d = t.dot(c);
|
|
399
399
|
n = Math.min(d, n), r = Math.max(d, r);
|
|
400
400
|
}
|
|
401
401
|
this.min = n, this.max = r;
|
|
402
402
|
};
|
|
403
403
|
}();
|
|
404
404
|
const mo = function() {
|
|
405
|
-
const
|
|
405
|
+
const c = new w(), s = new w(), t = new w();
|
|
406
406
|
return function(i, o, n) {
|
|
407
|
-
const r = i.start, a =
|
|
408
|
-
t.subVectors(r,
|
|
409
|
-
const d = t.dot(E), h = E.dot(a),
|
|
407
|
+
const r = i.start, a = c, l = o.start, E = s;
|
|
408
|
+
t.subVectors(r, l), c.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
|
|
409
|
+
const d = t.dot(E), h = E.dot(a), u = E.dot(E), p = t.dot(a), R = a.dot(a) * u - h * h;
|
|
410
410
|
let C, T;
|
|
411
|
-
R !== 0 ? C = (d * h - p *
|
|
411
|
+
R !== 0 ? C = (d * h - p * u) / R : C = 0, T = (d + C * h) / u, n.x = C, n.y = T;
|
|
412
412
|
};
|
|
413
413
|
}(), Fi = function() {
|
|
414
|
-
const
|
|
414
|
+
const c = new pe(), s = new w(), t = new w();
|
|
415
415
|
return function(i, o, n, r) {
|
|
416
|
-
mo(i, o,
|
|
417
|
-
let a =
|
|
418
|
-
if (a >= 0 && a <= 1 &&
|
|
419
|
-
i.at(a, n), o.at(
|
|
416
|
+
mo(i, o, c);
|
|
417
|
+
let a = c.x, l = c.y;
|
|
418
|
+
if (a >= 0 && a <= 1 && l >= 0 && l <= 1) {
|
|
419
|
+
i.at(a, n), o.at(l, r);
|
|
420
420
|
return;
|
|
421
421
|
} else if (a >= 0 && a <= 1) {
|
|
422
|
-
|
|
422
|
+
l < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
|
|
423
423
|
return;
|
|
424
|
-
} else if (
|
|
424
|
+
} else if (l >= 0 && l <= 1) {
|
|
425
425
|
a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
|
|
426
426
|
return;
|
|
427
427
|
} else {
|
|
428
428
|
let E;
|
|
429
429
|
a < 0 ? E = i.start : E = i.end;
|
|
430
430
|
let d;
|
|
431
|
-
|
|
432
|
-
const h = s,
|
|
433
|
-
if (i.closestPointToPoint(d, !0, s), o.closestPointToPoint(E, !0, t), h.distanceToSquared(d) <=
|
|
431
|
+
l < 0 ? d = o.start : d = o.end;
|
|
432
|
+
const h = s, u = t;
|
|
433
|
+
if (i.closestPointToPoint(d, !0, s), o.closestPointToPoint(E, !0, t), h.distanceToSquared(d) <= u.distanceToSquared(E)) {
|
|
434
434
|
n.copy(h), r.copy(d);
|
|
435
435
|
return;
|
|
436
436
|
} else {
|
|
437
|
-
n.copy(E), r.copy(
|
|
437
|
+
n.copy(E), r.copy(u);
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
}(), Ro = function() {
|
|
443
|
-
const
|
|
443
|
+
const c = new w(), s = new w(), t = new Ai(), e = new Lt();
|
|
444
444
|
return function(o, n) {
|
|
445
|
-
const { radius: r, center: a } = o, { a:
|
|
446
|
-
if (e.start =
|
|
445
|
+
const { radius: r, center: a } = o, { a: l, b: E, c: d } = n;
|
|
446
|
+
if (e.start = l, e.end = E, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r || (e.start = l, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r))
|
|
447
447
|
return !0;
|
|
448
448
|
const A = n.getPlane(t);
|
|
449
449
|
if (Math.abs(A.distanceToPoint(a)) <= r) {
|
|
@@ -454,10 +454,10 @@ const mo = function() {
|
|
|
454
454
|
return !1;
|
|
455
455
|
};
|
|
456
456
|
}(), Ao = 1e-15;
|
|
457
|
-
function Gs(
|
|
458
|
-
return Math.abs(
|
|
457
|
+
function Gs(c) {
|
|
458
|
+
return Math.abs(c) < Ao;
|
|
459
459
|
}
|
|
460
|
-
class Ft extends
|
|
460
|
+
class Ft extends Ie {
|
|
461
461
|
constructor(...s) {
|
|
462
462
|
super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new w()), this.satBounds = new Array(4).fill().map(() => new Mt()), this.points = [this.a, this.b, this.c], this.sphere = new Wn(), this.plane = new Ai(), this.needsUpdate = !0;
|
|
463
463
|
}
|
|
@@ -467,28 +467,28 @@ class Ft extends ue {
|
|
|
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
|
|
471
|
-
|
|
470
|
+
const l = o[1], E = n[1];
|
|
471
|
+
l.subVectors(s, t), E.setFromPoints(l, i);
|
|
472
472
|
const d = o[2], h = n[2];
|
|
473
473
|
d.subVectors(t, e), h.setFromPoints(d, i);
|
|
474
|
-
const
|
|
475
|
-
|
|
474
|
+
const u = o[3], p = n[3];
|
|
475
|
+
u.subVectors(e, s), p.setFromPoints(u, i), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(r, s), this.needsUpdate = !1;
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
Ft.prototype.closestPointToSegment = function() {
|
|
479
|
-
const
|
|
479
|
+
const c = new w(), s = new w(), t = new Lt();
|
|
480
480
|
return function(i, o = null, n = null) {
|
|
481
|
-
const { start: r, end: a } = i,
|
|
481
|
+
const { start: r, end: a } = i, l = this.points;
|
|
482
482
|
let E, d = 1 / 0;
|
|
483
483
|
for (let h = 0; h < 3; h++) {
|
|
484
|
-
const
|
|
485
|
-
t.start.copy(
|
|
484
|
+
const u = (h + 1) % 3;
|
|
485
|
+
t.start.copy(l[h]), t.end.copy(l[u]), Fi(t, i, c, s), E = c.distanceToSquared(s), E < d && (d = E, o && o.copy(c), n && n.copy(s));
|
|
486
486
|
}
|
|
487
|
-
return this.closestPointToPoint(r,
|
|
487
|
+
return this.closestPointToPoint(r, c), E = r.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(r)), this.closestPointToPoint(a, c), E = a.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(a)), Math.sqrt(d);
|
|
488
488
|
};
|
|
489
489
|
}();
|
|
490
490
|
Ft.prototype.intersectsTriangle = function() {
|
|
491
|
-
const
|
|
491
|
+
const c = 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(), l = new w(), E = new Lt(), d = new Lt(), h = 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;
|
|
@@ -500,12 +500,12 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
500
500
|
C.copy(E), F = 2;
|
|
501
501
|
break;
|
|
502
502
|
}
|
|
503
|
-
const N = R.intersectLine(E,
|
|
504
|
-
if (!N && _ &&
|
|
503
|
+
const N = R.intersectLine(E, u);
|
|
504
|
+
if (!N && _ && u.copy(O), (N || _) && !Gs(u.distanceTo(S))) {
|
|
505
505
|
if (F <= 1)
|
|
506
|
-
(F === 1 ? C.start : C.end).copy(
|
|
506
|
+
(F === 1 ? C.start : C.end).copy(u), _ && (f = F);
|
|
507
507
|
else if (F >= 2) {
|
|
508
|
-
(f === 1 ? C.start : C.end).copy(
|
|
508
|
+
(f === 1 ? C.start : C.end).copy(u), F = 2;
|
|
509
509
|
break;
|
|
510
510
|
}
|
|
511
511
|
if (F++, F === 2 && f === -1)
|
|
@@ -515,7 +515,7 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
515
515
|
return F;
|
|
516
516
|
}
|
|
517
517
|
return function(R, C = null, T = !1) {
|
|
518
|
-
this.needsUpdate && this.update(), R.isExtendedTriangle ? R.needsUpdate && R.update() : (
|
|
518
|
+
this.needsUpdate && this.update(), R.isExtendedTriangle ? R.needsUpdate && R.update() : (c.copy(R), c.update(), R = c);
|
|
519
519
|
const F = this.plane, f = R.plane;
|
|
520
520
|
if (Math.abs(F.normal.dot(f.normal)) > 1 - 1e-10) {
|
|
521
521
|
const m = this.satBounds, O = this.satAxes;
|
|
@@ -557,38 +557,38 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
557
557
|
h.start = h.end, h.end = x;
|
|
558
558
|
}
|
|
559
559
|
const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r), L = h.end.dot(r), M = _ < N, y = S < L;
|
|
560
|
-
return S !== L && N !== _ && M === y ? !1 : (C && (
|
|
560
|
+
return S !== L && N !== _ && M === y ? !1 : (C && (l.subVectors(d.start, h.start), l.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), l.subVectors(d.end, h.end), l.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}();
|
|
564
564
|
Ft.prototype.distanceToPoint = function() {
|
|
565
|
-
const
|
|
565
|
+
const c = new w();
|
|
566
566
|
return function(t) {
|
|
567
|
-
return this.closestPointToPoint(t,
|
|
567
|
+
return this.closestPointToPoint(t, c), t.distanceTo(c);
|
|
568
568
|
};
|
|
569
569
|
}();
|
|
570
570
|
Ft.prototype.distanceToTriangle = function() {
|
|
571
|
-
const
|
|
571
|
+
const c = new w(), s = new w(), t = ["a", "b", "c"], e = new Lt(), i = new Lt();
|
|
572
572
|
return function(n, r = null, a = null) {
|
|
573
|
-
const
|
|
574
|
-
if (this.intersectsTriangle(n,
|
|
575
|
-
return (r || a) && (r &&
|
|
573
|
+
const l = r || a ? e : null;
|
|
574
|
+
if (this.intersectsTriangle(n, l))
|
|
575
|
+
return (r || a) && (r && l.getCenter(r), a && l.getCenter(a)), 0;
|
|
576
576
|
let E = 1 / 0;
|
|
577
577
|
for (let d = 0; d < 3; d++) {
|
|
578
578
|
let h;
|
|
579
|
-
const
|
|
580
|
-
this.closestPointToPoint(p,
|
|
581
|
-
const A = this[
|
|
582
|
-
n.closestPointToPoint(A,
|
|
579
|
+
const u = t[d], p = n[u];
|
|
580
|
+
this.closestPointToPoint(p, c), h = p.distanceToSquared(c), h < E && (E = h, r && r.copy(c), a && a.copy(p));
|
|
581
|
+
const A = this[u];
|
|
582
|
+
n.closestPointToPoint(A, c), h = A.distanceToSquared(c), h < E && (E = h, r && r.copy(A), a && a.copy(c));
|
|
583
583
|
}
|
|
584
584
|
for (let d = 0; d < 3; d++) {
|
|
585
|
-
const h = t[d],
|
|
586
|
-
e.set(this[h], this[
|
|
585
|
+
const h = t[d], u = t[(d + 1) % 3];
|
|
586
|
+
e.set(this[h], this[u]);
|
|
587
587
|
for (let p = 0; p < 3; p++) {
|
|
588
588
|
const A = t[p], R = t[(p + 1) % 3];
|
|
589
|
-
i.set(n[A], n[R]), Fi(e, i,
|
|
590
|
-
const C =
|
|
591
|
-
C < E && (E = C, r && r.copy(
|
|
589
|
+
i.set(n[A], n[R]), Fi(e, i, c, s);
|
|
590
|
+
const C = c.distanceToSquared(s);
|
|
591
|
+
C < E && (E = C, r && r.copy(c), a && a.copy(s));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
return Math.sqrt(E);
|
|
@@ -608,58 +608,58 @@ class at {
|
|
|
608
608
|
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
|
-
for (let
|
|
611
|
+
for (let l = 0; l <= 1; l++)
|
|
612
612
|
for (let E = 0; E <= 1; E++)
|
|
613
613
|
for (let d = 0; d <= 1; d++) {
|
|
614
|
-
const h = 1 *
|
|
615
|
-
|
|
614
|
+
const h = 1 * l | 2 * E | 4 * d, u = i[h];
|
|
615
|
+
u.x = l ? e.x : t.x, u.y = E ? 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
|
-
for (let
|
|
619
|
-
const E = n[
|
|
620
|
-
E.subVectors(r,
|
|
618
|
+
for (let l = 0; l < 3; l++) {
|
|
619
|
+
const E = n[l], d = o[l], h = 1 << l, u = i[h];
|
|
620
|
+
E.subVectors(r, u), d.setFromPoints(E, 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;
|
|
624
624
|
};
|
|
625
625
|
}();
|
|
626
626
|
at.prototype.intersectsBox = function() {
|
|
627
|
-
const
|
|
627
|
+
const c = new Mt();
|
|
628
628
|
return function(t) {
|
|
629
629
|
this.needsUpdate && this.update();
|
|
630
630
|
const e = t.min, i = t.max, o = this.satBounds, n = this.satAxes, r = this.alignedSatBounds;
|
|
631
|
-
if (
|
|
631
|
+
if (c.min = e.x, c.max = i.x, r[0].isSeparated(c) || (c.min = e.y, c.max = i.y, r[1].isSeparated(c)) || (c.min = e.z, c.max = i.z, r[2].isSeparated(c)))
|
|
632
632
|
return !1;
|
|
633
633
|
for (let a = 0; a < 3; a++) {
|
|
634
|
-
const
|
|
635
|
-
if (
|
|
634
|
+
const l = n[a], E = o[a];
|
|
635
|
+
if (c.setFromBox(l, t), E.isSeparated(c))
|
|
636
636
|
return !1;
|
|
637
637
|
}
|
|
638
638
|
return !0;
|
|
639
639
|
};
|
|
640
640
|
}();
|
|
641
641
|
at.prototype.intersectsTriangle = function() {
|
|
642
|
-
const
|
|
642
|
+
const c = new Ft(), s = new Array(3), t = new Mt(), e = new Mt(), i = new w();
|
|
643
643
|
return function(n) {
|
|
644
|
-
this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (
|
|
644
|
+
this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (c.copy(n), c.update(), n = c);
|
|
645
645
|
const r = this.satBounds, a = this.satAxes;
|
|
646
646
|
s[0] = n.a, s[1] = n.b, s[2] = n.c;
|
|
647
647
|
for (let h = 0; h < 3; h++) {
|
|
648
|
-
const
|
|
649
|
-
if (t.setFromPoints(p, s),
|
|
648
|
+
const u = r[h], p = a[h];
|
|
649
|
+
if (t.setFromPoints(p, s), u.isSeparated(t))
|
|
650
650
|
return !1;
|
|
651
651
|
}
|
|
652
|
-
const
|
|
652
|
+
const l = n.satBounds, E = n.satAxes, d = this.points;
|
|
653
653
|
for (let h = 0; h < 3; h++) {
|
|
654
|
-
const
|
|
655
|
-
if (t.setFromPoints(p, d),
|
|
654
|
+
const u = l[h], p = E[h];
|
|
655
|
+
if (t.setFromPoints(p, d), u.isSeparated(t))
|
|
656
656
|
return !1;
|
|
657
657
|
}
|
|
658
658
|
for (let h = 0; h < 3; h++) {
|
|
659
|
-
const
|
|
659
|
+
const u = a[h];
|
|
660
660
|
for (let p = 0; p < 4; p++) {
|
|
661
661
|
const A = E[p];
|
|
662
|
-
if (i.crossVectors(
|
|
662
|
+
if (i.crossVectors(u, A), t.setFromPoints(i, s), e.setFromPoints(i, d), t.isSeparated(e))
|
|
663
663
|
return !1;
|
|
664
664
|
}
|
|
665
665
|
}
|
|
@@ -672,32 +672,32 @@ at.prototype.closestPointToPoint = /* @__PURE__ */ function() {
|
|
|
672
672
|
};
|
|
673
673
|
}();
|
|
674
674
|
at.prototype.distanceToPoint = function() {
|
|
675
|
-
const
|
|
675
|
+
const c = new w();
|
|
676
676
|
return function(t) {
|
|
677
|
-
return this.closestPointToPoint(t,
|
|
677
|
+
return this.closestPointToPoint(t, c), t.distanceTo(c);
|
|
678
678
|
};
|
|
679
679
|
}();
|
|
680
680
|
at.prototype.distanceToBox = function() {
|
|
681
|
-
const
|
|
682
|
-
return function(n, r = 0, a = null,
|
|
681
|
+
const c = ["x", "y", "z"], s = new Array(12).fill().map(() => new Lt()), t = new Array(12).fill().map(() => new Lt()), e = new w(), i = new w();
|
|
682
|
+
return function(n, r = 0, a = null, l = null) {
|
|
683
683
|
if (this.needsUpdate && this.update(), this.intersectsBox(n))
|
|
684
|
-
return (a ||
|
|
685
|
-
const E = r * r, d = n.min, h = n.max,
|
|
684
|
+
return (a || l) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), l && l.copy(i)), 0;
|
|
685
|
+
const E = r * r, d = n.min, h = n.max, u = this.points;
|
|
686
686
|
let p = 1 / 0;
|
|
687
687
|
for (let R = 0; R < 8; R++) {
|
|
688
|
-
const C =
|
|
688
|
+
const C = u[R];
|
|
689
689
|
i.copy(C).clamp(d, h);
|
|
690
690
|
const T = C.distanceToSquared(i);
|
|
691
|
-
if (T < p && (p = T, a && a.copy(C),
|
|
691
|
+
if (T < p && (p = T, a && a.copy(C), l && l.copy(i), T < E))
|
|
692
692
|
return Math.sqrt(T);
|
|
693
693
|
}
|
|
694
694
|
let A = 0;
|
|
695
695
|
for (let R = 0; R < 3; R++)
|
|
696
696
|
for (let C = 0; C <= 1; C++)
|
|
697
697
|
for (let T = 0; T <= 1; T++) {
|
|
698
|
-
const F = (R + 1) % 3, f = (R + 2) % 3, m = C << F | T << f, O = 1 << R | C << F | T << f, S =
|
|
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
|
-
const L =
|
|
700
|
+
const L = c[R], M = c[F], y = c[f], x = t[A], b = x.start, B = x.end;
|
|
701
701
|
b[L] = d[L], b[M] = C ? d[M] : h[M], b[y] = T ? d[y] : h[M], B[L] = h[L], B[M] = C ? d[M] : h[M], B[y] = T ? d[y] : h[M], A++;
|
|
702
702
|
}
|
|
703
703
|
for (let R = 0; R <= 1; R++)
|
|
@@ -705,7 +705,7 @@ at.prototype.distanceToBox = function() {
|
|
|
705
705
|
for (let T = 0; T <= 1; T++) {
|
|
706
706
|
i.x = R ? h.x : d.x, i.y = C ? h.y : d.y, i.z = T ? h.z : d.z, this.closestPointToPoint(i, e);
|
|
707
707
|
const F = i.distanceToSquared(e);
|
|
708
|
-
if (F < p && (p = F, a && a.copy(e),
|
|
708
|
+
if (F < p && (p = F, a && a.copy(e), l && l.copy(i), F < E))
|
|
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
|
Fi(C, F, e, i);
|
|
716
716
|
const f = e.distanceToSquared(i);
|
|
717
|
-
if (f < p && (p = f, a && a.copy(e),
|
|
717
|
+
if (f < p && (p = f, a && a.copy(e), l && l.copy(i), f < E))
|
|
718
718
|
return Math.sqrt(f);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -738,24 +738,24 @@ class Fo extends Oi {
|
|
|
738
738
|
super(() => new Ft());
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const
|
|
742
|
-
function ht(
|
|
743
|
-
return s[
|
|
741
|
+
const It = /* @__PURE__ */ new Fo();
|
|
742
|
+
function ht(c, s) {
|
|
743
|
+
return s[c + 15] === 65535;
|
|
744
744
|
}
|
|
745
|
-
function Et(
|
|
746
|
-
return s[
|
|
745
|
+
function Et(c, s) {
|
|
746
|
+
return s[c + 6];
|
|
747
747
|
}
|
|
748
|
-
function ft(
|
|
749
|
-
return s[
|
|
748
|
+
function ft(c, s) {
|
|
749
|
+
return s[c + 14];
|
|
750
750
|
}
|
|
751
|
-
function pt(
|
|
752
|
-
return
|
|
751
|
+
function pt(c) {
|
|
752
|
+
return c + 8;
|
|
753
753
|
}
|
|
754
|
-
function Ct(
|
|
755
|
-
return s[
|
|
754
|
+
function Ct(c, s) {
|
|
755
|
+
return s[c + 6];
|
|
756
756
|
}
|
|
757
|
-
function Dn(
|
|
758
|
-
return s[
|
|
757
|
+
function Dn(c, s) {
|
|
758
|
+
return s[c + 7];
|
|
759
759
|
}
|
|
760
760
|
class Oo {
|
|
761
761
|
constructor() {
|
|
@@ -772,19 +772,19 @@ class Oo {
|
|
|
772
772
|
const Z = new Oo();
|
|
773
773
|
let Yt, fe;
|
|
774
774
|
const te = [], $e = /* @__PURE__ */ new Oi(() => new Ot());
|
|
775
|
-
function go(
|
|
776
|
-
Yt = $e.getPrimitive(), fe = $e.getPrimitive(), te.push(Yt, fe), Z.setBuffer(
|
|
777
|
-
const n = ri(0,
|
|
775
|
+
function go(c, s, t, e, i, o) {
|
|
776
|
+
Yt = $e.getPrimitive(), fe = $e.getPrimitive(), te.push(Yt, fe), Z.setBuffer(c._roots[s]);
|
|
777
|
+
const n = ri(0, c.geometry, t, e, i, o);
|
|
778
778
|
Z.clearBuffer(), $e.releasePrimitive(Yt), $e.releasePrimitive(fe), te.pop(), te.pop();
|
|
779
779
|
const r = te.length;
|
|
780
780
|
return r > 0 && (fe = te[r - 1], Yt = te[r - 2]), n;
|
|
781
781
|
}
|
|
782
|
-
function ri(
|
|
783
|
-
const { float32Array: r, uint16Array: a, uint32Array:
|
|
784
|
-
let E =
|
|
782
|
+
function ri(c, s, t, e, i = null, o = 0, n = 0) {
|
|
783
|
+
const { float32Array: r, uint16Array: a, uint32Array: l } = Z;
|
|
784
|
+
let E = c * 2;
|
|
785
785
|
if (ht(E, a)) {
|
|
786
|
-
const h = Et(
|
|
787
|
-
return $(
|
|
786
|
+
const h = Et(c, l), u = ft(E, a);
|
|
787
|
+
return $(c, r, Yt), e(h, u, !1, n, o + c, Yt);
|
|
788
788
|
} else {
|
|
789
789
|
let L = function(y) {
|
|
790
790
|
const { uint16Array: x, uint32Array: b } = Z;
|
|
@@ -799,10 +799,10 @@ function ri(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 h = pt(
|
|
803
|
-
let p = h, A =
|
|
802
|
+
const h = pt(c), u = Ct(c, l);
|
|
803
|
+
let p = h, 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 =
|
|
805
|
+
p = u, A = h;
|
|
806
806
|
const y = R;
|
|
807
807
|
R = C, C = y, T = F;
|
|
808
808
|
}
|
|
@@ -844,10 +844,10 @@ function ri(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
const Fe = /* @__PURE__ */ new w(), zs = /* @__PURE__ */ new w();
|
|
847
|
-
function So(
|
|
847
|
+
function So(c, s, t = {}, e = 0, i = 1 / 0) {
|
|
848
848
|
const o = e * e, n = i * i;
|
|
849
849
|
let r = 1 / 0, a = null;
|
|
850
|
-
if (
|
|
850
|
+
if (c.shapecast(
|
|
851
851
|
{
|
|
852
852
|
boundsTraverseOrder: (E) => (Fe.copy(s).clamp(E.min, E.max), Fe.distanceToSquared(s)),
|
|
853
853
|
intersectsBounds: (E, d, h) => h < r && h < n,
|
|
@@ -859,22 +859,22 @@ function So(l, s, t = {}, e = 0, i = 1 / 0) {
|
|
|
859
859
|
}
|
|
860
860
|
), r === 1 / 0)
|
|
861
861
|
return null;
|
|
862
|
-
const
|
|
863
|
-
return t.point ? t.point.copy(zs) : t.point = zs.clone(), t.distance =
|
|
862
|
+
const l = Math.sqrt(r);
|
|
863
|
+
return t.point ? t.point.copy(zs) : t.point = zs.clone(), t.distance = l, t.faceIndex = a, t;
|
|
864
864
|
}
|
|
865
865
|
const ee = /* @__PURE__ */ new w(), se = /* @__PURE__ */ new w(), ie = /* @__PURE__ */ new w(), Ke = /* @__PURE__ */ new pe(), Je = /* @__PURE__ */ new pe(), ts = /* @__PURE__ */ new pe(), Vi = /* @__PURE__ */ new w(), Gi = /* @__PURE__ */ new w(), zi = /* @__PURE__ */ new w(), es = /* @__PURE__ */ new w();
|
|
866
|
-
function _o(
|
|
866
|
+
function _o(c, s, t, e, i, o) {
|
|
867
867
|
let n;
|
|
868
|
-
return o === Xn ? n =
|
|
869
|
-
distance:
|
|
868
|
+
return o === Xn ? n = c.intersectTriangle(e, t, s, !0, i) : n = c.intersectTriangle(s, t, e, o !== Pn, i), n === null ? null : {
|
|
869
|
+
distance: c.origin.distanceTo(i),
|
|
870
870
|
point: i.clone()
|
|
871
871
|
};
|
|
872
872
|
}
|
|
873
|
-
function No(
|
|
873
|
+
function No(c, s, t, e, i, o, n, r, a) {
|
|
874
874
|
ee.fromBufferAttribute(s, o), se.fromBufferAttribute(s, n), ie.fromBufferAttribute(s, r);
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
e && (Ke.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r),
|
|
875
|
+
const l = _o(c, ee, se, ie, es, a);
|
|
876
|
+
if (l) {
|
|
877
|
+
e && (Ke.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r), l.uv = Ie.getInterpolation(es, ee, se, ie, Ke, Je, ts, new pe())), i && (Ke.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), l.uv1 = Ie.getInterpolation(es, ee, se, ie, Ke, Je, ts, new pe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), l.normal = Ie.getInterpolation(es, ee, se, ie, Vi, Gi, zi, new w()), l.normal.dot(c.direction) > 0 && l.normal.multiplyScalar(-1));
|
|
878
878
|
const E = {
|
|
879
879
|
a: o,
|
|
880
880
|
b: n,
|
|
@@ -882,54 +882,54 @@ function No(l, s, t, e, i, o, n, r, a) {
|
|
|
882
882
|
normal: new w(),
|
|
883
883
|
materialIndex: 0
|
|
884
884
|
};
|
|
885
|
-
|
|
885
|
+
Ie.getNormal(ee, se, ie, E.normal), l.face = E, l.faceIndex = o;
|
|
886
886
|
}
|
|
887
|
-
return
|
|
887
|
+
return l;
|
|
888
888
|
}
|
|
889
|
-
function Us(
|
|
889
|
+
function Us(c, s, t, e, i) {
|
|
890
890
|
const o = e * 3;
|
|
891
891
|
let n = o + 0, r = o + 1, a = o + 2;
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
const { position: E, normal: d, uv: h, uv1:
|
|
892
|
+
const l = c.index;
|
|
893
|
+
c.index && (n = l.getX(n), r = l.getX(r), a = l.getX(a));
|
|
894
|
+
const { position: E, normal: d, uv: h, uv1: u } = c.attributes, p = No(t, E, d, h, u, n, r, a, s);
|
|
895
895
|
return p ? (p.faceIndex = e, i && i.push(p), p) : null;
|
|
896
896
|
}
|
|
897
|
-
function et(
|
|
898
|
-
const i =
|
|
899
|
-
let r = s, a = s + 1,
|
|
900
|
-
t && (r = t.getX(r), a = t.getX(a),
|
|
897
|
+
function et(c, s, t, e) {
|
|
898
|
+
const i = c.a, o = c.b, n = c.c;
|
|
899
|
+
let r = s, a = s + 1, l = s + 2;
|
|
900
|
+
t && (r = t.getX(r), a = t.getX(a), l = t.getX(l)), i.x = e.getX(r), i.y = e.getY(r), i.z = e.getZ(r), o.x = e.getX(a), o.y = e.getY(a), o.z = e.getZ(a), n.x = e.getX(l), n.y = e.getY(l), n.z = e.getZ(l);
|
|
901
901
|
}
|
|
902
|
-
function Po(
|
|
903
|
-
const { geometry: n, _indirectBuffer: r } =
|
|
904
|
-
for (let a = e,
|
|
902
|
+
function Po(c, s, t, e, i, o) {
|
|
903
|
+
const { geometry: n, _indirectBuffer: r } = c;
|
|
904
|
+
for (let a = e, l = e + i; a < l; a++)
|
|
905
905
|
Us(n, s, t, a, o);
|
|
906
906
|
}
|
|
907
|
-
function Lo(
|
|
908
|
-
const { geometry: o, _indirectBuffer: n } =
|
|
907
|
+
function Lo(c, s, t, e, i) {
|
|
908
|
+
const { geometry: o, _indirectBuffer: n } = c;
|
|
909
909
|
let r = 1 / 0, a = null;
|
|
910
|
-
for (let
|
|
910
|
+
for (let l = e, E = e + i; l < E; l++) {
|
|
911
911
|
let d;
|
|
912
|
-
d = Us(o, s, t,
|
|
912
|
+
d = Us(o, s, t, l), d && d.distance < r && (a = d, r = d.distance);
|
|
913
913
|
}
|
|
914
914
|
return a;
|
|
915
915
|
}
|
|
916
|
-
function yo(
|
|
917
|
-
const { geometry: r } = t, { index: a } = r,
|
|
918
|
-
for (let E =
|
|
916
|
+
function yo(c, s, t, e, i, o, n) {
|
|
917
|
+
const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
|
|
918
|
+
for (let E = c, d = s + c; E < d; E++) {
|
|
919
919
|
let h;
|
|
920
|
-
if (h = E, et(n, h * 3, a,
|
|
920
|
+
if (h = E, et(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
|
|
921
921
|
return !0;
|
|
922
922
|
}
|
|
923
923
|
return !1;
|
|
924
924
|
}
|
|
925
|
-
function wo(
|
|
925
|
+
function wo(c, s = null) {
|
|
926
926
|
s && Array.isArray(s) && (s = new Set(s));
|
|
927
|
-
const t =
|
|
928
|
-
let o, n, r, a,
|
|
929
|
-
const E =
|
|
930
|
-
for (let h = 0,
|
|
931
|
-
o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0,
|
|
932
|
-
function d(h,
|
|
927
|
+
const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
|
|
928
|
+
let o, n, r, a, l = 0;
|
|
929
|
+
const E = c._roots;
|
|
930
|
+
for (let h = 0, u = E.length; h < u; h++)
|
|
931
|
+
o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, l), l += o.byteLength;
|
|
932
|
+
function d(h, u, p = !1) {
|
|
933
933
|
const A = h * 2;
|
|
934
934
|
if (r[A + 15] === Ds) {
|
|
935
935
|
const C = n[h + 6], T = r[A + 14];
|
|
@@ -941,14 +941,14 @@ function wo(l, s = null) {
|
|
|
941
941
|
}
|
|
942
942
|
return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== O || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = O, a[h + 4] = S, a[h + 5] = _, !0) : !1;
|
|
943
943
|
} else {
|
|
944
|
-
const C = h + 8, T = n[h + 6], F = C +
|
|
944
|
+
const C = h + 8, T = n[h + 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;
|
|
948
948
|
let L = !1;
|
|
949
|
-
_ && (L = d(C,
|
|
949
|
+
_ && (L = d(C, u, m));
|
|
950
950
|
let M = !1;
|
|
951
|
-
N && (M = d(T,
|
|
951
|
+
N && (M = d(T, u, m));
|
|
952
952
|
const y = L || M;
|
|
953
953
|
if (y)
|
|
954
954
|
for (let x = 0; x < 3; x++) {
|
|
@@ -960,72 +960,72 @@ function wo(l, s = null) {
|
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
const Hi = /* @__PURE__ */ new Ot();
|
|
963
|
-
function zt(
|
|
964
|
-
return $(
|
|
963
|
+
function zt(c, s, t, e) {
|
|
964
|
+
return $(c, s, Hi), t.intersectBox(Hi, e);
|
|
965
965
|
}
|
|
966
|
-
function Mo(
|
|
967
|
-
const { geometry: n, _indirectBuffer: r } =
|
|
968
|
-
for (let a = e,
|
|
966
|
+
function Mo(c, s, t, e, i, o) {
|
|
967
|
+
const { geometry: n, _indirectBuffer: r } = c;
|
|
968
|
+
for (let a = e, l = e + i; a < l; a++) {
|
|
969
969
|
let E = r ? r[a] : a;
|
|
970
970
|
Us(n, s, t, E, o);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
function Do(
|
|
974
|
-
const { geometry: o, _indirectBuffer: n } =
|
|
973
|
+
function Do(c, s, t, e, i) {
|
|
974
|
+
const { geometry: o, _indirectBuffer: n } = c;
|
|
975
975
|
let r = 1 / 0, a = null;
|
|
976
|
-
for (let
|
|
976
|
+
for (let l = e, E = e + i; l < E; l++) {
|
|
977
977
|
let d;
|
|
978
|
-
d = Us(o, s, t, n ? n[
|
|
978
|
+
d = Us(o, s, t, n ? n[l] : l), d && d.distance < r && (a = d, r = d.distance);
|
|
979
979
|
}
|
|
980
980
|
return a;
|
|
981
981
|
}
|
|
982
|
-
function Uo(
|
|
983
|
-
const { geometry: r } = t, { index: a } = r,
|
|
984
|
-
for (let E =
|
|
982
|
+
function Uo(c, s, t, e, i, o, n) {
|
|
983
|
+
const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
|
|
984
|
+
for (let E = c, d = s + c; E < d; E++) {
|
|
985
985
|
let h;
|
|
986
|
-
if (h = t.resolveTriangleIndex(E), et(n, h * 3, a,
|
|
986
|
+
if (h = t.resolveTriangleIndex(E), et(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
|
|
987
987
|
return !0;
|
|
988
988
|
}
|
|
989
989
|
return !1;
|
|
990
990
|
}
|
|
991
991
|
const ki = /* @__PURE__ */ new w();
|
|
992
|
-
function xo(
|
|
993
|
-
Z.setBuffer(
|
|
992
|
+
function xo(c, s, t, e, i) {
|
|
993
|
+
Z.setBuffer(c._roots[s]), ai(0, c, t, e, i), Z.clearBuffer();
|
|
994
994
|
}
|
|
995
|
-
function ai(
|
|
996
|
-
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a =
|
|
995
|
+
function ai(c, s, t, e, i) {
|
|
996
|
+
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
|
|
997
997
|
if (ht(a, n)) {
|
|
998
|
-
const E = Et(
|
|
998
|
+
const E = Et(c, r), d = ft(a, n);
|
|
999
999
|
Po(s, t, e, E, d, i);
|
|
1000
1000
|
} else {
|
|
1001
|
-
const E = pt(
|
|
1001
|
+
const E = pt(c);
|
|
1002
1002
|
zt(E, o, e, ki) && ai(E, s, t, e, i);
|
|
1003
|
-
const d = Ct(
|
|
1003
|
+
const d = Ct(c, r);
|
|
1004
1004
|
zt(d, o, e, ki) && ai(d, s, t, e, i);
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
const Wi = /* @__PURE__ */ new w(), bo = ["x", "y", "z"];
|
|
1008
|
-
function vo(
|
|
1009
|
-
Z.setBuffer(
|
|
1010
|
-
const i = ci(0,
|
|
1008
|
+
function vo(c, s, t, e) {
|
|
1009
|
+
Z.setBuffer(c._roots[s]);
|
|
1010
|
+
const i = ci(0, c, t, e);
|
|
1011
1011
|
return Z.clearBuffer(), i;
|
|
1012
1012
|
}
|
|
1013
|
-
function ci(
|
|
1013
|
+
function ci(c, s, t, e) {
|
|
1014
1014
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1015
|
-
let r =
|
|
1015
|
+
let r = c * 2;
|
|
1016
1016
|
if (ht(r, o)) {
|
|
1017
|
-
const
|
|
1018
|
-
return Lo(s, t, e,
|
|
1017
|
+
const l = Et(c, n), E = ft(r, o);
|
|
1018
|
+
return Lo(s, t, e, l, E);
|
|
1019
1019
|
} else {
|
|
1020
|
-
const
|
|
1021
|
-
let
|
|
1022
|
-
h ? (
|
|
1023
|
-
const R = zt(
|
|
1020
|
+
const l = Dn(c, n), E = bo[l], h = e.direction[E] >= 0;
|
|
1021
|
+
let u, p;
|
|
1022
|
+
h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
|
|
1023
|
+
const R = zt(u, i, e, Wi) ? ci(u, s, t, e) : null;
|
|
1024
1024
|
if (R) {
|
|
1025
1025
|
const F = R.point[E];
|
|
1026
|
-
if (h ? F <= i[p +
|
|
1026
|
+
if (h ? F <= i[p + l] : (
|
|
1027
1027
|
// min bounding data
|
|
1028
|
-
F >= i[p +
|
|
1028
|
+
F >= i[p + l + 3]
|
|
1029
1029
|
))
|
|
1030
1030
|
return R;
|
|
1031
1031
|
}
|
|
@@ -1034,18 +1034,18 @@ function ci(l, s, t, e) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
1036
|
const ss = /* @__PURE__ */ new Ot(), ne = /* @__PURE__ */ new Ft(), oe = /* @__PURE__ */ new Ft(), Oe = /* @__PURE__ */ new yt(), Xi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
|
|
1037
|
-
function Bo(
|
|
1038
|
-
Z.setBuffer(
|
|
1039
|
-
const i = li(0,
|
|
1037
|
+
function Bo(c, s, t, e) {
|
|
1038
|
+
Z.setBuffer(c._roots[s]);
|
|
1039
|
+
const i = li(0, c, t, e);
|
|
1040
1040
|
return Z.clearBuffer(), i;
|
|
1041
1041
|
}
|
|
1042
|
-
function li(
|
|
1042
|
+
function li(c, s, t, e, i = null) {
|
|
1043
1043
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1044
|
-
let a =
|
|
1044
|
+
let a = c * 2;
|
|
1045
1045
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), Xi.set(t.boundingBox.min, t.boundingBox.max, e), i = Xi), ht(a, n)) {
|
|
1046
|
-
const E = s.geometry, d = E.index, h = E.attributes.position,
|
|
1046
|
+
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(c, r), R = ft(a, n);
|
|
1047
1047
|
if (Oe.copy(e).invert(), t.boundsTree)
|
|
1048
|
-
return $(
|
|
1048
|
+
return $(c, o, is), is.matrix.copy(Oe), is.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1049
1049
|
intersectsBounds: (T) => is.intersectsBox(T),
|
|
1050
1050
|
intersectsTriangle: (T) => {
|
|
1051
1051
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
@@ -1057,23 +1057,23 @@ function li(l, s, t, e, i = null) {
|
|
|
1057
1057
|
});
|
|
1058
1058
|
for (let C = A * 3, T = (R + A) * 3; C < T; C += 3) {
|
|
1059
1059
|
et(ne, C, d, h), ne.a.applyMatrix4(Oe), ne.b.applyMatrix4(Oe), ne.c.applyMatrix4(Oe), ne.needsUpdate = !0;
|
|
1060
|
-
for (let F = 0, f =
|
|
1061
|
-
if (et(oe, F,
|
|
1060
|
+
for (let F = 0, f = u.count; F < f; F += 3)
|
|
1061
|
+
if (et(oe, F, u, p), oe.needsUpdate = !0, ne.intersectsTriangle(oe))
|
|
1062
1062
|
return !0;
|
|
1063
1063
|
}
|
|
1064
1064
|
} else {
|
|
1065
|
-
const E =
|
|
1065
|
+
const E = c + 8, d = r[c + 6];
|
|
1066
1066
|
return $(E, o, ss), !!(i.intersectsBox(ss) && li(E, s, t, e, i) || ($(d, o, ss), i.intersectsBox(ss) && li(d, s, t, e, i)));
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
1069
|
const ns = /* @__PURE__ */ new yt(), Hs = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Yo = /* @__PURE__ */ new w(), Vo = /* @__PURE__ */ new w(), Go = /* @__PURE__ */ new w(), zo = /* @__PURE__ */ new w();
|
|
1070
|
-
function Ho(
|
|
1070
|
+
function Ho(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1071
1071
|
s.boundingBox || s.computeBoundingBox(), Hs.set(s.boundingBox.min, s.boundingBox.max, t), Hs.needsUpdate = !0;
|
|
1072
|
-
const r =
|
|
1072
|
+
const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
|
|
1073
1073
|
let p = Yo, A = Vo, R = null, C = null;
|
|
1074
1074
|
i && (R = Go, C = zo);
|
|
1075
1075
|
let T = 1 / 0, F = null, f = null;
|
|
1076
|
-
return ns.copy(t).invert(), ge.matrix.copy(ns),
|
|
1076
|
+
return ns.copy(t).invert(), ge.matrix.copy(ns), c.shapecast(
|
|
1077
1077
|
{
|
|
1078
1078
|
boundsTraverseOrder: (m) => Hs.distanceToBox(m),
|
|
1079
1079
|
intersectsBounds: (m, O, S) => S < T && S < n ? (O && (ge.min.copy(m.min), ge.max.copy(m.max), ge.needsUpdate = !0), !0) : !1,
|
|
@@ -1084,10 +1084,10 @@ function Ho(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(
|
|
1087
|
+
et(u, 3 * L, d, E), 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(h, 3 * y,
|
|
1090
|
-
const b = h.distanceToTriangle(
|
|
1089
|
+
et(h, 3 * y, l, a), h.needsUpdate = !0;
|
|
1090
|
+
const b = h.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 Ho(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(
|
|
1100
|
+
et(u, 3 * _, d, E), 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(h, 3 * L,
|
|
1103
|
-
const y = h.distanceToTriangle(
|
|
1102
|
+
et(h, 3 * L, l, a), h.needsUpdate = !0;
|
|
1103
|
+
const y = h.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,22 +1108,22 @@ function Ho(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
),
|
|
1111
|
+
), It.releasePrimitive(h), 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(ns), A.applyMatrix4(ns), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
|
|
1112
1112
|
}
|
|
1113
|
-
function ko(
|
|
1113
|
+
function ko(c, s = null) {
|
|
1114
1114
|
s && Array.isArray(s) && (s = new Set(s));
|
|
1115
|
-
const t =
|
|
1116
|
-
let o, n, r, a,
|
|
1117
|
-
const E =
|
|
1118
|
-
for (let h = 0,
|
|
1119
|
-
o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0,
|
|
1120
|
-
function d(h,
|
|
1115
|
+
const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
|
|
1116
|
+
let o, n, r, a, l = 0;
|
|
1117
|
+
const E = c._roots;
|
|
1118
|
+
for (let h = 0, u = E.length; h < u; h++)
|
|
1119
|
+
o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, l), l += o.byteLength;
|
|
1120
|
+
function d(h, u, p = !1) {
|
|
1121
1121
|
const A = h * 2;
|
|
1122
1122
|
if (r[A + 15] === Ds) {
|
|
1123
1123
|
const C = n[h + 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
|
-
const M = 3 *
|
|
1126
|
+
const M = 3 * c.resolveTriangleIndex(N);
|
|
1127
1127
|
for (let y = 0; y < 3; y++) {
|
|
1128
1128
|
let x = M + y;
|
|
1129
1129
|
x = e ? e[x] : x;
|
|
@@ -1133,14 +1133,14 @@ function ko(l, s = null) {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== O || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = O, a[h + 4] = S, a[h + 5] = _, !0) : !1;
|
|
1135
1135
|
} else {
|
|
1136
|
-
const C = h + 8, T = n[h + 6], F = C +
|
|
1136
|
+
const C = h + 8, T = n[h + 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;
|
|
1140
1140
|
let L = !1;
|
|
1141
|
-
_ && (L = d(C,
|
|
1141
|
+
_ && (L = d(C, u, m));
|
|
1142
1142
|
let M = !1;
|
|
1143
|
-
N && (M = d(T,
|
|
1143
|
+
N && (M = d(T, u, m));
|
|
1144
1144
|
const y = L || M;
|
|
1145
1145
|
if (y)
|
|
1146
1146
|
for (let x = 0; x < 3; x++) {
|
|
@@ -1152,43 +1152,43 @@ function ko(l, s = null) {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
const Zi = /* @__PURE__ */ new w();
|
|
1155
|
-
function Wo(
|
|
1156
|
-
Z.setBuffer(
|
|
1155
|
+
function Wo(c, s, t, e, i) {
|
|
1156
|
+
Z.setBuffer(c._roots[s]), hi(0, c, t, e, i), Z.clearBuffer();
|
|
1157
1157
|
}
|
|
1158
|
-
function hi(
|
|
1159
|
-
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a =
|
|
1158
|
+
function hi(c, s, t, e, i) {
|
|
1159
|
+
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
|
|
1160
1160
|
if (ht(a, n)) {
|
|
1161
|
-
const E = Et(
|
|
1161
|
+
const E = Et(c, r), d = ft(a, n);
|
|
1162
1162
|
Mo(s, t, e, E, d, i);
|
|
1163
1163
|
} else {
|
|
1164
|
-
const E = pt(
|
|
1164
|
+
const E = pt(c);
|
|
1165
1165
|
zt(E, o, e, Zi) && hi(E, s, t, e, i);
|
|
1166
|
-
const d = Ct(
|
|
1166
|
+
const d = Ct(c, r);
|
|
1167
1167
|
zt(d, o, e, Zi) && hi(d, s, t, e, i);
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
1170
|
const Qi = /* @__PURE__ */ new w(), Xo = ["x", "y", "z"];
|
|
1171
|
-
function Zo(
|
|
1172
|
-
Z.setBuffer(
|
|
1173
|
-
const i = Ei(0,
|
|
1171
|
+
function Zo(c, s, t, e) {
|
|
1172
|
+
Z.setBuffer(c._roots[s]);
|
|
1173
|
+
const i = Ei(0, c, t, e);
|
|
1174
1174
|
return Z.clearBuffer(), i;
|
|
1175
1175
|
}
|
|
1176
|
-
function Ei(
|
|
1176
|
+
function Ei(c, s, t, e) {
|
|
1177
1177
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1178
|
-
let r =
|
|
1178
|
+
let r = c * 2;
|
|
1179
1179
|
if (ht(r, o)) {
|
|
1180
|
-
const
|
|
1181
|
-
return Do(s, t, e,
|
|
1180
|
+
const l = Et(c, n), E = ft(r, o);
|
|
1181
|
+
return Do(s, t, e, l, E);
|
|
1182
1182
|
} else {
|
|
1183
|
-
const
|
|
1184
|
-
let
|
|
1185
|
-
h ? (
|
|
1186
|
-
const R = zt(
|
|
1183
|
+
const l = Dn(c, n), E = Xo[l], h = e.direction[E] >= 0;
|
|
1184
|
+
let u, p;
|
|
1185
|
+
h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
|
|
1186
|
+
const R = zt(u, i, e, Qi) ? Ei(u, s, t, e) : null;
|
|
1187
1187
|
if (R) {
|
|
1188
1188
|
const F = R.point[E];
|
|
1189
|
-
if (h ? F <= i[p +
|
|
1189
|
+
if (h ? F <= i[p + l] : (
|
|
1190
1190
|
// min bounding data
|
|
1191
|
-
F >= i[p +
|
|
1191
|
+
F >= i[p + l + 3]
|
|
1192
1192
|
))
|
|
1193
1193
|
return R;
|
|
1194
1194
|
}
|
|
@@ -1197,18 +1197,18 @@ function Ei(l, s, t, e) {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
1199
|
const os = /* @__PURE__ */ new Ot(), re = /* @__PURE__ */ new Ft(), ae = /* @__PURE__ */ new Ft(), Se = /* @__PURE__ */ new yt(), ji = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
|
|
1200
|
-
function Qo(
|
|
1201
|
-
Z.setBuffer(
|
|
1202
|
-
const i = di(0,
|
|
1200
|
+
function Qo(c, s, t, e) {
|
|
1201
|
+
Z.setBuffer(c._roots[s]);
|
|
1202
|
+
const i = di(0, c, t, e);
|
|
1203
1203
|
return Z.clearBuffer(), i;
|
|
1204
1204
|
}
|
|
1205
|
-
function di(
|
|
1205
|
+
function di(c, s, t, e, i = null) {
|
|
1206
1206
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1207
|
-
let a =
|
|
1207
|
+
let a = c * 2;
|
|
1208
1208
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, e), i = ji), ht(a, n)) {
|
|
1209
|
-
const E = s.geometry, d = E.index, h = E.attributes.position,
|
|
1209
|
+
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(c, r), R = ft(a, n);
|
|
1210
1210
|
if (Se.copy(e).invert(), t.boundsTree)
|
|
1211
|
-
return $(
|
|
1211
|
+
return $(c, o, rs), rs.matrix.copy(Se), rs.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1212
1212
|
intersectsBounds: (T) => rs.intersectsBox(T),
|
|
1213
1213
|
intersectsTriangle: (T) => {
|
|
1214
1214
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
@@ -1221,23 +1221,23 @@ function di(l, s, t, e, i = null) {
|
|
|
1221
1221
|
for (let C = A, T = R + A; C < T; C++) {
|
|
1222
1222
|
const F = s.resolveTriangleIndex(C);
|
|
1223
1223
|
et(re, 3 * F, d, h), re.a.applyMatrix4(Se), re.b.applyMatrix4(Se), re.c.applyMatrix4(Se), re.needsUpdate = !0;
|
|
1224
|
-
for (let f = 0, m =
|
|
1225
|
-
if (et(ae, f,
|
|
1224
|
+
for (let f = 0, m = u.count; f < m; f += 3)
|
|
1225
|
+
if (et(ae, f, u, p), ae.needsUpdate = !0, re.intersectsTriangle(ae))
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
}
|
|
1228
1228
|
} else {
|
|
1229
|
-
const E =
|
|
1229
|
+
const E = c + 8, d = r[c + 6];
|
|
1230
1230
|
return $(E, o, os), !!(i.intersectsBox(os) && di(E, s, t, e, i) || ($(d, o, os), i.intersectsBox(os) && di(d, s, t, e, i)));
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
const as = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), jo = /* @__PURE__ */ new w(), qo = /* @__PURE__ */ new w(), $o = /* @__PURE__ */ new w(), Ko = /* @__PURE__ */ new w();
|
|
1234
|
-
function Jo(
|
|
1234
|
+
function Jo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1235
1235
|
s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
|
|
1236
|
-
const r =
|
|
1236
|
+
const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
|
|
1237
1237
|
let p = jo, A = qo, R = null, C = null;
|
|
1238
1238
|
i && (R = $o, C = Ko);
|
|
1239
1239
|
let T = 1 / 0, F = null, f = null;
|
|
1240
|
-
return as.copy(t).invert(), _e.matrix.copy(as),
|
|
1240
|
+
return as.copy(t).invert(), _e.matrix.copy(as), c.shapecast(
|
|
1241
1241
|
{
|
|
1242
1242
|
boundsTraverseOrder: (m) => ks.distanceToBox(m),
|
|
1243
1243
|
intersectsBounds: (m, O, S) => S < T && S < n ? (O && (_e.min.copy(m.min), _e.max.copy(m.max), _e.needsUpdate = !0), !0) : !1,
|
|
@@ -1250,11 +1250,11 @@ function Jo(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(
|
|
1253
|
+
et(u, 3 * y, d, E), 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
|
-
const B =
|
|
1256
|
-
et(h, 3 * B,
|
|
1257
|
-
const H = h.distanceToTriangle(
|
|
1255
|
+
const B = c.resolveTriangleIndex(x);
|
|
1256
|
+
et(h, 3 * B, l, a), h.needsUpdate = !0;
|
|
1257
|
+
const H = h.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 Jo(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(
|
|
1267
|
+
et(u, 3 * _, d, E), 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
|
-
const y =
|
|
1270
|
-
et(h, 3 * y,
|
|
1271
|
-
const x = h.distanceToTriangle(
|
|
1269
|
+
const y = c.resolveTriangleIndex(L);
|
|
1270
|
+
et(h, 3 * y, l, a), h.needsUpdate = !0;
|
|
1271
|
+
const x = h.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,72 +1276,72 @@ function Jo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
|
-
),
|
|
1279
|
+
), It.releasePrimitive(h), 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(as), A.applyMatrix4(as), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
|
|
1280
1280
|
}
|
|
1281
1281
|
function tr() {
|
|
1282
1282
|
return typeof SharedArrayBuffer < "u";
|
|
1283
1283
|
}
|
|
1284
1284
|
const be = new Z.constructor(), Rs = new Z.constructor(), vt = new Oi(() => new Ot()), ce = new Ot(), le = new Ot(), Ws = new Ot(), Xs = new Ot();
|
|
1285
1285
|
let Zs = !1;
|
|
1286
|
-
function er(
|
|
1286
|
+
function er(c, s, t, e) {
|
|
1287
1287
|
if (Zs)
|
|
1288
1288
|
throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
1289
1289
|
Zs = !0;
|
|
1290
|
-
const i =
|
|
1290
|
+
const i = c._roots, o = s._roots;
|
|
1291
1291
|
let n, r = 0, a = 0;
|
|
1292
|
-
const
|
|
1292
|
+
const l = new yt().copy(t).invert();
|
|
1293
1293
|
for (let E = 0, d = i.length; E < d; E++) {
|
|
1294
1294
|
be.setBuffer(i[E]), a = 0;
|
|
1295
1295
|
const h = vt.getPrimitive();
|
|
1296
|
-
$(0, be.float32Array, h), h.applyMatrix4(
|
|
1297
|
-
for (let
|
|
1296
|
+
$(0, be.float32Array, h), h.applyMatrix4(l);
|
|
1297
|
+
for (let u = 0, p = o.length; u < p && (Rs.setBuffer(o[E]), n = Tt(
|
|
1298
1298
|
0,
|
|
1299
1299
|
0,
|
|
1300
1300
|
t,
|
|
1301
|
-
|
|
1301
|
+
l,
|
|
1302
1302
|
e,
|
|
1303
1303
|
r,
|
|
1304
1304
|
a,
|
|
1305
1305
|
0,
|
|
1306
1306
|
0,
|
|
1307
1307
|
h
|
|
1308
|
-
), Rs.clearBuffer(), a += o[
|
|
1308
|
+
), Rs.clearBuffer(), a += o[u].length, !n); u++)
|
|
1309
1309
|
;
|
|
1310
1310
|
if (vt.releasePrimitive(h), be.clearBuffer(), r += i[E].length, n)
|
|
1311
1311
|
break;
|
|
1312
1312
|
}
|
|
1313
1313
|
return Zs = !1, n;
|
|
1314
1314
|
}
|
|
1315
|
-
function Tt(
|
|
1315
|
+
function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
1316
1316
|
let d, h;
|
|
1317
1317
|
E ? (d = Rs, h = be) : (d = be, h = Rs);
|
|
1318
|
-
const
|
|
1318
|
+
const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, R = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = c * 2, f = s * 2, m = ht(F, A), O = ht(f, T);
|
|
1319
1319
|
let S = !1;
|
|
1320
1320
|
if (O && m)
|
|
1321
1321
|
E ? S = i(
|
|
1322
1322
|
Et(s, C),
|
|
1323
1323
|
ft(s * 2, T),
|
|
1324
|
-
Et(
|
|
1325
|
-
ft(
|
|
1324
|
+
Et(c, p),
|
|
1325
|
+
ft(c * 2, A),
|
|
1326
1326
|
a,
|
|
1327
1327
|
n + s,
|
|
1328
1328
|
r,
|
|
1329
|
-
o +
|
|
1329
|
+
o + c
|
|
1330
1330
|
) : S = i(
|
|
1331
|
-
Et(
|
|
1332
|
-
ft(
|
|
1331
|
+
Et(c, p),
|
|
1332
|
+
ft(c * 2, A),
|
|
1333
1333
|
Et(s, C),
|
|
1334
1334
|
ft(s * 2, T),
|
|
1335
1335
|
r,
|
|
1336
|
-
o +
|
|
1336
|
+
o + c,
|
|
1337
1337
|
a,
|
|
1338
1338
|
n + s
|
|
1339
1339
|
);
|
|
1340
1340
|
else if (O) {
|
|
1341
1341
|
const _ = vt.getPrimitive();
|
|
1342
1342
|
$(s, R, _), _.applyMatrix4(t);
|
|
1343
|
-
const N = pt(
|
|
1344
|
-
$(N,
|
|
1343
|
+
const N = pt(c), L = Ct(c, p);
|
|
1344
|
+
$(N, u, ce), $(L, u, le);
|
|
1345
1345
|
const M = _.intersectsBox(ce), y = _.intersectsBox(le);
|
|
1346
1346
|
S = M && Tt(
|
|
1347
1347
|
s,
|
|
@@ -1371,10 +1371,10 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1371
1371
|
} else {
|
|
1372
1372
|
const _ = pt(s), N = Ct(s, C);
|
|
1373
1373
|
$(_, R, Ws), $(N, R, Xs);
|
|
1374
|
-
const L =
|
|
1374
|
+
const L = l.intersectsBox(Ws), M = l.intersectsBox(Xs);
|
|
1375
1375
|
if (L && M)
|
|
1376
1376
|
S = Tt(
|
|
1377
|
-
|
|
1377
|
+
c,
|
|
1378
1378
|
_,
|
|
1379
1379
|
t,
|
|
1380
1380
|
e,
|
|
@@ -1383,10 +1383,10 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1383
1383
|
n,
|
|
1384
1384
|
r,
|
|
1385
1385
|
a + 1,
|
|
1386
|
-
|
|
1386
|
+
l,
|
|
1387
1387
|
E
|
|
1388
1388
|
) || Tt(
|
|
1389
|
-
|
|
1389
|
+
c,
|
|
1390
1390
|
N,
|
|
1391
1391
|
t,
|
|
1392
1392
|
e,
|
|
@@ -1395,13 +1395,13 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1395
1395
|
n,
|
|
1396
1396
|
r,
|
|
1397
1397
|
a + 1,
|
|
1398
|
-
|
|
1398
|
+
l,
|
|
1399
1399
|
E
|
|
1400
1400
|
);
|
|
1401
1401
|
else if (L)
|
|
1402
1402
|
if (m)
|
|
1403
1403
|
S = Tt(
|
|
1404
|
-
|
|
1404
|
+
c,
|
|
1405
1405
|
_,
|
|
1406
1406
|
t,
|
|
1407
1407
|
e,
|
|
@@ -1410,14 +1410,14 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1410
1410
|
n,
|
|
1411
1411
|
r,
|
|
1412
1412
|
a + 1,
|
|
1413
|
-
|
|
1413
|
+
l,
|
|
1414
1414
|
E
|
|
1415
1415
|
);
|
|
1416
1416
|
else {
|
|
1417
1417
|
const y = vt.getPrimitive();
|
|
1418
1418
|
y.copy(Ws).applyMatrix4(t);
|
|
1419
|
-
const x = pt(
|
|
1420
|
-
$(x,
|
|
1419
|
+
const x = pt(c), b = Ct(c, p);
|
|
1420
|
+
$(x, u, ce), $(b, u, le);
|
|
1421
1421
|
const B = y.intersectsBox(ce), H = y.intersectsBox(le);
|
|
1422
1422
|
S = B && Tt(
|
|
1423
1423
|
_,
|
|
@@ -1448,7 +1448,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1448
1448
|
else if (M)
|
|
1449
1449
|
if (m)
|
|
1450
1450
|
S = Tt(
|
|
1451
|
-
|
|
1451
|
+
c,
|
|
1452
1452
|
N,
|
|
1453
1453
|
t,
|
|
1454
1454
|
e,
|
|
@@ -1457,14 +1457,14 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1457
1457
|
n,
|
|
1458
1458
|
r,
|
|
1459
1459
|
a + 1,
|
|
1460
|
-
|
|
1460
|
+
l,
|
|
1461
1461
|
E
|
|
1462
1462
|
);
|
|
1463
1463
|
else {
|
|
1464
1464
|
const y = vt.getPrimitive();
|
|
1465
1465
|
y.copy(Xs).applyMatrix4(t);
|
|
1466
|
-
const x = pt(
|
|
1467
|
-
$(x,
|
|
1466
|
+
const x = pt(c), b = Ct(c, p);
|
|
1467
|
+
$(x, u, ce), $(b, u, le);
|
|
1468
1468
|
const B = y.intersectsBox(ce), H = y.intersectsBox(le);
|
|
1469
1469
|
S = B && Tt(
|
|
1470
1470
|
N,
|
|
@@ -1524,8 +1524,8 @@ class gi {
|
|
|
1524
1524
|
if (r._roots = o, r._indirectBuffer = n || null, e.setIndex) {
|
|
1525
1525
|
const a = t.getIndex();
|
|
1526
1526
|
if (a === null) {
|
|
1527
|
-
const
|
|
1528
|
-
t.setIndex(
|
|
1527
|
+
const l = new Nn(s.index, 1, !1);
|
|
1528
|
+
t.setIndex(l);
|
|
1529
1529
|
} else
|
|
1530
1530
|
a.array !== i && (a.array.set(i), a.needsUpdate = !0);
|
|
1531
1531
|
}
|
|
@@ -1565,22 +1565,22 @@ class gi {
|
|
|
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
|
|
1568
|
+
const l = r * 2, E = o[l + 15] === Ds;
|
|
1569
1569
|
if (E) {
|
|
1570
|
-
const d = i[r + 6], h = o[
|
|
1570
|
+
const d = i[r + 6], h = o[l + 14];
|
|
1571
1571
|
s(a, E, new Float32Array(e, r * 4, 6), d, h);
|
|
1572
1572
|
} else {
|
|
1573
|
-
const d = r + Cs / 4, h = i[r + 6],
|
|
1574
|
-
s(a, E, new Float32Array(e, r * 4, 6),
|
|
1573
|
+
const d = r + Cs / 4, h = i[r + 6], u = i[r + 7];
|
|
1574
|
+
s(a, E, new Float32Array(e, r * 4, 6), u) || (n(d, a + 1), n(h, a + 1));
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
/* Core Cast Functions */
|
|
1579
1579
|
raycast(s, t = Mi) {
|
|
1580
|
-
const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups,
|
|
1580
|
+
const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, l = n ? t.side : t, E = this.indirect ? Wo : xo;
|
|
1581
1581
|
for (let d = 0, h = e.length; d < h; d++) {
|
|
1582
|
-
const
|
|
1583
|
-
if (E(this, d,
|
|
1582
|
+
const u = r ? t[a[d].materialIndex].side : l, p = o.length;
|
|
1583
|
+
if (E(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 gi {
|
|
|
1591
1591
|
raycastFirst(s, t = Mi) {
|
|
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,
|
|
1594
|
+
const a = i.groups, l = o ? t.side : t, E = this.indirect ? Zo : vo;
|
|
1595
1595
|
for (let d = 0, h = e.length; d < h; d++) {
|
|
1596
|
-
const
|
|
1596
|
+
const u = n ? t[a[d].materialIndex].side : l, p = E(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;
|
|
@@ -1606,7 +1606,7 @@ class gi {
|
|
|
1606
1606
|
return e;
|
|
1607
1607
|
}
|
|
1608
1608
|
shapecast(s) {
|
|
1609
|
-
const t =
|
|
1609
|
+
const t = It.getPrimitive(), e = this.indirect ? Uo : yo;
|
|
1610
1610
|
let {
|
|
1611
1611
|
boundsTraverseOrder: i,
|
|
1612
1612
|
intersectsBounds: o,
|
|
@@ -1615,30 +1615,30 @@ class gi {
|
|
|
1615
1615
|
} = s;
|
|
1616
1616
|
if (n && r) {
|
|
1617
1617
|
const d = n;
|
|
1618
|
-
n = (h,
|
|
1618
|
+
n = (h, u, p, A, R) => d(h, u, p, A, R) ? !0 : e(h, u, this, r, p, A, t);
|
|
1619
1619
|
} else
|
|
1620
|
-
n || (r ? n = (d, h,
|
|
1621
|
-
let a = !1,
|
|
1620
|
+
n || (r ? n = (d, h, u, p) => e(d, h, this, r, u, p, t) : n = (d, h, u) => u);
|
|
1621
|
+
let a = !1, l = 0;
|
|
1622
1622
|
const E = this._roots;
|
|
1623
1623
|
for (let d = 0, h = E.length; d < h; d++) {
|
|
1624
|
-
const
|
|
1625
|
-
if (a = go(this, d, o, n, i,
|
|
1624
|
+
const u = E[d];
|
|
1625
|
+
if (a = go(this, d, o, n, i, l), a)
|
|
1626
1626
|
break;
|
|
1627
|
-
|
|
1627
|
+
l += u.byteLength;
|
|
1628
1628
|
}
|
|
1629
|
-
return
|
|
1629
|
+
return It.releasePrimitive(t), a;
|
|
1630
1630
|
}
|
|
1631
1631
|
bvhcast(s, t, e) {
|
|
1632
1632
|
let {
|
|
1633
1633
|
intersectsRanges: i,
|
|
1634
1634
|
intersectsTriangles: o
|
|
1635
1635
|
} = e;
|
|
1636
|
-
const n =
|
|
1636
|
+
const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, l = this.indirect ? (p) => {
|
|
1637
1637
|
const A = this.resolveTriangleIndex(p);
|
|
1638
1638
|
et(n, A * 3, r, a);
|
|
1639
1639
|
} : (p) => {
|
|
1640
1640
|
et(n, p * 3, r, a);
|
|
1641
|
-
}, E =
|
|
1641
|
+
}, E = It.getPrimitive(), d = s.geometry.index, h = s.geometry.attributes.position, u = s.indirect ? (p) => {
|
|
1642
1642
|
const A = s.resolveTriangleIndex(p);
|
|
1643
1643
|
et(E, A * 3, d, h);
|
|
1644
1644
|
} : (p) => {
|
|
@@ -1647,9 +1647,9 @@ class gi {
|
|
|
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
|
-
|
|
1650
|
+
u(S), E.a.applyMatrix4(t), E.b.applyMatrix4(t), E.c.applyMatrix4(t), E.needsUpdate = !0;
|
|
1651
1651
|
for (let N = A, L = A + R; N < L; N++)
|
|
1652
|
-
if (
|
|
1652
|
+
if (l(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, O))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
1655
1655
|
return !1;
|
|
@@ -1707,31 +1707,31 @@ class gi {
|
|
|
1707
1707
|
}), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
function $i(
|
|
1711
|
-
return
|
|
1710
|
+
function $i(c, s, t) {
|
|
1711
|
+
return c === null || (c.point.applyMatrix4(s.matrixWorld), c.distance = c.point.distanceTo(t.ray.origin), c.object = s, c.distance < t.near || c.distance > t.far) ? null : c;
|
|
1712
1712
|
}
|
|
1713
1713
|
const Qs = /* @__PURE__ */ new Zn(), Ki = /* @__PURE__ */ new yt(), sr = v.prototype.raycast;
|
|
1714
|
-
function ir(
|
|
1714
|
+
function ir(c, s) {
|
|
1715
1715
|
if (this.geometry.boundsTree) {
|
|
1716
1716
|
if (this.material === void 0)
|
|
1717
1717
|
return;
|
|
1718
|
-
Ki.copy(this.matrixWorld).invert(), Qs.copy(
|
|
1718
|
+
Ki.copy(this.matrixWorld).invert(), Qs.copy(c.ray).applyMatrix4(Ki);
|
|
1719
1719
|
const t = this.geometry.boundsTree;
|
|
1720
|
-
if (
|
|
1721
|
-
const e = $i(t.raycastFirst(Qs, this.material), this,
|
|
1720
|
+
if (c.firstHitOnly === !0) {
|
|
1721
|
+
const e = $i(t.raycastFirst(Qs, this.material), this, c);
|
|
1722
1722
|
e && s.push(e);
|
|
1723
1723
|
} else {
|
|
1724
1724
|
const e = t.raycast(Qs, this.material);
|
|
1725
1725
|
for (let i = 0, o = e.length; i < o; i++) {
|
|
1726
|
-
const n = $i(e[i], this,
|
|
1726
|
+
const n = $i(e[i], this, c);
|
|
1727
1727
|
n && s.push(n);
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
} else
|
|
1731
|
-
sr.call(this,
|
|
1731
|
+
sr.call(this, c, s);
|
|
1732
1732
|
}
|
|
1733
|
-
function nr(
|
|
1734
|
-
return this.boundsTree = new gi(this,
|
|
1733
|
+
function nr(c) {
|
|
1734
|
+
return this.boundsTree = new gi(this, c), this.boundsTree;
|
|
1735
1735
|
}
|
|
1736
1736
|
function or() {
|
|
1737
1737
|
this.boundsTree = null;
|
|
@@ -1739,12 +1739,12 @@ function or() {
|
|
|
1739
1739
|
class U {
|
|
1740
1740
|
constructor() {
|
|
1741
1741
|
/** Triggers all the callbacks assigned to this event. */
|
|
1742
|
-
|
|
1742
|
+
I(this, "trigger", (s) => {
|
|
1743
1743
|
const t = this.handlers.slice(0);
|
|
1744
1744
|
for (const e of t)
|
|
1745
1745
|
e(s);
|
|
1746
1746
|
});
|
|
1747
|
-
|
|
1747
|
+
I(this, "handlers", []);
|
|
1748
1748
|
}
|
|
1749
1749
|
/**
|
|
1750
1750
|
* Add a callback to this event instance.
|
|
@@ -1768,12 +1768,12 @@ class U {
|
|
|
1768
1768
|
class Kt {
|
|
1769
1769
|
constructor() {
|
|
1770
1770
|
/** Triggers all the callbacks assigned to this event. */
|
|
1771
|
-
|
|
1771
|
+
I(this, "trigger", async (s) => {
|
|
1772
1772
|
const t = this.handlers.slice(0);
|
|
1773
1773
|
for (const e of t)
|
|
1774
1774
|
await e(s);
|
|
1775
1775
|
});
|
|
1776
|
-
|
|
1776
|
+
I(this, "handlers", []);
|
|
1777
1777
|
}
|
|
1778
1778
|
/**
|
|
1779
1779
|
* Add a callback to this event instance.
|
|
@@ -1797,15 +1797,15 @@ class Kt {
|
|
|
1797
1797
|
class Si {
|
|
1798
1798
|
constructor(s) {
|
|
1799
1799
|
/** Whether is component is {@link Disposable}. */
|
|
1800
|
-
|
|
1800
|
+
I(this, "isDisposeable", () => "dispose" in this && "onDisposed" in this);
|
|
1801
1801
|
/** Whether is component is {@link Resizeable}. */
|
|
1802
|
-
|
|
1802
|
+
I(this, "isResizeable", () => "resize" in this && "getSize" in this);
|
|
1803
1803
|
/** Whether is component is {@link Updateable}. */
|
|
1804
|
-
|
|
1804
|
+
I(this, "isUpdateable", () => "onAfterUpdate" in this && "onBeforeUpdate" in this && "update" in this);
|
|
1805
1805
|
/** Whether is component is {@link Hideable}. */
|
|
1806
|
-
|
|
1806
|
+
I(this, "isHideable", () => "visible" in this);
|
|
1807
1807
|
/** Whether is component is {@link Configurable}. */
|
|
1808
|
-
|
|
1808
|
+
I(this, "isConfigurable", () => "setup" in this && "config" in this && "onSetup" in this);
|
|
1809
1809
|
this.components = s;
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
@@ -1814,9 +1814,9 @@ class J extends Si {
|
|
|
1814
1814
|
class _i extends Si {
|
|
1815
1815
|
constructor(t) {
|
|
1816
1816
|
super(t);
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1817
|
+
I(this, "worlds", /* @__PURE__ */ new Map());
|
|
1818
|
+
I(this, "onWorldChanged", new U());
|
|
1819
|
+
I(this, "currentWorld", null);
|
|
1820
1820
|
this.onWorldChanged.add(({ world: e, action: i }) => {
|
|
1821
1821
|
i === "removed" && this.worlds.delete(e.uuid);
|
|
1822
1822
|
});
|
|
@@ -1826,29 +1826,29 @@ class rr extends _i {
|
|
|
1826
1826
|
constructor() {
|
|
1827
1827
|
super(...arguments);
|
|
1828
1828
|
/** Whether is instance is {@link CameraControllable}. */
|
|
1829
|
-
|
|
1829
|
+
I(this, "hasCameraControls", () => "controls" in this);
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
1832
1832
|
class ar extends _i {
|
|
1833
1833
|
constructor() {
|
|
1834
1834
|
super(...arguments);
|
|
1835
1835
|
/** {@link Updateable.onBeforeUpdate} */
|
|
1836
|
-
|
|
1836
|
+
I(this, "onAfterUpdate", new U());
|
|
1837
1837
|
/** {@link Updateable.onAfterUpdate} */
|
|
1838
|
-
|
|
1838
|
+
I(this, "onBeforeUpdate", new U());
|
|
1839
1839
|
/** {@link Disposable.onDisposed} */
|
|
1840
|
-
|
|
1841
|
-
|
|
1840
|
+
I(this, "onDisposed", new U());
|
|
1841
|
+
I(this, "onResize", new U());
|
|
1842
1842
|
/**
|
|
1843
1843
|
* Event that fires when there has been a change to the list of clipping
|
|
1844
1844
|
* planes used by the active renderer.
|
|
1845
1845
|
*/
|
|
1846
|
-
|
|
1846
|
+
I(this, "onClippingPlanesUpdated", new U());
|
|
1847
1847
|
/**
|
|
1848
1848
|
* The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
|
|
1849
1849
|
* instance of the renderer.
|
|
1850
1850
|
*/
|
|
1851
|
-
|
|
1851
|
+
I(this, "clippingPlanes", []);
|
|
1852
1852
|
}
|
|
1853
1853
|
/**
|
|
1854
1854
|
* Forces the update of the clipping planes and all components that depend
|
|
@@ -1873,9 +1873,9 @@ class ar extends _i {
|
|
|
1873
1873
|
const ve = class ve extends J {
|
|
1874
1874
|
constructor(t) {
|
|
1875
1875
|
super(t);
|
|
1876
|
-
|
|
1876
|
+
I(this, "_disposedComponents", /* @__PURE__ */ new Set());
|
|
1877
1877
|
/** {@link Component.enabled} */
|
|
1878
|
-
|
|
1878
|
+
I(this, "enabled", !0);
|
|
1879
1879
|
t.add(ve.uuid, this);
|
|
1880
1880
|
}
|
|
1881
1881
|
/**
|
|
@@ -1930,13 +1930,13 @@ const ve = class ve extends J {
|
|
|
1930
1930
|
t.material.dispose();
|
|
1931
1931
|
}
|
|
1932
1932
|
};
|
|
1933
|
-
|
|
1933
|
+
I(ve, "uuid", "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");
|
|
1934
1934
|
let Ht = ve;
|
|
1935
1935
|
class cr extends _i {
|
|
1936
1936
|
constructor(t) {
|
|
1937
1937
|
super(t);
|
|
1938
1938
|
/** {@link Disposable.onDisposed} */
|
|
1939
|
-
|
|
1939
|
+
I(this, "onDisposed", new U());
|
|
1940
1940
|
}
|
|
1941
1941
|
/** {@link Disposable.dispose} */
|
|
1942
1942
|
dispose() {
|
|
@@ -1948,7 +1948,7 @@ class cr extends _i {
|
|
|
1948
1948
|
this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
1951
|
-
const Ts = 0, lr = 1, hr = new w(), Ji = new Lt(), js = new Ai(), tn = new w(), ls = new
|
|
1951
|
+
const Ts = 0, lr = 1, hr = new w(), Ji = new Lt(), js = new Ai(), tn = new w(), ls = new Ie();
|
|
1952
1952
|
class Er {
|
|
1953
1953
|
constructor() {
|
|
1954
1954
|
this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new en(), this.unassigned = new en(), this.vertices = [];
|
|
@@ -1987,10 +1987,10 @@ class Er {
|
|
|
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],
|
|
1991
|
-
if (
|
|
1990
|
+
const a = e[n], l = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
|
|
1991
|
+
if (l > 0 && E >= 0)
|
|
1992
1992
|
return null;
|
|
1993
|
-
const d = E !== 0 ? -
|
|
1993
|
+
const d = E !== 0 ? -l / E : 0;
|
|
1994
1994
|
if (!(d <= 0) && (E > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
|
|
1995
1995
|
return null;
|
|
1996
1996
|
}
|
|
@@ -2063,10 +2063,10 @@ class Er {
|
|
|
2063
2063
|
s.copy(this.vertices[0].point), t.copy(this.vertices[0].point);
|
|
2064
2064
|
for (let o = 0, n = this.vertices.length; o < n; o++) {
|
|
2065
2065
|
const r = this.vertices[o], a = r.point;
|
|
2066
|
-
for (let
|
|
2067
|
-
a.getComponent(
|
|
2068
|
-
for (let
|
|
2069
|
-
a.getComponent(
|
|
2066
|
+
for (let l = 0; l < 3; l++)
|
|
2067
|
+
a.getComponent(l) < s.getComponent(l) && (s.setComponent(l, a.getComponent(l)), e[l] = r);
|
|
2068
|
+
for (let l = 0; l < 3; l++)
|
|
2069
|
+
a.getComponent(l) > t.getComponent(l) && (t.setComponent(l, a.getComponent(l)), i[l] = r);
|
|
2070
2070
|
}
|
|
2071
2071
|
return this.tolerance = 3 * Number.EPSILON * (Math.max(Math.abs(s.x), Math.abs(t.x)) + Math.max(Math.abs(s.y), Math.abs(t.y)) + Math.max(Math.abs(s.z), Math.abs(t.z))), { min: e, max: i };
|
|
2072
2072
|
}
|
|
@@ -2076,24 +2076,24 @@ class Er {
|
|
|
2076
2076
|
const s = this.vertices, t = this.computeExtremes(), e = t.min, i = t.max;
|
|
2077
2077
|
let o = 0, n = 0;
|
|
2078
2078
|
for (let h = 0; h < 3; h++) {
|
|
2079
|
-
const
|
|
2080
|
-
|
|
2079
|
+
const u = i[h].point.getComponent(h) - e[h].point.getComponent(h);
|
|
2080
|
+
u > o && (o = u, n = h);
|
|
2081
2081
|
}
|
|
2082
2082
|
const r = e[n], a = i[n];
|
|
2083
|
-
let
|
|
2083
|
+
let l, E;
|
|
2084
2084
|
o = 0, Ji.set(r.point, a.point);
|
|
2085
|
-
for (let h = 0,
|
|
2085
|
+
for (let h = 0, u = this.vertices.length; h < u; h++) {
|
|
2086
2086
|
const p = s[h];
|
|
2087
2087
|
if (p !== r && p !== a) {
|
|
2088
2088
|
Ji.closestPointToPoint(p.point, !0, tn);
|
|
2089
2089
|
const A = tn.distanceToSquared(p.point);
|
|
2090
|
-
A > o && (o = A,
|
|
2090
|
+
A > o && (o = A, l = p);
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
o = -1, js.setFromCoplanarPoints(r.point, a.point,
|
|
2094
|
-
for (let h = 0,
|
|
2093
|
+
o = -1, js.setFromCoplanarPoints(r.point, a.point, l.point);
|
|
2094
|
+
for (let h = 0, u = this.vertices.length; h < u; h++) {
|
|
2095
2095
|
const p = s[h];
|
|
2096
|
-
if (p !== r && p !== a && p !==
|
|
2096
|
+
if (p !== r && p !== a && p !== l) {
|
|
2097
2097
|
const A = Math.abs(js.distanceToPoint(p.point));
|
|
2098
2098
|
A > o && (o = A, E = p);
|
|
2099
2099
|
}
|
|
@@ -2101,32 +2101,32 @@ class Er {
|
|
|
2101
2101
|
const d = [];
|
|
2102
2102
|
if (js.distanceToPoint(E.point) < 0) {
|
|
2103
2103
|
d.push(
|
|
2104
|
-
Rt.create(r, a,
|
|
2104
|
+
Rt.create(r, a, l),
|
|
2105
2105
|
Rt.create(E, a, r),
|
|
2106
|
-
Rt.create(E,
|
|
2107
|
-
Rt.create(E, r,
|
|
2106
|
+
Rt.create(E, l, a),
|
|
2107
|
+
Rt.create(E, r, l)
|
|
2108
2108
|
);
|
|
2109
2109
|
for (let h = 0; h < 3; h++) {
|
|
2110
|
-
const
|
|
2111
|
-
d[h + 1].getEdge(2).setTwin(d[0].getEdge(
|
|
2110
|
+
const u = (h + 1) % 3;
|
|
2111
|
+
d[h + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[h + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
|
|
2112
2112
|
}
|
|
2113
2113
|
} else {
|
|
2114
2114
|
d.push(
|
|
2115
|
-
Rt.create(r,
|
|
2115
|
+
Rt.create(r, l, a),
|
|
2116
2116
|
Rt.create(E, r, a),
|
|
2117
|
-
Rt.create(E, a,
|
|
2118
|
-
Rt.create(E,
|
|
2117
|
+
Rt.create(E, a, l),
|
|
2118
|
+
Rt.create(E, l, r)
|
|
2119
2119
|
);
|
|
2120
2120
|
for (let h = 0; h < 3; h++) {
|
|
2121
|
-
const
|
|
2122
|
-
d[h + 1].getEdge(2).setTwin(d[0].getEdge((3 - h) % 3)), d[h + 1].getEdge(0).setTwin(d[
|
|
2121
|
+
const u = (h + 1) % 3;
|
|
2122
|
+
d[h + 1].getEdge(2).setTwin(d[0].getEdge((3 - h) % 3)), d[h + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
2125
|
for (let h = 0; h < 4; h++)
|
|
2126
2126
|
this.faces.push(d[h]);
|
|
2127
|
-
for (let h = 0,
|
|
2127
|
+
for (let h = 0, u = s.length; h < u; h++) {
|
|
2128
2128
|
const p = s[h];
|
|
2129
|
-
if (p !== r && p !== a && p !==
|
|
2129
|
+
if (p !== r && p !== a && p !== l && p !== E) {
|
|
2130
2130
|
o = this.tolerance;
|
|
2131
2131
|
let A = null;
|
|
2132
2132
|
for (let R = 0; R < 4; R++) {
|
|
@@ -2298,55 +2298,55 @@ class en {
|
|
|
2298
2298
|
return this.head === null;
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
2301
|
-
const
|
|
2302
|
-
function Nt(
|
|
2303
|
-
return
|
|
2301
|
+
const ui = [2, 2, 1], Ii = [1, 0, 0];
|
|
2302
|
+
function Nt(c, s) {
|
|
2303
|
+
return c * 3 + s;
|
|
2304
2304
|
}
|
|
2305
|
-
function
|
|
2306
|
-
const s =
|
|
2305
|
+
function ur(c) {
|
|
2306
|
+
const s = c.elements;
|
|
2307
2307
|
let t = 0;
|
|
2308
2308
|
for (let e = 0; e < 9; e++)
|
|
2309
2309
|
t += s[e] * s[e];
|
|
2310
2310
|
return Math.sqrt(t);
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2313
|
-
const s =
|
|
2312
|
+
function Ir(c) {
|
|
2313
|
+
const s = c.elements;
|
|
2314
2314
|
let t = 0;
|
|
2315
2315
|
for (let e = 0; e < 3; e++) {
|
|
2316
|
-
const i = s[Nt(
|
|
2316
|
+
const i = s[Nt(ui[e], Ii[e])];
|
|
2317
2317
|
t += 2 * i * i;
|
|
2318
2318
|
}
|
|
2319
2319
|
return Math.sqrt(t);
|
|
2320
2320
|
}
|
|
2321
|
-
function fr(
|
|
2321
|
+
function fr(c, s) {
|
|
2322
2322
|
let t = 0, e = 1;
|
|
2323
|
-
const i =
|
|
2324
|
-
for (let
|
|
2325
|
-
const E = Math.abs(i[Nt(
|
|
2326
|
-
E > t && (t = E, e =
|
|
2323
|
+
const i = c.elements;
|
|
2324
|
+
for (let l = 0; l < 3; l++) {
|
|
2325
|
+
const E = Math.abs(i[Nt(ui[l], Ii[l])]);
|
|
2326
|
+
E > t && (t = E, e = l);
|
|
2327
2327
|
}
|
|
2328
2328
|
let o = 1, n = 0;
|
|
2329
|
-
const r =
|
|
2329
|
+
const r = Ii[e], a = ui[e];
|
|
2330
2330
|
if (Math.abs(i[Nt(a, r)]) > Number.EPSILON) {
|
|
2331
|
-
const
|
|
2332
|
-
let
|
|
2333
|
-
h < 0 ?
|
|
2331
|
+
const l = i[Nt(a, a)], E = i[Nt(r, r)], d = i[Nt(a, r)], h = (l - E) / 2 / d;
|
|
2332
|
+
let u;
|
|
2333
|
+
h < 0 ? u = -1 / (-h + Math.sqrt(1 + h * h)) : u = 1 / (h + Math.sqrt(1 + h * h)), 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
|
}
|
|
2337
|
-
function pr(
|
|
2337
|
+
function pr(c, s) {
|
|
2338
2338
|
let t = 0, e = 0;
|
|
2339
2339
|
const i = 10;
|
|
2340
|
-
s.unitary.identity(), s.diagonal.copy(
|
|
2341
|
-
const o = s.unitary, n = s.diagonal, r = new g.Matrix3(), a = new g.Matrix3(),
|
|
2342
|
-
for (; e < i &&
|
|
2340
|
+
s.unitary.identity(), s.diagonal.copy(c);
|
|
2341
|
+
const o = s.unitary, n = s.diagonal, r = new g.Matrix3(), a = new g.Matrix3(), l = Number.EPSILON * ur(n);
|
|
2342
|
+
for (; e < i && Ir(n) > l; )
|
|
2343
2343
|
fr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
|
|
2344
2344
|
return s;
|
|
2345
2345
|
}
|
|
2346
|
-
function Cr(
|
|
2346
|
+
function Cr(c) {
|
|
2347
2347
|
const s = [];
|
|
2348
|
-
for (let it = 0; it <
|
|
2349
|
-
const Zt =
|
|
2348
|
+
for (let it = 0; it < c.length - 2; it += 3) {
|
|
2349
|
+
const Zt = c[it], tt = c[it + 1], Jt = c[it + 2];
|
|
2350
2350
|
s.push(new g.Vector3(Zt, tt, Jt));
|
|
2351
2351
|
}
|
|
2352
2352
|
const t = new Er();
|
|
@@ -2368,12 +2368,12 @@ function Cr(l) {
|
|
|
2368
2368
|
n.push(xs.point.x, xs.point.y, xs.point.z), n.push(bs.point.x, bs.point.y, bs.point.z), n.push(vs.point.x, vs.point.y, vs.point.z);
|
|
2369
2369
|
}
|
|
2370
2370
|
}
|
|
2371
|
-
const r = new g.Vector3(), a = new g.Vector3(),
|
|
2371
|
+
const r = new g.Vector3(), a = new g.Vector3(), l = new g.Vector3(), E = new g.Vector3(), d = new g.Vector3(), h = 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),
|
|
2374
|
+
r.fromArray(n, it), a.fromArray(n, it + 3), l.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(l).divideScalar(3), E.subVectors(a, r), d.subVectors(l, r);
|
|
2375
2375
|
const tt = h.crossVectors(E, d).length() / 2;
|
|
2376
|
-
p.add(h.copy(
|
|
2376
|
+
p.add(h.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x + l.x * l.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + l.x * l.y) * (tt / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + l.x * l.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + l.y * l.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + l.y * l.z) * (tt / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + l.z * l.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();
|
|
@@ -2399,11 +2399,11 @@ function Cr(l) {
|
|
|
2399
2399
|
const me = new g.Matrix4();
|
|
2400
2400
|
return me.multiply(yi), me.multiply(wi), me.multiply(Te), me.multiply(We), { center: q, halfSizes: st, rotation: Q, transformation: me };
|
|
2401
2401
|
}
|
|
2402
|
-
function Tr(
|
|
2402
|
+
function Tr(c, s, t) {
|
|
2403
2403
|
const e = [
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2404
|
+
c[0] - s[0],
|
|
2405
|
+
c[1] - s[1],
|
|
2406
|
+
c[2] - s[2]
|
|
2407
2407
|
];
|
|
2408
2408
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
|
|
2409
2409
|
}
|
|
@@ -2430,8 +2430,8 @@ const K = class K {
|
|
|
2430
2430
|
);
|
|
2431
2431
|
}
|
|
2432
2432
|
};
|
|
2433
|
-
|
|
2434
|
-
|
|
2433
|
+
I(K, "_pattern", /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/), // prettier-ignore
|
|
2434
|
+
I(K, "_lut", [
|
|
2435
2435
|
"00",
|
|
2436
2436
|
"01",
|
|
2437
2437
|
"02",
|
|
@@ -2693,13 +2693,13 @@ let ze = K;
|
|
|
2693
2693
|
class ea extends J {
|
|
2694
2694
|
constructor(t, e) {
|
|
2695
2695
|
super(t);
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2696
|
+
I(this, "onVertexFound", new U());
|
|
2697
|
+
I(this, "onVertexLost", new U());
|
|
2698
|
+
I(this, "components");
|
|
2699
|
+
I(this, "_pickedPoint", null);
|
|
2700
|
+
I(this, "_config");
|
|
2701
|
+
I(this, "_enabled", !1);
|
|
2702
|
+
I(this, "_workingPlane", null);
|
|
2703
2703
|
this.components = t, this.config = {
|
|
2704
2704
|
snapDistance: 0.25,
|
|
2705
2705
|
showOnlyVertex: !1,
|
|
@@ -2771,13 +2771,13 @@ class ea extends J {
|
|
|
2771
2771
|
const Fs = class Fs {
|
|
2772
2772
|
constructor() {
|
|
2773
2773
|
/** {@link Disposable.onDisposed} */
|
|
2774
|
-
|
|
2774
|
+
I(this, "onDisposed", new U());
|
|
2775
2775
|
/** The list of components created in this app. */
|
|
2776
|
-
|
|
2776
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
2777
2777
|
/** If disabled, the animation loop will be stopped. */
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2778
|
+
I(this, "enabled", !1);
|
|
2779
|
+
I(this, "_clock");
|
|
2780
|
+
I(this, "update", () => {
|
|
2781
2781
|
if (!this.enabled)
|
|
2782
2782
|
return;
|
|
2783
2783
|
const s = this._clock.getDelta();
|
|
@@ -2842,15 +2842,15 @@ const Fs = class Fs {
|
|
|
2842
2842
|
g.BufferGeometry.prototype.computeBoundsTree = nr, g.BufferGeometry.prototype.disposeBoundsTree = or, g.Mesh.prototype.raycast = ir;
|
|
2843
2843
|
}
|
|
2844
2844
|
};
|
|
2845
|
-
|
|
2845
|
+
I(Fs, "release", "1.4.21");
|
|
2846
2846
|
let fi = Fs;
|
|
2847
2847
|
class mr {
|
|
2848
2848
|
constructor(s) {
|
|
2849
|
-
|
|
2850
|
-
|
|
2849
|
+
I(this, "_event");
|
|
2850
|
+
I(this, "_position", new g.Vector2());
|
|
2851
2851
|
/** {@link Disposable.onDisposed} */
|
|
2852
|
-
|
|
2853
|
-
|
|
2852
|
+
I(this, "onDisposed", new U());
|
|
2853
|
+
I(this, "updateMouseInfo", (s) => {
|
|
2854
2854
|
this._event = s;
|
|
2855
2855
|
});
|
|
2856
2856
|
this.dom = s, this.setupEvents(!0);
|
|
@@ -2882,14 +2882,14 @@ class mr {
|
|
|
2882
2882
|
class Rr {
|
|
2883
2883
|
constructor(s, t) {
|
|
2884
2884
|
/** {@link Component.enabled} */
|
|
2885
|
-
|
|
2886
|
-
|
|
2885
|
+
I(this, "enabled", !0);
|
|
2886
|
+
I(this, "components");
|
|
2887
2887
|
/** {@link Disposable.onDisposed} */
|
|
2888
|
-
|
|
2888
|
+
I(this, "onDisposed", new U());
|
|
2889
2889
|
/** The position of the mouse in the screen. */
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2890
|
+
I(this, "mouse");
|
|
2891
|
+
I(this, "three", new g.Raycaster());
|
|
2892
|
+
I(this, "world");
|
|
2893
2893
|
const e = t.renderer;
|
|
2894
2894
|
if (!e)
|
|
2895
2895
|
throw new Error("A renderer is needed for the raycaster to work!");
|
|
@@ -2936,9 +2936,9 @@ class Rr {
|
|
|
2936
2936
|
const Os = class Os extends J {
|
|
2937
2937
|
constructor(t) {
|
|
2938
2938
|
super(t);
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2939
|
+
I(this, "enabled", !0);
|
|
2940
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
2941
|
+
I(this, "onDisposed", new U());
|
|
2942
2942
|
t.add(Os.uuid, this);
|
|
2943
2943
|
}
|
|
2944
2944
|
get(t) {
|
|
@@ -2959,7 +2959,7 @@ const Os = class Os extends J {
|
|
|
2959
2959
|
this.list.clear(), this.onDisposed.trigger();
|
|
2960
2960
|
}
|
|
2961
2961
|
};
|
|
2962
|
-
|
|
2962
|
+
I(Os, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
|
|
2963
2963
|
let He = Os;
|
|
2964
2964
|
class Ar extends Si {
|
|
2965
2965
|
constructor(t) {
|
|
@@ -2967,15 +2967,15 @@ class Ar extends Si {
|
|
|
2967
2967
|
/**
|
|
2968
2968
|
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
|
|
2969
2969
|
*/
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2970
|
+
I(this, "meshes", /* @__PURE__ */ new Set());
|
|
2971
|
+
I(this, "onAfterUpdate", new U());
|
|
2972
|
+
I(this, "onBeforeUpdate", new U());
|
|
2973
|
+
I(this, "enabled", !0);
|
|
2974
|
+
I(this, "uuid", ze.create());
|
|
2975
|
+
I(this, "onDisposed", new U());
|
|
2976
|
+
I(this, "_scene");
|
|
2977
|
+
I(this, "_camera");
|
|
2978
|
+
I(this, "_renderer", null);
|
|
2979
2979
|
}
|
|
2980
2980
|
get scene() {
|
|
2981
2981
|
if (!this._scene)
|
|
@@ -3017,11 +3017,11 @@ class sa extends cr {
|
|
|
3017
3017
|
constructor(t) {
|
|
3018
3018
|
super(t);
|
|
3019
3019
|
/** {@link Configurable.isSetup} */
|
|
3020
|
-
|
|
3021
|
-
|
|
3020
|
+
I(this, "isSetup", !1);
|
|
3021
|
+
I(this, "three");
|
|
3022
3022
|
/** {@link Configurable.onSetup} */
|
|
3023
|
-
|
|
3024
|
-
|
|
3023
|
+
I(this, "onSetup", new U());
|
|
3024
|
+
I(this, "config", {
|
|
3025
3025
|
directionalLight: {
|
|
3026
3026
|
color: new g.Color("white"),
|
|
3027
3027
|
intensity: 1.5,
|
|
@@ -3052,27 +3052,30 @@ class sa extends cr {
|
|
|
3052
3052
|
class ia extends ar {
|
|
3053
3053
|
constructor(t, e, i) {
|
|
3054
3054
|
super(t);
|
|
3055
|
-
|
|
3055
|
+
I(this, "enabled", !0);
|
|
3056
3056
|
/** The HTML container of the THREE.js canvas where the scene is rendered. */
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3057
|
+
I(this, "container");
|
|
3058
|
+
I(this, "three");
|
|
3059
|
+
I(this, "_canvas");
|
|
3060
|
+
I(this, "_parameters");
|
|
3061
|
+
I(this, "_resizeObserver", null);
|
|
3062
|
+
I(this, "onContainerUpdated", new U());
|
|
3063
|
+
I(this, "_resizing", !1);
|
|
3063
3064
|
/** {@link Resizeable.resize} */
|
|
3064
|
-
|
|
3065
|
-
this.
|
|
3065
|
+
I(this, "resize", (t) => {
|
|
3066
|
+
if (this._resizing)
|
|
3067
|
+
return;
|
|
3068
|
+
this._resizing = !0, this.onContainerUpdated.trigger();
|
|
3066
3069
|
const e = t ? t.x : this.container.clientWidth, i = t ? t.y : this.container.clientHeight;
|
|
3067
|
-
this.three.setSize(e, i), this.onResize.trigger(new g.Vector2(e, i));
|
|
3070
|
+
this.three.setSize(e, i), this.onResize.trigger(new g.Vector2(e, i)), this._resizing = !1;
|
|
3068
3071
|
});
|
|
3069
|
-
|
|
3072
|
+
I(this, "resizeEvent", () => {
|
|
3070
3073
|
this.resize();
|
|
3071
3074
|
});
|
|
3072
|
-
|
|
3075
|
+
I(this, "onContextLost", (t) => {
|
|
3073
3076
|
t.preventDefault(), this.enabled = !1;
|
|
3074
3077
|
});
|
|
3075
|
-
|
|
3078
|
+
I(this, "onContextBack", () => {
|
|
3076
3079
|
this.three.setRenderTarget(null), this.three.dispose(), this.three = new g.WebGLRenderer({
|
|
3077
3080
|
canvas: this._canvas,
|
|
3078
3081
|
antialias: !0,
|
|
@@ -3111,7 +3114,7 @@ class ia extends ar {
|
|
|
3111
3114
|
const e = this.three.domElement.parentElement;
|
|
3112
3115
|
if (!e)
|
|
3113
3116
|
throw new Error("This renderer needs to have an HTML container!");
|
|
3114
|
-
this._resizeObserver && (this._resizeObserver.disconnect(), this._resizeObserver = null), window.removeEventListener("resize", this.resizeEvent), t && (this._resizeObserver = new ResizeObserver(this.resizeEvent), this._resizeObserver.observe(e),
|
|
3117
|
+
this._resizeObserver && (this._resizeObserver.disconnect(), this._resizeObserver = null), window.removeEventListener("resize", this.resizeEvent), t && (this._resizeObserver = new ResizeObserver(this.resizeEvent), this._resizeObserver.observe(e), window.addEventListener("resize", this.resizeEvent));
|
|
3115
3118
|
}
|
|
3116
3119
|
setupRenderer() {
|
|
3117
3120
|
this.three.localClippingEnabled = !0, this.container && this.container.appendChild(this.three.domElement), this.onContainerUpdated.trigger();
|
|
@@ -3150,64 +3153,64 @@ const V = {
|
|
|
3150
3153
|
IN: 1,
|
|
3151
3154
|
OUT: -1
|
|
3152
3155
|
};
|
|
3153
|
-
function Qt(
|
|
3154
|
-
return
|
|
3156
|
+
function Qt(c) {
|
|
3157
|
+
return c.isPerspectiveCamera;
|
|
3155
3158
|
}
|
|
3156
|
-
function bt(
|
|
3157
|
-
return
|
|
3159
|
+
function bt(c) {
|
|
3160
|
+
return c.isOrthographicCamera;
|
|
3158
3161
|
}
|
|
3159
3162
|
const Ee = Math.PI * 2, nn = Math.PI / 2, Un = 1e-5, Ne = Math.PI / 180;
|
|
3160
|
-
function mt(
|
|
3161
|
-
return Math.max(s, Math.min(t,
|
|
3163
|
+
function mt(c, s, t) {
|
|
3164
|
+
return Math.max(s, Math.min(t, c));
|
|
3162
3165
|
}
|
|
3163
|
-
function X(
|
|
3164
|
-
return Math.abs(
|
|
3166
|
+
function X(c, s = Un) {
|
|
3167
|
+
return Math.abs(c) < s;
|
|
3165
3168
|
}
|
|
3166
|
-
function k(
|
|
3167
|
-
return X(
|
|
3169
|
+
function k(c, s, t = Un) {
|
|
3170
|
+
return X(c - s, t);
|
|
3168
3171
|
}
|
|
3169
|
-
function on(
|
|
3170
|
-
return Math.round(
|
|
3172
|
+
function on(c, s) {
|
|
3173
|
+
return Math.round(c / s) * s;
|
|
3171
3174
|
}
|
|
3172
|
-
function Pe(
|
|
3173
|
-
return isFinite(
|
|
3175
|
+
function Pe(c) {
|
|
3176
|
+
return isFinite(c) ? c : c < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
3174
3177
|
}
|
|
3175
|
-
function Le(
|
|
3176
|
-
return Math.abs(
|
|
3178
|
+
function Le(c) {
|
|
3179
|
+
return Math.abs(c) < Number.MAX_VALUE ? c : c * (1 / 0);
|
|
3177
3180
|
}
|
|
3178
|
-
function hs(
|
|
3181
|
+
function hs(c, s, t, e, i = 1 / 0, o) {
|
|
3179
3182
|
e = Math.max(1e-4, e);
|
|
3180
3183
|
const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
|
|
3181
|
-
let
|
|
3184
|
+
let l = c - s;
|
|
3182
3185
|
const E = s, d = i * e;
|
|
3183
|
-
|
|
3184
|
-
const h = (t.value + n *
|
|
3186
|
+
l = mt(l, -d, d), s = c - l;
|
|
3187
|
+
const h = (t.value + n * l) * o;
|
|
3185
3188
|
t.value = (t.value - n * h) * a;
|
|
3186
|
-
let
|
|
3187
|
-
return E -
|
|
3189
|
+
let u = s + (l + h) * a;
|
|
3190
|
+
return E - c > 0 == u > E && (u = E, t.value = (u - E) / o), u;
|
|
3188
3191
|
}
|
|
3189
|
-
function rn(
|
|
3192
|
+
function rn(c, s, t, e, i = 1 / 0, o, n) {
|
|
3190
3193
|
e = Math.max(1e-4, e);
|
|
3191
|
-
const r = 2 / e, a = r * o,
|
|
3192
|
-
let E = s.x, d = s.y, h = s.z,
|
|
3193
|
-
const R = E, C = d, T = h, F = i * e, f = F * F, m =
|
|
3194
|
+
const r = 2 / e, a = r * o, l = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
3195
|
+
let E = s.x, d = s.y, h = s.z, u = c.x - E, p = c.y - d, A = c.z - h;
|
|
3196
|
+
const R = E, C = d, T = h, F = i * e, f = F * F, m = u * u + p * p + A * A;
|
|
3194
3197
|
if (m > f) {
|
|
3195
3198
|
const B = Math.sqrt(m);
|
|
3196
|
-
|
|
3199
|
+
u = u / B * F, p = p / B * F, A = A / B * F;
|
|
3197
3200
|
}
|
|
3198
|
-
E =
|
|
3199
|
-
const O = (t.x + r *
|
|
3200
|
-
t.x = (t.x - r * O) *
|
|
3201
|
-
const N = R -
|
|
3201
|
+
E = c.x - u, d = c.y - p, h = c.z - A;
|
|
3202
|
+
const O = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * A) * o;
|
|
3203
|
+
t.x = (t.x - r * O) * l, t.y = (t.y - r * S) * l, t.z = (t.z - r * _) * l, n.x = E + (u + O) * l, n.y = d + (p + S) * l, n.z = h + (A + _) * l;
|
|
3204
|
+
const N = R - c.x, L = C - c.y, M = T - c.z, y = n.x - R, x = n.y - C, b = n.z - T;
|
|
3202
3205
|
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;
|
|
3203
3206
|
}
|
|
3204
|
-
function $s(
|
|
3205
|
-
s.set(0, 0),
|
|
3207
|
+
function $s(c, s) {
|
|
3208
|
+
s.set(0, 0), c.forEach((t) => {
|
|
3206
3209
|
s.x += t.clientX, s.y += t.clientY;
|
|
3207
|
-
}), s.x /=
|
|
3210
|
+
}), s.x /= c.length, s.y /= c.length;
|
|
3208
3211
|
}
|
|
3209
|
-
function Ks(
|
|
3210
|
-
return bt(
|
|
3212
|
+
function Ks(c, s) {
|
|
3213
|
+
return bt(c) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
|
|
3211
3214
|
}
|
|
3212
3215
|
class Fr {
|
|
3213
3216
|
constructor() {
|
|
@@ -3274,7 +3277,7 @@ class Fr {
|
|
|
3274
3277
|
}
|
|
3275
3278
|
}
|
|
3276
3279
|
const Or = "2.7.3", Es = 1 / 8, xn = typeof window < "u", gr = xn && /Mac/.test(navigator.platform), Sr = !(xn && "PointerEvent" in window);
|
|
3277
|
-
let Y, an, ds, Js, lt, G, z, de, ye, gt, St, jt, cn, ln, dt, we,
|
|
3280
|
+
let Y, an, ds, Js, lt, G, z, de, ye, gt, St, jt, cn, ln, dt, we, ue, hn, ti, En, ei, si, us;
|
|
3278
3281
|
class ot extends Fr {
|
|
3279
3282
|
/**
|
|
3280
3283
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
@@ -3317,7 +3320,7 @@ class ot extends Fr {
|
|
|
3317
3320
|
* @category Statics
|
|
3318
3321
|
*/
|
|
3319
3322
|
static install(s) {
|
|
3320
|
-
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), Js = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), de = new Y.Vector3(), ye = new Y.Vector3(), gt = new Y.Vector3(), St = new Y.Vector3(), jt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), dt = new Y.Spherical(), we = new Y.Spherical(),
|
|
3323
|
+
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), Js = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), de = new Y.Vector3(), ye = new Y.Vector3(), gt = new Y.Vector3(), St = new Y.Vector3(), jt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), dt = new Y.Spherical(), we = new Y.Spherical(), ue = new Y.Box3(), hn = new Y.Box3(), ti = new Y.Sphere(), En = new Y.Quaternion(), ei = new Y.Quaternion(), si = new Y.Matrix4(), us = new Y.Raycaster();
|
|
3321
3324
|
}
|
|
3322
3325
|
/**
|
|
3323
3326
|
* list all ACTIONs
|
|
@@ -3425,7 +3428,7 @@ class ot extends Fr {
|
|
|
3425
3428
|
deltaY: 0,
|
|
3426
3429
|
mouseButton: (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.LEFT ? V.MIDDLE : (f.buttons & V.RIGHT) === V.LEFT ? V.RIGHT : null
|
|
3427
3430
|
};
|
|
3428
|
-
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3431
|
+
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", l), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, A(f);
|
|
3429
3432
|
}, a = (f) => {
|
|
3430
3433
|
f.cancelable && f.preventDefault();
|
|
3431
3434
|
const m = f.pointerId, O = this._lockedPointer || this._findPointerById(m);
|
|
@@ -3446,7 +3449,7 @@ class ot extends Fr {
|
|
|
3446
3449
|
(!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
3447
3450
|
R();
|
|
3448
3451
|
}
|
|
3449
|
-
},
|
|
3452
|
+
}, l = (f) => {
|
|
3450
3453
|
const m = this._lockedPointer || this._findPointerById(1);
|
|
3451
3454
|
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());
|
|
3452
3455
|
}, E = (f) => {
|
|
@@ -3476,7 +3479,7 @@ class ot extends Fr {
|
|
|
3476
3479
|
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = P.NONE, C());
|
|
3477
3480
|
};
|
|
3478
3481
|
let h = -1;
|
|
3479
|
-
const
|
|
3482
|
+
const u = (f) => {
|
|
3480
3483
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === P.NONE)
|
|
3481
3484
|
return;
|
|
3482
3485
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
@@ -3516,7 +3519,7 @@ class ot extends Fr {
|
|
|
3516
3519
|
if (!(!this._domElement || !this._enabled)) {
|
|
3517
3520
|
if (this.mouseButtons.right === ot.ACTION.NONE) {
|
|
3518
3521
|
const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(m);
|
|
3519
|
-
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3522
|
+
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d);
|
|
3520
3523
|
return;
|
|
3521
3524
|
}
|
|
3522
3525
|
f.preventDefault();
|
|
@@ -3564,7 +3567,7 @@ class ot extends Fr {
|
|
|
3564
3567
|
}
|
|
3565
3568
|
((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" });
|
|
3566
3569
|
}, C = () => {
|
|
3567
|
-
$s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3570
|
+
$s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
|
|
3568
3571
|
};
|
|
3569
3572
|
this.lockPointer = () => {
|
|
3570
3573
|
!this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
|
|
@@ -3584,9 +3587,9 @@ class ot extends Fr {
|
|
|
3584
3587
|
this.unlockPointer();
|
|
3585
3588
|
};
|
|
3586
3589
|
this._addAllEventListeners = (f) => {
|
|
3587
|
-
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Sr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel",
|
|
3590
|
+
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Sr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
|
|
3588
3591
|
}, this._removeAllEventListeners = () => {
|
|
3589
|
-
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", E), this._domElement.removeEventListener("wheel",
|
|
3592
|
+
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", E), 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", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3590
3593
|
}, this.cancel = () => {
|
|
3591
3594
|
this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
|
|
3592
3595
|
}, t && this.connect(t), this.update(0);
|
|
@@ -3951,15 +3954,15 @@ class ot extends Fr {
|
|
|
3951
3954
|
* @category Methods
|
|
3952
3955
|
*/
|
|
3953
3956
|
fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
|
|
3954
|
-
const a = [],
|
|
3955
|
-
|
|
3957
|
+
const a = [], l = s.isBox3 ? ue.copy(s) : ue.setFromObject(s);
|
|
3958
|
+
l.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
|
|
3956
3959
|
const E = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
|
|
3957
3960
|
a.push(this.rotateTo(E, d, t));
|
|
3958
|
-
const h = G.setFromSpherical(this._sphericalEnd).normalize(),
|
|
3959
|
-
p &&
|
|
3961
|
+
const h = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(h, Js), p = k(Math.abs(h.y), 1);
|
|
3962
|
+
p && u.multiply(ei.setFromAxisAngle(ds, E)), u.multiply(this._yAxisUpSpaceInverse);
|
|
3960
3963
|
const A = hn.makeEmpty();
|
|
3961
|
-
z.copy(
|
|
3962
|
-
const R = A.getSize(G), C = A.getCenter(z).applyQuaternion(
|
|
3964
|
+
z.copy(l.min).applyQuaternion(u), A.expandByPoint(z), z.copy(l.min).setX(l.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(l.min).setY(l.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(l.max).setZ(l.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(l.min).setZ(l.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(l.max).setY(l.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(l.max).setX(l.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(l.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(Js, h), p && u.premultiply(ei.invert()), u.premultiply(this._yAxisUpSpace);
|
|
3965
|
+
const R = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
|
|
3963
3966
|
if (Qt(this._camera)) {
|
|
3964
3967
|
const T = this.getDistanceToFitBox(R.x, R.y, R.z, e);
|
|
3965
3968
|
a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
@@ -3981,8 +3984,8 @@ class ot extends Fr {
|
|
|
3981
3984
|
const n = this.getDistanceToFitSphere(o.radius);
|
|
3982
3985
|
e.push(this.dollyTo(n, t));
|
|
3983
3986
|
} else if (bt(this._camera)) {
|
|
3984
|
-
const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius,
|
|
3985
|
-
e.push(this.zoomTo(
|
|
3987
|
+
const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, l = Math.min(n / a, r / a);
|
|
3988
|
+
e.push(this.zoomTo(l, t));
|
|
3986
3989
|
}
|
|
3987
3990
|
return e.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(e);
|
|
3988
3991
|
}
|
|
@@ -3999,8 +4002,8 @@ class ot extends Fr {
|
|
|
3999
4002
|
*/
|
|
4000
4003
|
setLookAt(s, t, e, i, o, n, r = !1) {
|
|
4001
4004
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
|
|
4002
|
-
const a = z.set(i, o, n),
|
|
4003
|
-
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
4005
|
+
const a = z.set(i, o, n), l = G.set(s, t, e);
|
|
4006
|
+
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
4004
4007
|
const E = !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);
|
|
4005
4008
|
return this._createOnRestPromise(E);
|
|
4006
4009
|
}
|
|
@@ -4022,14 +4025,14 @@ class ot extends Fr {
|
|
|
4022
4025
|
* @param enableTransition
|
|
4023
4026
|
* @category Methods
|
|
4024
4027
|
*/
|
|
4025
|
-
lerpLookAt(s, t, e, i, o, n, r, a,
|
|
4028
|
+
lerpLookAt(s, t, e, i, o, n, r, a, l, E, d, h, u, p = !1) {
|
|
4026
4029
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
|
|
4027
4030
|
const A = G.set(i, o, n), R = z.set(s, t, e);
|
|
4028
4031
|
dt.setFromVector3(R.sub(A).applyQuaternion(this._yAxisUpSpace));
|
|
4029
|
-
const C = de.set(E, d, h), T = z.set(r, a,
|
|
4030
|
-
we.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C,
|
|
4032
|
+
const C = de.set(E, d, h), T = z.set(r, a, l);
|
|
4033
|
+
we.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
|
|
4031
4034
|
const F = we.theta - dt.theta, f = we.phi - dt.phi, m = we.radius - dt.radius;
|
|
4032
|
-
this._sphericalEnd.set(dt.radius + m *
|
|
4035
|
+
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));
|
|
4033
4036
|
const O = !p || 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);
|
|
4034
4037
|
return this._createOnRestPromise(O);
|
|
4035
4038
|
}
|
|
@@ -4272,19 +4275,19 @@ class ot extends Fr {
|
|
|
4272
4275
|
}
|
|
4273
4276
|
if (this.dollyToCursor) {
|
|
4274
4277
|
if (Qt(this._camera) && this._changedDolly !== 0) {
|
|
4275
|
-
const d = this._spherical.radius - this._lastDistance, h = this._camera,
|
|
4278
|
+
const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(h.up).normalize();
|
|
4276
4279
|
p.lengthSq() === 0 && (p.x = 1);
|
|
4277
|
-
const A = z.crossVectors(p,
|
|
4280
|
+
const A = z.crossVectors(p, u), R = this._sphericalEnd.radius * Math.tan(h.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 * h.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;
|
|
4278
4281
|
if (this.infinityDolly && (m || O)) {
|
|
4279
4282
|
this._sphericalEnd.radius -= d, this._spherical.radius -= d;
|
|
4280
|
-
const _ = z.copy(
|
|
4283
|
+
const _ = z.copy(u).multiplyScalar(-d);
|
|
4281
4284
|
f.add(_);
|
|
4282
4285
|
}
|
|
4283
4286
|
this._boundary.clampPoint(f, f);
|
|
4284
4287
|
const S = z.subVectors(f, this._targetEnd);
|
|
4285
4288
|
this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
|
|
4286
4289
|
} else if (bt(this._camera) && this._changedZoom !== 0) {
|
|
4287
|
-
const d = this._zoom - this._lastZoom, h = this._camera,
|
|
4290
|
+
const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), A = de.copy(u).add(p.multiplyScalar(-u.dot(h.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);
|
|
4288
4291
|
f.sub(O), this._boundary.clampPoint(f, f);
|
|
4289
4292
|
const S = z.subVectors(f, this._targetEnd);
|
|
4290
4293
|
this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
|
|
@@ -4390,8 +4393,8 @@ class ot extends Fr {
|
|
|
4390
4393
|
if (e === 0)
|
|
4391
4394
|
return s.add(t).add(r);
|
|
4392
4395
|
{
|
|
4393
|
-
const
|
|
4394
|
-
return s.add(z.copy(t).multiplyScalar(
|
|
4396
|
+
const l = 1 + e * a / t.dot(r);
|
|
4397
|
+
return s.add(z.copy(t).multiplyScalar(l)).add(r.multiplyScalar(1 - e));
|
|
4395
4398
|
}
|
|
4396
4399
|
}
|
|
4397
4400
|
_updateNearPlaneCorners() {
|
|
@@ -4414,8 +4417,8 @@ class ot extends Fr {
|
|
|
4414
4417
|
const o = z.copy(this._nearPlaneCorners[i]);
|
|
4415
4418
|
o.applyMatrix4(si);
|
|
4416
4419
|
const n = de.addVectors(this._target, o);
|
|
4417
|
-
|
|
4418
|
-
const r =
|
|
4420
|
+
us.set(n, e), us.far = this._spherical.radius + 1;
|
|
4421
|
+
const r = us.intersectObjects(this.colliderMeshes);
|
|
4419
4422
|
r.length !== 0 && r[0].distance < s && (s = r[0].distance);
|
|
4420
4423
|
}
|
|
4421
4424
|
return s;
|
|
@@ -4476,9 +4479,9 @@ class ot extends Fr {
|
|
|
4476
4479
|
}
|
|
4477
4480
|
static createBoundingSphere(s, t = new Y.Sphere()) {
|
|
4478
4481
|
const e = t, i = e.center;
|
|
4479
|
-
|
|
4480
|
-
n.isMesh &&
|
|
4481
|
-
}),
|
|
4482
|
+
ue.makeEmpty(), s.traverseVisible((n) => {
|
|
4483
|
+
n.isMesh && ue.expandByObject(n);
|
|
4484
|
+
}), ue.getCenter(i);
|
|
4482
4485
|
let o = 0;
|
|
4483
4486
|
return s.traverseVisible((n) => {
|
|
4484
4487
|
if (!n.isMesh)
|
|
@@ -4495,19 +4498,19 @@ class ke extends rr {
|
|
|
4495
4498
|
constructor(t) {
|
|
4496
4499
|
super(t);
|
|
4497
4500
|
/** {@link Updateable.onBeforeUpdate} */
|
|
4498
|
-
|
|
4501
|
+
I(this, "onBeforeUpdate", new U());
|
|
4499
4502
|
/** {@link Updateable.onAfterUpdate} */
|
|
4500
|
-
|
|
4501
|
-
|
|
4503
|
+
I(this, "onAfterUpdate", new U());
|
|
4504
|
+
I(this, "onAspectUpdated", new U());
|
|
4502
4505
|
/** {@link Disposable.onDisposed} */
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
+
I(this, "onDisposed", new U());
|
|
4507
|
+
I(this, "three");
|
|
4508
|
+
I(this, "_allControls", /* @__PURE__ */ new Map());
|
|
4506
4509
|
/**
|
|
4507
4510
|
* Updates the aspect of the camera to match the size of the
|
|
4508
4511
|
* {@link Components.renderer}.
|
|
4509
4512
|
*/
|
|
4510
|
-
|
|
4513
|
+
I(this, "updateAspect", () => {
|
|
4511
4514
|
var t;
|
|
4512
4515
|
if (!(!this.currentWorld || !this.currentWorld.renderer)) {
|
|
4513
4516
|
if (this.three instanceof g.OrthographicCamera) {
|
|
@@ -4602,27 +4605,27 @@ const gs = class gs extends J {
|
|
|
4602
4605
|
* Event triggered after the update process of all worlds.
|
|
4603
4606
|
* Subscribers can listen to this event to perform actions post-update.
|
|
4604
4607
|
*/
|
|
4605
|
-
|
|
4608
|
+
I(this, "onAfterUpdate", new U());
|
|
4606
4609
|
/**
|
|
4607
4610
|
* Event triggered before the update process of all worlds.
|
|
4608
4611
|
* Subscribers can listen to this event to perform actions pre-update.
|
|
4609
4612
|
*/
|
|
4610
|
-
|
|
4613
|
+
I(this, "onBeforeUpdate", new U());
|
|
4611
4614
|
/**
|
|
4612
4615
|
* Event triggered when the Worlds component is disposed.
|
|
4613
4616
|
* Subscribers can listen to this event to perform cleanup actions.
|
|
4614
4617
|
*/
|
|
4615
|
-
|
|
4618
|
+
I(this, "onDisposed", new U());
|
|
4616
4619
|
/**
|
|
4617
4620
|
* A collection of worlds managed by this component.
|
|
4618
4621
|
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
4619
4622
|
*/
|
|
4620
|
-
|
|
4623
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
4621
4624
|
/**
|
|
4622
4625
|
* A flag indicating whether the Worlds component is enabled.
|
|
4623
4626
|
* If false, the update process will be skipped.
|
|
4624
4627
|
*/
|
|
4625
|
-
|
|
4628
|
+
I(this, "enabled", !0);
|
|
4626
4629
|
t.add(gs.uuid, this);
|
|
4627
4630
|
}
|
|
4628
4631
|
/**
|
|
@@ -4661,23 +4664,23 @@ const gs = class gs extends J {
|
|
|
4661
4664
|
* A unique identifier for the component.
|
|
4662
4665
|
* This UUID is used to register the component within the Components system.
|
|
4663
4666
|
*/
|
|
4664
|
-
|
|
4667
|
+
I(gs, "uuid", "fdb61dc4-2ec1-4966-b83d-54ea795fad4a");
|
|
4665
4668
|
let pi = gs;
|
|
4666
4669
|
class _r {
|
|
4667
4670
|
constructor(s, t, e) {
|
|
4668
4671
|
/** {@link Disposable.onDisposed} */
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4672
|
+
I(this, "onDisposed", new U());
|
|
4673
|
+
I(this, "world");
|
|
4674
|
+
I(this, "components");
|
|
4675
|
+
I(this, "three");
|
|
4676
|
+
I(this, "_fade", 3);
|
|
4677
|
+
I(this, "updateZoom", () => {
|
|
4675
4678
|
this.world.camera instanceof ke && (this.material.uniforms.uZoom.value = this.world.camera.three.zoom);
|
|
4676
4679
|
});
|
|
4677
4680
|
this.world = t;
|
|
4678
4681
|
const { color: i, size1: o, size2: n, distance: r } = e;
|
|
4679
4682
|
this.components = s;
|
|
4680
|
-
const a = new g.PlaneGeometry(2, 2, 1, 1),
|
|
4683
|
+
const a = new g.PlaneGeometry(2, 2, 1, 1), l = new g.ShaderMaterial({
|
|
4681
4684
|
side: g.DoubleSide,
|
|
4682
4685
|
uniforms: {
|
|
4683
4686
|
uSize1: {
|
|
@@ -4767,7 +4770,7 @@ class _r {
|
|
|
4767
4770
|
derivatives: !0
|
|
4768
4771
|
}
|
|
4769
4772
|
});
|
|
4770
|
-
this.three = new g.Mesh(a,
|
|
4773
|
+
this.three = new g.Mesh(a, l), this.three.frustumCulled = !1, t.scene.three.add(this.three), this.setupEvents(!0);
|
|
4771
4774
|
}
|
|
4772
4775
|
/** {@link Hideable.visible} */
|
|
4773
4776
|
get visible() {
|
|
@@ -4812,16 +4815,16 @@ class _r {
|
|
|
4812
4815
|
class Nr extends J {
|
|
4813
4816
|
constructor() {
|
|
4814
4817
|
super(...arguments);
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
4819
|
+
I(this, "onDisposed", new U());
|
|
4820
|
+
I(this, "config", {
|
|
4818
4821
|
color: new g.Color(12303291),
|
|
4819
4822
|
size1: 1,
|
|
4820
4823
|
size2: 10,
|
|
4821
4824
|
distance: 500
|
|
4822
4825
|
});
|
|
4823
4826
|
/** {@link Component.enabled} */
|
|
4824
|
-
|
|
4827
|
+
I(this, "enabled", !0);
|
|
4825
4828
|
}
|
|
4826
4829
|
create(t) {
|
|
4827
4830
|
if (this.list.has(t.uuid))
|
|
@@ -4841,12 +4844,12 @@ class Nr extends J {
|
|
|
4841
4844
|
this.list.clear(), this.onDisposed.trigger();
|
|
4842
4845
|
}
|
|
4843
4846
|
}
|
|
4844
|
-
|
|
4847
|
+
I(Nr, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
|
|
4845
4848
|
const qt = new Qn(), nt = new w(), xt = new w(), j = new Pt(), dn = {
|
|
4846
4849
|
X: new w(1, 0, 0),
|
|
4847
4850
|
Y: new w(0, 1, 0),
|
|
4848
4851
|
Z: new w(0, 0, 1)
|
|
4849
|
-
}, ii = { type: "change" },
|
|
4852
|
+
}, ii = { type: "change" }, un = { type: "mouseDown" }, In = { type: "mouseUp", mode: null }, fn = { type: "objectChange" };
|
|
4850
4853
|
class Pr extends oi {
|
|
4851
4854
|
constructor(s, t) {
|
|
4852
4855
|
super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
|
|
@@ -4867,8 +4870,8 @@ class Pr extends oi {
|
|
|
4867
4870
|
}), o[T] = F, i[T] = F, e[T] = F;
|
|
4868
4871
|
}
|
|
4869
4872
|
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);
|
|
4870
|
-
const r = new w(), a = new w(),
|
|
4871
|
-
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion",
|
|
4873
|
+
const r = new w(), a = new w(), l = new Pt(), E = new Pt(), d = new w(), h = new Pt(), u = new w(), p = new w(), A = new w(), R = 0, C = new w();
|
|
4874
|
+
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", l), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), 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 = Lr.bind(this), this._onPointerDown = wr.bind(this), this._onPointerHover = yr.bind(this), this._onPointerMove = Mr.bind(this), this._onPointerUp = Dr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
4872
4875
|
}
|
|
4873
4876
|
// updateMatrixWorld updates key transformation variables
|
|
4874
4877
|
updateMatrixWorld() {
|
|
@@ -4885,7 +4888,7 @@ class Pr extends oi {
|
|
|
4885
4888
|
if (!(this.object === void 0 || this.dragging === !0 || s.button !== 0) && this.axis !== null) {
|
|
4886
4889
|
qt.setFromCamera(s, this.camera);
|
|
4887
4890
|
const t = ni(this._plane, qt, !0);
|
|
4888
|
-
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0,
|
|
4891
|
+
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, un.mode = this.mode, this.dispatchEvent(un);
|
|
4889
4892
|
}
|
|
4890
4893
|
}
|
|
4891
4894
|
pointerMove(s) {
|
|
@@ -4915,7 +4918,7 @@ class Pr extends oi {
|
|
|
4915
4918
|
}
|
|
4916
4919
|
}
|
|
4917
4920
|
pointerUp(s) {
|
|
4918
|
-
s.button === 0 && (this.dragging && this.axis !== null && (
|
|
4921
|
+
s.button === 0 && (this.dragging && this.axis !== null && (In.mode = this.mode, this.dispatchEvent(In)), this.dragging = !1, this.axis = null);
|
|
4919
4922
|
}
|
|
4920
4923
|
dispose() {
|
|
4921
4924
|
this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.traverse(function(s) {
|
|
@@ -4959,48 +4962,48 @@ class Pr extends oi {
|
|
|
4959
4962
|
this.space = s;
|
|
4960
4963
|
}
|
|
4961
4964
|
}
|
|
4962
|
-
function Lr(
|
|
4965
|
+
function Lr(c) {
|
|
4963
4966
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
4964
4967
|
return {
|
|
4965
4968
|
x: 0,
|
|
4966
4969
|
y: 0,
|
|
4967
|
-
button:
|
|
4970
|
+
button: c.button
|
|
4968
4971
|
};
|
|
4969
4972
|
{
|
|
4970
4973
|
const s = this.domElement.getBoundingClientRect();
|
|
4971
4974
|
return {
|
|
4972
|
-
x: (
|
|
4973
|
-
y: -(
|
|
4974
|
-
button:
|
|
4975
|
+
x: (c.clientX - s.left) / s.width * 2 - 1,
|
|
4976
|
+
y: -(c.clientY - s.top) / s.height * 2 + 1,
|
|
4977
|
+
button: c.button
|
|
4975
4978
|
};
|
|
4976
4979
|
}
|
|
4977
4980
|
}
|
|
4978
|
-
function yr(
|
|
4981
|
+
function yr(c) {
|
|
4979
4982
|
if (this.enabled)
|
|
4980
|
-
switch (
|
|
4983
|
+
switch (c.pointerType) {
|
|
4981
4984
|
case "mouse":
|
|
4982
4985
|
case "pen":
|
|
4983
|
-
this.pointerHover(this._getPointer(
|
|
4986
|
+
this.pointerHover(this._getPointer(c));
|
|
4984
4987
|
break;
|
|
4985
4988
|
}
|
|
4986
4989
|
}
|
|
4987
|
-
function wr(
|
|
4988
|
-
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(
|
|
4990
|
+
function wr(c) {
|
|
4991
|
+
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(c.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(c)), this.pointerDown(this._getPointer(c)));
|
|
4989
4992
|
}
|
|
4990
|
-
function Mr(
|
|
4991
|
-
this.enabled && this.pointerMove(this._getPointer(
|
|
4993
|
+
function Mr(c) {
|
|
4994
|
+
this.enabled && this.pointerMove(this._getPointer(c));
|
|
4992
4995
|
}
|
|
4993
|
-
function Dr(
|
|
4994
|
-
this.enabled && (this.domElement.releasePointerCapture(
|
|
4996
|
+
function Dr(c) {
|
|
4997
|
+
this.enabled && (this.domElement.releasePointerCapture(c.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(c)));
|
|
4995
4998
|
}
|
|
4996
|
-
function ni(
|
|
4997
|
-
const e = s.intersectObject(
|
|
4999
|
+
function ni(c, s, t) {
|
|
5000
|
+
const e = s.intersectObject(c, !0);
|
|
4998
5001
|
for (let i = 0; i < e.length; i++)
|
|
4999
5002
|
if (e[i].object.visible || t)
|
|
5000
5003
|
return e[i];
|
|
5001
5004
|
return !1;
|
|
5002
5005
|
}
|
|
5003
|
-
const
|
|
5006
|
+
const Is = new jn(), W = new w(0, 1, 0), pn = new w(0, 0, 0), Cn = new yt(), fs = new Pt(), ms = new Pt(), _t = new w(), Tn = new yt(), Ue = new w(1, 0, 0), $t = new w(0, 1, 0), xe = new w(0, 0, 1), ps = new w(), Me = new w(), De = new w();
|
|
5004
5007
|
class Ur extends oi {
|
|
5005
5008
|
constructor() {
|
|
5006
5009
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
@@ -5028,8 +5031,8 @@ class Ur extends oi {
|
|
|
5028
5031
|
r.color.setHex(255);
|
|
5029
5032
|
const a = s.clone();
|
|
5030
5033
|
a.color.setHex(16711680), a.opacity = 0.5;
|
|
5031
|
-
const
|
|
5032
|
-
|
|
5034
|
+
const l = s.clone();
|
|
5035
|
+
l.color.setHex(65280), l.opacity = 0.5;
|
|
5033
5036
|
const E = s.clone();
|
|
5034
5037
|
E.color.setHex(255), E.opacity = 0.5;
|
|
5035
5038
|
const d = s.clone();
|
|
@@ -5080,7 +5083,7 @@ class Ur extends oi {
|
|
|
5080
5083
|
[new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
5081
5084
|
],
|
|
5082
5085
|
XZ: [
|
|
5083
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5086
|
+
[new v(new rt(0.15, 0.15, 0.01), l.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5084
5087
|
]
|
|
5085
5088
|
}, O = {
|
|
5086
5089
|
X: [
|
|
@@ -5185,7 +5188,7 @@ class Ur extends oi {
|
|
|
5185
5188
|
[new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
5186
5189
|
],
|
|
5187
5190
|
XZ: [
|
|
5188
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5191
|
+
[new v(new rt(0.15, 0.15, 0.01), l), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5189
5192
|
],
|
|
5190
5193
|
XYZ: [
|
|
5191
5194
|
[new v(new rt(0.1, 0.1, 0.1), d.clone())]
|
|
@@ -5250,7 +5253,7 @@ class Ur extends oi {
|
|
|
5250
5253
|
n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
|
|
5251
5254
|
let r;
|
|
5252
5255
|
if (this.camera.isOrthographicCamera ? r = (this.camera.top - this.camera.bottom) / this.camera.zoom : r = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), n.scale.set(1, 1, 1).multiplyScalar(r * this.size / 4), n.tag === "helper") {
|
|
5253
|
-
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(
|
|
5256
|
+
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy($t).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(xe).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(Cn.lookAt(pn, W, $t)), n.quaternion.multiply(j), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), nt.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), nt.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(nt), n.visible = this.dragging) : (n.quaternion.copy(e), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
|
|
5254
5257
|
continue;
|
|
5255
5258
|
}
|
|
5256
5259
|
n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(W.copy($t).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(W.copy(xe).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(W.copy(xe).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(W.copy($t).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(Cn.lookAt(this.eye, pn, $t)), n.name === "X" && (j.setFromAxisAngle(Ue, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle($t, Math.atan2(W.x, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(xe, Math.atan2(W.y, W.x)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(a) {
|
|
@@ -5307,34 +5310,34 @@ class xr extends v {
|
|
|
5307
5310
|
class Ni {
|
|
5308
5311
|
constructor(s, t, e, i, o, n = 5, r = !0) {
|
|
5309
5312
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
5310
|
-
|
|
5313
|
+
I(this, "onDraggingStarted", new U());
|
|
5311
5314
|
/** Event that fires when the user stops dragging a clipping plane. */
|
|
5312
|
-
|
|
5315
|
+
I(this, "onDraggingEnded", new U());
|
|
5313
5316
|
/** {@link Disposable.onDisposed} */
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5317
|
+
I(this, "onDisposed", new U());
|
|
5318
|
+
I(this, "normal");
|
|
5319
|
+
I(this, "origin");
|
|
5320
|
+
I(this, "three", new g.Plane());
|
|
5321
|
+
I(this, "_helper");
|
|
5322
|
+
I(this, "_visible", !0);
|
|
5323
|
+
I(this, "_enabled", !0);
|
|
5324
|
+
I(this, "components");
|
|
5325
|
+
I(this, "world");
|
|
5326
|
+
I(this, "_controlsActive", !1);
|
|
5327
|
+
I(this, "_arrowBoundBox", new g.Mesh());
|
|
5328
|
+
I(this, "_planeMesh");
|
|
5329
|
+
I(this, "_controls");
|
|
5330
|
+
I(this, "_hiddenMaterial", new g.MeshBasicMaterial({
|
|
5328
5331
|
visible: !1
|
|
5329
5332
|
}));
|
|
5330
5333
|
/** {@link Updateable.update} */
|
|
5331
|
-
|
|
5334
|
+
I(this, "update", () => {
|
|
5332
5335
|
this._enabled && this.three.setFromNormalAndCoplanarPoint(
|
|
5333
5336
|
this.normal,
|
|
5334
5337
|
this._helper.position
|
|
5335
5338
|
);
|
|
5336
5339
|
});
|
|
5337
|
-
|
|
5340
|
+
I(this, "changeDrag", (s) => {
|
|
5338
5341
|
this._visible = !s.value, this.preventCameraMovement(), this.notifyDraggingChanged(s);
|
|
5339
5342
|
});
|
|
5340
5343
|
if (this.components = s, this.world = t, !t.renderer)
|
|
@@ -5432,48 +5435,48 @@ const Be = class Be extends J {
|
|
|
5432
5435
|
constructor(t) {
|
|
5433
5436
|
super(t);
|
|
5434
5437
|
/** {@link Createable.onAfterCreate} */
|
|
5435
|
-
|
|
5438
|
+
I(this, "onAfterCreate", new U());
|
|
5436
5439
|
/** {@link Createable.onAfterDelete} */
|
|
5437
|
-
|
|
5440
|
+
I(this, "onAfterDelete", new U());
|
|
5438
5441
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
5439
|
-
|
|
5442
|
+
I(this, "onBeforeDrag", new U());
|
|
5440
5443
|
/** Event that fires when the user stops dragging a clipping plane. */
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5444
|
+
I(this, "onAfterDrag", new U());
|
|
5445
|
+
I(this, "onBeforeCreate", new U());
|
|
5446
|
+
I(this, "onBeforeCancel", new U());
|
|
5447
|
+
I(this, "onAfterCancel", new U());
|
|
5448
|
+
I(this, "onBeforeDelete", new U());
|
|
5446
5449
|
/** {@link Disposable.onDisposed} */
|
|
5447
|
-
|
|
5450
|
+
I(this, "onDisposed", new U());
|
|
5448
5451
|
/**
|
|
5449
5452
|
* Whether to force the clipping plane to be orthogonal in the Y direction
|
|
5450
5453
|
* (up). This is desirable when clipping a building horizontally and a
|
|
5451
5454
|
* clipping plane is created in its roof, which might have a slight
|
|
5452
5455
|
* slope for draining purposes.
|
|
5453
5456
|
*/
|
|
5454
|
-
|
|
5457
|
+
I(this, "orthogonalY", !1);
|
|
5455
5458
|
/**
|
|
5456
5459
|
* The tolerance that determines whether an almost-horizontal clipping plane
|
|
5457
5460
|
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
5458
5461
|
* has to be `true` for this to apply.
|
|
5459
5462
|
*/
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
+
I(this, "toleranceOrthogonalY", 0.7);
|
|
5464
|
+
I(this, "Type", Ni);
|
|
5465
|
+
I(this, "list", []);
|
|
5463
5466
|
/** The material used in all the clipping planes. */
|
|
5464
|
-
|
|
5467
|
+
I(this, "_material", new g.MeshBasicMaterial({
|
|
5465
5468
|
color: 12255487,
|
|
5466
5469
|
side: g.DoubleSide,
|
|
5467
5470
|
transparent: !0,
|
|
5468
5471
|
opacity: 0.2
|
|
5469
5472
|
}));
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5473
|
+
I(this, "_size", 5);
|
|
5474
|
+
I(this, "_enabled", !1);
|
|
5475
|
+
I(this, "_visible", !0);
|
|
5476
|
+
I(this, "_onStartDragging", () => {
|
|
5474
5477
|
this.onBeforeDrag.trigger();
|
|
5475
5478
|
});
|
|
5476
|
-
|
|
5479
|
+
I(this, "_onEndDragging", () => {
|
|
5477
5480
|
this.onAfterDrag.trigger();
|
|
5478
5481
|
});
|
|
5479
5482
|
this.components.add(Be.uuid, this);
|
|
@@ -5598,8 +5601,8 @@ const Be = class Be extends J {
|
|
|
5598
5601
|
const i = t.object;
|
|
5599
5602
|
let o = t.object.matrixWorld.clone();
|
|
5600
5603
|
if (i instanceof g.InstancedMesh && t.instanceId !== void 0) {
|
|
5601
|
-
const
|
|
5602
|
-
i.getMatrixAt(t.instanceId,
|
|
5604
|
+
const l = new g.Matrix4();
|
|
5605
|
+
i.getMatrixAt(t.instanceId, l), o = l.multiply(o);
|
|
5603
5606
|
}
|
|
5604
5607
|
const r = new g.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
|
|
5605
5608
|
return this.normalizePlaneDirectionY(a), a;
|
|
@@ -5633,17 +5636,17 @@ const Be = class Be extends J {
|
|
|
5633
5636
|
}
|
|
5634
5637
|
}
|
|
5635
5638
|
};
|
|
5636
|
-
|
|
5639
|
+
I(Be, "uuid", "66290bc5-18c4-4cd1-9379-2e17a0617611");
|
|
5637
5640
|
let mn = Be;
|
|
5638
|
-
function br(
|
|
5641
|
+
function br(c, s, t, e) {
|
|
5639
5642
|
return new Promise((i, o) => {
|
|
5640
5643
|
function n() {
|
|
5641
|
-
const r =
|
|
5642
|
-
if (r ===
|
|
5644
|
+
const r = c.clientWaitSync(s, t, 0);
|
|
5645
|
+
if (r === c.WAIT_FAILED) {
|
|
5643
5646
|
o();
|
|
5644
5647
|
return;
|
|
5645
5648
|
}
|
|
5646
|
-
if (r ===
|
|
5649
|
+
if (r === c.TIMEOUT_EXPIRED) {
|
|
5647
5650
|
setTimeout(n, e);
|
|
5648
5651
|
return;
|
|
5649
5652
|
}
|
|
@@ -5652,58 +5655,58 @@ function br(l, s, t, e) {
|
|
|
5652
5655
|
n();
|
|
5653
5656
|
});
|
|
5654
5657
|
}
|
|
5655
|
-
async function vr(
|
|
5656
|
-
const r =
|
|
5657
|
-
|
|
5658
|
+
async function vr(c, s, t, e, i, o, n) {
|
|
5659
|
+
const r = c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
5660
|
+
c.flush(), await br(c, r, 0, 10), c.deleteSync(r), c.bindBuffer(s, t), c.getBufferSubData(s, e, i, o, n), c.bindBuffer(s, null);
|
|
5658
5661
|
}
|
|
5659
|
-
async function Br(
|
|
5660
|
-
const a =
|
|
5661
|
-
return
|
|
5662
|
+
async function Br(c, s, t, e, i, o, n, r) {
|
|
5663
|
+
const a = c.createBuffer();
|
|
5664
|
+
return c.bindBuffer(c.PIXEL_PACK_BUFFER, a), c.bufferData(c.PIXEL_PACK_BUFFER, r.byteLength, c.STREAM_READ), c.readPixels(s, t, e, i, o, n, 0), c.bindBuffer(c.PIXEL_PACK_BUFFER, null), await vr(c, c.PIXEL_PACK_BUFFER, a, 0, r), c.deleteBuffer(a), r;
|
|
5662
5665
|
}
|
|
5663
5666
|
class Yr {
|
|
5664
5667
|
constructor(s, t, e) {
|
|
5665
5668
|
/** {@link Disposable.onDisposed} */
|
|
5666
|
-
|
|
5669
|
+
I(this, "onDisposed", new U());
|
|
5667
5670
|
/**
|
|
5668
5671
|
* Fires after making the visibility check to the meshes. It lists the
|
|
5669
5672
|
* meshes that are currently visible, and the ones that were visible
|
|
5670
5673
|
* just before but not anymore.
|
|
5671
5674
|
*/
|
|
5672
|
-
|
|
5675
|
+
I(this, "onViewUpdated", new Kt());
|
|
5673
5676
|
/** {@link Component.enabled} */
|
|
5674
|
-
|
|
5677
|
+
I(this, "enabled", !0);
|
|
5675
5678
|
/**
|
|
5676
5679
|
* Needs to check whether there are objects that need to be hidden or shown.
|
|
5677
5680
|
* You can bind this to the camera movement, to a certain interval, etc.
|
|
5678
5681
|
*/
|
|
5679
|
-
|
|
5682
|
+
I(this, "needsUpdate", !1);
|
|
5680
5683
|
/**
|
|
5681
5684
|
* Render the internal scene used to determine the object visibility. Used
|
|
5682
5685
|
* for debugging purposes.
|
|
5683
5686
|
*/
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5687
|
+
I(this, "renderDebugFrame", !1);
|
|
5688
|
+
I(this, "components");
|
|
5689
|
+
I(this, "world");
|
|
5690
|
+
I(this, "renderer");
|
|
5691
|
+
I(this, "autoUpdate", !0);
|
|
5692
|
+
I(this, "updateInterval", 1e3);
|
|
5693
|
+
I(this, "worker");
|
|
5694
|
+
I(this, "scene", new g.Scene());
|
|
5695
|
+
I(this, "_width", 512);
|
|
5696
|
+
I(this, "_height", 512);
|
|
5697
|
+
I(this, "_availableColor", 1);
|
|
5698
|
+
I(this, "renderTarget");
|
|
5699
|
+
I(this, "bufferSize");
|
|
5700
|
+
I(this, "_buffer");
|
|
5698
5701
|
// Prevents worker being fired multiple times
|
|
5699
|
-
|
|
5702
|
+
I(this, "_isWorkerBusy", !1);
|
|
5700
5703
|
/**
|
|
5701
5704
|
* The function that the culler uses to reprocess the scene. Generally it's
|
|
5702
5705
|
* better to call needsUpdate, but you can also call this to force it.
|
|
5703
5706
|
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
5704
5707
|
* not true.
|
|
5705
5708
|
*/
|
|
5706
|
-
|
|
5709
|
+
I(this, "updateVisibility", async (s) => {
|
|
5707
5710
|
if (!this.enabled || !this.needsUpdate && !s || this._isWorkerBusy)
|
|
5708
5711
|
return;
|
|
5709
5712
|
this._isWorkerBusy = !0;
|
|
@@ -5786,20 +5789,20 @@ class Vr extends Yr {
|
|
|
5786
5789
|
constructor(t, e, i) {
|
|
5787
5790
|
super(t, e, i);
|
|
5788
5791
|
/* Pixels in screen a geometry must occupy to be considered "seen". */
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5792
|
+
I(this, "threshold", 100);
|
|
5793
|
+
I(this, "onViewUpdated", new U());
|
|
5794
|
+
I(this, "colorMeshes", /* @__PURE__ */ new Map());
|
|
5795
|
+
I(this, "isProcessing", !1);
|
|
5796
|
+
I(this, "_colorCodeMeshMap", /* @__PURE__ */ new Map());
|
|
5797
|
+
I(this, "_meshIDColorCodeMap", /* @__PURE__ */ new Map());
|
|
5798
|
+
I(this, "_currentVisibleMeshes", /* @__PURE__ */ new Set());
|
|
5799
|
+
I(this, "_recentlyHiddenMeshes", /* @__PURE__ */ new Set());
|
|
5800
|
+
I(this, "_intervalID", null);
|
|
5801
|
+
I(this, "_transparentMat", new g.MeshBasicMaterial({
|
|
5799
5802
|
transparent: !0,
|
|
5800
5803
|
opacity: 0
|
|
5801
5804
|
}));
|
|
5802
|
-
|
|
5805
|
+
I(this, "handleWorkerMessage", async (t) => {
|
|
5803
5806
|
if (this.isProcessing)
|
|
5804
5807
|
return;
|
|
5805
5808
|
const e = t.data.colors;
|
|
@@ -5846,8 +5849,8 @@ class Vr extends Yr {
|
|
|
5846
5849
|
if (Array.isArray(o)) {
|
|
5847
5850
|
let d = !0;
|
|
5848
5851
|
const h = [];
|
|
5849
|
-
for (const
|
|
5850
|
-
sn.isTransparent(
|
|
5852
|
+
for (const u of o)
|
|
5853
|
+
sn.isTransparent(u) ? h.push(this._transparentMat) : (d = !1, h.push(n));
|
|
5851
5854
|
if (d) {
|
|
5852
5855
|
n.dispose(), this.isProcessing = !1;
|
|
5853
5856
|
return;
|
|
@@ -5859,7 +5862,7 @@ class Vr extends Yr {
|
|
|
5859
5862
|
} else
|
|
5860
5863
|
a = n;
|
|
5861
5864
|
this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
|
|
5862
|
-
const
|
|
5865
|
+
const l = e ? t.count : 1, E = new g.InstancedMesh(i, a, l);
|
|
5863
5866
|
e ? E.instanceMatrix = t.instanceMatrix : E.setMatrixAt(0, new g.Matrix4()), t.visible = !1, E.applyMatrix4(t.matrix), E.updateMatrix(), this.scene.add(E), this.colorMeshes.set(t.uuid, E), this.increaseColor(), this.isProcessing = !1;
|
|
5864
5867
|
}
|
|
5865
5868
|
remove(t) {
|
|
@@ -5883,12 +5886,12 @@ class Vr extends Yr {
|
|
|
5883
5886
|
const r = new g.Color(`rgb(${t}, ${e}, ${i})`);
|
|
5884
5887
|
if (!this.world.renderer)
|
|
5885
5888
|
throw new Error("Renderer not found in the world!");
|
|
5886
|
-
const a = this.world.renderer.clippingPlanes,
|
|
5889
|
+
const a = this.world.renderer.clippingPlanes, l = new g.MeshBasicMaterial({
|
|
5887
5890
|
color: r,
|
|
5888
5891
|
clippingPlanes: a,
|
|
5889
5892
|
side: g.DoubleSide
|
|
5890
5893
|
});
|
|
5891
|
-
return g.ColorManagement.enabled = n, { colorMaterial:
|
|
5894
|
+
return g.ColorManagement.enabled = n, { colorMaterial: l, code: o };
|
|
5892
5895
|
}
|
|
5893
5896
|
}
|
|
5894
5897
|
const Ye = class Ye extends J {
|
|
@@ -5897,15 +5900,15 @@ const Ye = class Ye extends J {
|
|
|
5897
5900
|
/**
|
|
5898
5901
|
* Indicates whether the Cullers component is enabled.
|
|
5899
5902
|
*/
|
|
5900
|
-
|
|
5903
|
+
I(this, "_enabled", !0);
|
|
5901
5904
|
/**
|
|
5902
5905
|
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
5903
5906
|
*/
|
|
5904
|
-
|
|
5907
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
5905
5908
|
/**
|
|
5906
5909
|
* An event that is triggered when the Cullers component is disposed.
|
|
5907
5910
|
*/
|
|
5908
|
-
|
|
5911
|
+
I(this, "onDisposed", new U());
|
|
5909
5912
|
t.add(Ye.uuid, this);
|
|
5910
5913
|
}
|
|
5911
5914
|
/**
|
|
@@ -5957,31 +5960,31 @@ const Ye = class Ye extends J {
|
|
|
5957
5960
|
/**
|
|
5958
5961
|
* A unique identifier for the Cullers component.
|
|
5959
5962
|
*/
|
|
5960
|
-
|
|
5963
|
+
I(Ye, "uuid", "69f2a50d-c266-44fc-b1bd-fa4d34be89e6");
|
|
5961
5964
|
let Ci = Ye;
|
|
5962
5965
|
class Gr {
|
|
5963
5966
|
constructor(s) {
|
|
5964
5967
|
/** {@link Disposable.onDisposed} */
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5968
|
+
I(this, "onDisposed", new U());
|
|
5969
|
+
I(this, "onAfterUpdate", new U());
|
|
5970
|
+
I(this, "onBeforeUpdate", new U());
|
|
5971
|
+
I(this, "onResize", new U());
|
|
5969
5972
|
// By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5973
|
+
I(this, "frontOffset", 0);
|
|
5974
|
+
I(this, "overrideMaterial", new g.MeshDepthMaterial());
|
|
5975
|
+
I(this, "backgroundColor", new g.Color(395274));
|
|
5976
|
+
I(this, "renderer");
|
|
5977
|
+
I(this, "enabled", !0);
|
|
5978
|
+
I(this, "world");
|
|
5979
|
+
I(this, "_lockRotation", !0);
|
|
5980
|
+
I(this, "_camera");
|
|
5981
|
+
I(this, "_plane");
|
|
5982
|
+
I(this, "_size", new g.Vector2(320, 160));
|
|
5983
|
+
I(this, "_tempVector1", new g.Vector3());
|
|
5984
|
+
I(this, "_tempVector2", new g.Vector3());
|
|
5985
|
+
I(this, "_tempTarget", new g.Vector3());
|
|
5986
|
+
I(this, "down", new g.Vector3(0, -1, 0));
|
|
5987
|
+
I(this, "updatePlanes", () => {
|
|
5985
5988
|
if (!this.world.renderer)
|
|
5986
5989
|
throw new Error("The given world must have a renderer!");
|
|
5987
5990
|
const s = [], t = this.world.renderer.three;
|
|
@@ -6054,11 +6057,11 @@ class Gr {
|
|
|
6054
6057
|
const Ss = class Ss extends J {
|
|
6055
6058
|
constructor(t) {
|
|
6056
6059
|
super(t);
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6060
|
+
I(this, "onAfterUpdate", new U());
|
|
6061
|
+
I(this, "onBeforeUpdate", new U());
|
|
6062
|
+
I(this, "onDisposed", new U());
|
|
6063
|
+
I(this, "enabled", !0);
|
|
6064
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
6062
6065
|
this.components.add(Ss.uuid, this);
|
|
6063
6066
|
}
|
|
6064
6067
|
create(t) {
|
|
@@ -6081,14 +6084,14 @@ const Ss = class Ss extends J {
|
|
|
6081
6084
|
e.update();
|
|
6082
6085
|
}
|
|
6083
6086
|
};
|
|
6084
|
-
|
|
6087
|
+
I(Ss, "uuid", "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");
|
|
6085
6088
|
let Rn = Ss;
|
|
6086
6089
|
class zr {
|
|
6087
6090
|
constructor(s) {
|
|
6088
6091
|
/** {@link NavigationMode.enabled} */
|
|
6089
|
-
|
|
6092
|
+
I(this, "enabled", !1);
|
|
6090
6093
|
/** {@link NavigationMode.id} */
|
|
6091
|
-
|
|
6094
|
+
I(this, "id", "FirstPerson");
|
|
6092
6095
|
this.camera = s;
|
|
6093
6096
|
}
|
|
6094
6097
|
/** {@link NavigationMode.set} */
|
|
@@ -6113,9 +6116,9 @@ class zr {
|
|
|
6113
6116
|
class Hr {
|
|
6114
6117
|
constructor(s) {
|
|
6115
6118
|
/** {@link NavigationMode.enabled} */
|
|
6116
|
-
|
|
6119
|
+
I(this, "enabled", !0);
|
|
6117
6120
|
/** {@link NavigationMode.id} */
|
|
6118
|
-
|
|
6121
|
+
I(this, "id", "Orbit");
|
|
6119
6122
|
this.camera = s, this.activateOrbitControls();
|
|
6120
6123
|
}
|
|
6121
6124
|
/** {@link NavigationMode.set} */
|
|
@@ -6136,14 +6139,14 @@ class Hr {
|
|
|
6136
6139
|
class kr {
|
|
6137
6140
|
constructor(s) {
|
|
6138
6141
|
/** {@link NavigationMode.enabled} */
|
|
6139
|
-
|
|
6142
|
+
I(this, "enabled", !1);
|
|
6140
6143
|
/** {@link NavigationMode.id} */
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6144
|
+
I(this, "id", "Plan");
|
|
6145
|
+
I(this, "mouseAction1");
|
|
6146
|
+
I(this, "mouseAction2");
|
|
6147
|
+
I(this, "mouseInitialized", !1);
|
|
6148
|
+
I(this, "defaultAzimuthSpeed");
|
|
6149
|
+
I(this, "defaultPolarSpeed");
|
|
6147
6150
|
this.camera = s, this.defaultAzimuthSpeed = s.controls.azimuthRotateSpeed, this.defaultPolarSpeed = s.controls.polarRotateSpeed;
|
|
6148
6151
|
}
|
|
6149
6152
|
/** {@link NavigationMode.set} */
|
|
@@ -6158,13 +6161,13 @@ class Wr {
|
|
|
6158
6161
|
/**
|
|
6159
6162
|
* Event that fires when the {@link CameraProjection} changes.
|
|
6160
6163
|
*/
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6164
|
+
I(this, "onChanged", new U());
|
|
6165
|
+
I(this, "current", "Perspective");
|
|
6166
|
+
I(this, "camera");
|
|
6167
|
+
I(this, "_component");
|
|
6168
|
+
I(this, "_previousDistance", -1);
|
|
6166
6169
|
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
6167
|
-
|
|
6170
|
+
I(this, "matchOrthoDistanceEnabled", !1);
|
|
6168
6171
|
this._component = s, this.camera = s.three;
|
|
6169
6172
|
}
|
|
6170
6173
|
/**
|
|
@@ -6202,8 +6205,8 @@ class Wr {
|
|
|
6202
6205
|
this._component.threePersp.getWorldDirection(t);
|
|
6203
6206
|
const e = new g.Vector3();
|
|
6204
6207
|
this._component.controls.getTarget(e);
|
|
6205
|
-
const o = e.clone().sub(this._component.threePersp.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.threePersp,
|
|
6206
|
-
return { width:
|
|
6208
|
+
const o = e.clone().sub(this._component.threePersp.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.threePersp, l = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
|
|
6209
|
+
return { width: l * r, height: l };
|
|
6207
6210
|
}
|
|
6208
6211
|
setupOrthoCamera(s, t) {
|
|
6209
6212
|
this._component.controls.mouseButtons.wheel = ot.ACTION.ZOOM, this._component.controls.mouseButtons.middle = ot.ACTION.ZOOM;
|
|
@@ -6226,15 +6229,15 @@ class na extends ke {
|
|
|
6226
6229
|
/**
|
|
6227
6230
|
* The current {@link NavigationMode}.
|
|
6228
6231
|
*/
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6232
|
+
I(this, "_mode", null);
|
|
6233
|
+
I(this, "projection");
|
|
6234
|
+
I(this, "threeOrtho");
|
|
6235
|
+
I(this, "threePersp");
|
|
6236
|
+
I(this, "_userInputButtons", {});
|
|
6237
|
+
I(this, "_frustumSize", 50);
|
|
6238
|
+
I(this, "_navigationModes", /* @__PURE__ */ new Map());
|
|
6236
6239
|
this.threePersp = this.three, this.threeOrtho = this.newOrthoCamera(), this.projection = new Wr(this), this.onAspectUpdated.add(() => {
|
|
6237
|
-
this.
|
|
6240
|
+
this.setOrthoPerspCameraAspect();
|
|
6238
6241
|
}), this.projection.onChanged.add(
|
|
6239
6242
|
(e) => {
|
|
6240
6243
|
this.three = e;
|
|
@@ -6275,15 +6278,15 @@ class na extends ke {
|
|
|
6275
6278
|
if (!this.enabled)
|
|
6276
6279
|
return;
|
|
6277
6280
|
const i = Number.MAX_VALUE, o = Number.MIN_VALUE, n = new g.Vector3(i, i, i), r = new g.Vector3(o, o, o);
|
|
6278
|
-
for (const
|
|
6279
|
-
const p = new g.Box3().setFromObject(
|
|
6281
|
+
for (const u of t) {
|
|
6282
|
+
const p = new g.Box3().setFromObject(u);
|
|
6280
6283
|
p.min.x < n.x && (n.x = p.min.x), p.min.y < n.y && (n.y = p.min.y), p.min.z < n.z && (n.z = p.min.z), p.max.x > r.x && (r.x = p.max.x), p.max.y > r.y && (r.y = p.max.y), p.max.z > r.z && (r.z = p.max.z);
|
|
6281
6284
|
}
|
|
6282
|
-
const a = new g.Box3(n, r),
|
|
6283
|
-
a.getSize(
|
|
6285
|
+
const a = new g.Box3(n, r), l = new g.Vector3();
|
|
6286
|
+
a.getSize(l);
|
|
6284
6287
|
const E = new g.Vector3();
|
|
6285
6288
|
a.getCenter(E);
|
|
6286
|
-
const d = Math.max(
|
|
6289
|
+
const d = Math.max(l.x, l.y, l.z) * e, h = new g.Sphere(E, d);
|
|
6287
6290
|
await this.controls.fitToSphere(h, !0);
|
|
6288
6291
|
}
|
|
6289
6292
|
/**
|
|
@@ -6311,27 +6314,29 @@ class na extends ke {
|
|
|
6311
6314
|
1e3
|
|
6312
6315
|
);
|
|
6313
6316
|
}
|
|
6314
|
-
|
|
6317
|
+
setOrthoPerspCameraAspect() {
|
|
6315
6318
|
if (!this.currentWorld || !this.currentWorld.renderer)
|
|
6316
6319
|
return;
|
|
6317
|
-
const t =
|
|
6318
|
-
this.threePersp.
|
|
6320
|
+
const t = this.currentWorld.renderer.getSize();
|
|
6321
|
+
this.threePersp.aspect = t.width / t.height, this.threePersp.updateProjectionMatrix();
|
|
6319
6322
|
const e = new g.Vector3();
|
|
6320
|
-
this.
|
|
6321
|
-
const
|
|
6322
|
-
this.
|
|
6323
|
+
this.threePersp.getWorldDirection(e);
|
|
6324
|
+
const i = new g.Vector3();
|
|
6325
|
+
this.controls.getTarget(i);
|
|
6326
|
+
const n = i.clone().sub(this.threePersp.position).dot(e), r = this.currentWorld.renderer.getSize(), a = r.x / r.y, l = this.threePersp, E = n * 2 * Math.atan(l.fov * (Math.PI / 180) / 2), d = E * a;
|
|
6327
|
+
this.threeOrtho.zoom = 1, this.threeOrtho.left = d / -2, this.threeOrtho.right = d / 2, this.threeOrtho.top = E / 2, this.threeOrtho.bottom = E / -2, this.threeOrtho.updateProjectionMatrix();
|
|
6323
6328
|
}
|
|
6324
6329
|
}
|
|
6325
6330
|
const At = class At extends J {
|
|
6326
6331
|
constructor(t) {
|
|
6327
6332
|
super(t);
|
|
6328
6333
|
/** {@link Component.enabled} */
|
|
6329
|
-
|
|
6334
|
+
I(this, "enabled", !0);
|
|
6330
6335
|
/** {@link Disposable.onDisposed} */
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6336
|
+
I(this, "onDisposed", new U());
|
|
6337
|
+
I(this, "_absoluteMin");
|
|
6338
|
+
I(this, "_absoluteMax");
|
|
6339
|
+
I(this, "_meshes", []);
|
|
6335
6340
|
this.components.add(At.uuid, this), this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
|
|
6336
6341
|
}
|
|
6337
6342
|
static getDimensions(t) {
|
|
@@ -6368,8 +6373,8 @@ const At = class At extends J {
|
|
|
6368
6373
|
return new g.Sphere(r, a);
|
|
6369
6374
|
}
|
|
6370
6375
|
getMesh() {
|
|
6371
|
-
const t = new g.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new g.BoxGeometry(i, o, n),
|
|
6372
|
-
return this._meshes.push(
|
|
6376
|
+
const t = new g.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new g.BoxGeometry(i, o, n), l = new g.Mesh(a);
|
|
6377
|
+
return this._meshes.push(l), l.position.copy(r), l;
|
|
6373
6378
|
}
|
|
6374
6379
|
reset() {
|
|
6375
6380
|
this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
|
|
@@ -6385,17 +6390,17 @@ const At = class At extends J {
|
|
|
6385
6390
|
t.updateMatrixWorld();
|
|
6386
6391
|
const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
|
|
6387
6392
|
if (e && t instanceof Vt.FragmentMesh)
|
|
6388
|
-
for (const
|
|
6389
|
-
const E = t.fragment.getInstancesIDs(
|
|
6393
|
+
for (const l of e) {
|
|
6394
|
+
const E = t.fragment.getInstancesIDs(l);
|
|
6390
6395
|
if (E)
|
|
6391
6396
|
for (const d of E)
|
|
6392
6397
|
a.add(d);
|
|
6393
6398
|
}
|
|
6394
6399
|
else
|
|
6395
6400
|
a.add(0);
|
|
6396
|
-
for (const
|
|
6401
|
+
for (const l of a) {
|
|
6397
6402
|
const E = i.min.clone(), d = i.max.clone();
|
|
6398
|
-
r && (t.getMatrixAt(
|
|
6403
|
+
r && (t.getMatrixAt(l, n), E.applyMatrix4(n), d.applyMatrix4(n)), E.applyMatrix4(o), d.applyMatrix4(o), E.x < this._absoluteMin.x && (this._absoluteMin.x = E.x), E.y < this._absoluteMin.y && (this._absoluteMin.y = E.y), E.z < this._absoluteMin.z && (this._absoluteMin.z = E.z), E.x > this._absoluteMax.x && (this._absoluteMax.x = E.x), E.y > this._absoluteMax.y && (this._absoluteMax.y = E.y), E.z > this._absoluteMax.z && (this._absoluteMax.z = E.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);
|
|
6399
6404
|
}
|
|
6400
6405
|
}
|
|
6401
6406
|
static getFragmentBounds(t) {
|
|
@@ -6403,18 +6408,18 @@ const At = class At extends J {
|
|
|
6403
6408
|
if (!t.geometry.index)
|
|
6404
6409
|
throw new Error("Geometry must be indexed!");
|
|
6405
6410
|
const a = Array.from(t.geometry.index.array);
|
|
6406
|
-
for (let
|
|
6407
|
-
if (
|
|
6408
|
-
|
|
6411
|
+
for (let l = 0; l < a.length; l++) {
|
|
6412
|
+
if (l % 3 === 0 && a[l] === 0 && a[l + 1] === 0 && a[l + 2] === 0) {
|
|
6413
|
+
l += 2;
|
|
6409
6414
|
continue;
|
|
6410
6415
|
}
|
|
6411
|
-
const E = a[
|
|
6412
|
-
d < n.x && (n.x = d), h < n.y && (n.y = h),
|
|
6416
|
+
const E = a[l], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
|
|
6417
|
+
d < n.x && (n.x = d), h < n.y && (n.y = h), u < n.z && (n.z = u), d > r.x && (r.x = d), h > r.y && (r.y = h), u > r.z && (r.z = u);
|
|
6413
6418
|
}
|
|
6414
6419
|
return new g.Box3(n, r);
|
|
6415
6420
|
}
|
|
6416
6421
|
};
|
|
6417
|
-
|
|
6422
|
+
I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
|
|
6418
6423
|
let An = At;
|
|
6419
6424
|
const Pi = /* @__PURE__ */ new Set([
|
|
6420
6425
|
1123145078,
|
|
@@ -6554,7 +6559,7 @@ const Pi = /* @__PURE__ */ new Set([
|
|
|
6554
6559
|
constructor(t) {
|
|
6555
6560
|
super(t);
|
|
6556
6561
|
/** {@link Component.enabled} */
|
|
6557
|
-
|
|
6562
|
+
I(this, "enabled", !0);
|
|
6558
6563
|
t.add(_s.uuid, this);
|
|
6559
6564
|
}
|
|
6560
6565
|
/**
|
|
@@ -6573,36 +6578,36 @@ const Pi = /* @__PURE__ */ new Set([
|
|
|
6573
6578
|
D.IFCBUILDINGSTOREY,
|
|
6574
6579
|
D.IFCSPACE
|
|
6575
6580
|
]);
|
|
6576
|
-
for (const
|
|
6577
|
-
r.add(
|
|
6578
|
-
for (const
|
|
6579
|
-
if (Pi.has(
|
|
6581
|
+
for (const l of a)
|
|
6582
|
+
r.add(l);
|
|
6583
|
+
for (const l of r) {
|
|
6584
|
+
if (Pi.has(l))
|
|
6580
6585
|
continue;
|
|
6581
|
-
const E = a.has(
|
|
6586
|
+
const E = a.has(l) && o, d = t.GetLineIDsWithType(e, l);
|
|
6582
6587
|
for (const h of d) {
|
|
6583
|
-
const
|
|
6584
|
-
n[
|
|
6588
|
+
const u = t.GetLine(0, h, E, i);
|
|
6589
|
+
n[u.expressID] = u;
|
|
6585
6590
|
}
|
|
6586
6591
|
}
|
|
6587
6592
|
return n;
|
|
6588
6593
|
}
|
|
6589
6594
|
};
|
|
6590
|
-
|
|
6595
|
+
I(_s, "uuid", "b32c4332-cd67-436e-ba7f-196646c7a635");
|
|
6591
6596
|
let Ti = _s;
|
|
6592
6597
|
const Ns = class Ns extends J {
|
|
6593
6598
|
constructor(t) {
|
|
6594
6599
|
super(t);
|
|
6595
6600
|
/** {@link Disposable.onDisposed} */
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6601
|
+
I(this, "onDisposed", new U());
|
|
6602
|
+
I(this, "onFragmentsLoaded", new U());
|
|
6603
|
+
I(this, "onFragmentsDisposed", new U());
|
|
6599
6604
|
/** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
|
|
6600
|
-
|
|
6601
|
-
|
|
6605
|
+
I(this, "list", /* @__PURE__ */ new Map());
|
|
6606
|
+
I(this, "groups", /* @__PURE__ */ new Map());
|
|
6602
6607
|
/** {@link Component.enabled} */
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6608
|
+
I(this, "enabled", !0);
|
|
6609
|
+
I(this, "baseCoordinationModel", "");
|
|
6610
|
+
I(this, "_loader", new Jn());
|
|
6606
6611
|
this.components.add(Ns.uuid, this);
|
|
6607
6612
|
}
|
|
6608
6613
|
/** The list of meshes of the created fragments. */
|
|
@@ -6636,10 +6641,10 @@ const Ns = class Ns extends J {
|
|
|
6636
6641
|
* @returns The loaded FragmentsGroup.
|
|
6637
6642
|
*/
|
|
6638
6643
|
load(t, e) {
|
|
6639
|
-
const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n, properties: r, relationsMap: a } = o,
|
|
6640
|
-
for (const E of
|
|
6641
|
-
E.group =
|
|
6642
|
-
return n && this.coordinate([
|
|
6644
|
+
const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n, properties: r, relationsMap: a } = o, l = this._loader.import(t);
|
|
6645
|
+
for (const E of l.items)
|
|
6646
|
+
E.group = l, this.list.set(E.id, E);
|
|
6647
|
+
return n && this.coordinate([l]), this.groups.set(l.uuid, l), r && l.setLocalProperties(r), a && this.components.get(As).setRelationMap(l, a), this.onFragmentsLoaded.trigger(l), l;
|
|
6643
6648
|
}
|
|
6644
6649
|
/**
|
|
6645
6650
|
* Export the specified fragments.
|
|
@@ -6667,8 +6672,8 @@ const Ns = class Ns extends J {
|
|
|
6667
6672
|
o !== i && (o.position.set(0, 0, 0), o.rotation.set(0, 0, 0), o.scale.set(1, 1, 1), o.updateMatrix(), o.applyMatrix4(o.coordinationMatrix.clone().invert()), o.applyMatrix4(i.coordinationMatrix));
|
|
6668
6673
|
}
|
|
6669
6674
|
};
|
|
6670
|
-
|
|
6671
|
-
let
|
|
6675
|
+
I(Ns, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
|
|
6676
|
+
let ut = Ns;
|
|
6672
6677
|
const Xr = {
|
|
6673
6678
|
103090709: "IFCPROJECT",
|
|
6674
6679
|
4097777520: "IFCSITE",
|
|
@@ -6813,8 +6818,8 @@ class oa {
|
|
|
6813
6818
|
const e = {}, i = Object.keys(Xr).map((o) => parseInt(o, 10));
|
|
6814
6819
|
for (let o = 0; o < i.length; o++) {
|
|
6815
6820
|
const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
|
|
6816
|
-
for (let
|
|
6817
|
-
e[r.get(
|
|
6821
|
+
for (let l = 0; l < a; l++)
|
|
6822
|
+
e[r.get(l)] = n;
|
|
6818
6823
|
}
|
|
6819
6824
|
return e;
|
|
6820
6825
|
}
|
|
@@ -7993,18 +7998,18 @@ class Gt {
|
|
|
7993
7998
|
var a;
|
|
7994
7999
|
const o = e ?? (() => {
|
|
7995
8000
|
}), n = {}, r = s.getAllPropertiesIDs();
|
|
7996
|
-
for (const
|
|
7997
|
-
const E = await s.getProperties(
|
|
8001
|
+
for (const l of r) {
|
|
8002
|
+
const E = await s.getProperties(l);
|
|
7998
8003
|
if (!E)
|
|
7999
8004
|
continue;
|
|
8000
8005
|
const d = E.type === t, h = Object.keys(E).find(
|
|
8001
8006
|
(C) => C.startsWith("Relating")
|
|
8002
|
-
),
|
|
8007
|
+
), u = Object.keys(E).find(
|
|
8003
8008
|
(C) => C.startsWith("Related")
|
|
8004
8009
|
);
|
|
8005
|
-
if (!(d && h &&
|
|
8010
|
+
if (!(d && h && u))
|
|
8006
8011
|
continue;
|
|
8007
|
-
const p = await s.getProperties((a = E[h]) == null ? void 0 : a.value), A = E[
|
|
8012
|
+
const p = await s.getProperties((a = E[h]) == null ? void 0 : a.value), A = E[u];
|
|
8008
8013
|
if (!p || !A || !(A && Array.isArray(A)))
|
|
8009
8014
|
continue;
|
|
8010
8015
|
const R = A.map((C) => C.value);
|
|
@@ -8015,12 +8020,12 @@ class Gt {
|
|
|
8015
8020
|
static async getQsetQuantities(s, t, e) {
|
|
8016
8021
|
const o = e ?? (() => {
|
|
8017
8022
|
}), n = await s.getProperties(t);
|
|
8018
|
-
return !n || n.type !== D.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((
|
|
8023
|
+
return !n || n.type !== D.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
|
|
8019
8024
|
}
|
|
8020
8025
|
static async getPsetProps(s, t, e) {
|
|
8021
8026
|
const o = e ?? (() => {
|
|
8022
8027
|
}), n = await s.getProperties(t);
|
|
8023
|
-
return !n || n.type !== D.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((
|
|
8028
|
+
return !n || n.type !== D.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
|
|
8024
8029
|
}
|
|
8025
8030
|
static async getPsetRel(s, t) {
|
|
8026
8031
|
var r;
|
|
@@ -8157,11 +8162,11 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8157
8162
|
constructor(t) {
|
|
8158
8163
|
super(t);
|
|
8159
8164
|
/** {@link Disposable.onDisposed} */
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
+
I(this, "onDisposed", new U());
|
|
8166
|
+
I(this, "enabled", !0);
|
|
8167
|
+
I(this, "onRelationsIndexed", new U());
|
|
8168
|
+
I(this, "_relToAttributesMap", Zr);
|
|
8169
|
+
I(this, "_inverseAttributes", [
|
|
8165
8170
|
"IsDecomposedBy",
|
|
8166
8171
|
"Decomposes",
|
|
8167
8172
|
"AssociatedTo",
|
|
@@ -8177,7 +8182,7 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8177
8182
|
"ContainedInStructure",
|
|
8178
8183
|
"ContainsElements"
|
|
8179
8184
|
]);
|
|
8180
|
-
|
|
8185
|
+
I(this, "_ifcRels", [
|
|
8181
8186
|
D.IFCRELAGGREGATES,
|
|
8182
8187
|
D.IFCRELASSOCIATESMATERIAL,
|
|
8183
8188
|
D.IFCRELASSOCIATESCLASSIFICATION,
|
|
@@ -8195,11 +8200,11 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8195
8200
|
* that are related through that relation type. This structure allows for efficient querying
|
|
8196
8201
|
* of entity relationships within a model.
|
|
8197
8202
|
*/
|
|
8198
|
-
|
|
8199
|
-
|
|
8203
|
+
I(this, "relationMaps", {});
|
|
8204
|
+
I(this, "onFragmentsDisposed", (t) => {
|
|
8200
8205
|
delete this.relationMaps[t.groupID];
|
|
8201
8206
|
});
|
|
8202
|
-
this.components.add(Ve.uuid, this), t.get(
|
|
8207
|
+
this.components.add(Ve.uuid, this), t.get(ut).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
8203
8208
|
}
|
|
8204
8209
|
/**
|
|
8205
8210
|
* Adds a relation map to the model's relations map.
|
|
@@ -8246,11 +8251,11 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8246
8251
|
const r = this._relToAttributesMap.get(i);
|
|
8247
8252
|
if (!r)
|
|
8248
8253
|
return;
|
|
8249
|
-
const { forRelated: a, forRelating:
|
|
8254
|
+
const { forRelated: a, forRelating: l } = r, E = e.get(o) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(l);
|
|
8250
8255
|
E.set(d, n), e.set(o, E);
|
|
8251
8256
|
for (const h of n) {
|
|
8252
|
-
const
|
|
8253
|
-
A.push(o),
|
|
8257
|
+
const u = e.get(h) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(a), A = u.get(p) ?? [];
|
|
8258
|
+
A.push(o), u.set(p, A), e.set(h, u);
|
|
8254
8259
|
}
|
|
8255
8260
|
}
|
|
8256
8261
|
);
|
|
@@ -8270,19 +8275,19 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8270
8275
|
const n = this._relToAttributesMap.get(o);
|
|
8271
8276
|
if (!n)
|
|
8272
8277
|
continue;
|
|
8273
|
-
const { forRelated: r, forRelating: a } = n,
|
|
8274
|
-
for (let E = 0; E <
|
|
8278
|
+
const { forRelated: r, forRelating: a } = n, l = t.GetLineIDsWithType(e, o);
|
|
8279
|
+
for (let E = 0; E < l.size(); E++) {
|
|
8275
8280
|
const d = await t.properties.getItemProperties(
|
|
8276
8281
|
e,
|
|
8277
|
-
|
|
8282
|
+
l.get(E)
|
|
8278
8283
|
), h = Object.keys(d).find(
|
|
8279
8284
|
(T) => T.startsWith("Relating")
|
|
8280
|
-
),
|
|
8285
|
+
), u = Object.keys(d).find(
|
|
8281
8286
|
(T) => T.startsWith("Related")
|
|
8282
8287
|
);
|
|
8283
|
-
if (!(h &&
|
|
8288
|
+
if (!(h && u))
|
|
8284
8289
|
continue;
|
|
8285
|
-
const p = d[h].value, A = d[
|
|
8290
|
+
const p = d[h].value, A = d[u].map((T) => T.value), R = i.get(p) ?? /* @__PURE__ */ new Map(), C = this._inverseAttributes.indexOf(a);
|
|
8286
8291
|
R.set(C, A), i.set(p, R);
|
|
8287
8292
|
for (const T of A) {
|
|
8288
8293
|
const F = i.get(T) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(r), m = F.get(f) ?? [];
|
|
@@ -8365,8 +8370,8 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8365
8370
|
const i = this.relationMaps[e], o = {};
|
|
8366
8371
|
for (const [n, r] of i.entries()) {
|
|
8367
8372
|
o[n] || (o[n] = {});
|
|
8368
|
-
for (const [a,
|
|
8369
|
-
o[n][a] =
|
|
8373
|
+
for (const [a, l] of r.entries())
|
|
8374
|
+
o[n][a] = l;
|
|
8370
8375
|
}
|
|
8371
8376
|
t[e] = o;
|
|
8372
8377
|
}
|
|
@@ -8400,15 +8405,15 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8400
8405
|
* references that could prevent garbage collection.
|
|
8401
8406
|
*/
|
|
8402
8407
|
dispose() {
|
|
8403
|
-
this.relationMaps = {}, this.components.get(
|
|
8408
|
+
this.relationMaps = {}, this.components.get(ut).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
|
|
8404
8409
|
}
|
|
8405
8410
|
};
|
|
8406
|
-
|
|
8411
|
+
I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
|
|
8407
8412
|
let As = Ve;
|
|
8408
8413
|
class Qr {
|
|
8409
8414
|
constructor() {
|
|
8410
|
-
|
|
8411
|
-
|
|
8415
|
+
I(this, "factor", 1);
|
|
8416
|
+
I(this, "complement", 1);
|
|
8412
8417
|
}
|
|
8413
8418
|
apply(s) {
|
|
8414
8419
|
const e = this.getScaleMatrix().multiply(s);
|
|
@@ -8465,8 +8470,8 @@ class Qr {
|
|
|
8465
8470
|
}
|
|
8466
8471
|
class vn {
|
|
8467
8472
|
constructor() {
|
|
8468
|
-
|
|
8469
|
-
|
|
8473
|
+
I(this, "itemsByFloor", {});
|
|
8474
|
+
I(this, "_units", new Qr());
|
|
8470
8475
|
}
|
|
8471
8476
|
// TODO: Maybe make this more flexible so that it also support more exotic spatial structures?
|
|
8472
8477
|
setUp(s) {
|
|
@@ -8476,51 +8481,51 @@ class vn {
|
|
|
8476
8481
|
0,
|
|
8477
8482
|
D.IFCRELCONTAINEDINSPATIALSTRUCTURE
|
|
8478
8483
|
), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, D.IFCSPACE);
|
|
8479
|
-
for (let
|
|
8480
|
-
e.add(i.get(
|
|
8484
|
+
for (let l = 0; l < i.size(); l++)
|
|
8485
|
+
e.add(i.get(l));
|
|
8481
8486
|
const o = s.GetLineIDsWithType(0, D.IFCRELAGGREGATES), n = o.size();
|
|
8482
|
-
for (let
|
|
8483
|
-
const E = o.get(
|
|
8487
|
+
for (let l = 0; l < n; l++) {
|
|
8488
|
+
const E = o.get(l), d = s.GetLine(0, E);
|
|
8484
8489
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8485
8490
|
continue;
|
|
8486
|
-
const h = d.RelatingObject.value,
|
|
8487
|
-
for (const p of
|
|
8491
|
+
const h = d.RelatingObject.value, u = d.RelatedObjects;
|
|
8492
|
+
for (const p of u) {
|
|
8488
8493
|
const A = p.value;
|
|
8489
8494
|
e.has(A) && (this.itemsByFloor[A] = h);
|
|
8490
8495
|
}
|
|
8491
8496
|
}
|
|
8492
8497
|
const r = {}, a = t.size();
|
|
8493
|
-
for (let
|
|
8494
|
-
const E = t.get(
|
|
8498
|
+
for (let l = 0; l < a; l++) {
|
|
8499
|
+
const E = t.get(l), d = s.GetLine(0, E);
|
|
8495
8500
|
if (!d || !d.RelatingStructure || !d.RelatedElements)
|
|
8496
8501
|
continue;
|
|
8497
|
-
const h = d.RelatingStructure.value,
|
|
8502
|
+
const h = d.RelatingStructure.value, u = d.RelatedElements;
|
|
8498
8503
|
if (e.has(h))
|
|
8499
|
-
for (const p of
|
|
8504
|
+
for (const p of u) {
|
|
8500
8505
|
r[h] || (r[h] = []);
|
|
8501
8506
|
const A = p.value;
|
|
8502
8507
|
r[h].push(A);
|
|
8503
8508
|
}
|
|
8504
8509
|
else
|
|
8505
|
-
for (const p of
|
|
8510
|
+
for (const p of u) {
|
|
8506
8511
|
const A = p.value;
|
|
8507
8512
|
this.itemsByFloor[A] = h;
|
|
8508
8513
|
}
|
|
8509
8514
|
}
|
|
8510
|
-
for (const
|
|
8511
|
-
const E = this.itemsByFloor[
|
|
8515
|
+
for (const l in r) {
|
|
8516
|
+
const E = this.itemsByFloor[l];
|
|
8512
8517
|
if (E !== void 0) {
|
|
8513
|
-
const d = r[
|
|
8518
|
+
const d = r[l];
|
|
8514
8519
|
for (const h of d)
|
|
8515
8520
|
this.itemsByFloor[h] = E;
|
|
8516
8521
|
}
|
|
8517
8522
|
}
|
|
8518
|
-
for (let
|
|
8519
|
-
const E = o.get(
|
|
8523
|
+
for (let l = 0; l < n; l++) {
|
|
8524
|
+
const E = o.get(l), d = s.GetLine(0, E);
|
|
8520
8525
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8521
8526
|
continue;
|
|
8522
|
-
const h = d.RelatingObject.value,
|
|
8523
|
-
for (const p of
|
|
8527
|
+
const h = d.RelatingObject.value, u = d.RelatedObjects;
|
|
8528
|
+
for (const p of u) {
|
|
8524
8529
|
const A = p.value, R = this.itemsByFloor[h];
|
|
8525
8530
|
R !== void 0 && (this.itemsByFloor[A] = R);
|
|
8526
8531
|
}
|
|
@@ -8536,36 +8541,36 @@ class vn {
|
|
|
8536
8541
|
class Li {
|
|
8537
8542
|
constructor() {
|
|
8538
8543
|
/** Whether to extract the IFC properties into a JSON. */
|
|
8539
|
-
|
|
8544
|
+
I(this, "includeProperties", !0);
|
|
8540
8545
|
/**
|
|
8541
8546
|
* Generate the geometry for categories that are not included by default,
|
|
8542
8547
|
* like IFCSPACE.
|
|
8543
8548
|
*/
|
|
8544
|
-
|
|
8549
|
+
I(this, "optionalCategories", [D.IFCSPACE]);
|
|
8545
8550
|
/** Whether to use the coordination data coming from the IFC files. */
|
|
8546
|
-
|
|
8551
|
+
I(this, "coordinate", !0);
|
|
8547
8552
|
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
8548
|
-
|
|
8553
|
+
I(this, "wasm", {
|
|
8549
8554
|
path: "",
|
|
8550
8555
|
absolute: !1,
|
|
8551
8556
|
logLevel: D.LogLevel.LOG_LEVEL_OFF
|
|
8552
8557
|
});
|
|
8553
8558
|
/** List of categories that won't be converted to fragments. */
|
|
8554
|
-
|
|
8559
|
+
I(this, "excludedCategories", /* @__PURE__ */ new Set());
|
|
8555
8560
|
/** Whether to save the absolute location of all IFC items. */
|
|
8556
|
-
|
|
8561
|
+
I(this, "saveLocations", !1);
|
|
8557
8562
|
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
8558
|
-
|
|
8563
|
+
I(this, "webIfc", {
|
|
8559
8564
|
COORDINATE_TO_ORIGIN: !0,
|
|
8560
8565
|
OPTIMIZE_PROFILES: !0
|
|
8561
8566
|
});
|
|
8562
|
-
|
|
8563
|
-
|
|
8567
|
+
I(this, "autoSetWasm", !0);
|
|
8568
|
+
I(this, "customLocateFileHandler", null);
|
|
8564
8569
|
}
|
|
8565
8570
|
}
|
|
8566
8571
|
class Bn {
|
|
8567
8572
|
constructor() {
|
|
8568
|
-
|
|
8573
|
+
I(this, "defLineMat", new g.LineBasicMaterial({ color: 16777215 }));
|
|
8569
8574
|
}
|
|
8570
8575
|
read(s) {
|
|
8571
8576
|
const t = s.GetAllAlignments(0), e = s.GetAllCrossSections2D(0), i = s.GetAllCrossSections3D(0), o = {
|
|
@@ -8592,16 +8597,16 @@ class Bn {
|
|
|
8592
8597
|
const n = {};
|
|
8593
8598
|
if (o.data)
|
|
8594
8599
|
for (const h of o.data) {
|
|
8595
|
-
const [
|
|
8596
|
-
n[
|
|
8600
|
+
const [u, p] = h.split(": "), A = parseFloat(p);
|
|
8601
|
+
n[u] = A || p;
|
|
8597
8602
|
}
|
|
8598
8603
|
const { points: r } = o, a = new Float32Array(r.length * 3);
|
|
8599
8604
|
for (let h = 0; h < r.length; h++) {
|
|
8600
|
-
const { x:
|
|
8601
|
-
a[h * 3] =
|
|
8605
|
+
const { x: u, y: p, z: A } = r[h];
|
|
8606
|
+
a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = A || 0;
|
|
8602
8607
|
}
|
|
8603
|
-
const
|
|
8604
|
-
E.setAttribute("position",
|
|
8608
|
+
const l = new g.BufferAttribute(a, 3), E = new g.EdgesGeometry();
|
|
8609
|
+
E.setAttribute("position", l);
|
|
8605
8610
|
const d = new Vt.CurveMesh(
|
|
8606
8611
|
i,
|
|
8607
8612
|
n,
|
|
@@ -8633,20 +8638,20 @@ class Yn {
|
|
|
8633
8638
|
const Ge = class Ge extends J {
|
|
8634
8639
|
constructor(t) {
|
|
8635
8640
|
super(t);
|
|
8636
|
-
|
|
8637
|
-
|
|
8641
|
+
I(this, "onIfcStartedLoading", new U());
|
|
8642
|
+
I(this, "onSetup", new U());
|
|
8638
8643
|
/** {@link Disposable.onDisposed} */
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8644
|
+
I(this, "onDisposed", new U());
|
|
8645
|
+
I(this, "settings", new Li());
|
|
8646
|
+
I(this, "enabled", !0);
|
|
8647
|
+
I(this, "webIfc", new D.IfcAPI());
|
|
8648
|
+
I(this, "_material", new g.MeshLambertMaterial());
|
|
8649
|
+
I(this, "_spatialTree", new vn());
|
|
8650
|
+
I(this, "_metaData", new Yn());
|
|
8651
|
+
I(this, "_fragmentInstances", /* @__PURE__ */ new Map());
|
|
8652
|
+
I(this, "_civil", new Bn());
|
|
8653
|
+
I(this, "_visitedFragments", /* @__PURE__ */ new Map());
|
|
8654
|
+
I(this, "_materialT", new g.MeshLambertMaterial({
|
|
8650
8655
|
transparent: !0,
|
|
8651
8656
|
opacity: 0.5
|
|
8652
8657
|
}));
|
|
@@ -8663,10 +8668,10 @@ const Ge = class Ge extends J {
|
|
|
8663
8668
|
this.onIfcStartedLoading.trigger(), await this.readIfcFile(t);
|
|
8664
8669
|
const o = await this.getAllGeometries(), r = await this.components.get(Ti).export(this.webIfc, 0);
|
|
8665
8670
|
o.setLocalProperties(r), this.cleanUp();
|
|
8666
|
-
const a = this.components.get(
|
|
8671
|
+
const a = this.components.get(ut);
|
|
8667
8672
|
a.groups.set(o.uuid, o);
|
|
8668
|
-
for (const
|
|
8669
|
-
a.list.set(
|
|
8673
|
+
for (const l of o.items)
|
|
8674
|
+
a.list.set(l.id, l), l.mesh.uuid = l.id, l.group = o;
|
|
8670
8675
|
return a.onFragmentsLoaded.trigger(o), e && a.coordinate([o]), console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
|
|
8671
8676
|
}
|
|
8672
8677
|
async readIfcFile(t) {
|
|
@@ -8686,27 +8691,27 @@ const Ge = class Ge extends J {
|
|
|
8686
8691
|
for (const a of t) {
|
|
8687
8692
|
if (!this.webIfc.IsIfcElement(a) && a !== D.IFCSPACE || this.settings.excludedCategories.has(a))
|
|
8688
8693
|
continue;
|
|
8689
|
-
const
|
|
8694
|
+
const l = this.webIfc.GetLineIDsWithType(0, a), E = l.size();
|
|
8690
8695
|
for (let d = 0; d < E; d++) {
|
|
8691
|
-
const h =
|
|
8696
|
+
const h = l.get(d);
|
|
8692
8697
|
n.push(h);
|
|
8693
|
-
const
|
|
8694
|
-
e.data.set(h, [[], [
|
|
8698
|
+
const u = this._spatialTree.itemsByFloor[h] || 0;
|
|
8699
|
+
e.data.set(h, [[], [u, a]]);
|
|
8695
8700
|
}
|
|
8696
8701
|
}
|
|
8697
8702
|
this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0, n, (a) => {
|
|
8698
8703
|
this.getMesh(a, e);
|
|
8699
8704
|
});
|
|
8700
8705
|
for (const a of this._visitedFragments) {
|
|
8701
|
-
const { index:
|
|
8702
|
-
e.keyFragments.set(
|
|
8706
|
+
const { index: l, fragment: E } = a[1];
|
|
8707
|
+
e.keyFragments.set(l, E.id);
|
|
8703
8708
|
}
|
|
8704
8709
|
for (const a of e.items) {
|
|
8705
|
-
const
|
|
8706
|
-
if (!
|
|
8710
|
+
const l = this._fragmentInstances.get(a.id);
|
|
8711
|
+
if (!l)
|
|
8707
8712
|
throw new Error("Fragment not found!");
|
|
8708
8713
|
const E = [];
|
|
8709
|
-
for (const [d, h] of
|
|
8714
|
+
for (const [d, h] of l)
|
|
8710
8715
|
E.push(h);
|
|
8711
8716
|
a.add(E);
|
|
8712
8717
|
}
|
|
@@ -8719,14 +8724,14 @@ const Ge = class Ge extends J {
|
|
|
8719
8724
|
getMesh(t, e) {
|
|
8720
8725
|
const i = t.geometries.size(), o = t.expressID;
|
|
8721
8726
|
for (let n = 0; n < i; n++) {
|
|
8722
|
-
const r = t.geometries.get(n), { x: a, y:
|
|
8727
|
+
const r = t.geometries.get(n), { x: a, y: l, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
|
|
8723
8728
|
if (!this._visitedFragments.has(p)) {
|
|
8724
|
-
const m = this.getGeometry(this.webIfc,
|
|
8729
|
+
const m = this.getGeometry(this.webIfc, u), O = h ? this._materialT : this._material, S = new Vt.Fragment(m, O, 1);
|
|
8725
8730
|
e.add(S.mesh), e.items.push(S);
|
|
8726
8731
|
const _ = this._visitedFragments.size;
|
|
8727
8732
|
this._visitedFragments.set(p, { index: _, fragment: S });
|
|
8728
8733
|
}
|
|
8729
|
-
const A = new g.Color().setRGB(a,
|
|
8734
|
+
const A = new g.Color().setRGB(a, l, E, "srgb"), R = new g.Matrix4();
|
|
8730
8735
|
R.fromArray(r.flatTransformation);
|
|
8731
8736
|
const C = this._visitedFragments.get(p);
|
|
8732
8737
|
if (C === void 0)
|
|
@@ -8759,8 +8764,8 @@ const Ge = class Ge extends J {
|
|
|
8759
8764
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
8760
8765
|
for (let h = 0; h < n.length; h += 6)
|
|
8761
8766
|
r[h / 2] = n[h], r[h / 2 + 1] = n[h + 1], r[h / 2 + 2] = n[h + 2], a[h / 2] = n[h + 3], a[h / 2 + 1] = n[h + 4], a[h / 2 + 2] = n[h + 5];
|
|
8762
|
-
const
|
|
8763
|
-
return
|
|
8767
|
+
const l = new g.BufferGeometry(), E = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
|
|
8768
|
+
return l.setAttribute("position", E), l.setAttribute("normal", d), l.setIndex(Array.from(o)), i.delete(), l;
|
|
8764
8769
|
}
|
|
8765
8770
|
async autoSetWasm() {
|
|
8766
8771
|
const t = await fetch(
|
|
@@ -8783,27 +8788,27 @@ const Ge = class Ge extends J {
|
|
|
8783
8788
|
}
|
|
8784
8789
|
}
|
|
8785
8790
|
};
|
|
8786
|
-
|
|
8791
|
+
I(Ge, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
|
|
8787
8792
|
let mi = Ge;
|
|
8788
8793
|
const Bt = class Bt extends J {
|
|
8789
8794
|
constructor(t) {
|
|
8790
8795
|
super(t);
|
|
8791
8796
|
/** {@link Disposable.onDisposed} */
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8797
|
+
I(this, "onDisposed", new U());
|
|
8798
|
+
I(this, "onRequestFile", new U());
|
|
8799
|
+
I(this, "ifcToExport", null);
|
|
8800
|
+
I(this, "onElementToPset", new U());
|
|
8801
|
+
I(this, "onPropToPset", new U());
|
|
8802
|
+
I(this, "onPsetRemoved", new U());
|
|
8803
|
+
I(this, "onDataChanged", new U());
|
|
8804
|
+
I(this, "wasm", {
|
|
8800
8805
|
path: "/",
|
|
8801
8806
|
absolute: !1
|
|
8802
8807
|
});
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8808
|
+
I(this, "enabled", !0);
|
|
8809
|
+
I(this, "attributeListeners", {});
|
|
8810
|
+
I(this, "selectedModel");
|
|
8811
|
+
I(this, "changeMap", {});
|
|
8807
8812
|
this.components.add(Bt.uuid, this);
|
|
8808
8813
|
}
|
|
8809
8814
|
dispose() {
|
|
@@ -8843,11 +8848,11 @@ const Bt = class Bt extends J {
|
|
|
8843
8848
|
}
|
|
8844
8849
|
}
|
|
8845
8850
|
async newPset(t, e, i) {
|
|
8846
|
-
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new D[o].IfcLabel(e),
|
|
8851
|
+
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new D[o].IfcLabel(e), l = i ? new D[o].IfcText(i) : null, E = new D[o].IfcPropertySet(
|
|
8847
8852
|
r,
|
|
8848
8853
|
n,
|
|
8849
8854
|
a,
|
|
8850
|
-
|
|
8855
|
+
l,
|
|
8851
8856
|
[]
|
|
8852
8857
|
);
|
|
8853
8858
|
E.expressID = this.increaseMaxID(t);
|
|
@@ -8875,13 +8880,13 @@ const Bt = class Bt extends J {
|
|
|
8875
8880
|
}
|
|
8876
8881
|
}
|
|
8877
8882
|
async newSingleProperty(t, e, i, o) {
|
|
8878
|
-
const n = Bt.getIFCSchema(t), r = new D[n].IfcIdentifier(i), a = new D[n][e](o),
|
|
8883
|
+
const n = Bt.getIFCSchema(t), r = new D[n].IfcIdentifier(i), a = new D[n][e](o), l = new D[n].IfcPropertySingleValue(
|
|
8879
8884
|
r,
|
|
8880
8885
|
null,
|
|
8881
8886
|
a,
|
|
8882
8887
|
null
|
|
8883
8888
|
);
|
|
8884
|
-
return
|
|
8889
|
+
return l.expressID = this.increaseMaxID(t), await this.setData(t, l), l;
|
|
8885
8890
|
}
|
|
8886
8891
|
newSingleStringProperty(t, e, i, o) {
|
|
8887
8892
|
return this.newSingleProperty(t, e, i, o);
|
|
@@ -8927,8 +8932,8 @@ const Bt = class Bt extends J {
|
|
|
8927
8932
|
}
|
|
8928
8933
|
async saveToIfc(t, e) {
|
|
8929
8934
|
const i = this.components.get(mi), o = i.webIfc, n = await i.readIfcFile(e), r = this.changeMap[t.uuid] ?? [];
|
|
8930
|
-
for (const
|
|
8931
|
-
const E = await t.getProperties(
|
|
8935
|
+
for (const l of r) {
|
|
8936
|
+
const E = await t.getProperties(l);
|
|
8932
8937
|
if (E)
|
|
8933
8938
|
try {
|
|
8934
8939
|
o.WriteLine(n, E);
|
|
@@ -8936,7 +8941,7 @@ const Bt = class Bt extends J {
|
|
|
8936
8941
|
}
|
|
8937
8942
|
else
|
|
8938
8943
|
try {
|
|
8939
|
-
o.DeleteLine(n,
|
|
8944
|
+
o.DeleteLine(n, l);
|
|
8940
8945
|
} catch {
|
|
8941
8946
|
}
|
|
8942
8947
|
}
|
|
@@ -8959,28 +8964,28 @@ const Bt = class Bt extends J {
|
|
|
8959
8964
|
const a = r.value;
|
|
8960
8965
|
if (a === void 0 || a == null)
|
|
8961
8966
|
throw new Error(`Attribute ${i} has a badly defined handle.`);
|
|
8962
|
-
const
|
|
8967
|
+
const l = new U();
|
|
8963
8968
|
return Object.defineProperty(n[i], "value", {
|
|
8964
8969
|
get() {
|
|
8965
8970
|
return this._value;
|
|
8966
8971
|
},
|
|
8967
8972
|
async set(E) {
|
|
8968
|
-
this._value = E,
|
|
8973
|
+
this._value = E, l.trigger(E);
|
|
8969
8974
|
}
|
|
8970
|
-
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] =
|
|
8975
|
+
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = l, l;
|
|
8971
8976
|
}
|
|
8972
8977
|
};
|
|
8973
|
-
|
|
8978
|
+
I(Bt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
|
|
8974
8979
|
let Fn = Bt;
|
|
8975
8980
|
const Ps = class Ps extends J {
|
|
8976
8981
|
constructor(t) {
|
|
8977
8982
|
super(t);
|
|
8978
8983
|
/** {@link Component.enabled} */
|
|
8979
|
-
|
|
8980
|
-
|
|
8984
|
+
I(this, "enabled", !0);
|
|
8985
|
+
I(this, "list", {});
|
|
8981
8986
|
/** {@link Disposable.onDisposed} */
|
|
8982
|
-
|
|
8983
|
-
|
|
8987
|
+
I(this, "onDisposed", new U());
|
|
8988
|
+
I(this, "onFragmentsDisposed", (t) => {
|
|
8984
8989
|
const { groupID: e, fragmentIDs: i } = t;
|
|
8985
8990
|
for (const o in this.list) {
|
|
8986
8991
|
const n = this.list[o], r = Object.keys(n);
|
|
@@ -8988,17 +8993,17 @@ const Ps = class Ps extends J {
|
|
|
8988
8993
|
delete n[e], Object.values(n).length === 0 && delete this.list[o];
|
|
8989
8994
|
else
|
|
8990
8995
|
for (const a of r) {
|
|
8991
|
-
const
|
|
8996
|
+
const l = n[a];
|
|
8992
8997
|
for (const E of i)
|
|
8993
|
-
delete
|
|
8994
|
-
Object.values(
|
|
8998
|
+
delete l[E];
|
|
8999
|
+
Object.values(l).length === 0 && delete n[a];
|
|
8995
9000
|
}
|
|
8996
9001
|
}
|
|
8997
9002
|
});
|
|
8998
|
-
t.add(Ps.uuid, this), t.get(
|
|
9003
|
+
t.add(Ps.uuid, this), t.get(ut).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
8999
9004
|
}
|
|
9000
9005
|
dispose() {
|
|
9001
|
-
this.list = {}, this.components.get(
|
|
9006
|
+
this.list = {}, this.components.get(ut).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(), this.onDisposed.reset();
|
|
9002
9007
|
}
|
|
9003
9008
|
remove(t) {
|
|
9004
9009
|
for (const e in this.list) {
|
|
@@ -9010,11 +9015,11 @@ const Ps = class Ps extends J {
|
|
|
9010
9015
|
}
|
|
9011
9016
|
}
|
|
9012
9017
|
find(t) {
|
|
9013
|
-
const e = this.components.get(
|
|
9018
|
+
const e = this.components.get(ut);
|
|
9014
9019
|
if (!t) {
|
|
9015
9020
|
const r = {};
|
|
9016
|
-
for (const [a,
|
|
9017
|
-
r[a] = new Set(
|
|
9021
|
+
for (const [a, l] of e.list)
|
|
9022
|
+
r[a] = new Set(l.ids);
|
|
9018
9023
|
return r;
|
|
9019
9024
|
}
|
|
9020
9025
|
const i = Object.keys(t).length, o = {};
|
|
@@ -9024,14 +9029,14 @@ const Ps = class Ps extends J {
|
|
|
9024
9029
|
console.warn(`Classification ${r} does not exist.`);
|
|
9025
9030
|
continue;
|
|
9026
9031
|
}
|
|
9027
|
-
for (const
|
|
9028
|
-
const E = this.list[r][
|
|
9032
|
+
for (const l of a) {
|
|
9033
|
+
const E = this.list[r][l];
|
|
9029
9034
|
if (E)
|
|
9030
9035
|
for (const d in E) {
|
|
9031
9036
|
o[d] || (o[d] = /* @__PURE__ */ new Map());
|
|
9032
9037
|
for (const h of E[d]) {
|
|
9033
|
-
const
|
|
9034
|
-
|
|
9038
|
+
const u = o[d].get(h);
|
|
9039
|
+
u === void 0 ? o[d].set(h, 1) : o[d].set(h, u + 1);
|
|
9035
9040
|
}
|
|
9036
9041
|
}
|
|
9037
9042
|
}
|
|
@@ -9039,10 +9044,10 @@ const Ps = class Ps extends J {
|
|
|
9039
9044
|
const n = {};
|
|
9040
9045
|
for (const r in o) {
|
|
9041
9046
|
const a = o[r];
|
|
9042
|
-
for (const [
|
|
9047
|
+
for (const [l, E] of a) {
|
|
9043
9048
|
if (E === void 0)
|
|
9044
9049
|
throw new Error("Malformed fragments map!");
|
|
9045
|
-
E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(
|
|
9050
|
+
E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(l));
|
|
9046
9051
|
}
|
|
9047
9052
|
}
|
|
9048
9053
|
return n;
|
|
@@ -9054,8 +9059,8 @@ const Ps = class Ps extends J {
|
|
|
9054
9059
|
const o = i[t];
|
|
9055
9060
|
for (const [n, r] of e.data) {
|
|
9056
9061
|
const a = r[0];
|
|
9057
|
-
for (const
|
|
9058
|
-
const E = e.keyFragments.get(
|
|
9062
|
+
for (const l of a) {
|
|
9063
|
+
const E = e.keyFragments.get(l);
|
|
9059
9064
|
E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
|
|
9060
9065
|
}
|
|
9061
9066
|
}
|
|
@@ -9070,14 +9075,14 @@ const Ps = class Ps extends J {
|
|
|
9070
9075
|
continue;
|
|
9071
9076
|
const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
|
|
9072
9077
|
e[a] || (e[a] = {});
|
|
9073
|
-
const
|
|
9078
|
+
const l = e[a];
|
|
9074
9079
|
for (const [E, d] of t.data) {
|
|
9075
9080
|
const h = d[0];
|
|
9076
|
-
for (const
|
|
9077
|
-
const p = t.keyFragments.get(
|
|
9081
|
+
for (const u of h) {
|
|
9082
|
+
const p = t.keyFragments.get(u);
|
|
9078
9083
|
if (!p)
|
|
9079
9084
|
throw new Error("Fragment ID not found!");
|
|
9080
|
-
|
|
9085
|
+
l[p] || (l[p] = /* @__PURE__ */ new Set()), l[p].add(r.expressID);
|
|
9081
9086
|
}
|
|
9082
9087
|
}
|
|
9083
9088
|
}
|
|
@@ -9115,7 +9120,7 @@ const Ps = class Ps extends J {
|
|
|
9115
9120
|
);
|
|
9116
9121
|
}
|
|
9117
9122
|
setColor(t, e, i = !1) {
|
|
9118
|
-
const o = this.components.get(
|
|
9123
|
+
const o = this.components.get(ut);
|
|
9119
9124
|
for (const n in t) {
|
|
9120
9125
|
const r = o.list.get(n);
|
|
9121
9126
|
if (!r)
|
|
@@ -9125,7 +9130,7 @@ const Ps = class Ps extends J {
|
|
|
9125
9130
|
}
|
|
9126
9131
|
}
|
|
9127
9132
|
resetColor(t) {
|
|
9128
|
-
const e = this.components.get(
|
|
9133
|
+
const e = this.components.get(ut);
|
|
9129
9134
|
for (const i in t) {
|
|
9130
9135
|
const o = e.list.get(i);
|
|
9131
9136
|
if (!o)
|
|
@@ -9141,23 +9146,23 @@ const Ps = class Ps extends J {
|
|
|
9141
9146
|
for (const r of n[0]) {
|
|
9142
9147
|
const a = t.keyFragments.get(r);
|
|
9143
9148
|
if (a) {
|
|
9144
|
-
const
|
|
9145
|
-
|
|
9149
|
+
const l = this.list[e];
|
|
9150
|
+
l[i] || (l[i] = {}), l[i][a] || (l[i][a] = /* @__PURE__ */ new Set()), l[i][a].add(o);
|
|
9146
9151
|
}
|
|
9147
9152
|
}
|
|
9148
9153
|
}
|
|
9149
9154
|
};
|
|
9150
|
-
|
|
9155
|
+
I(Ps, "uuid", "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");
|
|
9151
9156
|
let Ri = Ps;
|
|
9152
9157
|
const Ls = class Ls extends J {
|
|
9153
9158
|
constructor(t) {
|
|
9154
9159
|
super(t);
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9160
|
+
I(this, "enabled", !0);
|
|
9161
|
+
I(this, "height", 10);
|
|
9162
|
+
I(this, "groupName", "storeys");
|
|
9158
9163
|
/** {@link Disposable.onDisposed} */
|
|
9159
|
-
|
|
9160
|
-
|
|
9164
|
+
I(this, "onDisposed", new U());
|
|
9165
|
+
I(this, "list", /* @__PURE__ */ new Set());
|
|
9161
9166
|
t.add(Ls.uuid, this);
|
|
9162
9167
|
}
|
|
9163
9168
|
dispose() {
|
|
@@ -9166,33 +9171,33 @@ const Ls = class Ls extends J {
|
|
|
9166
9171
|
set(t) {
|
|
9167
9172
|
if (!this.enabled)
|
|
9168
9173
|
return;
|
|
9169
|
-
const e = this.components.get(Ri), i = this.components.get(
|
|
9174
|
+
const e = this.components.get(Ri), i = this.components.get(ut), o = t ? 1 : -1;
|
|
9170
9175
|
let n = 0;
|
|
9171
9176
|
const r = e.list[this.groupName], a = new g.Matrix4();
|
|
9172
|
-
for (const
|
|
9177
|
+
for (const l in r) {
|
|
9173
9178
|
a.elements[13] = n * o * this.height;
|
|
9174
|
-
for (const E in r[
|
|
9175
|
-
const d = i.list.get(E), h =
|
|
9176
|
-
if (!d || t &&
|
|
9179
|
+
for (const E in r[l]) {
|
|
9180
|
+
const d = i.list.get(E), h = l + E, u = this.list.has(h);
|
|
9181
|
+
if (!d || t && u || !t && !u)
|
|
9177
9182
|
continue;
|
|
9178
9183
|
t ? this.list.add(h) : this.list.delete(h);
|
|
9179
|
-
const p = r[
|
|
9184
|
+
const p = r[l][E];
|
|
9180
9185
|
d.applyTransform(p, a);
|
|
9181
9186
|
}
|
|
9182
9187
|
n++;
|
|
9183
9188
|
}
|
|
9184
9189
|
}
|
|
9185
9190
|
};
|
|
9186
|
-
|
|
9191
|
+
I(Ls, "uuid", "d260618b-ce88-4c7d-826c-6debb91de3e2");
|
|
9187
9192
|
let On = Ls;
|
|
9188
9193
|
const ys = class ys extends J {
|
|
9189
9194
|
constructor(t) {
|
|
9190
9195
|
super(t);
|
|
9191
|
-
|
|
9196
|
+
I(this, "enabled", !0);
|
|
9192
9197
|
this.components.add(ys.uuid, this);
|
|
9193
9198
|
}
|
|
9194
9199
|
set(t, e) {
|
|
9195
|
-
const i = this.components.get(
|
|
9200
|
+
const i = this.components.get(ut);
|
|
9196
9201
|
if (!e) {
|
|
9197
9202
|
for (const o in i.list) {
|
|
9198
9203
|
const n = i.list.get(o);
|
|
@@ -9216,32 +9221,32 @@ const ys = class ys extends J {
|
|
|
9216
9221
|
}
|
|
9217
9222
|
}
|
|
9218
9223
|
};
|
|
9219
|
-
|
|
9224
|
+
I(ys, "uuid", "dd9ccf2d-8a21-4821-b7f6-2949add16a29");
|
|
9220
9225
|
let gn = ys;
|
|
9221
9226
|
class jr extends Li {
|
|
9222
9227
|
constructor() {
|
|
9223
9228
|
super(...arguments);
|
|
9224
|
-
|
|
9225
|
-
|
|
9229
|
+
I(this, "minGeometrySize", 10);
|
|
9230
|
+
I(this, "minAssetsSize", 1e3);
|
|
9226
9231
|
}
|
|
9227
9232
|
}
|
|
9228
9233
|
class Vn extends Li {
|
|
9229
9234
|
constructor() {
|
|
9230
9235
|
super(...arguments);
|
|
9231
|
-
|
|
9236
|
+
I(this, "propertiesSize", 100);
|
|
9232
9237
|
}
|
|
9233
9238
|
}
|
|
9234
9239
|
class qr extends J {
|
|
9235
9240
|
constructor() {
|
|
9236
9241
|
super(...arguments);
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9242
|
+
I(this, "onPropertiesStreamed", new Kt());
|
|
9243
|
+
I(this, "onProgress", new Kt());
|
|
9244
|
+
I(this, "onIndicesStreamed", new Kt());
|
|
9240
9245
|
/** {@link Disposable.onDisposed} */
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9246
|
+
I(this, "onDisposed", new U());
|
|
9247
|
+
I(this, "enabled", !0);
|
|
9248
|
+
I(this, "settings", new Vn());
|
|
9249
|
+
I(this, "webIfc", new D.IfcAPI());
|
|
9245
9250
|
}
|
|
9246
9251
|
async dispose() {
|
|
9247
9252
|
this.onIndicesStreamed.reset(), this.onPropertiesStreamed.reset(), this.webIfc = null, this.onDisposed.reset();
|
|
@@ -9283,9 +9288,9 @@ class qr extends J {
|
|
|
9283
9288
|
for (const E of e) {
|
|
9284
9289
|
if (a++, Pi.has(E))
|
|
9285
9290
|
continue;
|
|
9286
|
-
const d = n.has(E), h = this.webIfc.GetLineIDsWithType(0, E),
|
|
9291
|
+
const d = n.has(E), h = this.webIfc.GetLineIDsWithType(0, E), u = h.size();
|
|
9287
9292
|
let p = 0;
|
|
9288
|
-
for (let R = 0; R <
|
|
9293
|
+
for (let R = 0; R < u - t; R += t) {
|
|
9289
9294
|
const C = {};
|
|
9290
9295
|
for (let T = 0; T < t; T++) {
|
|
9291
9296
|
p++;
|
|
@@ -9299,9 +9304,9 @@ class qr extends J {
|
|
|
9299
9304
|
}
|
|
9300
9305
|
await this.onPropertiesStreamed.trigger({ type: E, data: C });
|
|
9301
9306
|
}
|
|
9302
|
-
if (p !==
|
|
9307
|
+
if (p !== u) {
|
|
9303
9308
|
const R = {};
|
|
9304
|
-
for (let C = p; C <
|
|
9309
|
+
for (let C = p; C < u; C++) {
|
|
9305
9310
|
const T = h.get(C);
|
|
9306
9311
|
try {
|
|
9307
9312
|
const F = this.webIfc.GetLine(0, T, d);
|
|
@@ -9315,10 +9320,10 @@ class qr extends J {
|
|
|
9315
9320
|
const A = a / e.size;
|
|
9316
9321
|
A > r && (r += 0.01, r = Math.max(r, A), await this.onProgress.trigger(Math.round(r * 100) / 100));
|
|
9317
9322
|
}
|
|
9318
|
-
const
|
|
9323
|
+
const l = [];
|
|
9319
9324
|
for (const [E, d] of o)
|
|
9320
|
-
|
|
9321
|
-
await this.onIndicesStreamed.trigger(
|
|
9325
|
+
l.push([E, ...d]);
|
|
9326
|
+
await this.onIndicesStreamed.trigger(l);
|
|
9322
9327
|
}
|
|
9323
9328
|
getIndices(t, e, i) {
|
|
9324
9329
|
const o = t.RelatedObjects || t.RelatedElements;
|
|
@@ -9337,37 +9342,37 @@ class qr extends J {
|
|
|
9337
9342
|
for (const a of o) {
|
|
9338
9343
|
if (a.value === void 0 || a.value === null)
|
|
9339
9344
|
continue;
|
|
9340
|
-
const
|
|
9341
|
-
i.has(
|
|
9345
|
+
const l = a.value;
|
|
9346
|
+
i.has(l) || i.set(l, /* @__PURE__ */ new Set()), i.get(l).add(r);
|
|
9342
9347
|
}
|
|
9343
9348
|
}
|
|
9344
9349
|
cleanUp() {
|
|
9345
9350
|
this.webIfc = null, this.webIfc = new D.IfcAPI();
|
|
9346
9351
|
}
|
|
9347
9352
|
}
|
|
9348
|
-
|
|
9353
|
+
I(qr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
|
|
9349
9354
|
const ws = class ws extends J {
|
|
9350
9355
|
constructor(t) {
|
|
9351
9356
|
super(t);
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9357
|
+
I(this, "onGeometryStreamed", new U());
|
|
9358
|
+
I(this, "onAssetStreamed", new U());
|
|
9359
|
+
I(this, "onProgress", new U());
|
|
9360
|
+
I(this, "onIfcLoaded", new U());
|
|
9356
9361
|
/** {@link Disposable.onDisposed} */
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9362
|
+
I(this, "onDisposed", new U());
|
|
9363
|
+
I(this, "settings", new jr());
|
|
9364
|
+
I(this, "enabled", !0);
|
|
9365
|
+
I(this, "webIfc", new D.IfcAPI());
|
|
9366
|
+
I(this, "_spatialTree", new vn());
|
|
9367
|
+
I(this, "_metaData", new Yn());
|
|
9368
|
+
I(this, "_visitedGeometries", /* @__PURE__ */ new Map());
|
|
9369
|
+
I(this, "_streamSerializer", new Vt.StreamSerializer());
|
|
9370
|
+
I(this, "_geometries", /* @__PURE__ */ new Map());
|
|
9371
|
+
I(this, "_geometryCount", 0);
|
|
9372
|
+
I(this, "_civil", new Bn());
|
|
9373
|
+
I(this, "_groupSerializer", new Vt.Serializer());
|
|
9374
|
+
I(this, "_assets", []);
|
|
9375
|
+
I(this, "_meshesWithHoles", /* @__PURE__ */ new Set());
|
|
9371
9376
|
this.components.add(ws.uuid, this), this.settings.excludedCategories.add(D.IFCOPENINGELEMENT);
|
|
9372
9377
|
}
|
|
9373
9378
|
dispose() {
|
|
@@ -9399,18 +9404,18 @@ const ws = class ws extends J {
|
|
|
9399
9404
|
schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
|
|
9400
9405
|
maxExpressID: this.webIfc.GetMaxExpressID(0)
|
|
9401
9406
|
};
|
|
9402
|
-
let
|
|
9407
|
+
let l = 0, E = 0;
|
|
9403
9408
|
for (const T of i) {
|
|
9404
9409
|
if (!this.webIfc.IsIfcElement(T) && T !== D.IFCSPACE || this.settings.excludedCategories.has(T))
|
|
9405
9410
|
continue;
|
|
9406
9411
|
const F = this.webIfc.GetLineIDsWithType(0, T), f = F.size();
|
|
9407
9412
|
console.log(f);
|
|
9408
9413
|
for (let m = 0; m < f; m++) {
|
|
9409
|
-
|
|
9414
|
+
l > t && (l = 0, E++, o.push([]));
|
|
9410
9415
|
const O = F.get(m);
|
|
9411
9416
|
o[E].push(O);
|
|
9412
9417
|
const S = this._spatialTree.itemsByFloor[O] || 0;
|
|
9413
|
-
n.data.set(O, [[], [S, T]]),
|
|
9418
|
+
n.data.set(O, [[], [S, T]]), l++;
|
|
9414
9419
|
}
|
|
9415
9420
|
}
|
|
9416
9421
|
this._spatialTree.cleanUp();
|
|
@@ -9423,9 +9428,9 @@ const ws = class ws extends J {
|
|
|
9423
9428
|
F > d && (d += 0.01, d = Math.max(d, F), this.onProgress.trigger(Math.round(d * 100) / 100));
|
|
9424
9429
|
}
|
|
9425
9430
|
this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
|
|
9426
|
-
const { opaque:
|
|
9431
|
+
const { opaque: u, transparent: p } = n.geometryIDs;
|
|
9427
9432
|
for (const [T, { index: F, uuid: f }] of this._visitedGeometries)
|
|
9428
|
-
n.keyFragments.set(F, f), (T > 1 ?
|
|
9433
|
+
n.keyFragments.set(F, f), (T > 1 ? u : p).set(T, F);
|
|
9429
9434
|
const A = n.data.keys();
|
|
9430
9435
|
for (const T of A) {
|
|
9431
9436
|
const [F] = n.data.get(T);
|
|
@@ -9442,20 +9447,20 @@ const ws = class ws extends J {
|
|
|
9442
9447
|
getMesh(t, e, i) {
|
|
9443
9448
|
const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
|
|
9444
9449
|
for (let a = 0; a < o; a++) {
|
|
9445
|
-
const
|
|
9450
|
+
const l = e.geometries.get(a), E = l.geometryExpressID, d = l.color.w === 1 ? 1 : -1, h = E * d;
|
|
9446
9451
|
if (!this._visitedGeometries.has(h)) {
|
|
9447
9452
|
this._visitedGeometries.has(E) || this.getGeometry(t, E);
|
|
9448
9453
|
const m = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
|
|
9449
9454
|
this._visitedGeometries.set(h, { uuid: O, index: m });
|
|
9450
9455
|
}
|
|
9451
|
-
const
|
|
9452
|
-
if (
|
|
9456
|
+
const u = this._visitedGeometries.get(h);
|
|
9457
|
+
if (u === void 0)
|
|
9453
9458
|
throw new Error("Error getting geometry data for streaming!");
|
|
9454
9459
|
const p = i.data.get(n);
|
|
9455
9460
|
if (!p)
|
|
9456
9461
|
throw new Error("Data not found!");
|
|
9457
|
-
p[0].push(
|
|
9458
|
-
const { x: A, y: R, z: C, w: T } =
|
|
9462
|
+
p[0].push(u.index);
|
|
9463
|
+
const { x: A, y: R, z: C, w: T } = l.color, F = [A, R, C, T], f = l.flatTransformation;
|
|
9459
9464
|
r.geometries.push({ color: F, geometryID: E, transformation: f });
|
|
9460
9465
|
}
|
|
9461
9466
|
this._assets.push(r);
|
|
@@ -9468,12 +9473,12 @@ const ws = class ws extends J {
|
|
|
9468
9473
|
i.GetVertexData(),
|
|
9469
9474
|
i.GetVertexDataSize()
|
|
9470
9475
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
9471
|
-
for (let
|
|
9472
|
-
r[
|
|
9473
|
-
const
|
|
9476
|
+
for (let u = 0; u < n.length; u += 6)
|
|
9477
|
+
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];
|
|
9478
|
+
const l = Cr(r), E = new Float32Array(l.transformation.elements), d = [l.center.x, l.center.y, l.center.z];
|
|
9474
9479
|
let h = !1;
|
|
9475
|
-
for (let
|
|
9476
|
-
const p = r[
|
|
9480
|
+
for (let u = 0; u < r.length - 2; u += 3) {
|
|
9481
|
+
const p = r[u], A = r[u + 1], R = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
|
|
9477
9482
|
if (Tr(d, [p, A, R], [C, T, F])) {
|
|
9478
9483
|
h = !0;
|
|
9479
9484
|
break;
|
|
@@ -9497,19 +9502,19 @@ const ws = class ws extends J {
|
|
|
9497
9502
|
this.onGeometryStreamed.trigger({ data: e, buffer: t }), e = null, t = null, this._geometries.clear(), this._geometryCount = 0;
|
|
9498
9503
|
}
|
|
9499
9504
|
};
|
|
9500
|
-
|
|
9505
|
+
I(ws, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
|
|
9501
9506
|
let Sn = ws;
|
|
9502
9507
|
class $r extends J {
|
|
9503
9508
|
constructor() {
|
|
9504
9509
|
super(...arguments);
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9510
|
+
I(this, "onPropertiesStreamed", new Kt());
|
|
9511
|
+
I(this, "onProgress", new Kt());
|
|
9512
|
+
I(this, "onIndicesStreamed", new Kt());
|
|
9508
9513
|
/** {@link Disposable.onDisposed} */
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9514
|
+
I(this, "onDisposed", new U());
|
|
9515
|
+
I(this, "enabled", !0);
|
|
9516
|
+
I(this, "settings", new Vn());
|
|
9517
|
+
I(this, "webIfc", new D.IfcAPI());
|
|
9513
9518
|
}
|
|
9514
9519
|
async dispose() {
|
|
9515
9520
|
this.onIndicesStreamed.reset(), this.onPropertiesStreamed.reset(), this.webIfc = null, this.onDisposed.reset();
|
|
@@ -9538,18 +9543,18 @@ class $r extends J {
|
|
|
9538
9543
|
D.IFCBUILDINGSTOREY,
|
|
9539
9544
|
D.IFCSPACE
|
|
9540
9545
|
]);
|
|
9541
|
-
for (const
|
|
9542
|
-
e.add(
|
|
9546
|
+
for (const l of i)
|
|
9547
|
+
e.add(l);
|
|
9543
9548
|
let o = 0.01, n = 0;
|
|
9544
|
-
for (const
|
|
9545
|
-
if (n++, Pi.has(
|
|
9549
|
+
for (const l of e) {
|
|
9550
|
+
if (n++, Pi.has(l))
|
|
9546
9551
|
continue;
|
|
9547
|
-
const E = i.has(
|
|
9548
|
-
let
|
|
9552
|
+
const E = i.has(l), d = this.webIfc.GetLineIDsWithType(0, l), h = d.size();
|
|
9553
|
+
let u = 0;
|
|
9549
9554
|
for (let A = 0; A < h - t; A += t) {
|
|
9550
9555
|
const R = {};
|
|
9551
9556
|
for (let C = 0; C < t; C++) {
|
|
9552
|
-
|
|
9557
|
+
u++;
|
|
9553
9558
|
const T = d.get(A + C);
|
|
9554
9559
|
try {
|
|
9555
9560
|
const F = this.webIfc.GetLine(0, T, E);
|
|
@@ -9558,11 +9563,11 @@ class $r extends J {
|
|
|
9558
9563
|
console.log(`Could not get property: ${T}`);
|
|
9559
9564
|
}
|
|
9560
9565
|
}
|
|
9561
|
-
await this.onPropertiesStreamed.trigger({ type:
|
|
9566
|
+
await this.onPropertiesStreamed.trigger({ type: l, data: R });
|
|
9562
9567
|
}
|
|
9563
|
-
if (
|
|
9568
|
+
if (u !== h) {
|
|
9564
9569
|
const A = {};
|
|
9565
|
-
for (let R =
|
|
9570
|
+
for (let R = u; R < h; R++) {
|
|
9566
9571
|
const C = d.get(R);
|
|
9567
9572
|
try {
|
|
9568
9573
|
const T = this.webIfc.GetLine(0, C, E);
|
|
@@ -9571,7 +9576,7 @@ class $r extends J {
|
|
|
9571
9576
|
console.log(`Could not get property: ${C}`);
|
|
9572
9577
|
}
|
|
9573
9578
|
}
|
|
9574
|
-
await this.onPropertiesStreamed.trigger({ type:
|
|
9579
|
+
await this.onPropertiesStreamed.trigger({ type: l, data: A });
|
|
9575
9580
|
}
|
|
9576
9581
|
const p = n / e.size;
|
|
9577
9582
|
p > o && (o += 0.01, o = Math.max(o, p), await this.onProgress.trigger(Math.round(o * 100) / 100));
|
|
@@ -9583,11 +9588,11 @@ class $r extends J {
|
|
|
9583
9588
|
this.webIfc = null, this.webIfc = new D.IfcAPI();
|
|
9584
9589
|
}
|
|
9585
9590
|
}
|
|
9586
|
-
|
|
9591
|
+
I($r, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
|
|
9587
9592
|
const Ms = class Ms extends J {
|
|
9588
9593
|
constructor(t) {
|
|
9589
9594
|
super(t);
|
|
9590
|
-
|
|
9595
|
+
I(this, "enabled", !0);
|
|
9591
9596
|
t.add(Ms.uuid, this);
|
|
9592
9597
|
}
|
|
9593
9598
|
getFace(t, e, i) {
|
|
@@ -9599,26 +9604,26 @@ const Ms = class Ms extends J {
|
|
|
9599
9604
|
t
|
|
9600
9605
|
), a = [];
|
|
9601
9606
|
for (let h = 0; h < n.length / 3; h++) {
|
|
9602
|
-
const { plane:
|
|
9603
|
-
if (
|
|
9607
|
+
const { plane: u, edges: p } = this.getFaceData(h, i, t);
|
|
9608
|
+
if (u.equals(r)) {
|
|
9604
9609
|
a.push({ index: h, edges: p });
|
|
9605
9610
|
for (const { id: A, points: R, distance: C } of p)
|
|
9606
9611
|
o.set(A, { points: R, distance: C });
|
|
9607
9612
|
}
|
|
9608
9613
|
}
|
|
9609
|
-
let
|
|
9614
|
+
let l = 0;
|
|
9610
9615
|
const E = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
|
|
9611
|
-
for (const { index: h, edges:
|
|
9616
|
+
for (const { index: h, edges: u } of a) {
|
|
9612
9617
|
const p = /* @__PURE__ */ new Map();
|
|
9613
|
-
for (const { id: m } of
|
|
9618
|
+
for (const { id: m } of u)
|
|
9614
9619
|
if (E.has(m)) {
|
|
9615
9620
|
const O = E.get(m);
|
|
9616
9621
|
p.set(m, O);
|
|
9617
9622
|
}
|
|
9618
|
-
const A =
|
|
9623
|
+
const A = u.map((m) => m.id);
|
|
9619
9624
|
if (!p.size) {
|
|
9620
|
-
const m =
|
|
9621
|
-
for (const { id: O } of
|
|
9625
|
+
const m = l++;
|
|
9626
|
+
for (const { id: O } of u)
|
|
9622
9627
|
E.set(O, m);
|
|
9623
9628
|
d.set(m, {
|
|
9624
9629
|
edges: new Set(A),
|
|
@@ -9651,14 +9656,14 @@ const Ms = class Ms extends J {
|
|
|
9651
9656
|
d.delete(m);
|
|
9652
9657
|
}
|
|
9653
9658
|
}
|
|
9654
|
-
for (const [h, { indices:
|
|
9655
|
-
if (
|
|
9659
|
+
for (const [h, { indices: u, edges: p }] of d)
|
|
9660
|
+
if (u.has(e)) {
|
|
9656
9661
|
const A = [];
|
|
9657
9662
|
for (const R of p) {
|
|
9658
9663
|
const C = o.get(R);
|
|
9659
9664
|
A.push(C);
|
|
9660
9665
|
}
|
|
9661
|
-
return { edges: A, indices:
|
|
9666
|
+
return { edges: A, indices: u };
|
|
9662
9667
|
}
|
|
9663
9668
|
return null;
|
|
9664
9669
|
}
|
|
@@ -9667,8 +9672,8 @@ const Ms = class Ms extends J {
|
|
|
9667
9672
|
return n.set(e, i), n.closestPointToPoint(t, o, r), r.distanceTo(t);
|
|
9668
9673
|
}
|
|
9669
9674
|
getFaceData(t, e, i) {
|
|
9670
|
-
const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal:
|
|
9671
|
-
this.round(n), this.round(r), this.round(a), this.round(
|
|
9675
|
+
const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal: l } = o;
|
|
9676
|
+
this.round(n), this.round(r), this.round(a), this.round(l);
|
|
9672
9677
|
const E = [
|
|
9673
9678
|
{ id: `${n.x}|${n.y}|${n.z}`, value: n },
|
|
9674
9679
|
{ id: `${r.x}|${r.y}|${r.z}`, value: r },
|
|
@@ -9677,16 +9682,16 @@ const Ms = class Ms extends J {
|
|
|
9677
9682
|
E.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
|
|
9678
9683
|
const [
|
|
9679
9684
|
{ id: d, value: h },
|
|
9680
|
-
{ id:
|
|
9685
|
+
{ id: u, value: p },
|
|
9681
9686
|
{ id: A, value: R }
|
|
9682
9687
|
] = E, C = [
|
|
9683
9688
|
{
|
|
9684
|
-
id: `${d}|${
|
|
9689
|
+
id: `${d}|${u}`,
|
|
9685
9690
|
distance: h.distanceTo(p),
|
|
9686
9691
|
points: [h, p]
|
|
9687
9692
|
},
|
|
9688
9693
|
{
|
|
9689
|
-
id: `${
|
|
9694
|
+
id: `${u}|${A}`,
|
|
9690
9695
|
distance: p.distanceTo(R),
|
|
9691
9696
|
points: [p, R]
|
|
9692
9697
|
},
|
|
@@ -9696,25 +9701,25 @@ const Ms = class Ms extends J {
|
|
|
9696
9701
|
points: [h, R]
|
|
9697
9702
|
}
|
|
9698
9703
|
], T = new g.Plane();
|
|
9699
|
-
return T.setFromNormalAndCoplanarPoint(
|
|
9704
|
+
return T.setFromNormalAndCoplanarPoint(l, n), T.constant = Math.round(T.constant * 10) / 10, { plane: T, edges: C };
|
|
9700
9705
|
}
|
|
9701
9706
|
getVerticesAndNormal(t, e, i) {
|
|
9702
9707
|
if (!t.geometry.index)
|
|
9703
9708
|
throw new Error("Geometry must be indexed!");
|
|
9704
|
-
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3,
|
|
9709
|
+
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, l = o[e * 3 + 1] * 3, E = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), h = new g.Vector3(n[l], n[l + 1], n[l + 2]), u = new g.Vector3(n[E], n[E + 1], n[E + 2]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[l], r[l + 1], r[l + 2]), R = new g.Vector3(r[E], r[E + 1], r[E + 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);
|
|
9705
9710
|
if (!f.x && !f.y && !f.z && console.log("hey"), i !== void 0 && t instanceof g.InstancedMesh) {
|
|
9706
9711
|
const m = new g.Matrix4();
|
|
9707
9712
|
t.getMatrixAt(i, m);
|
|
9708
9713
|
const O = new g.Matrix4();
|
|
9709
|
-
O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m), h.applyMatrix4(m),
|
|
9714
|
+
O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m), h.applyMatrix4(m), u.applyMatrix4(m);
|
|
9710
9715
|
}
|
|
9711
|
-
return { p1: d, p2: h, p3:
|
|
9716
|
+
return { p1: d, p2: h, p3: u, faceNormal: f };
|
|
9712
9717
|
}
|
|
9713
9718
|
round(t) {
|
|
9714
9719
|
t.x = Math.trunc(t.x * 1e3) / 1e3, t.y = Math.trunc(t.y * 1e3) / 1e3, t.z = Math.trunc(t.z * 1e3) / 1e3;
|
|
9715
9720
|
}
|
|
9716
9721
|
};
|
|
9717
|
-
|
|
9722
|
+
I(Ms, "uuid", "267ca032-672f-4cb0-afa9-d24e904f39d6");
|
|
9718
9723
|
let _n = Ms;
|
|
9719
9724
|
export {
|
|
9720
9725
|
Kt as AsyncEvent,
|
|
@@ -9736,7 +9741,7 @@ export {
|
|
|
9736
9741
|
zr as FirstPersonMode,
|
|
9737
9742
|
gn as FragmentHider,
|
|
9738
9743
|
qr as FragmentPropsStreamConverter,
|
|
9739
|
-
|
|
9744
|
+
ut as FragmentsManager,
|
|
9740
9745
|
Nr as Grids,
|
|
9741
9746
|
oa as IfcCategories,
|
|
9742
9747
|
bn as IfcCategoryMap,
|