@thatopen/components 2.0.1 → 2.0.3
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/README.md +0 -0
- package/dist/core/Types/src/world.d.ts +1 -0
- package/dist/core/Worlds/index.d.ts +10 -10
- package/dist/core/Worlds/src/simple-world.d.ts +2 -0
- package/dist/fragments/Classifier/index.d.ts +2 -2
- package/dist/fragments/Hider/index.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +871 -846
- package/dist/namespace.d.ts +1090 -1087
- package/package.json +73 -73
package/dist/index.mjs
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
1
|
var Hn = Object.defineProperty;
|
|
2
|
-
var kn = (
|
|
3
|
-
var I = (
|
|
2
|
+
var kn = (l, s, t) => s in l ? Hn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
|
|
3
|
+
var I = (l, s, t) => (kn(l, 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 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
|
|
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 Qe, 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
|
-
import * as
|
|
9
|
-
const yn = 0, to = 1, eo = 2, xi = 2, Bs = 1.25, bi = 1,
|
|
10
|
-
function io(
|
|
11
|
-
return
|
|
8
|
+
import * as U from "web-ifc";
|
|
9
|
+
const yn = 0, to = 1, eo = 2, xi = 2, Bs = 1.25, bi = 1, Ts = 6 * 4 + 4 + 4, Ds = 65535, so = Math.pow(2, -24), Ys = Symbol("SKIP_GENERATION");
|
|
10
|
+
function io(l) {
|
|
11
|
+
return l.index ? l.index.count : l.attributes.position.count;
|
|
12
12
|
}
|
|
13
|
-
function Ce(
|
|
14
|
-
return io(
|
|
13
|
+
function Ce(l) {
|
|
14
|
+
return io(l) / 3;
|
|
15
15
|
}
|
|
16
|
-
function no(
|
|
17
|
-
return
|
|
16
|
+
function no(l, s = ArrayBuffer) {
|
|
17
|
+
return l > 65535 ? new Uint32Array(new s(4 * l)) : new Uint16Array(new s(2 * l));
|
|
18
18
|
}
|
|
19
|
-
function oo(
|
|
20
|
-
if (!
|
|
21
|
-
const t =
|
|
22
|
-
|
|
19
|
+
function oo(l, s) {
|
|
20
|
+
if (!l.index) {
|
|
21
|
+
const t = l.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = no(t, e);
|
|
22
|
+
l.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(l) {
|
|
28
|
+
const s = Ce(l), t = l.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(l) {
|
|
35
|
+
if (!l.groups || !l.groups.length)
|
|
36
|
+
return wn(l);
|
|
37
|
+
const s = [], t = /* @__PURE__ */ new Set(), e = l.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
|
|
38
|
+
for (const r of l.groups) {
|
|
39
|
+
const a = r.start / 3, c = (r.start + r.count) / 3;
|
|
40
|
+
t.add(Math.max(i, a)), t.add(Math.min(o, c));
|
|
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], c = n[r + 1];
|
|
45
45
|
s.push({
|
|
46
46
|
offset: Math.floor(a),
|
|
47
|
-
count: Math.floor(
|
|
47
|
+
count: Math.floor(c - a)
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return s;
|
|
51
51
|
}
|
|
52
|
-
function ro(
|
|
53
|
-
if (
|
|
52
|
+
function ro(l) {
|
|
53
|
+
if (l.groups.length === 0)
|
|
54
54
|
return !1;
|
|
55
|
-
const s = Ce(
|
|
55
|
+
const s = Ce(l), t = Mn(l).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 $(l, s, t) {
|
|
61
|
+
return t.min.x = s[l], t.min.y = s[l + 1], t.min.z = s[l + 2], t.max.x = s[l + 3], t.max.y = s[l + 4], t.max.z = s[l + 5], t;
|
|
62
62
|
}
|
|
63
|
-
function ao(
|
|
64
|
-
|
|
63
|
+
function ao(l) {
|
|
64
|
+
l[0] = l[1] = l[2] = 1 / 0, l[3] = l[4] = l[5] = -1 / 0;
|
|
65
65
|
}
|
|
66
|
-
function vi(
|
|
66
|
+
function vi(l) {
|
|
67
67
|
let s = -1, t = -1 / 0;
|
|
68
68
|
for (let e = 0; e < 3; e++) {
|
|
69
|
-
const i =
|
|
69
|
+
const i = l[e + 3] - l[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(l, s) {
|
|
75
|
+
s.set(l);
|
|
76
76
|
}
|
|
77
|
-
function Yi(
|
|
77
|
+
function Yi(l, 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 = l[o], i = s[o], t[o] = e < i ? e : i, e = l[n], i = s[n], t[n] = e > i ? e : i;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function je(l, s, t) {
|
|
85
85
|
for (let e = 0; e < 3; e++) {
|
|
86
|
-
const i = s[
|
|
86
|
+
const i = s[l + 2 * e], o = s[l + 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(l) {
|
|
91
|
+
const s = l[3] - l[0], t = l[4] - l[1], e = l[5] - l[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(l, s, t, e, i = null) {
|
|
95
|
+
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -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 = l[T + 0], m = l[T + 1], O = f - m, S = f + m;
|
|
99
99
|
O < o && (o = O), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
|
|
100
|
-
const _ =
|
|
101
|
-
L < n && (n = L), M >
|
|
102
|
-
const y =
|
|
100
|
+
const _ = l[T + 2], N = l[T + 3], L = _ - N, M = _ + N;
|
|
101
|
+
L < n && (n = L), M > c && (c = M), C && _ < h && (h = _), C && _ > A && (A = _);
|
|
102
|
+
const y = l[T + 4], x = l[T + 5], b = y - x, B = y + x;
|
|
103
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] = c, 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(l, s, t, e) {
|
|
108
|
+
let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
|
|
109
109
|
for (let E = s * 6, d = (s + t) * 6; E < d; E += 6) {
|
|
110
|
-
const h =
|
|
110
|
+
const h = l[E + 0];
|
|
111
111
|
h < i && (i = h), h > r && (r = h);
|
|
112
|
-
const u =
|
|
112
|
+
const u = l[E + 2];
|
|
113
113
|
u < o && (o = u), u > a && (a = u);
|
|
114
|
-
const p =
|
|
115
|
-
p < n && (n = p), p >
|
|
114
|
+
const p = l[E + 4];
|
|
115
|
+
p < n && (n = p), p > c && (c = 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] = c;
|
|
118
118
|
}
|
|
119
|
-
function lo(
|
|
119
|
+
function lo(l, s) {
|
|
120
120
|
ao(s);
|
|
121
|
-
const t =
|
|
122
|
-
let
|
|
123
|
-
t.isInterleavedBufferAttribute && (
|
|
121
|
+
const t = l.attributes.position, e = l.index ? l.index.array : null, i = Ce(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
|
|
122
|
+
let c = 3;
|
|
123
|
+
t.isInterleavedBufferAttribute && (c = t.data.stride);
|
|
124
124
|
const E = ["getX", "getY", "getZ"];
|
|
125
125
|
for (let d = 0; d < i; d++) {
|
|
126
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 * c + a, A = A * c + a, R = R * c + a);
|
|
129
129
|
for (let C = 0; C < 3; C++) {
|
|
130
130
|
let T, F, f;
|
|
131
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]);
|
|
@@ -139,22 +139,22 @@ function lo(c, s) {
|
|
|
139
139
|
}
|
|
140
140
|
return o;
|
|
141
141
|
}
|
|
142
|
-
const wt = 32, ho = (
|
|
142
|
+
const wt = 32, ho = (l, s) => l.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
|
-
})),
|
|
149
|
-
function Eo(
|
|
148
|
+
})), qe = new Float32Array(6);
|
|
149
|
+
function Eo(l, 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(l), n !== -1 && (r = uo(t, e, i, n));
|
|
155
155
|
else if (o === eo) {
|
|
156
|
-
const a = Ae(
|
|
157
|
-
let
|
|
156
|
+
const a = Ae(l);
|
|
157
|
+
let c = Bs * i;
|
|
158
158
|
const E = e * 6, d = (e + i) * 6;
|
|
159
159
|
for (let h = 0; h < 3; h++) {
|
|
160
160
|
const u = s[h], R = (s[h + 3] - u) / wt;
|
|
@@ -172,7 +172,7 @@ function Eo(c, s, t, e, i, o) {
|
|
|
172
172
|
} = m;
|
|
173
173
|
for (let N = 0; N < 3; N++)
|
|
174
174
|
_[N] = 1 / 0, _[N + 3] = -1 / 0, S[N] = 1 / 0, S[N + 3] = -1 / 0, O[N] = 1 / 0, O[N + 3] = -1 / 0;
|
|
175
|
-
|
|
175
|
+
je(f, t, O);
|
|
176
176
|
}
|
|
177
177
|
C.sort(ho);
|
|
178
178
|
let F = i;
|
|
@@ -185,7 +185,7 @@ function Eo(c, s, t, e, i, o) {
|
|
|
185
185
|
const m = t[f + 2 * h];
|
|
186
186
|
for (let O = 0; O < F; O++) {
|
|
187
187
|
const S = C[O];
|
|
188
|
-
m >= S.candidate ?
|
|
188
|
+
m >= S.candidate ? je(f, t, S.rightCacheBounds) : (je(f, t, S.leftCacheBounds), S.count++);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
for (let f = 0; f < F; f++) {
|
|
@@ -195,7 +195,7 @@ function Eo(c, 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 < c && (n = h, c = y, r = m.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
201
201
|
for (let F = 0; F < wt; F++) {
|
|
@@ -209,7 +209,7 @@ function Eo(c, s, t, e, i, o) {
|
|
|
209
209
|
let O = ~~((t[F + 2 * h] - u) / R);
|
|
210
210
|
O >= wt && (O = wt - 1);
|
|
211
211
|
const S = Ut[O];
|
|
212
|
-
S.count++,
|
|
212
|
+
S.count++, je(F, t, S.bounds);
|
|
213
213
|
}
|
|
214
214
|
const C = Ut[wt - 1];
|
|
215
215
|
Bi(C.bounds, C.rightCacheBounds);
|
|
@@ -220,13 +220,13 @@ function Eo(c, s, t, e, i, o) {
|
|
|
220
220
|
let T = 0;
|
|
221
221
|
for (let F = 0; F < wt - 1; F++) {
|
|
222
222
|
const f = Ut[F], m = f.count, O = f.bounds, _ = Ut[F + 1].rightCacheBounds;
|
|
223
|
-
m !== 0 && (T === 0 ? Bi(O,
|
|
223
|
+
m !== 0 && (T === 0 ? Bi(O, qe) : Yi(O, qe, qe)), T += m;
|
|
224
224
|
let N = 0, L = 0;
|
|
225
|
-
T !== 0 && (N = Ae(
|
|
225
|
+
T !== 0 && (N = Ae(qe) / a);
|
|
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 < c && (n = h, c = y, r = f.candidate);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -234,23 +234,23 @@ function Eo(c, 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 uo(
|
|
237
|
+
function uo(l, s, t, e) {
|
|
238
238
|
let i = 0;
|
|
239
239
|
for (let o = s, n = s + t; o < n; o++)
|
|
240
|
-
i +=
|
|
240
|
+
i += l[o * 6 + e * 2];
|
|
241
241
|
return i / t;
|
|
242
242
|
}
|
|
243
|
-
class
|
|
243
|
+
class $e {
|
|
244
244
|
constructor() {
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
function Io(
|
|
247
|
+
function Io(l, s, t, e, i, o) {
|
|
248
248
|
let n = e, r = e + i - 1;
|
|
249
|
-
const a = o.pos,
|
|
249
|
+
const a = o.pos, c = o.axis * 2;
|
|
250
250
|
for (; ; ) {
|
|
251
|
-
for (; n <= r && t[n * 6 +
|
|
251
|
+
for (; n <= r && t[n * 6 + c] < a; )
|
|
252
252
|
n++;
|
|
253
|
-
for (; n <= r && t[r * 6 +
|
|
253
|
+
for (; n <= r && t[r * 6 + c] >= a; )
|
|
254
254
|
r--;
|
|
255
255
|
if (n < r) {
|
|
256
256
|
for (let E = 0; E < 3; E++) {
|
|
@@ -266,17 +266,17 @@ function Io(c, s, t, e, i, o) {
|
|
|
266
266
|
return n;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
function fo(
|
|
269
|
+
function fo(l, s, t, e, i, o) {
|
|
270
270
|
let n = e, r = e + i - 1;
|
|
271
|
-
const a = o.pos,
|
|
271
|
+
const a = o.pos, c = o.axis * 2;
|
|
272
272
|
for (; ; ) {
|
|
273
|
-
for (; n <= r && t[n * 6 +
|
|
273
|
+
for (; n <= r && t[n * 6 + c] < a; )
|
|
274
274
|
n++;
|
|
275
|
-
for (; n <= r && t[r * 6 +
|
|
275
|
+
for (; n <= r && t[r * 6 + c] >= a; )
|
|
276
276
|
r--;
|
|
277
277
|
if (n < r) {
|
|
278
|
-
let E =
|
|
279
|
-
|
|
278
|
+
let E = l[n];
|
|
279
|
+
l[n] = l[r], l[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(c, s, t, e, i, o) {
|
|
|
286
286
|
return n;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function po(
|
|
290
|
-
const t = (
|
|
289
|
+
function po(l, s) {
|
|
290
|
+
const t = (l.index ? l.index.count : l.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(l, s) {
|
|
296
|
+
const t = l.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, c = Ce(t), E = l._indirectBuffer;
|
|
297
297
|
let d = !1;
|
|
298
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
|
-
const f = C[0], m = new
|
|
300
|
+
const f = C[0], m = new $e();
|
|
301
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
|
-
const m = new
|
|
304
|
+
const m = new $e();
|
|
305
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 / c);
|
|
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)
|
|
@@ -319,32 +319,32 @@ function Co(c, s) {
|
|
|
319
319
|
T(m + O), f.offset = m, f.count = O;
|
|
320
320
|
else {
|
|
321
321
|
f.splitAxis = N.axis;
|
|
322
|
-
const M = new
|
|
322
|
+
const M = new $e(), y = m, x = L - m;
|
|
323
323
|
f.left = M, M.boundingData = new Float32Array(6), Vs(p, y, x, M.boundingData, u), F(M, y, x, u, _ + 1);
|
|
324
|
-
const b = new
|
|
324
|
+
const b = new $e(), B = L, H = O - x;
|
|
325
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(l, s) {
|
|
331
|
+
const t = l.geometry;
|
|
332
|
+
s.indirect && (l._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
|
+
)), l._indirectBuffer || oo(t, s);
|
|
335
|
+
const e = Co(l, s);
|
|
336
336
|
let i, o, n;
|
|
337
337
|
const r = [], a = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
|
|
338
338
|
for (let d = 0; d < e.length; d++) {
|
|
339
339
|
const h = e[d];
|
|
340
|
-
let u =
|
|
341
|
-
const p = new a(
|
|
340
|
+
let u = c(h);
|
|
341
|
+
const p = new a(Ts * 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
|
+
l._roots = r;
|
|
345
345
|
return;
|
|
346
|
-
function
|
|
347
|
-
return d.count ? 1 : 1 +
|
|
346
|
+
function c(d) {
|
|
347
|
+
return d.count ? 1 : 1 + c(d.left) + c(d.right);
|
|
348
348
|
}
|
|
349
349
|
function E(d, h) {
|
|
350
350
|
const u = d / 4, p = d / 2, A = !!h.count, R = h.boundingData;
|
|
@@ -352,11 +352,11 @@ function To(c, s) {
|
|
|
352
352
|
i[u + C] = R[C];
|
|
353
353
|
if (A) {
|
|
354
354
|
const C = h.offset, T = h.count;
|
|
355
|
-
return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Ds, d +
|
|
355
|
+
return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Ds, d + Ts;
|
|
356
356
|
} else {
|
|
357
357
|
const C = h.left, T = h.right, F = h.splitAxis;
|
|
358
358
|
let f;
|
|
359
|
-
if (f = E(d +
|
|
359
|
+
if (f = E(d + Ts, C), f / 4 > Math.pow(2, 32))
|
|
360
360
|
throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");
|
|
361
361
|
return o[u + 6] = f / 4, f = E(f, T), o[u + 7] = F, f;
|
|
362
362
|
}
|
|
@@ -387,48 +387,48 @@ class Mt {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
Mt.prototype.setFromBox = function() {
|
|
390
|
-
const
|
|
390
|
+
const l = 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 c = 0; c <= 1; c++)
|
|
396
396
|
for (let E = 0; E <= 1; E++) {
|
|
397
|
-
|
|
398
|
-
const d = t.dot(
|
|
397
|
+
l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * E + o.z * (1 - E);
|
|
398
|
+
const d = t.dot(l);
|
|
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 l = 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,
|
|
407
|
+
const r = i.start, a = l, c = o.start, E = s;
|
|
408
|
+
t.subVectors(r, c), l.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
|
|
409
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
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 l = 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, l);
|
|
417
|
+
let a = l.x, c = l.y;
|
|
418
|
+
if (a >= 0 && a <= 1 && c >= 0 && c <= 1) {
|
|
419
|
+
i.at(a, n), o.at(c, r);
|
|
420
420
|
return;
|
|
421
421
|
} else if (a >= 0 && a <= 1) {
|
|
422
|
-
|
|
422
|
+
c < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
|
|
423
423
|
return;
|
|
424
|
-
} else if (
|
|
424
|
+
} else if (c >= 0 && c <= 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
|
-
|
|
431
|
+
c < 0 ? d = o.start : d = o.end;
|
|
432
432
|
const h = s, u = t;
|
|
433
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);
|
|
@@ -440,10 +440,10 @@ const mo = function() {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
}(), Ro = function() {
|
|
443
|
-
const
|
|
443
|
+
const l = 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: c, b: E, c: d } = n;
|
|
446
|
+
if (e.start = c, e.end = E, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
|
|
447
447
|
return !0;
|
|
448
448
|
const A = n.getPlane(t);
|
|
449
449
|
if (Math.abs(A.distanceToPoint(a)) <= r) {
|
|
@@ -454,8 +454,8 @@ const mo = function() {
|
|
|
454
454
|
return !1;
|
|
455
455
|
};
|
|
456
456
|
}(), Ao = 1e-15;
|
|
457
|
-
function Gs(
|
|
458
|
-
return Math.abs(
|
|
457
|
+
function Gs(l) {
|
|
458
|
+
return Math.abs(l) < Ao;
|
|
459
459
|
}
|
|
460
460
|
class Ft extends Ie {
|
|
461
461
|
constructor(...s) {
|
|
@@ -467,8 +467,8 @@ class Ft extends Ie {
|
|
|
467
467
|
update() {
|
|
468
468
|
const s = this.a, t = this.b, e = this.c, i = this.points, o = this.satAxes, n = this.satBounds, r = o[0], a = n[0];
|
|
469
469
|
this.getNormal(r), a.setFromPoints(r, i);
|
|
470
|
-
const
|
|
471
|
-
|
|
470
|
+
const c = o[1], E = n[1];
|
|
471
|
+
c.subVectors(s, t), E.setFromPoints(c, i);
|
|
472
472
|
const d = o[2], h = n[2];
|
|
473
473
|
d.subVectors(t, e), h.setFromPoints(d, i);
|
|
474
474
|
const u = o[3], p = n[3];
|
|
@@ -476,19 +476,19 @@ class Ft extends Ie {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
Ft.prototype.closestPointToSegment = function() {
|
|
479
|
-
const
|
|
479
|
+
const l = 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, c = this.points;
|
|
482
482
|
let E, d = 1 / 0;
|
|
483
483
|
for (let h = 0; h < 3; h++) {
|
|
484
484
|
const u = (h + 1) % 3;
|
|
485
|
-
t.start.copy(
|
|
485
|
+
t.start.copy(c[h]), t.end.copy(c[u]), Fi(t, i, l, s), E = l.distanceToSquared(s), E < d && (d = E, o && o.copy(l), n && n.copy(s));
|
|
486
486
|
}
|
|
487
|
-
return this.closestPointToPoint(r,
|
|
487
|
+
return this.closestPointToPoint(r, l), E = r.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), E = a.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
|
|
488
488
|
};
|
|
489
489
|
}();
|
|
490
490
|
Ft.prototype.intersectsTriangle = function() {
|
|
491
|
-
const
|
|
491
|
+
const l = new Ft(), s = new Array(3), t = new Array(3), e = new Mt(), i = new Mt(), o = new w(), n = new w(), r = new w(), a = new w(), c = new w(), 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;
|
|
@@ -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() : (l.copy(R), l.update(), R = l);
|
|
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 && (c.subVectors(d.start, h.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), c.subVectors(d.end, h.end), c.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 l = new w();
|
|
566
566
|
return function(t) {
|
|
567
|
-
return this.closestPointToPoint(t,
|
|
567
|
+
return this.closestPointToPoint(t, l), t.distanceTo(l);
|
|
568
568
|
};
|
|
569
569
|
}();
|
|
570
570
|
Ft.prototype.distanceToTriangle = function() {
|
|
571
|
-
const
|
|
571
|
+
const l = 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 c = r || a ? e : null;
|
|
574
|
+
if (this.intersectsTriangle(n, c))
|
|
575
|
+
return (r || a) && (r && c.getCenter(r), a && c.getCenter(a)), 0;
|
|
576
576
|
let E = 1 / 0;
|
|
577
577
|
for (let d = 0; d < 3; d++) {
|
|
578
578
|
let h;
|
|
579
579
|
const u = t[d], p = n[u];
|
|
580
|
-
this.closestPointToPoint(p,
|
|
580
|
+
this.closestPointToPoint(p, l), h = p.distanceToSquared(l), h < E && (E = h, r && r.copy(l), a && a.copy(p));
|
|
581
581
|
const A = this[u];
|
|
582
|
-
n.closestPointToPoint(A,
|
|
582
|
+
n.closestPointToPoint(A, l), h = A.distanceToSquared(l), h < E && (E = h, r && r.copy(A), a && a.copy(l));
|
|
583
583
|
}
|
|
584
584
|
for (let d = 0; d < 3; d++) {
|
|
585
585
|
const h = t[d], u = t[(d + 1) % 3];
|
|
586
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, l, s);
|
|
590
|
+
const C = l.distanceToSquared(s);
|
|
591
|
+
C < E && (E = C, r && r.copy(l), a && a.copy(s));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
return Math.sqrt(E);
|
|
@@ -608,15 +608,15 @@ 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 c = 0; c <= 1; c++)
|
|
612
612
|
for (let E = 0; E <= 1; E++)
|
|
613
613
|
for (let d = 0; d <= 1; d++) {
|
|
614
|
-
const h = 1 *
|
|
615
|
-
u.x =
|
|
614
|
+
const h = 1 * c | 2 * E | 4 * d, u = i[h];
|
|
615
|
+
u.x = c ? 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[
|
|
618
|
+
for (let c = 0; c < 3; c++) {
|
|
619
|
+
const E = n[c], d = o[c], h = 1 << c, u = i[h];
|
|
620
620
|
E.subVectors(r, u), d.setFromPoints(E, i);
|
|
621
621
|
}
|
|
622
622
|
const a = this.alignedSatBounds;
|
|
@@ -624,24 +624,24 @@ at.prototype.update = /* @__PURE__ */ function() {
|
|
|
624
624
|
};
|
|
625
625
|
}();
|
|
626
626
|
at.prototype.intersectsBox = function() {
|
|
627
|
-
const
|
|
627
|
+
const l = 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 (l.min = e.x, l.max = i.x, r[0].isSeparated(l) || (l.min = e.y, l.max = i.y, r[1].isSeparated(l)) || (l.min = e.z, l.max = i.z, r[2].isSeparated(l)))
|
|
632
632
|
return !1;
|
|
633
633
|
for (let a = 0; a < 3; a++) {
|
|
634
|
-
const
|
|
635
|
-
if (
|
|
634
|
+
const c = n[a], E = o[a];
|
|
635
|
+
if (l.setFromBox(c, t), E.isSeparated(l))
|
|
636
636
|
return !1;
|
|
637
637
|
}
|
|
638
638
|
return !0;
|
|
639
639
|
};
|
|
640
640
|
}();
|
|
641
641
|
at.prototype.intersectsTriangle = function() {
|
|
642
|
-
const
|
|
642
|
+
const l = 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() : (l.copy(n), l.update(), n = l);
|
|
645
645
|
const r = this.satBounds, a = this.satAxes;
|
|
646
646
|
s[0] = n.a, s[1] = n.b, s[2] = n.c;
|
|
647
647
|
for (let h = 0; h < 3; h++) {
|
|
@@ -649,9 +649,9 @@ at.prototype.intersectsTriangle = function() {
|
|
|
649
649
|
if (t.setFromPoints(p, s), u.isSeparated(t))
|
|
650
650
|
return !1;
|
|
651
651
|
}
|
|
652
|
-
const
|
|
652
|
+
const c = n.satBounds, E = n.satAxes, d = this.points;
|
|
653
653
|
for (let h = 0; h < 3; h++) {
|
|
654
|
-
const u =
|
|
654
|
+
const u = c[h], p = E[h];
|
|
655
655
|
if (t.setFromPoints(p, d), u.isSeparated(t))
|
|
656
656
|
return !1;
|
|
657
657
|
}
|
|
@@ -672,23 +672,23 @@ at.prototype.closestPointToPoint = /* @__PURE__ */ function() {
|
|
|
672
672
|
};
|
|
673
673
|
}();
|
|
674
674
|
at.prototype.distanceToPoint = function() {
|
|
675
|
-
const
|
|
675
|
+
const l = new w();
|
|
676
676
|
return function(t) {
|
|
677
|
-
return this.closestPointToPoint(t,
|
|
677
|
+
return this.closestPointToPoint(t, l), t.distanceTo(l);
|
|
678
678
|
};
|
|
679
679
|
}();
|
|
680
680
|
at.prototype.distanceToBox = function() {
|
|
681
|
-
const
|
|
682
|
-
return function(n, r = 0, a = null,
|
|
681
|
+
const l = ["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, c = null) {
|
|
683
683
|
if (this.needsUpdate && this.update(), this.intersectsBox(n))
|
|
684
|
-
return (a ||
|
|
684
|
+
return (a || c) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), c && c.copy(i)), 0;
|
|
685
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
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), c && c.copy(i), T < E))
|
|
692
692
|
return Math.sqrt(T);
|
|
693
693
|
}
|
|
694
694
|
let A = 0;
|
|
@@ -697,7 +697,7 @@ at.prototype.distanceToBox = function() {
|
|
|
697
697
|
for (let T = 0; T <= 1; T++) {
|
|
698
698
|
const F = (R + 1) % 3, f = (R + 2) % 3, m = C << F | T << f, O = 1 << R | C << F | T << f, S = u[m], _ = u[O];
|
|
699
699
|
s[A].set(S, _);
|
|
700
|
-
const L =
|
|
700
|
+
const L = l[R], M = l[F], y = l[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), c && c.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), c && c.copy(i), f < E))
|
|
718
718
|
return Math.sqrt(f);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -739,23 +739,23 @@ class Fo extends Oi {
|
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
const It = /* @__PURE__ */ new Fo();
|
|
742
|
-
function ht(
|
|
743
|
-
return s[
|
|
742
|
+
function ht(l, s) {
|
|
743
|
+
return s[l + 15] === 65535;
|
|
744
744
|
}
|
|
745
|
-
function Et(
|
|
746
|
-
return s[
|
|
745
|
+
function Et(l, s) {
|
|
746
|
+
return s[l + 6];
|
|
747
747
|
}
|
|
748
|
-
function ft(
|
|
749
|
-
return s[
|
|
748
|
+
function ft(l, s) {
|
|
749
|
+
return s[l + 14];
|
|
750
750
|
}
|
|
751
|
-
function pt(
|
|
752
|
-
return
|
|
751
|
+
function pt(l) {
|
|
752
|
+
return l + 8;
|
|
753
753
|
}
|
|
754
|
-
function Ct(
|
|
755
|
-
return s[
|
|
754
|
+
function Ct(l, s) {
|
|
755
|
+
return s[l + 6];
|
|
756
756
|
}
|
|
757
|
-
function Dn(
|
|
758
|
-
return s[
|
|
757
|
+
function Dn(l, s) {
|
|
758
|
+
return s[l + 7];
|
|
759
759
|
}
|
|
760
760
|
class Oo {
|
|
761
761
|
constructor() {
|
|
@@ -771,20 +771,20 @@ class Oo {
|
|
|
771
771
|
}
|
|
772
772
|
const Z = new Oo();
|
|
773
773
|
let Yt, fe;
|
|
774
|
-
const te = [],
|
|
775
|
-
function go(
|
|
776
|
-
Yt =
|
|
777
|
-
const n = ri(0,
|
|
778
|
-
Z.clearBuffer(),
|
|
774
|
+
const te = [], Ke = /* @__PURE__ */ new Oi(() => new Ot());
|
|
775
|
+
function go(l, s, t, e, i, o) {
|
|
776
|
+
Yt = Ke.getPrimitive(), fe = Ke.getPrimitive(), te.push(Yt, fe), Z.setBuffer(l._roots[s]);
|
|
777
|
+
const n = ri(0, l.geometry, t, e, i, o);
|
|
778
|
+
Z.clearBuffer(), Ke.releasePrimitive(Yt), Ke.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(l, s, t, e, i = null, o = 0, n = 0) {
|
|
783
|
+
const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
|
|
784
|
+
let E = l * 2;
|
|
785
785
|
if (ht(E, a)) {
|
|
786
|
-
const h = Et(
|
|
787
|
-
return $(
|
|
786
|
+
const h = Et(l, c), u = ft(E, a);
|
|
787
|
+
return $(l, r, Yt), e(h, u, !1, n, o + l, Yt);
|
|
788
788
|
} else {
|
|
789
789
|
let L = function(y) {
|
|
790
790
|
const { uint16Array: x, uint32Array: b } = Z;
|
|
@@ -799,7 +799,7 @@ function ri(c, 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(
|
|
802
|
+
const h = pt(l), u = Ct(l, c);
|
|
803
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
805
|
p = u, A = h;
|
|
@@ -844,10 +844,10 @@ function ri(c, 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(l, 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 (l.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(c, 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 c = Math.sqrt(r);
|
|
863
|
+
return t.point ? t.point.copy(zs) : t.point = zs.clone(), t.distance = c, t.faceIndex = a, t;
|
|
864
864
|
}
|
|
865
|
-
const ee = /* @__PURE__ */ new w(), se = /* @__PURE__ */ new w(), ie = /* @__PURE__ */ new w(),
|
|
866
|
-
function _o(
|
|
865
|
+
const ee = /* @__PURE__ */ new w(), se = /* @__PURE__ */ new w(), ie = /* @__PURE__ */ new w(), Je = /* @__PURE__ */ new pe(), ts = /* @__PURE__ */ new pe(), es = /* @__PURE__ */ new pe(), Vi = /* @__PURE__ */ new w(), Gi = /* @__PURE__ */ new w(), zi = /* @__PURE__ */ new w(), ss = /* @__PURE__ */ new w();
|
|
866
|
+
function _o(l, s, t, e, i, o) {
|
|
867
867
|
let n;
|
|
868
|
-
return o === Xn ? n =
|
|
869
|
-
distance:
|
|
868
|
+
return o === Xn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== Pn, i), n === null ? null : {
|
|
869
|
+
distance: l.origin.distanceTo(i),
|
|
870
870
|
point: i.clone()
|
|
871
871
|
};
|
|
872
872
|
}
|
|
873
|
-
function No(
|
|
873
|
+
function No(l, 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 && (
|
|
875
|
+
const c = _o(l, ee, se, ie, ss, a);
|
|
876
|
+
if (c) {
|
|
877
|
+
e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), c.uv = Ie.getInterpolation(ss, ee, se, ie, Je, ts, es, new pe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), c.uv1 = Ie.getInterpolation(ss, ee, se, ie, Je, ts, es, new pe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), c.normal = Ie.getInterpolation(ss, ee, se, ie, Vi, Gi, zi, new w()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
|
|
878
878
|
const E = {
|
|
879
879
|
a: o,
|
|
880
880
|
b: n,
|
|
@@ -882,53 +882,53 @@ function No(c, s, t, e, i, o, n, r, a) {
|
|
|
882
882
|
normal: new w(),
|
|
883
883
|
materialIndex: 0
|
|
884
884
|
};
|
|
885
|
-
Ie.getNormal(ee, se, ie, E.normal),
|
|
885
|
+
Ie.getNormal(ee, se, ie, E.normal), c.face = E, c.faceIndex = o;
|
|
886
886
|
}
|
|
887
|
-
return
|
|
887
|
+
return c;
|
|
888
888
|
}
|
|
889
|
-
function Us(
|
|
889
|
+
function Us(l, 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: u } =
|
|
892
|
+
const c = l.index;
|
|
893
|
+
l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
|
|
894
|
+
const { position: E, normal: d, uv: h, uv1: u } = l.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(l, s, t, e) {
|
|
898
|
+
const i = l.a, o = l.b, n = l.c;
|
|
899
|
+
let r = s, a = s + 1, c = s + 2;
|
|
900
|
+
t && (r = t.getX(r), a = t.getX(a), c = t.getX(c)), 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(c), n.y = e.getY(c), n.z = e.getZ(c);
|
|
901
901
|
}
|
|
902
|
-
function Po(
|
|
903
|
-
const { geometry: n, _indirectBuffer: r } =
|
|
904
|
-
for (let a = e,
|
|
902
|
+
function Po(l, s, t, e, i, o) {
|
|
903
|
+
const { geometry: n, _indirectBuffer: r } = l;
|
|
904
|
+
for (let a = e, c = e + i; a < c; a++)
|
|
905
905
|
Us(n, s, t, a, o);
|
|
906
906
|
}
|
|
907
|
-
function Lo(
|
|
908
|
-
const { geometry: o, _indirectBuffer: n } =
|
|
907
|
+
function Lo(l, s, t, e, i) {
|
|
908
|
+
const { geometry: o, _indirectBuffer: n } = l;
|
|
909
909
|
let r = 1 / 0, a = null;
|
|
910
|
-
for (let
|
|
910
|
+
for (let c = e, E = e + i; c < E; c++) {
|
|
911
911
|
let d;
|
|
912
|
-
d = Us(o, s, t,
|
|
912
|
+
d = Us(o, s, t, c), 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(l, s, t, e, i, o, n) {
|
|
917
|
+
const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
|
|
918
|
+
for (let E = l, d = s + l; 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, c), 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(l, s = null) {
|
|
926
926
|
s && Array.isArray(s) && (s = new Set(s));
|
|
927
|
-
const t =
|
|
928
|
-
let o, n, r, a,
|
|
929
|
-
const E =
|
|
927
|
+
const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
|
|
928
|
+
let o, n, r, a, c = 0;
|
|
929
|
+
const E = l._roots;
|
|
930
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,
|
|
931
|
+
o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
|
|
932
932
|
function d(h, u, p = !1) {
|
|
933
933
|
const A = h * 2;
|
|
934
934
|
if (r[A + 15] === Ds) {
|
|
@@ -960,72 +960,72 @@ function wo(c, s = null) {
|
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
const Hi = /* @__PURE__ */ new Ot();
|
|
963
|
-
function zt(
|
|
964
|
-
return $(
|
|
963
|
+
function zt(l, s, t, e) {
|
|
964
|
+
return $(l, 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(l, s, t, e, i, o) {
|
|
967
|
+
const { geometry: n, _indirectBuffer: r } = l;
|
|
968
|
+
for (let a = e, c = e + i; a < c; 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(l, s, t, e, i) {
|
|
974
|
+
const { geometry: o, _indirectBuffer: n } = l;
|
|
975
975
|
let r = 1 / 0, a = null;
|
|
976
|
-
for (let
|
|
976
|
+
for (let c = e, E = e + i; c < E; c++) {
|
|
977
977
|
let d;
|
|
978
|
-
d = Us(o, s, t, n ? n[
|
|
978
|
+
d = Us(o, s, t, n ? n[c] : c), 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(l, s, t, e, i, o, n) {
|
|
983
|
+
const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
|
|
984
|
+
for (let E = l, d = s + l; 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, c), 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(l, s, t, e, i) {
|
|
993
|
+
Z.setBuffer(l._roots[s]), ai(0, l, t, e, i), Z.clearBuffer();
|
|
994
994
|
}
|
|
995
|
-
function ai(
|
|
996
|
-
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a =
|
|
995
|
+
function ai(l, s, t, e, i) {
|
|
996
|
+
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
997
997
|
if (ht(a, n)) {
|
|
998
|
-
const E = Et(
|
|
998
|
+
const E = Et(l, 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(l);
|
|
1002
1002
|
zt(E, o, e, ki) && ai(E, s, t, e, i);
|
|
1003
|
-
const d = Ct(
|
|
1003
|
+
const d = Ct(l, 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(l, s, t, e) {
|
|
1009
|
+
Z.setBuffer(l._roots[s]);
|
|
1010
|
+
const i = ci(0, l, t, e);
|
|
1011
1011
|
return Z.clearBuffer(), i;
|
|
1012
1012
|
}
|
|
1013
|
-
function ci(
|
|
1013
|
+
function ci(l, s, t, e) {
|
|
1014
1014
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1015
|
-
let r =
|
|
1015
|
+
let r = l * 2;
|
|
1016
1016
|
if (ht(r, o)) {
|
|
1017
|
-
const
|
|
1018
|
-
return Lo(s, t, e,
|
|
1017
|
+
const c = Et(l, n), E = ft(r, o);
|
|
1018
|
+
return Lo(s, t, e, c, E);
|
|
1019
1019
|
} else {
|
|
1020
|
-
const
|
|
1020
|
+
const c = Dn(l, n), E = bo[c], h = e.direction[E] >= 0;
|
|
1021
1021
|
let u, p;
|
|
1022
|
-
h ? (u = pt(
|
|
1022
|
+
h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
|
|
1023
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 + c] : (
|
|
1027
1027
|
// min bounding data
|
|
1028
|
-
F >= i[p +
|
|
1028
|
+
F >= i[p + c + 3]
|
|
1029
1029
|
))
|
|
1030
1030
|
return R;
|
|
1031
1031
|
}
|
|
@@ -1033,20 +1033,20 @@ function ci(c, s, t, e) {
|
|
|
1033
1033
|
return R && T ? R.distance <= T.distance ? R : T : R || T || null;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
const
|
|
1037
|
-
function Bo(
|
|
1038
|
-
Z.setBuffer(
|
|
1039
|
-
const i = li(0,
|
|
1036
|
+
const is = /* @__PURE__ */ new Ot(), ne = /* @__PURE__ */ new Ft(), oe = /* @__PURE__ */ new Ft(), Oe = /* @__PURE__ */ new yt(), Xi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
|
|
1037
|
+
function Bo(l, s, t, e) {
|
|
1038
|
+
Z.setBuffer(l._roots[s]);
|
|
1039
|
+
const i = li(0, l, t, e);
|
|
1040
1040
|
return Z.clearBuffer(), i;
|
|
1041
1041
|
}
|
|
1042
|
-
function li(
|
|
1042
|
+
function li(l, s, t, e, i = null) {
|
|
1043
1043
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1044
|
-
let a =
|
|
1044
|
+
let a = l * 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, u = t.index, p = t.attributes.position, A = Et(
|
|
1046
|
+
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
|
|
1047
1047
|
if (Oe.copy(e).invert(), t.boundsTree)
|
|
1048
|
-
return $(
|
|
1049
|
-
intersectsBounds: (T) =>
|
|
1048
|
+
return $(l, o, ns), ns.matrix.copy(Oe), ns.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1049
|
+
intersectsBounds: (T) => ns.intersectsBox(T),
|
|
1050
1050
|
intersectsTriangle: (T) => {
|
|
1051
1051
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
1052
1052
|
for (let F = A * 3, f = (R + A) * 3; F < f; F += 3)
|
|
@@ -1062,18 +1062,18 @@ function li(c, s, t, e, i = null) {
|
|
|
1062
1062
|
return !0;
|
|
1063
1063
|
}
|
|
1064
1064
|
} else {
|
|
1065
|
-
const E =
|
|
1066
|
-
return $(E, o,
|
|
1065
|
+
const E = l + 8, d = r[l + 6];
|
|
1066
|
+
return $(E, o, is), !!(i.intersectsBox(is) && li(E, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && li(d, s, t, e, i)));
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
|
-
const
|
|
1070
|
-
function Ho(
|
|
1069
|
+
const os = /* @__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(l, 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 = l.geometry, a = r.attributes.position, c = 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
|
|
1076
|
+
return os.copy(t).invert(), ge.matrix.copy(os), l.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,
|
|
@@ -1086,7 +1086,7 @@ function Ho(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1086
1086
|
for (let L = _, M = _ + N; L < M; L++) {
|
|
1087
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,
|
|
1089
|
+
et(h, 3 * y, c, a), h.needsUpdate = !0;
|
|
1090
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;
|
|
@@ -1099,7 +1099,7 @@ function Ho(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1099
1099
|
for (let _ = 0, N = S; _ < N; _++) {
|
|
1100
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,
|
|
1102
|
+
et(h, 3 * L, c, a), h.needsUpdate = !0;
|
|
1103
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;
|
|
@@ -1108,22 +1108,22 @@ function Ho(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
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(
|
|
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(os), A.applyMatrix4(os), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
|
|
1112
1112
|
}
|
|
1113
|
-
function ko(
|
|
1113
|
+
function ko(l, s = null) {
|
|
1114
1114
|
s && Array.isArray(s) && (s = new Set(s));
|
|
1115
|
-
const t =
|
|
1116
|
-
let o, n, r, a,
|
|
1117
|
-
const E =
|
|
1115
|
+
const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
|
|
1116
|
+
let o, n, r, a, c = 0;
|
|
1117
|
+
const E = l._roots;
|
|
1118
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,
|
|
1119
|
+
o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
|
|
1120
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 * l.resolveTriangleIndex(N);
|
|
1127
1127
|
for (let y = 0; y < 3; y++) {
|
|
1128
1128
|
let x = M + y;
|
|
1129
1129
|
x = e ? e[x] : x;
|
|
@@ -1152,43 +1152,43 @@ function ko(c, s = null) {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
const Zi = /* @__PURE__ */ new w();
|
|
1155
|
-
function Wo(
|
|
1156
|
-
Z.setBuffer(
|
|
1155
|
+
function Wo(l, s, t, e, i) {
|
|
1156
|
+
Z.setBuffer(l._roots[s]), hi(0, l, t, e, i), Z.clearBuffer();
|
|
1157
1157
|
}
|
|
1158
|
-
function hi(
|
|
1159
|
-
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a =
|
|
1158
|
+
function hi(l, s, t, e, i) {
|
|
1159
|
+
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
1160
1160
|
if (ht(a, n)) {
|
|
1161
|
-
const E = Et(
|
|
1161
|
+
const E = Et(l, 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(l);
|
|
1165
1165
|
zt(E, o, e, Zi) && hi(E, s, t, e, i);
|
|
1166
|
-
const d = Ct(
|
|
1166
|
+
const d = Ct(l, 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(l, s, t, e) {
|
|
1172
|
+
Z.setBuffer(l._roots[s]);
|
|
1173
|
+
const i = Ei(0, l, t, e);
|
|
1174
1174
|
return Z.clearBuffer(), i;
|
|
1175
1175
|
}
|
|
1176
|
-
function Ei(
|
|
1176
|
+
function Ei(l, s, t, e) {
|
|
1177
1177
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1178
|
-
let r =
|
|
1178
|
+
let r = l * 2;
|
|
1179
1179
|
if (ht(r, o)) {
|
|
1180
|
-
const
|
|
1181
|
-
return Do(s, t, e,
|
|
1180
|
+
const c = Et(l, n), E = ft(r, o);
|
|
1181
|
+
return Do(s, t, e, c, E);
|
|
1182
1182
|
} else {
|
|
1183
|
-
const
|
|
1183
|
+
const c = Dn(l, n), E = Xo[c], h = e.direction[E] >= 0;
|
|
1184
1184
|
let u, p;
|
|
1185
|
-
h ? (u = pt(
|
|
1185
|
+
h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
|
|
1186
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 + c] : (
|
|
1190
1190
|
// min bounding data
|
|
1191
|
-
F >= i[p +
|
|
1191
|
+
F >= i[p + c + 3]
|
|
1192
1192
|
))
|
|
1193
1193
|
return R;
|
|
1194
1194
|
}
|
|
@@ -1196,20 +1196,20 @@ function Ei(c, s, t, e) {
|
|
|
1196
1196
|
return R && T ? R.distance <= T.distance ? R : T : R || T || null;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
const
|
|
1200
|
-
function Qo(
|
|
1201
|
-
Z.setBuffer(
|
|
1202
|
-
const i = di(0,
|
|
1199
|
+
const rs = /* @__PURE__ */ new Ot(), re = /* @__PURE__ */ new Ft(), ae = /* @__PURE__ */ new Ft(), Se = /* @__PURE__ */ new yt(), ji = /* @__PURE__ */ new at(), as = /* @__PURE__ */ new at();
|
|
1200
|
+
function Qo(l, s, t, e) {
|
|
1201
|
+
Z.setBuffer(l._roots[s]);
|
|
1202
|
+
const i = di(0, l, t, e);
|
|
1203
1203
|
return Z.clearBuffer(), i;
|
|
1204
1204
|
}
|
|
1205
|
-
function di(
|
|
1205
|
+
function di(l, s, t, e, i = null) {
|
|
1206
1206
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1207
|
-
let a =
|
|
1207
|
+
let a = l * 2;
|
|
1208
1208
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, e), i = ji), ht(a, n)) {
|
|
1209
|
-
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(
|
|
1209
|
+
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
|
|
1210
1210
|
if (Se.copy(e).invert(), t.boundsTree)
|
|
1211
|
-
return $(
|
|
1212
|
-
intersectsBounds: (T) =>
|
|
1211
|
+
return $(l, o, as), as.matrix.copy(Se), as.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1212
|
+
intersectsBounds: (T) => as.intersectsBox(T),
|
|
1213
1213
|
intersectsTriangle: (T) => {
|
|
1214
1214
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
1215
1215
|
for (let F = A, f = R + A; F < f; F++)
|
|
@@ -1226,18 +1226,18 @@ function di(c, s, t, e, i = null) {
|
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
}
|
|
1228
1228
|
} else {
|
|
1229
|
-
const E =
|
|
1230
|
-
return $(E, o,
|
|
1229
|
+
const E = l + 8, d = r[l + 6];
|
|
1230
|
+
return $(E, o, rs), !!(i.intersectsBox(rs) && di(E, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && di(d, s, t, e, i)));
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
|
-
const
|
|
1234
|
-
function Jo(
|
|
1233
|
+
const cs = /* @__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(l, 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 = l.geometry, a = r.attributes.position, c = 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
|
|
1240
|
+
return cs.copy(t).invert(), _e.matrix.copy(cs), l.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,
|
|
@@ -1252,8 +1252,8 @@ function Jo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1252
1252
|
const y = S.resolveTriangleIndex(L);
|
|
1253
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,
|
|
1255
|
+
const B = l.resolveTriangleIndex(x);
|
|
1256
|
+
et(h, 3 * B, c, a), h.needsUpdate = !0;
|
|
1257
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;
|
|
@@ -1266,8 +1266,8 @@ function Jo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1266
1266
|
for (let _ = 0, N = S; _ < N; _++) {
|
|
1267
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,
|
|
1269
|
+
const y = l.resolveTriangleIndex(L);
|
|
1270
|
+
et(h, 3 * y, c, a), h.needsUpdate = !0;
|
|
1271
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;
|
|
@@ -1276,71 +1276,71 @@ function Jo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
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(
|
|
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(cs), A.applyMatrix4(cs), 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
|
-
const be = new Z.constructor(),
|
|
1284
|
+
const be = new Z.constructor(), As = 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(l, 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 = l._roots, o = s._roots;
|
|
1291
1291
|
let n, r = 0, a = 0;
|
|
1292
|
-
const
|
|
1292
|
+
const c = 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 u = 0, p = o.length; u < p && (
|
|
1296
|
+
$(0, be.float32Array, h), h.applyMatrix4(c);
|
|
1297
|
+
for (let u = 0, p = o.length; u < p && (As.setBuffer(o[E]), n = Tt(
|
|
1298
1298
|
0,
|
|
1299
1299
|
0,
|
|
1300
1300
|
t,
|
|
1301
|
-
|
|
1301
|
+
c,
|
|
1302
1302
|
e,
|
|
1303
1303
|
r,
|
|
1304
1304
|
a,
|
|
1305
1305
|
0,
|
|
1306
1306
|
0,
|
|
1307
1307
|
h
|
|
1308
|
-
),
|
|
1308
|
+
), As.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(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
1316
1316
|
let d, h;
|
|
1317
|
-
E ? (d =
|
|
1318
|
-
const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, R = h.float32Array, C = h.uint32Array, T = h.uint16Array, F =
|
|
1317
|
+
E ? (d = As, h = be) : (d = be, h = As);
|
|
1318
|
+
const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, R = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = l * 2, f = s * 2, m = ht(F, A), O = ht(f, T);
|
|
1319
1319
|
let S = !1;
|
|
1320
1320
|
if (O && m)
|
|
1321
1321
|
E ? S = i(
|
|
1322
1322
|
Et(s, C),
|
|
1323
1323
|
ft(s * 2, T),
|
|
1324
|
-
Et(
|
|
1325
|
-
ft(
|
|
1324
|
+
Et(l, p),
|
|
1325
|
+
ft(l * 2, A),
|
|
1326
1326
|
a,
|
|
1327
1327
|
n + s,
|
|
1328
1328
|
r,
|
|
1329
|
-
o +
|
|
1329
|
+
o + l
|
|
1330
1330
|
) : S = i(
|
|
1331
|
-
Et(
|
|
1332
|
-
ft(
|
|
1331
|
+
Et(l, p),
|
|
1332
|
+
ft(l * 2, A),
|
|
1333
1333
|
Et(s, C),
|
|
1334
1334
|
ft(s * 2, T),
|
|
1335
1335
|
r,
|
|
1336
|
-
o +
|
|
1336
|
+
o + l,
|
|
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(
|
|
1343
|
+
const N = pt(l), L = Ct(l, p);
|
|
1344
1344
|
$(N, u, ce), $(L, u, le);
|
|
1345
1345
|
const M = _.intersectsBox(ce), y = _.intersectsBox(le);
|
|
1346
1346
|
S = M && Tt(
|
|
@@ -1371,10 +1371,10 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = 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 = c.intersectsBox(Ws), M = c.intersectsBox(Xs);
|
|
1375
1375
|
if (L && M)
|
|
1376
1376
|
S = Tt(
|
|
1377
|
-
|
|
1377
|
+
l,
|
|
1378
1378
|
_,
|
|
1379
1379
|
t,
|
|
1380
1380
|
e,
|
|
@@ -1383,10 +1383,10 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
|
1383
1383
|
n,
|
|
1384
1384
|
r,
|
|
1385
1385
|
a + 1,
|
|
1386
|
-
|
|
1386
|
+
c,
|
|
1387
1387
|
E
|
|
1388
1388
|
) || Tt(
|
|
1389
|
-
|
|
1389
|
+
l,
|
|
1390
1390
|
N,
|
|
1391
1391
|
t,
|
|
1392
1392
|
e,
|
|
@@ -1395,13 +1395,13 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
|
1395
1395
|
n,
|
|
1396
1396
|
r,
|
|
1397
1397
|
a + 1,
|
|
1398
|
-
|
|
1398
|
+
c,
|
|
1399
1399
|
E
|
|
1400
1400
|
);
|
|
1401
1401
|
else if (L)
|
|
1402
1402
|
if (m)
|
|
1403
1403
|
S = Tt(
|
|
1404
|
-
|
|
1404
|
+
l,
|
|
1405
1405
|
_,
|
|
1406
1406
|
t,
|
|
1407
1407
|
e,
|
|
@@ -1410,13 +1410,13 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
|
1410
1410
|
n,
|
|
1411
1411
|
r,
|
|
1412
1412
|
a + 1,
|
|
1413
|
-
|
|
1413
|
+
c,
|
|
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(
|
|
1419
|
+
const x = pt(l), b = Ct(l, p);
|
|
1420
1420
|
$(x, u, ce), $(b, u, le);
|
|
1421
1421
|
const B = y.intersectsBox(ce), H = y.intersectsBox(le);
|
|
1422
1422
|
S = B && Tt(
|
|
@@ -1448,7 +1448,7 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
|
1448
1448
|
else if (M)
|
|
1449
1449
|
if (m)
|
|
1450
1450
|
S = Tt(
|
|
1451
|
-
|
|
1451
|
+
l,
|
|
1452
1452
|
N,
|
|
1453
1453
|
t,
|
|
1454
1454
|
e,
|
|
@@ -1457,13 +1457,13 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
|
1457
1457
|
n,
|
|
1458
1458
|
r,
|
|
1459
1459
|
a + 1,
|
|
1460
|
-
|
|
1460
|
+
c,
|
|
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(
|
|
1466
|
+
const x = pt(l), b = Ct(l, p);
|
|
1467
1467
|
$(x, u, ce), $(b, u, le);
|
|
1468
1468
|
const B = y.intersectsBox(ce), H = y.intersectsBox(le);
|
|
1469
1469
|
S = B && Tt(
|
|
@@ -1495,7 +1495,7 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
return S;
|
|
1497
1497
|
}
|
|
1498
|
-
const
|
|
1498
|
+
const ls = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new Ot();
|
|
1499
1499
|
class gi {
|
|
1500
1500
|
static serialize(s, t = {}) {
|
|
1501
1501
|
t = {
|
|
@@ -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 c = new Nn(s.index, 1, !1);
|
|
1528
|
+
t.setIndex(c);
|
|
1529
1529
|
} else
|
|
1530
1530
|
a.array !== i && (a.array.set(i), a.needsUpdate = !0);
|
|
1531
1531
|
}
|
|
@@ -1565,21 +1565,21 @@ 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 c = r * 2, E = o[c + 15] === Ds;
|
|
1569
1569
|
if (E) {
|
|
1570
|
-
const d = i[r + 6], h = o[
|
|
1570
|
+
const d = i[r + 6], h = o[c + 14];
|
|
1571
1571
|
s(a, E, new Float32Array(e, r * 4, 6), d, h);
|
|
1572
1572
|
} else {
|
|
1573
|
-
const d = r +
|
|
1573
|
+
const d = r + Ts / 4, h = i[r + 6], u = i[r + 7];
|
|
1574
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, c = n ? t.side : t, E = this.indirect ? Wo : xo;
|
|
1581
1581
|
for (let d = 0, h = e.length; d < h; d++) {
|
|
1582
|
-
const u = r ? t[a[d].materialIndex].side :
|
|
1582
|
+
const u = r ? t[a[d].materialIndex].side : c, p = o.length;
|
|
1583
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++)
|
|
@@ -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, c = o ? t.side : t, E = this.indirect ? Zo : vo;
|
|
1595
1595
|
for (let d = 0, h = e.length; d < h; d++) {
|
|
1596
|
-
const u = n ? t[a[d].materialIndex].side :
|
|
1596
|
+
const u = n ? t[a[d].materialIndex].side : c, 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;
|
|
@@ -1618,13 +1618,13 @@ class gi {
|
|
|
1618
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
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,
|
|
1621
|
+
let a = !1, c = 0;
|
|
1622
1622
|
const E = this._roots;
|
|
1623
1623
|
for (let d = 0, h = E.length; d < h; d++) {
|
|
1624
1624
|
const u = E[d];
|
|
1625
|
-
if (a = go(this, d, o, n, i,
|
|
1625
|
+
if (a = go(this, d, o, n, i, c), a)
|
|
1626
1626
|
break;
|
|
1627
|
-
|
|
1627
|
+
c += u.byteLength;
|
|
1628
1628
|
}
|
|
1629
1629
|
return It.releasePrimitive(t), a;
|
|
1630
1630
|
}
|
|
@@ -1633,7 +1633,7 @@ class gi {
|
|
|
1633
1633
|
intersectsRanges: i,
|
|
1634
1634
|
intersectsTriangles: o
|
|
1635
1635
|
} = e;
|
|
1636
|
-
const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position,
|
|
1636
|
+
const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, c = this.indirect ? (p) => {
|
|
1637
1637
|
const A = this.resolveTriangleIndex(p);
|
|
1638
1638
|
et(n, A * 3, r, a);
|
|
1639
1639
|
} : (p) => {
|
|
@@ -1649,7 +1649,7 @@ class gi {
|
|
|
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 (c(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, O))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
1655
1655
|
return !1;
|
|
@@ -1666,10 +1666,10 @@ class gi {
|
|
|
1666
1666
|
}
|
|
1667
1667
|
/* Derived Cast Functions */
|
|
1668
1668
|
intersectsBox(s, t) {
|
|
1669
|
-
return
|
|
1669
|
+
return ls.set(s.min, s.max, t), ls.needsUpdate = !0, this.shapecast(
|
|
1670
1670
|
{
|
|
1671
|
-
intersectsBounds: (e) =>
|
|
1672
|
-
intersectsTriangle: (e) =>
|
|
1671
|
+
intersectsBounds: (e) => ls.intersectsBox(e),
|
|
1672
|
+
intersectsTriangle: (e) => ls.intersectsTriangle(e)
|
|
1673
1673
|
}
|
|
1674
1674
|
);
|
|
1675
1675
|
}
|
|
@@ -1707,36 +1707,36 @@ class gi {
|
|
|
1707
1707
|
}), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
function $i(
|
|
1711
|
-
return
|
|
1710
|
+
function $i(l, s, t) {
|
|
1711
|
+
return l === null || (l.point.applyMatrix4(s.matrixWorld), l.distance = l.point.distanceTo(t.ray.origin), l.object = s, l.distance < t.near || l.distance > t.far) ? null : l;
|
|
1712
1712
|
}
|
|
1713
1713
|
const Qs = /* @__PURE__ */ new Zn(), Ki = /* @__PURE__ */ new yt(), sr = v.prototype.raycast;
|
|
1714
|
-
function ir(
|
|
1714
|
+
function ir(l, 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(l.ray).applyMatrix4(Ki);
|
|
1719
1719
|
const t = this.geometry.boundsTree;
|
|
1720
|
-
if (
|
|
1721
|
-
const e = $i(t.raycastFirst(Qs, this.material), this,
|
|
1720
|
+
if (l.firstHitOnly === !0) {
|
|
1721
|
+
const e = $i(t.raycastFirst(Qs, this.material), this, l);
|
|
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, l);
|
|
1727
1727
|
n && s.push(n);
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
} else
|
|
1731
|
-
sr.call(this,
|
|
1731
|
+
sr.call(this, l, s);
|
|
1732
1732
|
}
|
|
1733
|
-
function nr(
|
|
1734
|
-
return this.boundsTree = new gi(this,
|
|
1733
|
+
function nr(l) {
|
|
1734
|
+
return this.boundsTree = new gi(this, l), this.boundsTree;
|
|
1735
1735
|
}
|
|
1736
1736
|
function or() {
|
|
1737
1737
|
this.boundsTree = null;
|
|
1738
1738
|
}
|
|
1739
|
-
class
|
|
1739
|
+
class D {
|
|
1740
1740
|
constructor() {
|
|
1741
1741
|
/** Triggers all the callbacks assigned to this event. */
|
|
1742
1742
|
I(this, "trigger", (s) => {
|
|
@@ -1815,7 +1815,7 @@ class _i extends Si {
|
|
|
1815
1815
|
constructor(t) {
|
|
1816
1816
|
super(t);
|
|
1817
1817
|
I(this, "worlds", /* @__PURE__ */ new Map());
|
|
1818
|
-
I(this, "onWorldChanged", new
|
|
1818
|
+
I(this, "onWorldChanged", new D());
|
|
1819
1819
|
I(this, "currentWorld", null);
|
|
1820
1820
|
this.onWorldChanged.add(({ world: e, action: i }) => {
|
|
1821
1821
|
i === "removed" && this.worlds.delete(e.uuid);
|
|
@@ -1833,17 +1833,17 @@ class ar extends _i {
|
|
|
1833
1833
|
constructor() {
|
|
1834
1834
|
super(...arguments);
|
|
1835
1835
|
/** {@link Updateable.onBeforeUpdate} */
|
|
1836
|
-
I(this, "onAfterUpdate", new
|
|
1836
|
+
I(this, "onAfterUpdate", new D());
|
|
1837
1837
|
/** {@link Updateable.onAfterUpdate} */
|
|
1838
|
-
I(this, "onBeforeUpdate", new
|
|
1838
|
+
I(this, "onBeforeUpdate", new D());
|
|
1839
1839
|
/** {@link Disposable.onDisposed} */
|
|
1840
|
-
I(this, "onDisposed", new
|
|
1841
|
-
I(this, "onResize", new
|
|
1840
|
+
I(this, "onDisposed", new D());
|
|
1841
|
+
I(this, "onResize", new D());
|
|
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
|
-
I(this, "onClippingPlanesUpdated", new
|
|
1846
|
+
I(this, "onClippingPlanesUpdated", new D());
|
|
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.
|
|
@@ -1936,7 +1936,7 @@ class cr extends _i {
|
|
|
1936
1936
|
constructor(t) {
|
|
1937
1937
|
super(t);
|
|
1938
1938
|
/** {@link Disposable.onDisposed} */
|
|
1939
|
-
I(this, "onDisposed", new
|
|
1939
|
+
I(this, "onDisposed", new D());
|
|
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
|
|
1951
|
+
const ms = 0, lr = 1, hr = new w(), Ji = new Lt(), js = new Ai(), tn = new w(), hs = 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], c = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
|
|
1991
|
+
if (c > 0 && E >= 0)
|
|
1992
1992
|
return null;
|
|
1993
|
-
const d = E !== 0 ? -
|
|
1993
|
+
const d = E !== 0 ? -c / 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
|
}
|
|
@@ -2044,7 +2044,7 @@ class Er {
|
|
|
2044
2044
|
let i = this.tolerance, o = null;
|
|
2045
2045
|
for (let n = 0; n < s.length; n++) {
|
|
2046
2046
|
const r = s[n];
|
|
2047
|
-
if (r.mark ===
|
|
2047
|
+
if (r.mark === ms) {
|
|
2048
2048
|
const a = r.distanceToPoint(t.point);
|
|
2049
2049
|
if (a > i && (i = a, o = r), i > 1e3 * this.tolerance)
|
|
2050
2050
|
break;
|
|
@@ -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 c = 0; c < 3; c++)
|
|
2067
|
+
a.getComponent(c) < s.getComponent(c) && (s.setComponent(c, a.getComponent(c)), e[c] = r);
|
|
2068
|
+
for (let c = 0; c < 3; c++)
|
|
2069
|
+
a.getComponent(c) > t.getComponent(c) && (t.setComponent(c, a.getComponent(c)), i[c] = 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
|
}
|
|
@@ -2080,20 +2080,20 @@ class Er {
|
|
|
2080
2080
|
u > o && (o = u, n = h);
|
|
2081
2081
|
}
|
|
2082
2082
|
const r = e[n], a = i[n];
|
|
2083
|
-
let
|
|
2083
|
+
let c, E;
|
|
2084
2084
|
o = 0, Ji.set(r.point, a.point);
|
|
2085
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, c = p);
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
o = -1, js.setFromCoplanarPoints(r.point, a.point,
|
|
2093
|
+
o = -1, js.setFromCoplanarPoints(r.point, a.point, c.point);
|
|
2094
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 !== c) {
|
|
2097
2097
|
const A = Math.abs(js.distanceToPoint(p.point));
|
|
2098
2098
|
A > o && (o = A, E = p);
|
|
2099
2099
|
}
|
|
@@ -2101,10 +2101,10 @@ 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, c),
|
|
2105
2105
|
Rt.create(E, a, r),
|
|
2106
|
-
Rt.create(E,
|
|
2107
|
-
Rt.create(E, r,
|
|
2106
|
+
Rt.create(E, c, a),
|
|
2107
|
+
Rt.create(E, r, c)
|
|
2108
2108
|
);
|
|
2109
2109
|
for (let h = 0; h < 3; h++) {
|
|
2110
2110
|
const u = (h + 1) % 3;
|
|
@@ -2112,10 +2112,10 @@ class Er {
|
|
|
2112
2112
|
}
|
|
2113
2113
|
} else {
|
|
2114
2114
|
d.push(
|
|
2115
|
-
Rt.create(r,
|
|
2115
|
+
Rt.create(r, c, a),
|
|
2116
2116
|
Rt.create(E, r, a),
|
|
2117
|
-
Rt.create(E, a,
|
|
2118
|
-
Rt.create(E,
|
|
2117
|
+
Rt.create(E, a, c),
|
|
2118
|
+
Rt.create(E, c, r)
|
|
2119
2119
|
);
|
|
2120
2120
|
for (let h = 0; h < 3; h++) {
|
|
2121
2121
|
const u = (h + 1) % 3;
|
|
@@ -2126,7 +2126,7 @@ class Er {
|
|
|
2126
2126
|
this.faces.push(d[h]);
|
|
2127
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 !== c && p !== E) {
|
|
2130
2130
|
o = this.tolerance;
|
|
2131
2131
|
let A = null;
|
|
2132
2132
|
for (let R = 0; R < 4; R++) {
|
|
@@ -2143,7 +2143,7 @@ class Er {
|
|
|
2143
2143
|
const s = [];
|
|
2144
2144
|
for (let t = 0; t < this.faces.length; t++) {
|
|
2145
2145
|
const e = this.faces[t];
|
|
2146
|
-
e.mark ===
|
|
2146
|
+
e.mark === ms && s.push(e);
|
|
2147
2147
|
}
|
|
2148
2148
|
return this.faces = s, this;
|
|
2149
2149
|
}
|
|
@@ -2169,7 +2169,7 @@ class Er {
|
|
|
2169
2169
|
t === null ? o = t = e.getEdge(0) : o = t.next;
|
|
2170
2170
|
do {
|
|
2171
2171
|
const n = o.twin, r = n.face;
|
|
2172
|
-
r.mark ===
|
|
2172
|
+
r.mark === ms && (r.distanceToPoint(s) > this.tolerance ? this.computeHorizon(s, n, r, i) : i.push(o)), o = o.next;
|
|
2173
2173
|
} while (o !== t);
|
|
2174
2174
|
return this;
|
|
2175
2175
|
}
|
|
@@ -2206,7 +2206,7 @@ class Er {
|
|
|
2206
2206
|
}
|
|
2207
2207
|
class Rt {
|
|
2208
2208
|
constructor() {
|
|
2209
|
-
this.normal = new w(), this.midpoint = new w(), this.area = 0, this.constant = 0, this.outside = null, this.mark =
|
|
2209
|
+
this.normal = new w(), this.midpoint = new w(), this.area = 0, this.constant = 0, this.outside = null, this.mark = ms, this.edge = null;
|
|
2210
2210
|
}
|
|
2211
2211
|
static create(s, t, e) {
|
|
2212
2212
|
const i = new Rt(), o = new qs(s, i), n = new qs(t, i), r = new qs(e, i);
|
|
@@ -2222,7 +2222,7 @@ class Rt {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
compute() {
|
|
2224
2224
|
const s = this.edge.tail(), t = this.edge.head(), e = this.edge.next.head();
|
|
2225
|
-
return
|
|
2225
|
+
return hs.set(s.point, t.point, e.point), hs.getNormal(this.normal), hs.getMidpoint(this.midpoint), this.area = hs.getArea(), this.constant = this.normal.dot(this.midpoint), this;
|
|
2226
2226
|
}
|
|
2227
2227
|
distanceToPoint(s) {
|
|
2228
2228
|
return this.normal.dot(s) - this.constant;
|
|
@@ -2299,18 +2299,18 @@ class en {
|
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
2301
2301
|
const ui = [2, 2, 1], Ii = [1, 0, 0];
|
|
2302
|
-
function Nt(
|
|
2303
|
-
return
|
|
2302
|
+
function Nt(l, s) {
|
|
2303
|
+
return l * 3 + s;
|
|
2304
2304
|
}
|
|
2305
|
-
function ur(
|
|
2306
|
-
const s =
|
|
2305
|
+
function ur(l) {
|
|
2306
|
+
const s = l.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 Ir(
|
|
2313
|
-
const s =
|
|
2312
|
+
function Ir(l) {
|
|
2313
|
+
const s = l.elements;
|
|
2314
2314
|
let t = 0;
|
|
2315
2315
|
for (let e = 0; e < 3; e++) {
|
|
2316
2316
|
const i = s[Nt(ui[e], Ii[e])];
|
|
@@ -2318,35 +2318,35 @@ function Ir(c) {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
return Math.sqrt(t);
|
|
2320
2320
|
}
|
|
2321
|
-
function fr(
|
|
2321
|
+
function fr(l, s) {
|
|
2322
2322
|
let t = 0, e = 1;
|
|
2323
|
-
const i =
|
|
2324
|
-
for (let
|
|
2325
|
-
const E = Math.abs(i[Nt(ui[
|
|
2326
|
-
E > t && (t = E, e =
|
|
2323
|
+
const i = l.elements;
|
|
2324
|
+
for (let c = 0; c < 3; c++) {
|
|
2325
|
+
const E = Math.abs(i[Nt(ui[c], Ii[c])]);
|
|
2326
|
+
E > t && (t = E, e = c);
|
|
2327
2327
|
}
|
|
2328
2328
|
let o = 1, n = 0;
|
|
2329
2329
|
const r = Ii[e], a = ui[e];
|
|
2330
2330
|
if (Math.abs(i[Nt(a, r)]) > Number.EPSILON) {
|
|
2331
|
-
const
|
|
2331
|
+
const c = i[Nt(a, a)], E = i[Nt(r, r)], d = i[Nt(a, r)], h = (c - E) / 2 / d;
|
|
2332
2332
|
let u;
|
|
2333
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(l, 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 && Ir(n) >
|
|
2340
|
+
s.unitary.identity(), s.diagonal.copy(l);
|
|
2341
|
+
const o = s.unitary, n = s.diagonal, r = new g.Matrix3(), a = new g.Matrix3(), c = Number.EPSILON * ur(n);
|
|
2342
|
+
for (; e < i && Ir(n) > c; )
|
|
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(l) {
|
|
2347
2347
|
const s = [];
|
|
2348
|
-
for (let it = 0; it <
|
|
2349
|
-
const Zt =
|
|
2348
|
+
for (let it = 0; it < l.length - 2; it += 3) {
|
|
2349
|
+
const Zt = l[it], tt = l[it + 1], Jt = l[it + 2];
|
|
2350
2350
|
s.push(new g.Vector3(Zt, tt, Jt));
|
|
2351
2351
|
}
|
|
2352
2352
|
const t = new Er();
|
|
@@ -2363,17 +2363,17 @@ function Cr(c) {
|
|
|
2363
2363
|
o.push(Jt), Jt = Jt.next;
|
|
2364
2364
|
while (Jt !== tt.edge);
|
|
2365
2365
|
const Gn = o.length - 2;
|
|
2366
|
-
for (let
|
|
2367
|
-
const xs = o[0].vertex, bs = o[
|
|
2366
|
+
for (let Ze = 1, zn = Gn; Ze <= zn; Ze++) {
|
|
2367
|
+
const xs = o[0].vertex, bs = o[Ze + 0].vertex, vs = o[Ze + 1].vertex;
|
|
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(), c = 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), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), E.subVectors(a, r), d.subVectors(c, r);
|
|
2375
2375
|
const tt = h.crossVectors(E, d).length() / 2;
|
|
2376
|
-
p.add(h.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x +
|
|
2376
|
+
p.add(h.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (tt / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (tt / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (tt / 12);
|
|
2377
2377
|
}
|
|
2378
2378
|
p.divideScalar(A), R /= A, C /= A, T /= A, F /= A, f /= A, m /= A, R -= p.x * p.x, C -= p.x * p.y, T -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, m -= p.z * p.z;
|
|
2379
2379
|
const O = new g.Matrix3();
|
|
@@ -2388,8 +2388,8 @@ function Cr(c) {
|
|
|
2388
2388
|
_.multiplyScalar(0.5 * (b + M)), N.multiplyScalar(0.5 * (B + y)), L.multiplyScalar(0.5 * (H + x));
|
|
2389
2389
|
const q = new g.Vector3(), st = new g.Vector3(), Q = new g.Matrix3();
|
|
2390
2390
|
q.add(_).add(N).add(L), st.x = M - b, st.y = y - B, st.z = x - H, st.multiplyScalar(0.5), Q.copy(S);
|
|
2391
|
-
const { x: kt, y: Wt, z: Xt } = st,
|
|
2392
|
-
|
|
2391
|
+
const { x: kt, y: Wt, z: Xt } = st, Xe = new g.Matrix4();
|
|
2392
|
+
Xe.makeScale(kt * 2, Wt * 2, Xt * 2);
|
|
2393
2393
|
const Te = new g.Matrix4();
|
|
2394
2394
|
Te.makeTranslation(-kt, -Wt, -Xt);
|
|
2395
2395
|
const yi = new g.Matrix4();
|
|
@@ -2397,13 +2397,13 @@ function Cr(c) {
|
|
|
2397
2397
|
const wi = new g.Matrix4();
|
|
2398
2398
|
wi.setFromMatrix3(Q);
|
|
2399
2399
|
const me = new g.Matrix4();
|
|
2400
|
-
return me.multiply(yi), me.multiply(wi), me.multiply(Te), me.multiply(
|
|
2400
|
+
return me.multiply(yi), me.multiply(wi), me.multiply(Te), me.multiply(Xe), { center: q, halfSizes: st, rotation: Q, transformation: me };
|
|
2401
2401
|
}
|
|
2402
|
-
function Tr(
|
|
2402
|
+
function Tr(l, s, t) {
|
|
2403
2403
|
const e = [
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2404
|
+
l[0] - s[0],
|
|
2405
|
+
l[1] - s[1],
|
|
2406
|
+
l[2] - s[2]
|
|
2407
2407
|
];
|
|
2408
2408
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
|
|
2409
2409
|
}
|
|
@@ -2693,8 +2693,8 @@ let ze = K;
|
|
|
2693
2693
|
class ea extends J {
|
|
2694
2694
|
constructor(t, e) {
|
|
2695
2695
|
super(t);
|
|
2696
|
-
I(this, "onVertexFound", new
|
|
2697
|
-
I(this, "onVertexLost", new
|
|
2696
|
+
I(this, "onVertexFound", new D());
|
|
2697
|
+
I(this, "onVertexLost", new D());
|
|
2698
2698
|
I(this, "components");
|
|
2699
2699
|
I(this, "_pickedPoint", null);
|
|
2700
2700
|
I(this, "_config");
|
|
@@ -2771,7 +2771,7 @@ class ea extends J {
|
|
|
2771
2771
|
const Fs = class Fs {
|
|
2772
2772
|
constructor() {
|
|
2773
2773
|
/** {@link Disposable.onDisposed} */
|
|
2774
|
-
I(this, "onDisposed", new
|
|
2774
|
+
I(this, "onDisposed", new D());
|
|
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. */
|
|
@@ -2849,7 +2849,7 @@ class mr {
|
|
|
2849
2849
|
I(this, "_event");
|
|
2850
2850
|
I(this, "_position", new g.Vector2());
|
|
2851
2851
|
/** {@link Disposable.onDisposed} */
|
|
2852
|
-
I(this, "onDisposed", new
|
|
2852
|
+
I(this, "onDisposed", new D());
|
|
2853
2853
|
I(this, "updateMouseInfo", (s) => {
|
|
2854
2854
|
this._event = s;
|
|
2855
2855
|
});
|
|
@@ -2885,7 +2885,7 @@ class Rr {
|
|
|
2885
2885
|
I(this, "enabled", !0);
|
|
2886
2886
|
I(this, "components");
|
|
2887
2887
|
/** {@link Disposable.onDisposed} */
|
|
2888
|
-
I(this, "onDisposed", new
|
|
2888
|
+
I(this, "onDisposed", new D());
|
|
2889
2889
|
/** The position of the mouse in the screen. */
|
|
2890
2890
|
I(this, "mouse");
|
|
2891
2891
|
I(this, "three", new g.Raycaster());
|
|
@@ -2938,7 +2938,7 @@ const Os = class Os extends J {
|
|
|
2938
2938
|
super(t);
|
|
2939
2939
|
I(this, "enabled", !0);
|
|
2940
2940
|
I(this, "list", /* @__PURE__ */ new Map());
|
|
2941
|
-
I(this, "onDisposed", new
|
|
2941
|
+
I(this, "onDisposed", new D());
|
|
2942
2942
|
t.add(Os.uuid, this);
|
|
2943
2943
|
}
|
|
2944
2944
|
get(t) {
|
|
@@ -2968,11 +2968,13 @@ class Ar extends Si {
|
|
|
2968
2968
|
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
|
|
2969
2969
|
*/
|
|
2970
2970
|
I(this, "meshes", /* @__PURE__ */ new Set());
|
|
2971
|
-
I(this, "onAfterUpdate", new
|
|
2972
|
-
I(this, "onBeforeUpdate", new
|
|
2971
|
+
I(this, "onAfterUpdate", new D());
|
|
2972
|
+
I(this, "onBeforeUpdate", new D());
|
|
2973
|
+
I(this, "isDisposing", !1);
|
|
2973
2974
|
I(this, "enabled", !0);
|
|
2974
2975
|
I(this, "uuid", ze.create());
|
|
2975
|
-
I(this, "
|
|
2976
|
+
I(this, "name");
|
|
2977
|
+
I(this, "onDisposed", new D());
|
|
2976
2978
|
I(this, "_scene");
|
|
2977
2979
|
I(this, "_camera");
|
|
2978
2980
|
I(this, "_renderer", null);
|
|
@@ -3003,7 +3005,7 @@ class Ar extends Si {
|
|
|
3003
3005
|
this.enabled && (!this._scene || !this._camera || (this.scene.currentWorld = this, this.camera.currentWorld = this, this.renderer && (this.renderer.currentWorld = this), this.onBeforeUpdate.trigger(), this.scene.isUpdateable() && this.scene.update(t), this.camera.isUpdateable() && this.camera.update(t), this.renderer && this.renderer.update(t), this.onAfterUpdate.trigger()));
|
|
3004
3006
|
}
|
|
3005
3007
|
dispose(t = !0) {
|
|
3006
|
-
if (this.enabled = !1, this.scene.onWorldChanged.trigger({ world: this, action: "removed" }), this.camera.onWorldChanged.trigger({ world: this, action: "removed" }), this.renderer && this.renderer.onWorldChanged.trigger({ world: this, action: "removed" }), t) {
|
|
3008
|
+
if (this.enabled = !1, this.isDisposing = !0, this.scene.onWorldChanged.trigger({ world: this, action: "removed" }), this.camera.onWorldChanged.trigger({ world: this, action: "removed" }), this.renderer && this.renderer.onWorldChanged.trigger({ world: this, action: "removed" }), t) {
|
|
3007
3009
|
const e = this.components.get(Ht);
|
|
3008
3010
|
this.scene.dispose(), this.camera.isDisposeable() && this.camera.dispose(), this.renderer && this.renderer.dispose();
|
|
3009
3011
|
for (const i of this.meshes)
|
|
@@ -3020,7 +3022,7 @@ class sa extends cr {
|
|
|
3020
3022
|
I(this, "isSetup", !1);
|
|
3021
3023
|
I(this, "three");
|
|
3022
3024
|
/** {@link Configurable.onSetup} */
|
|
3023
|
-
I(this, "onSetup", new
|
|
3025
|
+
I(this, "onSetup", new D());
|
|
3024
3026
|
I(this, "config", {
|
|
3025
3027
|
directionalLight: {
|
|
3026
3028
|
color: new g.Color("white"),
|
|
@@ -3059,7 +3061,7 @@ class ia extends ar {
|
|
|
3059
3061
|
I(this, "_canvas");
|
|
3060
3062
|
I(this, "_parameters");
|
|
3061
3063
|
I(this, "_resizeObserver", null);
|
|
3062
|
-
I(this, "onContainerUpdated", new
|
|
3064
|
+
I(this, "onContainerUpdated", new D());
|
|
3063
3065
|
I(this, "_resizing", !1);
|
|
3064
3066
|
/** {@link Resizeable.resize} */
|
|
3065
3067
|
I(this, "resize", (t) => {
|
|
@@ -3153,64 +3155,64 @@ const V = {
|
|
|
3153
3155
|
IN: 1,
|
|
3154
3156
|
OUT: -1
|
|
3155
3157
|
};
|
|
3156
|
-
function Qt(
|
|
3157
|
-
return
|
|
3158
|
+
function Qt(l) {
|
|
3159
|
+
return l.isPerspectiveCamera;
|
|
3158
3160
|
}
|
|
3159
|
-
function bt(
|
|
3160
|
-
return
|
|
3161
|
+
function bt(l) {
|
|
3162
|
+
return l.isOrthographicCamera;
|
|
3161
3163
|
}
|
|
3162
3164
|
const Ee = Math.PI * 2, nn = Math.PI / 2, Un = 1e-5, Ne = Math.PI / 180;
|
|
3163
|
-
function mt(
|
|
3164
|
-
return Math.max(s, Math.min(t,
|
|
3165
|
+
function mt(l, s, t) {
|
|
3166
|
+
return Math.max(s, Math.min(t, l));
|
|
3165
3167
|
}
|
|
3166
|
-
function X(
|
|
3167
|
-
return Math.abs(
|
|
3168
|
+
function X(l, s = Un) {
|
|
3169
|
+
return Math.abs(l) < s;
|
|
3168
3170
|
}
|
|
3169
|
-
function k(
|
|
3170
|
-
return X(
|
|
3171
|
+
function k(l, s, t = Un) {
|
|
3172
|
+
return X(l - s, t);
|
|
3171
3173
|
}
|
|
3172
|
-
function on(
|
|
3173
|
-
return Math.round(
|
|
3174
|
+
function on(l, s) {
|
|
3175
|
+
return Math.round(l / s) * s;
|
|
3174
3176
|
}
|
|
3175
|
-
function Pe(
|
|
3176
|
-
return isFinite(
|
|
3177
|
+
function Pe(l) {
|
|
3178
|
+
return isFinite(l) ? l : l < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
3177
3179
|
}
|
|
3178
|
-
function Le(
|
|
3179
|
-
return Math.abs(
|
|
3180
|
+
function Le(l) {
|
|
3181
|
+
return Math.abs(l) < Number.MAX_VALUE ? l : l * (1 / 0);
|
|
3180
3182
|
}
|
|
3181
|
-
function
|
|
3183
|
+
function Es(l, s, t, e, i = 1 / 0, o) {
|
|
3182
3184
|
e = Math.max(1e-4, e);
|
|
3183
3185
|
const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
|
|
3184
|
-
let
|
|
3186
|
+
let c = l - s;
|
|
3185
3187
|
const E = s, d = i * e;
|
|
3186
|
-
|
|
3187
|
-
const h = (t.value + n *
|
|
3188
|
+
c = mt(c, -d, d), s = l - c;
|
|
3189
|
+
const h = (t.value + n * c) * o;
|
|
3188
3190
|
t.value = (t.value - n * h) * a;
|
|
3189
|
-
let u = s + (
|
|
3190
|
-
return E -
|
|
3191
|
+
let u = s + (c + h) * a;
|
|
3192
|
+
return E - l > 0 == u > E && (u = E, t.value = (u - E) / o), u;
|
|
3191
3193
|
}
|
|
3192
|
-
function rn(
|
|
3194
|
+
function rn(l, s, t, e, i = 1 / 0, o, n) {
|
|
3193
3195
|
e = Math.max(1e-4, e);
|
|
3194
|
-
const r = 2 / e, a = r * o,
|
|
3195
|
-
let E = s.x, d = s.y, h = s.z, u =
|
|
3196
|
+
const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
3197
|
+
let E = s.x, d = s.y, h = s.z, u = l.x - E, p = l.y - d, A = l.z - h;
|
|
3196
3198
|
const R = E, C = d, T = h, F = i * e, f = F * F, m = u * u + p * p + A * A;
|
|
3197
3199
|
if (m > f) {
|
|
3198
3200
|
const B = Math.sqrt(m);
|
|
3199
3201
|
u = u / B * F, p = p / B * F, A = A / B * F;
|
|
3200
3202
|
}
|
|
3201
|
-
E =
|
|
3203
|
+
E = l.x - u, d = l.y - p, h = l.z - A;
|
|
3202
3204
|
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) *
|
|
3204
|
-
const N = R -
|
|
3205
|
+
t.x = (t.x - r * O) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = E + (u + O) * c, n.y = d + (p + S) * c, n.z = h + (A + _) * c;
|
|
3206
|
+
const N = R - l.x, L = C - l.y, M = T - l.z, y = n.x - R, x = n.y - C, b = n.z - T;
|
|
3205
3207
|
return N * y + L * x + M * b > 0 && (n.x = R, n.y = C, n.z = T, t.x = (n.x - R) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
|
|
3206
3208
|
}
|
|
3207
|
-
function $s(
|
|
3208
|
-
s.set(0, 0),
|
|
3209
|
+
function $s(l, s) {
|
|
3210
|
+
s.set(0, 0), l.forEach((t) => {
|
|
3209
3211
|
s.x += t.clientX, s.y += t.clientY;
|
|
3210
|
-
}), s.x /=
|
|
3212
|
+
}), s.x /= l.length, s.y /= l.length;
|
|
3211
3213
|
}
|
|
3212
|
-
function Ks(
|
|
3213
|
-
return bt(
|
|
3214
|
+
function Ks(l, s) {
|
|
3215
|
+
return bt(l) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
|
|
3214
3216
|
}
|
|
3215
3217
|
class Fr {
|
|
3216
3218
|
constructor() {
|
|
@@ -3276,8 +3278,8 @@ class Fr {
|
|
|
3276
3278
|
}
|
|
3277
3279
|
}
|
|
3278
3280
|
}
|
|
3279
|
-
const Or = "2.7.3",
|
|
3280
|
-
let Y, an,
|
|
3281
|
+
const Or = "2.7.3", ds = 1 / 8, xn = typeof window < "u", gr = xn && /Mac/.test(navigator.platform), Sr = !(xn && "PointerEvent" in window);
|
|
3282
|
+
let Y, an, us, Js, lt, G, z, de, ye, gt, St, jt, cn, ln, dt, we, ue, hn, ti, En, ei, si, Is;
|
|
3281
3283
|
class ot extends Fr {
|
|
3282
3284
|
/**
|
|
3283
3285
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
@@ -3320,7 +3322,7 @@ class ot extends Fr {
|
|
|
3320
3322
|
* @category Statics
|
|
3321
3323
|
*/
|
|
3322
3324
|
static install(s) {
|
|
3323
|
-
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)),
|
|
3325
|
+
Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), us = 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(), Is = new Y.Raycaster();
|
|
3324
3326
|
}
|
|
3325
3327
|
/**
|
|
3326
3328
|
* list all ACTIONs
|
|
@@ -3368,7 +3370,7 @@ class ot extends Fr {
|
|
|
3368
3370
|
}, this._zoomInternal = (f, m, O) => {
|
|
3369
3371
|
const S = Math.pow(0.95, f * this.dollySpeed), _ = this._zoom, N = this._zoom * S;
|
|
3370
3372
|
this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(m, O));
|
|
3371
|
-
}, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up,
|
|
3373
|
+
}, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = P.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
3372
3374
|
new Y.Vector3(),
|
|
3373
3375
|
new Y.Vector3(),
|
|
3374
3376
|
new Y.Vector3(),
|
|
@@ -3428,7 +3430,7 @@ class ot extends Fr {
|
|
|
3428
3430
|
deltaY: 0,
|
|
3429
3431
|
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
|
|
3430
3432
|
};
|
|
3431
|
-
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3433
|
+
this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", c), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, A(f);
|
|
3432
3434
|
}, a = (f) => {
|
|
3433
3435
|
f.cancelable && f.preventDefault();
|
|
3434
3436
|
const m = f.pointerId, O = this._lockedPointer || this._findPointerById(m);
|
|
@@ -3449,7 +3451,7 @@ class ot extends Fr {
|
|
|
3449
3451
|
(!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);
|
|
3450
3452
|
R();
|
|
3451
3453
|
}
|
|
3452
|
-
},
|
|
3454
|
+
}, c = (f) => {
|
|
3453
3455
|
const m = this._lockedPointer || this._findPointerById(1);
|
|
3454
3456
|
m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), R());
|
|
3455
3457
|
}, E = (f) => {
|
|
@@ -3519,7 +3521,7 @@ class ot extends Fr {
|
|
|
3519
3521
|
if (!(!this._domElement || !this._enabled)) {
|
|
3520
3522
|
if (this.mouseButtons.right === ot.ACTION.NONE) {
|
|
3521
3523
|
const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(m);
|
|
3522
|
-
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3524
|
+
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
|
|
3523
3525
|
return;
|
|
3524
3526
|
}
|
|
3525
3527
|
f.preventDefault();
|
|
@@ -3557,17 +3559,17 @@ class ot extends Fr {
|
|
|
3557
3559
|
const m = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = m ? -m.deltaX : i.x - lt.x, S = m ? -m.deltaY : i.y - lt.y;
|
|
3558
3560
|
if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, S), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
|
|
3559
3561
|
const _ = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, L = this.dollyDragInverted ? -1 : 1;
|
|
3560
|
-
(this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(L * S *
|
|
3562
|
+
(this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(L * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(L * S * ds, _, N), this._isUserControllingZoom = !0);
|
|
3561
3563
|
}
|
|
3562
3564
|
if ((this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_ZOOM) === P.TOUCH_ZOOM || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) {
|
|
3563
3565
|
const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, L = Math.sqrt(_ * _ + N * N), M = o.y - L;
|
|
3564
3566
|
o.set(0, L);
|
|
3565
3567
|
const y = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, x = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3566
|
-
(this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(M *
|
|
3568
|
+
(this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(M * ds, y, x), this._isUserControllingDolly = !0) : (this._zoomInternal(M * ds, y, x), this._isUserControllingZoom = !0);
|
|
3567
3569
|
}
|
|
3568
3570
|
((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, S, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
3569
3571
|
}, C = () => {
|
|
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",
|
|
3572
|
+
$s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
|
|
3571
3573
|
};
|
|
3572
3574
|
this.lockPointer = () => {
|
|
3573
3575
|
!this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
|
|
@@ -3589,7 +3591,7 @@ class ot extends Fr {
|
|
|
3589
3591
|
this._addAllEventListeners = (f) => {
|
|
3590
3592
|
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);
|
|
3591
3593
|
}, this._removeAllEventListeners = () => {
|
|
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",
|
|
3594
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", 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", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3593
3595
|
}, this.cancel = () => {
|
|
3594
3596
|
this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
|
|
3595
3597
|
}, t && this.connect(t), this.update(0);
|
|
@@ -3954,14 +3956,14 @@ class ot extends Fr {
|
|
|
3954
3956
|
* @category Methods
|
|
3955
3957
|
*/
|
|
3956
3958
|
fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
|
|
3957
|
-
const a = [],
|
|
3958
|
-
|
|
3959
|
+
const a = [], c = s.isBox3 ? ue.copy(s) : ue.setFromObject(s);
|
|
3960
|
+
c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
|
|
3959
3961
|
const E = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
|
|
3960
3962
|
a.push(this.rotateTo(E, d, t));
|
|
3961
3963
|
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(
|
|
3964
|
+
p && u.multiply(ei.setFromAxisAngle(us, E)), u.multiply(this._yAxisUpSpaceInverse);
|
|
3963
3965
|
const A = hn.makeEmpty();
|
|
3964
|
-
z.copy(
|
|
3966
|
+
z.copy(c.min).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(Js, h), p && u.premultiply(ei.invert()), u.premultiply(this._yAxisUpSpace);
|
|
3965
3967
|
const R = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
|
|
3966
3968
|
if (Qt(this._camera)) {
|
|
3967
3969
|
const T = this.getDistanceToFitBox(R.x, R.y, R.z, e);
|
|
@@ -3984,8 +3986,8 @@ class ot extends Fr {
|
|
|
3984
3986
|
const n = this.getDistanceToFitSphere(o.radius);
|
|
3985
3987
|
e.push(this.dollyTo(n, t));
|
|
3986
3988
|
} else if (bt(this._camera)) {
|
|
3987
|
-
const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius,
|
|
3988
|
-
e.push(this.zoomTo(
|
|
3989
|
+
const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, c = Math.min(n / a, r / a);
|
|
3990
|
+
e.push(this.zoomTo(c, t));
|
|
3989
3991
|
}
|
|
3990
3992
|
return e.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(e);
|
|
3991
3993
|
}
|
|
@@ -4002,8 +4004,8 @@ class ot extends Fr {
|
|
|
4002
4004
|
*/
|
|
4003
4005
|
setLookAt(s, t, e, i, o, n, r = !1) {
|
|
4004
4006
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
|
|
4005
|
-
const a = z.set(i, o, n),
|
|
4006
|
-
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
4007
|
+
const a = z.set(i, o, n), c = G.set(s, t, e);
|
|
4008
|
+
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
4007
4009
|
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);
|
|
4008
4010
|
return this._createOnRestPromise(E);
|
|
4009
4011
|
}
|
|
@@ -4025,11 +4027,11 @@ class ot extends Fr {
|
|
|
4025
4027
|
* @param enableTransition
|
|
4026
4028
|
* @category Methods
|
|
4027
4029
|
*/
|
|
4028
|
-
lerpLookAt(s, t, e, i, o, n, r, a,
|
|
4030
|
+
lerpLookAt(s, t, e, i, o, n, r, a, c, E, d, h, u, p = !1) {
|
|
4029
4031
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
|
|
4030
4032
|
const A = G.set(i, o, n), R = z.set(s, t, e);
|
|
4031
4033
|
dt.setFromVector3(R.sub(A).applyQuaternion(this._yAxisUpSpace));
|
|
4032
|
-
const C = de.set(E, d, h), T = z.set(r, a,
|
|
4034
|
+
const C = de.set(E, d, h), T = z.set(r, a, c);
|
|
4033
4035
|
we.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
|
|
4034
4036
|
const F = we.theta - dt.theta, f = we.phi - dt.phi, m = we.radius - dt.radius;
|
|
4035
4037
|
this._sphericalEnd.set(dt.radius + m * u, dt.phi + f * u, dt.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -4215,7 +4217,7 @@ class ot extends Fr {
|
|
|
4215
4217
|
* @category Methods
|
|
4216
4218
|
*/
|
|
4217
4219
|
updateCameraUp() {
|
|
4218
|
-
this._yAxisUpSpace.setFromUnitVectors(this._camera.up,
|
|
4220
|
+
this._yAxisUpSpace.setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert();
|
|
4219
4221
|
}
|
|
4220
4222
|
/**
|
|
4221
4223
|
* Apply current camera-up direction to the camera.
|
|
@@ -4241,19 +4243,19 @@ class ot extends Fr {
|
|
|
4241
4243
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
4242
4244
|
else {
|
|
4243
4245
|
const d = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
4244
|
-
this._spherical.theta =
|
|
4246
|
+
this._spherical.theta = Es(this._spherical.theta, this._sphericalEnd.theta, this._thetaVelocity, d, 1 / 0, s), this._needsUpdate = !0;
|
|
4245
4247
|
}
|
|
4246
4248
|
if (X(e))
|
|
4247
4249
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
4248
4250
|
else {
|
|
4249
4251
|
const d = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
4250
|
-
this._spherical.phi =
|
|
4252
|
+
this._spherical.phi = Es(this._spherical.phi, this._sphericalEnd.phi, this._phiVelocity, d, 1 / 0, s), this._needsUpdate = !0;
|
|
4251
4253
|
}
|
|
4252
4254
|
if (X(i))
|
|
4253
4255
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
4254
4256
|
else {
|
|
4255
4257
|
const d = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
4256
|
-
this._spherical.radius =
|
|
4258
|
+
this._spherical.radius = Es(this._spherical.radius, this._sphericalEnd.radius, this._radiusVelocity, d, this.maxSpeed, s), this._needsUpdate = !0;
|
|
4257
4259
|
}
|
|
4258
4260
|
if (X(o.x) && X(o.y) && X(o.z))
|
|
4259
4261
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
@@ -4271,7 +4273,7 @@ class ot extends Fr {
|
|
|
4271
4273
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
4272
4274
|
else {
|
|
4273
4275
|
const d = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
4274
|
-
this._zoom =
|
|
4276
|
+
this._zoom = Es(this._zoom, this._zoomEnd, this._zoomVelocity, d, 1 / 0, s);
|
|
4275
4277
|
}
|
|
4276
4278
|
if (this.dollyToCursor) {
|
|
4277
4279
|
if (Qt(this._camera) && this._changedDolly !== 0) {
|
|
@@ -4393,8 +4395,8 @@ class ot extends Fr {
|
|
|
4393
4395
|
if (e === 0)
|
|
4394
4396
|
return s.add(t).add(r);
|
|
4395
4397
|
{
|
|
4396
|
-
const
|
|
4397
|
-
return s.add(z.copy(t).multiplyScalar(
|
|
4398
|
+
const c = 1 + e * a / t.dot(r);
|
|
4399
|
+
return s.add(z.copy(t).multiplyScalar(c)).add(r.multiplyScalar(1 - e));
|
|
4398
4400
|
}
|
|
4399
4401
|
}
|
|
4400
4402
|
_updateNearPlaneCorners() {
|
|
@@ -4417,8 +4419,8 @@ class ot extends Fr {
|
|
|
4417
4419
|
const o = z.copy(this._nearPlaneCorners[i]);
|
|
4418
4420
|
o.applyMatrix4(si);
|
|
4419
4421
|
const n = de.addVectors(this._target, o);
|
|
4420
|
-
|
|
4421
|
-
const r =
|
|
4422
|
+
Is.set(n, e), Is.far = this._spherical.radius + 1;
|
|
4423
|
+
const r = Is.intersectObjects(this.colliderMeshes);
|
|
4422
4424
|
r.length !== 0 && r[0].distance < s && (s = r[0].distance);
|
|
4423
4425
|
}
|
|
4424
4426
|
return s;
|
|
@@ -4498,12 +4500,12 @@ class ke extends rr {
|
|
|
4498
4500
|
constructor(t) {
|
|
4499
4501
|
super(t);
|
|
4500
4502
|
/** {@link Updateable.onBeforeUpdate} */
|
|
4501
|
-
I(this, "onBeforeUpdate", new
|
|
4503
|
+
I(this, "onBeforeUpdate", new D());
|
|
4502
4504
|
/** {@link Updateable.onAfterUpdate} */
|
|
4503
|
-
I(this, "onAfterUpdate", new
|
|
4504
|
-
I(this, "onAspectUpdated", new
|
|
4505
|
+
I(this, "onAfterUpdate", new D());
|
|
4506
|
+
I(this, "onAspectUpdated", new D());
|
|
4505
4507
|
/** {@link Disposable.onDisposed} */
|
|
4506
|
-
I(this, "onDisposed", new
|
|
4508
|
+
I(this, "onDisposed", new D());
|
|
4507
4509
|
I(this, "three");
|
|
4508
4510
|
I(this, "_allControls", /* @__PURE__ */ new Map());
|
|
4509
4511
|
/**
|
|
@@ -4558,7 +4560,7 @@ class ke extends rr {
|
|
|
4558
4560
|
}
|
|
4559
4561
|
/** {@link Disposable.dispose} */
|
|
4560
4562
|
dispose() {
|
|
4561
|
-
this.setupEvents(!1), this.
|
|
4563
|
+
this.setupEvents(!1), this.onAspectUpdated.reset(), this.onBeforeUpdate.reset(), this.onAfterUpdate.reset(), this.three.removeFromParent(), this.onDisposed.trigger(), this.onDisposed.reset();
|
|
4562
4564
|
for (const [t, e] of this._allControls)
|
|
4563
4565
|
e.dispose();
|
|
4564
4566
|
}
|
|
@@ -4605,17 +4607,19 @@ const gs = class gs extends J {
|
|
|
4605
4607
|
* Event triggered after the update process of all worlds.
|
|
4606
4608
|
* Subscribers can listen to this event to perform actions post-update.
|
|
4607
4609
|
*/
|
|
4608
|
-
I(this, "onAfterUpdate", new
|
|
4610
|
+
I(this, "onAfterUpdate", new D());
|
|
4609
4611
|
/**
|
|
4610
4612
|
* Event triggered before the update process of all worlds.
|
|
4611
4613
|
* Subscribers can listen to this event to perform actions pre-update.
|
|
4612
4614
|
*/
|
|
4613
|
-
I(this, "onBeforeUpdate", new
|
|
4615
|
+
I(this, "onBeforeUpdate", new D());
|
|
4614
4616
|
/**
|
|
4615
4617
|
* Event triggered when the Worlds component is disposed.
|
|
4616
4618
|
* Subscribers can listen to this event to perform cleanup actions.
|
|
4617
4619
|
*/
|
|
4618
|
-
I(this, "onDisposed", new
|
|
4620
|
+
I(this, "onDisposed", new D());
|
|
4621
|
+
I(this, "onWorldCreated", new D());
|
|
4622
|
+
I(this, "onWorldDeleted", new D());
|
|
4619
4623
|
/**
|
|
4620
4624
|
* A collection of worlds managed by this component.
|
|
4621
4625
|
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
@@ -4629,24 +4633,23 @@ const gs = class gs extends J {
|
|
|
4629
4633
|
t.add(gs.uuid, this);
|
|
4630
4634
|
}
|
|
4631
4635
|
/**
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
4641
|
-
*/
|
|
4636
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
4637
|
+
*
|
|
4638
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
4639
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
4640
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
4641
|
+
*
|
|
4642
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
4643
|
+
*/
|
|
4642
4644
|
create() {
|
|
4643
4645
|
const t = new Ar(this.components), e = t.uuid;
|
|
4644
4646
|
if (this.list.has(e))
|
|
4645
4647
|
throw new Error("There is already a world with this name!");
|
|
4646
|
-
return this.list.set(e, t), t;
|
|
4648
|
+
return this.list.set(e, t), this.onWorldCreated.trigger(t), t;
|
|
4647
4649
|
}
|
|
4648
4650
|
delete(t) {
|
|
4649
|
-
|
|
4651
|
+
const e = t.uuid;
|
|
4652
|
+
this.list.delete(t.uuid), t.dispose(), this.onWorldDeleted.trigger(e);
|
|
4650
4653
|
}
|
|
4651
4654
|
dispose() {
|
|
4652
4655
|
this.enabled = !1;
|
|
@@ -4669,7 +4672,7 @@ let pi = gs;
|
|
|
4669
4672
|
class _r {
|
|
4670
4673
|
constructor(s, t, e) {
|
|
4671
4674
|
/** {@link Disposable.onDisposed} */
|
|
4672
|
-
I(this, "onDisposed", new
|
|
4675
|
+
I(this, "onDisposed", new D());
|
|
4673
4676
|
I(this, "world");
|
|
4674
4677
|
I(this, "components");
|
|
4675
4678
|
I(this, "three");
|
|
@@ -4680,7 +4683,7 @@ class _r {
|
|
|
4680
4683
|
this.world = t;
|
|
4681
4684
|
const { color: i, size1: o, size2: n, distance: r } = e;
|
|
4682
4685
|
this.components = s;
|
|
4683
|
-
const a = new g.PlaneGeometry(2, 2, 1, 1),
|
|
4686
|
+
const a = new g.PlaneGeometry(2, 2, 1, 1), c = new g.ShaderMaterial({
|
|
4684
4687
|
side: g.DoubleSide,
|
|
4685
4688
|
uniforms: {
|
|
4686
4689
|
uSize1: {
|
|
@@ -4770,7 +4773,7 @@ class _r {
|
|
|
4770
4773
|
derivatives: !0
|
|
4771
4774
|
}
|
|
4772
4775
|
});
|
|
4773
|
-
this.three = new g.Mesh(a,
|
|
4776
|
+
this.three = new g.Mesh(a, c), this.three.frustumCulled = !1, t.scene.three.add(this.three), this.setupEvents(!0);
|
|
4774
4777
|
}
|
|
4775
4778
|
/** {@link Hideable.visible} */
|
|
4776
4779
|
get visible() {
|
|
@@ -4806,7 +4809,7 @@ class _r {
|
|
|
4806
4809
|
this.setupEvents(!1), this.components.get(Ht).destroy(this.three), this.onDisposed.trigger(), this.onDisposed.reset(), this.world = null, this.components = null;
|
|
4807
4810
|
}
|
|
4808
4811
|
setupEvents(s) {
|
|
4809
|
-
if (!(this.world.camera instanceof ke))
|
|
4812
|
+
if (this.world.isDisposing || !(this.world.camera instanceof ke))
|
|
4810
4813
|
return;
|
|
4811
4814
|
const t = this.world.camera.controls;
|
|
4812
4815
|
s ? t.addEventListener("update", this.updateZoom) : t.removeEventListener("update", this.updateZoom);
|
|
@@ -4816,7 +4819,7 @@ class Nr extends J {
|
|
|
4816
4819
|
constructor() {
|
|
4817
4820
|
super(...arguments);
|
|
4818
4821
|
I(this, "list", /* @__PURE__ */ new Map());
|
|
4819
|
-
I(this, "onDisposed", new
|
|
4822
|
+
I(this, "onDisposed", new D());
|
|
4820
4823
|
I(this, "config", {
|
|
4821
4824
|
color: new g.Color(12303291),
|
|
4822
4825
|
size1: 1,
|
|
@@ -4870,8 +4873,8 @@ class Pr extends oi {
|
|
|
4870
4873
|
}), o[T] = F, i[T] = F, e[T] = F;
|
|
4871
4874
|
}
|
|
4872
4875
|
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);
|
|
4873
|
-
const r = new w(), a = new w(),
|
|
4874
|
-
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion",
|
|
4876
|
+
const r = new w(), a = new w(), c = 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();
|
|
4877
|
+
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), 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);
|
|
4875
4878
|
}
|
|
4876
4879
|
// updateMatrixWorld updates key transformation variables
|
|
4877
4880
|
updateMatrixWorld() {
|
|
@@ -4962,48 +4965,48 @@ class Pr extends oi {
|
|
|
4962
4965
|
this.space = s;
|
|
4963
4966
|
}
|
|
4964
4967
|
}
|
|
4965
|
-
function Lr(
|
|
4968
|
+
function Lr(l) {
|
|
4966
4969
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
4967
4970
|
return {
|
|
4968
4971
|
x: 0,
|
|
4969
4972
|
y: 0,
|
|
4970
|
-
button:
|
|
4973
|
+
button: l.button
|
|
4971
4974
|
};
|
|
4972
4975
|
{
|
|
4973
4976
|
const s = this.domElement.getBoundingClientRect();
|
|
4974
4977
|
return {
|
|
4975
|
-
x: (
|
|
4976
|
-
y: -(
|
|
4977
|
-
button:
|
|
4978
|
+
x: (l.clientX - s.left) / s.width * 2 - 1,
|
|
4979
|
+
y: -(l.clientY - s.top) / s.height * 2 + 1,
|
|
4980
|
+
button: l.button
|
|
4978
4981
|
};
|
|
4979
4982
|
}
|
|
4980
4983
|
}
|
|
4981
|
-
function yr(
|
|
4984
|
+
function yr(l) {
|
|
4982
4985
|
if (this.enabled)
|
|
4983
|
-
switch (
|
|
4986
|
+
switch (l.pointerType) {
|
|
4984
4987
|
case "mouse":
|
|
4985
4988
|
case "pen":
|
|
4986
|
-
this.pointerHover(this._getPointer(
|
|
4989
|
+
this.pointerHover(this._getPointer(l));
|
|
4987
4990
|
break;
|
|
4988
4991
|
}
|
|
4989
4992
|
}
|
|
4990
|
-
function wr(
|
|
4991
|
-
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(
|
|
4993
|
+
function wr(l) {
|
|
4994
|
+
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(l.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(l)), this.pointerDown(this._getPointer(l)));
|
|
4992
4995
|
}
|
|
4993
|
-
function Mr(
|
|
4994
|
-
this.enabled && this.pointerMove(this._getPointer(
|
|
4996
|
+
function Mr(l) {
|
|
4997
|
+
this.enabled && this.pointerMove(this._getPointer(l));
|
|
4995
4998
|
}
|
|
4996
|
-
function Dr(
|
|
4997
|
-
this.enabled && (this.domElement.releasePointerCapture(
|
|
4999
|
+
function Dr(l) {
|
|
5000
|
+
this.enabled && (this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(l)));
|
|
4998
5001
|
}
|
|
4999
|
-
function ni(
|
|
5000
|
-
const e = s.intersectObject(
|
|
5002
|
+
function ni(l, s, t) {
|
|
5003
|
+
const e = s.intersectObject(l, !0);
|
|
5001
5004
|
for (let i = 0; i < e.length; i++)
|
|
5002
5005
|
if (e[i].object.visible || t)
|
|
5003
5006
|
return e[i];
|
|
5004
5007
|
return !1;
|
|
5005
5008
|
}
|
|
5006
|
-
const
|
|
5009
|
+
const fs = new jn(), W = new w(0, 1, 0), pn = new w(0, 0, 0), Cn = new yt(), ps = new Pt(), Rs = 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), Cs = new w(), Me = new w(), De = new w();
|
|
5007
5010
|
class Ur extends oi {
|
|
5008
5011
|
constructor() {
|
|
5009
5012
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
@@ -5031,8 +5034,8 @@ class Ur extends oi {
|
|
|
5031
5034
|
r.color.setHex(255);
|
|
5032
5035
|
const a = s.clone();
|
|
5033
5036
|
a.color.setHex(16711680), a.opacity = 0.5;
|
|
5034
|
-
const
|
|
5035
|
-
|
|
5037
|
+
const c = s.clone();
|
|
5038
|
+
c.color.setHex(65280), c.opacity = 0.5;
|
|
5036
5039
|
const E = s.clone();
|
|
5037
5040
|
E.color.setHex(255), E.opacity = 0.5;
|
|
5038
5041
|
const d = s.clone();
|
|
@@ -5074,7 +5077,7 @@ class Ur extends oi {
|
|
|
5074
5077
|
[new v(T, r), null, [Math.PI / 2, 0, 0]]
|
|
5075
5078
|
],
|
|
5076
5079
|
XYZ: [
|
|
5077
|
-
[new v(new
|
|
5080
|
+
[new v(new Qe(0.1, 0), d.clone()), [0, 0, 0]]
|
|
5078
5081
|
],
|
|
5079
5082
|
XY: [
|
|
5080
5083
|
[new v(new rt(0.15, 0.15, 0.01), E.clone()), [0.15, 0.15, 0]]
|
|
@@ -5083,7 +5086,7 @@ class Ur extends oi {
|
|
|
5083
5086
|
[new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
5084
5087
|
],
|
|
5085
5088
|
XZ: [
|
|
5086
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5089
|
+
[new v(new rt(0.15, 0.15, 0.01), c.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5087
5090
|
]
|
|
5088
5091
|
}, O = {
|
|
5089
5092
|
X: [
|
|
@@ -5099,7 +5102,7 @@ class Ur extends oi {
|
|
|
5099
5102
|
[new v(new ct(0.2, 0, 0.6, 4), e), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
5100
5103
|
],
|
|
5101
5104
|
XYZ: [
|
|
5102
|
-
[new v(new
|
|
5105
|
+
[new v(new Qe(0.2, 0), e)]
|
|
5103
5106
|
],
|
|
5104
5107
|
XY: [
|
|
5105
5108
|
[new v(new rt(0.2, 0.2, 0.01), e), [0.15, 0.15, 0]]
|
|
@@ -5112,10 +5115,10 @@ class Ur extends oi {
|
|
|
5112
5115
|
]
|
|
5113
5116
|
}, S = {
|
|
5114
5117
|
START: [
|
|
5115
|
-
[new v(new
|
|
5118
|
+
[new v(new Qe(0.01, 2), i), null, null, null, "helper"]
|
|
5116
5119
|
],
|
|
5117
5120
|
END: [
|
|
5118
|
-
[new v(new
|
|
5121
|
+
[new v(new Qe(0.01, 2), i), null, null, null, "helper"]
|
|
5119
5122
|
],
|
|
5120
5123
|
DELTA: [
|
|
5121
5124
|
[new Dt(f(), i), null, null, null, "helper"]
|
|
@@ -5188,7 +5191,7 @@ class Ur extends oi {
|
|
|
5188
5191
|
[new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
5189
5192
|
],
|
|
5190
5193
|
XZ: [
|
|
5191
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5194
|
+
[new v(new rt(0.15, 0.15, 0.01), c), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5192
5195
|
],
|
|
5193
5196
|
XYZ: [
|
|
5194
5197
|
[new v(new rt(0.1, 0.1, 0.1), d.clone())]
|
|
@@ -5233,8 +5236,8 @@ class Ur extends oi {
|
|
|
5233
5236
|
const H = new oi();
|
|
5234
5237
|
for (const q in B)
|
|
5235
5238
|
for (let st = B[q].length; st--; ) {
|
|
5236
|
-
const Q = B[q][st][0].clone(), kt = B[q][st][1], Wt = B[q][st][2], Xt = B[q][st][3],
|
|
5237
|
-
Q.name = q, Q.tag =
|
|
5239
|
+
const Q = B[q][st][0].clone(), kt = B[q][st][1], Wt = B[q][st][2], Xt = B[q][st][3], Xe = B[q][st][4];
|
|
5240
|
+
Q.name = q, Q.tag = Xe, kt && Q.position.set(kt[0], kt[1], kt[2]), Wt && Q.rotation.set(Wt[0], Wt[1], Wt[2]), Xt && Q.scale.set(Xt[0], Xt[1], Xt[2]), Q.updateMatrix();
|
|
5238
5241
|
const Te = Q.geometry.clone();
|
|
5239
5242
|
Te.applyMatrix4(Q.matrix), Q.geometry = Te, Q.renderOrder = 1 / 0, Q.position.set(0, 0, 0), Q.rotation.set(0, 0, 0), Q.scale.set(1, 1, 1), H.add(Q);
|
|
5240
5243
|
}
|
|
@@ -5244,7 +5247,7 @@ class Ur extends oi {
|
|
|
5244
5247
|
}
|
|
5245
5248
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
5246
5249
|
updateMatrixWorld(s) {
|
|
5247
|
-
const e = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion :
|
|
5250
|
+
const e = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : Rs;
|
|
5248
5251
|
this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
|
|
5249
5252
|
let i = [];
|
|
5250
5253
|
i = i.concat(this.picker[this.mode].children), i = i.concat(this.gizmo[this.mode].children), i = i.concat(this.helper[this.mode].children);
|
|
@@ -5253,10 +5256,10 @@ class Ur extends oi {
|
|
|
5253
5256
|
n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
|
|
5254
5257
|
let r;
|
|
5255
5258
|
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") {
|
|
5256
|
-
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(
|
|
5259
|
+
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(fs.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(fs.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(fs.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(fs.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));
|
|
5257
5260
|
continue;
|
|
5258
5261
|
}
|
|
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" && (
|
|
5262
|
+
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" && (ps.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(ps, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle($t, Math.atan2(W.x, W.z)), j.multiplyQuaternions(ps, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(xe, Math.atan2(W.y, W.x)), j.multiplyQuaternions(ps, 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) {
|
|
5260
5263
|
return n.name === a;
|
|
5261
5264
|
})) && (n.material.color.setHex(16776960), n.material.opacity = 1);
|
|
5262
5265
|
}
|
|
@@ -5272,12 +5275,12 @@ class xr extends v {
|
|
|
5272
5275
|
}
|
|
5273
5276
|
updateMatrixWorld(s) {
|
|
5274
5277
|
let t = this.space;
|
|
5275
|
-
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"),
|
|
5278
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), Cs.copy(Ue).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), Me.copy($t).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), De.copy(xe).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), W.copy(Me), this.mode) {
|
|
5276
5279
|
case "translate":
|
|
5277
5280
|
case "scale":
|
|
5278
5281
|
switch (this.axis) {
|
|
5279
5282
|
case "X":
|
|
5280
|
-
W.copy(this.eye).cross(
|
|
5283
|
+
W.copy(this.eye).cross(Cs), _t.copy(Cs).cross(W);
|
|
5281
5284
|
break;
|
|
5282
5285
|
case "Y":
|
|
5283
5286
|
W.copy(this.eye).cross(Me), _t.copy(Me).cross(W);
|
|
@@ -5289,7 +5292,7 @@ class xr extends v {
|
|
|
5289
5292
|
_t.copy(De);
|
|
5290
5293
|
break;
|
|
5291
5294
|
case "YZ":
|
|
5292
|
-
_t.copy(
|
|
5295
|
+
_t.copy(Cs);
|
|
5293
5296
|
break;
|
|
5294
5297
|
case "XZ":
|
|
5295
5298
|
W.copy(De), _t.copy(Me);
|
|
@@ -5310,11 +5313,11 @@ class xr extends v {
|
|
|
5310
5313
|
class Ni {
|
|
5311
5314
|
constructor(s, t, e, i, o, n = 5, r = !0) {
|
|
5312
5315
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
5313
|
-
I(this, "onDraggingStarted", new
|
|
5316
|
+
I(this, "onDraggingStarted", new D());
|
|
5314
5317
|
/** Event that fires when the user stops dragging a clipping plane. */
|
|
5315
|
-
I(this, "onDraggingEnded", new
|
|
5318
|
+
I(this, "onDraggingEnded", new D());
|
|
5316
5319
|
/** {@link Disposable.onDisposed} */
|
|
5317
|
-
I(this, "onDisposed", new
|
|
5320
|
+
I(this, "onDisposed", new D());
|
|
5318
5321
|
I(this, "normal");
|
|
5319
5322
|
I(this, "origin");
|
|
5320
5323
|
I(this, "three", new g.Plane());
|
|
@@ -5435,19 +5438,19 @@ const Be = class Be extends J {
|
|
|
5435
5438
|
constructor(t) {
|
|
5436
5439
|
super(t);
|
|
5437
5440
|
/** {@link Createable.onAfterCreate} */
|
|
5438
|
-
I(this, "onAfterCreate", new
|
|
5441
|
+
I(this, "onAfterCreate", new D());
|
|
5439
5442
|
/** {@link Createable.onAfterDelete} */
|
|
5440
|
-
I(this, "onAfterDelete", new
|
|
5443
|
+
I(this, "onAfterDelete", new D());
|
|
5441
5444
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
5442
|
-
I(this, "onBeforeDrag", new
|
|
5445
|
+
I(this, "onBeforeDrag", new D());
|
|
5443
5446
|
/** Event that fires when the user stops dragging a clipping plane. */
|
|
5444
|
-
I(this, "onAfterDrag", new
|
|
5445
|
-
I(this, "onBeforeCreate", new
|
|
5446
|
-
I(this, "onBeforeCancel", new
|
|
5447
|
-
I(this, "onAfterCancel", new
|
|
5448
|
-
I(this, "onBeforeDelete", new
|
|
5447
|
+
I(this, "onAfterDrag", new D());
|
|
5448
|
+
I(this, "onBeforeCreate", new D());
|
|
5449
|
+
I(this, "onBeforeCancel", new D());
|
|
5450
|
+
I(this, "onAfterCancel", new D());
|
|
5451
|
+
I(this, "onBeforeDelete", new D());
|
|
5449
5452
|
/** {@link Disposable.onDisposed} */
|
|
5450
|
-
I(this, "onDisposed", new
|
|
5453
|
+
I(this, "onDisposed", new D());
|
|
5451
5454
|
/**
|
|
5452
5455
|
* Whether to force the clipping plane to be orthogonal in the Y direction
|
|
5453
5456
|
* (up). This is desirable when clipping a building horizontally and a
|
|
@@ -5601,8 +5604,8 @@ const Be = class Be extends J {
|
|
|
5601
5604
|
const i = t.object;
|
|
5602
5605
|
let o = t.object.matrixWorld.clone();
|
|
5603
5606
|
if (i instanceof g.InstancedMesh && t.instanceId !== void 0) {
|
|
5604
|
-
const
|
|
5605
|
-
i.getMatrixAt(t.instanceId,
|
|
5607
|
+
const c = new g.Matrix4();
|
|
5608
|
+
i.getMatrixAt(t.instanceId, c), o = c.multiply(o);
|
|
5606
5609
|
}
|
|
5607
5610
|
const r = new g.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
|
|
5608
5611
|
return this.normalizePlaneDirectionY(a), a;
|
|
@@ -5638,15 +5641,15 @@ const Be = class Be extends J {
|
|
|
5638
5641
|
};
|
|
5639
5642
|
I(Be, "uuid", "66290bc5-18c4-4cd1-9379-2e17a0617611");
|
|
5640
5643
|
let mn = Be;
|
|
5641
|
-
function br(
|
|
5644
|
+
function br(l, s, t, e) {
|
|
5642
5645
|
return new Promise((i, o) => {
|
|
5643
5646
|
function n() {
|
|
5644
|
-
const r =
|
|
5645
|
-
if (r ===
|
|
5647
|
+
const r = l.clientWaitSync(s, t, 0);
|
|
5648
|
+
if (r === l.WAIT_FAILED) {
|
|
5646
5649
|
o();
|
|
5647
5650
|
return;
|
|
5648
5651
|
}
|
|
5649
|
-
if (r ===
|
|
5652
|
+
if (r === l.TIMEOUT_EXPIRED) {
|
|
5650
5653
|
setTimeout(n, e);
|
|
5651
5654
|
return;
|
|
5652
5655
|
}
|
|
@@ -5655,18 +5658,18 @@ function br(c, s, t, e) {
|
|
|
5655
5658
|
n();
|
|
5656
5659
|
});
|
|
5657
5660
|
}
|
|
5658
|
-
async function vr(
|
|
5659
|
-
const r =
|
|
5660
|
-
|
|
5661
|
+
async function vr(l, s, t, e, i, o, n) {
|
|
5662
|
+
const r = l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
5663
|
+
l.flush(), await br(l, r, 0, 10), l.deleteSync(r), l.bindBuffer(s, t), l.getBufferSubData(s, e, i, o, n), l.bindBuffer(s, null);
|
|
5661
5664
|
}
|
|
5662
|
-
async function Br(
|
|
5663
|
-
const a =
|
|
5664
|
-
return
|
|
5665
|
+
async function Br(l, s, t, e, i, o, n, r) {
|
|
5666
|
+
const a = l.createBuffer();
|
|
5667
|
+
return l.bindBuffer(l.PIXEL_PACK_BUFFER, a), l.bufferData(l.PIXEL_PACK_BUFFER, r.byteLength, l.STREAM_READ), l.readPixels(s, t, e, i, o, n, 0), l.bindBuffer(l.PIXEL_PACK_BUFFER, null), await vr(l, l.PIXEL_PACK_BUFFER, a, 0, r), l.deleteBuffer(a), r;
|
|
5665
5668
|
}
|
|
5666
5669
|
class Yr {
|
|
5667
5670
|
constructor(s, t, e) {
|
|
5668
5671
|
/** {@link Disposable.onDisposed} */
|
|
5669
|
-
I(this, "onDisposed", new
|
|
5672
|
+
I(this, "onDisposed", new D());
|
|
5670
5673
|
/**
|
|
5671
5674
|
* Fires after making the visibility check to the meshes. It lists the
|
|
5672
5675
|
* meshes that are currently visible, and the ones that were visible
|
|
@@ -5790,7 +5793,7 @@ class Vr extends Yr {
|
|
|
5790
5793
|
super(t, e, i);
|
|
5791
5794
|
/* Pixels in screen a geometry must occupy to be considered "seen". */
|
|
5792
5795
|
I(this, "threshold", 100);
|
|
5793
|
-
I(this, "onViewUpdated", new
|
|
5796
|
+
I(this, "onViewUpdated", new D());
|
|
5794
5797
|
I(this, "colorMeshes", /* @__PURE__ */ new Map());
|
|
5795
5798
|
I(this, "isProcessing", !1);
|
|
5796
5799
|
I(this, "_colorCodeMeshMap", /* @__PURE__ */ new Map());
|
|
@@ -5862,7 +5865,7 @@ class Vr extends Yr {
|
|
|
5862
5865
|
} else
|
|
5863
5866
|
a = n;
|
|
5864
5867
|
this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
|
|
5865
|
-
const
|
|
5868
|
+
const c = e ? t.count : 1, E = new g.InstancedMesh(i, a, c);
|
|
5866
5869
|
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;
|
|
5867
5870
|
}
|
|
5868
5871
|
remove(t) {
|
|
@@ -5886,12 +5889,12 @@ class Vr extends Yr {
|
|
|
5886
5889
|
const r = new g.Color(`rgb(${t}, ${e}, ${i})`);
|
|
5887
5890
|
if (!this.world.renderer)
|
|
5888
5891
|
throw new Error("Renderer not found in the world!");
|
|
5889
|
-
const a = this.world.renderer.clippingPlanes,
|
|
5892
|
+
const a = this.world.renderer.clippingPlanes, c = new g.MeshBasicMaterial({
|
|
5890
5893
|
color: r,
|
|
5891
5894
|
clippingPlanes: a,
|
|
5892
5895
|
side: g.DoubleSide
|
|
5893
5896
|
});
|
|
5894
|
-
return g.ColorManagement.enabled = n, { colorMaterial:
|
|
5897
|
+
return g.ColorManagement.enabled = n, { colorMaterial: c, code: o };
|
|
5895
5898
|
}
|
|
5896
5899
|
}
|
|
5897
5900
|
const Ye = class Ye extends J {
|
|
@@ -5908,7 +5911,7 @@ const Ye = class Ye extends J {
|
|
|
5908
5911
|
/**
|
|
5909
5912
|
* An event that is triggered when the Cullers component is disposed.
|
|
5910
5913
|
*/
|
|
5911
|
-
I(this, "onDisposed", new
|
|
5914
|
+
I(this, "onDisposed", new D());
|
|
5912
5915
|
t.add(Ye.uuid, this);
|
|
5913
5916
|
}
|
|
5914
5917
|
/**
|
|
@@ -5965,10 +5968,10 @@ let Ci = Ye;
|
|
|
5965
5968
|
class Gr {
|
|
5966
5969
|
constructor(s) {
|
|
5967
5970
|
/** {@link Disposable.onDisposed} */
|
|
5968
|
-
I(this, "onDisposed", new
|
|
5969
|
-
I(this, "onAfterUpdate", new
|
|
5970
|
-
I(this, "onBeforeUpdate", new
|
|
5971
|
-
I(this, "onResize", new
|
|
5971
|
+
I(this, "onDisposed", new D());
|
|
5972
|
+
I(this, "onAfterUpdate", new D());
|
|
5973
|
+
I(this, "onBeforeUpdate", new D());
|
|
5974
|
+
I(this, "onResize", new D());
|
|
5972
5975
|
// By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
5973
5976
|
I(this, "frontOffset", 0);
|
|
5974
5977
|
I(this, "overrideMaterial", new g.MeshDepthMaterial());
|
|
@@ -6046,20 +6049,18 @@ class Gr {
|
|
|
6046
6049
|
getSize() {
|
|
6047
6050
|
return this._size;
|
|
6048
6051
|
}
|
|
6049
|
-
resize(s) {
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
this._camera.left = e * t / -2, this._camera.right = e * t / 2, this._camera.top = e / 2, this._camera.bottom = -e / 2, this._camera.updateProjectionMatrix(), this.onResize.trigger(s);
|
|
6054
|
-
}
|
|
6052
|
+
resize(s = this._size) {
|
|
6053
|
+
this._size.copy(s), this.renderer.setSize(s.x, s.y);
|
|
6054
|
+
const t = s.x / s.y, e = 1;
|
|
6055
|
+
this._camera.left = e * t / -2, this._camera.right = e * t / 2, this._camera.top = e / 2, this._camera.bottom = -e / 2, this._camera.updateProjectionMatrix(), this.onResize.trigger(s);
|
|
6055
6056
|
}
|
|
6056
6057
|
}
|
|
6057
6058
|
const Ss = class Ss extends J {
|
|
6058
6059
|
constructor(t) {
|
|
6059
6060
|
super(t);
|
|
6060
|
-
I(this, "onAfterUpdate", new
|
|
6061
|
-
I(this, "onBeforeUpdate", new
|
|
6062
|
-
I(this, "onDisposed", new
|
|
6061
|
+
I(this, "onAfterUpdate", new D());
|
|
6062
|
+
I(this, "onBeforeUpdate", new D());
|
|
6063
|
+
I(this, "onDisposed", new D());
|
|
6063
6064
|
I(this, "enabled", !0);
|
|
6064
6065
|
I(this, "list", /* @__PURE__ */ new Map());
|
|
6065
6066
|
this.components.add(Ss.uuid, this);
|
|
@@ -6161,7 +6162,7 @@ class Wr {
|
|
|
6161
6162
|
/**
|
|
6162
6163
|
* Event that fires when the {@link CameraProjection} changes.
|
|
6163
6164
|
*/
|
|
6164
|
-
I(this, "onChanged", new
|
|
6165
|
+
I(this, "onChanged", new D());
|
|
6165
6166
|
I(this, "current", "Perspective");
|
|
6166
6167
|
I(this, "camera");
|
|
6167
6168
|
I(this, "_component");
|
|
@@ -6205,8 +6206,8 @@ class Wr {
|
|
|
6205
6206
|
this._component.threePersp.getWorldDirection(t);
|
|
6206
6207
|
const e = new g.Vector3();
|
|
6207
6208
|
this._component.controls.getTarget(e);
|
|
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,
|
|
6209
|
-
return { width:
|
|
6209
|
+
const o = e.clone().sub(this._component.threePersp.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.threePersp, c = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
|
|
6210
|
+
return { width: c * r, height: c };
|
|
6210
6211
|
}
|
|
6211
6212
|
setupOrthoCamera(s, t) {
|
|
6212
6213
|
this._component.controls.mouseButtons.wheel = ot.ACTION.ZOOM, this._component.controls.mouseButtons.middle = ot.ACTION.ZOOM;
|
|
@@ -6243,8 +6244,8 @@ class na extends ke {
|
|
|
6243
6244
|
(e) => {
|
|
6244
6245
|
this.three = e, this.updateAspect();
|
|
6245
6246
|
}
|
|
6246
|
-
), this.onWorldChanged.add(() => {
|
|
6247
|
-
this._navigationModes.clear(), this._navigationModes.set("Orbit", new Hr(this)), this._navigationModes.set("FirstPerson", new zr(this)), this._navigationModes.set("Plan", new kr(this)), this._mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.currentWorld && this.currentWorld.renderer && (this.previousSize = this.currentWorld.renderer.getSize().clone());
|
|
6247
|
+
), this.onWorldChanged.add(({ action: e }) => {
|
|
6248
|
+
e === "added" && (this._navigationModes.clear(), this._navigationModes.set("Orbit", new Hr(this)), this._navigationModes.set("FirstPerson", new zr(this)), this._navigationModes.set("Plan", new kr(this)), this._mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.currentWorld && this.currentWorld.renderer && (this.previousSize = this.currentWorld.renderer.getSize().clone()));
|
|
6248
6249
|
});
|
|
6249
6250
|
}
|
|
6250
6251
|
get mode() {
|
|
@@ -6283,11 +6284,11 @@ class na extends ke {
|
|
|
6283
6284
|
const p = new g.Box3().setFromObject(u);
|
|
6284
6285
|
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);
|
|
6285
6286
|
}
|
|
6286
|
-
const a = new g.Box3(n, r),
|
|
6287
|
-
a.getSize(
|
|
6287
|
+
const a = new g.Box3(n, r), c = new g.Vector3();
|
|
6288
|
+
a.getSize(c);
|
|
6288
6289
|
const E = new g.Vector3();
|
|
6289
6290
|
a.getCenter(E);
|
|
6290
|
-
const d = Math.max(
|
|
6291
|
+
const d = Math.max(c.x, c.y, c.z) * e, h = new g.Sphere(E, d);
|
|
6291
6292
|
await this.controls.fitToSphere(h, !0);
|
|
6292
6293
|
}
|
|
6293
6294
|
/**
|
|
@@ -6328,7 +6329,7 @@ const At = class At extends J {
|
|
|
6328
6329
|
/** {@link Component.enabled} */
|
|
6329
6330
|
I(this, "enabled", !0);
|
|
6330
6331
|
/** {@link Disposable.onDisposed} */
|
|
6331
|
-
I(this, "onDisposed", new
|
|
6332
|
+
I(this, "onDisposed", new D());
|
|
6332
6333
|
I(this, "_absoluteMin");
|
|
6333
6334
|
I(this, "_absoluteMax");
|
|
6334
6335
|
I(this, "_meshes", []);
|
|
@@ -6368,8 +6369,8 @@ const At = class At extends J {
|
|
|
6368
6369
|
return new g.Sphere(r, a);
|
|
6369
6370
|
}
|
|
6370
6371
|
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(
|
|
6372
|
+
const t = new g.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new g.BoxGeometry(i, o, n), c = new g.Mesh(a);
|
|
6373
|
+
return this._meshes.push(c), c.position.copy(r), c;
|
|
6373
6374
|
}
|
|
6374
6375
|
reset() {
|
|
6375
6376
|
this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
|
|
@@ -6385,17 +6386,17 @@ const At = class At extends J {
|
|
|
6385
6386
|
t.updateMatrixWorld();
|
|
6386
6387
|
const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
|
|
6387
6388
|
if (e && t instanceof Vt.FragmentMesh)
|
|
6388
|
-
for (const
|
|
6389
|
-
const E = t.fragment.getInstancesIDs(
|
|
6389
|
+
for (const c of e) {
|
|
6390
|
+
const E = t.fragment.getInstancesIDs(c);
|
|
6390
6391
|
if (E)
|
|
6391
6392
|
for (const d of E)
|
|
6392
6393
|
a.add(d);
|
|
6393
6394
|
}
|
|
6394
6395
|
else
|
|
6395
6396
|
a.add(0);
|
|
6396
|
-
for (const
|
|
6397
|
+
for (const c of a) {
|
|
6397
6398
|
const E = i.min.clone(), d = i.max.clone();
|
|
6398
|
-
r && (t.getMatrixAt(
|
|
6399
|
+
r && (t.getMatrixAt(c, 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
6400
|
}
|
|
6400
6401
|
}
|
|
6401
6402
|
static getFragmentBounds(t) {
|
|
@@ -6403,12 +6404,12 @@ const At = class At extends J {
|
|
|
6403
6404
|
if (!t.geometry.index)
|
|
6404
6405
|
throw new Error("Geometry must be indexed!");
|
|
6405
6406
|
const a = Array.from(t.geometry.index.array);
|
|
6406
|
-
for (let
|
|
6407
|
-
if (
|
|
6408
|
-
|
|
6407
|
+
for (let c = 0; c < a.length; c++) {
|
|
6408
|
+
if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
|
|
6409
|
+
c += 2;
|
|
6409
6410
|
continue;
|
|
6410
6411
|
}
|
|
6411
|
-
const E = a[
|
|
6412
|
+
const E = a[c], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
|
|
6412
6413
|
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
6414
|
}
|
|
6414
6415
|
return new g.Box3(n, r);
|
|
@@ -6567,18 +6568,18 @@ const Pi = /* @__PURE__ */ new Set([
|
|
|
6567
6568
|
*/
|
|
6568
6569
|
async export(t, e, i = !1, o = !0) {
|
|
6569
6570
|
const n = {}, r = new Set(t.GetIfcEntityList(e)), a = /* @__PURE__ */ new Set([
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6571
|
+
U.IFCPROJECT,
|
|
6572
|
+
U.IFCSITE,
|
|
6573
|
+
U.IFCBUILDING,
|
|
6574
|
+
U.IFCBUILDINGSTOREY,
|
|
6575
|
+
U.IFCSPACE
|
|
6575
6576
|
]);
|
|
6576
|
-
for (const
|
|
6577
|
-
r.add(
|
|
6578
|
-
for (const
|
|
6579
|
-
if (Pi.has(
|
|
6577
|
+
for (const c of a)
|
|
6578
|
+
r.add(c);
|
|
6579
|
+
for (const c of r) {
|
|
6580
|
+
if (Pi.has(c))
|
|
6580
6581
|
continue;
|
|
6581
|
-
const E = a.has(
|
|
6582
|
+
const E = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
|
|
6582
6583
|
for (const h of d) {
|
|
6583
6584
|
const u = t.GetLine(0, h, E, i);
|
|
6584
6585
|
n[u.expressID] = u;
|
|
@@ -6593,9 +6594,9 @@ const Ns = class Ns extends J {
|
|
|
6593
6594
|
constructor(t) {
|
|
6594
6595
|
super(t);
|
|
6595
6596
|
/** {@link Disposable.onDisposed} */
|
|
6596
|
-
I(this, "onDisposed", new
|
|
6597
|
-
I(this, "onFragmentsLoaded", new
|
|
6598
|
-
I(this, "onFragmentsDisposed", new
|
|
6597
|
+
I(this, "onDisposed", new D());
|
|
6598
|
+
I(this, "onFragmentsLoaded", new D());
|
|
6599
|
+
I(this, "onFragmentsDisposed", new D());
|
|
6599
6600
|
/** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
|
|
6600
6601
|
I(this, "list", /* @__PURE__ */ new Map());
|
|
6601
6602
|
I(this, "groups", /* @__PURE__ */ new Map());
|
|
@@ -6636,10 +6637,10 @@ const Ns = class Ns extends J {
|
|
|
6636
6637
|
* @returns The loaded FragmentsGroup.
|
|
6637
6638
|
*/
|
|
6638
6639
|
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([
|
|
6640
|
+
const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n, properties: r, relationsMap: a } = o, c = this._loader.import(t);
|
|
6641
|
+
for (const E of c.items)
|
|
6642
|
+
E.group = c, this.list.set(E.id, E);
|
|
6643
|
+
return n && this.coordinate([c]), this.groups.set(c.uuid, c), r && c.setLocalProperties(r), a && this.components.get(We).setRelationMap(c, a), this.onFragmentsLoaded.trigger(c), c;
|
|
6643
6644
|
}
|
|
6644
6645
|
/**
|
|
6645
6646
|
* Export the specified fragments.
|
|
@@ -6813,8 +6814,8 @@ class oa {
|
|
|
6813
6814
|
const e = {}, i = Object.keys(Xr).map((o) => parseInt(o, 10));
|
|
6814
6815
|
for (let o = 0; o < i.length; o++) {
|
|
6815
6816
|
const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
|
|
6816
|
-
for (let
|
|
6817
|
-
e[r.get(
|
|
6817
|
+
for (let c = 0; c < a; c++)
|
|
6818
|
+
e[r.get(c)] = n;
|
|
6818
6819
|
}
|
|
6819
6820
|
return e;
|
|
6820
6821
|
}
|
|
@@ -7964,7 +7965,7 @@ const bn = {
|
|
|
7964
7965
|
class Gt {
|
|
7965
7966
|
static async getUnits(s) {
|
|
7966
7967
|
var n;
|
|
7967
|
-
const { IFCUNITASSIGNMENT: t } =
|
|
7968
|
+
const { IFCUNITASSIGNMENT: t } = U, e = await s.getAllPropertiesOfType(t);
|
|
7968
7969
|
if (!e)
|
|
7969
7970
|
return 1;
|
|
7970
7971
|
const i = Object.keys(e), o = e[parseInt(i[0], 10)];
|
|
@@ -7991,10 +7992,10 @@ class Gt {
|
|
|
7991
7992
|
}
|
|
7992
7993
|
static async getRelationMap(s, t, e) {
|
|
7993
7994
|
var a;
|
|
7994
|
-
const o = e ?? (() => {
|
|
7995
|
+
const o = e ?? (async () => {
|
|
7995
7996
|
}), n = {}, r = s.getAllPropertiesIDs();
|
|
7996
|
-
for (const
|
|
7997
|
-
const E = await s.getProperties(
|
|
7997
|
+
for (const c of r) {
|
|
7998
|
+
const E = await s.getProperties(c);
|
|
7998
7999
|
if (!E)
|
|
7999
8000
|
continue;
|
|
8000
8001
|
const d = E.type === t, h = Object.keys(E).find(
|
|
@@ -8008,26 +8009,26 @@ class Gt {
|
|
|
8008
8009
|
if (!p || !A || !(A && Array.isArray(A)))
|
|
8009
8010
|
continue;
|
|
8010
8011
|
const R = A.map((C) => C.value);
|
|
8011
|
-
o(p.expressID, R), n[p.expressID] = R;
|
|
8012
|
+
await o(p.expressID, R), n[p.expressID] = R;
|
|
8012
8013
|
}
|
|
8013
8014
|
return n;
|
|
8014
8015
|
}
|
|
8015
8016
|
static async getQsetQuantities(s, t, e) {
|
|
8016
8017
|
const o = e ?? (() => {
|
|
8017
8018
|
}), n = await s.getProperties(t);
|
|
8018
|
-
return !n || n.type !==
|
|
8019
|
+
return !n || n.type !== U.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
|
|
8019
8020
|
}
|
|
8020
8021
|
static async getPsetProps(s, t, e) {
|
|
8021
8022
|
const o = e ?? (() => {
|
|
8022
8023
|
}), n = await s.getProperties(t);
|
|
8023
|
-
return !n || n.type !==
|
|
8024
|
+
return !n || n.type !== U.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
|
|
8024
8025
|
}
|
|
8025
8026
|
static async getPsetRel(s, t) {
|
|
8026
8027
|
var r;
|
|
8027
8028
|
if (!await s.getProperties(t))
|
|
8028
8029
|
return null;
|
|
8029
8030
|
const i = await s.getAllPropertiesOfType(
|
|
8030
|
-
|
|
8031
|
+
U.IFCRELDEFINESBYPROPERTIES
|
|
8031
8032
|
);
|
|
8032
8033
|
if (!i)
|
|
8033
8034
|
return null;
|
|
@@ -8098,56 +8099,56 @@ class Gt {
|
|
|
8098
8099
|
}
|
|
8099
8100
|
const Zr = /* @__PURE__ */ new Map([
|
|
8100
8101
|
[
|
|
8101
|
-
|
|
8102
|
+
U.IFCRELAGGREGATES,
|
|
8102
8103
|
{
|
|
8103
8104
|
forRelating: "IsDecomposedBy",
|
|
8104
8105
|
forRelated: "Decomposes"
|
|
8105
8106
|
}
|
|
8106
8107
|
],
|
|
8107
8108
|
[
|
|
8108
|
-
|
|
8109
|
+
U.IFCRELASSOCIATESMATERIAL,
|
|
8109
8110
|
{
|
|
8110
8111
|
forRelating: "AssociatedTo",
|
|
8111
8112
|
forRelated: "HasAssociations"
|
|
8112
8113
|
}
|
|
8113
8114
|
],
|
|
8114
8115
|
[
|
|
8115
|
-
|
|
8116
|
+
U.IFCRELASSOCIATESCLASSIFICATION,
|
|
8116
8117
|
{
|
|
8117
8118
|
forRelating: "ClassificationForObjects",
|
|
8118
8119
|
forRelated: "HasAssociations"
|
|
8119
8120
|
}
|
|
8120
8121
|
],
|
|
8121
8122
|
[
|
|
8122
|
-
|
|
8123
|
+
U.IFCRELASSIGNSTOGROUP,
|
|
8123
8124
|
{
|
|
8124
8125
|
forRelating: "IsGroupedBy",
|
|
8125
8126
|
forRelated: "HasAssignments"
|
|
8126
8127
|
}
|
|
8127
8128
|
],
|
|
8128
8129
|
[
|
|
8129
|
-
|
|
8130
|
+
U.IFCRELDEFINESBYPROPERTIES,
|
|
8130
8131
|
{
|
|
8131
8132
|
forRelated: "IsDefinedBy",
|
|
8132
8133
|
forRelating: "DefinesOcurrence"
|
|
8133
8134
|
}
|
|
8134
8135
|
],
|
|
8135
8136
|
[
|
|
8136
|
-
|
|
8137
|
+
U.IFCRELDEFINESBYTYPE,
|
|
8137
8138
|
{
|
|
8138
8139
|
forRelated: "IsTypedBy",
|
|
8139
8140
|
forRelating: "Types"
|
|
8140
8141
|
}
|
|
8141
8142
|
],
|
|
8142
8143
|
[
|
|
8143
|
-
|
|
8144
|
+
U.IFCRELDEFINESBYTEMPLATE,
|
|
8144
8145
|
{
|
|
8145
8146
|
forRelated: "IsDefinedBy",
|
|
8146
8147
|
forRelating: "Defines"
|
|
8147
8148
|
}
|
|
8148
8149
|
],
|
|
8149
8150
|
[
|
|
8150
|
-
|
|
8151
|
+
U.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
8151
8152
|
{
|
|
8152
8153
|
forRelated: "ContainedInStructure",
|
|
8153
8154
|
forRelating: "ContainsElements"
|
|
@@ -8157,9 +8158,9 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8157
8158
|
constructor(t) {
|
|
8158
8159
|
super(t);
|
|
8159
8160
|
/** {@link Disposable.onDisposed} */
|
|
8160
|
-
I(this, "onDisposed", new
|
|
8161
|
+
I(this, "onDisposed", new D());
|
|
8161
8162
|
I(this, "enabled", !0);
|
|
8162
|
-
I(this, "onRelationsIndexed", new
|
|
8163
|
+
I(this, "onRelationsIndexed", new D());
|
|
8163
8164
|
I(this, "_relToAttributesMap", Zr);
|
|
8164
8165
|
I(this, "_inverseAttributes", [
|
|
8165
8166
|
"IsDecomposedBy",
|
|
@@ -8178,14 +8179,14 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8178
8179
|
"ContainsElements"
|
|
8179
8180
|
]);
|
|
8180
8181
|
I(this, "_ifcRels", [
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8182
|
+
U.IFCRELAGGREGATES,
|
|
8183
|
+
U.IFCRELASSOCIATESMATERIAL,
|
|
8184
|
+
U.IFCRELASSOCIATESCLASSIFICATION,
|
|
8185
|
+
U.IFCRELASSIGNSTOGROUP,
|
|
8186
|
+
U.IFCRELDEFINESBYPROPERTIES,
|
|
8187
|
+
U.IFCRELDEFINESBYTYPE,
|
|
8188
|
+
U.IFCRELDEFINESBYTEMPLATE,
|
|
8189
|
+
U.IFCRELCONTAINEDINSPATIALSTRUCTURE
|
|
8189
8190
|
]);
|
|
8190
8191
|
/**
|
|
8191
8192
|
* Holds the relationship mappings for each model processed by the indexer.
|
|
@@ -8246,7 +8247,7 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8246
8247
|
const r = this._relToAttributesMap.get(i);
|
|
8247
8248
|
if (!r)
|
|
8248
8249
|
return;
|
|
8249
|
-
const { forRelated: a, forRelating:
|
|
8250
|
+
const { forRelated: a, forRelating: c } = r, E = e.get(o) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(c);
|
|
8250
8251
|
E.set(d, n), e.set(o, E);
|
|
8251
8252
|
for (const h of n) {
|
|
8252
8253
|
const u = e.get(h) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(a), A = u.get(p) ?? [];
|
|
@@ -8270,11 +8271,11 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8270
8271
|
const n = this._relToAttributesMap.get(o);
|
|
8271
8272
|
if (!n)
|
|
8272
8273
|
continue;
|
|
8273
|
-
const { forRelated: r, forRelating: a } = n,
|
|
8274
|
-
for (let E = 0; E <
|
|
8274
|
+
const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
|
|
8275
|
+
for (let E = 0; E < c.size(); E++) {
|
|
8275
8276
|
const d = await t.properties.getItemProperties(
|
|
8276
8277
|
e,
|
|
8277
|
-
|
|
8278
|
+
c.get(E)
|
|
8278
8279
|
), h = Object.keys(d).find(
|
|
8279
8280
|
(T) => T.startsWith("Relating")
|
|
8280
8281
|
), u = Object.keys(d).find(
|
|
@@ -8365,8 +8366,8 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8365
8366
|
const i = this.relationMaps[e], o = {};
|
|
8366
8367
|
for (const [n, r] of i.entries()) {
|
|
8367
8368
|
o[n] || (o[n] = {});
|
|
8368
|
-
for (const [a,
|
|
8369
|
-
o[n][a] =
|
|
8369
|
+
for (const [a, c] of r.entries())
|
|
8370
|
+
o[n][a] = c;
|
|
8370
8371
|
}
|
|
8371
8372
|
t[e] = o;
|
|
8372
8373
|
}
|
|
@@ -8404,7 +8405,7 @@ const Zr = /* @__PURE__ */ new Map([
|
|
|
8404
8405
|
}
|
|
8405
8406
|
};
|
|
8406
8407
|
I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
|
|
8407
|
-
let
|
|
8408
|
+
let We = Ve;
|
|
8408
8409
|
class Qr {
|
|
8409
8410
|
constructor() {
|
|
8410
8411
|
I(this, "factor", 1);
|
|
@@ -8427,7 +8428,7 @@ class Qr {
|
|
|
8427
8428
|
try {
|
|
8428
8429
|
const e = s.GetLineIDsWithType(
|
|
8429
8430
|
0,
|
|
8430
|
-
|
|
8431
|
+
U.IFCUNITASSIGNMENT
|
|
8431
8432
|
).get(0), i = s.GetLine(0, e);
|
|
8432
8433
|
for (const o of i.Units) {
|
|
8433
8434
|
if (!o || o.value === null || o.value === void 0)
|
|
@@ -8474,13 +8475,13 @@ class vn {
|
|
|
8474
8475
|
try {
|
|
8475
8476
|
const t = s.GetLineIDsWithType(
|
|
8476
8477
|
0,
|
|
8477
|
-
|
|
8478
|
-
), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0,
|
|
8479
|
-
for (let
|
|
8480
|
-
e.add(i.get(
|
|
8481
|
-
const o = s.GetLineIDsWithType(0,
|
|
8482
|
-
for (let
|
|
8483
|
-
const E = o.get(
|
|
8478
|
+
U.IFCRELCONTAINEDINSPATIALSTRUCTURE
|
|
8479
|
+
), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, U.IFCSPACE);
|
|
8480
|
+
for (let c = 0; c < i.size(); c++)
|
|
8481
|
+
e.add(i.get(c));
|
|
8482
|
+
const o = s.GetLineIDsWithType(0, U.IFCRELAGGREGATES), n = o.size();
|
|
8483
|
+
for (let c = 0; c < n; c++) {
|
|
8484
|
+
const E = o.get(c), d = s.GetLine(0, E);
|
|
8484
8485
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8485
8486
|
continue;
|
|
8486
8487
|
const h = d.RelatingObject.value, u = d.RelatedObjects;
|
|
@@ -8490,8 +8491,8 @@ class vn {
|
|
|
8490
8491
|
}
|
|
8491
8492
|
}
|
|
8492
8493
|
const r = {}, a = t.size();
|
|
8493
|
-
for (let
|
|
8494
|
-
const E = t.get(
|
|
8494
|
+
for (let c = 0; c < a; c++) {
|
|
8495
|
+
const E = t.get(c), d = s.GetLine(0, E);
|
|
8495
8496
|
if (!d || !d.RelatingStructure || !d.RelatedElements)
|
|
8496
8497
|
continue;
|
|
8497
8498
|
const h = d.RelatingStructure.value, u = d.RelatedElements;
|
|
@@ -8507,16 +8508,16 @@ class vn {
|
|
|
8507
8508
|
this.itemsByFloor[A] = h;
|
|
8508
8509
|
}
|
|
8509
8510
|
}
|
|
8510
|
-
for (const
|
|
8511
|
-
const E = this.itemsByFloor[
|
|
8511
|
+
for (const c in r) {
|
|
8512
|
+
const E = this.itemsByFloor[c];
|
|
8512
8513
|
if (E !== void 0) {
|
|
8513
|
-
const d = r[
|
|
8514
|
+
const d = r[c];
|
|
8514
8515
|
for (const h of d)
|
|
8515
8516
|
this.itemsByFloor[h] = E;
|
|
8516
8517
|
}
|
|
8517
8518
|
}
|
|
8518
|
-
for (let
|
|
8519
|
-
const E = o.get(
|
|
8519
|
+
for (let c = 0; c < n; c++) {
|
|
8520
|
+
const E = o.get(c), d = s.GetLine(0, E);
|
|
8520
8521
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8521
8522
|
continue;
|
|
8522
8523
|
const h = d.RelatingObject.value, u = d.RelatedObjects;
|
|
@@ -8541,14 +8542,14 @@ class Li {
|
|
|
8541
8542
|
* Generate the geometry for categories that are not included by default,
|
|
8542
8543
|
* like IFCSPACE.
|
|
8543
8544
|
*/
|
|
8544
|
-
I(this, "optionalCategories", [
|
|
8545
|
+
I(this, "optionalCategories", [U.IFCSPACE]);
|
|
8545
8546
|
/** Whether to use the coordination data coming from the IFC files. */
|
|
8546
8547
|
I(this, "coordinate", !0);
|
|
8547
8548
|
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
8548
8549
|
I(this, "wasm", {
|
|
8549
8550
|
path: "",
|
|
8550
8551
|
absolute: !1,
|
|
8551
|
-
logLevel:
|
|
8552
|
+
logLevel: U.LogLevel.LOG_LEVEL_OFF
|
|
8552
8553
|
});
|
|
8553
8554
|
/** List of categories that won't be converted to fragments. */
|
|
8554
8555
|
I(this, "excludedCategories", /* @__PURE__ */ new Set());
|
|
@@ -8600,8 +8601,8 @@ class Bn {
|
|
|
8600
8601
|
const { x: u, y: p, z: A } = r[h];
|
|
8601
8602
|
a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = A || 0;
|
|
8602
8603
|
}
|
|
8603
|
-
const
|
|
8604
|
-
E.setAttribute("position",
|
|
8604
|
+
const c = new g.BufferAttribute(a, 3), E = new g.EdgesGeometry();
|
|
8605
|
+
E.setAttribute("position", c);
|
|
8605
8606
|
const d = new Vt.CurveMesh(
|
|
8606
8607
|
i,
|
|
8607
8608
|
n,
|
|
@@ -8633,13 +8634,13 @@ class Yn {
|
|
|
8633
8634
|
const Ge = class Ge extends J {
|
|
8634
8635
|
constructor(t) {
|
|
8635
8636
|
super(t);
|
|
8636
|
-
I(this, "onIfcStartedLoading", new
|
|
8637
|
-
I(this, "onSetup", new
|
|
8637
|
+
I(this, "onIfcStartedLoading", new D());
|
|
8638
|
+
I(this, "onSetup", new D());
|
|
8638
8639
|
/** {@link Disposable.onDisposed} */
|
|
8639
|
-
I(this, "onDisposed", new
|
|
8640
|
+
I(this, "onDisposed", new D());
|
|
8640
8641
|
I(this, "settings", new Li());
|
|
8641
8642
|
I(this, "enabled", !0);
|
|
8642
|
-
I(this, "webIfc", new
|
|
8643
|
+
I(this, "webIfc", new U.IfcAPI());
|
|
8643
8644
|
I(this, "_material", new g.MeshLambertMaterial());
|
|
8644
8645
|
I(this, "_spatialTree", new vn());
|
|
8645
8646
|
I(this, "_metaData", new Yn());
|
|
@@ -8650,7 +8651,7 @@ const Ge = class Ge extends J {
|
|
|
8650
8651
|
transparent: !0,
|
|
8651
8652
|
opacity: 0.5
|
|
8652
8653
|
}));
|
|
8653
|
-
this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(
|
|
8654
|
+
this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(U.IFCOPENINGELEMENT);
|
|
8654
8655
|
}
|
|
8655
8656
|
dispose() {
|
|
8656
8657
|
this.webIfc = null, this.onDisposed.trigger(Ge.uuid), this.onDisposed.reset();
|
|
@@ -8665,8 +8666,8 @@ const Ge = class Ge extends J {
|
|
|
8665
8666
|
o.setLocalProperties(r), this.cleanUp();
|
|
8666
8667
|
const a = this.components.get(ut);
|
|
8667
8668
|
a.groups.set(o.uuid, o);
|
|
8668
|
-
for (const
|
|
8669
|
-
a.list.set(
|
|
8669
|
+
for (const c of o.items)
|
|
8670
|
+
a.list.set(c.id, c), c.mesh.uuid = c.id, c.group = o;
|
|
8670
8671
|
return a.onFragmentsLoaded.trigger(o), e && a.coordinate([o]), console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
|
|
8671
8672
|
}
|
|
8672
8673
|
async readIfcFile(t) {
|
|
@@ -8675,7 +8676,7 @@ const Ge = class Ge extends J {
|
|
|
8675
8676
|
}
|
|
8676
8677
|
async getAllGeometries() {
|
|
8677
8678
|
this._spatialTree.setUp(this.webIfc);
|
|
8678
|
-
const t = this.webIfc.GetIfcEntityList(0), e = new Vt.FragmentsGroup(), { FILE_NAME: i, FILE_DESCRIPTION: o } =
|
|
8679
|
+
const t = this.webIfc.GetIfcEntityList(0), e = new Vt.FragmentsGroup(), { FILE_NAME: i, FILE_DESCRIPTION: o } = U;
|
|
8679
8680
|
e.ifcMetadata = {
|
|
8680
8681
|
name: this._metaData.get(this.webIfc, i),
|
|
8681
8682
|
description: this._metaData.get(this.webIfc, o),
|
|
@@ -8684,11 +8685,11 @@ const Ge = class Ge extends J {
|
|
|
8684
8685
|
};
|
|
8685
8686
|
const n = [];
|
|
8686
8687
|
for (const a of t) {
|
|
8687
|
-
if (!this.webIfc.IsIfcElement(a) && a !==
|
|
8688
|
+
if (!this.webIfc.IsIfcElement(a) && a !== U.IFCSPACE || this.settings.excludedCategories.has(a))
|
|
8688
8689
|
continue;
|
|
8689
|
-
const
|
|
8690
|
+
const c = this.webIfc.GetLineIDsWithType(0, a), E = c.size();
|
|
8690
8691
|
for (let d = 0; d < E; d++) {
|
|
8691
|
-
const h =
|
|
8692
|
+
const h = c.get(d);
|
|
8692
8693
|
n.push(h);
|
|
8693
8694
|
const u = this._spatialTree.itemsByFloor[h] || 0;
|
|
8694
8695
|
e.data.set(h, [[], [u, a]]);
|
|
@@ -8698,15 +8699,15 @@ const Ge = class Ge extends J {
|
|
|
8698
8699
|
this.getMesh(a, e);
|
|
8699
8700
|
});
|
|
8700
8701
|
for (const a of this._visitedFragments) {
|
|
8701
|
-
const { index:
|
|
8702
|
-
e.keyFragments.set(
|
|
8702
|
+
const { index: c, fragment: E } = a[1];
|
|
8703
|
+
e.keyFragments.set(c, E.id);
|
|
8703
8704
|
}
|
|
8704
8705
|
for (const a of e.items) {
|
|
8705
|
-
const
|
|
8706
|
-
if (!
|
|
8706
|
+
const c = this._fragmentInstances.get(a.id);
|
|
8707
|
+
if (!c)
|
|
8707
8708
|
throw new Error("Fragment not found!");
|
|
8708
8709
|
const E = [];
|
|
8709
|
-
for (const [d, h] of
|
|
8710
|
+
for (const [d, h] of c)
|
|
8710
8711
|
E.push(h);
|
|
8711
8712
|
a.add(E);
|
|
8712
8713
|
}
|
|
@@ -8714,19 +8715,19 @@ const Ge = class Ge extends J {
|
|
|
8714
8715
|
return e.coordinationMatrix.fromArray(r), e.civilData = this._civil.read(this.webIfc), e;
|
|
8715
8716
|
}
|
|
8716
8717
|
cleanUp() {
|
|
8717
|
-
this.webIfc = null, this.webIfc = new
|
|
8718
|
+
this.webIfc = null, this.webIfc = new U.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
|
|
8718
8719
|
}
|
|
8719
8720
|
getMesh(t, e) {
|
|
8720
8721
|
const i = t.geometries.size(), o = t.expressID;
|
|
8721
8722
|
for (let n = 0; n < i; n++) {
|
|
8722
|
-
const r = t.geometries.get(n), { x: a, y:
|
|
8723
|
+
const r = t.geometries.get(n), { x: a, y: c, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
|
|
8723
8724
|
if (!this._visitedFragments.has(p)) {
|
|
8724
8725
|
const m = this.getGeometry(this.webIfc, u), O = h ? this._materialT : this._material, S = new Vt.Fragment(m, O, 1);
|
|
8725
8726
|
e.add(S.mesh), e.items.push(S);
|
|
8726
8727
|
const _ = this._visitedFragments.size;
|
|
8727
8728
|
this._visitedFragments.set(p, { index: _, fragment: S });
|
|
8728
8729
|
}
|
|
8729
|
-
const A = new g.Color().setRGB(a,
|
|
8730
|
+
const A = new g.Color().setRGB(a, c, E, "srgb"), R = new g.Matrix4();
|
|
8730
8731
|
R.fromArray(r.flatTransformation);
|
|
8731
8732
|
const C = this._visitedFragments.get(p);
|
|
8732
8733
|
if (C === void 0)
|
|
@@ -8759,8 +8760,8 @@ const Ge = class Ge extends J {
|
|
|
8759
8760
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
8760
8761
|
for (let h = 0; h < n.length; h += 6)
|
|
8761
8762
|
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
|
|
8763
|
+
const c = new g.BufferGeometry(), E = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
|
|
8764
|
+
return c.setAttribute("position", E), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
|
|
8764
8765
|
}
|
|
8765
8766
|
async autoSetWasm() {
|
|
8766
8767
|
const t = await fetch(
|
|
@@ -8789,13 +8790,13 @@ const Bt = class Bt extends J {
|
|
|
8789
8790
|
constructor(t) {
|
|
8790
8791
|
super(t);
|
|
8791
8792
|
/** {@link Disposable.onDisposed} */
|
|
8792
|
-
I(this, "onDisposed", new
|
|
8793
|
-
I(this, "onRequestFile", new
|
|
8793
|
+
I(this, "onDisposed", new D());
|
|
8794
|
+
I(this, "onRequestFile", new D());
|
|
8794
8795
|
I(this, "ifcToExport", null);
|
|
8795
|
-
I(this, "onElementToPset", new
|
|
8796
|
-
I(this, "onPropToPset", new
|
|
8797
|
-
I(this, "onPsetRemoved", new
|
|
8798
|
-
I(this, "onDataChanged", new
|
|
8796
|
+
I(this, "onElementToPset", new D());
|
|
8797
|
+
I(this, "onPropToPset", new D());
|
|
8798
|
+
I(this, "onPsetRemoved", new D());
|
|
8799
|
+
I(this, "onDataChanged", new D());
|
|
8799
8800
|
I(this, "wasm", {
|
|
8800
8801
|
path: "/",
|
|
8801
8802
|
absolute: !1
|
|
@@ -8820,15 +8821,15 @@ const Bt = class Bt extends J {
|
|
|
8820
8821
|
}
|
|
8821
8822
|
newGUID(t) {
|
|
8822
8823
|
const e = Bt.getIFCSchema(t);
|
|
8823
|
-
return new
|
|
8824
|
+
return new U[e].IfcGloballyUniqueId(ze.create());
|
|
8824
8825
|
}
|
|
8825
8826
|
async getOwnerHistory(t) {
|
|
8826
8827
|
const e = await t.getAllPropertiesOfType(
|
|
8827
|
-
|
|
8828
|
+
U.IFCOWNERHISTORY
|
|
8828
8829
|
);
|
|
8829
8830
|
if (!e)
|
|
8830
8831
|
throw new Error("No OwnerHistory was found.");
|
|
8831
|
-
const i = Object.keys(e).map((r) => parseInt(r, 10)), o = e[i[0]], n = new
|
|
8832
|
+
const i = Object.keys(e).map((r) => parseInt(r, 10)), o = e[i[0]], n = new U.Handle(o.expressID);
|
|
8832
8833
|
return { ownerHistory: o, ownerHistoryHandle: n };
|
|
8833
8834
|
}
|
|
8834
8835
|
registerChange(t, ...e) {
|
|
@@ -8843,28 +8844,28 @@ const Bt = class Bt extends J {
|
|
|
8843
8844
|
}
|
|
8844
8845
|
}
|
|
8845
8846
|
async newPset(t, e, i) {
|
|
8846
|
-
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new
|
|
8847
|
+
const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new U[o].IfcLabel(e), c = i ? new U[o].IfcText(i) : null, E = new U[o].IfcPropertySet(
|
|
8847
8848
|
r,
|
|
8848
8849
|
n,
|
|
8849
8850
|
a,
|
|
8850
|
-
|
|
8851
|
+
c,
|
|
8851
8852
|
[]
|
|
8852
8853
|
);
|
|
8853
8854
|
E.expressID = this.increaseMaxID(t);
|
|
8854
|
-
const d = this.newGUID(t), h = new
|
|
8855
|
+
const d = this.newGUID(t), h = new U[o].IfcRelDefinesByProperties(
|
|
8855
8856
|
d,
|
|
8856
8857
|
n,
|
|
8857
8858
|
null,
|
|
8858
8859
|
null,
|
|
8859
8860
|
[],
|
|
8860
|
-
new
|
|
8861
|
+
new U.Handle(E.expressID)
|
|
8861
8862
|
);
|
|
8862
8863
|
return h.expressID = this.increaseMaxID(t), await this.setData(t, E, h), { pset: E, rel: h };
|
|
8863
8864
|
}
|
|
8864
8865
|
async removePset(t, ...e) {
|
|
8865
8866
|
for (const i of e) {
|
|
8866
8867
|
const o = await t.getProperties(i);
|
|
8867
|
-
if ((o == null ? void 0 : o.type) !==
|
|
8868
|
+
if ((o == null ? void 0 : o.type) !== U.IFCPROPERTYSET)
|
|
8868
8869
|
continue;
|
|
8869
8870
|
const n = await Gt.getPsetRel(t, i);
|
|
8870
8871
|
if (n && (await t.setProperties(n, null), this.registerChange(t, n)), o) {
|
|
@@ -8875,13 +8876,13 @@ const Bt = class Bt extends J {
|
|
|
8875
8876
|
}
|
|
8876
8877
|
}
|
|
8877
8878
|
async newSingleProperty(t, e, i, o) {
|
|
8878
|
-
const n = Bt.getIFCSchema(t), r = new
|
|
8879
|
+
const n = Bt.getIFCSchema(t), r = new U[n].IfcIdentifier(i), a = new U[n][e](o), c = new U[n].IfcPropertySingleValue(
|
|
8879
8880
|
r,
|
|
8880
8881
|
null,
|
|
8881
8882
|
a,
|
|
8882
8883
|
null
|
|
8883
8884
|
);
|
|
8884
|
-
return
|
|
8885
|
+
return c.expressID = this.increaseMaxID(t), await this.setData(t, c), c;
|
|
8885
8886
|
}
|
|
8886
8887
|
newSingleStringProperty(t, e, i, o) {
|
|
8887
8888
|
return this.newSingleProperty(t, e, i, o);
|
|
@@ -8894,7 +8895,7 @@ const Bt = class Bt extends J {
|
|
|
8894
8895
|
}
|
|
8895
8896
|
async removePsetProp(t, e, i) {
|
|
8896
8897
|
const o = await t.getProperties(e), n = await t.getProperties(i);
|
|
8897
|
-
!o || !n || o.type ===
|
|
8898
|
+
!o || !n || o.type === U.IFCPROPERTYSET && n && (o.HasProperties = o.HasProperties.filter((r) => r.value !== i), await t.setProperties(i, null), this.registerChange(t, e, i));
|
|
8898
8899
|
}
|
|
8899
8900
|
async addElementToPset(t, e, ...i) {
|
|
8900
8901
|
const o = await Gt.getPsetRel(t, e);
|
|
@@ -8903,7 +8904,7 @@ const Bt = class Bt extends J {
|
|
|
8903
8904
|
const n = await t.getProperties(o);
|
|
8904
8905
|
if (n) {
|
|
8905
8906
|
for (const r of i) {
|
|
8906
|
-
const a = new
|
|
8907
|
+
const a = new U.Handle(r);
|
|
8907
8908
|
n.RelatedObjects.push(a), this.onElementToPset.trigger({
|
|
8908
8909
|
model: t,
|
|
8909
8910
|
psetID: e,
|
|
@@ -8919,7 +8920,7 @@ const Bt = class Bt extends J {
|
|
|
8919
8920
|
for (const n of i) {
|
|
8920
8921
|
if (o.HasProperties.includes(n))
|
|
8921
8922
|
continue;
|
|
8922
|
-
const r = new
|
|
8923
|
+
const r = new U.Handle(n);
|
|
8923
8924
|
o.HasProperties.push(r), this.onPropToPset.trigger({ model: t, psetID: e, propID: n });
|
|
8924
8925
|
}
|
|
8925
8926
|
this.registerChange(t, e);
|
|
@@ -8927,8 +8928,8 @@ const Bt = class Bt extends J {
|
|
|
8927
8928
|
}
|
|
8928
8929
|
async saveToIfc(t, e) {
|
|
8929
8930
|
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(
|
|
8931
|
+
for (const c of r) {
|
|
8932
|
+
const E = await t.getProperties(c);
|
|
8932
8933
|
if (E)
|
|
8933
8934
|
try {
|
|
8934
8935
|
o.WriteLine(n, E);
|
|
@@ -8936,7 +8937,7 @@ const Bt = class Bt extends J {
|
|
|
8936
8937
|
}
|
|
8937
8938
|
else
|
|
8938
8939
|
try {
|
|
8939
|
-
o.DeleteLine(n,
|
|
8940
|
+
o.DeleteLine(n, c);
|
|
8940
8941
|
} catch {
|
|
8941
8942
|
}
|
|
8942
8943
|
}
|
|
@@ -8959,15 +8960,15 @@ const Bt = class Bt extends J {
|
|
|
8959
8960
|
const a = r.value;
|
|
8960
8961
|
if (a === void 0 || a == null)
|
|
8961
8962
|
throw new Error(`Attribute ${i} has a badly defined handle.`);
|
|
8962
|
-
const
|
|
8963
|
+
const c = new D();
|
|
8963
8964
|
return Object.defineProperty(n[i], "value", {
|
|
8964
8965
|
get() {
|
|
8965
8966
|
return this._value;
|
|
8966
8967
|
},
|
|
8967
8968
|
async set(E) {
|
|
8968
|
-
this._value = E,
|
|
8969
|
+
this._value = E, c.trigger(E);
|
|
8969
8970
|
}
|
|
8970
|
-
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] =
|
|
8971
|
+
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = c, c;
|
|
8971
8972
|
}
|
|
8972
8973
|
};
|
|
8973
8974
|
I(Bt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
|
|
@@ -8979,7 +8980,7 @@ const Ps = class Ps extends J {
|
|
|
8979
8980
|
I(this, "enabled", !0);
|
|
8980
8981
|
I(this, "list", {});
|
|
8981
8982
|
/** {@link Disposable.onDisposed} */
|
|
8982
|
-
I(this, "onDisposed", new
|
|
8983
|
+
I(this, "onDisposed", new D());
|
|
8983
8984
|
I(this, "onFragmentsDisposed", (t) => {
|
|
8984
8985
|
const { groupID: e, fragmentIDs: i } = t;
|
|
8985
8986
|
for (const o in this.list) {
|
|
@@ -8988,10 +8989,10 @@ const Ps = class Ps extends J {
|
|
|
8988
8989
|
delete n[e], Object.values(n).length === 0 && delete this.list[o];
|
|
8989
8990
|
else
|
|
8990
8991
|
for (const a of r) {
|
|
8991
|
-
const
|
|
8992
|
+
const c = n[a];
|
|
8992
8993
|
for (const E of i)
|
|
8993
|
-
delete
|
|
8994
|
-
Object.values(
|
|
8994
|
+
delete c[E];
|
|
8995
|
+
Object.values(c).length === 0 && delete n[a];
|
|
8995
8996
|
}
|
|
8996
8997
|
}
|
|
8997
8998
|
});
|
|
@@ -9013,8 +9014,8 @@ const Ps = class Ps extends J {
|
|
|
9013
9014
|
const e = this.components.get(ut);
|
|
9014
9015
|
if (!t) {
|
|
9015
9016
|
const r = {};
|
|
9016
|
-
for (const [a,
|
|
9017
|
-
r[a] = new Set(
|
|
9017
|
+
for (const [a, c] of e.list)
|
|
9018
|
+
r[a] = new Set(c.ids);
|
|
9018
9019
|
return r;
|
|
9019
9020
|
}
|
|
9020
9021
|
const i = Object.keys(t).length, o = {};
|
|
@@ -9024,8 +9025,8 @@ const Ps = class Ps extends J {
|
|
|
9024
9025
|
console.warn(`Classification ${r} does not exist.`);
|
|
9025
9026
|
continue;
|
|
9026
9027
|
}
|
|
9027
|
-
for (const
|
|
9028
|
-
const E = this.list[r][
|
|
9028
|
+
for (const c of a) {
|
|
9029
|
+
const E = this.list[r][c];
|
|
9029
9030
|
if (E)
|
|
9030
9031
|
for (const d in E) {
|
|
9031
9032
|
o[d] || (o[d] = /* @__PURE__ */ new Map());
|
|
@@ -9039,10 +9040,10 @@ const Ps = class Ps extends J {
|
|
|
9039
9040
|
const n = {};
|
|
9040
9041
|
for (const r in o) {
|
|
9041
9042
|
const a = o[r];
|
|
9042
|
-
for (const [
|
|
9043
|
+
for (const [c, E] of a) {
|
|
9043
9044
|
if (E === void 0)
|
|
9044
9045
|
throw new Error("Malformed fragments map!");
|
|
9045
|
-
E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(
|
|
9046
|
+
E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
|
|
9046
9047
|
}
|
|
9047
9048
|
}
|
|
9048
9049
|
return n;
|
|
@@ -9054,8 +9055,8 @@ const Ps = class Ps extends J {
|
|
|
9054
9055
|
const o = i[t];
|
|
9055
9056
|
for (const [n, r] of e.data) {
|
|
9056
9057
|
const a = r[0];
|
|
9057
|
-
for (const
|
|
9058
|
-
const E = e.keyFragments.get(
|
|
9058
|
+
for (const c of a) {
|
|
9059
|
+
const E = e.keyFragments.get(c);
|
|
9059
9060
|
E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
|
|
9060
9061
|
}
|
|
9061
9062
|
}
|
|
@@ -9070,14 +9071,14 @@ const Ps = class Ps extends J {
|
|
|
9070
9071
|
continue;
|
|
9071
9072
|
const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
|
|
9072
9073
|
e[a] || (e[a] = {});
|
|
9073
|
-
const
|
|
9074
|
+
const c = e[a];
|
|
9074
9075
|
for (const [E, d] of t.data) {
|
|
9075
9076
|
const h = d[0];
|
|
9076
9077
|
for (const u of h) {
|
|
9077
9078
|
const p = t.keyFragments.get(u);
|
|
9078
9079
|
if (!p)
|
|
9079
9080
|
throw new Error("Fragment ID not found!");
|
|
9080
|
-
|
|
9081
|
+
c[p] || (c[p] = /* @__PURE__ */ new Set()), c[p].add(r.expressID);
|
|
9081
9082
|
}
|
|
9082
9083
|
}
|
|
9083
9084
|
}
|
|
@@ -9089,12 +9090,6 @@ const Ps = class Ps extends J {
|
|
|
9089
9090
|
this.saveItem(t, "entities", r, e);
|
|
9090
9091
|
}
|
|
9091
9092
|
}
|
|
9092
|
-
byStorey(t) {
|
|
9093
|
-
for (const [e, i] of t.data) {
|
|
9094
|
-
const r = i[1][0].toString();
|
|
9095
|
-
this.saveItem(t, "storeys", r, e);
|
|
9096
|
-
}
|
|
9097
|
-
}
|
|
9098
9093
|
async byIfcRel(t, e, i) {
|
|
9099
9094
|
Gt.isRel(e) && await Gt.getRelationMap(
|
|
9100
9095
|
t,
|
|
@@ -9114,6 +9109,36 @@ const Ps = class Ps extends J {
|
|
|
9114
9109
|
}
|
|
9115
9110
|
);
|
|
9116
9111
|
}
|
|
9112
|
+
async bySpatialStructure(t) {
|
|
9113
|
+
var n;
|
|
9114
|
+
const e = this.components.get(We), i = e.relationMaps[t.uuid];
|
|
9115
|
+
if (!i)
|
|
9116
|
+
throw new Error(
|
|
9117
|
+
`Classifier: model relations of ${t.name || t.uuid} have to exists to group by spatial structure.`
|
|
9118
|
+
);
|
|
9119
|
+
const o = "spatialStructures";
|
|
9120
|
+
for (const [r] of i) {
|
|
9121
|
+
const a = e.getEntityRelations(
|
|
9122
|
+
t,
|
|
9123
|
+
r,
|
|
9124
|
+
"ContainsElements"
|
|
9125
|
+
), c = await t.getProperties(r);
|
|
9126
|
+
if (!(a && c))
|
|
9127
|
+
continue;
|
|
9128
|
+
const E = (n = c.Name) == null ? void 0 : n.value;
|
|
9129
|
+
for (const d of a) {
|
|
9130
|
+
this.saveItem(t, o, E, d);
|
|
9131
|
+
const h = e.getEntityRelations(
|
|
9132
|
+
t,
|
|
9133
|
+
Number(d),
|
|
9134
|
+
"IsDecomposedBy"
|
|
9135
|
+
);
|
|
9136
|
+
if (h)
|
|
9137
|
+
for (const u of h)
|
|
9138
|
+
this.saveItem(t, o, E, u);
|
|
9139
|
+
}
|
|
9140
|
+
}
|
|
9141
|
+
}
|
|
9117
9142
|
setColor(t, e, i = !1) {
|
|
9118
9143
|
const o = this.components.get(ut);
|
|
9119
9144
|
for (const n in t) {
|
|
@@ -9141,8 +9166,8 @@ const Ps = class Ps extends J {
|
|
|
9141
9166
|
for (const r of n[0]) {
|
|
9142
9167
|
const a = t.keyFragments.get(r);
|
|
9143
9168
|
if (a) {
|
|
9144
|
-
const
|
|
9145
|
-
|
|
9169
|
+
const c = this.list[e];
|
|
9170
|
+
c[i] || (c[i] = {}), c[i][a] || (c[i][a] = /* @__PURE__ */ new Set()), c[i][a].add(o);
|
|
9146
9171
|
}
|
|
9147
9172
|
}
|
|
9148
9173
|
}
|
|
@@ -9156,7 +9181,7 @@ const Ls = class Ls extends J {
|
|
|
9156
9181
|
I(this, "height", 10);
|
|
9157
9182
|
I(this, "groupName", "storeys");
|
|
9158
9183
|
/** {@link Disposable.onDisposed} */
|
|
9159
|
-
I(this, "onDisposed", new
|
|
9184
|
+
I(this, "onDisposed", new D());
|
|
9160
9185
|
I(this, "list", /* @__PURE__ */ new Set());
|
|
9161
9186
|
t.add(Ls.uuid, this);
|
|
9162
9187
|
}
|
|
@@ -9169,14 +9194,14 @@ const Ls = class Ls extends J {
|
|
|
9169
9194
|
const e = this.components.get(Ri), i = this.components.get(ut), o = t ? 1 : -1;
|
|
9170
9195
|
let n = 0;
|
|
9171
9196
|
const r = e.list[this.groupName], a = new g.Matrix4();
|
|
9172
|
-
for (const
|
|
9197
|
+
for (const c in r) {
|
|
9173
9198
|
a.elements[13] = n * o * this.height;
|
|
9174
|
-
for (const E in r[
|
|
9175
|
-
const d = i.list.get(E), h =
|
|
9199
|
+
for (const E in r[c]) {
|
|
9200
|
+
const d = i.list.get(E), h = c + E, u = this.list.has(h);
|
|
9176
9201
|
if (!d || t && u || !t && !u)
|
|
9177
9202
|
continue;
|
|
9178
9203
|
t ? this.list.add(h) : this.list.delete(h);
|
|
9179
|
-
const p = r[
|
|
9204
|
+
const p = r[c][E];
|
|
9180
9205
|
d.applyTransform(p, a);
|
|
9181
9206
|
}
|
|
9182
9207
|
n++;
|
|
@@ -9238,10 +9263,10 @@ class qr extends J {
|
|
|
9238
9263
|
I(this, "onProgress", new Kt());
|
|
9239
9264
|
I(this, "onIndicesStreamed", new Kt());
|
|
9240
9265
|
/** {@link Disposable.onDisposed} */
|
|
9241
|
-
I(this, "onDisposed", new
|
|
9266
|
+
I(this, "onDisposed", new D());
|
|
9242
9267
|
I(this, "enabled", !0);
|
|
9243
9268
|
I(this, "settings", new Vn());
|
|
9244
|
-
I(this, "webIfc", new
|
|
9269
|
+
I(this, "webIfc", new U.IfcAPI());
|
|
9245
9270
|
}
|
|
9246
9271
|
async dispose() {
|
|
9247
9272
|
this.onIndicesStreamed.reset(), this.onPropertiesStreamed.reset(), this.webIfc = null, this.onDisposed.reset();
|
|
@@ -9264,18 +9289,18 @@ class qr extends J {
|
|
|
9264
9289
|
}
|
|
9265
9290
|
async streamAllProperties() {
|
|
9266
9291
|
const { propertiesSize: t } = this.settings, e = new Set(this.webIfc.GetIfcEntityList(0)), i = [
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9292
|
+
U.IFCRELDEFINESBYPROPERTIES,
|
|
9293
|
+
U.IFCRELDEFINESBYTYPE,
|
|
9294
|
+
U.IFCRELASSOCIATESMATERIAL,
|
|
9295
|
+
U.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
9296
|
+
U.IFCRELASSOCIATESCLASSIFICATION,
|
|
9297
|
+
U.IFCRELASSIGNSTOGROUP
|
|
9273
9298
|
], o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9299
|
+
U.IFCPROJECT,
|
|
9300
|
+
U.IFCSITE,
|
|
9301
|
+
U.IFCBUILDING,
|
|
9302
|
+
U.IFCBUILDINGSTOREY,
|
|
9303
|
+
U.IFCSPACE
|
|
9279
9304
|
]);
|
|
9280
9305
|
for (const E of n)
|
|
9281
9306
|
e.add(E);
|
|
@@ -9315,10 +9340,10 @@ class qr extends J {
|
|
|
9315
9340
|
const A = a / e.size;
|
|
9316
9341
|
A > r && (r += 0.01, r = Math.max(r, A), await this.onProgress.trigger(Math.round(r * 100) / 100));
|
|
9317
9342
|
}
|
|
9318
|
-
const
|
|
9343
|
+
const c = [];
|
|
9319
9344
|
for (const [E, d] of o)
|
|
9320
|
-
|
|
9321
|
-
await this.onIndicesStreamed.trigger(
|
|
9345
|
+
c.push([E, ...d]);
|
|
9346
|
+
await this.onIndicesStreamed.trigger(c);
|
|
9322
9347
|
}
|
|
9323
9348
|
getIndices(t, e, i) {
|
|
9324
9349
|
const o = t.RelatedObjects || t.RelatedElements;
|
|
@@ -9337,27 +9362,27 @@ class qr extends J {
|
|
|
9337
9362
|
for (const a of o) {
|
|
9338
9363
|
if (a.value === void 0 || a.value === null)
|
|
9339
9364
|
continue;
|
|
9340
|
-
const
|
|
9341
|
-
i.has(
|
|
9365
|
+
const c = a.value;
|
|
9366
|
+
i.has(c) || i.set(c, /* @__PURE__ */ new Set()), i.get(c).add(r);
|
|
9342
9367
|
}
|
|
9343
9368
|
}
|
|
9344
9369
|
cleanUp() {
|
|
9345
|
-
this.webIfc = null, this.webIfc = new
|
|
9370
|
+
this.webIfc = null, this.webIfc = new U.IfcAPI();
|
|
9346
9371
|
}
|
|
9347
9372
|
}
|
|
9348
9373
|
I(qr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
|
|
9349
9374
|
const ws = class ws extends J {
|
|
9350
9375
|
constructor(t) {
|
|
9351
9376
|
super(t);
|
|
9352
|
-
I(this, "onGeometryStreamed", new
|
|
9353
|
-
I(this, "onAssetStreamed", new
|
|
9354
|
-
I(this, "onProgress", new
|
|
9355
|
-
I(this, "onIfcLoaded", new
|
|
9377
|
+
I(this, "onGeometryStreamed", new D());
|
|
9378
|
+
I(this, "onAssetStreamed", new D());
|
|
9379
|
+
I(this, "onProgress", new D());
|
|
9380
|
+
I(this, "onIfcLoaded", new D());
|
|
9356
9381
|
/** {@link Disposable.onDisposed} */
|
|
9357
|
-
I(this, "onDisposed", new
|
|
9382
|
+
I(this, "onDisposed", new D());
|
|
9358
9383
|
I(this, "settings", new jr());
|
|
9359
9384
|
I(this, "enabled", !0);
|
|
9360
|
-
I(this, "webIfc", new
|
|
9385
|
+
I(this, "webIfc", new U.IfcAPI());
|
|
9361
9386
|
I(this, "_spatialTree", new vn());
|
|
9362
9387
|
I(this, "_metaData", new Yn());
|
|
9363
9388
|
I(this, "_visitedGeometries", /* @__PURE__ */ new Map());
|
|
@@ -9368,7 +9393,7 @@ const ws = class ws extends J {
|
|
|
9368
9393
|
I(this, "_groupSerializer", new Vt.Serializer());
|
|
9369
9394
|
I(this, "_assets", []);
|
|
9370
9395
|
I(this, "_meshesWithHoles", /* @__PURE__ */ new Set());
|
|
9371
|
-
this.components.add(ws.uuid, this), this.settings.excludedCategories.add(
|
|
9396
|
+
this.components.add(ws.uuid, this), this.settings.excludedCategories.add(U.IFCOPENINGELEMENT);
|
|
9372
9397
|
}
|
|
9373
9398
|
dispose() {
|
|
9374
9399
|
this.onIfcLoaded.reset(), this.onGeometryStreamed.reset(), this.onAssetStreamed.reset(), this.webIfc = null, this.onDisposed.trigger(), this.onDisposed.reset();
|
|
@@ -9392,25 +9417,25 @@ const ws = class ws extends J {
|
|
|
9392
9417
|
async streamAllGeometries() {
|
|
9393
9418
|
const { minGeometrySize: t, minAssetsSize: e } = this.settings;
|
|
9394
9419
|
this._spatialTree.setUp(this.webIfc);
|
|
9395
|
-
const i = this.webIfc.GetIfcEntityList(0), o = [[]], n = new Vt.FragmentsGroup(), { FILE_NAME: r, FILE_DESCRIPTION: a } =
|
|
9420
|
+
const i = this.webIfc.GetIfcEntityList(0), o = [[]], n = new Vt.FragmentsGroup(), { FILE_NAME: r, FILE_DESCRIPTION: a } = U;
|
|
9396
9421
|
n.ifcMetadata = {
|
|
9397
9422
|
name: this._metaData.get(this.webIfc, r),
|
|
9398
9423
|
description: this._metaData.get(this.webIfc, a),
|
|
9399
9424
|
schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
|
|
9400
9425
|
maxExpressID: this.webIfc.GetMaxExpressID(0)
|
|
9401
9426
|
};
|
|
9402
|
-
let
|
|
9427
|
+
let c = 0, E = 0;
|
|
9403
9428
|
for (const T of i) {
|
|
9404
|
-
if (!this.webIfc.IsIfcElement(T) && T !==
|
|
9429
|
+
if (!this.webIfc.IsIfcElement(T) && T !== U.IFCSPACE || this.settings.excludedCategories.has(T))
|
|
9405
9430
|
continue;
|
|
9406
9431
|
const F = this.webIfc.GetLineIDsWithType(0, T), f = F.size();
|
|
9407
9432
|
console.log(f);
|
|
9408
9433
|
for (let m = 0; m < f; m++) {
|
|
9409
|
-
|
|
9434
|
+
c > t && (c = 0, E++, o.push([]));
|
|
9410
9435
|
const O = F.get(m);
|
|
9411
9436
|
o[E].push(O);
|
|
9412
9437
|
const S = this._spatialTree.itemsByFloor[O] || 0;
|
|
9413
|
-
n.data.set(O, [[], [S, T]]),
|
|
9438
|
+
n.data.set(O, [[], [S, T]]), c++;
|
|
9414
9439
|
}
|
|
9415
9440
|
}
|
|
9416
9441
|
this._spatialTree.cleanUp();
|
|
@@ -9437,12 +9462,12 @@ const ws = class ws extends J {
|
|
|
9437
9462
|
this.onIfcLoaded.trigger(C), n.dispose(!0);
|
|
9438
9463
|
}
|
|
9439
9464
|
cleanUp() {
|
|
9440
|
-
this.webIfc = null, this.webIfc = new
|
|
9465
|
+
this.webIfc = null, this.webIfc = new U.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
|
|
9441
9466
|
}
|
|
9442
9467
|
getMesh(t, e, i) {
|
|
9443
9468
|
const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
|
|
9444
9469
|
for (let a = 0; a < o; a++) {
|
|
9445
|
-
const
|
|
9470
|
+
const c = e.geometries.get(a), E = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, h = E * d;
|
|
9446
9471
|
if (!this._visitedGeometries.has(h)) {
|
|
9447
9472
|
this._visitedGeometries.has(E) || this.getGeometry(t, E);
|
|
9448
9473
|
const m = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
|
|
@@ -9455,7 +9480,7 @@ const ws = class ws extends J {
|
|
|
9455
9480
|
if (!p)
|
|
9456
9481
|
throw new Error("Data not found!");
|
|
9457
9482
|
p[0].push(u.index);
|
|
9458
|
-
const { x: A, y: R, z: C, w: T } =
|
|
9483
|
+
const { x: A, y: R, z: C, w: T } = c.color, F = [A, R, C, T], f = c.flatTransformation;
|
|
9459
9484
|
r.geometries.push({ color: F, geometryID: E, transformation: f });
|
|
9460
9485
|
}
|
|
9461
9486
|
this._assets.push(r);
|
|
@@ -9470,7 +9495,7 @@ const ws = class ws extends J {
|
|
|
9470
9495
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
9471
9496
|
for (let u = 0; u < n.length; u += 6)
|
|
9472
9497
|
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];
|
|
9473
|
-
const
|
|
9498
|
+
const c = Cr(r), E = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
|
|
9474
9499
|
let h = !1;
|
|
9475
9500
|
for (let u = 0; u < r.length - 2; u += 3) {
|
|
9476
9501
|
const p = r[u], A = r[u + 1], R = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
|
|
@@ -9506,10 +9531,10 @@ class $r extends J {
|
|
|
9506
9531
|
I(this, "onProgress", new Kt());
|
|
9507
9532
|
I(this, "onIndicesStreamed", new Kt());
|
|
9508
9533
|
/** {@link Disposable.onDisposed} */
|
|
9509
|
-
I(this, "onDisposed", new
|
|
9534
|
+
I(this, "onDisposed", new D());
|
|
9510
9535
|
I(this, "enabled", !0);
|
|
9511
9536
|
I(this, "settings", new Vn());
|
|
9512
|
-
I(this, "webIfc", new
|
|
9537
|
+
I(this, "webIfc", new U.IfcAPI());
|
|
9513
9538
|
}
|
|
9514
9539
|
async dispose() {
|
|
9515
9540
|
this.onIndicesStreamed.reset(), this.onPropertiesStreamed.reset(), this.webIfc = null, this.onDisposed.reset();
|
|
@@ -9532,19 +9557,19 @@ class $r extends J {
|
|
|
9532
9557
|
}
|
|
9533
9558
|
async streamAllProperties() {
|
|
9534
9559
|
const { propertiesSize: t } = this.settings, e = new Set(this.webIfc.GetIfcEntityList(0)), i = /* @__PURE__ */ new Set([
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9560
|
+
U.IFCPROJECT,
|
|
9561
|
+
U.IFCSITE,
|
|
9562
|
+
U.IFCBUILDING,
|
|
9563
|
+
U.IFCBUILDINGSTOREY,
|
|
9564
|
+
U.IFCSPACE
|
|
9540
9565
|
]);
|
|
9541
|
-
for (const
|
|
9542
|
-
e.add(
|
|
9566
|
+
for (const c of i)
|
|
9567
|
+
e.add(c);
|
|
9543
9568
|
let o = 0.01, n = 0;
|
|
9544
|
-
for (const
|
|
9545
|
-
if (n++, Pi.has(
|
|
9569
|
+
for (const c of e) {
|
|
9570
|
+
if (n++, Pi.has(c))
|
|
9546
9571
|
continue;
|
|
9547
|
-
const E = i.has(
|
|
9572
|
+
const E = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), h = d.size();
|
|
9548
9573
|
let u = 0;
|
|
9549
9574
|
for (let A = 0; A < h - t; A += t) {
|
|
9550
9575
|
const R = {};
|
|
@@ -9558,7 +9583,7 @@ class $r extends J {
|
|
|
9558
9583
|
console.log(`Could not get property: ${T}`);
|
|
9559
9584
|
}
|
|
9560
9585
|
}
|
|
9561
|
-
await this.onPropertiesStreamed.trigger({ type:
|
|
9586
|
+
await this.onPropertiesStreamed.trigger({ type: c, data: R });
|
|
9562
9587
|
}
|
|
9563
9588
|
if (u !== h) {
|
|
9564
9589
|
const A = {};
|
|
@@ -9571,16 +9596,16 @@ class $r extends J {
|
|
|
9571
9596
|
console.log(`Could not get property: ${C}`);
|
|
9572
9597
|
}
|
|
9573
9598
|
}
|
|
9574
|
-
await this.onPropertiesStreamed.trigger({ type:
|
|
9599
|
+
await this.onPropertiesStreamed.trigger({ type: c, data: A });
|
|
9575
9600
|
}
|
|
9576
9601
|
const p = n / e.size;
|
|
9577
9602
|
p > o && (o += 0.01, o = Math.max(o, p), await this.onProgress.trigger(Math.round(o * 100) / 100));
|
|
9578
9603
|
}
|
|
9579
|
-
const a = await this.components.get(
|
|
9604
|
+
const a = await this.components.get(We).processFromWebIfc(this.webIfc, 0);
|
|
9580
9605
|
await this.onIndicesStreamed.trigger(a);
|
|
9581
9606
|
}
|
|
9582
9607
|
cleanUp() {
|
|
9583
|
-
this.webIfc = null, this.webIfc = new
|
|
9608
|
+
this.webIfc = null, this.webIfc = new U.IfcAPI();
|
|
9584
9609
|
}
|
|
9585
9610
|
}
|
|
9586
9611
|
I($r, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
|
|
@@ -9606,7 +9631,7 @@ const Ms = class Ms extends J {
|
|
|
9606
9631
|
o.set(A, { points: R, distance: C });
|
|
9607
9632
|
}
|
|
9608
9633
|
}
|
|
9609
|
-
let
|
|
9634
|
+
let c = 0;
|
|
9610
9635
|
const E = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
|
|
9611
9636
|
for (const { index: h, edges: u } of a) {
|
|
9612
9637
|
const p = /* @__PURE__ */ new Map();
|
|
@@ -9617,7 +9642,7 @@ const Ms = class Ms extends J {
|
|
|
9617
9642
|
}
|
|
9618
9643
|
const A = u.map((m) => m.id);
|
|
9619
9644
|
if (!p.size) {
|
|
9620
|
-
const m =
|
|
9645
|
+
const m = c++;
|
|
9621
9646
|
for (const { id: O } of u)
|
|
9622
9647
|
E.set(O, m);
|
|
9623
9648
|
d.set(m, {
|
|
@@ -9667,8 +9692,8 @@ const Ms = class Ms extends J {
|
|
|
9667
9692
|
return n.set(e, i), n.closestPointToPoint(t, o, r), r.distanceTo(t);
|
|
9668
9693
|
}
|
|
9669
9694
|
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(
|
|
9695
|
+
const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal: c } = o;
|
|
9696
|
+
this.round(n), this.round(r), this.round(a), this.round(c);
|
|
9672
9697
|
const E = [
|
|
9673
9698
|
{ id: `${n.x}|${n.y}|${n.z}`, value: n },
|
|
9674
9699
|
{ id: `${r.x}|${r.y}|${r.z}`, value: r },
|
|
@@ -9696,12 +9721,12 @@ const Ms = class Ms extends J {
|
|
|
9696
9721
|
points: [h, R]
|
|
9697
9722
|
}
|
|
9698
9723
|
], T = new g.Plane();
|
|
9699
|
-
return T.setFromNormalAndCoplanarPoint(
|
|
9724
|
+
return T.setFromNormalAndCoplanarPoint(c, n), T.constant = Math.round(T.constant * 10) / 10, { plane: T, edges: C };
|
|
9700
9725
|
}
|
|
9701
9726
|
getVerticesAndNormal(t, e, i) {
|
|
9702
9727
|
if (!t.geometry.index)
|
|
9703
9728
|
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,
|
|
9729
|
+
const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, E = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), h = new g.Vector3(n[c], n[c + 1], n[c + 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[c], r[c + 1], r[c + 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
9730
|
if (i !== void 0 && t instanceof g.InstancedMesh) {
|
|
9706
9731
|
const m = new g.Matrix4();
|
|
9707
9732
|
t.getMatrixAt(i, m);
|
|
@@ -9731,13 +9756,13 @@ export {
|
|
|
9731
9756
|
Yr as CullerRenderer,
|
|
9732
9757
|
Ci as Cullers,
|
|
9733
9758
|
Ht as Disposer,
|
|
9734
|
-
|
|
9759
|
+
D as Event,
|
|
9735
9760
|
On as Exploder,
|
|
9736
9761
|
zr as FirstPersonMode,
|
|
9737
|
-
gn as FragmentHider,
|
|
9738
9762
|
qr as FragmentPropsStreamConverter,
|
|
9739
9763
|
ut as FragmentsManager,
|
|
9740
9764
|
Nr as Grids,
|
|
9765
|
+
gn as Hider,
|
|
9741
9766
|
oa as IfcCategories,
|
|
9742
9767
|
bn as IfcCategoryMap,
|
|
9743
9768
|
Xr as IfcElements,
|
|
@@ -9747,7 +9772,7 @@ export {
|
|
|
9747
9772
|
Fn as IfcPropertiesManager,
|
|
9748
9773
|
$r as IfcPropertiesTiler,
|
|
9749
9774
|
Gt as IfcPropertiesUtils,
|
|
9750
|
-
|
|
9775
|
+
We as IfcRelationsIndexer,
|
|
9751
9776
|
jr as IfcStreamingSettings,
|
|
9752
9777
|
sn as MaterialsUtils,
|
|
9753
9778
|
_n as MeasurementUtils,
|