@thatopen/components 2.0.0-alpha.4 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fragments/FragmentBoundingBox/index.d.ts +2 -2
- package/dist/fragments/FragmentClassifier/index.d.ts +1 -1
- package/dist/fragments/FragmentHider/index.d.ts +1 -1
- package/dist/fragments/FragmentIfcLoader/index.d.ts +1 -1
- package/dist/fragments/FragmentIfcLoader/src/civil-reader.d.ts +1 -1
- package/dist/fragments/FragmentManager/index.d.ts +1 -1
- package/dist/ifc/IfcJsonExporter/index.d.ts +1 -1
- package/dist/ifc/IfcPropertiesFinder/index.d.ts +2 -2
- package/dist/ifc/IfcPropertiesIndexer/index.d.ts +20 -66
- package/dist/ifc/IfcPropertiesManager/index.d.ts +2 -2
- package/dist/ifc/Utils/properties-utils.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +940 -1014
- package/dist/namespace.d.ts +749 -795
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
1
|
var vn = Object.defineProperty;
|
|
2
|
-
var Bn = (
|
|
3
|
-
var I = (
|
|
2
|
+
var Bn = (c, s, t) => s in c ? vn(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
|
|
3
|
+
var I = (c, s, t) => (Bn(c, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
4
|
import * as O from "three";
|
|
5
|
-
import { BufferAttribute as An, Vector3 as M, Vector2 as fe, Plane as pi, Line3 as
|
|
5
|
+
import { BufferAttribute as An, Vector3 as M, Vector2 as fe, Plane as pi, Line3 as Lt, Triangle as ue, Sphere as Yn, Matrix4 as Mt, Box3 as Ot, BackSide as Vn, DoubleSide as Fn, FrontSide as _i, Mesh as v, Ray as Gn, Raycaster as zn, Quaternion as yt, Object3D as ei, Euler as Hn, MeshBasicMaterial as gn, LineBasicMaterial as kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Ni, Float32BufferAttribute as Pi, OctahedronGeometry as Qe, Line as Ut, SphereGeometry as Wn, TorusGeometry as me, PlaneGeometry as Xn } from "three";
|
|
6
6
|
import * as b from "web-ifc";
|
|
7
|
-
import * as $t from "
|
|
8
|
-
import { Serializer as Zn } from "
|
|
9
|
-
const On = 0, Qn = 1, jn = 2,
|
|
10
|
-
function $n(
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
function pe(
|
|
14
|
-
return $n(
|
|
15
|
-
}
|
|
16
|
-
function Kn(
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
function Jn(
|
|
20
|
-
if (!
|
|
21
|
-
const t =
|
|
22
|
-
|
|
7
|
+
import * as $t from "@thatopen/fragments";
|
|
8
|
+
import { Serializer as Zn } from "@thatopen/fragments";
|
|
9
|
+
const On = 0, Qn = 1, jn = 2, yi = 2, Us = 1.25, Li = 1, Ts = 6 * 4 + 4 + 4, ys = 65535, qn = Math.pow(2, -24), xs = Symbol("SKIP_GENERATION");
|
|
10
|
+
function $n(c) {
|
|
11
|
+
return c.index ? c.index.count : c.attributes.position.count;
|
|
12
|
+
}
|
|
13
|
+
function pe(c) {
|
|
14
|
+
return $n(c) / 3;
|
|
15
|
+
}
|
|
16
|
+
function Kn(c, s = ArrayBuffer) {
|
|
17
|
+
return c > 65535 ? new Uint32Array(new s(4 * c)) : new Uint16Array(new s(2 * c));
|
|
18
|
+
}
|
|
19
|
+
function Jn(c, s) {
|
|
20
|
+
if (!c.index) {
|
|
21
|
+
const t = c.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = Kn(t, e);
|
|
22
|
+
c.setIndex(new An(i, 1));
|
|
23
23
|
for (let o = 0; o < t; o++)
|
|
24
24
|
i[o] = o;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function Sn(
|
|
28
|
-
const s = pe(
|
|
27
|
+
function Sn(c) {
|
|
28
|
+
const s = pe(c), t = c.drawRange, e = t.start / 3, i = (t.start + t.count) / 3, o = Math.max(0, e), n = Math.min(s, i) - o;
|
|
29
29
|
return [{
|
|
30
30
|
offset: Math.floor(o),
|
|
31
31
|
count: Math.floor(n)
|
|
32
32
|
}];
|
|
33
33
|
}
|
|
34
|
-
function _n(
|
|
35
|
-
if (!
|
|
36
|
-
return Sn(
|
|
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 _n(c) {
|
|
35
|
+
if (!c.groups || !c.groups.length)
|
|
36
|
+
return Sn(c);
|
|
37
|
+
const s = [], t = /* @__PURE__ */ new Set(), e = c.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
|
|
38
|
+
for (const r of c.groups) {
|
|
39
|
+
const a = r.start / 3, l = (r.start + r.count) / 3;
|
|
40
|
+
t.add(Math.max(i, a)), t.add(Math.min(o, l));
|
|
41
41
|
}
|
|
42
42
|
const n = Array.from(t.values()).sort((r, a) => r - a);
|
|
43
43
|
for (let r = 0; r < n.length - 1; r++) {
|
|
44
|
-
const a = n[r],
|
|
44
|
+
const a = n[r], l = n[r + 1];
|
|
45
45
|
s.push({
|
|
46
46
|
offset: Math.floor(a),
|
|
47
|
-
count: Math.floor(
|
|
47
|
+
count: Math.floor(l - a)
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return s;
|
|
51
51
|
}
|
|
52
|
-
function to(
|
|
53
|
-
if (
|
|
52
|
+
function to(c) {
|
|
53
|
+
if (c.groups.length === 0)
|
|
54
54
|
return !1;
|
|
55
|
-
const s = pe(
|
|
55
|
+
const s = pe(c), t = _n(c).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
|
|
56
56
|
e.count = Math.min(s - e.offset, e.count);
|
|
57
57
|
let i = 0;
|
|
58
58
|
return t.forEach(({ count: o }) => i += o), s !== i;
|
|
59
59
|
}
|
|
60
|
-
function $(
|
|
61
|
-
return t.min.x = s[
|
|
60
|
+
function $(c, s, t) {
|
|
61
|
+
return t.min.x = s[c], t.min.y = s[c + 1], t.min.z = s[c + 2], t.max.x = s[c + 3], t.max.y = s[c + 4], t.max.z = s[c + 5], t;
|
|
62
62
|
}
|
|
63
|
-
function eo(
|
|
64
|
-
|
|
63
|
+
function eo(c) {
|
|
64
|
+
c[0] = c[1] = c[2] = 1 / 0, c[3] = c[4] = c[5] = -1 / 0;
|
|
65
65
|
}
|
|
66
|
-
function Mi(
|
|
66
|
+
function Mi(c) {
|
|
67
67
|
let s = -1, t = -1 / 0;
|
|
68
68
|
for (let e = 0; e < 3; e++) {
|
|
69
|
-
const i =
|
|
69
|
+
const i = c[e + 3] - c[e];
|
|
70
70
|
i > t && (t = i, s = e);
|
|
71
71
|
}
|
|
72
72
|
return s;
|
|
73
73
|
}
|
|
74
|
-
function wi(
|
|
75
|
-
s.set(
|
|
74
|
+
function wi(c, s) {
|
|
75
|
+
s.set(c);
|
|
76
76
|
}
|
|
77
|
-
function Di(
|
|
77
|
+
function Di(c, s, t) {
|
|
78
78
|
let e, i;
|
|
79
79
|
for (let o = 0; o < 3; o++) {
|
|
80
80
|
const n = o + 3;
|
|
81
|
-
e =
|
|
81
|
+
e = c[o], i = s[o], t[o] = e < i ? e : i, e = c[n], i = s[n], t[n] = e > i ? e : i;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function je(
|
|
84
|
+
function je(c, s, t) {
|
|
85
85
|
for (let e = 0; e < 3; e++) {
|
|
86
|
-
const i = s[
|
|
86
|
+
const i = s[c + 2 * e], o = s[c + 2 * e + 1], n = i - o, r = i + o;
|
|
87
87
|
n < t[e] && (t[e] = n), r > t[e + 3] && (t[e + 3] = r);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
function Re(
|
|
91
|
-
const s =
|
|
90
|
+
function Re(c) {
|
|
91
|
+
const s = c[3] - c[0], t = c[4] - c[1], e = c[5] - c[2];
|
|
92
92
|
return 2 * (s * t + t * e + e * s);
|
|
93
93
|
}
|
|
94
|
-
function bs(
|
|
95
|
-
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0,
|
|
94
|
+
function bs(c, s, t, e, i = null) {
|
|
95
|
+
let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, l = -1 / 0, E = -1 / 0, d = 1 / 0, h = 1 / 0, u = 1 / 0, p = -1 / 0, R = -1 / 0, A = -1 / 0;
|
|
96
96
|
const C = i !== null;
|
|
97
97
|
for (let T = s * 6, F = (s + t) * 6; T < F; T += 6) {
|
|
98
|
-
const f =
|
|
98
|
+
const f = c[T + 0], m = c[T + 1], g = f - m, S = f + m;
|
|
99
99
|
g < o && (o = g), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
|
|
100
|
-
const _ =
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
x < r && (r = x), B > E && (E = B), C &&
|
|
100
|
+
const _ = c[T + 2], N = c[T + 3], y = _ - N, w = _ + N;
|
|
101
|
+
y < n && (n = y), w > l && (l = w), C && _ < h && (h = _), C && _ > R && (R = _);
|
|
102
|
+
const L = c[T + 4], U = c[T + 5], x = L - U, B = L + U;
|
|
103
|
+
x < r && (r = x), B > E && (E = B), C && L < u && (u = L), C && L > A && (A = L);
|
|
104
104
|
}
|
|
105
|
-
e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] =
|
|
105
|
+
e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = l, e[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = R, i[5] = A);
|
|
106
106
|
}
|
|
107
|
-
function so(
|
|
108
|
-
let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0,
|
|
107
|
+
function so(c, s, t, e) {
|
|
108
|
+
let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, l = -1 / 0;
|
|
109
109
|
for (let E = s * 6, d = (s + t) * 6; E < d; E += 6) {
|
|
110
|
-
const h =
|
|
110
|
+
const h = c[E + 0];
|
|
111
111
|
h < i && (i = h), h > r && (r = h);
|
|
112
|
-
const u =
|
|
112
|
+
const u = c[E + 2];
|
|
113
113
|
u < o && (o = u), u > a && (a = u);
|
|
114
|
-
const p =
|
|
115
|
-
p < n && (n = p), p >
|
|
114
|
+
const p = c[E + 4];
|
|
115
|
+
p < n && (n = p), p > l && (l = p);
|
|
116
116
|
}
|
|
117
|
-
e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] =
|
|
117
|
+
e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = l;
|
|
118
118
|
}
|
|
119
|
-
function io(
|
|
119
|
+
function io(c, s) {
|
|
120
120
|
eo(s);
|
|
121
|
-
const t =
|
|
122
|
-
let
|
|
123
|
-
t.isInterleavedBufferAttribute && (
|
|
121
|
+
const t = c.attributes.position, e = c.index ? c.index.array : null, i = pe(c), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
|
|
122
|
+
let l = 3;
|
|
123
|
+
t.isInterleavedBufferAttribute && (l = t.data.stride);
|
|
124
124
|
const E = ["getX", "getY", "getZ"];
|
|
125
125
|
for (let d = 0; d < i; d++) {
|
|
126
126
|
const h = d * 3, u = d * 6;
|
|
127
127
|
let p = h + 0, R = h + 1, A = h + 2;
|
|
128
|
-
e && (p = e[p], R = e[R], A = e[A]), n || (p = p *
|
|
128
|
+
e && (p = e[p], R = e[R], A = e[A]), n || (p = p * l + a, R = R * l + a, A = A * l + a);
|
|
129
129
|
for (let C = 0; C < 3; C++) {
|
|
130
130
|
let T, F, f;
|
|
131
131
|
n ? (T = t[E[C]](p), F = t[E[C]](R), f = t[E[C]](A)) : (T = r[p + C], F = r[R + C], f = r[A + C]);
|
|
@@ -139,22 +139,22 @@ function io(l, s) {
|
|
|
139
139
|
}
|
|
140
140
|
return o;
|
|
141
141
|
}
|
|
142
|
-
const wt = 32, no = (
|
|
142
|
+
const wt = 32, no = (c, s) => c.candidate - s.candidate, xt = new Array(wt).fill().map(() => ({
|
|
143
143
|
count: 0,
|
|
144
144
|
bounds: new Float32Array(6),
|
|
145
145
|
rightCacheBounds: new Float32Array(6),
|
|
146
146
|
leftCacheBounds: new Float32Array(6),
|
|
147
147
|
candidate: 0
|
|
148
148
|
})), qe = new Float32Array(6);
|
|
149
|
-
function oo(
|
|
149
|
+
function oo(c, s, t, e, i, o) {
|
|
150
150
|
let n = -1, r = 0;
|
|
151
151
|
if (o === On)
|
|
152
152
|
n = Mi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
|
|
153
153
|
else if (o === Qn)
|
|
154
|
-
n = Mi(
|
|
154
|
+
n = Mi(c), n !== -1 && (r = ro(t, e, i, n));
|
|
155
155
|
else if (o === jn) {
|
|
156
|
-
const a = Re(
|
|
157
|
-
let
|
|
156
|
+
const a = Re(c);
|
|
157
|
+
let l = Us * 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], A = (s[h + 3] - u) / wt;
|
|
@@ -190,12 +190,12 @@ function oo(l, s, t, e, i, o) {
|
|
|
190
190
|
}
|
|
191
191
|
for (let f = 0; f < F; f++) {
|
|
192
192
|
const m = C[f], g = m.count, S = i - m.count, _ = m.leftCacheBounds, N = m.rightCacheBounds;
|
|
193
|
-
let
|
|
194
|
-
g !== 0 && (
|
|
193
|
+
let y = 0;
|
|
194
|
+
g !== 0 && (y = Re(_) / a);
|
|
195
195
|
let w = 0;
|
|
196
196
|
S !== 0 && (w = Re(N) / a);
|
|
197
|
-
const
|
|
198
|
-
|
|
197
|
+
const L = Li + Us * (y * g + w * S);
|
|
198
|
+
L < l && (n = h, l = L, r = m.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
201
201
|
for (let F = 0; F < wt; F++) {
|
|
@@ -221,12 +221,12 @@ function oo(l, s, t, e, i, o) {
|
|
|
221
221
|
for (let F = 0; F < wt - 1; F++) {
|
|
222
222
|
const f = xt[F], m = f.count, g = f.bounds, _ = xt[F + 1].rightCacheBounds;
|
|
223
223
|
m !== 0 && (T === 0 ? wi(g, qe) : Di(g, qe, qe)), T += m;
|
|
224
|
-
let N = 0,
|
|
224
|
+
let N = 0, y = 0;
|
|
225
225
|
T !== 0 && (N = Re(qe) / a);
|
|
226
226
|
const w = i - T;
|
|
227
|
-
w !== 0 && (
|
|
228
|
-
const
|
|
229
|
-
|
|
227
|
+
w !== 0 && (y = Re(_) / a);
|
|
228
|
+
const L = Li + Us * (N * T + y * w);
|
|
229
|
+
L < l && (n = h, l = L, r = f.candidate);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -234,23 +234,23 @@ function oo(l, s, t, e, i, o) {
|
|
|
234
234
|
console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);
|
|
235
235
|
return { axis: n, pos: r };
|
|
236
236
|
}
|
|
237
|
-
function ro(
|
|
237
|
+
function ro(c, s, t, e) {
|
|
238
238
|
let i = 0;
|
|
239
239
|
for (let o = s, n = s + t; o < n; o++)
|
|
240
|
-
i +=
|
|
240
|
+
i += c[o * 6 + e * 2];
|
|
241
241
|
return i / t;
|
|
242
242
|
}
|
|
243
243
|
class $e {
|
|
244
244
|
constructor() {
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
function ao(
|
|
247
|
+
function ao(c, s, t, e, i, o) {
|
|
248
248
|
let n = e, r = e + i - 1;
|
|
249
|
-
const a = o.pos,
|
|
249
|
+
const a = o.pos, l = o.axis * 2;
|
|
250
250
|
for (; ; ) {
|
|
251
|
-
for (; n <= r && t[n * 6 +
|
|
251
|
+
for (; n <= r && t[n * 6 + l] < a; )
|
|
252
252
|
n++;
|
|
253
|
-
for (; n <= r && t[r * 6 +
|
|
253
|
+
for (; n <= r && t[r * 6 + l] >= a; )
|
|
254
254
|
r--;
|
|
255
255
|
if (n < r) {
|
|
256
256
|
for (let E = 0; E < 3; E++) {
|
|
@@ -266,17 +266,17 @@ function ao(l, s, t, e, i, o) {
|
|
|
266
266
|
return n;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
function co(
|
|
269
|
+
function co(c, s, t, e, i, o) {
|
|
270
270
|
let n = e, r = e + i - 1;
|
|
271
|
-
const a = o.pos,
|
|
271
|
+
const a = o.pos, l = o.axis * 2;
|
|
272
272
|
for (; ; ) {
|
|
273
|
-
for (; n <= r && t[n * 6 +
|
|
273
|
+
for (; n <= r && t[n * 6 + l] < a; )
|
|
274
274
|
n++;
|
|
275
|
-
for (; n <= r && t[r * 6 +
|
|
275
|
+
for (; n <= r && t[r * 6 + l] >= a; )
|
|
276
276
|
r--;
|
|
277
277
|
if (n < r) {
|
|
278
|
-
let E =
|
|
279
|
-
|
|
278
|
+
let E = c[n];
|
|
279
|
+
c[n] = c[r], c[r] = E;
|
|
280
280
|
for (let d = 0; d < 6; d++) {
|
|
281
281
|
let h = t[n * 6 + d];
|
|
282
282
|
t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = h;
|
|
@@ -286,14 +286,14 @@ function co(l, s, t, e, i, o) {
|
|
|
286
286
|
return n;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function lo(
|
|
290
|
-
const t = (
|
|
289
|
+
function lo(c, s) {
|
|
290
|
+
const t = (c.index ? c.index.count : c.attributes.position.count) / 3, e = t > 2 ** 16, i = e ? 4 : 2, o = s ? new SharedArrayBuffer(t * i) : new ArrayBuffer(t * i), n = e ? new Uint32Array(o) : new Uint16Array(o);
|
|
291
291
|
for (let r = 0, a = n.length; r < a; r++)
|
|
292
292
|
n[r] = r;
|
|
293
293
|
return n;
|
|
294
294
|
}
|
|
295
|
-
function ho(
|
|
296
|
-
const t =
|
|
295
|
+
function ho(c, s) {
|
|
296
|
+
const t = c.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, l = pe(t), E = c._indirectBuffer;
|
|
297
297
|
let d = !1;
|
|
298
298
|
const h = new Float32Array(6), u = new Float32Array(6), p = io(t, h), R = s.indirect ? co : ao, A = [], C = s.indirect ? Sn(t) : _n(t);
|
|
299
299
|
if (C.length === 1) {
|
|
@@ -306,7 +306,7 @@ function ho(l, s) {
|
|
|
306
306
|
}
|
|
307
307
|
return A;
|
|
308
308
|
function T(f) {
|
|
309
|
-
a && a(f /
|
|
309
|
+
a && a(f / l);
|
|
310
310
|
}
|
|
311
311
|
function F(f, m, g, 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))), g <= n || _ >= i)
|
|
@@ -314,37 +314,37 @@ function ho(l, s) {
|
|
|
314
314
|
const N = oo(f.boundingData, S, p, m, g, r);
|
|
315
315
|
if (N.axis === -1)
|
|
316
316
|
return T(m + g), f.offset = m, f.count = g, f;
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
317
|
+
const y = R(E, e, p, m, g, N);
|
|
318
|
+
if (y === m || y === m + g)
|
|
319
319
|
T(m + g), f.offset = m, f.count = g;
|
|
320
320
|
else {
|
|
321
321
|
f.splitAxis = N.axis;
|
|
322
|
-
const w = new $e(),
|
|
323
|
-
f.left = w, w.boundingData = new Float32Array(6), bs(p,
|
|
324
|
-
const x = new $e(), B =
|
|
322
|
+
const w = new $e(), L = m, U = y - m;
|
|
323
|
+
f.left = w, w.boundingData = new Float32Array(6), bs(p, L, U, w.boundingData, u), F(w, L, U, u, _ + 1);
|
|
324
|
+
const x = new $e(), B = y, H = g - U;
|
|
325
325
|
f.right = x, x.boundingData = new Float32Array(6), bs(p, B, H, x.boundingData, u), F(x, B, H, u, _ + 1);
|
|
326
326
|
}
|
|
327
327
|
return f;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
function Eo(
|
|
331
|
-
const t =
|
|
332
|
-
s.indirect && (
|
|
330
|
+
function Eo(c, s) {
|
|
331
|
+
const t = c.geometry;
|
|
332
|
+
s.indirect && (c._indirectBuffer = lo(t, s.useSharedArrayBuffer), to(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 = ho(
|
|
334
|
+
)), c._indirectBuffer || Jn(t, s);
|
|
335
|
+
const e = ho(c, s);
|
|
336
336
|
let i, o, n;
|
|
337
337
|
const r = [], a = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
|
|
338
338
|
for (let d = 0; d < e.length; d++) {
|
|
339
339
|
const h = e[d];
|
|
340
|
-
let u =
|
|
340
|
+
let u = l(h);
|
|
341
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
|
+
c._roots = r;
|
|
345
345
|
return;
|
|
346
|
-
function
|
|
347
|
-
return d.count ? 1 : 1 +
|
|
346
|
+
function l(d) {
|
|
347
|
+
return d.count ? 1 : 1 + l(d.left) + l(d.right);
|
|
348
348
|
}
|
|
349
349
|
function E(d, h) {
|
|
350
350
|
const u = d / 4, p = d / 2, R = !!h.count, A = h.boundingData;
|
|
@@ -352,7 +352,7 @@ function Eo(l, s) {
|
|
|
352
352
|
i[u + C] = A[C];
|
|
353
353
|
if (R) {
|
|
354
354
|
const C = h.offset, T = h.count;
|
|
355
|
-
return o[u + 6] = C, n[p + 14] = T, n[p + 15] =
|
|
355
|
+
return o[u + 6] = C, n[p + 14] = T, n[p + 15] = ys, d + Ts;
|
|
356
356
|
} else {
|
|
357
357
|
const C = h.left, T = h.right, F = h.splitAxis;
|
|
358
358
|
let f;
|
|
@@ -387,48 +387,48 @@ class Dt {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
Dt.prototype.setFromBox = function() {
|
|
390
|
-
const
|
|
390
|
+
const c = new M();
|
|
391
391
|
return function(t, e) {
|
|
392
392
|
const i = e.min, o = e.max;
|
|
393
393
|
let n = 1 / 0, r = -1 / 0;
|
|
394
394
|
for (let a = 0; a <= 1; a++)
|
|
395
|
-
for (let
|
|
395
|
+
for (let l = 0; l <= 1; l++)
|
|
396
396
|
for (let E = 0; E <= 1; E++) {
|
|
397
|
-
|
|
398
|
-
const d = t.dot(
|
|
397
|
+
c.x = i.x * a + o.x * (1 - a), c.y = i.y * l + o.y * (1 - l), c.z = i.z * E + o.z * (1 - E);
|
|
398
|
+
const d = t.dot(c);
|
|
399
399
|
n = Math.min(d, n), r = Math.max(d, r);
|
|
400
400
|
}
|
|
401
401
|
this.min = n, this.max = r;
|
|
402
402
|
};
|
|
403
403
|
}();
|
|
404
404
|
const uo = function() {
|
|
405
|
-
const
|
|
405
|
+
const c = new M(), s = new M(), t = new M();
|
|
406
406
|
return function(i, o, n) {
|
|
407
|
-
const r = i.start, a =
|
|
408
|
-
t.subVectors(r,
|
|
407
|
+
const r = i.start, a = c, l = o.start, E = s;
|
|
408
|
+
t.subVectors(r, l), c.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
|
|
409
409
|
const d = t.dot(E), h = E.dot(a), u = E.dot(E), p = t.dot(a), A = a.dot(a) * u - h * h;
|
|
410
410
|
let C, T;
|
|
411
411
|
A !== 0 ? C = (d * h - p * u) / A : C = 0, T = (d + C * h) / u, n.x = C, n.y = T;
|
|
412
412
|
};
|
|
413
413
|
}(), Ci = function() {
|
|
414
|
-
const
|
|
414
|
+
const c = new fe(), s = new M(), t = new M();
|
|
415
415
|
return function(i, o, n, r) {
|
|
416
|
-
uo(i, o,
|
|
417
|
-
let a =
|
|
418
|
-
if (a >= 0 && a <= 1 &&
|
|
419
|
-
i.at(a, n), o.at(
|
|
416
|
+
uo(i, o, c);
|
|
417
|
+
let a = c.x, l = c.y;
|
|
418
|
+
if (a >= 0 && a <= 1 && l >= 0 && l <= 1) {
|
|
419
|
+
i.at(a, n), o.at(l, r);
|
|
420
420
|
return;
|
|
421
421
|
} else if (a >= 0 && a <= 1) {
|
|
422
|
-
|
|
422
|
+
l < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
|
|
423
423
|
return;
|
|
424
|
-
} else if (
|
|
424
|
+
} else if (l >= 0 && l <= 1) {
|
|
425
425
|
a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
|
|
426
426
|
return;
|
|
427
427
|
} else {
|
|
428
428
|
let E;
|
|
429
429
|
a < 0 ? E = i.start : E = i.end;
|
|
430
430
|
let d;
|
|
431
|
-
|
|
431
|
+
l < 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 uo = function() {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
}(), Io = function() {
|
|
443
|
-
const
|
|
443
|
+
const c = new M(), s = new M(), t = new pi(), e = new Lt();
|
|
444
444
|
return function(o, n) {
|
|
445
|
-
const { radius: r, center: a } = o, { a:
|
|
446
|
-
if (e.start =
|
|
445
|
+
const { radius: r, center: a } = o, { a: l, b: E, c: d } = n;
|
|
446
|
+
if (e.start = l, e.end = E, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r || (e.start = l, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r))
|
|
447
447
|
return !0;
|
|
448
448
|
const R = n.getPlane(t);
|
|
449
449
|
if (Math.abs(R.distanceToPoint(a)) <= r) {
|
|
@@ -454,8 +454,8 @@ const uo = function() {
|
|
|
454
454
|
return !1;
|
|
455
455
|
};
|
|
456
456
|
}(), fo = 1e-15;
|
|
457
|
-
function vs(
|
|
458
|
-
return Math.abs(
|
|
457
|
+
function vs(c) {
|
|
458
|
+
return Math.abs(c) < fo;
|
|
459
459
|
}
|
|
460
460
|
class gt extends ue {
|
|
461
461
|
constructor(...s) {
|
|
@@ -467,8 +467,8 @@ class gt extends ue {
|
|
|
467
467
|
update() {
|
|
468
468
|
const s = this.a, t = this.b, e = this.c, i = this.points, o = this.satAxes, n = this.satBounds, r = o[0], a = n[0];
|
|
469
469
|
this.getNormal(r), a.setFromPoints(r, i);
|
|
470
|
-
const
|
|
471
|
-
|
|
470
|
+
const l = o[1], E = n[1];
|
|
471
|
+
l.subVectors(s, t), E.setFromPoints(l, i);
|
|
472
472
|
const d = o[2], h = n[2];
|
|
473
473
|
d.subVectors(t, e), h.setFromPoints(d, i);
|
|
474
474
|
const u = o[3], p = n[3];
|
|
@@ -476,19 +476,19 @@ class gt extends ue {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
gt.prototype.closestPointToSegment = function() {
|
|
479
|
-
const
|
|
479
|
+
const c = new M(), s = new M(), t = new Lt();
|
|
480
480
|
return function(i, o = null, n = null) {
|
|
481
|
-
const { start: r, end: a } = i,
|
|
481
|
+
const { start: r, end: a } = i, l = this.points;
|
|
482
482
|
let E, d = 1 / 0;
|
|
483
483
|
for (let h = 0; h < 3; h++) {
|
|
484
484
|
const u = (h + 1) % 3;
|
|
485
|
-
t.start.copy(
|
|
485
|
+
t.start.copy(l[h]), t.end.copy(l[u]), Ci(t, i, c, s), E = c.distanceToSquared(s), E < d && (d = E, o && o.copy(c), n && n.copy(s));
|
|
486
486
|
}
|
|
487
|
-
return this.closestPointToPoint(r,
|
|
487
|
+
return this.closestPointToPoint(r, c), E = r.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(r)), this.closestPointToPoint(a, c), E = a.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(a)), Math.sqrt(d);
|
|
488
488
|
};
|
|
489
489
|
}();
|
|
490
490
|
gt.prototype.intersectsTriangle = function() {
|
|
491
|
-
const
|
|
491
|
+
const c = new gt(), s = new Array(3), t = new Array(3), e = new Dt(), i = new Dt(), o = new M(), n = new M(), r = new M(), a = new M(), l = new M(), E = new Lt(), d = new Lt(), h = new Lt(), u = new M();
|
|
492
492
|
function p(R, A, C) {
|
|
493
493
|
const T = R.points;
|
|
494
494
|
let F = 0, f = -1;
|
|
@@ -515,28 +515,28 @@ gt.prototype.intersectsTriangle = function() {
|
|
|
515
515
|
return F;
|
|
516
516
|
}
|
|
517
517
|
return function(A, C = null, T = !1) {
|
|
518
|
-
this.needsUpdate && this.update(), A.isExtendedTriangle ? A.needsUpdate && A.update() : (
|
|
518
|
+
this.needsUpdate && this.update(), A.isExtendedTriangle ? A.needsUpdate && A.update() : (c.copy(A), c.update(), A = c);
|
|
519
519
|
const F = this.plane, f = A.plane;
|
|
520
520
|
if (Math.abs(F.normal.dot(f.normal)) > 1 - 1e-10) {
|
|
521
521
|
const m = this.satBounds, g = this.satAxes;
|
|
522
522
|
t[0] = A.a, t[1] = A.b, t[2] = A.c;
|
|
523
523
|
for (let N = 0; N < 4; N++) {
|
|
524
|
-
const
|
|
525
|
-
if (e.setFromPoints(w, t),
|
|
524
|
+
const y = m[N], w = g[N];
|
|
525
|
+
if (e.setFromPoints(w, t), y.isSeparated(e))
|
|
526
526
|
return !1;
|
|
527
527
|
}
|
|
528
528
|
const S = A.satBounds, _ = A.satAxes;
|
|
529
529
|
s[0] = this.a, s[1] = this.b, s[2] = this.c;
|
|
530
530
|
for (let N = 0; N < 4; N++) {
|
|
531
|
-
const
|
|
532
|
-
if (e.setFromPoints(w, s),
|
|
531
|
+
const y = S[N], w = _[N];
|
|
532
|
+
if (e.setFromPoints(w, s), y.isSeparated(e))
|
|
533
533
|
return !1;
|
|
534
534
|
}
|
|
535
535
|
for (let N = 0; N < 4; N++) {
|
|
536
|
-
const
|
|
536
|
+
const y = g[N];
|
|
537
537
|
for (let w = 0; w < 4; w++) {
|
|
538
|
-
const
|
|
539
|
-
if (o.crossVectors(
|
|
538
|
+
const L = _[w];
|
|
539
|
+
if (o.crossVectors(y, L), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
|
|
540
540
|
return !1;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
@@ -556,39 +556,39 @@ gt.prototype.intersectsTriangle = function() {
|
|
|
556
556
|
let U = h.start;
|
|
557
557
|
h.start = h.end, h.end = U;
|
|
558
558
|
}
|
|
559
|
-
const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r),
|
|
560
|
-
return S !==
|
|
559
|
+
const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r), y = h.end.dot(r), w = _ < N, L = S < y;
|
|
560
|
+
return S !== y && N !== _ && w === L ? !1 : (C && (l.subVectors(d.start, h.start), l.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), l.subVectors(d.end, h.end), l.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}();
|
|
564
564
|
gt.prototype.distanceToPoint = function() {
|
|
565
|
-
const
|
|
565
|
+
const c = new M();
|
|
566
566
|
return function(t) {
|
|
567
|
-
return this.closestPointToPoint(t,
|
|
567
|
+
return this.closestPointToPoint(t, c), t.distanceTo(c);
|
|
568
568
|
};
|
|
569
569
|
}();
|
|
570
570
|
gt.prototype.distanceToTriangle = function() {
|
|
571
|
-
const
|
|
571
|
+
const c = new M(), s = new M(), t = ["a", "b", "c"], e = new Lt(), i = new Lt();
|
|
572
572
|
return function(n, r = null, a = null) {
|
|
573
|
-
const
|
|
574
|
-
if (this.intersectsTriangle(n,
|
|
575
|
-
return (r || a) && (r &&
|
|
573
|
+
const l = r || a ? e : null;
|
|
574
|
+
if (this.intersectsTriangle(n, l))
|
|
575
|
+
return (r || a) && (r && l.getCenter(r), a && l.getCenter(a)), 0;
|
|
576
576
|
let E = 1 / 0;
|
|
577
577
|
for (let d = 0; d < 3; d++) {
|
|
578
578
|
let h;
|
|
579
579
|
const u = t[d], p = n[u];
|
|
580
|
-
this.closestPointToPoint(p,
|
|
580
|
+
this.closestPointToPoint(p, c), h = p.distanceToSquared(c), h < E && (E = h, r && r.copy(c), a && a.copy(p));
|
|
581
581
|
const R = this[u];
|
|
582
|
-
n.closestPointToPoint(R,
|
|
582
|
+
n.closestPointToPoint(R, c), h = R.distanceToSquared(c), h < E && (E = h, r && r.copy(R), a && a.copy(c));
|
|
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 R = t[p], A = t[(p + 1) % 3];
|
|
589
|
-
i.set(n[R], n[A]), Ci(e, i,
|
|
590
|
-
const C =
|
|
591
|
-
C < E && (E = C, r && r.copy(
|
|
589
|
+
i.set(n[R], n[A]), Ci(e, i, c, s);
|
|
590
|
+
const C = c.distanceToSquared(s);
|
|
591
|
+
C < E && (E = C, r && r.copy(c), a && a.copy(s));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
return Math.sqrt(E);
|
|
@@ -608,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 l = 0; l <= 1; l++)
|
|
612
612
|
for (let E = 0; E <= 1; E++)
|
|
613
613
|
for (let d = 0; d <= 1; d++) {
|
|
614
|
-
const h = 1 *
|
|
615
|
-
u.x =
|
|
614
|
+
const h = 1 * l | 2 * E | 4 * d, u = i[h];
|
|
615
|
+
u.x = l ? e.x : t.x, u.y = E ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
|
|
616
616
|
}
|
|
617
617
|
const o = this.satBounds, n = this.satAxes, r = i[0];
|
|
618
|
-
for (let
|
|
619
|
-
const E = n[
|
|
618
|
+
for (let l = 0; l < 3; l++) {
|
|
619
|
+
const E = n[l], d = o[l], h = 1 << l, 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 c = new Dt();
|
|
628
628
|
return function(t) {
|
|
629
629
|
this.needsUpdate && this.update();
|
|
630
630
|
const e = t.min, i = t.max, o = this.satBounds, n = this.satAxes, r = this.alignedSatBounds;
|
|
631
|
-
if (
|
|
631
|
+
if (c.min = e.x, c.max = i.x, r[0].isSeparated(c) || (c.min = e.y, c.max = i.y, r[1].isSeparated(c)) || (c.min = e.z, c.max = i.z, r[2].isSeparated(c)))
|
|
632
632
|
return !1;
|
|
633
633
|
for (let a = 0; a < 3; a++) {
|
|
634
|
-
const
|
|
635
|
-
if (
|
|
634
|
+
const l = n[a], E = o[a];
|
|
635
|
+
if (c.setFromBox(l, t), E.isSeparated(c))
|
|
636
636
|
return !1;
|
|
637
637
|
}
|
|
638
638
|
return !0;
|
|
639
639
|
};
|
|
640
640
|
}();
|
|
641
641
|
at.prototype.intersectsTriangle = function() {
|
|
642
|
-
const
|
|
642
|
+
const c = new gt(), s = new Array(3), t = new Dt(), e = new Dt(), i = new M();
|
|
643
643
|
return function(n) {
|
|
644
|
-
this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (
|
|
644
|
+
this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (c.copy(n), c.update(), n = c);
|
|
645
645
|
const r = this.satBounds, a = this.satAxes;
|
|
646
646
|
s[0] = n.a, s[1] = n.b, s[2] = n.c;
|
|
647
647
|
for (let h = 0; h < 3; h++) {
|
|
@@ -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 l = n.satBounds, E = n.satAxes, d = this.points;
|
|
653
653
|
for (let h = 0; h < 3; h++) {
|
|
654
|
-
const u =
|
|
654
|
+
const u = l[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 c = new M();
|
|
676
676
|
return function(t) {
|
|
677
|
-
return this.closestPointToPoint(t,
|
|
677
|
+
return this.closestPointToPoint(t, c), t.distanceTo(c);
|
|
678
678
|
};
|
|
679
679
|
}();
|
|
680
680
|
at.prototype.distanceToBox = function() {
|
|
681
|
-
const
|
|
682
|
-
return function(n, r = 0, a = null,
|
|
681
|
+
const c = ["x", "y", "z"], s = new Array(12).fill().map(() => new Lt()), t = new Array(12).fill().map(() => new Lt()), e = new M(), i = new M();
|
|
682
|
+
return function(n, r = 0, a = null, l = null) {
|
|
683
683
|
if (this.needsUpdate && this.update(), this.intersectsBox(n))
|
|
684
|
-
return (a ||
|
|
684
|
+
return (a || l) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), l && l.copy(i)), 0;
|
|
685
685
|
const E = r * r, d = n.min, h = n.max, u = this.points;
|
|
686
686
|
let p = 1 / 0;
|
|
687
687
|
for (let A = 0; A < 8; A++) {
|
|
688
688
|
const C = u[A];
|
|
689
689
|
i.copy(C).clamp(d, h);
|
|
690
690
|
const T = C.distanceToSquared(i);
|
|
691
|
-
if (T < p && (p = T, a && a.copy(C),
|
|
691
|
+
if (T < p && (p = T, a && a.copy(C), l && l.copy(i), T < E))
|
|
692
692
|
return Math.sqrt(T);
|
|
693
693
|
}
|
|
694
694
|
let R = 0;
|
|
@@ -697,15 +697,15 @@ at.prototype.distanceToBox = function() {
|
|
|
697
697
|
for (let T = 0; T <= 1; T++) {
|
|
698
698
|
const F = (A + 1) % 3, f = (A + 2) % 3, m = C << F | T << f, g = 1 << A | C << F | T << f, S = u[m], _ = u[g];
|
|
699
699
|
s[R].set(S, _);
|
|
700
|
-
const
|
|
701
|
-
x[
|
|
700
|
+
const y = c[A], w = c[F], L = c[f], U = t[R], x = U.start, B = U.end;
|
|
701
|
+
x[y] = d[y], x[w] = C ? d[w] : h[w], x[L] = T ? d[L] : h[w], B[y] = h[y], B[w] = C ? d[w] : h[w], B[L] = T ? d[L] : h[w], R++;
|
|
702
702
|
}
|
|
703
703
|
for (let A = 0; A <= 1; A++)
|
|
704
704
|
for (let C = 0; C <= 1; C++)
|
|
705
705
|
for (let T = 0; T <= 1; T++) {
|
|
706
706
|
i.x = A ? h.x : d.x, i.y = C ? h.y : d.y, i.z = T ? h.z : d.z, this.closestPointToPoint(i, e);
|
|
707
707
|
const F = i.distanceToSquared(e);
|
|
708
|
-
if (F < p && (p = F, a && a.copy(e),
|
|
708
|
+
if (F < p && (p = F, a && a.copy(e), l && l.copy(i), F < E))
|
|
709
709
|
return Math.sqrt(F);
|
|
710
710
|
}
|
|
711
711
|
for (let A = 0; A < 12; A++) {
|
|
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
|
|
|
714
714
|
const F = t[T];
|
|
715
715
|
Ci(C, F, e, i);
|
|
716
716
|
const f = e.distanceToSquared(i);
|
|
717
|
-
if (f < p && (p = f, a && a.copy(e),
|
|
717
|
+
if (f < p && (p = f, a && a.copy(e), l && l.copy(i), f < E))
|
|
718
718
|
return Math.sqrt(f);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -739,23 +739,23 @@ class po extends Ti {
|
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
const It = /* @__PURE__ */ new po();
|
|
742
|
-
function ht(
|
|
743
|
-
return s[
|
|
742
|
+
function ht(c, s) {
|
|
743
|
+
return s[c + 15] === 65535;
|
|
744
744
|
}
|
|
745
|
-
function Et(
|
|
746
|
-
return s[
|
|
745
|
+
function Et(c, s) {
|
|
746
|
+
return s[c + 6];
|
|
747
747
|
}
|
|
748
|
-
function ft(
|
|
749
|
-
return s[
|
|
748
|
+
function ft(c, s) {
|
|
749
|
+
return s[c + 14];
|
|
750
750
|
}
|
|
751
|
-
function pt(
|
|
752
|
-
return
|
|
751
|
+
function pt(c) {
|
|
752
|
+
return c + 8;
|
|
753
753
|
}
|
|
754
|
-
function Ct(
|
|
755
|
-
return s[
|
|
754
|
+
function Ct(c, s) {
|
|
755
|
+
return s[c + 6];
|
|
756
756
|
}
|
|
757
|
-
function Nn(
|
|
758
|
-
return s[
|
|
757
|
+
function Nn(c, s) {
|
|
758
|
+
return s[c + 7];
|
|
759
759
|
}
|
|
760
760
|
class Co {
|
|
761
761
|
constructor() {
|
|
@@ -770,48 +770,48 @@ class Co {
|
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
const Z = new Co();
|
|
773
|
-
let
|
|
773
|
+
let Vt, Ie;
|
|
774
774
|
const Jt = [], Ke = /* @__PURE__ */ new Ti(() => new Ot());
|
|
775
|
-
function To(
|
|
776
|
-
|
|
777
|
-
const n = si(0,
|
|
778
|
-
Z.clearBuffer(), Ke.releasePrimitive(
|
|
775
|
+
function To(c, s, t, e, i, o) {
|
|
776
|
+
Vt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Vt, Ie), Z.setBuffer(c._roots[s]);
|
|
777
|
+
const n = si(0, c.geometry, t, e, i, o);
|
|
778
|
+
Z.clearBuffer(), Ke.releasePrimitive(Vt), Ke.releasePrimitive(Ie), Jt.pop(), Jt.pop();
|
|
779
779
|
const r = Jt.length;
|
|
780
|
-
return r > 0 && (Ie = Jt[r - 1],
|
|
780
|
+
return r > 0 && (Ie = Jt[r - 1], Vt = Jt[r - 2]), n;
|
|
781
781
|
}
|
|
782
|
-
function si(
|
|
783
|
-
const { float32Array: r, uint16Array: a, uint32Array:
|
|
784
|
-
let E =
|
|
782
|
+
function si(c, s, t, e, i = null, o = 0, n = 0) {
|
|
783
|
+
const { float32Array: r, uint16Array: a, uint32Array: l } = Z;
|
|
784
|
+
let E = c * 2;
|
|
785
785
|
if (ht(E, a)) {
|
|
786
|
-
const h = Et(
|
|
787
|
-
return $(
|
|
786
|
+
const h = Et(c, l), u = ft(E, a);
|
|
787
|
+
return $(c, r, Vt), e(h, u, !1, n, o + c, Vt);
|
|
788
788
|
} else {
|
|
789
|
-
let
|
|
789
|
+
let y = function(L) {
|
|
790
790
|
const { uint16Array: U, uint32Array: x } = Z;
|
|
791
|
-
let B =
|
|
791
|
+
let B = L * 2;
|
|
792
792
|
for (; !ht(B, U); )
|
|
793
|
-
|
|
794
|
-
return Et(
|
|
795
|
-
}, w = function(
|
|
793
|
+
L = pt(L), B = L * 2;
|
|
794
|
+
return Et(L, x);
|
|
795
|
+
}, w = function(L) {
|
|
796
796
|
const { uint16Array: U, uint32Array: x } = Z;
|
|
797
|
-
let B =
|
|
797
|
+
let B = L * 2;
|
|
798
798
|
for (; !ht(B, U); )
|
|
799
|
-
|
|
800
|
-
return Et(
|
|
799
|
+
L = Ct(L, x), B = L * 2;
|
|
800
|
+
return Et(L, x) + ft(B, U);
|
|
801
801
|
};
|
|
802
|
-
const h = pt(
|
|
802
|
+
const h = pt(c), u = Ct(c, l);
|
|
803
803
|
let p = h, R = u, A, C, T, F;
|
|
804
|
-
if (i && (T =
|
|
804
|
+
if (i && (T = Vt, F = Ie, $(p, r, T), $(R, r, F), A = i(T), C = i(F), C < A)) {
|
|
805
805
|
p = u, R = h;
|
|
806
|
-
const
|
|
807
|
-
A = C, C =
|
|
806
|
+
const L = A;
|
|
807
|
+
A = C, C = L, T = F;
|
|
808
808
|
}
|
|
809
|
-
T || (T =
|
|
809
|
+
T || (T = Vt, $(p, r, T));
|
|
810
810
|
const f = ht(p * 2, a), m = t(T, f, A, n + 1, o + p);
|
|
811
811
|
let g;
|
|
812
|
-
if (m ===
|
|
813
|
-
const
|
|
814
|
-
g = e(
|
|
812
|
+
if (m === yi) {
|
|
813
|
+
const L = y(p), x = w(p) - L;
|
|
814
|
+
g = e(L, x, !0, n + 1, o + p, T);
|
|
815
815
|
} else
|
|
816
816
|
g = m && si(
|
|
817
817
|
p,
|
|
@@ -827,9 +827,9 @@ function si(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
827
827
|
F = Ie, $(R, r, F);
|
|
828
828
|
const S = ht(R * 2, a), _ = t(F, S, C, n + 1, o + R);
|
|
829
829
|
let N;
|
|
830
|
-
if (_ ===
|
|
831
|
-
const
|
|
832
|
-
N = e(
|
|
830
|
+
if (_ === yi) {
|
|
831
|
+
const L = y(R), x = w(R) - L;
|
|
832
|
+
N = e(L, x, !0, n + 1, o + R, F);
|
|
833
833
|
} else
|
|
834
834
|
N = _ && si(
|
|
835
835
|
R,
|
|
@@ -844,10 +844,10 @@ function si(l, s, t, e, i = null, o = 0, n = 0) {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
const Ae = /* @__PURE__ */ new M(), Bs = /* @__PURE__ */ new M();
|
|
847
|
-
function mo(
|
|
847
|
+
function mo(c, s, t = {}, e = 0, i = 1 / 0) {
|
|
848
848
|
const o = e * e, n = i * i;
|
|
849
849
|
let r = 1 / 0, a = null;
|
|
850
|
-
if (
|
|
850
|
+
if (c.shapecast(
|
|
851
851
|
{
|
|
852
852
|
boundsTraverseOrder: (E) => (Ae.copy(s).clamp(E.min, E.max), Ae.distanceToSquared(s)),
|
|
853
853
|
intersectsBounds: (E, d, h) => h < r && h < n,
|
|
@@ -859,22 +859,22 @@ function mo(l, s, t = {}, e = 0, i = 1 / 0) {
|
|
|
859
859
|
}
|
|
860
860
|
), r === 1 / 0)
|
|
861
861
|
return null;
|
|
862
|
-
const
|
|
863
|
-
return t.point ? t.point.copy(Bs) : t.point = Bs.clone(), t.distance =
|
|
862
|
+
const l = Math.sqrt(r);
|
|
863
|
+
return t.point ? t.point.copy(Bs) : t.point = Bs.clone(), t.distance = l, t.faceIndex = a, t;
|
|
864
864
|
}
|
|
865
865
|
const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), es = /* @__PURE__ */ new fe(), Ui = /* @__PURE__ */ new M(), xi = /* @__PURE__ */ new M(), bi = /* @__PURE__ */ new M(), ss = /* @__PURE__ */ new M();
|
|
866
|
-
function Ro(
|
|
866
|
+
function Ro(c, s, t, e, i, o) {
|
|
867
867
|
let n;
|
|
868
|
-
return o ===
|
|
869
|
-
distance:
|
|
868
|
+
return o === Vn ? n = c.intersectTriangle(e, t, s, !0, i) : n = c.intersectTriangle(s, t, e, o !== Fn, i), n === null ? null : {
|
|
869
|
+
distance: c.origin.distanceTo(i),
|
|
870
870
|
point: i.clone()
|
|
871
871
|
};
|
|
872
872
|
}
|
|
873
|
-
function Ao(
|
|
873
|
+
function Ao(c, s, t, e, i, o, n, r, a) {
|
|
874
874
|
te.fromBufferAttribute(s, o), ee.fromBufferAttribute(s, n), se.fromBufferAttribute(s, r);
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r),
|
|
875
|
+
const l = Ro(c, te, ee, se, ss, a);
|
|
876
|
+
if (l) {
|
|
877
|
+
e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), l.uv = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), l.uv1 = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), t && (Ui.fromBufferAttribute(t, o), xi.fromBufferAttribute(t, n), bi.fromBufferAttribute(t, r), l.normal = ue.getInterpolation(ss, te, ee, se, Ui, xi, bi, new M()), l.normal.dot(c.direction) > 0 && l.normal.multiplyScalar(-1));
|
|
878
878
|
const E = {
|
|
879
879
|
a: o,
|
|
880
880
|
b: n,
|
|
@@ -882,62 +882,62 @@ function Ao(l, s, t, e, i, o, n, r, a) {
|
|
|
882
882
|
normal: new M(),
|
|
883
883
|
materialIndex: 0
|
|
884
884
|
};
|
|
885
|
-
ue.getNormal(te, ee, se, E.normal),
|
|
885
|
+
ue.getNormal(te, ee, se, E.normal), l.face = E, l.faceIndex = o;
|
|
886
886
|
}
|
|
887
|
-
return
|
|
887
|
+
return l;
|
|
888
888
|
}
|
|
889
|
-
function
|
|
889
|
+
function Ls(c, s, t, e, i) {
|
|
890
890
|
const o = e * 3;
|
|
891
891
|
let n = o + 0, r = o + 1, a = o + 2;
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
const { position: E, normal: d, uv: h, uv1: u } =
|
|
892
|
+
const l = c.index;
|
|
893
|
+
c.index && (n = l.getX(n), r = l.getX(r), a = l.getX(a));
|
|
894
|
+
const { position: E, normal: d, uv: h, uv1: u } = c.attributes, p = Ao(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 tt(
|
|
898
|
-
const i =
|
|
899
|
-
let r = s, a = s + 1,
|
|
900
|
-
t && (r = t.getX(r), a = t.getX(a),
|
|
897
|
+
function tt(c, s, t, e) {
|
|
898
|
+
const i = c.a, o = c.b, n = c.c;
|
|
899
|
+
let r = s, a = s + 1, l = s + 2;
|
|
900
|
+
t && (r = t.getX(r), a = t.getX(a), l = t.getX(l)), i.x = e.getX(r), i.y = e.getY(r), i.z = e.getZ(r), o.x = e.getX(a), o.y = e.getY(a), o.z = e.getZ(a), n.x = e.getX(l), n.y = e.getY(l), n.z = e.getZ(l);
|
|
901
901
|
}
|
|
902
|
-
function Fo(
|
|
903
|
-
const { geometry: n, _indirectBuffer: r } =
|
|
904
|
-
for (let a = e,
|
|
905
|
-
|
|
902
|
+
function Fo(c, s, t, e, i, o) {
|
|
903
|
+
const { geometry: n, _indirectBuffer: r } = c;
|
|
904
|
+
for (let a = e, l = e + i; a < l; a++)
|
|
905
|
+
Ls(n, s, t, a, o);
|
|
906
906
|
}
|
|
907
|
-
function go(
|
|
908
|
-
const { geometry: o, _indirectBuffer: n } =
|
|
907
|
+
function go(c, s, t, e, i) {
|
|
908
|
+
const { geometry: o, _indirectBuffer: n } = c;
|
|
909
909
|
let r = 1 / 0, a = null;
|
|
910
|
-
for (let
|
|
910
|
+
for (let l = e, E = e + i; l < E; l++) {
|
|
911
911
|
let d;
|
|
912
|
-
d =
|
|
912
|
+
d = Ls(o, s, t, l), d && d.distance < r && (a = d, r = d.distance);
|
|
913
913
|
}
|
|
914
914
|
return a;
|
|
915
915
|
}
|
|
916
|
-
function Oo(
|
|
917
|
-
const { geometry: r } = t, { index: a } = r,
|
|
918
|
-
for (let E =
|
|
916
|
+
function Oo(c, s, t, e, i, o, n) {
|
|
917
|
+
const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
|
|
918
|
+
for (let E = c, d = s + c; E < d; E++) {
|
|
919
919
|
let h;
|
|
920
|
-
if (h = E, tt(n, h * 3, a,
|
|
920
|
+
if (h = E, tt(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
|
|
921
921
|
return !0;
|
|
922
922
|
}
|
|
923
923
|
return !1;
|
|
924
924
|
}
|
|
925
|
-
function So(
|
|
925
|
+
function So(c, s = null) {
|
|
926
926
|
s && Array.isArray(s) && (s = new Set(s));
|
|
927
|
-
const t =
|
|
928
|
-
let o, n, r, a,
|
|
929
|
-
const E =
|
|
927
|
+
const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
|
|
928
|
+
let o, n, r, a, l = 0;
|
|
929
|
+
const E = c._roots;
|
|
930
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, l), l += o.byteLength;
|
|
932
932
|
function d(h, u, p = !1) {
|
|
933
933
|
const R = h * 2;
|
|
934
|
-
if (r[R + 15] ===
|
|
934
|
+
if (r[R + 15] === ys) {
|
|
935
935
|
const C = n[h + 6], T = r[R + 14];
|
|
936
936
|
let F = 1 / 0, f = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
|
|
937
|
-
for (let N = 3 * C,
|
|
937
|
+
for (let N = 3 * C, y = 3 * (C + T); N < y; N++) {
|
|
938
938
|
let w = e[N];
|
|
939
|
-
const
|
|
940
|
-
|
|
939
|
+
const L = i.getX(w), U = i.getY(w), x = i.getZ(w);
|
|
940
|
+
L < F && (F = L), L > g && (g = L), U < f && (f = U), U > S && (S = U), x < m && (m = x), x > _ && (_ = x);
|
|
941
941
|
}
|
|
942
942
|
return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== g || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = g, a[h + 4] = S, a[h + 5] = _, !0) : !1;
|
|
943
943
|
} else {
|
|
@@ -945,107 +945,107 @@ function So(l, s = null) {
|
|
|
945
945
|
let m = p, g = !1, S = !1;
|
|
946
946
|
s ? m || (g = s.has(F), S = s.has(f), m = !g && !S) : (g = !0, S = !0);
|
|
947
947
|
const _ = m || g, N = m || S;
|
|
948
|
-
let
|
|
949
|
-
_ && (
|
|
948
|
+
let y = !1;
|
|
949
|
+
_ && (y = d(C, u, m));
|
|
950
950
|
let w = !1;
|
|
951
951
|
N && (w = d(T, u, m));
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
952
|
+
const L = y || w;
|
|
953
|
+
if (L)
|
|
954
954
|
for (let U = 0; U < 3; U++) {
|
|
955
955
|
const x = C + U, B = T + U, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
|
|
956
956
|
a[h + U] = H < et ? H : et, a[h + U + 3] = q > Q ? q : Q;
|
|
957
957
|
}
|
|
958
|
-
return
|
|
958
|
+
return L;
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
const vi = /* @__PURE__ */ new Ot();
|
|
963
|
-
function
|
|
964
|
-
return $(
|
|
963
|
+
function Gt(c, s, t, e) {
|
|
964
|
+
return $(c, s, vi), t.intersectBox(vi, e);
|
|
965
965
|
}
|
|
966
|
-
function _o(
|
|
967
|
-
const { geometry: n, _indirectBuffer: r } =
|
|
968
|
-
for (let a = e,
|
|
966
|
+
function _o(c, s, t, e, i, o) {
|
|
967
|
+
const { geometry: n, _indirectBuffer: r } = c;
|
|
968
|
+
for (let a = e, l = e + i; a < l; a++) {
|
|
969
969
|
let E = r ? r[a] : a;
|
|
970
|
-
|
|
970
|
+
Ls(n, s, t, E, o);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
function No(
|
|
974
|
-
const { geometry: o, _indirectBuffer: n } =
|
|
973
|
+
function No(c, s, t, e, i) {
|
|
974
|
+
const { geometry: o, _indirectBuffer: n } = c;
|
|
975
975
|
let r = 1 / 0, a = null;
|
|
976
|
-
for (let
|
|
976
|
+
for (let l = e, E = e + i; l < E; l++) {
|
|
977
977
|
let d;
|
|
978
|
-
d =
|
|
978
|
+
d = Ls(o, s, t, n ? n[l] : l), d && d.distance < r && (a = d, r = d.distance);
|
|
979
979
|
}
|
|
980
980
|
return a;
|
|
981
981
|
}
|
|
982
|
-
function
|
|
983
|
-
const { geometry: r } = t, { index: a } = r,
|
|
984
|
-
for (let E =
|
|
982
|
+
function Po(c, s, t, e, i, o, n) {
|
|
983
|
+
const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
|
|
984
|
+
for (let E = c, d = s + c; E < d; E++) {
|
|
985
985
|
let h;
|
|
986
|
-
if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a,
|
|
986
|
+
if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
|
|
987
987
|
return !0;
|
|
988
988
|
}
|
|
989
989
|
return !1;
|
|
990
990
|
}
|
|
991
991
|
const Bi = /* @__PURE__ */ new M();
|
|
992
|
-
function
|
|
993
|
-
Z.setBuffer(
|
|
992
|
+
function yo(c, s, t, e, i) {
|
|
993
|
+
Z.setBuffer(c._roots[s]), ii(0, c, t, e, i), Z.clearBuffer();
|
|
994
994
|
}
|
|
995
|
-
function ii(
|
|
996
|
-
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a =
|
|
995
|
+
function ii(c, s, t, e, i) {
|
|
996
|
+
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
|
|
997
997
|
if (ht(a, n)) {
|
|
998
|
-
const E = Et(
|
|
998
|
+
const E = Et(c, r), d = ft(a, n);
|
|
999
999
|
Fo(s, t, e, E, d, i);
|
|
1000
1000
|
} else {
|
|
1001
|
-
const E = pt(
|
|
1002
|
-
|
|
1003
|
-
const d = Ct(
|
|
1004
|
-
|
|
1001
|
+
const E = pt(c);
|
|
1002
|
+
Gt(E, o, e, Bi) && ii(E, s, t, e, i);
|
|
1003
|
+
const d = Ct(c, r);
|
|
1004
|
+
Gt(d, o, e, Bi) && ii(d, s, t, e, i);
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
const Yi = /* @__PURE__ */ new M(),
|
|
1008
|
-
function Mo(
|
|
1009
|
-
Z.setBuffer(
|
|
1010
|
-
const i = ni(0,
|
|
1007
|
+
const Yi = /* @__PURE__ */ new M(), Lo = ["x", "y", "z"];
|
|
1008
|
+
function Mo(c, s, t, e) {
|
|
1009
|
+
Z.setBuffer(c._roots[s]);
|
|
1010
|
+
const i = ni(0, c, t, e);
|
|
1011
1011
|
return Z.clearBuffer(), i;
|
|
1012
1012
|
}
|
|
1013
|
-
function ni(
|
|
1013
|
+
function ni(c, s, t, e) {
|
|
1014
1014
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1015
|
-
let r =
|
|
1015
|
+
let r = c * 2;
|
|
1016
1016
|
if (ht(r, o)) {
|
|
1017
|
-
const
|
|
1018
|
-
return go(s, t, e,
|
|
1017
|
+
const l = Et(c, n), E = ft(r, o);
|
|
1018
|
+
return go(s, t, e, l, E);
|
|
1019
1019
|
} else {
|
|
1020
|
-
const
|
|
1020
|
+
const l = Nn(c, n), E = Lo[l], h = e.direction[E] >= 0;
|
|
1021
1021
|
let u, p;
|
|
1022
|
-
h ? (u = pt(
|
|
1023
|
-
const A =
|
|
1022
|
+
h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
|
|
1023
|
+
const A = Gt(u, i, e, Yi) ? ni(u, s, t, e) : null;
|
|
1024
1024
|
if (A) {
|
|
1025
1025
|
const F = A.point[E];
|
|
1026
|
-
if (h ? F <= i[p +
|
|
1026
|
+
if (h ? F <= i[p + l] : (
|
|
1027
1027
|
// min bounding data
|
|
1028
|
-
F >= i[p +
|
|
1028
|
+
F >= i[p + l + 3]
|
|
1029
1029
|
))
|
|
1030
1030
|
return A;
|
|
1031
1031
|
}
|
|
1032
|
-
const T =
|
|
1032
|
+
const T = Gt(p, i, e, Yi) ? ni(p, s, t, e) : null;
|
|
1033
1033
|
return A && T ? A.distance <= T.distance ? A : T : A || T || null;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
const is = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new gt(), ne = /* @__PURE__ */ new gt(), Fe = /* @__PURE__ */ new Mt(),
|
|
1037
|
-
function wo(
|
|
1038
|
-
Z.setBuffer(
|
|
1039
|
-
const i = oi(0,
|
|
1036
|
+
const is = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new gt(), ne = /* @__PURE__ */ new gt(), Fe = /* @__PURE__ */ new Mt(), Vi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
|
|
1037
|
+
function wo(c, s, t, e) {
|
|
1038
|
+
Z.setBuffer(c._roots[s]);
|
|
1039
|
+
const i = oi(0, c, t, e);
|
|
1040
1040
|
return Z.clearBuffer(), i;
|
|
1041
1041
|
}
|
|
1042
|
-
function oi(
|
|
1042
|
+
function oi(c, s, t, e, i = null) {
|
|
1043
1043
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1044
|
-
let a =
|
|
1045
|
-
if (i === null && (t.boundingBox || t.computeBoundingBox(),
|
|
1046
|
-
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(
|
|
1044
|
+
let a = c * 2;
|
|
1045
|
+
if (i === null && (t.boundingBox || t.computeBoundingBox(), Vi.set(t.boundingBox.min, t.boundingBox.max, e), i = Vi), ht(a, n)) {
|
|
1046
|
+
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(c, r), A = ft(a, n);
|
|
1047
1047
|
if (Fe.copy(e).invert(), t.boundsTree)
|
|
1048
|
-
return $(
|
|
1048
|
+
return $(c, o, ns), ns.matrix.copy(Fe), ns.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1049
1049
|
intersectsBounds: (T) => ns.intersectsBox(T),
|
|
1050
1050
|
intersectsTriangle: (T) => {
|
|
1051
1051
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
@@ -1062,18 +1062,18 @@ function oi(l, s, t, e, i = null) {
|
|
|
1062
1062
|
return !0;
|
|
1063
1063
|
}
|
|
1064
1064
|
} else {
|
|
1065
|
-
const E =
|
|
1065
|
+
const E = c + 8, d = r[c + 6];
|
|
1066
1066
|
return $(E, o, is), !!(i.intersectsBox(is) && oi(E, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && oi(d, s, t, e, i)));
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
1069
|
const os = /* @__PURE__ */ new Mt(), Ys = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Do = /* @__PURE__ */ new M(), Uo = /* @__PURE__ */ new M(), xo = /* @__PURE__ */ new M(), bo = /* @__PURE__ */ new M();
|
|
1070
|
-
function vo(
|
|
1070
|
+
function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1071
1071
|
s.boundingBox || s.computeBoundingBox(), Ys.set(s.boundingBox.min, s.boundingBox.max, t), Ys.needsUpdate = !0;
|
|
1072
|
-
const r =
|
|
1072
|
+
const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
|
|
1073
1073
|
let p = Do, R = Uo, A = null, C = null;
|
|
1074
1074
|
i && (A = xo, C = bo);
|
|
1075
1075
|
let T = 1 / 0, F = null, f = null;
|
|
1076
|
-
return os.copy(t).invert(), ge.matrix.copy(os),
|
|
1076
|
+
return os.copy(t).invert(), ge.matrix.copy(os), c.shapecast(
|
|
1077
1077
|
{
|
|
1078
1078
|
boundsTraverseOrder: (m) => Ys.distanceToBox(m),
|
|
1079
1079
|
intersectsBounds: (m, g, S) => S < T && S < n ? (g && (ge.min.copy(m.min), ge.max.copy(m.max), ge.needsUpdate = !0), !0) : !1,
|
|
@@ -1081,14 +1081,14 @@ function vo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1081
1081
|
if (s.boundsTree)
|
|
1082
1082
|
return s.boundsTree.shapecast({
|
|
1083
1083
|
boundsTraverseOrder: (_) => ge.distanceToBox(_),
|
|
1084
|
-
intersectsBounds: (_, N,
|
|
1084
|
+
intersectsBounds: (_, N, y) => y < T && y < n,
|
|
1085
1085
|
intersectsRange: (_, N) => {
|
|
1086
|
-
for (let
|
|
1087
|
-
tt(u, 3 *
|
|
1088
|
-
for (let
|
|
1089
|
-
tt(h, 3 *
|
|
1086
|
+
for (let y = _, w = _ + N; y < w; y++) {
|
|
1087
|
+
tt(u, 3 * y, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1088
|
+
for (let L = m, U = m + g; L < U; L++) {
|
|
1089
|
+
tt(h, 3 * L, l, a), h.needsUpdate = !0;
|
|
1090
1090
|
const x = h.distanceToTriangle(u, p, A);
|
|
1091
|
-
if (x < T && (R.copy(p), C && C.copy(A), T = x, F =
|
|
1091
|
+
if (x < T && (R.copy(p), C && C.copy(A), T = x, F = L, f = y), x < o)
|
|
1092
1092
|
return !0;
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
@@ -1098,10 +1098,10 @@ function vo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1098
1098
|
const S = pe(s);
|
|
1099
1099
|
for (let _ = 0, N = S; _ < N; _++) {
|
|
1100
1100
|
tt(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1101
|
-
for (let
|
|
1102
|
-
tt(h, 3 *
|
|
1103
|
-
const
|
|
1104
|
-
if (
|
|
1101
|
+
for (let y = m, w = m + g; y < w; y++) {
|
|
1102
|
+
tt(h, 3 * y, l, a), h.needsUpdate = !0;
|
|
1103
|
+
const L = h.distanceToTriangle(u, p, A);
|
|
1104
|
+
if (L < T && (R.copy(p), C && C.copy(A), T = L, F = y, f = _), L < o)
|
|
1105
1105
|
return !0;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
@@ -1110,22 +1110,22 @@ function vo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1110
1110
|
}
|
|
1111
1111
|
), It.releasePrimitive(h), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(R) : e.point = R.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), R.applyMatrix4(os), i.distance = R.sub(i.point).length(), i.faceIndex = f), e);
|
|
1112
1112
|
}
|
|
1113
|
-
function Bo(
|
|
1113
|
+
function Bo(c, s = null) {
|
|
1114
1114
|
s && Array.isArray(s) && (s = new Set(s));
|
|
1115
|
-
const t =
|
|
1116
|
-
let o, n, r, a,
|
|
1117
|
-
const E =
|
|
1115
|
+
const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
|
|
1116
|
+
let o, n, r, a, l = 0;
|
|
1117
|
+
const E = c._roots;
|
|
1118
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, l), l += o.byteLength;
|
|
1120
1120
|
function d(h, u, p = !1) {
|
|
1121
1121
|
const R = h * 2;
|
|
1122
|
-
if (r[R + 15] ===
|
|
1122
|
+
if (r[R + 15] === ys) {
|
|
1123
1123
|
const C = n[h + 6], T = r[R + 14];
|
|
1124
1124
|
let F = 1 / 0, f = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
|
|
1125
|
-
for (let N = C,
|
|
1126
|
-
const w = 3 *
|
|
1127
|
-
for (let
|
|
1128
|
-
let U = w +
|
|
1125
|
+
for (let N = C, y = C + T; N < y; N++) {
|
|
1126
|
+
const w = 3 * c.resolveTriangleIndex(N);
|
|
1127
|
+
for (let L = 0; L < 3; L++) {
|
|
1128
|
+
let U = w + L;
|
|
1129
1129
|
U = e ? e[U] : U;
|
|
1130
1130
|
const x = i.getX(U), B = i.getY(U), H = i.getZ(U);
|
|
1131
1131
|
x < F && (F = x), x > g && (g = x), B < f && (f = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
|
|
@@ -1137,78 +1137,78 @@ function Bo(l, s = null) {
|
|
|
1137
1137
|
let m = p, g = !1, S = !1;
|
|
1138
1138
|
s ? m || (g = s.has(F), S = s.has(f), m = !g && !S) : (g = !0, S = !0);
|
|
1139
1139
|
const _ = m || g, N = m || S;
|
|
1140
|
-
let
|
|
1141
|
-
_ && (
|
|
1140
|
+
let y = !1;
|
|
1141
|
+
_ && (y = d(C, u, m));
|
|
1142
1142
|
let w = !1;
|
|
1143
1143
|
N && (w = d(T, u, m));
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
1144
|
+
const L = y || w;
|
|
1145
|
+
if (L)
|
|
1146
1146
|
for (let U = 0; U < 3; U++) {
|
|
1147
1147
|
const x = C + U, B = T + U, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
|
|
1148
1148
|
a[h + U] = H < et ? H : et, a[h + U + 3] = q > Q ? q : Q;
|
|
1149
1149
|
}
|
|
1150
|
-
return
|
|
1150
|
+
return L;
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
const
|
|
1155
|
-
function Yo(
|
|
1156
|
-
Z.setBuffer(
|
|
1154
|
+
const Gi = /* @__PURE__ */ new M();
|
|
1155
|
+
function Yo(c, s, t, e, i) {
|
|
1156
|
+
Z.setBuffer(c._roots[s]), ri(0, c, t, e, i), Z.clearBuffer();
|
|
1157
1157
|
}
|
|
1158
|
-
function ri(
|
|
1159
|
-
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a =
|
|
1158
|
+
function ri(c, s, t, e, i) {
|
|
1159
|
+
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
|
|
1160
1160
|
if (ht(a, n)) {
|
|
1161
|
-
const E = Et(
|
|
1161
|
+
const E = Et(c, r), d = ft(a, n);
|
|
1162
1162
|
_o(s, t, e, E, d, i);
|
|
1163
1163
|
} else {
|
|
1164
|
-
const E = pt(
|
|
1165
|
-
|
|
1166
|
-
const d = Ct(
|
|
1167
|
-
|
|
1164
|
+
const E = pt(c);
|
|
1165
|
+
Gt(E, o, e, Gi) && ri(E, s, t, e, i);
|
|
1166
|
+
const d = Ct(c, r);
|
|
1167
|
+
Gt(d, o, e, Gi) && ri(d, s, t, e, i);
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
|
-
const zi = /* @__PURE__ */ new M(),
|
|
1171
|
-
function
|
|
1172
|
-
Z.setBuffer(
|
|
1173
|
-
const i = ai(0,
|
|
1170
|
+
const zi = /* @__PURE__ */ new M(), Vo = ["x", "y", "z"];
|
|
1171
|
+
function Go(c, s, t, e) {
|
|
1172
|
+
Z.setBuffer(c._roots[s]);
|
|
1173
|
+
const i = ai(0, c, t, e);
|
|
1174
1174
|
return Z.clearBuffer(), i;
|
|
1175
1175
|
}
|
|
1176
|
-
function ai(
|
|
1176
|
+
function ai(c, s, t, e) {
|
|
1177
1177
|
const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
|
|
1178
|
-
let r =
|
|
1178
|
+
let r = c * 2;
|
|
1179
1179
|
if (ht(r, o)) {
|
|
1180
|
-
const
|
|
1181
|
-
return No(s, t, e,
|
|
1180
|
+
const l = Et(c, n), E = ft(r, o);
|
|
1181
|
+
return No(s, t, e, l, E);
|
|
1182
1182
|
} else {
|
|
1183
|
-
const
|
|
1183
|
+
const l = Nn(c, n), E = Vo[l], h = e.direction[E] >= 0;
|
|
1184
1184
|
let u, p;
|
|
1185
|
-
h ? (u = pt(
|
|
1186
|
-
const A =
|
|
1185
|
+
h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
|
|
1186
|
+
const A = Gt(u, i, e, zi) ? ai(u, s, t, e) : null;
|
|
1187
1187
|
if (A) {
|
|
1188
1188
|
const F = A.point[E];
|
|
1189
|
-
if (h ? F <= i[p +
|
|
1189
|
+
if (h ? F <= i[p + l] : (
|
|
1190
1190
|
// min bounding data
|
|
1191
|
-
F >= i[p +
|
|
1191
|
+
F >= i[p + l + 3]
|
|
1192
1192
|
))
|
|
1193
1193
|
return A;
|
|
1194
1194
|
}
|
|
1195
|
-
const T =
|
|
1195
|
+
const T = Gt(p, i, e, zi) ? ai(p, s, t, e) : null;
|
|
1196
1196
|
return A && T ? A.distance <= T.distance ? A : T : A || T || null;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
1199
|
const rs = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new gt(), re = /* @__PURE__ */ new gt(), Oe = /* @__PURE__ */ new Mt(), Hi = /* @__PURE__ */ new at(), as = /* @__PURE__ */ new at();
|
|
1200
|
-
function zo(
|
|
1201
|
-
Z.setBuffer(
|
|
1202
|
-
const i = ci(0,
|
|
1200
|
+
function zo(c, s, t, e) {
|
|
1201
|
+
Z.setBuffer(c._roots[s]);
|
|
1202
|
+
const i = ci(0, c, t, e);
|
|
1203
1203
|
return Z.clearBuffer(), i;
|
|
1204
1204
|
}
|
|
1205
|
-
function ci(
|
|
1205
|
+
function ci(c, s, t, e, i = null) {
|
|
1206
1206
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
|
|
1207
|
-
let a =
|
|
1207
|
+
let a = c * 2;
|
|
1208
1208
|
if (i === null && (t.boundingBox || t.computeBoundingBox(), Hi.set(t.boundingBox.min, t.boundingBox.max, e), i = Hi), ht(a, n)) {
|
|
1209
|
-
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(
|
|
1209
|
+
const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(c, r), A = ft(a, n);
|
|
1210
1210
|
if (Oe.copy(e).invert(), t.boundsTree)
|
|
1211
|
-
return $(
|
|
1211
|
+
return $(c, o, as), as.matrix.copy(Oe), as.needsUpdate = !0, t.boundsTree.shapecast({
|
|
1212
1212
|
intersectsBounds: (T) => as.intersectsBox(T),
|
|
1213
1213
|
intersectsTriangle: (T) => {
|
|
1214
1214
|
T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
|
|
@@ -1226,36 +1226,36 @@ function ci(l, s, t, e, i = null) {
|
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
}
|
|
1228
1228
|
} else {
|
|
1229
|
-
const E =
|
|
1229
|
+
const E = c + 8, d = r[c + 6];
|
|
1230
1230
|
return $(E, o, rs), !!(i.intersectsBox(rs) && ci(E, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && ci(d, s, t, e, i)));
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
|
-
const cs = /* @__PURE__ */ new Mt(),
|
|
1234
|
-
function Zo(
|
|
1235
|
-
s.boundingBox || s.computeBoundingBox(),
|
|
1236
|
-
const r =
|
|
1233
|
+
const cs = /* @__PURE__ */ new Mt(), Vs = /* @__PURE__ */ new at(), Se = /* @__PURE__ */ new at(), Ho = /* @__PURE__ */ new M(), ko = /* @__PURE__ */ new M(), Wo = /* @__PURE__ */ new M(), Xo = /* @__PURE__ */ new M();
|
|
1234
|
+
function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
1235
|
+
s.boundingBox || s.computeBoundingBox(), Vs.set(s.boundingBox.min, s.boundingBox.max, t), Vs.needsUpdate = !0;
|
|
1236
|
+
const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
|
|
1237
1237
|
let p = Ho, R = ko, A = null, C = null;
|
|
1238
1238
|
i && (A = Wo, C = Xo);
|
|
1239
1239
|
let T = 1 / 0, F = null, f = null;
|
|
1240
|
-
return cs.copy(t).invert(), Se.matrix.copy(cs),
|
|
1240
|
+
return cs.copy(t).invert(), Se.matrix.copy(cs), c.shapecast(
|
|
1241
1241
|
{
|
|
1242
|
-
boundsTraverseOrder: (m) =>
|
|
1242
|
+
boundsTraverseOrder: (m) => Vs.distanceToBox(m),
|
|
1243
1243
|
intersectsBounds: (m, g, S) => S < T && S < n ? (g && (Se.min.copy(m.min), Se.max.copy(m.max), Se.needsUpdate = !0), !0) : !1,
|
|
1244
1244
|
intersectsRange: (m, g) => {
|
|
1245
1245
|
if (s.boundsTree) {
|
|
1246
1246
|
const S = s.boundsTree;
|
|
1247
1247
|
return S.shapecast({
|
|
1248
1248
|
boundsTraverseOrder: (_) => Se.distanceToBox(_),
|
|
1249
|
-
intersectsBounds: (_, N,
|
|
1249
|
+
intersectsBounds: (_, N, y) => y < T && y < n,
|
|
1250
1250
|
intersectsRange: (_, N) => {
|
|
1251
|
-
for (let
|
|
1252
|
-
const
|
|
1253
|
-
tt(u, 3 *
|
|
1251
|
+
for (let y = _, w = _ + N; y < w; y++) {
|
|
1252
|
+
const L = S.resolveTriangleIndex(y);
|
|
1253
|
+
tt(u, 3 * L, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1254
1254
|
for (let U = m, x = m + g; U < x; U++) {
|
|
1255
|
-
const B =
|
|
1256
|
-
tt(h, 3 * B,
|
|
1255
|
+
const B = c.resolveTriangleIndex(U);
|
|
1256
|
+
tt(h, 3 * B, l, a), h.needsUpdate = !0;
|
|
1257
1257
|
const H = h.distanceToTriangle(u, p, A);
|
|
1258
|
-
if (H < T && (R.copy(p), C && C.copy(A), T = H, F = U, f =
|
|
1258
|
+
if (H < T && (R.copy(p), C && C.copy(A), T = H, F = U, f = y), H < o)
|
|
1259
1259
|
return !0;
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
@@ -1265,11 +1265,11 @@ function Zo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1265
1265
|
const S = pe(s);
|
|
1266
1266
|
for (let _ = 0, N = S; _ < N; _++) {
|
|
1267
1267
|
tt(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1268
|
-
for (let
|
|
1269
|
-
const
|
|
1270
|
-
tt(h, 3 *
|
|
1268
|
+
for (let y = m, w = m + g; y < w; y++) {
|
|
1269
|
+
const L = c.resolveTriangleIndex(y);
|
|
1270
|
+
tt(h, 3 * L, l, a), h.needsUpdate = !0;
|
|
1271
1271
|
const U = h.distanceToTriangle(u, p, A);
|
|
1272
|
-
if (U < T && (R.copy(p), C && C.copy(A), T = U, F =
|
|
1272
|
+
if (U < T && (R.copy(p), C && C.copy(A), T = U, F = y, f = _), U < o)
|
|
1273
1273
|
return !0;
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
@@ -1281,24 +1281,24 @@ function Zo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1281
1281
|
function Qo() {
|
|
1282
1282
|
return typeof SharedArrayBuffer < "u";
|
|
1283
1283
|
}
|
|
1284
|
-
const xe = new Z.constructor(), As = new Z.constructor(), Bt = new Ti(() => new Ot()), ae = new Ot(), ce = new Ot(),
|
|
1284
|
+
const xe = new Z.constructor(), As = new Z.constructor(), Bt = new Ti(() => new Ot()), ae = new Ot(), ce = new Ot(), Gs = new Ot(), zs = new Ot();
|
|
1285
1285
|
let Hs = !1;
|
|
1286
|
-
function jo(
|
|
1286
|
+
function jo(c, s, t, e) {
|
|
1287
1287
|
if (Hs)
|
|
1288
1288
|
throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
1289
1289
|
Hs = !0;
|
|
1290
|
-
const i =
|
|
1290
|
+
const i = c._roots, o = s._roots;
|
|
1291
1291
|
let n, r = 0, a = 0;
|
|
1292
|
-
const
|
|
1292
|
+
const l = new Mt().copy(t).invert();
|
|
1293
1293
|
for (let E = 0, d = i.length; E < d; E++) {
|
|
1294
1294
|
xe.setBuffer(i[E]), a = 0;
|
|
1295
1295
|
const h = Bt.getPrimitive();
|
|
1296
|
-
$(0, xe.float32Array, h), h.applyMatrix4(
|
|
1296
|
+
$(0, xe.float32Array, h), h.applyMatrix4(l);
|
|
1297
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
|
+
l,
|
|
1302
1302
|
e,
|
|
1303
1303
|
r,
|
|
1304
1304
|
a,
|
|
@@ -1312,37 +1312,37 @@ function jo(l, s, t, e) {
|
|
|
1312
1312
|
}
|
|
1313
1313
|
return Hs = !1, n;
|
|
1314
1314
|
}
|
|
1315
|
-
function Tt(
|
|
1315
|
+
function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
|
|
1316
1316
|
let d, h;
|
|
1317
1317
|
E ? (d = As, h = xe) : (d = xe, h = As);
|
|
1318
|
-
const u = d.float32Array, p = d.uint32Array, R = d.uint16Array, A = h.float32Array, C = h.uint32Array, T = h.uint16Array, F =
|
|
1318
|
+
const u = d.float32Array, p = d.uint32Array, R = d.uint16Array, A = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = c * 2, f = s * 2, m = ht(F, R), g = ht(f, T);
|
|
1319
1319
|
let S = !1;
|
|
1320
1320
|
if (g && m)
|
|
1321
1321
|
E ? S = i(
|
|
1322
1322
|
Et(s, C),
|
|
1323
1323
|
ft(s * 2, T),
|
|
1324
|
-
Et(
|
|
1325
|
-
ft(
|
|
1324
|
+
Et(c, p),
|
|
1325
|
+
ft(c * 2, R),
|
|
1326
1326
|
a,
|
|
1327
1327
|
n + s,
|
|
1328
1328
|
r,
|
|
1329
|
-
o +
|
|
1329
|
+
o + c
|
|
1330
1330
|
) : S = i(
|
|
1331
|
-
Et(
|
|
1332
|
-
ft(
|
|
1331
|
+
Et(c, p),
|
|
1332
|
+
ft(c * 2, R),
|
|
1333
1333
|
Et(s, C),
|
|
1334
1334
|
ft(s * 2, T),
|
|
1335
1335
|
r,
|
|
1336
|
-
o +
|
|
1336
|
+
o + c,
|
|
1337
1337
|
a,
|
|
1338
1338
|
n + s
|
|
1339
1339
|
);
|
|
1340
1340
|
else if (g) {
|
|
1341
1341
|
const _ = Bt.getPrimitive();
|
|
1342
1342
|
$(s, A, _), _.applyMatrix4(t);
|
|
1343
|
-
const N = pt(
|
|
1344
|
-
$(N, u, ae), $(
|
|
1345
|
-
const w = _.intersectsBox(ae),
|
|
1343
|
+
const N = pt(c), y = Ct(c, p);
|
|
1344
|
+
$(N, u, ae), $(y, u, ce);
|
|
1345
|
+
const w = _.intersectsBox(ae), L = _.intersectsBox(ce);
|
|
1346
1346
|
S = w && Tt(
|
|
1347
1347
|
s,
|
|
1348
1348
|
N,
|
|
@@ -1355,9 +1355,9 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1355
1355
|
r + 1,
|
|
1356
1356
|
_,
|
|
1357
1357
|
!E
|
|
1358
|
-
) ||
|
|
1358
|
+
) || L && Tt(
|
|
1359
1359
|
s,
|
|
1360
|
-
|
|
1360
|
+
y,
|
|
1361
1361
|
e,
|
|
1362
1362
|
t,
|
|
1363
1363
|
i,
|
|
@@ -1370,11 +1370,11 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1370
1370
|
), Bt.releasePrimitive(_);
|
|
1371
1371
|
} else {
|
|
1372
1372
|
const _ = pt(s), N = Ct(s, C);
|
|
1373
|
-
$(_, A,
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1373
|
+
$(_, A, Gs), $(N, A, zs);
|
|
1374
|
+
const y = l.intersectsBox(Gs), w = l.intersectsBox(zs);
|
|
1375
|
+
if (y && w)
|
|
1376
1376
|
S = Tt(
|
|
1377
|
-
|
|
1377
|
+
c,
|
|
1378
1378
|
_,
|
|
1379
1379
|
t,
|
|
1380
1380
|
e,
|
|
@@ -1383,10 +1383,10 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1383
1383
|
n,
|
|
1384
1384
|
r,
|
|
1385
1385
|
a + 1,
|
|
1386
|
-
|
|
1386
|
+
l,
|
|
1387
1387
|
E
|
|
1388
1388
|
) || Tt(
|
|
1389
|
-
|
|
1389
|
+
c,
|
|
1390
1390
|
N,
|
|
1391
1391
|
t,
|
|
1392
1392
|
e,
|
|
@@ -1395,13 +1395,13 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1395
1395
|
n,
|
|
1396
1396
|
r,
|
|
1397
1397
|
a + 1,
|
|
1398
|
-
|
|
1398
|
+
l,
|
|
1399
1399
|
E
|
|
1400
1400
|
);
|
|
1401
|
-
else if (
|
|
1401
|
+
else if (y)
|
|
1402
1402
|
if (m)
|
|
1403
1403
|
S = Tt(
|
|
1404
|
-
|
|
1404
|
+
c,
|
|
1405
1405
|
_,
|
|
1406
1406
|
t,
|
|
1407
1407
|
e,
|
|
@@ -1410,15 +1410,15 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1410
1410
|
n,
|
|
1411
1411
|
r,
|
|
1412
1412
|
a + 1,
|
|
1413
|
-
|
|
1413
|
+
l,
|
|
1414
1414
|
E
|
|
1415
1415
|
);
|
|
1416
1416
|
else {
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
const U = pt(
|
|
1417
|
+
const L = Bt.getPrimitive();
|
|
1418
|
+
L.copy(Gs).applyMatrix4(t);
|
|
1419
|
+
const U = pt(c), x = Ct(c, p);
|
|
1420
1420
|
$(U, u, ae), $(x, u, ce);
|
|
1421
|
-
const B =
|
|
1421
|
+
const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
|
|
1422
1422
|
S = B && Tt(
|
|
1423
1423
|
_,
|
|
1424
1424
|
U,
|
|
@@ -1429,7 +1429,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1429
1429
|
o,
|
|
1430
1430
|
a,
|
|
1431
1431
|
r + 1,
|
|
1432
|
-
|
|
1432
|
+
L,
|
|
1433
1433
|
!E
|
|
1434
1434
|
) || H && Tt(
|
|
1435
1435
|
_,
|
|
@@ -1441,14 +1441,14 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1441
1441
|
o,
|
|
1442
1442
|
a,
|
|
1443
1443
|
r + 1,
|
|
1444
|
-
|
|
1444
|
+
L,
|
|
1445
1445
|
!E
|
|
1446
|
-
), Bt.releasePrimitive(
|
|
1446
|
+
), Bt.releasePrimitive(L);
|
|
1447
1447
|
}
|
|
1448
1448
|
else if (w)
|
|
1449
1449
|
if (m)
|
|
1450
1450
|
S = Tt(
|
|
1451
|
-
|
|
1451
|
+
c,
|
|
1452
1452
|
N,
|
|
1453
1453
|
t,
|
|
1454
1454
|
e,
|
|
@@ -1457,15 +1457,15 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1457
1457
|
n,
|
|
1458
1458
|
r,
|
|
1459
1459
|
a + 1,
|
|
1460
|
-
|
|
1460
|
+
l,
|
|
1461
1461
|
E
|
|
1462
1462
|
);
|
|
1463
1463
|
else {
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
const U = pt(
|
|
1464
|
+
const L = Bt.getPrimitive();
|
|
1465
|
+
L.copy(zs).applyMatrix4(t);
|
|
1466
|
+
const U = pt(c), x = Ct(c, p);
|
|
1467
1467
|
$(U, u, ae), $(x, u, ce);
|
|
1468
|
-
const B =
|
|
1468
|
+
const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
|
|
1469
1469
|
S = B && Tt(
|
|
1470
1470
|
N,
|
|
1471
1471
|
U,
|
|
@@ -1476,7 +1476,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1476
1476
|
o,
|
|
1477
1477
|
a,
|
|
1478
1478
|
r + 1,
|
|
1479
|
-
|
|
1479
|
+
L,
|
|
1480
1480
|
!E
|
|
1481
1481
|
) || H && Tt(
|
|
1482
1482
|
N,
|
|
@@ -1488,9 +1488,9 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1488
1488
|
o,
|
|
1489
1489
|
a,
|
|
1490
1490
|
r + 1,
|
|
1491
|
-
|
|
1491
|
+
L,
|
|
1492
1492
|
!E
|
|
1493
|
-
), Bt.releasePrimitive(
|
|
1493
|
+
), Bt.releasePrimitive(L);
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
1496
1496
|
return S;
|
|
@@ -1524,8 +1524,8 @@ class mi {
|
|
|
1524
1524
|
if (r._roots = o, r._indirectBuffer = n || null, e.setIndex) {
|
|
1525
1525
|
const a = t.getIndex();
|
|
1526
1526
|
if (a === null) {
|
|
1527
|
-
const
|
|
1528
|
-
t.setIndex(
|
|
1527
|
+
const l = new An(s.index, 1, !1);
|
|
1528
|
+
t.setIndex(l);
|
|
1529
1529
|
} else
|
|
1530
1530
|
a.array !== i && (a.array.set(i), a.needsUpdate = !0);
|
|
1531
1531
|
}
|
|
@@ -1565,9 +1565,9 @@ class mi {
|
|
|
1565
1565
|
const e = this._roots[t], i = new Uint32Array(e), o = new Uint16Array(e);
|
|
1566
1566
|
n(0);
|
|
1567
1567
|
function n(r, a = 0) {
|
|
1568
|
-
const
|
|
1568
|
+
const l = r * 2, E = o[l + 15] === ys;
|
|
1569
1569
|
if (E) {
|
|
1570
|
-
const d = i[r + 6], h = o[
|
|
1570
|
+
const d = i[r + 6], h = o[l + 14];
|
|
1571
1571
|
s(a, E, new Float32Array(e, r * 4, 6), d, h);
|
|
1572
1572
|
} else {
|
|
1573
1573
|
const d = r + Ts / 4, h = i[r + 6], u = i[r + 7];
|
|
@@ -1577,9 +1577,9 @@ class mi {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
/* Core Cast Functions */
|
|
1579
1579
|
raycast(s, t = _i) {
|
|
1580
|
-
const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups,
|
|
1580
|
+
const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, l = n ? t.side : t, E = this.indirect ? Yo : yo;
|
|
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 : l, p = o.length;
|
|
1583
1583
|
if (E(this, d, u, s, o), r) {
|
|
1584
1584
|
const R = a[d].materialIndex;
|
|
1585
1585
|
for (let A = p, C = o.length; A < C; A++)
|
|
@@ -1591,9 +1591,9 @@ class mi {
|
|
|
1591
1591
|
raycastFirst(s, t = _i) {
|
|
1592
1592
|
const e = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
|
|
1593
1593
|
let r = null;
|
|
1594
|
-
const a = i.groups,
|
|
1594
|
+
const a = i.groups, l = o ? t.side : t, E = this.indirect ? Go : Mo;
|
|
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 : l, p = E(this, d, u, s);
|
|
1597
1597
|
p != null && (r == null || p.distance < r.distance) && (r = p, n && (p.face.materialIndex = a[d].materialIndex));
|
|
1598
1598
|
}
|
|
1599
1599
|
return r;
|
|
@@ -1606,7 +1606,7 @@ class mi {
|
|
|
1606
1606
|
return e;
|
|
1607
1607
|
}
|
|
1608
1608
|
shapecast(s) {
|
|
1609
|
-
const t = It.getPrimitive(), e = this.indirect ?
|
|
1609
|
+
const t = It.getPrimitive(), e = this.indirect ? Po : Oo;
|
|
1610
1610
|
let {
|
|
1611
1611
|
boundsTraverseOrder: i,
|
|
1612
1612
|
intersectsBounds: o,
|
|
@@ -1618,13 +1618,13 @@ class mi {
|
|
|
1618
1618
|
n = (h, u, p, R, A) => d(h, u, p, R, A) ? !0 : e(h, u, this, r, p, R, 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, l = 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 = To(this, d, o, n, i,
|
|
1625
|
+
if (a = To(this, d, o, n, i, l), a)
|
|
1626
1626
|
break;
|
|
1627
|
-
|
|
1627
|
+
l += u.byteLength;
|
|
1628
1628
|
}
|
|
1629
1629
|
return It.releasePrimitive(t), a;
|
|
1630
1630
|
}
|
|
@@ -1633,7 +1633,7 @@ class mi {
|
|
|
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, l = this.indirect ? (p) => {
|
|
1637
1637
|
const R = this.resolveTriangleIndex(p);
|
|
1638
1638
|
tt(n, R * 3, r, a);
|
|
1639
1639
|
} : (p) => {
|
|
@@ -1648,8 +1648,8 @@ class mi {
|
|
|
1648
1648
|
const p = (R, A, C, T, F, f, m, g) => {
|
|
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
|
-
for (let N = R,
|
|
1652
|
-
if (
|
|
1651
|
+
for (let N = R, y = R + A; N < y; N++)
|
|
1652
|
+
if (l(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, g))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
1655
1655
|
return !1;
|
|
@@ -1707,31 +1707,31 @@ class mi {
|
|
|
1707
1707
|
}), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
function Wi(
|
|
1711
|
-
return
|
|
1710
|
+
function Wi(c, s, t) {
|
|
1711
|
+
return c === null || (c.point.applyMatrix4(s.matrixWorld), c.distance = c.point.distanceTo(t.ray.origin), c.object = s, c.distance < t.near || c.distance > t.far) ? null : c;
|
|
1712
1712
|
}
|
|
1713
|
-
const ks = /* @__PURE__ */ new
|
|
1714
|
-
function $o(
|
|
1713
|
+
const ks = /* @__PURE__ */ new Gn(), Xi = /* @__PURE__ */ new Mt(), qo = v.prototype.raycast;
|
|
1714
|
+
function $o(c, s) {
|
|
1715
1715
|
if (this.geometry.boundsTree) {
|
|
1716
1716
|
if (this.material === void 0)
|
|
1717
1717
|
return;
|
|
1718
|
-
Xi.copy(this.matrixWorld).invert(), ks.copy(
|
|
1718
|
+
Xi.copy(this.matrixWorld).invert(), ks.copy(c.ray).applyMatrix4(Xi);
|
|
1719
1719
|
const t = this.geometry.boundsTree;
|
|
1720
|
-
if (
|
|
1721
|
-
const e = Wi(t.raycastFirst(ks, this.material), this,
|
|
1720
|
+
if (c.firstHitOnly === !0) {
|
|
1721
|
+
const e = Wi(t.raycastFirst(ks, this.material), this, c);
|
|
1722
1722
|
e && s.push(e);
|
|
1723
1723
|
} else {
|
|
1724
1724
|
const e = t.raycast(ks, this.material);
|
|
1725
1725
|
for (let i = 0, o = e.length; i < o; i++) {
|
|
1726
|
-
const n = Wi(e[i], this,
|
|
1726
|
+
const n = Wi(e[i], this, c);
|
|
1727
1727
|
n && s.push(n);
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
} else
|
|
1731
|
-
qo.call(this,
|
|
1731
|
+
qo.call(this, c, s);
|
|
1732
1732
|
}
|
|
1733
|
-
function Ko(
|
|
1734
|
-
return this.boundsTree = new mi(this,
|
|
1733
|
+
function Ko(c) {
|
|
1734
|
+
return this.boundsTree = new mi(this, c), this.boundsTree;
|
|
1735
1735
|
}
|
|
1736
1736
|
function Jo() {
|
|
1737
1737
|
this.boundsTree = null;
|
|
@@ -1919,7 +1919,7 @@ class sr extends Ai {
|
|
|
1919
1919
|
this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
const ms = 0, ir = 1, nr = new M(), Zi = new
|
|
1922
|
+
const ms = 0, ir = 1, nr = new M(), Zi = new Lt(), Ws = new pi(), Qi = new M(), hs = new ue();
|
|
1923
1923
|
class or {
|
|
1924
1924
|
constructor() {
|
|
1925
1925
|
this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new ji(), this.unassigned = new ji(), this.vertices = [];
|
|
@@ -1958,10 +1958,10 @@ class or {
|
|
|
1958
1958
|
const e = this.faces;
|
|
1959
1959
|
let i = -1 / 0, o = 1 / 0;
|
|
1960
1960
|
for (let n = 0, r = e.length; n < r; n++) {
|
|
1961
|
-
const a = e[n],
|
|
1962
|
-
if (
|
|
1961
|
+
const a = e[n], l = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
|
|
1962
|
+
if (l > 0 && E >= 0)
|
|
1963
1963
|
return null;
|
|
1964
|
-
const d = E !== 0 ? -
|
|
1964
|
+
const d = E !== 0 ? -l / E : 0;
|
|
1965
1965
|
if (!(d <= 0) && (E > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
|
|
1966
1966
|
return null;
|
|
1967
1967
|
}
|
|
@@ -2034,10 +2034,10 @@ class or {
|
|
|
2034
2034
|
s.copy(this.vertices[0].point), t.copy(this.vertices[0].point);
|
|
2035
2035
|
for (let o = 0, n = this.vertices.length; o < n; o++) {
|
|
2036
2036
|
const r = this.vertices[o], a = r.point;
|
|
2037
|
-
for (let
|
|
2038
|
-
a.getComponent(
|
|
2039
|
-
for (let
|
|
2040
|
-
a.getComponent(
|
|
2037
|
+
for (let l = 0; l < 3; l++)
|
|
2038
|
+
a.getComponent(l) < s.getComponent(l) && (s.setComponent(l, a.getComponent(l)), e[l] = r);
|
|
2039
|
+
for (let l = 0; l < 3; l++)
|
|
2040
|
+
a.getComponent(l) > t.getComponent(l) && (t.setComponent(l, a.getComponent(l)), i[l] = r);
|
|
2041
2041
|
}
|
|
2042
2042
|
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 };
|
|
2043
2043
|
}
|
|
@@ -2051,20 +2051,20 @@ class or {
|
|
|
2051
2051
|
u > o && (o = u, n = h);
|
|
2052
2052
|
}
|
|
2053
2053
|
const r = e[n], a = i[n];
|
|
2054
|
-
let
|
|
2054
|
+
let l, E;
|
|
2055
2055
|
o = 0, Zi.set(r.point, a.point);
|
|
2056
2056
|
for (let h = 0, u = this.vertices.length; h < u; h++) {
|
|
2057
2057
|
const p = s[h];
|
|
2058
2058
|
if (p !== r && p !== a) {
|
|
2059
2059
|
Zi.closestPointToPoint(p.point, !0, Qi);
|
|
2060
2060
|
const R = Qi.distanceToSquared(p.point);
|
|
2061
|
-
R > o && (o = R,
|
|
2061
|
+
R > o && (o = R, l = p);
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
o = -1, Ws.setFromCoplanarPoints(r.point, a.point,
|
|
2064
|
+
o = -1, Ws.setFromCoplanarPoints(r.point, a.point, l.point);
|
|
2065
2065
|
for (let h = 0, u = this.vertices.length; h < u; h++) {
|
|
2066
2066
|
const p = s[h];
|
|
2067
|
-
if (p !== r && p !== a && p !==
|
|
2067
|
+
if (p !== r && p !== a && p !== l) {
|
|
2068
2068
|
const R = Math.abs(Ws.distanceToPoint(p.point));
|
|
2069
2069
|
R > o && (o = R, E = p);
|
|
2070
2070
|
}
|
|
@@ -2072,10 +2072,10 @@ class or {
|
|
|
2072
2072
|
const d = [];
|
|
2073
2073
|
if (Ws.distanceToPoint(E.point) < 0) {
|
|
2074
2074
|
d.push(
|
|
2075
|
-
Rt.create(r, a,
|
|
2075
|
+
Rt.create(r, a, l),
|
|
2076
2076
|
Rt.create(E, a, r),
|
|
2077
|
-
Rt.create(E,
|
|
2078
|
-
Rt.create(E, r,
|
|
2077
|
+
Rt.create(E, l, a),
|
|
2078
|
+
Rt.create(E, r, l)
|
|
2079
2079
|
);
|
|
2080
2080
|
for (let h = 0; h < 3; h++) {
|
|
2081
2081
|
const u = (h + 1) % 3;
|
|
@@ -2083,10 +2083,10 @@ class or {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
} else {
|
|
2085
2085
|
d.push(
|
|
2086
|
-
Rt.create(r,
|
|
2086
|
+
Rt.create(r, l, a),
|
|
2087
2087
|
Rt.create(E, r, a),
|
|
2088
|
-
Rt.create(E, a,
|
|
2089
|
-
Rt.create(E,
|
|
2088
|
+
Rt.create(E, a, l),
|
|
2089
|
+
Rt.create(E, l, r)
|
|
2090
2090
|
);
|
|
2091
2091
|
for (let h = 0; h < 3; h++) {
|
|
2092
2092
|
const u = (h + 1) % 3;
|
|
@@ -2097,7 +2097,7 @@ class or {
|
|
|
2097
2097
|
this.faces.push(d[h]);
|
|
2098
2098
|
for (let h = 0, u = s.length; h < u; h++) {
|
|
2099
2099
|
const p = s[h];
|
|
2100
|
-
if (p !== r && p !== a && p !==
|
|
2100
|
+
if (p !== r && p !== a && p !== l && p !== E) {
|
|
2101
2101
|
o = this.tolerance;
|
|
2102
2102
|
let R = null;
|
|
2103
2103
|
for (let A = 0; A < 4; A++) {
|
|
@@ -2270,54 +2270,54 @@ class ji {
|
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
2272
|
const li = [2, 2, 1], hi = [1, 0, 0];
|
|
2273
|
-
function
|
|
2274
|
-
return
|
|
2273
|
+
function Pt(c, s) {
|
|
2274
|
+
return c * 3 + s;
|
|
2275
2275
|
}
|
|
2276
|
-
function ar(
|
|
2277
|
-
const s =
|
|
2276
|
+
function ar(c) {
|
|
2277
|
+
const s = c.elements;
|
|
2278
2278
|
let t = 0;
|
|
2279
2279
|
for (let e = 0; e < 9; e++)
|
|
2280
2280
|
t += s[e] * s[e];
|
|
2281
2281
|
return Math.sqrt(t);
|
|
2282
2282
|
}
|
|
2283
|
-
function cr(
|
|
2284
|
-
const s =
|
|
2283
|
+
function cr(c) {
|
|
2284
|
+
const s = c.elements;
|
|
2285
2285
|
let t = 0;
|
|
2286
2286
|
for (let e = 0; e < 3; e++) {
|
|
2287
|
-
const i = s[
|
|
2287
|
+
const i = s[Pt(li[e], hi[e])];
|
|
2288
2288
|
t += 2 * i * i;
|
|
2289
2289
|
}
|
|
2290
2290
|
return Math.sqrt(t);
|
|
2291
2291
|
}
|
|
2292
|
-
function lr(
|
|
2292
|
+
function lr(c, s) {
|
|
2293
2293
|
let t = 0, e = 1;
|
|
2294
|
-
const i =
|
|
2295
|
-
for (let
|
|
2296
|
-
const E = Math.abs(i[
|
|
2297
|
-
E > t && (t = E, e =
|
|
2294
|
+
const i = c.elements;
|
|
2295
|
+
for (let l = 0; l < 3; l++) {
|
|
2296
|
+
const E = Math.abs(i[Pt(li[l], hi[l])]);
|
|
2297
|
+
E > t && (t = E, e = l);
|
|
2298
2298
|
}
|
|
2299
2299
|
let o = 1, n = 0;
|
|
2300
2300
|
const r = hi[e], a = li[e];
|
|
2301
|
-
if (Math.abs(i[
|
|
2302
|
-
const
|
|
2301
|
+
if (Math.abs(i[Pt(a, r)]) > Number.EPSILON) {
|
|
2302
|
+
const l = i[Pt(a, a)], E = i[Pt(r, r)], d = i[Pt(a, r)], h = (l - E) / 2 / d;
|
|
2303
2303
|
let u;
|
|
2304
2304
|
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;
|
|
2305
2305
|
}
|
|
2306
|
-
return s.identity(), s.elements[
|
|
2306
|
+
return s.identity(), s.elements[Pt(r, r)] = o, s.elements[Pt(a, a)] = o, s.elements[Pt(a, r)] = n, s.elements[Pt(r, a)] = -n, s;
|
|
2307
2307
|
}
|
|
2308
|
-
function hr(
|
|
2308
|
+
function hr(c, s) {
|
|
2309
2309
|
let t = 0, e = 0;
|
|
2310
2310
|
const i = 10;
|
|
2311
|
-
s.unitary.identity(), s.diagonal.copy(
|
|
2312
|
-
const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(),
|
|
2313
|
-
for (; e < i && cr(n) >
|
|
2311
|
+
s.unitary.identity(), s.diagonal.copy(c);
|
|
2312
|
+
const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), l = Number.EPSILON * ar(n);
|
|
2313
|
+
for (; e < i && cr(n) > l; )
|
|
2314
2314
|
lr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
|
|
2315
2315
|
return s;
|
|
2316
2316
|
}
|
|
2317
|
-
function Er(
|
|
2317
|
+
function Er(c) {
|
|
2318
2318
|
const s = [];
|
|
2319
|
-
for (let st = 0; st <
|
|
2320
|
-
const Xt =
|
|
2319
|
+
for (let st = 0; st < c.length - 2; st += 3) {
|
|
2320
|
+
const Xt = c[st], J = c[st + 1], Kt = c[st + 2];
|
|
2321
2321
|
s.push(new O.Vector3(Xt, J, Kt));
|
|
2322
2322
|
}
|
|
2323
2323
|
const t = new or();
|
|
@@ -2339,26 +2339,26 @@ function Er(l) {
|
|
|
2339
2339
|
n.push(Ms.point.x, Ms.point.y, Ms.point.z), n.push(ws.point.x, ws.point.y, ws.point.z), n.push(Ds.point.x, Ds.point.y, Ds.point.z);
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
const r = new O.Vector3(), a = new O.Vector3(),
|
|
2342
|
+
const r = new O.Vector3(), a = new O.Vector3(), l = new O.Vector3(), E = new O.Vector3(), d = new O.Vector3(), h = new O.Vector3(), u = new O.Vector3(), p = new O.Vector3();
|
|
2343
2343
|
let R = 0, A = 0, C = 0, T = 0, F = 0, f = 0, m = 0;
|
|
2344
2344
|
for (let st = 0, Xt = n.length; st < Xt; st += 9) {
|
|
2345
|
-
r.fromArray(n, st), a.fromArray(n, st + 3),
|
|
2345
|
+
r.fromArray(n, st), a.fromArray(n, st + 3), l.fromArray(n, st + 6), u.set(0, 0, 0), u.add(r).add(a).add(l).divideScalar(3), E.subVectors(a, r), d.subVectors(l, r);
|
|
2346
2346
|
const J = h.crossVectors(E, d).length() / 2;
|
|
2347
|
-
p.add(h.copy(u).multiplyScalar(J)), R += J, A += (9 * u.x * u.x + r.x * r.x + a.x * a.x +
|
|
2347
|
+
p.add(h.copy(u).multiplyScalar(J)), R += J, A += (9 * u.x * u.x + r.x * r.x + a.x * a.x + l.x * l.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + l.x * l.y) * (J / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + l.x * l.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + l.y * l.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + l.y * l.z) * (J / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + l.z * l.z) * (J / 12);
|
|
2348
2348
|
}
|
|
2349
2349
|
p.divideScalar(R), A /= R, C /= R, T /= R, F /= R, f /= R, m /= R, A -= 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;
|
|
2350
2350
|
const g = new O.Matrix3();
|
|
2351
2351
|
g.elements[0] = A, g.elements[1] = C, g.elements[2] = T, g.elements[3] = C, g.elements[4] = F, g.elements[5] = f, g.elements[6] = T, g.elements[7] = f, g.elements[8] = m, hr(g, e);
|
|
2352
|
-
const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(),
|
|
2353
|
-
S.extractBasis(_, N,
|
|
2354
|
-
let w = -1 / 0,
|
|
2352
|
+
const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(), y = new O.Vector3();
|
|
2353
|
+
S.extractBasis(_, N, y);
|
|
2354
|
+
let w = -1 / 0, L = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
|
|
2355
2355
|
for (let st = 0, Xt = s.length; st < Xt; st++) {
|
|
2356
2356
|
const J = s[st];
|
|
2357
|
-
w = Math.max(_.dot(J), w),
|
|
2357
|
+
w = Math.max(_.dot(J), w), L = Math.max(N.dot(J), L), U = Math.max(y.dot(J), U), x = Math.min(_.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(y.dot(J), H);
|
|
2358
2358
|
}
|
|
2359
|
-
_.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B +
|
|
2359
|
+
_.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + L)), y.multiplyScalar(0.5 * (H + U));
|
|
2360
2360
|
const q = new O.Vector3(), et = new O.Vector3(), Q = new O.Matrix3();
|
|
2361
|
-
q.add(_).add(N).add(
|
|
2361
|
+
q.add(_).add(N).add(y), et.x = w - x, et.y = L - B, et.z = U - H, et.multiplyScalar(0.5), Q.copy(S);
|
|
2362
2362
|
const { x: Ht, y: kt, z: Wt } = et, Xe = new O.Matrix4();
|
|
2363
2363
|
Xe.makeScale(Ht * 2, kt * 2, Wt * 2);
|
|
2364
2364
|
const Ce = new O.Matrix4();
|
|
@@ -2370,11 +2370,11 @@ function Er(l) {
|
|
|
2370
2370
|
const Te = new O.Matrix4();
|
|
2371
2371
|
return Te.multiply(Oi), Te.multiply(Si), Te.multiply(Ce), Te.multiply(Xe), { center: q, halfSizes: et, rotation: Q, transformation: Te };
|
|
2372
2372
|
}
|
|
2373
|
-
function dr(
|
|
2373
|
+
function dr(c, s, t) {
|
|
2374
2374
|
const e = [
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2375
|
+
c[0] - s[0],
|
|
2376
|
+
c[1] - s[1],
|
|
2377
|
+
c[2] - s[2]
|
|
2378
2378
|
];
|
|
2379
2379
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
|
|
2380
2380
|
}
|
|
@@ -3104,11 +3104,11 @@ class qr extends er {
|
|
|
3104
3104
|
* (c) 2017 @yomotsu
|
|
3105
3105
|
* Released under the MIT License.
|
|
3106
3106
|
*/
|
|
3107
|
-
const
|
|
3107
|
+
const V = {
|
|
3108
3108
|
LEFT: 1,
|
|
3109
3109
|
RIGHT: 2,
|
|
3110
3110
|
MIDDLE: 4
|
|
3111
|
-
},
|
|
3111
|
+
}, P = Object.freeze({
|
|
3112
3112
|
NONE: 0,
|
|
3113
3113
|
ROTATE: 1,
|
|
3114
3114
|
TRUCK: 2,
|
|
@@ -3131,64 +3131,64 @@ const G = {
|
|
|
3131
3131
|
IN: 1,
|
|
3132
3132
|
OUT: -1
|
|
3133
3133
|
};
|
|
3134
|
-
function Zt(
|
|
3135
|
-
return
|
|
3134
|
+
function Zt(c) {
|
|
3135
|
+
return c.isPerspectiveCamera;
|
|
3136
3136
|
}
|
|
3137
|
-
function vt(
|
|
3138
|
-
return
|
|
3137
|
+
function vt(c) {
|
|
3138
|
+
return c.isOrthographicCamera;
|
|
3139
3139
|
}
|
|
3140
|
-
const he = Math.PI * 2, $i = Math.PI / 2,
|
|
3141
|
-
function mt(
|
|
3142
|
-
return Math.max(s, Math.min(t,
|
|
3140
|
+
const he = Math.PI * 2, $i = Math.PI / 2, Pn = 1e-5, _e = Math.PI / 180;
|
|
3141
|
+
function mt(c, s, t) {
|
|
3142
|
+
return Math.max(s, Math.min(t, c));
|
|
3143
3143
|
}
|
|
3144
|
-
function X(
|
|
3145
|
-
return Math.abs(
|
|
3144
|
+
function X(c, s = Pn) {
|
|
3145
|
+
return Math.abs(c) < s;
|
|
3146
3146
|
}
|
|
3147
|
-
function k(
|
|
3148
|
-
return X(
|
|
3147
|
+
function k(c, s, t = Pn) {
|
|
3148
|
+
return X(c - s, t);
|
|
3149
3149
|
}
|
|
3150
|
-
function Ki(
|
|
3151
|
-
return Math.round(
|
|
3150
|
+
function Ki(c, s) {
|
|
3151
|
+
return Math.round(c / s) * s;
|
|
3152
3152
|
}
|
|
3153
|
-
function Ne(
|
|
3154
|
-
return isFinite(
|
|
3153
|
+
function Ne(c) {
|
|
3154
|
+
return isFinite(c) ? c : c < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
3155
3155
|
}
|
|
3156
|
-
function
|
|
3157
|
-
return Math.abs(
|
|
3156
|
+
function Pe(c) {
|
|
3157
|
+
return Math.abs(c) < Number.MAX_VALUE ? c : c * (1 / 0);
|
|
3158
3158
|
}
|
|
3159
|
-
function Es(
|
|
3159
|
+
function Es(c, s, t, e, i = 1 / 0, o) {
|
|
3160
3160
|
e = Math.max(1e-4, e);
|
|
3161
3161
|
const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
|
|
3162
|
-
let
|
|
3162
|
+
let l = c - s;
|
|
3163
3163
|
const E = s, d = i * e;
|
|
3164
|
-
|
|
3165
|
-
const h = (t.value + n *
|
|
3164
|
+
l = mt(l, -d, d), s = c - l;
|
|
3165
|
+
const h = (t.value + n * l) * o;
|
|
3166
3166
|
t.value = (t.value - n * h) * a;
|
|
3167
|
-
let u = s + (
|
|
3168
|
-
return E -
|
|
3167
|
+
let u = s + (l + h) * a;
|
|
3168
|
+
return E - c > 0 == u > E && (u = E, t.value = (u - E) / o), u;
|
|
3169
3169
|
}
|
|
3170
|
-
function Ji(
|
|
3170
|
+
function Ji(c, s, t, e, i = 1 / 0, o, n) {
|
|
3171
3171
|
e = Math.max(1e-4, e);
|
|
3172
|
-
const r = 2 / e, a = r * o,
|
|
3173
|
-
let E = s.x, d = s.y, h = s.z, u =
|
|
3172
|
+
const r = 2 / e, a = r * o, l = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
3173
|
+
let E = s.x, d = s.y, h = s.z, u = c.x - E, p = c.y - d, R = c.z - h;
|
|
3174
3174
|
const A = E, C = d, T = h, F = i * e, f = F * F, m = u * u + p * p + R * R;
|
|
3175
3175
|
if (m > f) {
|
|
3176
3176
|
const B = Math.sqrt(m);
|
|
3177
3177
|
u = u / B * F, p = p / B * F, R = R / B * F;
|
|
3178
3178
|
}
|
|
3179
|
-
E =
|
|
3179
|
+
E = c.x - u, d = c.y - p, h = c.z - R;
|
|
3180
3180
|
const g = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * R) * o;
|
|
3181
|
-
t.x = (t.x - r * g) *
|
|
3182
|
-
const N = A -
|
|
3183
|
-
return N *
|
|
3181
|
+
t.x = (t.x - r * g) * l, t.y = (t.y - r * S) * l, t.z = (t.z - r * _) * l, n.x = E + (u + g) * l, n.y = d + (p + S) * l, n.z = h + (R + _) * l;
|
|
3182
|
+
const N = A - c.x, y = C - c.y, w = T - c.z, L = n.x - A, U = n.y - C, x = n.z - T;
|
|
3183
|
+
return N * L + y * U + w * x > 0 && (n.x = A, n.y = C, n.z = T, t.x = (n.x - A) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
|
|
3184
3184
|
}
|
|
3185
|
-
function Zs(
|
|
3186
|
-
s.set(0, 0),
|
|
3185
|
+
function Zs(c, s) {
|
|
3186
|
+
s.set(0, 0), c.forEach((t) => {
|
|
3187
3187
|
s.x += t.clientX, s.y += t.clientY;
|
|
3188
|
-
}), s.x /=
|
|
3188
|
+
}), s.x /= c.length, s.y /= c.length;
|
|
3189
3189
|
}
|
|
3190
|
-
function Qs(
|
|
3191
|
-
return vt(
|
|
3190
|
+
function Qs(c, s) {
|
|
3191
|
+
return vt(c) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
|
|
3192
3192
|
}
|
|
3193
3193
|
class pr {
|
|
3194
3194
|
constructor() {
|
|
@@ -3254,8 +3254,8 @@ class pr {
|
|
|
3254
3254
|
}
|
|
3255
3255
|
}
|
|
3256
3256
|
}
|
|
3257
|
-
const Cr = "2.7.3", ds = 1 / 8,
|
|
3258
|
-
let Y, tn, us, js, lt,
|
|
3257
|
+
const Cr = "2.7.3", ds = 1 / 8, yn = typeof window < "u", Tr = yn && /Mac/.test(navigator.platform), mr = !(yn && "PointerEvent" in window);
|
|
3258
|
+
let Y, tn, us, js, lt, G, z, Ee, ye, St, _t, Qt, en, sn, ut, Le, de, nn, qs, on, $s, Ks, Is;
|
|
3259
3259
|
class ot extends pr {
|
|
3260
3260
|
/**
|
|
3261
3261
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
@@ -3298,14 +3298,14 @@ class ot extends pr {
|
|
|
3298
3298
|
* @category Statics
|
|
3299
3299
|
*/
|
|
3300
3300
|
static install(s) {
|
|
3301
|
-
Y = s.THREE, tn = 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(),
|
|
3301
|
+
Y = s.THREE, tn = 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(), Ee = new Y.Vector3(), ye = new Y.Vector3(), St = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), en = new Y.Vector3(), sn = new Y.Vector3(), ut = new Y.Spherical(), Le = new Y.Spherical(), de = new Y.Box3(), nn = new Y.Box3(), qs = new Y.Sphere(), on = new Y.Quaternion(), $s = new Y.Quaternion(), Ks = new Y.Matrix4(), Is = new Y.Raycaster();
|
|
3302
3302
|
}
|
|
3303
3303
|
/**
|
|
3304
3304
|
* list all ACTIONs
|
|
3305
3305
|
* @category Statics
|
|
3306
3306
|
*/
|
|
3307
3307
|
static get ACTION() {
|
|
3308
|
-
return
|
|
3308
|
+
return P;
|
|
3309
3309
|
}
|
|
3310
3310
|
/**
|
|
3311
3311
|
* Creates a `CameraControls` instance.
|
|
@@ -3326,10 +3326,10 @@ class ot extends pr {
|
|
|
3326
3326
|
*/
|
|
3327
3327
|
constructor(s, t) {
|
|
3328
3328
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.verticalDragToForward = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
3329
|
-
}, this._enabled = !0, this._state =
|
|
3329
|
+
}, this._enabled = !0, this._state = P.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, m, g) => {
|
|
3330
3330
|
let S, _;
|
|
3331
3331
|
if (Zt(this._camera)) {
|
|
3332
|
-
const N =
|
|
3332
|
+
const N = G.copy(this._camera.position).sub(this._target), y = this._camera.getEffectiveFOV() * _e, w = N.length() * Math.tan(y * 0.5);
|
|
3333
3333
|
S = this.truckSpeed * f * w / this._elementRect.height, _ = this.truckSpeed * m * w / this._elementRect.height;
|
|
3334
3334
|
} else if (vt(this._camera)) {
|
|
3335
3335
|
const N = this._camera;
|
|
@@ -3341,25 +3341,25 @@ class ot extends pr {
|
|
|
3341
3341
|
const g = he * this.azimuthRotateSpeed * f / this._elementRect.height, S = he * this.polarRotateSpeed * m / this._elementRect.height;
|
|
3342
3342
|
this.rotate(g, S, !0);
|
|
3343
3343
|
}, this._dollyInternal = (f, m, g) => {
|
|
3344
|
-
const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S,
|
|
3345
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(
|
|
3344
|
+
const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, y = mt(N, this.minDistance, this.maxDistance), w = y - N;
|
|
3345
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(y, !0)) : this._dollyToNoClamp(y, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : y) - _, this._dollyControlCoord.set(m, g)), this._lastDollyDirection = Math.sign(-f);
|
|
3346
3346
|
}, this._zoomInternal = (f, m, g) => {
|
|
3347
3347
|
const S = Math.pow(0.95, f * this.dollySpeed), _ = this._zoom, N = this._zoom * S;
|
|
3348
3348
|
this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(m, g));
|
|
3349
|
-
}, 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 =
|
|
3349
|
+
}, 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 = [
|
|
3350
3350
|
new Y.Vector3(),
|
|
3351
3351
|
new Y.Vector3(),
|
|
3352
3352
|
new Y.Vector3(),
|
|
3353
3353
|
new Y.Vector3()
|
|
3354
3354
|
], this._updateNearPlaneCorners(), this._boundary = new Y.Box3(new Y.Vector3(-1 / 0, -1 / 0, -1 / 0), new Y.Vector3(1 / 0, 1 / 0, 1 / 0)), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new Y.Vector2(), this.mouseButtons = {
|
|
3355
|
-
left:
|
|
3356
|
-
middle:
|
|
3357
|
-
right:
|
|
3358
|
-
wheel: Zt(this._camera) ?
|
|
3355
|
+
left: P.ROTATE,
|
|
3356
|
+
middle: P.DOLLY,
|
|
3357
|
+
right: P.TRUCK,
|
|
3358
|
+
wheel: Zt(this._camera) ? P.DOLLY : vt(this._camera) ? P.ZOOM : P.NONE
|
|
3359
3359
|
}, this.touches = {
|
|
3360
|
-
one:
|
|
3361
|
-
two: Zt(this._camera) ?
|
|
3362
|
-
three:
|
|
3360
|
+
one: P.TOUCH_ROTATE,
|
|
3361
|
+
two: Zt(this._camera) ? P.TOUCH_DOLLY_TRUCK : vt(this._camera) ? P.TOUCH_ZOOM_TRUCK : P.NONE,
|
|
3362
|
+
three: P.TOUCH_TRUCK
|
|
3363
3363
|
};
|
|
3364
3364
|
const e = new Y.Vector2(), i = new Y.Vector2(), o = new Y.Vector2(), n = (f) => {
|
|
3365
3365
|
if (!this._enabled || !this._domElement)
|
|
@@ -3369,12 +3369,12 @@ class ot extends pr {
|
|
|
3369
3369
|
if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
|
|
3370
3370
|
return;
|
|
3371
3371
|
}
|
|
3372
|
-
const m = f.pointerType !== "mouse" ? null : (f.buttons &
|
|
3372
|
+
const m = f.pointerType !== "mouse" ? null : (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
|
|
3373
3373
|
if (m !== null) {
|
|
3374
3374
|
const S = this._findPointerByMouseButton(m);
|
|
3375
3375
|
S && this._disposePointer(S);
|
|
3376
3376
|
}
|
|
3377
|
-
if ((f.buttons &
|
|
3377
|
+
if ((f.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
|
|
3378
3378
|
return;
|
|
3379
3379
|
const g = {
|
|
3380
3380
|
pointerId: f.pointerId,
|
|
@@ -3393,7 +3393,7 @@ class ot extends pr {
|
|
|
3393
3393
|
if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
|
|
3394
3394
|
return;
|
|
3395
3395
|
}
|
|
3396
|
-
const m = (f.buttons &
|
|
3396
|
+
const m = (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
|
|
3397
3397
|
if (m !== null) {
|
|
3398
3398
|
const S = this._findPointerByMouseButton(m);
|
|
3399
3399
|
S && this._disposePointer(S);
|
|
@@ -3404,9 +3404,9 @@ class ot extends pr {
|
|
|
3404
3404
|
clientY: f.clientY,
|
|
3405
3405
|
deltaX: 0,
|
|
3406
3406
|
deltaY: 0,
|
|
3407
|
-
mouseButton: (f.buttons &
|
|
3407
|
+
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
|
|
3408
3408
|
};
|
|
3409
|
-
this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3409
|
+
this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", l), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(f);
|
|
3410
3410
|
}, a = (f) => {
|
|
3411
3411
|
f.cancelable && f.preventDefault();
|
|
3412
3412
|
const m = f.pointerId, g = this._lockedPointer || this._findPointerById(m);
|
|
@@ -3424,19 +3424,19 @@ class ot extends pr {
|
|
|
3424
3424
|
break;
|
|
3425
3425
|
}
|
|
3426
3426
|
else
|
|
3427
|
-
(!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons &
|
|
3427
|
+
(!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);
|
|
3428
3428
|
A();
|
|
3429
3429
|
}
|
|
3430
|
-
},
|
|
3430
|
+
}, l = (f) => {
|
|
3431
3431
|
const m = this._lockedPointer || this._findPointerById(1);
|
|
3432
|
-
m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons &
|
|
3432
|
+
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), A());
|
|
3433
3433
|
}, E = (f) => {
|
|
3434
3434
|
const m = this._findPointerById(f.pointerId);
|
|
3435
3435
|
if (!(m && m === this._lockedPointer)) {
|
|
3436
3436
|
if (m && this._disposePointer(m), f.pointerType === "touch")
|
|
3437
3437
|
switch (this._activePointers.length) {
|
|
3438
3438
|
case 0:
|
|
3439
|
-
this._state =
|
|
3439
|
+
this._state = P.NONE;
|
|
3440
3440
|
break;
|
|
3441
3441
|
case 1:
|
|
3442
3442
|
this._state = this.touches.one;
|
|
@@ -3449,45 +3449,45 @@ class ot extends pr {
|
|
|
3449
3449
|
break;
|
|
3450
3450
|
}
|
|
3451
3451
|
else
|
|
3452
|
-
this._state =
|
|
3452
|
+
this._state = P.NONE;
|
|
3453
3453
|
C();
|
|
3454
3454
|
}
|
|
3455
3455
|
}, d = () => {
|
|
3456
3456
|
const f = this._findPointerById(1);
|
|
3457
|
-
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state =
|
|
3457
|
+
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = P.NONE, C());
|
|
3458
3458
|
};
|
|
3459
3459
|
let h = -1;
|
|
3460
3460
|
const u = (f) => {
|
|
3461
|
-
if (!this._domElement || !this._enabled || this.mouseButtons.wheel ===
|
|
3461
|
+
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === P.NONE)
|
|
3462
3462
|
return;
|
|
3463
3463
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
3464
|
-
const N = this._domElement.getBoundingClientRect(),
|
|
3465
|
-
if (
|
|
3464
|
+
const N = this._domElement.getBoundingClientRect(), y = f.clientX / N.width, w = f.clientY / N.height;
|
|
3465
|
+
if (y < this._interactiveArea.left || y > this._interactiveArea.right || w < this._interactiveArea.top || w > this._interactiveArea.bottom)
|
|
3466
3466
|
return;
|
|
3467
3467
|
}
|
|
3468
|
-
if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel ===
|
|
3468
|
+
if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === P.ROTATE || this.mouseButtons.wheel === P.TRUCK) {
|
|
3469
3469
|
const N = performance.now();
|
|
3470
3470
|
h - N < 1e3 && this._getClientRect(this._elementRect), h = N;
|
|
3471
3471
|
}
|
|
3472
3472
|
const m = Tr ? -1 : -3, g = f.deltaMode === 1 ? f.deltaY / m : f.deltaY / (m * 10), S = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3473
3473
|
switch (this.mouseButtons.wheel) {
|
|
3474
|
-
case
|
|
3474
|
+
case P.ROTATE: {
|
|
3475
3475
|
this._rotateInternal(f.deltaX, f.deltaY), this._isUserControllingRotate = !0;
|
|
3476
3476
|
break;
|
|
3477
3477
|
}
|
|
3478
|
-
case
|
|
3478
|
+
case P.TRUCK: {
|
|
3479
3479
|
this._truckInternal(f.deltaX, f.deltaY, !1), this._isUserControllingTruck = !0;
|
|
3480
3480
|
break;
|
|
3481
3481
|
}
|
|
3482
|
-
case
|
|
3482
|
+
case P.OFFSET: {
|
|
3483
3483
|
this._truckInternal(f.deltaX, f.deltaY, !0), this._isUserControllingOffset = !0;
|
|
3484
3484
|
break;
|
|
3485
3485
|
}
|
|
3486
|
-
case
|
|
3486
|
+
case P.DOLLY: {
|
|
3487
3487
|
this._dollyInternal(-g, S, _), this._isUserControllingDolly = !0;
|
|
3488
3488
|
break;
|
|
3489
3489
|
}
|
|
3490
|
-
case
|
|
3490
|
+
case P.ZOOM: {
|
|
3491
3491
|
this._zoomInternal(-g, S, _), this._isUserControllingZoom = !0;
|
|
3492
3492
|
break;
|
|
3493
3493
|
}
|
|
@@ -3497,7 +3497,7 @@ class ot extends pr {
|
|
|
3497
3497
|
if (!(!this._domElement || !this._enabled)) {
|
|
3498
3498
|
if (this.mouseButtons.right === ot.ACTION.NONE) {
|
|
3499
3499
|
const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), g = this._findPointerById(m);
|
|
3500
|
-
g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove",
|
|
3500
|
+
g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d);
|
|
3501
3501
|
return;
|
|
3502
3502
|
}
|
|
3503
3503
|
f.preventDefault();
|
|
@@ -3508,8 +3508,8 @@ class ot extends pr {
|
|
|
3508
3508
|
if (Zs(this._activePointers, lt), this._getClientRect(this._elementRect), e.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
|
|
3509
3509
|
const g = lt.x - this._activePointers[1].clientX, S = lt.y - this._activePointers[1].clientY, _ = Math.sqrt(g * g + S * S);
|
|
3510
3510
|
o.set(0, _);
|
|
3511
|
-
const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
3512
|
-
i.set(N,
|
|
3511
|
+
const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, y = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
3512
|
+
i.set(N, y);
|
|
3513
3513
|
}
|
|
3514
3514
|
if (this._state = 0, !f)
|
|
3515
3515
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
@@ -3526,26 +3526,26 @@ class ot extends pr {
|
|
|
3526
3526
|
break;
|
|
3527
3527
|
}
|
|
3528
3528
|
else
|
|
3529
|
-
!this._lockedPointer && (f.buttons &
|
|
3530
|
-
((this._state &
|
|
3529
|
+
!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);
|
|
3530
|
+
((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._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((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._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & P.DOLLY) === P.DOLLY || (this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & P.ZOOM) === P.ZOOM || (this._state & P.TOUCH_ZOOM) === P.TOUCH_ZOOM || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 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._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
3531
3531
|
}, A = () => {
|
|
3532
3532
|
if (!this._enabled || !this._dragNeedsUpdate)
|
|
3533
3533
|
return;
|
|
3534
3534
|
this._dragNeedsUpdate = !1, Zs(this._activePointers, lt);
|
|
3535
3535
|
const m = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, g = m ? -m.deltaX : i.x - lt.x, S = m ? -m.deltaY : i.y - lt.y;
|
|
3536
|
-
if (i.copy(lt), ((this._state &
|
|
3537
|
-
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,
|
|
3538
|
-
(this._state &
|
|
3536
|
+
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(g, S), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
|
|
3537
|
+
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, y = this.dollyDragInverted ? -1 : 1;
|
|
3538
|
+
(this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(y * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(y * S * ds, _, N), this._isUserControllingZoom = !0);
|
|
3539
3539
|
}
|
|
3540
|
-
if ((this._state &
|
|
3541
|
-
const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY,
|
|
3542
|
-
o.set(0,
|
|
3543
|
-
const
|
|
3544
|
-
(this._state &
|
|
3540
|
+
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) {
|
|
3541
|
+
const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, y = Math.sqrt(_ * _ + N * N), w = o.y - y;
|
|
3542
|
+
o.set(0, y);
|
|
3543
|
+
const L = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3544
|
+
(this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * ds, L, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * ds, L, U), this._isUserControllingZoom = !0);
|
|
3545
3545
|
}
|
|
3546
|
-
((this._state &
|
|
3546
|
+
((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(g, 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(g, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
3547
3547
|
}, C = () => {
|
|
3548
|
-
Zs(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",
|
|
3548
|
+
Zs(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
|
|
3549
3549
|
};
|
|
3550
3550
|
this.lockPointer = () => {
|
|
3551
3551
|
!this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
|
|
@@ -3567,9 +3567,9 @@ class ot extends pr {
|
|
|
3567
3567
|
this._addAllEventListeners = (f) => {
|
|
3568
3568
|
this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), mr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
|
|
3569
3569
|
}, this._removeAllEventListeners = () => {
|
|
3570
|
-
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",
|
|
3570
|
+
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", E), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3571
3571
|
}, this.cancel = () => {
|
|
3572
|
-
this._state !==
|
|
3572
|
+
this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
|
|
3573
3573
|
}, t && this.connect(t), this.update(0);
|
|
3574
3574
|
}
|
|
3575
3575
|
/**
|
|
@@ -3825,7 +3825,7 @@ class ot extends pr {
|
|
|
3825
3825
|
* @category Methods
|
|
3826
3826
|
*/
|
|
3827
3827
|
dollyInFixed(s, t = !1) {
|
|
3828
|
-
this._targetEnd.add(this._getCameraDirection(
|
|
3828
|
+
this._targetEnd.add(this._getCameraDirection(ye).multiplyScalar(s)), t || this._target.copy(this._targetEnd);
|
|
3829
3829
|
const e = !t || 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);
|
|
3830
3830
|
return this._createOnRestPromise(e);
|
|
3831
3831
|
}
|
|
@@ -3867,7 +3867,7 @@ class ot extends pr {
|
|
|
3867
3867
|
*/
|
|
3868
3868
|
truck(s, t, e = !1) {
|
|
3869
3869
|
this._camera.updateMatrix(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), St.multiplyScalar(s), _t.multiplyScalar(-t);
|
|
3870
|
-
const i =
|
|
3870
|
+
const i = G.copy(St).add(_t), o = z.copy(this._targetEnd).add(i);
|
|
3871
3871
|
return this.moveTo(o.x, o.y, o.z, e);
|
|
3872
3872
|
}
|
|
3873
3873
|
/**
|
|
@@ -3877,8 +3877,8 @@ class ot extends pr {
|
|
|
3877
3877
|
* @category Methods
|
|
3878
3878
|
*/
|
|
3879
3879
|
forward(s, t = !1) {
|
|
3880
|
-
|
|
3881
|
-
const e = z.copy(this._targetEnd).add(
|
|
3880
|
+
G.setFromMatrixColumn(this._camera.matrix, 0), G.crossVectors(this._camera.up, G), G.multiplyScalar(s);
|
|
3881
|
+
const e = z.copy(this._targetEnd).add(G);
|
|
3882
3882
|
return this.moveTo(e.x, e.y, e.z, t);
|
|
3883
3883
|
}
|
|
3884
3884
|
/**
|
|
@@ -3888,7 +3888,7 @@ class ot extends pr {
|
|
|
3888
3888
|
* @category Methods
|
|
3889
3889
|
*/
|
|
3890
3890
|
elevate(s, t = !1) {
|
|
3891
|
-
return
|
|
3891
|
+
return G.copy(this._camera.up).multiplyScalar(s), this.moveTo(this._targetEnd.x + G.x, this._targetEnd.y + G.y, this._targetEnd.z + G.z, t);
|
|
3892
3892
|
}
|
|
3893
3893
|
/**
|
|
3894
3894
|
* Move target position to given point.
|
|
@@ -3900,7 +3900,7 @@ class ot extends pr {
|
|
|
3900
3900
|
*/
|
|
3901
3901
|
moveTo(s, t, e, i = !1) {
|
|
3902
3902
|
this._isUserControllingTruck = !1;
|
|
3903
|
-
const o =
|
|
3903
|
+
const o = G.set(s, t, e).sub(this._targetEnd);
|
|
3904
3904
|
this._encloseToBoundary(this._targetEnd, o, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
3905
3905
|
const n = !i || 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);
|
|
3906
3906
|
return this._createOnRestPromise(n);
|
|
@@ -3915,7 +3915,7 @@ class ot extends pr {
|
|
|
3915
3915
|
* @category Methods
|
|
3916
3916
|
*/
|
|
3917
3917
|
lookInDirectionOf(s, t, e, i = !1) {
|
|
3918
|
-
const r =
|
|
3918
|
+
const r = G.set(s, t, e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);
|
|
3919
3919
|
return this.setPosition(r.x, r.y, r.z, i);
|
|
3920
3920
|
}
|
|
3921
3921
|
/**
|
|
@@ -3932,15 +3932,15 @@ class ot extends pr {
|
|
|
3932
3932
|
* @category Methods
|
|
3933
3933
|
*/
|
|
3934
3934
|
fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
|
|
3935
|
-
const a = [],
|
|
3936
|
-
|
|
3935
|
+
const a = [], l = s.isBox3 ? de.copy(s) : de.setFromObject(s);
|
|
3936
|
+
l.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
|
|
3937
3937
|
const E = Ki(this._sphericalEnd.theta, $i), d = Ki(this._sphericalEnd.phi, $i);
|
|
3938
3938
|
a.push(this.rotateTo(E, d, t));
|
|
3939
|
-
const h =
|
|
3939
|
+
const h = G.setFromSpherical(this._sphericalEnd).normalize(), u = on.setFromUnitVectors(h, js), p = k(Math.abs(h.y), 1);
|
|
3940
3940
|
p && u.multiply($s.setFromAxisAngle(us, E)), u.multiply(this._yAxisUpSpaceInverse);
|
|
3941
3941
|
const R = nn.makeEmpty();
|
|
3942
|
-
z.copy(
|
|
3943
|
-
const A = R.getSize(
|
|
3942
|
+
z.copy(l.min).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setX(l.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setY(l.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setZ(l.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setZ(l.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setY(l.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setX(l.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(js, h), p && u.premultiply($s.invert()), u.premultiply(this._yAxisUpSpace);
|
|
3943
|
+
const A = R.getSize(G), C = R.getCenter(z).applyQuaternion(u);
|
|
3944
3944
|
if (Zt(this._camera)) {
|
|
3945
3945
|
const T = this.getDistanceToFitBox(A.x, A.y, A.z, e);
|
|
3946
3946
|
a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
@@ -3962,8 +3962,8 @@ class ot extends pr {
|
|
|
3962
3962
|
const n = this.getDistanceToFitSphere(o.radius);
|
|
3963
3963
|
e.push(this.dollyTo(n, t));
|
|
3964
3964
|
} else if (vt(this._camera)) {
|
|
3965
|
-
const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius,
|
|
3966
|
-
e.push(this.zoomTo(
|
|
3965
|
+
const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, l = Math.min(n / a, r / a);
|
|
3966
|
+
e.push(this.zoomTo(l, t));
|
|
3967
3967
|
}
|
|
3968
3968
|
return e.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(e);
|
|
3969
3969
|
}
|
|
@@ -3980,8 +3980,8 @@ class ot extends pr {
|
|
|
3980
3980
|
*/
|
|
3981
3981
|
setLookAt(s, t, e, i, o, n, r = !1) {
|
|
3982
3982
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
|
|
3983
|
-
const a = z.set(i, o, n),
|
|
3984
|
-
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
3983
|
+
const a = z.set(i, o, n), l = G.set(s, t, e);
|
|
3984
|
+
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
3985
3985
|
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);
|
|
3986
3986
|
return this._createOnRestPromise(E);
|
|
3987
3987
|
}
|
|
@@ -4003,13 +4003,13 @@ class ot extends pr {
|
|
|
4003
4003
|
* @param enableTransition
|
|
4004
4004
|
* @category Methods
|
|
4005
4005
|
*/
|
|
4006
|
-
lerpLookAt(s, t, e, i, o, n, r, a,
|
|
4006
|
+
lerpLookAt(s, t, e, i, o, n, r, a, l, E, d, h, u, p = !1) {
|
|
4007
4007
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
|
|
4008
|
-
const R =
|
|
4008
|
+
const R = G.set(i, o, n), A = z.set(s, t, e);
|
|
4009
4009
|
ut.setFromVector3(A.sub(R).applyQuaternion(this._yAxisUpSpace));
|
|
4010
|
-
const C = Ee.set(E, d, h), T = z.set(r, a,
|
|
4011
|
-
|
|
4012
|
-
const F =
|
|
4010
|
+
const C = Ee.set(E, d, h), T = z.set(r, a, l);
|
|
4011
|
+
Le.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
|
|
4012
|
+
const F = Le.theta - ut.theta, f = Le.phi - ut.phi, m = Le.radius - ut.radius;
|
|
4013
4013
|
this._sphericalEnd.set(ut.radius + m * u, ut.phi + f * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
4014
4014
|
const g = !p || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
|
|
4015
4015
|
return this._createOnRestPromise(g);
|
|
@@ -4036,7 +4036,7 @@ class ot extends pr {
|
|
|
4036
4036
|
* @category Methods
|
|
4037
4037
|
*/
|
|
4038
4038
|
setTarget(s, t, e, i = !1) {
|
|
4039
|
-
const o = this.getPosition(
|
|
4039
|
+
const o = this.getPosition(G), n = this.setLookAt(o.x, o.y, o.z, s, t, e, i);
|
|
4040
4040
|
return this._sphericalEnd.phi = mt(this._sphericalEnd.phi, this.minPolarAngle, this.maxPolarAngle), n;
|
|
4041
4041
|
}
|
|
4042
4042
|
/**
|
|
@@ -4062,8 +4062,8 @@ class ot extends pr {
|
|
|
4062
4062
|
*/
|
|
4063
4063
|
setOrbitPoint(s, t, e) {
|
|
4064
4064
|
this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), _t.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
4065
|
-
const i =
|
|
4066
|
-
St.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z),
|
|
4065
|
+
const i = G.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
|
|
4066
|
+
St.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(St).add(_t).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
|
|
4067
4067
|
}
|
|
4068
4068
|
/**
|
|
4069
4069
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -4170,7 +4170,7 @@ class ot extends pr {
|
|
|
4170
4170
|
reset(s = !1) {
|
|
4171
4171
|
if (!k(this._camera.up.x, this._cameraUp0.x) || !k(this._camera.up.y, this._cameraUp0.y) || !k(this._camera.up.z, this._cameraUp0.z)) {
|
|
4172
4172
|
this._camera.up.copy(this._cameraUp0);
|
|
4173
|
-
const e = this.getPosition(
|
|
4173
|
+
const e = this.getPosition(G);
|
|
4174
4174
|
this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
|
|
4175
4175
|
}
|
|
4176
4176
|
const t = [
|
|
@@ -4201,9 +4201,9 @@ class ot extends pr {
|
|
|
4201
4201
|
* @category Methods
|
|
4202
4202
|
*/
|
|
4203
4203
|
applyCameraUp() {
|
|
4204
|
-
const s =
|
|
4204
|
+
const s = G.subVectors(this._target, this._camera.position).normalize(), t = z.crossVectors(s, this._camera.up);
|
|
4205
4205
|
this._camera.up.crossVectors(t, s).normalize(), this._camera.updateMatrixWorld();
|
|
4206
|
-
const e = this.getPosition(
|
|
4206
|
+
const e = this.getPosition(G);
|
|
4207
4207
|
this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
|
|
4208
4208
|
}
|
|
4209
4209
|
/**
|
|
@@ -4253,9 +4253,9 @@ class ot extends pr {
|
|
|
4253
4253
|
}
|
|
4254
4254
|
if (this.dollyToCursor) {
|
|
4255
4255
|
if (Zt(this._camera) && this._changedDolly !== 0) {
|
|
4256
|
-
const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(
|
|
4256
|
+
const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(h.up).normalize();
|
|
4257
4257
|
p.lengthSq() === 0 && (p.x = 1);
|
|
4258
|
-
const R = z.crossVectors(p, u), A = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * _e * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * A * h.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * A)), f =
|
|
4258
|
+
const R = z.crossVectors(p, u), A = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * _e * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * A * h.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * A)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
|
|
4259
4259
|
if (this.infinityDolly && (m || g)) {
|
|
4260
4260
|
this._sphericalEnd.radius -= d, this._spherical.radius -= d;
|
|
4261
4261
|
const _ = z.copy(u).multiplyScalar(-d);
|
|
@@ -4265,7 +4265,7 @@ class ot extends pr {
|
|
|
4265
4265
|
const S = z.subVectors(f, this._targetEnd);
|
|
4266
4266
|
this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
|
|
4267
4267
|
} else if (vt(this._camera) && this._changedZoom !== 0) {
|
|
4268
|
-
const d = this._zoom - this._lastZoom, h = this._camera, u =
|
|
4268
|
+
const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), R = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(ye), F = this._targetEnd.dot(T), f = G.copy(this._targetEnd).lerp(R, C), m = f.dot(T), g = T.multiplyScalar(m - F);
|
|
4269
4269
|
f.sub(g), this._boundary.clampPoint(f, f);
|
|
4270
4270
|
const S = z.subVectors(f, this._targetEnd);
|
|
4271
4271
|
this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
|
|
@@ -4273,7 +4273,7 @@ class ot extends pr {
|
|
|
4273
4273
|
}
|
|
4274
4274
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
4275
4275
|
const a = this._collisionTest();
|
|
4276
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), St.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z),
|
|
4276
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), St.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(St).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
|
|
4277
4277
|
const E = this._needsUpdate;
|
|
4278
4278
|
return E && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : E ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !E && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = E, this._needsUpdate = !1, E;
|
|
4279
4279
|
}
|
|
@@ -4299,7 +4299,7 @@ class ot extends pr {
|
|
|
4299
4299
|
dollyToCursor: this.dollyToCursor,
|
|
4300
4300
|
verticalDragToForward: this.verticalDragToForward,
|
|
4301
4301
|
target: this._targetEnd.toArray(),
|
|
4302
|
-
position:
|
|
4302
|
+
position: G.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
4303
4303
|
zoom: this._zoomEnd,
|
|
4304
4304
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
4305
4305
|
target0: this._target0.toArray(),
|
|
@@ -4316,7 +4316,7 @@ class ot extends pr {
|
|
|
4316
4316
|
*/
|
|
4317
4317
|
fromJSON(s, t = !1) {
|
|
4318
4318
|
const e = JSON.parse(s);
|
|
4319
|
-
this.enabled = e.enabled, this.minDistance = e.minDistance, this.maxDistance =
|
|
4319
|
+
this.enabled = e.enabled, this.minDistance = e.minDistance, this.maxDistance = Pe(e.maxDistance), this.minZoom = e.minZoom, this.maxZoom = Pe(e.maxZoom), this.minPolarAngle = e.minPolarAngle, this.maxPolarAngle = Pe(e.maxPolarAngle), this.minAzimuthAngle = Pe(e.minAzimuthAngle), this.maxAzimuthAngle = Pe(e.maxAzimuthAngle), this.smoothTime = e.smoothTime, this.draggingSmoothTime = e.draggingSmoothTime, this.dollySpeed = e.dollySpeed, this.truckSpeed = e.truckSpeed, this.dollyToCursor = e.dollyToCursor, this.verticalDragToForward = e.verticalDragToForward, this._target0.fromArray(e.target0), this._position0.fromArray(e.position0), this._zoom0 = e.zoom0, this._focalOffset0.fromArray(e.focalOffset0), this.moveTo(e.target[0], e.target[1], e.target[2], t), ut.setFromVector3(G.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(ut.theta, ut.phi, t), this.dollyTo(ut.radius, t), this.zoomTo(e.zoom, t), this.setFocalOffset(e.focalOffset[0], e.focalOffset[1], e.focalOffset[2], t), this._needsUpdate = !0;
|
|
4320
4320
|
}
|
|
4321
4321
|
/**
|
|
4322
4322
|
* Attach all internal event handlers to enable drag control.
|
|
@@ -4371,8 +4371,8 @@ class ot extends pr {
|
|
|
4371
4371
|
if (e === 0)
|
|
4372
4372
|
return s.add(t).add(r);
|
|
4373
4373
|
{
|
|
4374
|
-
const
|
|
4375
|
-
return s.add(z.copy(t).multiplyScalar(
|
|
4374
|
+
const l = 1 + e * a / t.dot(r);
|
|
4375
|
+
return s.add(z.copy(t).multiplyScalar(l)).add(r.multiplyScalar(1 - e));
|
|
4376
4376
|
}
|
|
4377
4377
|
}
|
|
4378
4378
|
_updateNearPlaneCorners() {
|
|
@@ -4389,7 +4389,7 @@ class ot extends pr {
|
|
|
4389
4389
|
let s = 1 / 0;
|
|
4390
4390
|
if (!(this.colliderMeshes.length >= 1) || Qs(this._camera, "_collisionTest"))
|
|
4391
4391
|
return s;
|
|
4392
|
-
const e = this._getTargetDirection(
|
|
4392
|
+
const e = this._getTargetDirection(ye);
|
|
4393
4393
|
Ks.lookAt(tn, e, this._camera.up);
|
|
4394
4394
|
for (let i = 0; i < 4; i++) {
|
|
4395
4395
|
const o = z.copy(this._nearPlaneCorners[i]);
|
|
@@ -4468,7 +4468,7 @@ class ot extends pr {
|
|
|
4468
4468
|
a.applyMatrix4(r.matrixWorld);
|
|
4469
4469
|
const E = a.attributes.position;
|
|
4470
4470
|
for (let d = 0, h = E.count; d < h; d++)
|
|
4471
|
-
|
|
4471
|
+
G.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(G));
|
|
4472
4472
|
}), e.radius = Math.sqrt(o), e;
|
|
4473
4473
|
}
|
|
4474
4474
|
}
|
|
@@ -4617,7 +4617,7 @@ class Rr {
|
|
|
4617
4617
|
this.world = t;
|
|
4618
4618
|
const { color: i, size1: o, size2: n, distance: r } = e;
|
|
4619
4619
|
this.components = s;
|
|
4620
|
-
const a = new O.PlaneGeometry(2, 2, 1, 1),
|
|
4620
|
+
const a = new O.PlaneGeometry(2, 2, 1, 1), l = new O.ShaderMaterial({
|
|
4621
4621
|
side: O.DoubleSide,
|
|
4622
4622
|
uniforms: {
|
|
4623
4623
|
uSize1: {
|
|
@@ -4707,7 +4707,7 @@ class Rr {
|
|
|
4707
4707
|
derivatives: !0
|
|
4708
4708
|
}
|
|
4709
4709
|
});
|
|
4710
|
-
this._grid = new O.Mesh(a,
|
|
4710
|
+
this._grid = new O.Mesh(a, l), this._grid.frustumCulled = !1, t.scene.three.add(this._grid), this.setupEvents(!0);
|
|
4711
4711
|
}
|
|
4712
4712
|
/** {@link Hideable.visible} */
|
|
4713
4713
|
get visible() {
|
|
@@ -4786,7 +4786,7 @@ class Ar extends it {
|
|
|
4786
4786
|
}
|
|
4787
4787
|
}
|
|
4788
4788
|
I(Ar, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
|
|
4789
|
-
const jt = new zn(), nt = new M(), bt = new M(), j = new
|
|
4789
|
+
const jt = new zn(), nt = new M(), bt = new M(), j = new yt(), rn = {
|
|
4790
4790
|
X: new M(1, 0, 0),
|
|
4791
4791
|
Y: new M(0, 1, 0),
|
|
4792
4792
|
Z: new M(0, 0, 1)
|
|
@@ -4794,9 +4794,9 @@ const jt = new zn(), nt = new M(), bt = new M(), j = new Lt(), rn = {
|
|
|
4794
4794
|
class Fr extends ei {
|
|
4795
4795
|
constructor(s, t) {
|
|
4796
4796
|
super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
|
|
4797
|
-
const e = new
|
|
4797
|
+
const e = new Pr();
|
|
4798
4798
|
this._gizmo = e, this.add(e);
|
|
4799
|
-
const i = new
|
|
4799
|
+
const i = new yr();
|
|
4800
4800
|
this._plane = i, this.add(i);
|
|
4801
4801
|
const o = this;
|
|
4802
4802
|
function n(T, F) {
|
|
@@ -4811,8 +4811,8 @@ class Fr extends ei {
|
|
|
4811
4811
|
}), o[T] = F, i[T] = F, e[T] = F;
|
|
4812
4812
|
}
|
|
4813
4813
|
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);
|
|
4814
|
-
const r = new M(), a = new M(),
|
|
4815
|
-
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion",
|
|
4814
|
+
const r = new M(), a = new M(), l = new yt(), E = new yt(), d = new M(), h = new yt(), u = new M(), p = new M(), R = new M(), A = 0, C = new M();
|
|
4815
|
+
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", l), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", R), n("rotationAngle", A), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new yt(), this._parentQuaternionInv = new yt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new yt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new yt(), this._scaleStart = new M(), this._getPointer = gr.bind(this), this._onPointerDown = Sr.bind(this), this._onPointerHover = Or.bind(this), this._onPointerMove = _r.bind(this), this._onPointerUp = Nr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
4816
4816
|
}
|
|
4817
4817
|
// updateMatrixWorld updates key transformation variables
|
|
4818
4818
|
updateMatrixWorld() {
|
|
@@ -4903,49 +4903,49 @@ class Fr extends ei {
|
|
|
4903
4903
|
this.space = s;
|
|
4904
4904
|
}
|
|
4905
4905
|
}
|
|
4906
|
-
function gr(
|
|
4906
|
+
function gr(c) {
|
|
4907
4907
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
4908
4908
|
return {
|
|
4909
4909
|
x: 0,
|
|
4910
4910
|
y: 0,
|
|
4911
|
-
button:
|
|
4911
|
+
button: c.button
|
|
4912
4912
|
};
|
|
4913
4913
|
{
|
|
4914
4914
|
const s = this.domElement.getBoundingClientRect();
|
|
4915
4915
|
return {
|
|
4916
|
-
x: (
|
|
4917
|
-
y: -(
|
|
4918
|
-
button:
|
|
4916
|
+
x: (c.clientX - s.left) / s.width * 2 - 1,
|
|
4917
|
+
y: -(c.clientY - s.top) / s.height * 2 + 1,
|
|
4918
|
+
button: c.button
|
|
4919
4919
|
};
|
|
4920
4920
|
}
|
|
4921
4921
|
}
|
|
4922
|
-
function Or(
|
|
4922
|
+
function Or(c) {
|
|
4923
4923
|
if (this.enabled)
|
|
4924
|
-
switch (
|
|
4924
|
+
switch (c.pointerType) {
|
|
4925
4925
|
case "mouse":
|
|
4926
4926
|
case "pen":
|
|
4927
|
-
this.pointerHover(this._getPointer(
|
|
4927
|
+
this.pointerHover(this._getPointer(c));
|
|
4928
4928
|
break;
|
|
4929
4929
|
}
|
|
4930
4930
|
}
|
|
4931
|
-
function Sr(
|
|
4932
|
-
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(
|
|
4931
|
+
function Sr(c) {
|
|
4932
|
+
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(c.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(c)), this.pointerDown(this._getPointer(c)));
|
|
4933
4933
|
}
|
|
4934
|
-
function _r(
|
|
4935
|
-
this.enabled && this.pointerMove(this._getPointer(
|
|
4934
|
+
function _r(c) {
|
|
4935
|
+
this.enabled && this.pointerMove(this._getPointer(c));
|
|
4936
4936
|
}
|
|
4937
|
-
function Nr(
|
|
4938
|
-
this.enabled && (this.domElement.releasePointerCapture(
|
|
4937
|
+
function Nr(c) {
|
|
4938
|
+
this.enabled && (this.domElement.releasePointerCapture(c.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(c)));
|
|
4939
4939
|
}
|
|
4940
|
-
function ti(
|
|
4941
|
-
const e = s.intersectObject(
|
|
4940
|
+
function ti(c, s, t) {
|
|
4941
|
+
const e = s.intersectObject(c, !0);
|
|
4942
4942
|
for (let i = 0; i < e.length; i++)
|
|
4943
4943
|
if (e[i].object.visible || t)
|
|
4944
4944
|
return e[i];
|
|
4945
4945
|
return !1;
|
|
4946
4946
|
}
|
|
4947
|
-
const fs = new Hn(), W = new M(0, 1, 0), hn = new M(0, 0, 0), En = new Mt(), ps = new
|
|
4948
|
-
class
|
|
4947
|
+
const fs = new Hn(), W = new M(0, 1, 0), hn = new M(0, 0, 0), En = new Mt(), ps = new yt(), Rs = new yt(), Nt = new M(), dn = new Mt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), Cs = new M(), Me = new M(), we = new M();
|
|
4948
|
+
class Pr extends ei {
|
|
4949
4949
|
constructor() {
|
|
4950
4950
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
4951
4951
|
const s = new gn({
|
|
@@ -4972,8 +4972,8 @@ class yr extends ei {
|
|
|
4972
4972
|
r.color.setHex(255);
|
|
4973
4973
|
const a = s.clone();
|
|
4974
4974
|
a.color.setHex(16711680), a.opacity = 0.5;
|
|
4975
|
-
const
|
|
4976
|
-
|
|
4975
|
+
const l = s.clone();
|
|
4976
|
+
l.color.setHex(65280), l.opacity = 0.5;
|
|
4977
4977
|
const E = s.clone();
|
|
4978
4978
|
E.color.setHex(255), E.opacity = 0.5;
|
|
4979
4979
|
const d = s.clone();
|
|
@@ -4987,7 +4987,7 @@ class yr extends ei {
|
|
|
4987
4987
|
const A = new rt(0.08, 0.08, 0.08);
|
|
4988
4988
|
A.translate(0, 0.04, 0);
|
|
4989
4989
|
const C = new Ni();
|
|
4990
|
-
C.setAttribute("position", new
|
|
4990
|
+
C.setAttribute("position", new Pi([0, 0, 0, 1, 0, 0], 3));
|
|
4991
4991
|
const T = new ct(75e-4, 75e-4, 0.5, 3);
|
|
4992
4992
|
T.translate(0, 0.25, 0);
|
|
4993
4993
|
function F(B, H) {
|
|
@@ -4996,7 +4996,7 @@ class yr extends ei {
|
|
|
4996
4996
|
}
|
|
4997
4997
|
function f() {
|
|
4998
4998
|
const B = new Ni();
|
|
4999
|
-
return B.setAttribute("position", new
|
|
4999
|
+
return B.setAttribute("position", new Pi([0, 0, 0, 1, 1, 1], 3)), B;
|
|
5000
5000
|
}
|
|
5001
5001
|
const m = {
|
|
5002
5002
|
X: [
|
|
@@ -5024,7 +5024,7 @@ class yr extends ei {
|
|
|
5024
5024
|
[new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
5025
5025
|
],
|
|
5026
5026
|
XZ: [
|
|
5027
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5027
|
+
[new v(new rt(0.15, 0.15, 0.01), l.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5028
5028
|
]
|
|
5029
5029
|
}, g = {
|
|
5030
5030
|
X: [
|
|
@@ -5090,7 +5090,7 @@ class yr extends ei {
|
|
|
5090
5090
|
AXIS: [
|
|
5091
5091
|
[new Ut(C, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
5092
5092
|
]
|
|
5093
|
-
},
|
|
5093
|
+
}, y = {
|
|
5094
5094
|
XYZE: [
|
|
5095
5095
|
[new v(new Wn(0.25, 10, 8), e)]
|
|
5096
5096
|
],
|
|
@@ -5129,12 +5129,12 @@ class yr extends ei {
|
|
|
5129
5129
|
[new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
5130
5130
|
],
|
|
5131
5131
|
XZ: [
|
|
5132
|
-
[new v(new rt(0.15, 0.15, 0.01),
|
|
5132
|
+
[new v(new rt(0.15, 0.15, 0.01), l), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
5133
5133
|
],
|
|
5134
5134
|
XYZ: [
|
|
5135
5135
|
[new v(new rt(0.1, 0.1, 0.1), d.clone())]
|
|
5136
5136
|
]
|
|
5137
|
-
},
|
|
5137
|
+
}, L = {
|
|
5138
5138
|
X: [
|
|
5139
5139
|
[new v(new ct(0.2, 0, 0.6, 4), e), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
5140
5140
|
[new v(new ct(0.2, 0, 0.6, 4), e), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
@@ -5181,7 +5181,7 @@ class yr extends ei {
|
|
|
5181
5181
|
}
|
|
5182
5182
|
return H;
|
|
5183
5183
|
}
|
|
5184
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(m)), this.add(this.gizmo.rotate = x(_)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(
|
|
5184
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(m)), this.add(this.gizmo.rotate = x(_)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(y)), this.add(this.picker.scale = x(L)), this.add(this.helper.translate = x(S)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
5185
5185
|
}
|
|
5186
5186
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
5187
5187
|
updateMatrixWorld(s) {
|
|
@@ -5204,7 +5204,7 @@ class yr extends ei {
|
|
|
5204
5204
|
super.updateMatrixWorld(s);
|
|
5205
5205
|
}
|
|
5206
5206
|
}
|
|
5207
|
-
class
|
|
5207
|
+
class yr extends v {
|
|
5208
5208
|
constructor() {
|
|
5209
5209
|
super(
|
|
5210
5210
|
new Xn(1e5, 1e5, 2, 2),
|
|
@@ -5546,8 +5546,8 @@ const ve = class ve extends it {
|
|
|
5546
5546
|
const i = t.object;
|
|
5547
5547
|
let o = t.object.matrixWorld.clone();
|
|
5548
5548
|
if (i instanceof O.InstancedMesh && t.instanceId !== void 0) {
|
|
5549
|
-
const
|
|
5550
|
-
i.getMatrixAt(t.instanceId,
|
|
5549
|
+
const l = new O.Matrix4();
|
|
5550
|
+
i.getMatrixAt(t.instanceId, l), o = l.multiply(o);
|
|
5551
5551
|
}
|
|
5552
5552
|
const r = new O.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
|
|
5553
5553
|
return this.normalizePlaneDirectionY(a), a;
|
|
@@ -5682,15 +5682,15 @@ const Be = class Be extends it {
|
|
|
5682
5682
|
};
|
|
5683
5683
|
I(Be, "uuid", "24989d27-fa2f-4797-8b08-35918f74e502");
|
|
5684
5684
|
let In = Be;
|
|
5685
|
-
function
|
|
5685
|
+
function Lr(c, s, t, e) {
|
|
5686
5686
|
return new Promise((i, o) => {
|
|
5687
5687
|
function n() {
|
|
5688
|
-
const r =
|
|
5689
|
-
if (r ===
|
|
5688
|
+
const r = c.clientWaitSync(s, t, 0);
|
|
5689
|
+
if (r === c.WAIT_FAILED) {
|
|
5690
5690
|
o();
|
|
5691
5691
|
return;
|
|
5692
5692
|
}
|
|
5693
|
-
if (r ===
|
|
5693
|
+
if (r === c.TIMEOUT_EXPIRED) {
|
|
5694
5694
|
setTimeout(n, e);
|
|
5695
5695
|
return;
|
|
5696
5696
|
}
|
|
@@ -5699,13 +5699,13 @@ function Pr(l, s, t, e) {
|
|
|
5699
5699
|
n();
|
|
5700
5700
|
});
|
|
5701
5701
|
}
|
|
5702
|
-
async function Mr(
|
|
5703
|
-
const r =
|
|
5704
|
-
|
|
5702
|
+
async function Mr(c, s, t, e, i, o, n) {
|
|
5703
|
+
const r = c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
5704
|
+
c.flush(), await Lr(c, r, 0, 10), c.deleteSync(r), c.bindBuffer(s, t), c.getBufferSubData(s, e, i, o, n), c.bindBuffer(s, null);
|
|
5705
5705
|
}
|
|
5706
|
-
async function wr(
|
|
5707
|
-
const a =
|
|
5708
|
-
return
|
|
5706
|
+
async function wr(c, s, t, e, i, o, n, r) {
|
|
5707
|
+
const a = c.createBuffer();
|
|
5708
|
+
return c.bindBuffer(c.PIXEL_PACK_BUFFER, a), c.bufferData(c.PIXEL_PACK_BUFFER, r.byteLength, c.STREAM_READ), c.readPixels(s, t, e, i, o, n, 0), c.bindBuffer(c.PIXEL_PACK_BUFFER, null), await Mr(c, c.PIXEL_PACK_BUFFER, a, 0, r), c.deleteBuffer(a), r;
|
|
5709
5709
|
}
|
|
5710
5710
|
class Dr {
|
|
5711
5711
|
constructor(s, t, e) {
|
|
@@ -5902,7 +5902,7 @@ class Ur extends Dr {
|
|
|
5902
5902
|
} else
|
|
5903
5903
|
a = n;
|
|
5904
5904
|
this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
|
|
5905
|
-
const
|
|
5905
|
+
const l = e ? t.count : 1, E = new O.InstancedMesh(i, a, l);
|
|
5906
5906
|
e ? E.instanceMatrix = t.instanceMatrix : E.setMatrixAt(0, new O.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;
|
|
5907
5907
|
}
|
|
5908
5908
|
remove(t) {
|
|
@@ -5926,12 +5926,12 @@ class Ur extends Dr {
|
|
|
5926
5926
|
const r = new O.Color(`rgb(${t}, ${e}, ${i})`);
|
|
5927
5927
|
if (!this.world.renderer)
|
|
5928
5928
|
throw new Error("Renderer not found in the world!");
|
|
5929
|
-
const a = this.world.renderer.clippingPlanes,
|
|
5929
|
+
const a = this.world.renderer.clippingPlanes, l = new O.MeshBasicMaterial({
|
|
5930
5930
|
color: r,
|
|
5931
5931
|
clippingPlanes: a,
|
|
5932
5932
|
side: O.DoubleSide
|
|
5933
5933
|
});
|
|
5934
|
-
return O.ColorManagement.enabled = n, { colorMaterial:
|
|
5934
|
+
return O.ColorManagement.enabled = n, { colorMaterial: l, code: o };
|
|
5935
5935
|
}
|
|
5936
5936
|
}
|
|
5937
5937
|
const Ye = class Ye extends it {
|
|
@@ -6018,8 +6018,8 @@ const At = class At extends it {
|
|
|
6018
6018
|
return new O.Sphere(r, a);
|
|
6019
6019
|
}
|
|
6020
6020
|
getMesh() {
|
|
6021
|
-
const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n),
|
|
6022
|
-
return this._meshes.push(
|
|
6021
|
+
const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n), l = new O.Mesh(a);
|
|
6022
|
+
return this._meshes.push(l), l.position.copy(r), l;
|
|
6023
6023
|
}
|
|
6024
6024
|
reset() {
|
|
6025
6025
|
this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
|
|
@@ -6035,8 +6035,8 @@ const At = class At extends it {
|
|
|
6035
6035
|
t.updateMatrixWorld();
|
|
6036
6036
|
const i = t.matrixWorld, o = new O.Matrix4(), n = t instanceof O.InstancedMesh, r = n ? t.count : 1;
|
|
6037
6037
|
for (let a = 0; a < r; a++) {
|
|
6038
|
-
const
|
|
6039
|
-
n && (t.getMatrixAt(a, o),
|
|
6038
|
+
const l = e.min.clone(), E = e.max.clone();
|
|
6039
|
+
n && (t.getMatrixAt(a, o), l.applyMatrix4(o), E.applyMatrix4(o)), l.applyMatrix4(i), E.applyMatrix4(i), l.x < this._absoluteMin.x && (this._absoluteMin.x = l.x), l.y < this._absoluteMin.y && (this._absoluteMin.y = l.y), l.z < this._absoluteMin.z && (this._absoluteMin.z = l.z), l.x > this._absoluteMax.x && (this._absoluteMax.x = l.x), l.y > this._absoluteMax.y && (this._absoluteMax.y = l.y), l.z > this._absoluteMax.z && (this._absoluteMax.z = l.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), 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);
|
|
6040
6040
|
}
|
|
6041
6041
|
}
|
|
6042
6042
|
static getFragmentBounds(t) {
|
|
@@ -6044,12 +6044,12 @@ const At = class At extends it {
|
|
|
6044
6044
|
if (!t.geometry.index)
|
|
6045
6045
|
throw new Error("Geometry must be indexed!");
|
|
6046
6046
|
const a = Array.from(t.geometry.index.array);
|
|
6047
|
-
for (let
|
|
6048
|
-
if (
|
|
6049
|
-
|
|
6047
|
+
for (let l = 0; l < a.length; l++) {
|
|
6048
|
+
if (l % 3 === 0 && a[l] === 0 && a[l + 1] === 0 && a[l + 2] === 0) {
|
|
6049
|
+
l += 2;
|
|
6050
6050
|
continue;
|
|
6051
6051
|
}
|
|
6052
|
-
const E = a[
|
|
6052
|
+
const E = a[l], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
|
|
6053
6053
|
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);
|
|
6054
6054
|
}
|
|
6055
6055
|
return new O.Box3(n, r);
|
|
@@ -6057,7 +6057,7 @@ const At = class At extends it {
|
|
|
6057
6057
|
};
|
|
6058
6058
|
I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
|
|
6059
6059
|
let fn = At;
|
|
6060
|
-
const
|
|
6060
|
+
const Ln = /* @__PURE__ */ new Set([
|
|
6061
6061
|
1123145078,
|
|
6062
6062
|
574549367,
|
|
6063
6063
|
1675464909,
|
|
@@ -6212,11 +6212,11 @@ class xr {
|
|
|
6212
6212
|
for (const a of r)
|
|
6213
6213
|
n.add(a);
|
|
6214
6214
|
for (const a of n) {
|
|
6215
|
-
if (
|
|
6215
|
+
if (Ln.has(a))
|
|
6216
6216
|
continue;
|
|
6217
|
-
const
|
|
6217
|
+
const l = r.has(a) && i, E = s.GetLineIDsWithType(t, a);
|
|
6218
6218
|
for (const d of E) {
|
|
6219
|
-
const h = s.GetLine(0, d,
|
|
6219
|
+
const h = s.GetLine(0, d, l, e);
|
|
6220
6220
|
o[h.expressID] = h;
|
|
6221
6221
|
}
|
|
6222
6222
|
}
|
|
@@ -6367,8 +6367,8 @@ class $r {
|
|
|
6367
6367
|
const e = {}, i = Object.keys(br).map((o) => parseInt(o, 10));
|
|
6368
6368
|
for (let o = 0; o < i.length; o++) {
|
|
6369
6369
|
const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
|
|
6370
|
-
for (let
|
|
6371
|
-
e[r.get(
|
|
6370
|
+
for (let l = 0; l < a; l++)
|
|
6371
|
+
e[r.get(l)] = n;
|
|
6372
6372
|
}
|
|
6373
6373
|
return e;
|
|
6374
6374
|
}
|
|
@@ -7547,8 +7547,8 @@ class Ft {
|
|
|
7547
7547
|
var a;
|
|
7548
7548
|
const o = e ?? (() => {
|
|
7549
7549
|
}), n = {}, r = s.getAllPropertiesIDs();
|
|
7550
|
-
for (const
|
|
7551
|
-
const E = await s.getProperties(
|
|
7550
|
+
for (const l of r) {
|
|
7551
|
+
const E = await s.getProperties(l);
|
|
7552
7552
|
if (!E)
|
|
7553
7553
|
continue;
|
|
7554
7554
|
const d = E.type === t, h = Object.keys(E).find(
|
|
@@ -7569,12 +7569,12 @@ class Ft {
|
|
|
7569
7569
|
static async getQsetQuantities(s, t, e) {
|
|
7570
7570
|
const o = e ?? (() => {
|
|
7571
7571
|
}), n = await s.getProperties(t);
|
|
7572
|
-
return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((
|
|
7572
|
+
return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
|
|
7573
7573
|
}
|
|
7574
7574
|
static async getPsetProps(s, t, e) {
|
|
7575
7575
|
const o = e ?? (() => {
|
|
7576
7576
|
}), n = await s.getProperties(t);
|
|
7577
|
-
return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((
|
|
7577
|
+
return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
|
|
7578
7578
|
}
|
|
7579
7579
|
static async getPsetRel(s, t) {
|
|
7580
7580
|
var r;
|
|
@@ -7759,8 +7759,8 @@ class Kr extends it {
|
|
|
7759
7759
|
});
|
|
7760
7760
|
for (const a of n) {
|
|
7761
7761
|
e[o].add(a);
|
|
7762
|
-
for (const
|
|
7763
|
-
e[
|
|
7762
|
+
for (const l of r)
|
|
7763
|
+
e[l].add(a);
|
|
7764
7764
|
e[a] || (e[a] = /* @__PURE__ */ new Set()), e[a].add(a);
|
|
7765
7765
|
}
|
|
7766
7766
|
}
|
|
@@ -7785,13 +7785,13 @@ class Kr extends it {
|
|
|
7785
7785
|
async find(t, e) {
|
|
7786
7786
|
const i = this.components.get(dt), o = e || i.groups.values(), n = {};
|
|
7787
7787
|
for (const a of o) {
|
|
7788
|
-
let
|
|
7789
|
-
|
|
7788
|
+
let l = this.indexedModels[a.uuid];
|
|
7789
|
+
l || (l = await this.indexEntityRelations(a));
|
|
7790
7790
|
let E = [];
|
|
7791
7791
|
for (const [u, p] of t.entries()) {
|
|
7792
7792
|
const R = /* @__PURE__ */ new Set(), A = this.simpleQuery(a, p, R), C = [];
|
|
7793
7793
|
for (const T of A) {
|
|
7794
|
-
const F =
|
|
7794
|
+
const F = l[T];
|
|
7795
7795
|
if (F) {
|
|
7796
7796
|
C.push(T);
|
|
7797
7797
|
for (const f of F)
|
|
@@ -7819,9 +7819,9 @@ class Kr extends it {
|
|
|
7819
7819
|
continue;
|
|
7820
7820
|
const r = t[o].modelEntities;
|
|
7821
7821
|
for (const a of r) {
|
|
7822
|
-
const
|
|
7823
|
-
if (
|
|
7824
|
-
for (const E of
|
|
7822
|
+
const l = n.data.get(a);
|
|
7823
|
+
if (l)
|
|
7824
|
+
for (const E of l[0]) {
|
|
7825
7825
|
const d = n.keyFragments.get(E);
|
|
7826
7826
|
if (!d)
|
|
7827
7827
|
throw new Error("Fragment ID not found!");
|
|
@@ -7836,24 +7836,24 @@ class Kr extends it {
|
|
|
7836
7836
|
if (!o)
|
|
7837
7837
|
throw new Error("Model has no properties");
|
|
7838
7838
|
let n = {}, r = 0, a = [];
|
|
7839
|
-
for (const
|
|
7839
|
+
for (const l of e.queries) {
|
|
7840
7840
|
let E = [];
|
|
7841
|
-
const d =
|
|
7842
|
-
if (
|
|
7841
|
+
const d = l.operator === "AND" ? n : o;
|
|
7842
|
+
if (l.condition) {
|
|
7843
7843
|
const u = this.getMatchingEntities(
|
|
7844
7844
|
d,
|
|
7845
|
-
|
|
7845
|
+
l,
|
|
7846
7846
|
i
|
|
7847
7847
|
);
|
|
7848
7848
|
E = u.expressIDs, n = { ...n, ...u.entities };
|
|
7849
7849
|
} else
|
|
7850
7850
|
E = [
|
|
7851
|
-
...this.simpleQuery(t,
|
|
7851
|
+
...this.simpleQuery(t, l, i)
|
|
7852
7852
|
];
|
|
7853
7853
|
a = r === 0 ? E : this.combineArrays(
|
|
7854
7854
|
a,
|
|
7855
7855
|
E,
|
|
7856
|
-
|
|
7856
|
+
l.operator ?? "AND"
|
|
7857
7857
|
// Defaults to AND if iterations > 0 and query.operator is not defined
|
|
7858
7858
|
), r++;
|
|
7859
7859
|
}
|
|
@@ -7862,7 +7862,7 @@ class Kr extends it {
|
|
|
7862
7862
|
getMatchingEntities(t, e, i) {
|
|
7863
7863
|
const { attribute: o, condition: n } = e;
|
|
7864
7864
|
let { value: r } = e;
|
|
7865
|
-
const a = !this._noHandleAttributes.includes(o),
|
|
7865
|
+
const a = !this._noHandleAttributes.includes(o), l = [], E = [];
|
|
7866
7866
|
for (const d in t) {
|
|
7867
7867
|
const h = t[d];
|
|
7868
7868
|
if (h === void 0)
|
|
@@ -7881,9 +7881,9 @@ class Kr extends it {
|
|
|
7881
7881
|
e.negateResult && i.add(h.expressID);
|
|
7882
7882
|
continue;
|
|
7883
7883
|
}
|
|
7884
|
-
|
|
7884
|
+
l.push(h.expressID), E.push(h);
|
|
7885
7885
|
}
|
|
7886
|
-
return { expressIDs:
|
|
7886
|
+
return { expressIDs: l, entities: E, excludedItems: i };
|
|
7887
7887
|
}
|
|
7888
7888
|
combineArrays(t, e, i) {
|
|
7889
7889
|
return i ? i === "AND" ? this.arrayIntersection(t, e) : this.arrayUnion(t, e) : e;
|
|
@@ -7915,211 +7915,137 @@ class Kr extends it {
|
|
|
7915
7915
|
};
|
|
7916
7916
|
}
|
|
7917
7917
|
}
|
|
7918
|
-
const
|
|
7918
|
+
const Ve = class Ve extends it {
|
|
7919
7919
|
constructor(t) {
|
|
7920
7920
|
super(t);
|
|
7921
7921
|
/** {@link Disposable.onDisposed} */
|
|
7922
7922
|
I(this, "onDisposed", new D());
|
|
7923
7923
|
I(this, "enabled", !0);
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
"HasAssociations",
|
|
7932
|
-
"ClassificationForObjects",
|
|
7933
|
-
"IsGroupedBy",
|
|
7934
|
-
"HasAssignments",
|
|
7935
|
-
"IsDefinedBy",
|
|
7936
|
-
"DefinesOcurrence",
|
|
7937
|
-
"IsTypedBy",
|
|
7938
|
-
"Types",
|
|
7939
|
-
"Defines",
|
|
7940
|
-
"ContainedInStructure",
|
|
7941
|
-
"ContainsElements"
|
|
7942
|
-
]);
|
|
7943
|
-
I(this, "inverseAttributesToProcess", [
|
|
7944
|
-
"HasAssignments",
|
|
7945
|
-
"IsDecomposedBy",
|
|
7946
|
-
"IsDefinedBy",
|
|
7947
|
-
"IsTypedBy",
|
|
7948
|
-
"HasAssociations",
|
|
7949
|
-
"ContainedInStructure"
|
|
7924
|
+
I(this, "relationsToProcess", [
|
|
7925
|
+
b.IFCRELDEFINESBYPROPERTIES,
|
|
7926
|
+
b.IFCRELDEFINESBYTYPE,
|
|
7927
|
+
b.IFCRELASSOCIATESMATERIAL,
|
|
7928
|
+
b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
7929
|
+
b.IFCRELASSOCIATESCLASSIFICATION,
|
|
7930
|
+
b.IFCRELASSIGNSTOGROUP
|
|
7950
7931
|
]);
|
|
7951
|
-
I(this, "
|
|
7952
|
-
I(this, "
|
|
7932
|
+
I(this, "indexMap", {});
|
|
7933
|
+
I(this, "_propertiesManager", null);
|
|
7934
|
+
I(this, "onPropertiesManagerSet", new D());
|
|
7953
7935
|
I(this, "onFragmentsDisposed", (t) => {
|
|
7954
|
-
delete this.
|
|
7936
|
+
delete this.indexMap[t.groupID];
|
|
7955
7937
|
});
|
|
7956
|
-
this.components.add(
|
|
7938
|
+
this.components.add(Ve.uuid, this), t.get(dt).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
7957
7939
|
}
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
}
|
|
7964
|
-
return e;
|
|
7940
|
+
// private _entityUIPool: UIPool<TreeView>;
|
|
7941
|
+
set propertiesManager(t) {
|
|
7942
|
+
this._propertiesManager || (this._propertiesManager = t, t && (t.onElementToPset.add(async ({ model: e, psetID: i, elementID: o }) => {
|
|
7943
|
+
this.indexMap[e.uuid] && this.setEntityIndex(e, o).add(i);
|
|
7944
|
+
}), this.onPropertiesManagerSet.trigger(t)));
|
|
7965
7945
|
}
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
this._relToAttributesMap.set(b.IFCRELAGGREGATES, {
|
|
7969
|
-
forRelating: "IsDecomposedBy",
|
|
7970
|
-
forRelated: "Decomposes"
|
|
7971
|
-
}), this._relToAttributesMap.set(b.IFCRELASSOCIATESMATERIAL, {
|
|
7972
|
-
forRelating: "AssociatedTo",
|
|
7973
|
-
forRelated: "HasAssociations"
|
|
7974
|
-
}), this._relToAttributesMap.set(b.IFCRELASSOCIATESCLASSIFICATION, {
|
|
7975
|
-
forRelating: "ClassificationForObjects",
|
|
7976
|
-
forRelated: "HasAssociations"
|
|
7977
|
-
}), this._relToAttributesMap.set(b.IFCRELASSIGNSTOGROUP, {
|
|
7978
|
-
forRelating: "IsGroupedBy",
|
|
7979
|
-
forRelated: "HasAssignments"
|
|
7980
|
-
}), this._relToAttributesMap.set(b.IFCRELDEFINESBYPROPERTIES, {
|
|
7981
|
-
forRelated: "IsDefinedBy",
|
|
7982
|
-
forRelating: "DefinesOcurrence"
|
|
7983
|
-
}), this._relToAttributesMap.set(b.IFCRELDEFINESBYTYPE, {
|
|
7984
|
-
forRelated: "IsTypedBy",
|
|
7985
|
-
forRelating: "Types"
|
|
7986
|
-
}), this._relToAttributesMap.set(b.IFCRELDEFINESBYTEMPLATE, {
|
|
7987
|
-
forRelated: "IsDefinedBy",
|
|
7988
|
-
forRelating: "Defines"
|
|
7989
|
-
}), this._relToAttributesMap.set(b.IFCRELCONTAINEDINSPATIALSTRUCTURE, {
|
|
7990
|
-
forRelated: "ContainedInStructure",
|
|
7991
|
-
forRelating: "ContainsElements"
|
|
7992
|
-
});
|
|
7946
|
+
get propertiesManager() {
|
|
7947
|
+
return this._propertiesManager;
|
|
7993
7948
|
}
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
7997
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
7998
|
-
*
|
|
7999
|
-
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
8000
|
-
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
8001
|
-
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
8002
|
-
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
8003
|
-
* of entities that are related through that attribute.
|
|
8004
|
-
*
|
|
8005
|
-
* @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
|
|
8006
|
-
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
8007
|
-
* representation of the relations indexed by entity expressIDs and relation types.
|
|
8008
|
-
* @throws An error if the model does not have properties loaded.
|
|
8009
|
-
*/
|
|
8010
|
-
async process(t) {
|
|
8011
|
-
if (!t.hasProperties)
|
|
8012
|
-
throw new Error("FragmentsGroup properties not found");
|
|
8013
|
-
this.relationMaps[t.uuid] = /* @__PURE__ */ new Map();
|
|
8014
|
-
const e = this.relationMaps[t.uuid];
|
|
8015
|
-
for (const i of this.inverseAttributesToProcess) {
|
|
8016
|
-
const o = this.getAttributeRels(i);
|
|
8017
|
-
for (const n of o)
|
|
8018
|
-
await Ft.getRelationMap(
|
|
8019
|
-
t,
|
|
8020
|
-
n,
|
|
8021
|
-
async (r, a) => {
|
|
8022
|
-
const c = this._relToAttributesMap.get(n);
|
|
8023
|
-
if (!c)
|
|
8024
|
-
return;
|
|
8025
|
-
const { forRelated: E, forRelating: d } = c;
|
|
8026
|
-
if (d && this.inverseAttributesToProcess.includes(d)) {
|
|
8027
|
-
const h = e.get(r) ?? /* @__PURE__ */ new Map(), u = this.inverseAttributes.indexOf(d);
|
|
8028
|
-
h.set(u, a), e.set(r, h);
|
|
8029
|
-
}
|
|
8030
|
-
if (E && this.inverseAttributesToProcess.includes(E))
|
|
8031
|
-
for (const h of a) {
|
|
8032
|
-
const u = e.get(h) ?? /* @__PURE__ */ new Map(), p = this.inverseAttributes.indexOf(E), R = u.get(p) ?? [];
|
|
8033
|
-
R.push(r), u.set(p, R), e.set(h, u);
|
|
8034
|
-
}
|
|
8035
|
-
}
|
|
8036
|
-
);
|
|
8037
|
-
}
|
|
8038
|
-
return e;
|
|
7949
|
+
async dispose() {
|
|
7950
|
+
this.indexMap = {}, this.propertiesManager = null, this.onPropertiesManagerSet.reset(), this.components.get(dt).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
|
|
8039
7951
|
}
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
* This method searches the indexed relation maps for the specified model and entity,
|
|
8043
|
-
* returning the IDs of related entities if a match is found.
|
|
8044
|
-
*
|
|
8045
|
-
* @param model The `FragmentsGroup` model containing the entity.
|
|
8046
|
-
* @param expressID The unique identifier of the entity within the model.
|
|
8047
|
-
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
8048
|
-
* @returns An array of express IDs representing the related entities, or `null` if no relations are found
|
|
8049
|
-
* or the specified relation name is not indexed.
|
|
8050
|
-
*/
|
|
8051
|
-
getEntityRelations(t, e, i) {
|
|
8052
|
-
const o = this.relationMaps[t.uuid];
|
|
8053
|
-
if (!o)
|
|
7952
|
+
async getProperties(t, e) {
|
|
7953
|
+
if (!t.hasProperties)
|
|
8054
7954
|
return null;
|
|
8055
|
-
const
|
|
8056
|
-
if (
|
|
7955
|
+
const i = t.getLocalProperties();
|
|
7956
|
+
if (i === void 0)
|
|
8057
7957
|
return null;
|
|
8058
|
-
const
|
|
8059
|
-
|
|
8060
|
-
}
|
|
8061
|
-
/**
|
|
8062
|
-
* Serializes the relations of a specific model into a JSON string.
|
|
8063
|
-
* This method iterates through the relations indexed for the given model,
|
|
8064
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
8065
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
8066
|
-
* The resulting object is then serialized into a JSON string.
|
|
8067
|
-
*
|
|
8068
|
-
* @param model The `FragmentsGroup` model whose relations are to be serialized.
|
|
8069
|
-
* @returns A JSON string representing the serialized relations of the specified model.
|
|
8070
|
-
* If the model has no indexed relations, `null` is returned.
|
|
8071
|
-
*/
|
|
8072
|
-
serializeModelRelations(t) {
|
|
8073
|
-
const e = this.relationMaps[t.uuid];
|
|
8074
|
-
if (!e)
|
|
7958
|
+
const o = this.indexMap[t.uuid];
|
|
7959
|
+
if (!o)
|
|
8075
7960
|
return null;
|
|
8076
|
-
const
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
7961
|
+
const n = o[e], r = parseInt(e, 10), a = await t.getProperties(r);
|
|
7962
|
+
if (!a)
|
|
7963
|
+
throw new Error("Properties not found!");
|
|
7964
|
+
const l = this.cloneProperty(a);
|
|
7965
|
+
if (!l)
|
|
7966
|
+
throw new Error("Properties not found!");
|
|
7967
|
+
const E = [l];
|
|
7968
|
+
if (n)
|
|
7969
|
+
for (const d of n) {
|
|
7970
|
+
const h = await t.getProperties(d);
|
|
7971
|
+
if (!h)
|
|
7972
|
+
continue;
|
|
7973
|
+
const u = this.cloneProperty(h);
|
|
7974
|
+
u && (this.getPsetProperties(u, i), this.getNestedPsets(u, i), E.push(u));
|
|
7975
|
+
}
|
|
7976
|
+
return E;
|
|
8083
7977
|
}
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
8090
|
-
*
|
|
8091
|
-
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
8092
|
-
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
8093
|
-
*/
|
|
8094
|
-
serializeRelations() {
|
|
8095
|
-
const t = {};
|
|
8096
|
-
for (const e in this.relationMaps) {
|
|
8097
|
-
const i = this.relationMaps[e], o = {};
|
|
8098
|
-
for (const [n, r] of i.entries()) {
|
|
8099
|
-
o[n] || (o[n] = {});
|
|
8100
|
-
for (const [a, c] of r.entries())
|
|
8101
|
-
o[n][a] = c;
|
|
7978
|
+
getNestedPsets(t, e) {
|
|
7979
|
+
if (t.HasPropertySets)
|
|
7980
|
+
for (const i of t.HasPropertySets) {
|
|
7981
|
+
const o = i.value;
|
|
7982
|
+
i.value = this.cloneProperty(e[o]), this.getPsetProperties(i.value, e);
|
|
8102
7983
|
}
|
|
8103
|
-
t[e] = o;
|
|
8104
|
-
}
|
|
8105
|
-
return JSON.stringify(t);
|
|
8106
7984
|
}
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
7985
|
+
getPsetProperties(t, e) {
|
|
7986
|
+
if (t.HasProperties)
|
|
7987
|
+
for (const i of t.HasProperties) {
|
|
7988
|
+
const o = i.value, n = this.cloneProperty(e[o]);
|
|
7989
|
+
i.value = { ...n };
|
|
7990
|
+
}
|
|
7991
|
+
}
|
|
7992
|
+
async process(t) {
|
|
7993
|
+
if (!t.hasProperties)
|
|
7994
|
+
throw new Error("FragmentsGroup properties not found");
|
|
7995
|
+
this.indexMap[t.uuid] = {};
|
|
7996
|
+
const e = [b.IFCPROPERTYSET, b.IFCELEMENTQUANTITY];
|
|
7997
|
+
for (const i of this.relationsToProcess)
|
|
7998
|
+
await Ft.getRelationMap(
|
|
7999
|
+
t,
|
|
8000
|
+
i,
|
|
8001
|
+
// eslint-disable-next-line no-loop-func
|
|
8002
|
+
async (o, n) => {
|
|
8003
|
+
const r = await t.getProperties(o);
|
|
8004
|
+
if (r) {
|
|
8005
|
+
e.includes(r.type) || this.setEntityIndex(t, o);
|
|
8006
|
+
for (const a of n)
|
|
8007
|
+
this.setEntityIndex(t, a).add(o);
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
);
|
|
8011
|
+
}
|
|
8012
|
+
setEntityIndex(t, e) {
|
|
8013
|
+
return this.indexMap[t.uuid][e] || (this.indexMap[t.uuid][e] = /* @__PURE__ */ new Set()), this.indexMap[t.uuid][e];
|
|
8014
|
+
}
|
|
8015
|
+
cloneProperty(t, e = {}) {
|
|
8016
|
+
if (!t)
|
|
8017
|
+
return e;
|
|
8018
|
+
for (const i in t) {
|
|
8019
|
+
const o = t[i], n = Array.isArray(o), r = typeof o == "object" && !n && o !== null;
|
|
8020
|
+
if (n) {
|
|
8021
|
+
e[i] = [];
|
|
8022
|
+
const a = e[i];
|
|
8023
|
+
this.clonePropertyArray(o, a);
|
|
8024
|
+
} else if (r) {
|
|
8025
|
+
e[i] = {};
|
|
8026
|
+
const a = e[i];
|
|
8027
|
+
this.cloneProperty(o, a);
|
|
8028
|
+
} else
|
|
8029
|
+
e[i] = o;
|
|
8114
8030
|
}
|
|
8115
|
-
return
|
|
8031
|
+
return e;
|
|
8116
8032
|
}
|
|
8117
|
-
|
|
8118
|
-
|
|
8033
|
+
clonePropertyArray(t, e) {
|
|
8034
|
+
for (const i of t) {
|
|
8035
|
+
const o = Array.isArray(i), n = typeof i == "object" && !o && i !== null;
|
|
8036
|
+
if (o) {
|
|
8037
|
+
const r = [];
|
|
8038
|
+
e.push(r), this.clonePropertyArray(i, r);
|
|
8039
|
+
} else if (n) {
|
|
8040
|
+
const r = {};
|
|
8041
|
+
e.push(r), this.cloneProperty(i, r);
|
|
8042
|
+
} else
|
|
8043
|
+
e.push(i);
|
|
8044
|
+
}
|
|
8119
8045
|
}
|
|
8120
8046
|
};
|
|
8121
|
-
I(
|
|
8122
|
-
let pn =
|
|
8047
|
+
I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
|
|
8048
|
+
let pn = Ve;
|
|
8123
8049
|
class vr {
|
|
8124
8050
|
constructor() {
|
|
8125
8051
|
I(this, "factor", 1);
|
|
@@ -8191,11 +8117,11 @@ class wn {
|
|
|
8191
8117
|
0,
|
|
8192
8118
|
b.IFCRELCONTAINEDINSPATIALSTRUCTURE
|
|
8193
8119
|
), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, b.IFCSPACE);
|
|
8194
|
-
for (let
|
|
8195
|
-
e.add(i.get(
|
|
8120
|
+
for (let l = 0; l < i.size(); l++)
|
|
8121
|
+
e.add(i.get(l));
|
|
8196
8122
|
const o = s.GetLineIDsWithType(0, b.IFCRELAGGREGATES), n = o.size();
|
|
8197
|
-
for (let
|
|
8198
|
-
const E = o.get(
|
|
8123
|
+
for (let l = 0; l < n; l++) {
|
|
8124
|
+
const E = o.get(l), d = s.GetLine(0, E);
|
|
8199
8125
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8200
8126
|
continue;
|
|
8201
8127
|
const h = d.RelatingObject.value, u = d.RelatedObjects;
|
|
@@ -8205,8 +8131,8 @@ class wn {
|
|
|
8205
8131
|
}
|
|
8206
8132
|
}
|
|
8207
8133
|
const r = {}, a = t.size();
|
|
8208
|
-
for (let
|
|
8209
|
-
const E = t.get(
|
|
8134
|
+
for (let l = 0; l < a; l++) {
|
|
8135
|
+
const E = t.get(l), d = s.GetLine(0, E);
|
|
8210
8136
|
if (!d || !d.RelatingStructure || !d.RelatedElements)
|
|
8211
8137
|
continue;
|
|
8212
8138
|
const h = d.RelatingStructure.value, u = d.RelatedElements;
|
|
@@ -8222,16 +8148,16 @@ class wn {
|
|
|
8222
8148
|
this.itemsByFloor[R] = h;
|
|
8223
8149
|
}
|
|
8224
8150
|
}
|
|
8225
|
-
for (const
|
|
8226
|
-
const E = this.itemsByFloor[
|
|
8151
|
+
for (const l in r) {
|
|
8152
|
+
const E = this.itemsByFloor[l];
|
|
8227
8153
|
if (E !== void 0) {
|
|
8228
|
-
const d = r[
|
|
8154
|
+
const d = r[l];
|
|
8229
8155
|
for (const h of d)
|
|
8230
8156
|
this.itemsByFloor[h] = E;
|
|
8231
8157
|
}
|
|
8232
8158
|
}
|
|
8233
|
-
for (let
|
|
8234
|
-
const E = o.get(
|
|
8159
|
+
for (let l = 0; l < n; l++) {
|
|
8160
|
+
const E = o.get(l), d = s.GetLine(0, E);
|
|
8235
8161
|
if (!d || !d.RelatingObject || !d.RelatedObjects)
|
|
8236
8162
|
continue;
|
|
8237
8163
|
const h = d.RelatingObject.value, u = d.RelatedObjects;
|
|
@@ -8315,8 +8241,8 @@ class Dn {
|
|
|
8315
8241
|
const { x: u, y: p, z: R } = r[h];
|
|
8316
8242
|
a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = R || 0;
|
|
8317
8243
|
}
|
|
8318
|
-
const
|
|
8319
|
-
E.setAttribute("position",
|
|
8244
|
+
const l = new O.BufferAttribute(a, 3), E = new O.EdgesGeometry();
|
|
8245
|
+
E.setAttribute("position", l);
|
|
8320
8246
|
const d = new $t.CurveMesh(
|
|
8321
8247
|
i,
|
|
8322
8248
|
n,
|
|
@@ -8345,7 +8271,7 @@ class Un {
|
|
|
8345
8271
|
return e;
|
|
8346
8272
|
}
|
|
8347
8273
|
}
|
|
8348
|
-
const
|
|
8274
|
+
const Ge = class Ge extends it {
|
|
8349
8275
|
constructor(t) {
|
|
8350
8276
|
super(t);
|
|
8351
8277
|
I(this, "onIfcStartedLoading", new D());
|
|
@@ -8366,10 +8292,10 @@ const Ve = class Ve extends it {
|
|
|
8366
8292
|
transparent: !0,
|
|
8367
8293
|
opacity: 0.5
|
|
8368
8294
|
}));
|
|
8369
|
-
this.components.add(
|
|
8295
|
+
this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
|
|
8370
8296
|
}
|
|
8371
8297
|
dispose() {
|
|
8372
|
-
this.webIfc = null, this.onDisposed.trigger(
|
|
8298
|
+
this.webIfc = null, this.onDisposed.trigger(Ge.uuid), this.onDisposed.reset();
|
|
8373
8299
|
}
|
|
8374
8300
|
async setup(t) {
|
|
8375
8301
|
this.settings = { ...this.settings, ...t }, this.settings.autoSetWasm && await this.autoSetWasm(), this.onSetup.trigger();
|
|
@@ -8402,9 +8328,9 @@ const Ve = class Ve extends it {
|
|
|
8402
8328
|
for (const a of t) {
|
|
8403
8329
|
if (!this.webIfc.IsIfcElement(a) && a !== b.IFCSPACE || this.settings.excludedCategories.has(a))
|
|
8404
8330
|
continue;
|
|
8405
|
-
const
|
|
8331
|
+
const l = this.webIfc.GetLineIDsWithType(0, a), E = l.size();
|
|
8406
8332
|
for (let d = 0; d < E; d++) {
|
|
8407
|
-
const h =
|
|
8333
|
+
const h = l.get(d);
|
|
8408
8334
|
n.push(h);
|
|
8409
8335
|
const u = this._spatialTree.itemsByFloor[h] || 0;
|
|
8410
8336
|
e.data.set(h, [[], [u, a]]);
|
|
@@ -8414,15 +8340,15 @@ const Ve = class Ve extends it {
|
|
|
8414
8340
|
this.getMesh(a, e);
|
|
8415
8341
|
});
|
|
8416
8342
|
for (const a of this._visitedFragments) {
|
|
8417
|
-
const { index:
|
|
8418
|
-
e.keyFragments.set(
|
|
8343
|
+
const { index: l, fragment: E } = a[1];
|
|
8344
|
+
e.keyFragments.set(l, E.id);
|
|
8419
8345
|
}
|
|
8420
8346
|
for (const a of e.items) {
|
|
8421
|
-
const
|
|
8422
|
-
if (!
|
|
8347
|
+
const l = this._fragmentInstances.get(a.id);
|
|
8348
|
+
if (!l)
|
|
8423
8349
|
throw new Error("Fragment not found!");
|
|
8424
8350
|
const E = [];
|
|
8425
|
-
for (const [d, h] of
|
|
8351
|
+
for (const [d, h] of l)
|
|
8426
8352
|
E.push(h);
|
|
8427
8353
|
a.add(E);
|
|
8428
8354
|
}
|
|
@@ -8435,14 +8361,14 @@ const Ve = class Ve extends it {
|
|
|
8435
8361
|
getMesh(t, e) {
|
|
8436
8362
|
const i = t.geometries.size(), o = t.expressID;
|
|
8437
8363
|
for (let n = 0; n < i; n++) {
|
|
8438
|
-
const r = t.geometries.get(n), { x: a, y:
|
|
8364
|
+
const r = t.geometries.get(n), { x: a, y: l, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
|
|
8439
8365
|
if (!this._visitedFragments.has(p)) {
|
|
8440
8366
|
const m = this.getGeometry(this.webIfc, u), g = h ? this._materialT : this._material, S = new $t.Fragment(m, g, 1);
|
|
8441
8367
|
e.add(S.mesh), e.items.push(S);
|
|
8442
8368
|
const _ = this._visitedFragments.size;
|
|
8443
8369
|
this._visitedFragments.set(p, { index: _, fragment: S });
|
|
8444
8370
|
}
|
|
8445
|
-
const R = new O.Color().setRGB(a,
|
|
8371
|
+
const R = new O.Color().setRGB(a, l, E, "srgb"), A = new O.Matrix4();
|
|
8446
8372
|
A.fromArray(r.flatTransformation);
|
|
8447
8373
|
const C = this._visitedFragments.get(p);
|
|
8448
8374
|
if (C === void 0)
|
|
@@ -8475,8 +8401,8 @@ const Ve = class Ve extends it {
|
|
|
8475
8401
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
8476
8402
|
for (let h = 0; h < n.length; h += 6)
|
|
8477
8403
|
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];
|
|
8478
|
-
const
|
|
8479
|
-
return
|
|
8404
|
+
const l = new O.BufferGeometry(), E = new O.BufferAttribute(r, 3), d = new O.BufferAttribute(a, 3);
|
|
8405
|
+
return l.setAttribute("position", E), l.setAttribute("normal", d), l.setIndex(Array.from(o)), i.delete(), l;
|
|
8480
8406
|
}
|
|
8481
8407
|
async autoSetWasm() {
|
|
8482
8408
|
const t = await fetch(
|
|
@@ -8499,8 +8425,8 @@ const Ve = class Ve extends it {
|
|
|
8499
8425
|
}
|
|
8500
8426
|
}
|
|
8501
8427
|
};
|
|
8502
|
-
I(
|
|
8503
|
-
let Ii =
|
|
8428
|
+
I(Ge, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
|
|
8429
|
+
let Ii = Ge;
|
|
8504
8430
|
const Yt = class Yt extends it {
|
|
8505
8431
|
constructor(t) {
|
|
8506
8432
|
super(t);
|
|
@@ -8562,11 +8488,11 @@ const Yt = class Yt extends it {
|
|
|
8562
8488
|
}
|
|
8563
8489
|
}
|
|
8564
8490
|
async newPset(t, e, i) {
|
|
8565
|
-
const o = Yt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(e),
|
|
8491
|
+
const o = Yt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(e), l = i ? new b[o].IfcText(i) : null, E = new b[o].IfcPropertySet(
|
|
8566
8492
|
r,
|
|
8567
8493
|
n,
|
|
8568
8494
|
a,
|
|
8569
|
-
|
|
8495
|
+
l,
|
|
8570
8496
|
[]
|
|
8571
8497
|
);
|
|
8572
8498
|
E.expressID = this.increaseMaxID(t);
|
|
@@ -8594,13 +8520,13 @@ const Yt = class Yt extends it {
|
|
|
8594
8520
|
}
|
|
8595
8521
|
}
|
|
8596
8522
|
async newSingleProperty(t, e, i, o) {
|
|
8597
|
-
const n = Yt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o),
|
|
8523
|
+
const n = Yt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o), l = new b[n].IfcPropertySingleValue(
|
|
8598
8524
|
r,
|
|
8599
8525
|
null,
|
|
8600
8526
|
a,
|
|
8601
8527
|
null
|
|
8602
8528
|
);
|
|
8603
|
-
return
|
|
8529
|
+
return l.expressID = this.increaseMaxID(t), await this.setData(t, l), l;
|
|
8604
8530
|
}
|
|
8605
8531
|
newSingleStringProperty(t, e, i, o) {
|
|
8606
8532
|
return this.newSingleProperty(t, e, i, o);
|
|
@@ -8646,8 +8572,8 @@ const Yt = class Yt extends it {
|
|
|
8646
8572
|
}
|
|
8647
8573
|
async saveToIfc(t, e) {
|
|
8648
8574
|
const i = this.components.get(Ii), o = i.webIfc, n = await i.readIfcFile(e), r = this._changeMap[t.uuid] ?? [];
|
|
8649
|
-
for (const
|
|
8650
|
-
const E = await t.getProperties(
|
|
8575
|
+
for (const l of r) {
|
|
8576
|
+
const E = await t.getProperties(l);
|
|
8651
8577
|
if (E)
|
|
8652
8578
|
try {
|
|
8653
8579
|
o.WriteLine(n, E);
|
|
@@ -8655,7 +8581,7 @@ const Yt = class Yt extends it {
|
|
|
8655
8581
|
}
|
|
8656
8582
|
else
|
|
8657
8583
|
try {
|
|
8658
|
-
o.DeleteLine(n,
|
|
8584
|
+
o.DeleteLine(n, l);
|
|
8659
8585
|
} catch {
|
|
8660
8586
|
}
|
|
8661
8587
|
}
|
|
@@ -8678,15 +8604,15 @@ const Yt = class Yt extends it {
|
|
|
8678
8604
|
const a = r.value;
|
|
8679
8605
|
if (a === void 0 || a == null)
|
|
8680
8606
|
throw new Error(`Attribute ${i} has a badly defined handle.`);
|
|
8681
|
-
const
|
|
8607
|
+
const l = new D();
|
|
8682
8608
|
return Object.defineProperty(n[i], "value", {
|
|
8683
8609
|
get() {
|
|
8684
8610
|
return this._value;
|
|
8685
8611
|
},
|
|
8686
8612
|
async set(E) {
|
|
8687
|
-
this._value = E,
|
|
8613
|
+
this._value = E, l.trigger(E);
|
|
8688
8614
|
}
|
|
8689
|
-
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] =
|
|
8615
|
+
}), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = l, l;
|
|
8690
8616
|
}
|
|
8691
8617
|
};
|
|
8692
8618
|
I(Yt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
|
|
@@ -8707,10 +8633,10 @@ const _s = class _s extends it {
|
|
|
8707
8633
|
delete n[e], Object.values(n).length === 0 && delete this._groupSystems[o];
|
|
8708
8634
|
else
|
|
8709
8635
|
for (const a of r) {
|
|
8710
|
-
const
|
|
8636
|
+
const l = n[a];
|
|
8711
8637
|
for (const E of i)
|
|
8712
|
-
delete
|
|
8713
|
-
Object.values(
|
|
8638
|
+
delete l[E];
|
|
8639
|
+
Object.values(l).length === 0 && delete n[a];
|
|
8714
8640
|
}
|
|
8715
8641
|
}
|
|
8716
8642
|
});
|
|
@@ -8736,8 +8662,8 @@ const _s = class _s extends it {
|
|
|
8736
8662
|
const e = this.components.get(dt);
|
|
8737
8663
|
if (!t) {
|
|
8738
8664
|
const r = {};
|
|
8739
|
-
for (const [a,
|
|
8740
|
-
r[a] = new Set(
|
|
8665
|
+
for (const [a, l] of e.list)
|
|
8666
|
+
r[a] = new Set(l.ids);
|
|
8741
8667
|
return r;
|
|
8742
8668
|
}
|
|
8743
8669
|
const i = Object.keys(t).length, o = {};
|
|
@@ -8747,8 +8673,8 @@ const _s = class _s extends it {
|
|
|
8747
8673
|
console.warn(`Classification ${r} does not exist.`);
|
|
8748
8674
|
continue;
|
|
8749
8675
|
}
|
|
8750
|
-
for (const
|
|
8751
|
-
const E = this._groupSystems[r][
|
|
8676
|
+
for (const l of a) {
|
|
8677
|
+
const E = this._groupSystems[r][l];
|
|
8752
8678
|
if (E)
|
|
8753
8679
|
for (const d in E) {
|
|
8754
8680
|
o[d] || (o[d] = /* @__PURE__ */ new Map());
|
|
@@ -8762,10 +8688,10 @@ const _s = class _s extends it {
|
|
|
8762
8688
|
const n = {};
|
|
8763
8689
|
for (const r in o) {
|
|
8764
8690
|
const a = o[r];
|
|
8765
|
-
for (const [
|
|
8691
|
+
for (const [l, E] of a) {
|
|
8766
8692
|
if (E === void 0)
|
|
8767
8693
|
throw new Error("Malformed fragments map!");
|
|
8768
|
-
E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(
|
|
8694
|
+
E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(l));
|
|
8769
8695
|
}
|
|
8770
8696
|
}
|
|
8771
8697
|
return n;
|
|
@@ -8777,8 +8703,8 @@ const _s = class _s extends it {
|
|
|
8777
8703
|
const o = i[t];
|
|
8778
8704
|
for (const [n, r] of e.data) {
|
|
8779
8705
|
const a = r[0];
|
|
8780
|
-
for (const
|
|
8781
|
-
const E = e.keyFragments.get(
|
|
8706
|
+
for (const l of a) {
|
|
8707
|
+
const E = e.keyFragments.get(l);
|
|
8782
8708
|
E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
|
|
8783
8709
|
}
|
|
8784
8710
|
}
|
|
@@ -8793,14 +8719,14 @@ const _s = class _s extends it {
|
|
|
8793
8719
|
continue;
|
|
8794
8720
|
const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
|
|
8795
8721
|
e[a] || (e[a] = {});
|
|
8796
|
-
const
|
|
8722
|
+
const l = e[a];
|
|
8797
8723
|
for (const [E, d] of t.data) {
|
|
8798
8724
|
const h = d[0];
|
|
8799
8725
|
for (const u of h) {
|
|
8800
8726
|
const p = t.keyFragments.get(u);
|
|
8801
8727
|
if (!p)
|
|
8802
8728
|
throw new Error("Fragment ID not found!");
|
|
8803
|
-
|
|
8729
|
+
l[p] || (l[p] = /* @__PURE__ */ new Set()), l[p].add(r.expressID);
|
|
8804
8730
|
}
|
|
8805
8731
|
}
|
|
8806
8732
|
}
|
|
@@ -8844,8 +8770,8 @@ const _s = class _s extends it {
|
|
|
8844
8770
|
for (const r of n[0]) {
|
|
8845
8771
|
const a = t.keyFragments.get(r);
|
|
8846
8772
|
if (a) {
|
|
8847
|
-
const
|
|
8848
|
-
|
|
8773
|
+
const l = this._groupSystems[e];
|
|
8774
|
+
l[i] || (l[i] = {}), l[i][a] || (l[i][a] = /* @__PURE__ */ new Set()), l[i][a].add(o);
|
|
8849
8775
|
}
|
|
8850
8776
|
}
|
|
8851
8777
|
}
|
|
@@ -8876,14 +8802,14 @@ const ze = class ze extends it {
|
|
|
8876
8802
|
const t = this.components.get(fi), e = this.components.get(dt), i = this.enabled ? 1 : -1;
|
|
8877
8803
|
let o = 0;
|
|
8878
8804
|
const r = t.get()[this.groupName], a = new O.Matrix4();
|
|
8879
|
-
for (const
|
|
8805
|
+
for (const l in r) {
|
|
8880
8806
|
a.elements[13] = o * i * this.height;
|
|
8881
|
-
for (const E in r[
|
|
8882
|
-
const d = e.list.get(E), h =
|
|
8807
|
+
for (const E in r[l]) {
|
|
8808
|
+
const d = e.list.get(E), h = l + E, u = this.list.has(h);
|
|
8883
8809
|
if (!d || this.enabled && u || !this.enabled && !u)
|
|
8884
8810
|
continue;
|
|
8885
8811
|
this.enabled ? this.list.add(h) : this.list.delete(h);
|
|
8886
|
-
const p = r[
|
|
8812
|
+
const p = r[l][E];
|
|
8887
8813
|
d.applyTransform(p, a);
|
|
8888
8814
|
}
|
|
8889
8815
|
o++;
|
|
@@ -8938,7 +8864,7 @@ class Yr extends gi {
|
|
|
8938
8864
|
I(this, "propertiesSize", 100);
|
|
8939
8865
|
}
|
|
8940
8866
|
}
|
|
8941
|
-
class
|
|
8867
|
+
class Vr extends it {
|
|
8942
8868
|
constructor() {
|
|
8943
8869
|
super(...arguments);
|
|
8944
8870
|
I(this, "onPropertiesStreamed", new D());
|
|
@@ -8988,7 +8914,7 @@ class Gr extends it {
|
|
|
8988
8914
|
e.add(E);
|
|
8989
8915
|
let r = 0.01, a = 0;
|
|
8990
8916
|
for (const E of e) {
|
|
8991
|
-
if (a++,
|
|
8917
|
+
if (a++, Ln.has(E))
|
|
8992
8918
|
continue;
|
|
8993
8919
|
const d = n.has(E), h = this.webIfc.GetLineIDsWithType(0, E), u = h.size();
|
|
8994
8920
|
let p = 0;
|
|
@@ -9022,10 +8948,10 @@ class Gr extends it {
|
|
|
9022
8948
|
const R = a / e.size;
|
|
9023
8949
|
R > r && (r += 0.01, r = Math.max(r, R), await this.onProgress.trigger(Math.round(r * 100) / 100));
|
|
9024
8950
|
}
|
|
9025
|
-
const
|
|
8951
|
+
const l = [];
|
|
9026
8952
|
for (const [E, d] of o)
|
|
9027
|
-
|
|
9028
|
-
await this.onIndicesStreamed.trigger(
|
|
8953
|
+
l.push([E, ...d]);
|
|
8954
|
+
await this.onIndicesStreamed.trigger(l);
|
|
9029
8955
|
}
|
|
9030
8956
|
getIndices(t, e, i) {
|
|
9031
8957
|
const o = t.RelatedObjects || t.RelatedElements;
|
|
@@ -9044,16 +8970,16 @@ class Gr extends it {
|
|
|
9044
8970
|
for (const a of o) {
|
|
9045
8971
|
if (a.value === void 0 || a.value === null)
|
|
9046
8972
|
continue;
|
|
9047
|
-
const
|
|
9048
|
-
i.has(
|
|
8973
|
+
const l = a.value;
|
|
8974
|
+
i.has(l) || i.set(l, /* @__PURE__ */ new Set()), i.get(l).add(r);
|
|
9049
8975
|
}
|
|
9050
8976
|
}
|
|
9051
8977
|
cleanUp() {
|
|
9052
8978
|
this.webIfc = null, this.webIfc = new b.IfcAPI();
|
|
9053
8979
|
}
|
|
9054
8980
|
}
|
|
9055
|
-
I(
|
|
9056
|
-
const
|
|
8981
|
+
I(Vr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
|
|
8982
|
+
const Ps = class Ps extends it {
|
|
9057
8983
|
constructor(t) {
|
|
9058
8984
|
super(t);
|
|
9059
8985
|
I(this, "onGeometryStreamed", new D());
|
|
@@ -9075,7 +9001,7 @@ const ys = class ys extends it {
|
|
|
9075
9001
|
I(this, "_groupSerializer", new $t.Serializer());
|
|
9076
9002
|
I(this, "_assets", []);
|
|
9077
9003
|
I(this, "_meshesWithHoles", /* @__PURE__ */ new Set());
|
|
9078
|
-
this.components.add(
|
|
9004
|
+
this.components.add(Ps.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
|
|
9079
9005
|
}
|
|
9080
9006
|
dispose() {
|
|
9081
9007
|
this.onIfcLoaded.reset(), this.onGeometryStreamed.reset(), this.onAssetStreamed.reset(), this.webIfc = null, this.onDisposed.trigger(), this.onDisposed.reset();
|
|
@@ -9106,17 +9032,17 @@ const ys = class ys extends it {
|
|
|
9106
9032
|
schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
|
|
9107
9033
|
maxExpressID: this.webIfc.GetMaxExpressID(0)
|
|
9108
9034
|
};
|
|
9109
|
-
let
|
|
9035
|
+
let l = 0, E = 0;
|
|
9110
9036
|
for (const T of i) {
|
|
9111
9037
|
if (!this.webIfc.IsIfcElement(T) && T !== b.IFCSPACE || this.settings.excludedCategories.has(T))
|
|
9112
9038
|
continue;
|
|
9113
9039
|
const F = this.webIfc.GetLineIDsWithType(0, T), f = F.size();
|
|
9114
9040
|
for (let m = 0; m < f; m++) {
|
|
9115
|
-
|
|
9041
|
+
l > t && (l = 0, E++, o.push([]));
|
|
9116
9042
|
const g = F.get(m);
|
|
9117
9043
|
o[E].push(g);
|
|
9118
9044
|
const S = this._spatialTree.itemsByFloor[g] || 0;
|
|
9119
|
-
n.data.set(g, [[], [S, T]]),
|
|
9045
|
+
n.data.set(g, [[], [S, T]]), l++;
|
|
9120
9046
|
}
|
|
9121
9047
|
}
|
|
9122
9048
|
this._spatialTree.cleanUp();
|
|
@@ -9148,7 +9074,7 @@ const ys = class ys extends it {
|
|
|
9148
9074
|
getMesh(t, e, i) {
|
|
9149
9075
|
const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
|
|
9150
9076
|
for (let a = 0; a < o; a++) {
|
|
9151
|
-
const
|
|
9077
|
+
const l = e.geometries.get(a), E = l.geometryExpressID, d = l.color.w === 1 ? 1 : -1, h = E * d;
|
|
9152
9078
|
if (!this._visitedGeometries.has(h)) {
|
|
9153
9079
|
this._visitedGeometries.has(E) || this.getGeometry(t, E);
|
|
9154
9080
|
const m = this._visitedGeometries.size, g = O.MathUtils.generateUUID();
|
|
@@ -9161,7 +9087,7 @@ const ys = class ys extends it {
|
|
|
9161
9087
|
if (!p)
|
|
9162
9088
|
throw new Error("Data not found!");
|
|
9163
9089
|
p[0].push(u.index);
|
|
9164
|
-
const { x: R, y: A, z: C, w: T } =
|
|
9090
|
+
const { x: R, y: A, z: C, w: T } = l.color, F = [R, A, C, T], f = l.flatTransformation;
|
|
9165
9091
|
r.geometries.push({ color: F, geometryID: E, transformation: f });
|
|
9166
9092
|
}
|
|
9167
9093
|
this._assets.push(r);
|
|
@@ -9176,7 +9102,7 @@ const ys = class ys extends it {
|
|
|
9176
9102
|
), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
|
|
9177
9103
|
for (let u = 0; u < n.length; u += 6)
|
|
9178
9104
|
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];
|
|
9179
|
-
const
|
|
9105
|
+
const l = Er(r), E = new Float32Array(l.transformation.elements), d = [l.center.x, l.center.y, l.center.z];
|
|
9180
9106
|
let h = !1;
|
|
9181
9107
|
for (let u = 0; u < r.length - 2; u += 3) {
|
|
9182
9108
|
const p = r[u], R = r[u + 1], A = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
|
|
@@ -9203,9 +9129,9 @@ const ys = class ys extends it {
|
|
|
9203
9129
|
this.onGeometryStreamed.trigger({ data: e, buffer: t }), e = null, t = null, this._geometries.clear(), this._geometryCount = 0;
|
|
9204
9130
|
}
|
|
9205
9131
|
};
|
|
9206
|
-
I(
|
|
9207
|
-
let Rn =
|
|
9208
|
-
class
|
|
9132
|
+
I(Ps, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
|
|
9133
|
+
let Rn = Ps;
|
|
9134
|
+
class Gr {
|
|
9209
9135
|
constructor(s) {
|
|
9210
9136
|
/** {@link NavigationMode.enabled} */
|
|
9211
9137
|
I(this, "enabled", !1);
|
|
@@ -9324,8 +9250,8 @@ class kr {
|
|
|
9324
9250
|
this._component.three.getWorldDirection(t);
|
|
9325
9251
|
const e = new O.Vector3();
|
|
9326
9252
|
this._component.controls.getTarget(e);
|
|
9327
|
-
const o = e.clone().sub(this._component.three.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.three,
|
|
9328
|
-
return { width:
|
|
9253
|
+
const o = e.clone().sub(this._component.three.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.three, l = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
|
|
9254
|
+
return { width: l * r, height: l };
|
|
9329
9255
|
}
|
|
9330
9256
|
setupOrthoCamera(s, t) {
|
|
9331
9257
|
this._component.controls.mouseButtons.wheel = ot.ACTION.ZOOM, this._component.controls.mouseButtons.middle = ot.ACTION.ZOOM;
|
|
@@ -9354,7 +9280,7 @@ class Jr extends We {
|
|
|
9354
9280
|
I(this, "_userInputButtons", {});
|
|
9355
9281
|
I(this, "_frustumSize", 50);
|
|
9356
9282
|
I(this, "_navigationModes", /* @__PURE__ */ new Map());
|
|
9357
|
-
this.threeOrtho = this.newOrthoCamera(), this._navigationModes.set("Orbit", new zr(this)), this._navigationModes.set("FirstPerson", new
|
|
9283
|
+
this.threeOrtho = this.newOrthoCamera(), this._navigationModes.set("Orbit", new zr(this)), this._navigationModes.set("FirstPerson", new Gr(this)), this._navigationModes.set("Plan", new Hr(this)), this.mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.projection = new kr(this), this.onAspectUpdated.add(() => this.setOrthoCameraAspect());
|
|
9358
9284
|
}
|
|
9359
9285
|
get current() {
|
|
9360
9286
|
return this.projection.camera;
|
|
@@ -9390,11 +9316,11 @@ class Jr extends We {
|
|
|
9390
9316
|
const p = new O.Box3().setFromObject(u);
|
|
9391
9317
|
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);
|
|
9392
9318
|
}
|
|
9393
|
-
const a = new O.Box3(n, r),
|
|
9394
|
-
a.getSize(
|
|
9319
|
+
const a = new O.Box3(n, r), l = new O.Vector3();
|
|
9320
|
+
a.getSize(l);
|
|
9395
9321
|
const E = new O.Vector3();
|
|
9396
9322
|
a.getCenter(E);
|
|
9397
|
-
const d = Math.max(
|
|
9323
|
+
const d = Math.max(l.x, l.y, l.z) * e, h = new O.Sphere(E, d);
|
|
9398
9324
|
await this.controls.fitToSphere(h, !0);
|
|
9399
9325
|
}
|
|
9400
9326
|
/**
|
|
@@ -9447,19 +9373,19 @@ class ta {
|
|
|
9447
9373
|
}
|
|
9448
9374
|
}
|
|
9449
9375
|
let a = 0;
|
|
9450
|
-
const
|
|
9376
|
+
const l = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
|
|
9451
9377
|
for (const { index: d, edges: h } of r) {
|
|
9452
9378
|
const u = /* @__PURE__ */ new Map();
|
|
9453
9379
|
for (const { id: f } of h)
|
|
9454
|
-
if (
|
|
9455
|
-
const m =
|
|
9380
|
+
if (l.has(f)) {
|
|
9381
|
+
const m = l.get(f);
|
|
9456
9382
|
u.set(f, m);
|
|
9457
9383
|
}
|
|
9458
9384
|
const p = h.map((f) => f.id);
|
|
9459
9385
|
if (!u.size) {
|
|
9460
9386
|
const f = a++;
|
|
9461
9387
|
for (const { id: m } of h)
|
|
9462
|
-
|
|
9388
|
+
l.set(m, f);
|
|
9463
9389
|
E.set(f, {
|
|
9464
9390
|
edges: new Set(p),
|
|
9465
9391
|
indices: /* @__PURE__ */ new Set([d])
|
|
@@ -9469,7 +9395,7 @@ class ta {
|
|
|
9469
9395
|
let R = null;
|
|
9470
9396
|
const A = /* @__PURE__ */ new Set(), C = new Set(p);
|
|
9471
9397
|
for (const [f, m] of u) {
|
|
9472
|
-
R === null ? R = m : m !== R && A.add(m),
|
|
9398
|
+
R === null ? R = m : m !== R && A.add(m), l.delete(f);
|
|
9473
9399
|
const { edges: g } = E.get(m);
|
|
9474
9400
|
g.delete(f), C.delete(f);
|
|
9475
9401
|
}
|
|
@@ -9478,16 +9404,16 @@ class ta {
|
|
|
9478
9404
|
const T = E.get(R), { indices: F } = T;
|
|
9479
9405
|
F.add(d);
|
|
9480
9406
|
for (const f of C) {
|
|
9481
|
-
|
|
9407
|
+
l.set(f, R);
|
|
9482
9408
|
const { edges: m } = T;
|
|
9483
9409
|
m.add(f);
|
|
9484
9410
|
}
|
|
9485
9411
|
for (const f of A) {
|
|
9486
|
-
const m = E.get(f), { edges: g, indices: S } = m, _ = E.get(R), { edges: N, indices:
|
|
9412
|
+
const m = E.get(f), { edges: g, indices: S } = m, _ = E.get(R), { edges: N, indices: y } = _;
|
|
9487
9413
|
for (const w of g)
|
|
9488
|
-
N.add(w),
|
|
9414
|
+
N.add(w), l.set(w, R);
|
|
9489
9415
|
for (const w of S)
|
|
9490
|
-
|
|
9416
|
+
y.add(w);
|
|
9491
9417
|
E.delete(f);
|
|
9492
9418
|
}
|
|
9493
9419
|
}
|
|
@@ -9509,17 +9435,17 @@ class ta {
|
|
|
9509
9435
|
static getFaceData(s, t, e) {
|
|
9510
9436
|
const i = this.getVerticesAndNormal(e, s, t), { p1: o, p2: n, p3: r, faceNormal: a } = i;
|
|
9511
9437
|
this.round(o), this.round(n), this.round(r), this.round(a);
|
|
9512
|
-
const
|
|
9438
|
+
const l = [
|
|
9513
9439
|
{ id: `${o.x}|${o.y}|${o.z}`, value: o },
|
|
9514
9440
|
{ id: `${n.x}|${n.y}|${n.z}`, value: n },
|
|
9515
9441
|
{ id: `${r.x}|${r.y}|${r.z}`, value: r }
|
|
9516
9442
|
];
|
|
9517
|
-
|
|
9443
|
+
l.sort((T, F) => T.id < F.id ? -1 : T.id > F.id ? 1 : 0);
|
|
9518
9444
|
const [
|
|
9519
9445
|
{ id: E, value: d },
|
|
9520
9446
|
{ id: h, value: u },
|
|
9521
9447
|
{ id: p, value: R }
|
|
9522
|
-
] =
|
|
9448
|
+
] = l, A = [
|
|
9523
9449
|
{
|
|
9524
9450
|
id: `${E}|${h}`,
|
|
9525
9451
|
distance: d.distanceTo(u),
|
|
@@ -9541,7 +9467,7 @@ class ta {
|
|
|
9541
9467
|
static getVerticesAndNormal(s, t, e) {
|
|
9542
9468
|
if (!s.geometry.index)
|
|
9543
9469
|
throw new Error("Geometry must be indexed!");
|
|
9544
|
-
const i = s.geometry.index.array, o = s.geometry.attributes.position.array, n = s.geometry.attributes.normal.array, r = i[t * 3] * 3, a = i[t * 3 + 1] * 3,
|
|
9470
|
+
const i = s.geometry.index.array, o = s.geometry.attributes.position.array, n = s.geometry.attributes.normal.array, r = i[t * 3] * 3, a = i[t * 3 + 1] * 3, l = i[t * 3 + 2] * 3, E = new O.Vector3(o[r], o[r + 1], o[r + 2]), d = new O.Vector3(o[a], o[a + 1], o[a + 2]), h = new O.Vector3(o[l], o[l + 1], o[l + 2]), u = new O.Vector3(n[r], n[r + 1], n[r + 2]), p = new O.Vector3(n[a], n[a + 1], n[a + 2]), R = new O.Vector3(n[l], n[l + 1], n[l + 2]), A = (u.x + p.x + R.x) / 3, C = (u.y + p.y + R.y) / 3, T = (u.z + p.z + R.z) / 3, F = new O.Vector3(A, C, T);
|
|
9545
9471
|
if (!F.x && !F.y && !F.z && console.log("hey"), e !== void 0 && s instanceof O.InstancedMesh) {
|
|
9546
9472
|
const f = new O.Matrix4();
|
|
9547
9473
|
s.getMatrixAt(e, f);
|
|
@@ -9567,7 +9493,7 @@ export {
|
|
|
9567
9493
|
ui as Cullers,
|
|
9568
9494
|
zt as Disposer,
|
|
9569
9495
|
D as Event,
|
|
9570
|
-
|
|
9496
|
+
Gr as FirstPersonMode,
|
|
9571
9497
|
fn as FragmentBoundingBox,
|
|
9572
9498
|
fi as FragmentClassifier,
|
|
9573
9499
|
Tn as FragmentExploder,
|
|
@@ -9575,7 +9501,7 @@ export {
|
|
|
9575
9501
|
Ii as FragmentIfcLoader,
|
|
9576
9502
|
Rn as FragmentIfcStreamConverter,
|
|
9577
9503
|
dt as FragmentManager,
|
|
9578
|
-
|
|
9504
|
+
Vr as FragmentPropsStreamConverter,
|
|
9579
9505
|
Ar as Grids,
|
|
9580
9506
|
$r as IfcCategories,
|
|
9581
9507
|
Mn as IfcCategoryMap,
|