softbox 4.26.0 → 4.26.1
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/{ThreePathTracingService-BF9N0xLz.js → ThreePathTracingService-WxrUCt06.js} +446 -456
- package/dist/{ThreePathTracingService-Cfn0abhM.cjs → ThreePathTracingService-vIumWBEY.cjs} +4 -4
- package/dist/index.d.cts +0 -564
- package/dist/index.d.ts +0 -564
- package/dist/simple-viewer.cjs +7 -17
- package/dist/simple-viewer.es.js +3515 -4154
- package/dist/{smoothstep-gC155W8-.js → smoothstep-DJLgqxNL.js} +272 -362
- package/dist/smoothstep-DoPxvpnb.cjs +2 -0
- package/package.json +1 -1
- package/dist/smoothstep-BsyRnZAu.cjs +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as e from "three";
|
|
2
|
-
import { BackSide as t,
|
|
2
|
+
import { BackSide as t, Box3 as n, BufferAttribute as r, DoubleSide as i, FrontSide as a, Line3 as o, Matrix4 as s, Plane as c, REVISION as l, Ray as u, Triangle as d, Vector2 as f, Vector3 as p } from "three";
|
|
3
3
|
//#region src/errors/ThreeViewerError.ts
|
|
4
|
-
var
|
|
4
|
+
var m = class e extends Error {
|
|
5
5
|
constructor(t, n, r) {
|
|
6
6
|
super(t), this.code = n, this.context = r, this.name = "ThreeViewerError", this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this, e);
|
|
7
7
|
}
|
|
@@ -17,9 +17,9 @@ var x = class e extends Error {
|
|
|
17
17
|
};
|
|
18
18
|
return new e(i, n, a);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, h = /* @__PURE__ */ function(e) {
|
|
21
21
|
return e.SCENE_INIT_FAILED = "SCENE_INIT_FAILED", e.RENDERER_INIT_FAILED = "RENDERER_INIT_FAILED", e.RENDERER_NOT_INITIALIZED = "RENDERER_NOT_INITIALIZED", e.CAMERA_INIT_FAILED = "CAMERA_INIT_FAILED", e.WEBGL_NOT_SUPPORTED = "WEBGL_NOT_SUPPORTED", e.INITIALIZATION_FAILED = "INITIALIZATION_FAILED", e.PATH_TRACING_INIT_FAILED = "PATH_TRACING_INIT_FAILED", e.MODEL_LOAD_FAILED = "MODEL_LOAD_FAILED", e.TEXTURE_LOAD_FAILED = "TEXTURE_LOAD_FAILED", e.RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND", e.UNSUPPORTED_FORMAT = "UNSUPPORTED_FORMAT", e.INVALID_CONFIGURATION = "INVALID_CONFIGURATION", e.RENDER_ERROR = "RENDER_ERROR", e.RENDER_FAILED = "RENDER_FAILED", e.SCENE_OPERATION_FAILED = "SCENE_OPERATION_FAILED", e.COMPONENT_NOT_MOUNTED = "COMPONENT_NOT_MOUNTED", e.INVALID_STATE = "INVALID_STATE", e.INVALID_PARAMETER = "INVALID_PARAMETER", e.OPERATION_FAILED = "OPERATION_FAILED", e.POST_PROCESSING_FAILED = "POST_PROCESSING_FAILED", e.UNKNOWN = "UNKNOWN", e;
|
|
22
|
-
}({}),
|
|
22
|
+
}({}), g = {
|
|
23
23
|
ok(e) {
|
|
24
24
|
return {
|
|
25
25
|
ok: !0,
|
|
@@ -34,12 +34,12 @@ var x = class e extends Error {
|
|
|
34
34
|
},
|
|
35
35
|
wrap(e) {
|
|
36
36
|
try {
|
|
37
|
-
return
|
|
37
|
+
return g.ok(e());
|
|
38
38
|
} catch (e) {
|
|
39
|
-
return
|
|
39
|
+
return g.err(e instanceof m ? e : new m(String(e), h.UNKNOWN, { originalError: e }));
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, _ = class {
|
|
43
43
|
constructor() {
|
|
44
44
|
this.listeners = /* @__PURE__ */ new Map();
|
|
45
45
|
}
|
|
@@ -77,13 +77,49 @@ var x = class e extends Error {
|
|
|
77
77
|
removeListener(e, t) {
|
|
78
78
|
this.off(e, t);
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, v = {
|
|
81
81
|
meters: 1,
|
|
82
82
|
centimeters: .01,
|
|
83
83
|
millimeters: .001,
|
|
84
84
|
feet: .3048,
|
|
85
85
|
inches: .0254
|
|
86
|
-
},
|
|
86
|
+
}, y = "softbox-units-scale", b = "softboxExternallyOwnedTextures", x = "softboxBackgroundNode", S = "softboxStashedMaterials";
|
|
87
|
+
function C(t) {
|
|
88
|
+
if (!t.userData.softboxDisposed) {
|
|
89
|
+
if (!t.userData?.softboxExternallyOwnedTextures) {
|
|
90
|
+
let n = t;
|
|
91
|
+
for (let t of Object.keys(n)) {
|
|
92
|
+
let r = n[t];
|
|
93
|
+
r instanceof e.Texture && r.dispose();
|
|
94
|
+
}
|
|
95
|
+
let r = t;
|
|
96
|
+
if (r.isShaderMaterial && r.uniforms) for (let t of Object.values(r.uniforms)) t?.value instanceof e.Texture && t.value.dispose();
|
|
97
|
+
}
|
|
98
|
+
t.dispose(), t.userData.softboxDisposed = !0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function w(e) {
|
|
102
|
+
e.boundsTree &&= void 0;
|
|
103
|
+
}
|
|
104
|
+
function T(e) {
|
|
105
|
+
e.traverse((e) => {
|
|
106
|
+
let t = e;
|
|
107
|
+
t.geometry && typeof t.geometry.dispose == "function" && (w(t.geometry), t.geometry.dispose());
|
|
108
|
+
let n = t.material;
|
|
109
|
+
Array.isArray(n) ? n.forEach(C) : n && C(n), (e.userData?.[S])?.forEach(C);
|
|
110
|
+
let r = e;
|
|
111
|
+
r.isLight && r.shadow?.dispose && r.shadow.dispose();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function ee(t, n) {
|
|
115
|
+
if (!n?.keepBackgrounds) {
|
|
116
|
+
t.background instanceof e.Texture && (t.background.dispose(), t.background = null), t.environment instanceof e.Texture && (t.environment.dispose(), t.environment = null);
|
|
117
|
+
let n = t;
|
|
118
|
+
n.__originalEnvironmentTexture &&= void 0;
|
|
119
|
+
}
|
|
120
|
+
for (let e of [...t.children]) n?.keepBackgrounds && e.userData?.softboxBackgroundNode || (T(e), t.remove(e));
|
|
121
|
+
}
|
|
122
|
+
var E = 1.25, te = 65535, ne = te << 16, re = 2 ** -24, D = Symbol("SKIP_GENERATION"), ie = {
|
|
87
123
|
strategy: 0,
|
|
88
124
|
maxDepth: 40,
|
|
89
125
|
targetLeafSize: 10,
|
|
@@ -131,7 +167,7 @@ function le(e) {
|
|
|
131
167
|
//#endregion
|
|
132
168
|
//#region node_modules/three-mesh-bvh/src/core/utils/nodeBufferUtils.js
|
|
133
169
|
function k(e, t) {
|
|
134
|
-
return t[e + 15] ===
|
|
170
|
+
return t[e + 15] === te;
|
|
135
171
|
}
|
|
136
172
|
function A(e, t) {
|
|
137
173
|
return t[e + 6];
|
|
@@ -179,7 +215,7 @@ function me(e, t, n, r, i, a) {
|
|
|
179
215
|
if (a === 0) o = ae(t), o !== -1 && (s = (t[o] + t[o + 3]) / 2);
|
|
180
216
|
else if (a === 1) o = ae(e), o !== -1 && (s = he(n, r, i, o));
|
|
181
217
|
else if (a === 2) {
|
|
182
|
-
let a = le(e), c =
|
|
218
|
+
let a = le(e), c = E * i, l = n.offset || 0, u = (r - l) * 6, d = (r + i - l) * 6;
|
|
183
219
|
for (let e = 0; e < 3; e++) {
|
|
184
220
|
let r = t[e], l = (t[e + 3] - r) / F;
|
|
185
221
|
if (i < F / 4) {
|
|
@@ -211,7 +247,7 @@ function me(e, t, n, r, i, a) {
|
|
|
211
247
|
l !== 0 && (p = le(d) / a);
|
|
212
248
|
let m = 0;
|
|
213
249
|
u !== 0 && (m = le(f) / a);
|
|
214
|
-
let h = 1 +
|
|
250
|
+
let h = 1 + E * (p * l + m * u);
|
|
215
251
|
h < c && (o = e, c = h, s = r.candidate);
|
|
216
252
|
}
|
|
217
253
|
} else {
|
|
@@ -241,7 +277,7 @@ function me(e, t, n, r, i, a) {
|
|
|
241
277
|
f !== 0 && (d = le(pe) / a);
|
|
242
278
|
let m = i - f;
|
|
243
279
|
m !== 0 && (p = le(u) / a);
|
|
244
|
-
let h = 1 +
|
|
280
|
+
let h = 1 + E * (d * f + p * m);
|
|
245
281
|
h < c && (o = e, c = h, s = n.candidate);
|
|
246
282
|
}
|
|
247
283
|
}
|
|
@@ -296,7 +332,7 @@ function we(e, t, n) {
|
|
|
296
332
|
function Te(e, t) {
|
|
297
333
|
let n = e / 4, r = e / 2, i = "count" in t, a = t.boundingData;
|
|
298
334
|
for (let e = 0; e < 6; e++) ve[n + e] = a[e];
|
|
299
|
-
if (i) return t.buffer ? (xe.set(new Uint8Array(t.buffer), e), e + t.buffer.byteLength) : (ye[n + 6] = t.offset, be[r + 14] = t.count, be[r + 15] =
|
|
335
|
+
if (i) return t.buffer ? (xe.set(new Uint8Array(t.buffer), e), e + t.buffer.byteLength) : (ye[n + 6] = t.offset, be[r + 14] = t.count, be[r + 15] = te, e + 32);
|
|
300
336
|
{
|
|
301
337
|
let { left: r, right: i, splitAxis: a } = t, o = Te(e + 32, r), s = e / 32, c = o / 32 - s;
|
|
302
338
|
if (c > Se) throw Error("MeshBVH: Cannot store relative child node offset greater than 32 bits.");
|
|
@@ -360,7 +396,7 @@ var Oe = class {
|
|
|
360
396
|
t = null, this.float32Array = null, this.uint16Array = null, this.uint32Array = null, e.length !== 0 && this.setBuffer(e.pop());
|
|
361
397
|
};
|
|
362
398
|
}
|
|
363
|
-
}(), R, ke, Ae = [], je = /* @__PURE__ */ new Oe(() => new
|
|
399
|
+
}(), R, ke, Ae = [], je = /* @__PURE__ */ new Oe(() => new n());
|
|
364
400
|
function Me(e, t, n, r, i, a) {
|
|
365
401
|
R = je.getPrimitive(), ke = je.getPrimitive(), Ae.push(R, ke), L.setBuffer(e._roots[t]);
|
|
366
402
|
let o = Ne(0, e.geometry, n, r, i, a);
|
|
@@ -409,21 +445,21 @@ function Ne(e, t, n, r, i = null, a = 0, o = 0) {
|
|
|
409
445
|
}
|
|
410
446
|
//#endregion
|
|
411
447
|
//#region node_modules/three-mesh-bvh/src/core/cast/bvhcast.js
|
|
412
|
-
var Pe = /* @__PURE__ */ new L.constructor(), Fe = /* @__PURE__ */ new L.constructor(), z = /* @__PURE__ */ new Oe(() => new
|
|
413
|
-
function
|
|
414
|
-
if (
|
|
415
|
-
|
|
416
|
-
let i = e._roots, a = t._roots, o,
|
|
448
|
+
var Pe = /* @__PURE__ */ new L.constructor(), Fe = /* @__PURE__ */ new L.constructor(), z = /* @__PURE__ */ new Oe(() => new n()), B = /* @__PURE__ */ new n(), Ie = /* @__PURE__ */ new n(), Le = /* @__PURE__ */ new n(), Re = /* @__PURE__ */ new n(), ze = !1;
|
|
449
|
+
function Be(e, t, n, r) {
|
|
450
|
+
if (ze) throw Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
451
|
+
ze = !0;
|
|
452
|
+
let i = e._roots, a = t._roots, o, c = 0, l = 0, u = new s().copy(n).invert();
|
|
417
453
|
for (let e = 0, t = i.length; e < t; e++) {
|
|
418
|
-
Pe.setBuffer(i[e]),
|
|
454
|
+
Pe.setBuffer(i[e]), l = 0;
|
|
419
455
|
let t = z.getPrimitive();
|
|
420
|
-
O(P(0), Pe.float32Array, t), t.applyMatrix4(
|
|
421
|
-
for (let e = 0, i = a.length; e < i && (Fe.setBuffer(a[e]), o =
|
|
422
|
-
if (z.releasePrimitive(t), Pe.clearBuffer(),
|
|
456
|
+
O(P(0), Pe.float32Array, t), t.applyMatrix4(u);
|
|
457
|
+
for (let e = 0, i = a.length; e < i && (Fe.setBuffer(a[e]), o = V(0, 0, n, u, r, c, l, 0, 0, t), Fe.clearBuffer(), l += a[e].byteLength / 32, !o); e++);
|
|
458
|
+
if (z.releasePrimitive(t), Pe.clearBuffer(), c += i[e].byteLength / 32, o) break;
|
|
423
459
|
}
|
|
424
|
-
return
|
|
460
|
+
return ze = !1, o;
|
|
425
461
|
}
|
|
426
|
-
function
|
|
462
|
+
function V(e, t, n, r, i, a = 0, o = 0, s = 0, c = 0, l = null, u = !1) {
|
|
427
463
|
let d, f;
|
|
428
464
|
u ? (d = Fe, f = Pe) : (d = Pe, f = Fe);
|
|
429
465
|
let p = d.float32Array, m = d.uint32Array, h = d.uint16Array, g = f.float32Array, _ = f.uint32Array, v = f.uint16Array, y = e * 2, b = t * 2, x = k(y, h), S = k(b, v), C = !1;
|
|
@@ -432,38 +468,38 @@ function B(e, t, n, r, i, a = 0, o = 0, s = 0, c = 0, l = null, u = !1) {
|
|
|
432
468
|
let l = z.getPrimitive();
|
|
433
469
|
O(P(t), g, l), l.applyMatrix4(n);
|
|
434
470
|
let d = M(e), f = N(e, m);
|
|
435
|
-
O(P(d), p,
|
|
436
|
-
let h = l.intersectsBox(
|
|
437
|
-
C = h &&
|
|
471
|
+
O(P(d), p, B), O(P(f), p, Ie);
|
|
472
|
+
let h = l.intersectsBox(B), _ = l.intersectsBox(Ie);
|
|
473
|
+
C = h && V(t, d, r, n, i, o, a, c, s + 1, l, !u) || _ && V(t, f, r, n, i, o, a, c, s + 1, l, !u), z.releasePrimitive(l);
|
|
438
474
|
} else {
|
|
439
475
|
let d = M(t), f = N(t, _);
|
|
440
|
-
O(P(d), g,
|
|
441
|
-
let h = l.intersectsBox(
|
|
442
|
-
if (h && v) C =
|
|
443
|
-
else if (h) if (x) C =
|
|
476
|
+
O(P(d), g, Le), O(P(f), g, Re);
|
|
477
|
+
let h = l.intersectsBox(Le), v = l.intersectsBox(Re);
|
|
478
|
+
if (h && v) C = V(e, d, n, r, i, a, o, s, c + 1, l, u) || V(e, f, n, r, i, a, o, s, c + 1, l, u);
|
|
479
|
+
else if (h) if (x) C = V(e, d, n, r, i, a, o, s, c + 1, l, u);
|
|
444
480
|
else {
|
|
445
481
|
let t = z.getPrimitive();
|
|
446
|
-
t.copy(
|
|
482
|
+
t.copy(Le).applyMatrix4(n);
|
|
447
483
|
let l = M(e), f = N(e, m);
|
|
448
|
-
O(P(l), p,
|
|
449
|
-
let h = t.intersectsBox(
|
|
450
|
-
C = h &&
|
|
484
|
+
O(P(l), p, B), O(P(f), p, Ie);
|
|
485
|
+
let h = t.intersectsBox(B), g = t.intersectsBox(Ie);
|
|
486
|
+
C = h && V(d, l, r, n, i, o, a, c, s + 1, t, !u) || g && V(d, f, r, n, i, o, a, c, s + 1, t, !u), z.releasePrimitive(t);
|
|
451
487
|
}
|
|
452
|
-
else if (v) if (x) C =
|
|
488
|
+
else if (v) if (x) C = V(e, f, n, r, i, a, o, s, c + 1, l, u);
|
|
453
489
|
else {
|
|
454
490
|
let t = z.getPrimitive();
|
|
455
|
-
t.copy(
|
|
491
|
+
t.copy(Re).applyMatrix4(n);
|
|
456
492
|
let l = M(e), d = N(e, m);
|
|
457
|
-
O(P(l), p,
|
|
458
|
-
let h = t.intersectsBox(
|
|
459
|
-
C = h &&
|
|
493
|
+
O(P(l), p, B), O(P(d), p, Ie);
|
|
494
|
+
let h = t.intersectsBox(B), g = t.intersectsBox(Ie);
|
|
495
|
+
C = h && V(f, l, r, n, i, o, a, c, s + 1, t, !u) || g && V(f, d, r, n, i, o, a, c, s + 1, t, !u), z.releasePrimitive(t);
|
|
460
496
|
}
|
|
461
497
|
}
|
|
462
498
|
return C;
|
|
463
499
|
}
|
|
464
500
|
//#endregion
|
|
465
501
|
//#region node_modules/three-mesh-bvh/src/core/BVHTraversalHelper.js
|
|
466
|
-
var
|
|
502
|
+
var Ve = new class {
|
|
467
503
|
constructor() {
|
|
468
504
|
let e = null, t = null, n = null, r = !1;
|
|
469
505
|
this.root = null, this.buffer = null, this.uint32Array = null, this.uint16Array = null, this.setBVH = (i, a) => {
|
|
@@ -507,7 +543,7 @@ var He = new class {
|
|
|
507
543
|
});
|
|
508
544
|
};
|
|
509
545
|
}
|
|
510
|
-
}(),
|
|
546
|
+
}(), He = /* @__PURE__ */ new n(), Ue = /* @__PURE__ */ new Float32Array(6), We = class {
|
|
511
547
|
constructor() {
|
|
512
548
|
this._roots = null, this.primitiveBuffer = null, this.primitiveBufferStride = null;
|
|
513
549
|
}
|
|
@@ -529,8 +565,8 @@ var He = new class {
|
|
|
529
565
|
writePrimitiveRangeBounds(e, t, n, r) {
|
|
530
566
|
let i = Infinity, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity, l = -Infinity;
|
|
531
567
|
for (let n = e, r = e + t; n < r; n++) {
|
|
532
|
-
this.writePrimitiveBounds(n,
|
|
533
|
-
let [e, t, r, u, d, f] =
|
|
568
|
+
this.writePrimitiveBounds(n, Ue, 0);
|
|
569
|
+
let [e, t, r, u, d, f] = Ue;
|
|
534
570
|
e < i && (i = e), u > s && (s = u), t < a && (a = t), d > c && (c = d), r < o && (o = r), f > l && (l = f);
|
|
535
571
|
}
|
|
536
572
|
return n[r + 0] = i, n[r + 1] = a, n[r + 2] = o, n[r + 3] = s, n[r + 4] = c, n[r + 5] = l, n;
|
|
@@ -538,8 +574,8 @@ var He = new class {
|
|
|
538
574
|
computePrimitiveBounds(e, t, n) {
|
|
539
575
|
let r = n.offset || 0;
|
|
540
576
|
for (let i = e, a = e + t; i < a; i++) {
|
|
541
|
-
this.writePrimitiveBounds(i,
|
|
542
|
-
let [e, t, a, o, s, c] =
|
|
577
|
+
this.writePrimitiveBounds(i, Ue, 0);
|
|
578
|
+
let [e, t, a, o, s, c] = Ue, l = (e + o) / 2, u = (t + s) / 2, d = (a + c) / 2, f = (o - e) / 2, p = (s - t) / 2, m = (c - a) / 2, h = (i - r) * 6;
|
|
543
579
|
n[h + 0] = l, n[h + 1] = f + (Math.abs(l) + f) * re, n[h + 2] = u, n[h + 3] = p + (Math.abs(u) + p) * re, n[h + 4] = d, n[h + 5] = m + (Math.abs(d) + m) * re;
|
|
544
580
|
}
|
|
545
581
|
return n;
|
|
@@ -559,7 +595,7 @@ var He = new class {
|
|
|
559
595
|
}
|
|
560
596
|
}
|
|
561
597
|
traverse(e, t = 0) {
|
|
562
|
-
|
|
598
|
+
Ve.setBVH(this, t), Ve.traverse(e), Ve.reset();
|
|
563
599
|
}
|
|
564
600
|
refit() {
|
|
565
601
|
let e = this._roots;
|
|
@@ -569,7 +605,7 @@ var He = new class {
|
|
|
569
605
|
let t = e * 8, n = t * 2;
|
|
570
606
|
if (k(n, i)) {
|
|
571
607
|
let e = A(t, r), o = j(n, i);
|
|
572
|
-
this.writePrimitiveRangeBounds(e, o,
|
|
608
|
+
this.writePrimitiveRangeBounds(e, o, Ue, 0), a.set(Ue, t);
|
|
573
609
|
} else {
|
|
574
610
|
let e = M(t), n = N(t, r);
|
|
575
611
|
for (let r = 0; r < 3; r++) {
|
|
@@ -582,7 +618,7 @@ var He = new class {
|
|
|
582
618
|
}
|
|
583
619
|
getBoundingBox(e) {
|
|
584
620
|
return e.makeEmpty(), this._roots.forEach((t) => {
|
|
585
|
-
O(0, new Float32Array(t),
|
|
621
|
+
O(0, new Float32Array(t), He), e.union(He);
|
|
586
622
|
}), e;
|
|
587
623
|
}
|
|
588
624
|
shapecast(e) {
|
|
@@ -601,7 +637,7 @@ var He = new class {
|
|
|
601
637
|
}
|
|
602
638
|
bvhcast(e, t, n) {
|
|
603
639
|
let { intersectsRanges: r } = n;
|
|
604
|
-
return
|
|
640
|
+
return Be(this, e, t, r);
|
|
605
641
|
}
|
|
606
642
|
};
|
|
607
643
|
//#endregion
|
|
@@ -622,9 +658,9 @@ function Je(e, t = ArrayBuffer) {
|
|
|
622
658
|
}
|
|
623
659
|
function Ye(e, t) {
|
|
624
660
|
if (!e.index) {
|
|
625
|
-
let n = e.attributes.position.count,
|
|
626
|
-
e.setIndex(new i
|
|
627
|
-
for (let e = 0; e < n; e++)
|
|
661
|
+
let n = e.attributes.position.count, i = Je(n, t.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer);
|
|
662
|
+
e.setIndex(new r(i, 1));
|
|
663
|
+
for (let e = 0; e < n; e++) i[e] = e;
|
|
628
664
|
}
|
|
629
665
|
}
|
|
630
666
|
function Xe(e, t, n) {
|
|
@@ -701,12 +737,12 @@ var et = class extends We {
|
|
|
701
737
|
}, t[D] || this.init(t);
|
|
702
738
|
}
|
|
703
739
|
init(e) {
|
|
704
|
-
let { geometry: t, primitiveStride:
|
|
740
|
+
let { geometry: t, primitiveStride: r } = this;
|
|
705
741
|
if (e.indirect) {
|
|
706
|
-
let
|
|
707
|
-
this._indirectBuffer =
|
|
742
|
+
let n = $e(Qe(t, e.range, r), e.useSharedArrayBuffer);
|
|
743
|
+
this._indirectBuffer = n;
|
|
708
744
|
} else Ye(t, e);
|
|
709
|
-
super.init(e), !t.boundingBox && e.setBoundingBox && (t.boundingBox = this.getBoundingBox(new
|
|
745
|
+
super.init(e), !t.boundingBox && e.setBoundingBox && (t.boundingBox = this.getBoundingBox(new n()));
|
|
710
746
|
}
|
|
711
747
|
getRootRanges(e) {
|
|
712
748
|
return this.indirect ? [{
|
|
@@ -742,7 +778,7 @@ var et = class extends We {
|
|
|
742
778
|
}
|
|
743
779
|
};
|
|
744
780
|
H.prototype.setFromBox = (function() {
|
|
745
|
-
let e = /* @__PURE__ */ new
|
|
781
|
+
let e = /* @__PURE__ */ new p();
|
|
746
782
|
return function(t, n) {
|
|
747
783
|
let r = n.min, i = n.max, a = Infinity, o = -Infinity;
|
|
748
784
|
for (let n = 0; n <= 1; n++) for (let s = 0; s <= 1; s++) for (let c = 0; c <= 1; c++) {
|
|
@@ -756,7 +792,7 @@ H.prototype.setFromBox = (function() {
|
|
|
756
792
|
//#endregion
|
|
757
793
|
//#region node_modules/three-mesh-bvh/src/math/MathUtilities.js
|
|
758
794
|
var tt = (function() {
|
|
759
|
-
let e = /* @__PURE__ */ new
|
|
795
|
+
let e = /* @__PURE__ */ new p(), t = /* @__PURE__ */ new p(), n = /* @__PURE__ */ new p();
|
|
760
796
|
return function(r, i, a) {
|
|
761
797
|
let o = r.start, s = e, c = i.start, l = t;
|
|
762
798
|
n.subVectors(o, c), e.subVectors(r.end, r.start), t.subVectors(i.end, i.start);
|
|
@@ -764,7 +800,7 @@ var tt = (function() {
|
|
|
764
800
|
h = m === 0 ? 0 : (u * d - p * f) / m, g = (u + h * d) / f, a.x = h, a.y = g;
|
|
765
801
|
};
|
|
766
802
|
})(), nt = (function() {
|
|
767
|
-
let e = /* @__PURE__ */ new
|
|
803
|
+
let e = /* @__PURE__ */ new f(), t = /* @__PURE__ */ new p(), n = /* @__PURE__ */ new p();
|
|
768
804
|
return function(r, i, a, o) {
|
|
769
805
|
tt(r, i, e);
|
|
770
806
|
let s = e.x, c = e.y;
|
|
@@ -793,7 +829,7 @@ var tt = (function() {
|
|
|
793
829
|
}
|
|
794
830
|
};
|
|
795
831
|
})(), rt = (function() {
|
|
796
|
-
let e = /* @__PURE__ */ new
|
|
832
|
+
let e = /* @__PURE__ */ new p(), t = /* @__PURE__ */ new p(), n = /* @__PURE__ */ new c(), r = /* @__PURE__ */ new o();
|
|
797
833
|
return function(i, a) {
|
|
798
834
|
let { radius: o, center: s } = i, { a: c, b: l, c: u } = a;
|
|
799
835
|
if (r.start = c, r.end = l, r.closestPointToPoint(s, !0, e).distanceTo(s) <= o || (r.start = c, r.end = u, r.closestPointToPoint(s, !0, e).distanceTo(s) <= o) || (r.start = l, r.end = u, r.closestPointToPoint(s, !0, e).distanceTo(s) <= o)) return !0;
|
|
@@ -812,14 +848,14 @@ var tt = (function() {
|
|
|
812
848
|
function W(e) {
|
|
813
849
|
return Math.abs(e) < U;
|
|
814
850
|
}
|
|
815
|
-
var G = class extends
|
|
851
|
+
var G = class extends d {
|
|
816
852
|
constructor(...e) {
|
|
817
853
|
super(...e), this.isExtendedTriangle = !0, this.satAxes = [
|
|
818
854
|
,
|
|
819
855
|
,
|
|
820
856
|
,
|
|
821
857
|
,
|
|
822
|
-
].fill().map(() => new
|
|
858
|
+
].fill().map(() => new p()), this.satBounds = [
|
|
823
859
|
,
|
|
824
860
|
,
|
|
825
861
|
,
|
|
@@ -828,7 +864,7 @@ var G = class extends v {
|
|
|
828
864
|
this.a,
|
|
829
865
|
this.b,
|
|
830
866
|
this.c
|
|
831
|
-
], this.plane = new
|
|
867
|
+
], this.plane = new c(), this.isDegenerateIntoSegment = !1, this.isDegenerateIntoPoint = !1, this.degenerateSegment = new o(), this.needsUpdate = !0;
|
|
832
868
|
}
|
|
833
869
|
intersectsSphere(e) {
|
|
834
870
|
return rt(e, this);
|
|
@@ -847,7 +883,7 @@ var G = class extends v {
|
|
|
847
883
|
}
|
|
848
884
|
};
|
|
849
885
|
G.prototype.closestPointToSegment = (function() {
|
|
850
|
-
let e = /* @__PURE__ */ new
|
|
886
|
+
let e = /* @__PURE__ */ new p(), t = /* @__PURE__ */ new p(), n = /* @__PURE__ */ new o();
|
|
851
887
|
return function(r, i = null, a = null) {
|
|
852
888
|
let { start: o, end: s } = r, c = this.points, l, u = Infinity;
|
|
853
889
|
for (let o = 0; o < 3; o++) {
|
|
@@ -857,44 +893,44 @@ G.prototype.closestPointToSegment = (function() {
|
|
|
857
893
|
return this.closestPointToPoint(o, e), l = o.distanceToSquared(e), l < u && (u = l, i && i.copy(e), a && a.copy(o)), this.closestPointToPoint(s, e), l = s.distanceToSquared(e), l < u && (u = l, i && i.copy(e), a && a.copy(s)), Math.sqrt(u);
|
|
858
894
|
};
|
|
859
895
|
})(), G.prototype.intersectsTriangle = (function() {
|
|
860
|
-
let e = /* @__PURE__ */ new G(), t = /* @__PURE__ */ new H(), n = /* @__PURE__ */ new H(), r = /* @__PURE__ */ new
|
|
861
|
-
function
|
|
896
|
+
let e = /* @__PURE__ */ new G(), t = /* @__PURE__ */ new H(), n = /* @__PURE__ */ new H(), r = /* @__PURE__ */ new p(), i = /* @__PURE__ */ new p(), a = /* @__PURE__ */ new p(), s = /* @__PURE__ */ new p(), c = /* @__PURE__ */ new o(), l = /* @__PURE__ */ new o(), u = /* @__PURE__ */ new p(), d = /* @__PURE__ */ new f(), m = /* @__PURE__ */ new f();
|
|
897
|
+
function h(e, i, a, o) {
|
|
862
898
|
let c = r;
|
|
863
899
|
!e.isDegenerateIntoPoint && !e.isDegenerateIntoSegment ? c.copy(e.plane.normal) : c.copy(i.plane.normal);
|
|
864
900
|
let l = e.satBounds, u = e.satAxes;
|
|
865
901
|
for (let r = 1; r < 4; r++) {
|
|
866
|
-
let a = l[r],
|
|
867
|
-
if (t.setFromPoints(
|
|
902
|
+
let a = l[r], o = u[r];
|
|
903
|
+
if (t.setFromPoints(o, i.points), a.isSeparated(t) || (s.copy(c).cross(o), t.setFromPoints(s, e.points), n.setFromPoints(s, i.points), t.isSeparated(n))) return !1;
|
|
868
904
|
}
|
|
869
905
|
let d = i.satBounds, f = i.satAxes;
|
|
870
906
|
for (let r = 1; r < 4; r++) {
|
|
871
|
-
let a = d[r],
|
|
872
|
-
if (t.setFromPoints(
|
|
907
|
+
let a = d[r], o = f[r];
|
|
908
|
+
if (t.setFromPoints(o, e.points), a.isSeparated(t) || (s.crossVectors(c, o), t.setFromPoints(s, e.points), n.setFromPoints(s, i.points), t.isSeparated(n))) return !1;
|
|
873
909
|
}
|
|
874
|
-
return a && (
|
|
910
|
+
return a && (o || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), a.start.set(0, 0, 0), a.end.set(0, 0, 0)), !0;
|
|
875
911
|
}
|
|
876
|
-
function
|
|
912
|
+
function g(e, t, n, r, i, a, o, s, c, l, u) {
|
|
877
913
|
let d = o / (o - s);
|
|
878
914
|
l.x = r + (i - r) * d, u.start.subVectors(t, e).multiplyScalar(d).add(e), d = o / (o - c), l.y = r + (a - r) * d, u.end.subVectors(n, e).multiplyScalar(d).add(e);
|
|
879
915
|
}
|
|
880
|
-
function
|
|
881
|
-
if (i > 0)
|
|
882
|
-
else if (a > 0)
|
|
883
|
-
else if (s * c > 0 || o != 0)
|
|
884
|
-
else if (s != 0)
|
|
885
|
-
else if (c != 0)
|
|
916
|
+
function _(e, t, n, r, i, a, o, s, c, l, u) {
|
|
917
|
+
if (i > 0) g(e.c, e.a, e.b, r, t, n, c, o, s, l, u);
|
|
918
|
+
else if (a > 0) g(e.b, e.a, e.c, n, t, r, s, o, c, l, u);
|
|
919
|
+
else if (s * c > 0 || o != 0) g(e.a, e.b, e.c, t, n, r, o, s, c, l, u);
|
|
920
|
+
else if (s != 0) g(e.b, e.a, e.c, n, t, r, s, o, c, l, u);
|
|
921
|
+
else if (c != 0) g(e.c, e.a, e.b, r, t, n, c, o, s, l, u);
|
|
886
922
|
else return !0;
|
|
887
923
|
return !1;
|
|
888
924
|
}
|
|
889
|
-
function
|
|
925
|
+
function v(e, t, n, i) {
|
|
890
926
|
let a = t.degenerateSegment, o = e.plane.distanceToPoint(a.start), s = e.plane.distanceToPoint(a.end);
|
|
891
|
-
return W(o) ? W(s) ?
|
|
927
|
+
return W(o) ? W(s) ? h(e, t, n, i) : (n && (n.start.copy(a.start), n.end.copy(a.start)), e.containsPoint(a.start)) : W(s) ? (n && (n.start.copy(a.end), n.end.copy(a.end)), e.containsPoint(a.end)) : e.plane.intersectLine(a, r) == null ? !1 : (n && (n.start.copy(r), n.end.copy(r)), e.containsPoint(r));
|
|
892
928
|
}
|
|
893
|
-
function
|
|
929
|
+
function y(e, t, n) {
|
|
894
930
|
let r = t.a;
|
|
895
931
|
return W(e.plane.distanceToPoint(r)) && e.containsPoint(r) ? (n && (n.start.copy(r), n.end.copy(r)), !0) : !1;
|
|
896
932
|
}
|
|
897
|
-
function
|
|
933
|
+
function b(e, t, n) {
|
|
898
934
|
let i = e.degenerateSegment, a = t.a;
|
|
899
935
|
return i.closestPointToPoint(a, !0, r), a.distanceToSquared(r) < at ? (n && (n.start.copy(a), n.end.copy(a)), !0) : !1;
|
|
900
936
|
}
|
|
@@ -906,50 +942,50 @@ G.prototype.closestPointToSegment = (function() {
|
|
|
906
942
|
if (W(d)) return !1;
|
|
907
943
|
let f = (u.x * l.y - u.y * l.x) / d, p = -(c.x * u.y - c.y * u.x) / d;
|
|
908
944
|
return f < 0 || f > 1 || p < 0 || p > 1 ? !1 : W(o.start.z + c.z * f - (s.start.z + l.z * p)) ? (n && (n.start.copy(o.start).addScaledVector(c, f), n.end.copy(o.start).addScaledVector(c, f)), !0) : !1;
|
|
909
|
-
} else if (t.isDegenerateIntoPoint) return
|
|
910
|
-
else return
|
|
911
|
-
else if (e.isDegenerateIntoPoint) return t.isDegenerateIntoPoint ? t.a.distanceToSquared(e.a) < at ? (n && (n.start.copy(e.a), n.end.copy(e.a)), !0) : !1 : t.isDegenerateIntoSegment ?
|
|
912
|
-
else if (t.isDegenerateIntoPoint) return
|
|
913
|
-
else if (t.isDegenerateIntoSegment) return
|
|
945
|
+
} else if (t.isDegenerateIntoPoint) return b(e, t, n);
|
|
946
|
+
else return v(t, e, n, o);
|
|
947
|
+
else if (e.isDegenerateIntoPoint) return t.isDegenerateIntoPoint ? t.a.distanceToSquared(e.a) < at ? (n && (n.start.copy(e.a), n.end.copy(e.a)), !0) : !1 : t.isDegenerateIntoSegment ? b(t, e, n) : y(t, e, n);
|
|
948
|
+
else if (t.isDegenerateIntoPoint) return y(e, t, n);
|
|
949
|
+
else if (t.isDegenerateIntoSegment) return v(e, t, n, o);
|
|
914
950
|
}
|
|
915
951
|
return function(t, n = null, r = !1) {
|
|
916
952
|
this.needsUpdate && this.update(), t.isExtendedTriangle ? t.needsUpdate && t.update() : (e.copy(t), e.update(), t = e);
|
|
917
953
|
let o = x(this, t, n, r);
|
|
918
954
|
if (o !== void 0) return o;
|
|
919
|
-
let
|
|
920
|
-
W(
|
|
921
|
-
let y =
|
|
955
|
+
let s = this.plane, f = t.plane, p = f.distanceToPoint(this.a), g = f.distanceToPoint(this.b), v = f.distanceToPoint(this.c);
|
|
956
|
+
W(p) && (p = 0), W(g) && (g = 0), W(v) && (v = 0);
|
|
957
|
+
let y = p * g, b = p * v;
|
|
922
958
|
if (y > 0 && b > 0) return !1;
|
|
923
|
-
let S =
|
|
959
|
+
let S = s.distanceToPoint(t.a), C = s.distanceToPoint(t.b), w = s.distanceToPoint(t.c);
|
|
924
960
|
W(S) && (S = 0), W(C) && (C = 0), W(w) && (w = 0);
|
|
925
961
|
let T = S * C, ee = S * w;
|
|
926
962
|
if (T > 0 && ee > 0) return !1;
|
|
927
|
-
i.copy(
|
|
928
|
-
let
|
|
929
|
-
re > ne && (ne = re,
|
|
930
|
-
let D = it[
|
|
931
|
-
if (
|
|
963
|
+
i.copy(s.normal), a.copy(f.normal);
|
|
964
|
+
let E = i.cross(a), te = 0, ne = Math.abs(E.x), re = Math.abs(E.y);
|
|
965
|
+
re > ne && (ne = re, te = 1), Math.abs(E.z) > ne && (te = 2);
|
|
966
|
+
let D = it[te], ie = this.a[D], O = this.b[D], ae = this.c[D], oe = t.a[D], se = t.b[D], ce = t.c[D];
|
|
967
|
+
if (_(this, ie, O, ae, y, b, p, g, v, d, c) || _(t, oe, se, ce, T, ee, S, C, w, m, l)) return h(this, t, n, r);
|
|
932
968
|
if (d.y < d.x) {
|
|
933
969
|
let e = d.y;
|
|
934
|
-
d.y = d.x, d.x = e, u.copy(
|
|
970
|
+
d.y = d.x, d.x = e, u.copy(c.start), c.start.copy(c.end), c.end.copy(u);
|
|
935
971
|
}
|
|
936
|
-
if (
|
|
937
|
-
let e =
|
|
938
|
-
|
|
972
|
+
if (m.y < m.x) {
|
|
973
|
+
let e = m.y;
|
|
974
|
+
m.y = m.x, m.x = e, u.copy(l.start), l.start.copy(l.end), l.end.copy(u);
|
|
939
975
|
}
|
|
940
|
-
return d.y <
|
|
976
|
+
return d.y < m.x || m.y < d.x ? !1 : (n && (m.x > d.x ? n.start.copy(l.start) : n.start.copy(c.start), m.y < d.y ? n.end.copy(l.end) : n.end.copy(c.end)), !0);
|
|
941
977
|
};
|
|
942
978
|
})(), G.prototype.distanceToPoint = (function() {
|
|
943
|
-
let e = /* @__PURE__ */ new
|
|
979
|
+
let e = /* @__PURE__ */ new p();
|
|
944
980
|
return function(t) {
|
|
945
981
|
return this.closestPointToPoint(t, e), t.distanceTo(e);
|
|
946
982
|
};
|
|
947
983
|
})(), G.prototype.distanceToTriangle = (function() {
|
|
948
|
-
let e = /* @__PURE__ */ new
|
|
984
|
+
let e = /* @__PURE__ */ new p(), t = /* @__PURE__ */ new p(), n = [
|
|
949
985
|
"a",
|
|
950
986
|
"b",
|
|
951
987
|
"c"
|
|
952
|
-
], r = /* @__PURE__ */ new
|
|
988
|
+
], r = /* @__PURE__ */ new o(), i = /* @__PURE__ */ new o();
|
|
953
989
|
return function(a, o = null, s = null) {
|
|
954
990
|
let c = o || s ? r : null;
|
|
955
991
|
if (this.intersectsTriangle(a, c, !0)) return (o || s) && (o && c.getCenter(o), s && c.getCenter(s)), 0;
|
|
@@ -977,11 +1013,11 @@ G.prototype.closestPointToSegment = (function() {
|
|
|
977
1013
|
//#region node_modules/three-mesh-bvh/src/math/OrientedBox.js
|
|
978
1014
|
var K = class {
|
|
979
1015
|
constructor(e, t, n) {
|
|
980
|
-
this.isOrientedBox = !0, this.min = new
|
|
1016
|
+
this.isOrientedBox = !0, this.min = new p(), this.max = new p(), this.matrix = new s(), this.invMatrix = new s(), this.points = Array(8).fill().map(() => new p()), this.satAxes = [
|
|
981
1017
|
,
|
|
982
1018
|
,
|
|
983
1019
|
,
|
|
984
|
-
].fill().map(() => new
|
|
1020
|
+
].fill().map(() => new p()), this.satBounds = [
|
|
985
1021
|
,
|
|
986
1022
|
,
|
|
987
1023
|
,
|
|
@@ -1030,7 +1066,7 @@ K.prototype.update = (function() {
|
|
|
1030
1066
|
,
|
|
1031
1067
|
,
|
|
1032
1068
|
,
|
|
1033
|
-
], n = /* @__PURE__ */ new H(), r = /* @__PURE__ */ new H(), i = /* @__PURE__ */ new
|
|
1069
|
+
], n = /* @__PURE__ */ new H(), r = /* @__PURE__ */ new H(), i = /* @__PURE__ */ new p();
|
|
1034
1070
|
return function(a) {
|
|
1035
1071
|
this.needsUpdate && this.update(), a.isExtendedTriangle ? a.needsUpdate && a.update() : (e.copy(a), e.update(), a = e);
|
|
1036
1072
|
let o = this.satBounds, s = this.satAxes;
|
|
@@ -1058,7 +1094,7 @@ K.prototype.update = (function() {
|
|
|
1058
1094
|
return this.needsUpdate && this.update(), t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min, this.max).applyMatrix4(this.matrix), t;
|
|
1059
1095
|
};
|
|
1060
1096
|
})(), K.prototype.distanceToPoint = (function() {
|
|
1061
|
-
let e = new
|
|
1097
|
+
let e = new p();
|
|
1062
1098
|
return function(t) {
|
|
1063
1099
|
return this.closestPointToPoint(t, e), t.distanceTo(e);
|
|
1064
1100
|
};
|
|
@@ -1067,7 +1103,7 @@ K.prototype.update = (function() {
|
|
|
1067
1103
|
"x",
|
|
1068
1104
|
"y",
|
|
1069
1105
|
"z"
|
|
1070
|
-
], t = /* @__PURE__ */ Array(12).fill().map(() => new
|
|
1106
|
+
], t = /* @__PURE__ */ Array(12).fill().map(() => new o()), n = /* @__PURE__ */ Array(12).fill().map(() => new o()), r = /* @__PURE__ */ new p(), i = /* @__PURE__ */ new p();
|
|
1071
1107
|
return function(a, o = 0, s = null, c = null) {
|
|
1072
1108
|
if (this.needsUpdate && this.update(), this.intersectsBox(a)) return (s || c) && (a.getCenter(i), this.closestPointToPoint(i, r), a.closestPointToPoint(r, i), s && s.copy(r), c && c.copy(i)), 0;
|
|
1073
1109
|
let l = o * o, u = a.min, d = a.max, f = this.points, p = Infinity;
|
|
@@ -1105,7 +1141,7 @@ var q = /* @__PURE__ */ new class extends Oe {
|
|
|
1105
1141
|
constructor() {
|
|
1106
1142
|
super(() => new G());
|
|
1107
1143
|
}
|
|
1108
|
-
}(), ot = /* @__PURE__ */ new
|
|
1144
|
+
}(), ot = /* @__PURE__ */ new p(), st = /* @__PURE__ */ new p();
|
|
1109
1145
|
function ct(e, t, n = {}, r = 0, i = Infinity) {
|
|
1110
1146
|
let a = r * r, o = i * i, s = Infinity, c = null;
|
|
1111
1147
|
if (e.shapecast({
|
|
@@ -1122,10 +1158,10 @@ function ct(e, t, n = {}, r = 0, i = Infinity) {
|
|
|
1122
1158
|
}
|
|
1123
1159
|
//#endregion
|
|
1124
1160
|
//#region node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js
|
|
1125
|
-
var lt = parseInt(
|
|
1126
|
-
function vt(e, n, r,
|
|
1161
|
+
var lt = parseInt(l) >= 169, ut = parseInt(l) <= 161, J = /* @__PURE__ */ new p(), Y = /* @__PURE__ */ new p(), X = /* @__PURE__ */ new p(), dt = /* @__PURE__ */ new f(), ft = /* @__PURE__ */ new f(), pt = /* @__PURE__ */ new f(), mt = /* @__PURE__ */ new p(), ht = /* @__PURE__ */ new p(), gt = /* @__PURE__ */ new p(), _t = /* @__PURE__ */ new p();
|
|
1162
|
+
function vt(e, n, r, a, o, s, c, l) {
|
|
1127
1163
|
let u;
|
|
1128
|
-
if (u = s === t ? e.intersectTriangle(
|
|
1164
|
+
if (u = s === t ? e.intersectTriangle(a, r, n, !0, o) : e.intersectTriangle(n, r, a, s !== i, o), u === null) return null;
|
|
1129
1165
|
let d = e.origin.distanceTo(o);
|
|
1130
1166
|
return d < c || d > l ? null : {
|
|
1131
1167
|
distance: d,
|
|
@@ -1134,36 +1170,36 @@ function vt(e, n, r, i, o, s, c, l) {
|
|
|
1134
1170
|
}
|
|
1135
1171
|
function yt(e, t, n, r, i, a, o, s, c, l, u) {
|
|
1136
1172
|
J.fromBufferAttribute(t, a), Y.fromBufferAttribute(t, o), X.fromBufferAttribute(t, s);
|
|
1137
|
-
let
|
|
1138
|
-
if (
|
|
1173
|
+
let m = vt(e, J, Y, X, _t, c, l, u);
|
|
1174
|
+
if (m) {
|
|
1139
1175
|
if (r) {
|
|
1140
|
-
dt.fromBufferAttribute(r, a), ft.fromBufferAttribute(r, o), pt.fromBufferAttribute(r, s),
|
|
1141
|
-
let e =
|
|
1142
|
-
lt || (
|
|
1176
|
+
dt.fromBufferAttribute(r, a), ft.fromBufferAttribute(r, o), pt.fromBufferAttribute(r, s), m.uv = new f();
|
|
1177
|
+
let e = d.getInterpolation(_t, J, Y, X, dt, ft, pt, m.uv);
|
|
1178
|
+
lt || (m.uv = e);
|
|
1143
1179
|
}
|
|
1144
1180
|
if (i) {
|
|
1145
|
-
dt.fromBufferAttribute(i, a), ft.fromBufferAttribute(i, o), pt.fromBufferAttribute(i, s),
|
|
1146
|
-
let e =
|
|
1147
|
-
lt || (
|
|
1181
|
+
dt.fromBufferAttribute(i, a), ft.fromBufferAttribute(i, o), pt.fromBufferAttribute(i, s), m.uv1 = new f();
|
|
1182
|
+
let e = d.getInterpolation(_t, J, Y, X, dt, ft, pt, m.uv1);
|
|
1183
|
+
lt || (m.uv1 = e), ut && (m.uv2 = m.uv1);
|
|
1148
1184
|
}
|
|
1149
1185
|
if (n) {
|
|
1150
|
-
mt.fromBufferAttribute(n, a), ht.fromBufferAttribute(n, o), gt.fromBufferAttribute(n, s),
|
|
1151
|
-
let t =
|
|
1152
|
-
|
|
1186
|
+
mt.fromBufferAttribute(n, a), ht.fromBufferAttribute(n, o), gt.fromBufferAttribute(n, s), m.normal = new p();
|
|
1187
|
+
let t = d.getInterpolation(_t, J, Y, X, mt, ht, gt, m.normal);
|
|
1188
|
+
m.normal.dot(e.direction) > 0 && m.normal.multiplyScalar(-1), lt || (m.normal = t);
|
|
1153
1189
|
}
|
|
1154
1190
|
let t = {
|
|
1155
1191
|
a,
|
|
1156
1192
|
b: o,
|
|
1157
1193
|
c: s,
|
|
1158
|
-
normal: new
|
|
1194
|
+
normal: new p(),
|
|
1159
1195
|
materialIndex: 0
|
|
1160
1196
|
};
|
|
1161
|
-
if (
|
|
1162
|
-
let e = new
|
|
1163
|
-
|
|
1197
|
+
if (d.getNormal(J, Y, X, t.normal), m.face = t, m.faceIndex = a, lt) {
|
|
1198
|
+
let e = new p();
|
|
1199
|
+
d.getBarycoord(_t, J, Y, X, e), m.barycoord = e;
|
|
1164
1200
|
}
|
|
1165
1201
|
}
|
|
1166
|
-
return
|
|
1202
|
+
return m;
|
|
1167
1203
|
}
|
|
1168
1204
|
function bt(e) {
|
|
1169
1205
|
return e && e.isMaterial ? e.side : e;
|
|
@@ -1325,50 +1361,50 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1325
1361
|
}
|
|
1326
1362
|
//#endregion
|
|
1327
1363
|
//#region node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry.generated.js
|
|
1328
|
-
var Pt = /* @__PURE__ */ new
|
|
1329
|
-
function
|
|
1364
|
+
var Pt = /* @__PURE__ */ new n(), Ft = /* @__PURE__ */ new G(), $ = /* @__PURE__ */ new G(), It = /* @__PURE__ */ new s(), Lt = /* @__PURE__ */ new K(), Rt = /* @__PURE__ */ new K();
|
|
1365
|
+
function zt(e, t, n, r) {
|
|
1330
1366
|
L.setBuffer(e._roots[t]);
|
|
1331
|
-
let i =
|
|
1367
|
+
let i = Bt(0, e, n, r);
|
|
1332
1368
|
return L.clearBuffer(), i;
|
|
1333
1369
|
}
|
|
1334
|
-
function
|
|
1370
|
+
function Bt(e, t, n, r, i = null) {
|
|
1335
1371
|
let { float32Array: a, uint16Array: o, uint32Array: s } = L, c = e * 2;
|
|
1336
|
-
if (i === null && (n.boundingBox || n.computeBoundingBox(),
|
|
1372
|
+
if (i === null && (n.boundingBox || n.computeBoundingBox(), Lt.set(n.boundingBox.min, n.boundingBox.max, r), i = Lt), k(c, o)) {
|
|
1337
1373
|
let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p = A(e, s), m = j(c, o);
|
|
1338
|
-
if (
|
|
1339
|
-
intersectsBounds: (e) =>
|
|
1374
|
+
if (It.copy(r).invert(), n.boundsTree) return O(P(e), a, Rt), Rt.matrix.copy(It), Rt.needsUpdate = !0, n.boundsTree.shapecast({
|
|
1375
|
+
intersectsBounds: (e) => Rt.intersectsBox(e),
|
|
1340
1376
|
intersectsTriangle: (e) => {
|
|
1341
1377
|
e.a.applyMatrix4(r), e.b.applyMatrix4(r), e.c.applyMatrix4(r), e.needsUpdate = !0;
|
|
1342
|
-
for (let t = p * 3, n = (m + p) * 3; t < n; t += 3) if (Z(
|
|
1378
|
+
for (let t = p * 3, n = (m + p) * 3; t < n; t += 3) if (Z($, t, l, u), $.needsUpdate = !0, e.intersectsTriangle($)) return !0;
|
|
1343
1379
|
return !1;
|
|
1344
1380
|
}
|
|
1345
1381
|
});
|
|
1346
1382
|
{
|
|
1347
1383
|
let e = qe(n);
|
|
1348
1384
|
for (let t = p * 3, n = (m + p) * 3; t < n; t += 3) {
|
|
1349
|
-
Z(Ft, t, l, u), Ft.a.applyMatrix4(
|
|
1350
|
-
for (let t = 0, n = e * 3; t < n; t += 3) if (Z(
|
|
1385
|
+
Z(Ft, t, l, u), Ft.a.applyMatrix4(It), Ft.b.applyMatrix4(It), Ft.c.applyMatrix4(It), Ft.needsUpdate = !0;
|
|
1386
|
+
for (let t = 0, n = e * 3; t < n; t += 3) if (Z($, t, d, f), $.needsUpdate = !0, Ft.intersectsTriangle($)) return !0;
|
|
1351
1387
|
}
|
|
1352
1388
|
}
|
|
1353
1389
|
} else {
|
|
1354
1390
|
let o = M(e), c = N(e, s);
|
|
1355
|
-
return O(P(o), a, Pt), !!(i.intersectsBox(Pt) &&
|
|
1391
|
+
return O(P(o), a, Pt), !!(i.intersectsBox(Pt) && Bt(o, t, n, r, i) || (O(P(c), a, Pt), i.intersectsBox(Pt) && Bt(c, t, n, r, i)));
|
|
1356
1392
|
}
|
|
1357
1393
|
}
|
|
1358
1394
|
//#endregion
|
|
1359
1395
|
//#region node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry.generated.js
|
|
1360
|
-
var
|
|
1361
|
-
function
|
|
1362
|
-
t.boundingBox || t.computeBoundingBox(),
|
|
1363
|
-
let s = e.geometry, c = s.attributes.position, l = s.index, u = t.attributes.position, d = t.index, f = q.getPrimitive(), p = q.getPrimitive(), m =
|
|
1364
|
-
i && (g =
|
|
1396
|
+
var Vt = /* @__PURE__ */ new s(), Ht = /* @__PURE__ */ new K(), Ut = /* @__PURE__ */ new K(), Wt = /* @__PURE__ */ new p(), Gt = /* @__PURE__ */ new p(), Kt = /* @__PURE__ */ new p(), qt = /* @__PURE__ */ new p();
|
|
1397
|
+
function Jt(e, t, n, r = {}, i = {}, a = 0, o = Infinity) {
|
|
1398
|
+
t.boundingBox || t.computeBoundingBox(), Ht.set(t.boundingBox.min, t.boundingBox.max, n), Ht.needsUpdate = !0;
|
|
1399
|
+
let s = e.geometry, c = s.attributes.position, l = s.index, u = t.attributes.position, d = t.index, f = q.getPrimitive(), p = q.getPrimitive(), m = Wt, h = Gt, g = null, _ = null;
|
|
1400
|
+
i && (g = Kt, _ = qt);
|
|
1365
1401
|
let v = Infinity, y = null, b = null;
|
|
1366
|
-
return
|
|
1367
|
-
boundsTraverseOrder: (e) =>
|
|
1368
|
-
intersectsBounds: (e, t, n) => n < v && n < o ? (t && (
|
|
1402
|
+
return Vt.copy(n).invert(), Ut.matrix.copy(Vt), e.shapecast({
|
|
1403
|
+
boundsTraverseOrder: (e) => Ht.distanceToBox(e),
|
|
1404
|
+
intersectsBounds: (e, t, n) => n < v && n < o ? (t && (Ut.min.copy(e.min), Ut.max.copy(e.max), Ut.needsUpdate = !0), !0) : !1,
|
|
1369
1405
|
intersectsRange: (e, r) => {
|
|
1370
1406
|
if (t.boundsTree) return t.boundsTree.shapecast({
|
|
1371
|
-
boundsTraverseOrder: (e) =>
|
|
1407
|
+
boundsTraverseOrder: (e) => Ut.distanceToBox(e),
|
|
1372
1408
|
intersectsBounds: (e, t, n) => n < v && n < o,
|
|
1373
1409
|
intersectsRange: (t, i) => {
|
|
1374
1410
|
for (let o = t, s = t + i; o < s; o++) {
|
|
@@ -1393,11 +1429,11 @@ function Yt(e, t, n, r = {}, i = {}, a = 0, o = Infinity) {
|
|
|
1393
1429
|
}
|
|
1394
1430
|
}
|
|
1395
1431
|
}
|
|
1396
|
-
}), q.releasePrimitive(f), q.releasePrimitive(p), v === Infinity ? null : (r.point ? r.point.copy(h) : r.point = h.clone(), r.distance = v, r.faceIndex = y, i && (i.point ? i.point.copy(_) : i.point = _.clone(), i.point.applyMatrix4(
|
|
1432
|
+
}), q.releasePrimitive(f), q.releasePrimitive(p), v === Infinity ? null : (r.point ? r.point.copy(h) : r.point = h.clone(), r.distance = v, r.faceIndex = y, i && (i.point ? i.point.copy(_) : i.point = _.clone(), i.point.applyMatrix4(Vt), h.applyMatrix4(Vt), i.distance = h.sub(i.point).length(), i.faceIndex = b), r);
|
|
1397
1433
|
}
|
|
1398
1434
|
//#endregion
|
|
1399
1435
|
//#region node_modules/three-mesh-bvh/src/core/cast/refit_indirect.generated.js
|
|
1400
|
-
function
|
|
1436
|
+
function Yt(e, t = null) {
|
|
1401
1437
|
t && Array.isArray(t) && (t = new Set(t));
|
|
1402
1438
|
let n = e.geometry, r = n.index ? n.index.array : null, i = n.attributes.position, a, o, s, c, l = 0, u = e._roots;
|
|
1403
1439
|
for (let e = 0, t = u.length; e < t; e++) a = u[e], o = new Uint32Array(a), s = new Uint16Array(a), c = new Float32Array(a), d(0, l), l += a.byteLength;
|
|
@@ -1438,94 +1474,94 @@ function Xt(e, t = null) {
|
|
|
1438
1474
|
}
|
|
1439
1475
|
//#endregion
|
|
1440
1476
|
//#region node_modules/three-mesh-bvh/src/core/cast/raycast_indirect.generated.js
|
|
1441
|
-
function
|
|
1442
|
-
L.setBuffer(e._roots[t]),
|
|
1477
|
+
function Xt(e, t, n, r, i, a, o) {
|
|
1478
|
+
L.setBuffer(e._roots[t]), Zt(0, e, n, r, i, a, o), L.clearBuffer();
|
|
1443
1479
|
}
|
|
1444
|
-
function
|
|
1480
|
+
function Zt(e, t, n, r, i, a, o) {
|
|
1445
1481
|
let { float32Array: s, uint16Array: c, uint32Array: l } = L, u = e * 2;
|
|
1446
1482
|
if (k(u, c)) Et(t, n, r, A(e, l), j(u, c), i, a, o);
|
|
1447
1483
|
else {
|
|
1448
1484
|
let c = M(e);
|
|
1449
|
-
Q(c, s, r, a, o) &&
|
|
1485
|
+
Q(c, s, r, a, o) && Zt(c, t, n, r, i, a, o);
|
|
1450
1486
|
let u = N(e, l);
|
|
1451
|
-
Q(u, s, r, a, o) &&
|
|
1487
|
+
Q(u, s, r, a, o) && Zt(u, t, n, r, i, a, o);
|
|
1452
1488
|
}
|
|
1453
1489
|
}
|
|
1454
1490
|
//#endregion
|
|
1455
1491
|
//#region node_modules/three-mesh-bvh/src/core/cast/raycastFirst_indirect.generated.js
|
|
1456
|
-
var
|
|
1492
|
+
var Qt = [
|
|
1457
1493
|
"x",
|
|
1458
1494
|
"y",
|
|
1459
1495
|
"z"
|
|
1460
1496
|
];
|
|
1461
|
-
function
|
|
1497
|
+
function $t(e, t, n, r, i, a) {
|
|
1462
1498
|
L.setBuffer(e._roots[t]);
|
|
1463
|
-
let o =
|
|
1499
|
+
let o = en(0, e, n, r, i, a);
|
|
1464
1500
|
return L.clearBuffer(), o;
|
|
1465
1501
|
}
|
|
1466
|
-
function
|
|
1502
|
+
function en(e, t, n, r, i, a) {
|
|
1467
1503
|
let { float32Array: o, uint16Array: s, uint32Array: c } = L, l = e * 2;
|
|
1468
1504
|
if (k(l, s)) return Dt(t, n, r, A(e, c), j(l, s), i, a);
|
|
1469
1505
|
{
|
|
1470
|
-
let s = ue(e, c), l =
|
|
1506
|
+
let s = ue(e, c), l = Qt[s], u = r.direction[l] >= 0, d, f;
|
|
1471
1507
|
u ? (d = M(e), f = N(e, c)) : (d = N(e, c), f = M(e));
|
|
1472
|
-
let p = Q(d, o, r, i, a) ?
|
|
1508
|
+
let p = Q(d, o, r, i, a) ? en(d, t, n, r, i, a) : null;
|
|
1473
1509
|
if (p) {
|
|
1474
1510
|
let e = p.point[l];
|
|
1475
1511
|
if (u ? e <= o[f + s] : e >= o[f + s + 3]) return p;
|
|
1476
1512
|
}
|
|
1477
|
-
let m = Q(f, o, r, i, a) ?
|
|
1513
|
+
let m = Q(f, o, r, i, a) ? en(f, t, n, r, i, a) : null;
|
|
1478
1514
|
return p && m ? p.distance <= m.distance ? p : m : p || m || null;
|
|
1479
1515
|
}
|
|
1480
1516
|
}
|
|
1481
1517
|
//#endregion
|
|
1482
1518
|
//#region node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry_indirect.generated.js
|
|
1483
|
-
var
|
|
1484
|
-
function
|
|
1519
|
+
var tn = /* @__PURE__ */ new n(), nn = /* @__PURE__ */ new G(), rn = /* @__PURE__ */ new G(), an = /* @__PURE__ */ new s(), on = /* @__PURE__ */ new K(), sn = /* @__PURE__ */ new K();
|
|
1520
|
+
function cn(e, t, n, r) {
|
|
1485
1521
|
L.setBuffer(e._roots[t]);
|
|
1486
|
-
let i =
|
|
1522
|
+
let i = ln(0, e, n, r);
|
|
1487
1523
|
return L.clearBuffer(), i;
|
|
1488
1524
|
}
|
|
1489
|
-
function
|
|
1525
|
+
function ln(e, t, n, r, i = null) {
|
|
1490
1526
|
let { float32Array: a, uint16Array: o, uint32Array: s } = L, c = e * 2;
|
|
1491
|
-
if (i === null && (n.boundingBox || n.computeBoundingBox(),
|
|
1527
|
+
if (i === null && (n.boundingBox || n.computeBoundingBox(), on.set(n.boundingBox.min, n.boundingBox.max, r), i = on), k(c, o)) {
|
|
1492
1528
|
let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p = A(e, s), m = j(c, o);
|
|
1493
|
-
if (
|
|
1494
|
-
intersectsBounds: (e) =>
|
|
1529
|
+
if (an.copy(r).invert(), n.boundsTree) return O(P(e), a, sn), sn.matrix.copy(an), sn.needsUpdate = !0, n.boundsTree.shapecast({
|
|
1530
|
+
intersectsBounds: (e) => sn.intersectsBox(e),
|
|
1495
1531
|
intersectsTriangle: (e) => {
|
|
1496
1532
|
e.a.applyMatrix4(r), e.b.applyMatrix4(r), e.c.applyMatrix4(r), e.needsUpdate = !0;
|
|
1497
|
-
for (let n = p, r = m + p; n < r; n++) if (Z(
|
|
1533
|
+
for (let n = p, r = m + p; n < r; n++) if (Z(rn, 3 * t.resolveTriangleIndex(n), l, u), rn.needsUpdate = !0, e.intersectsTriangle(rn)) return !0;
|
|
1498
1534
|
return !1;
|
|
1499
1535
|
}
|
|
1500
1536
|
});
|
|
1501
1537
|
{
|
|
1502
1538
|
let e = qe(n);
|
|
1503
1539
|
for (let n = p, r = m + p; n < r; n++) {
|
|
1504
|
-
Z(
|
|
1505
|
-
for (let t = 0, n = e * 3; t < n; t += 3) if (Z(
|
|
1540
|
+
Z(nn, 3 * t.resolveTriangleIndex(n), l, u), nn.a.applyMatrix4(an), nn.b.applyMatrix4(an), nn.c.applyMatrix4(an), nn.needsUpdate = !0;
|
|
1541
|
+
for (let t = 0, n = e * 3; t < n; t += 3) if (Z(rn, t, d, f), rn.needsUpdate = !0, nn.intersectsTriangle(rn)) return !0;
|
|
1506
1542
|
}
|
|
1507
1543
|
}
|
|
1508
1544
|
} else {
|
|
1509
1545
|
let o = M(e), c = N(e, s);
|
|
1510
|
-
return O(P(o), a,
|
|
1546
|
+
return O(P(o), a, tn), !!(i.intersectsBox(tn) && ln(o, t, n, r, i) || (O(P(c), a, tn), i.intersectsBox(tn) && ln(c, t, n, r, i)));
|
|
1511
1547
|
}
|
|
1512
1548
|
}
|
|
1513
1549
|
//#endregion
|
|
1514
1550
|
//#region node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry_indirect.generated.js
|
|
1515
|
-
var
|
|
1516
|
-
function
|
|
1517
|
-
t.boundingBox || t.computeBoundingBox(),
|
|
1518
|
-
let s = e.geometry, c = s.attributes.position, l = s.index, u = t.attributes.position, d = t.index, f = q.getPrimitive(), p = q.getPrimitive(), m =
|
|
1519
|
-
i && (g =
|
|
1551
|
+
var un = /* @__PURE__ */ new s(), dn = /* @__PURE__ */ new K(), fn = /* @__PURE__ */ new K(), pn = /* @__PURE__ */ new p(), mn = /* @__PURE__ */ new p(), hn = /* @__PURE__ */ new p(), gn = /* @__PURE__ */ new p();
|
|
1552
|
+
function _n(e, t, n, r = {}, i = {}, a = 0, o = Infinity) {
|
|
1553
|
+
t.boundingBox || t.computeBoundingBox(), dn.set(t.boundingBox.min, t.boundingBox.max, n), dn.needsUpdate = !0;
|
|
1554
|
+
let s = e.geometry, c = s.attributes.position, l = s.index, u = t.attributes.position, d = t.index, f = q.getPrimitive(), p = q.getPrimitive(), m = pn, h = mn, g = null, _ = null;
|
|
1555
|
+
i && (g = hn, _ = gn);
|
|
1520
1556
|
let v = Infinity, y = null, b = null;
|
|
1521
|
-
return
|
|
1522
|
-
boundsTraverseOrder: (e) =>
|
|
1523
|
-
intersectsBounds: (e, t, n) => n < v && n < o ? (t && (
|
|
1557
|
+
return un.copy(n).invert(), fn.matrix.copy(un), e.shapecast({
|
|
1558
|
+
boundsTraverseOrder: (e) => dn.distanceToBox(e),
|
|
1559
|
+
intersectsBounds: (e, t, n) => n < v && n < o ? (t && (fn.min.copy(e.min), fn.max.copy(e.max), fn.needsUpdate = !0), !0) : !1,
|
|
1524
1560
|
intersectsRange: (r, i) => {
|
|
1525
1561
|
if (t.boundsTree) {
|
|
1526
1562
|
let s = t.boundsTree;
|
|
1527
1563
|
return s.shapecast({
|
|
1528
|
-
boundsTraverseOrder: (e) =>
|
|
1564
|
+
boundsTraverseOrder: (e) => fn.distanceToBox(e),
|
|
1529
1565
|
intersectsBounds: (e, t, n) => n < v && n < o,
|
|
1530
1566
|
intersectsRange: (t, o) => {
|
|
1531
1567
|
for (let x = t, S = t + o; x < S; x++) {
|
|
@@ -1553,20 +1589,20 @@ function vn(e, t, n, r = {}, i = {}, a = 0, o = Infinity) {
|
|
|
1553
1589
|
}
|
|
1554
1590
|
}
|
|
1555
1591
|
}
|
|
1556
|
-
}), q.releasePrimitive(f), q.releasePrimitive(p), v === Infinity ? null : (r.point ? r.point.copy(h) : r.point = h.clone(), r.distance = v, r.faceIndex = y, i && (i.point ? i.point.copy(_) : i.point = _.clone(), i.point.applyMatrix4(
|
|
1592
|
+
}), q.releasePrimitive(f), q.releasePrimitive(p), v === Infinity ? null : (r.point ? r.point.copy(h) : r.point = h.clone(), r.distance = v, r.faceIndex = y, i && (i.point ? i.point.copy(_) : i.point = _.clone(), i.point.applyMatrix4(un), h.applyMatrix4(un), i.distance = h.sub(i.point).length(), i.faceIndex = b), r);
|
|
1557
1593
|
}
|
|
1558
1594
|
//#endregion
|
|
1559
1595
|
//#region node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js
|
|
1560
|
-
function
|
|
1596
|
+
function vn(e, t, n) {
|
|
1561
1597
|
return e === null ? null : (e.point.applyMatrix4(t.matrixWorld), e.distance = e.point.distanceTo(n.ray.origin), e.object = t, e);
|
|
1562
1598
|
}
|
|
1563
1599
|
//#endregion
|
|
1564
1600
|
//#region node_modules/three-mesh-bvh/src/core/MeshBVH.js
|
|
1565
|
-
var
|
|
1601
|
+
var yn = /* @__PURE__ */ new K(), bn = /* @__PURE__ */ new u(), xn = /* @__PURE__ */ new p(), Sn = /* @__PURE__ */ new s(), Cn = /* @__PURE__ */ new p(), wn = [
|
|
1566
1602
|
"getX",
|
|
1567
1603
|
"getY",
|
|
1568
1604
|
"getZ"
|
|
1569
|
-
],
|
|
1605
|
+
], Tn = class e extends et {
|
|
1570
1606
|
static serialize(e, t = {}) {
|
|
1571
1607
|
t = {
|
|
1572
1608
|
cloneBuffers: !0,
|
|
@@ -1580,22 +1616,22 @@ var bn = /* @__PURE__ */ new K(), xn = /* @__PURE__ */ new g(), Sn = /* @__PURE_
|
|
|
1580
1616
|
};
|
|
1581
1617
|
return t.cloneBuffers ? (o.roots = r.map((e) => e.slice()), o.index = a ? a.array.slice() : null, o.indirectBuffer = i ? i.slice() : null) : (o.roots = r, o.index = a ? a.array : null, o.indirectBuffer = i), o;
|
|
1582
1618
|
}
|
|
1583
|
-
static deserialize(t, n,
|
|
1584
|
-
|
|
1619
|
+
static deserialize(t, n, i = {}) {
|
|
1620
|
+
i = {
|
|
1585
1621
|
setIndex: !0,
|
|
1586
1622
|
indirect: !!t.indirectBuffer,
|
|
1587
|
-
...
|
|
1623
|
+
...i
|
|
1588
1624
|
};
|
|
1589
1625
|
let { index: a, roots: o, indirectBuffer: s } = t;
|
|
1590
1626
|
t.version || (console.warn("MeshBVH.deserialize: Serialization format has been changed and will be fixed up. It is recommended to regenerate any stored serialized data."), l(o));
|
|
1591
1627
|
let c = new e(n, {
|
|
1592
|
-
...
|
|
1628
|
+
...i,
|
|
1593
1629
|
[D]: !0
|
|
1594
1630
|
});
|
|
1595
|
-
if (c._roots = o, c._indirectBuffer = s || null,
|
|
1631
|
+
if (c._roots = o, c._indirectBuffer = s || null, i.setIndex) {
|
|
1596
1632
|
let e = n.getIndex();
|
|
1597
1633
|
if (e === null) {
|
|
1598
|
-
let e = new
|
|
1634
|
+
let e = new r(t.index, 1, !1);
|
|
1599
1635
|
n.setIndex(e);
|
|
1600
1636
|
} else e.array !== a && (e.array.set(a), e.needsUpdate = !0);
|
|
1601
1637
|
}
|
|
@@ -1629,7 +1665,7 @@ var bn = /* @__PURE__ */ new K(), xn = /* @__PURE__ */ new g(), Sn = /* @__PURE_
|
|
|
1629
1665
|
let r = this.geometry, i = this._indirectBuffer, a = r.attributes.position, o = r.index ? r.index.array : null, s = (i ? i[e] : e) * 3, c = s + 0, l = s + 1, u = s + 2;
|
|
1630
1666
|
o && (c = o[c], l = o[l], u = o[u]);
|
|
1631
1667
|
for (let e = 0; e < 3; e++) {
|
|
1632
|
-
let r = a[
|
|
1668
|
+
let r = a[wn[e]](c), i = a[wn[e]](l), o = a[wn[e]](u), s = r;
|
|
1633
1669
|
i < s && (s = i), o < s && (s = o);
|
|
1634
1670
|
let d = r;
|
|
1635
1671
|
i > d && (d = i), o > d && (d = o), t[n + e] = s, t[n + e + 3] = d;
|
|
@@ -1665,38 +1701,38 @@ var bn = /* @__PURE__ */ new K(), xn = /* @__PURE__ */ new g(), Sn = /* @__PURE_
|
|
|
1665
1701
|
raycastObject3D(e, t, n = []) {
|
|
1666
1702
|
let { material: r } = e;
|
|
1667
1703
|
if (r === void 0) return;
|
|
1668
|
-
|
|
1669
|
-
let i =
|
|
1704
|
+
Sn.copy(e.matrixWorld).invert(), bn.copy(t.ray).applyMatrix4(Sn), Cn.setFromMatrixScale(e.matrixWorld), xn.copy(bn.direction).multiply(Cn);
|
|
1705
|
+
let i = xn.length(), a = t.near / i, o = t.far / i;
|
|
1670
1706
|
if (t.firstHitOnly === !0) {
|
|
1671
|
-
let i = this.raycastFirst(
|
|
1672
|
-
i =
|
|
1707
|
+
let i = this.raycastFirst(bn, r, a, o);
|
|
1708
|
+
i = vn(i, e, t), i && n.push(i);
|
|
1673
1709
|
} else {
|
|
1674
|
-
let i = this.raycast(
|
|
1710
|
+
let i = this.raycast(bn, r, a, o);
|
|
1675
1711
|
for (let r = 0, a = i.length; r < a; r++) {
|
|
1676
|
-
let a =
|
|
1712
|
+
let a = vn(i[r], e, t);
|
|
1677
1713
|
a && n.push(a);
|
|
1678
1714
|
}
|
|
1679
1715
|
}
|
|
1680
1716
|
return n;
|
|
1681
1717
|
}
|
|
1682
1718
|
refit(e = null) {
|
|
1683
|
-
return (this.indirect ?
|
|
1684
|
-
}
|
|
1685
|
-
raycast(e, t =
|
|
1686
|
-
let i = this._roots,
|
|
1687
|
-
for (let
|
|
1688
|
-
return
|
|
1689
|
-
}
|
|
1690
|
-
raycastFirst(e, t =
|
|
1691
|
-
let i = this._roots,
|
|
1692
|
-
for (let
|
|
1693
|
-
let i = s(this,
|
|
1694
|
-
i != null && (
|
|
1719
|
+
return (this.indirect ? Yt : Tt)(this, e);
|
|
1720
|
+
}
|
|
1721
|
+
raycast(e, t = a, n = 0, r = Infinity) {
|
|
1722
|
+
let i = this._roots, o = [], s = this.indirect ? Xt : kt;
|
|
1723
|
+
for (let a = 0, c = i.length; a < c; a++) s(this, a, t, e, o, n, r);
|
|
1724
|
+
return o;
|
|
1725
|
+
}
|
|
1726
|
+
raycastFirst(e, t = a, n = 0, r = Infinity) {
|
|
1727
|
+
let i = this._roots, o = null, s = this.indirect ? $t : Mt;
|
|
1728
|
+
for (let a = 0, c = i.length; a < c; a++) {
|
|
1729
|
+
let i = s(this, a, t, e, n, r);
|
|
1730
|
+
i != null && (o == null || i.distance < o.distance) && (o = i);
|
|
1695
1731
|
}
|
|
1696
|
-
return
|
|
1732
|
+
return o;
|
|
1697
1733
|
}
|
|
1698
1734
|
intersectsGeometry(e, t) {
|
|
1699
|
-
let n = !1, r = this._roots, i = this.indirect ?
|
|
1735
|
+
let n = !1, r = this._roots, i = this.indirect ? cn : zt;
|
|
1700
1736
|
for (let a = 0, o = r.length; a < o && (n = i(this, a, e, t), !n); a++);
|
|
1701
1737
|
return n;
|
|
1702
1738
|
}
|
|
@@ -1740,9 +1776,9 @@ var bn = /* @__PURE__ */ new K(), xn = /* @__PURE__ */ new g(), Sn = /* @__PURE_
|
|
|
1740
1776
|
return super.bvhcast(t, n, { intersectsRanges: i });
|
|
1741
1777
|
}
|
|
1742
1778
|
intersectsBox(e, t) {
|
|
1743
|
-
return
|
|
1744
|
-
intersectsBounds: (e) =>
|
|
1745
|
-
intersectsTriangle: (e) =>
|
|
1779
|
+
return yn.set(e.min, e.max, t), yn.needsUpdate = !0, this.shapecast({
|
|
1780
|
+
intersectsBounds: (e) => yn.intersectsBox(e),
|
|
1781
|
+
intersectsTriangle: (e) => yn.intersectsTriangle(e)
|
|
1746
1782
|
});
|
|
1747
1783
|
}
|
|
1748
1784
|
intersectsSphere(e) {
|
|
@@ -1752,121 +1788,22 @@ var bn = /* @__PURE__ */ new K(), xn = /* @__PURE__ */ new g(), Sn = /* @__PURE_
|
|
|
1752
1788
|
});
|
|
1753
1789
|
}
|
|
1754
1790
|
closestPointToGeometry(e, t, n = {}, r = {}, i = 0, a = Infinity) {
|
|
1755
|
-
return (this.indirect ?
|
|
1791
|
+
return (this.indirect ? _n : Jt)(this, e, t, n, r, i, a);
|
|
1756
1792
|
}
|
|
1757
1793
|
closestPointToPoint(e, t = {}, n = 0, r = Infinity) {
|
|
1758
1794
|
return ct(this, e, t, n, r);
|
|
1759
1795
|
}
|
|
1760
|
-
}, Dn =
|
|
1761
|
-
Mesh: f.prototype.raycast,
|
|
1762
|
-
Line: s.prototype.raycast,
|
|
1763
|
-
LineSegments: u.prototype.raycast,
|
|
1764
|
-
LineLoop: l.prototype.raycast,
|
|
1765
|
-
Points: m.prototype.raycast,
|
|
1766
|
-
BatchedMesh: n.prototype.raycast
|
|
1767
|
-
}, $ = /* @__PURE__ */ new f(), On = [];
|
|
1768
|
-
function kn(e, t) {
|
|
1769
|
-
if (this.isBatchedMesh) An.call(this, e, t);
|
|
1770
|
-
else {
|
|
1771
|
-
let { geometry: n } = this;
|
|
1772
|
-
if (n.boundsTree) n.boundsTree.raycastObject3D(this, e, t);
|
|
1773
|
-
else {
|
|
1774
|
-
let n;
|
|
1775
|
-
if (this instanceof f) n = Dn.Mesh;
|
|
1776
|
-
else if (this instanceof u) n = Dn.LineSegments;
|
|
1777
|
-
else if (this instanceof l) n = Dn.LineLoop;
|
|
1778
|
-
else if (this instanceof s) n = Dn.Line;
|
|
1779
|
-
else if (this instanceof m) n = Dn.Points;
|
|
1780
|
-
else throw Error("BVH: Fallback raycast function not found.");
|
|
1781
|
-
n.call(this, e, t);
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
function An(e, t) {
|
|
1786
|
-
if (this.boundsTrees) {
|
|
1787
|
-
let n = this.boundsTrees, r = this._drawInfo || this._instanceInfo, i = this._drawRanges || this._geometryInfo, a = this.matrixWorld;
|
|
1788
|
-
$.material = this.material, $.geometry = this.geometry;
|
|
1789
|
-
let o = $.geometry.boundsTree, s = $.geometry.drawRange;
|
|
1790
|
-
$.geometry.boundingSphere === null && ($.geometry.boundingSphere = new _());
|
|
1791
|
-
for (let o = 0, s = r.length; o < s; o++) {
|
|
1792
|
-
if (!this.getVisibleAt(o)) continue;
|
|
1793
|
-
let s = r[o].geometryIndex;
|
|
1794
|
-
if ($.geometry.boundsTree = n[s], this.getMatrixAt(o, $.matrixWorld).premultiply(a), !$.geometry.boundsTree) {
|
|
1795
|
-
this.getBoundingBoxAt(s, $.geometry.boundingBox), this.getBoundingSphereAt(s, $.geometry.boundingSphere);
|
|
1796
|
-
let e = i[s];
|
|
1797
|
-
$.geometry.setDrawRange(e.start, e.count);
|
|
1798
|
-
}
|
|
1799
|
-
$.raycast(e, On);
|
|
1800
|
-
for (let e = 0, n = On.length; e < n; e++) {
|
|
1801
|
-
let n = On[e];
|
|
1802
|
-
n.object = this, n.batchId = o, t.push(n);
|
|
1803
|
-
}
|
|
1804
|
-
On.length = 0;
|
|
1805
|
-
}
|
|
1806
|
-
$.geometry.boundsTree = o, $.geometry.drawRange = s, $.material = null, $.geometry = null;
|
|
1807
|
-
} else Dn.BatchedMesh.call(this, e, t);
|
|
1808
|
-
}
|
|
1809
|
-
//#endregion
|
|
1810
|
-
//#region src/infrastructure/three/bvh.ts
|
|
1796
|
+
}, En = "contact-shadow-baked", Dn = "contact-shadow-live", On = "softboxContactShadowHelper", kn = "softboxPathTracingFloor", An = Math.PI * (3 - Math.sqrt(5));
|
|
1811
1797
|
function jn(e) {
|
|
1812
|
-
e.
|
|
1813
|
-
|
|
1814
|
-
if (!t.isMesh || t.isSkinnedMesh || t.isInstancedMesh || t.isBatchedMesh) return;
|
|
1815
|
-
let n = t.geometry;
|
|
1816
|
-
!n?.attributes?.position || n.morphAttributes?.position?.length || (n.boundsTree ||= new En(n), t.raycast = kn);
|
|
1817
|
-
});
|
|
1798
|
+
let t = e.getObjectByName(En);
|
|
1799
|
+
t && (e.remove(t), T(t));
|
|
1818
1800
|
}
|
|
1819
1801
|
function Mn(e) {
|
|
1820
|
-
e
|
|
1821
|
-
|
|
1822
|
-
//#endregion
|
|
1823
|
-
//#region src/infrastructure/three/disposal.ts
|
|
1824
|
-
var Nn = "softboxExternallyOwnedTextures", Pn = "softboxBackgroundNode", Fn = "softboxStashedMaterials";
|
|
1825
|
-
function In(t) {
|
|
1826
|
-
if (!t.userData.softboxDisposed) {
|
|
1827
|
-
if (!t.userData?.softboxExternallyOwnedTextures) {
|
|
1828
|
-
let n = t;
|
|
1829
|
-
for (let t of Object.keys(n)) {
|
|
1830
|
-
let r = n[t];
|
|
1831
|
-
r instanceof e.Texture && r.dispose();
|
|
1832
|
-
}
|
|
1833
|
-
let r = t;
|
|
1834
|
-
if (r.isShaderMaterial && r.uniforms) for (let t of Object.values(r.uniforms)) t?.value instanceof e.Texture && t.value.dispose();
|
|
1835
|
-
}
|
|
1836
|
-
t.dispose(), t.userData.softboxDisposed = !0;
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
function Ln(e) {
|
|
1840
|
-
e.traverse((e) => {
|
|
1841
|
-
let t = e;
|
|
1842
|
-
t.geometry && typeof t.geometry.dispose == "function" && (Mn(t.geometry), t.geometry.dispose());
|
|
1843
|
-
let n = t.material;
|
|
1844
|
-
Array.isArray(n) ? n.forEach(In) : n && In(n), (e.userData?.[Fn])?.forEach(In);
|
|
1845
|
-
let r = e;
|
|
1846
|
-
r.isLight && r.shadow?.dispose && r.shadow.dispose();
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
function Rn(t, n) {
|
|
1850
|
-
if (!n?.keepBackgrounds) {
|
|
1851
|
-
t.background instanceof e.Texture && (t.background.dispose(), t.background = null), t.environment instanceof e.Texture && (t.environment.dispose(), t.environment = null);
|
|
1852
|
-
let n = t;
|
|
1853
|
-
n.__originalEnvironmentTexture &&= void 0;
|
|
1854
|
-
}
|
|
1855
|
-
for (let e of [...t.children]) n?.keepBackgrounds && e.userData?.softboxBackgroundNode || (Ln(e), t.remove(e));
|
|
1856
|
-
}
|
|
1857
|
-
//#endregion
|
|
1858
|
-
//#region src/infrastructure/three/ContactShadowBaker.ts
|
|
1859
|
-
var zn = "contact-shadow-baked", Bn = "contact-shadow-live", Vn = "softboxContactShadowHelper", Hn = "softboxPathTracingFloor", Un = Math.PI * (3 - Math.sqrt(5));
|
|
1860
|
-
function Wn(e) {
|
|
1861
|
-
let t = e.getObjectByName(zn);
|
|
1862
|
-
t && (e.remove(t), Ln(t));
|
|
1863
|
-
}
|
|
1864
|
-
function Gn(e) {
|
|
1865
|
-
Wn(e);
|
|
1866
|
-
let t = e.getObjectByName(Bn);
|
|
1802
|
+
jn(e);
|
|
1803
|
+
let t = e.getObjectByName(Dn);
|
|
1867
1804
|
t && (t.visible = !0);
|
|
1868
1805
|
}
|
|
1869
|
-
var
|
|
1806
|
+
var Nn = class t {
|
|
1870
1807
|
static {
|
|
1871
1808
|
this.AMBIENT_RATIO = .62;
|
|
1872
1809
|
}
|
|
@@ -1929,7 +1866,7 @@ var Kn = class t {
|
|
|
1929
1866
|
}
|
|
1930
1867
|
let s = this.measureBakeRegion(a);
|
|
1931
1868
|
if (!s) return;
|
|
1932
|
-
let c = i.getObjectByName(
|
|
1869
|
+
let c = i.getObjectByName(Dn);
|
|
1933
1870
|
c?.geometry instanceof e.CircleGeometry && (s.halfExtent = Math.min(s.halfExtent, c.geometry.parameters.radius));
|
|
1934
1871
|
let l = new e.WebGLRenderTarget(t.ACCUMULATION_TEXTURE_SIZE, t.ACCUMULATION_TEXTURE_SIZE, {
|
|
1935
1872
|
type: r.capabilities.isWebGL2 ? e.HalfFloatType : e.UnsignedByteType,
|
|
@@ -1948,10 +1885,10 @@ var Kn = class t {
|
|
|
1948
1885
|
this.installBakedMesh(i, s, l, u);
|
|
1949
1886
|
}
|
|
1950
1887
|
leaveLiveCatcherInCharge(e) {
|
|
1951
|
-
|
|
1888
|
+
Mn(e);
|
|
1952
1889
|
}
|
|
1953
1890
|
evictBakedMesh(e) {
|
|
1954
|
-
|
|
1891
|
+
jn(e);
|
|
1955
1892
|
}
|
|
1956
1893
|
measureBakeRegion(n) {
|
|
1957
1894
|
let r = new e.Box3().setFromObject(n);
|
|
@@ -2020,12 +1957,12 @@ var Kn = class t {
|
|
|
2020
1957
|
l.lengthSq() < 1e-6 && l.set(1, 0, 0), l.normalize();
|
|
2021
1958
|
let u = new e.Vector3().crossVectors(c, l), d = Math.round(r * t.AMBIENT_RATIO), f = r - d, p = e.MathUtils.degToRad(t.LIGHT_APERTURE_DEGREES), m = Math.tan(p / 2) * s, h = [];
|
|
2022
1959
|
for (let e = 0; e < f; e++) {
|
|
2023
|
-
let t = m * Math.sqrt((e + .5) / f), n = e *
|
|
1960
|
+
let t = m * Math.sqrt((e + .5) / f), n = e * An;
|
|
2024
1961
|
h.push(i.clone().addScaledVector(l, t * Math.cos(n)).addScaledVector(u, t * Math.sin(n)));
|
|
2025
1962
|
}
|
|
2026
1963
|
let g = Math.sin(e.MathUtils.degToRad(t.AMBIENT_MIN_ELEVATION_DEGREES)), _ = t.AMBIENT_MAX_ELEVATION_SIN;
|
|
2027
1964
|
for (let t = 0; t < d; t++) {
|
|
2028
|
-
let n = Math.sqrt((t + .5) / d), r = g + (_ - g) * n, i = Math.sqrt(1 - r * r), o = t *
|
|
1965
|
+
let n = Math.sqrt((t + .5) / d), r = g + (_ - g) * n, i = Math.sqrt(1 - r * r), o = t * An;
|
|
2029
1966
|
h.push(new e.Vector3(i * Math.cos(o), r, i * Math.sin(o)).multiplyScalar(s).add(a));
|
|
2030
1967
|
}
|
|
2031
1968
|
return h;
|
|
@@ -2043,10 +1980,10 @@ var Kn = class t {
|
|
|
2043
1980
|
e.fragmentShader = e.fragmentShader.replace("#include <map_fragment>", "#include <map_fragment>\n diffuseColor.a = pow(diffuseColor.a, 0.75);");
|
|
2044
1981
|
}, o.customProgramCacheKey = () => "contact-shadow-alpha-gamma", o.addEventListener("dispose", () => i.dispose());
|
|
2045
1982
|
let s = new e.Mesh(a, o);
|
|
2046
|
-
s.name =
|
|
1983
|
+
s.name = En, s.userData[On] = !0, s.rotation.x = -Math.PI / 2;
|
|
2047
1984
|
let c = e.MathUtils.clamp(r.objectHeight * t.FLOOR_LIFT_PER_HEIGHT, t.FLOOR_LIFT_MIN, t.FLOOR_LIFT_MAX);
|
|
2048
1985
|
s.position.set(r.center.x, c, r.center.z), s.userData.renderTarget = i, n.add(s);
|
|
2049
|
-
let l = n.getObjectByName(
|
|
1986
|
+
let l = n.getObjectByName(Dn);
|
|
2050
1987
|
l && (l.visible = !1);
|
|
2051
1988
|
}
|
|
2052
1989
|
disableColorWrite(e) {
|
|
@@ -2063,33 +2000,6 @@ var Kn = class t {
|
|
|
2063
2000
|
t.colorWrite = e;
|
|
2064
2001
|
});
|
|
2065
2002
|
}
|
|
2066
|
-
},
|
|
2067
|
-
if (e && typeof e == "object") {
|
|
2068
|
-
let n = e[t];
|
|
2069
|
-
if (typeof n == "function") return n.call(e);
|
|
2070
|
-
}
|
|
2071
|
-
return null;
|
|
2072
|
-
};
|
|
2073
|
-
function Jn(t) {
|
|
2074
|
-
return qn(t, "getThreeObject") ?? (t instanceof e.Object3D ? t : null);
|
|
2075
|
-
}
|
|
2076
|
-
function Yn(t) {
|
|
2077
|
-
return qn(t, "getThreeCamera") ?? (t instanceof e.Camera ? t : null);
|
|
2078
|
-
}
|
|
2079
|
-
function Xn(t) {
|
|
2080
|
-
return qn(t, "getThreeScene") ?? (t instanceof e.Scene ? t : null);
|
|
2081
|
-
}
|
|
2082
|
-
function Zn(t) {
|
|
2083
|
-
return qn(t, "getThreeTexture") ?? (t instanceof e.Texture ? t : null);
|
|
2084
|
-
}
|
|
2085
|
-
function Qn(t) {
|
|
2086
|
-
return qn(t, "getThreeRenderer") ?? (t instanceof e.WebGLRenderer ? t : null);
|
|
2087
|
-
}
|
|
2088
|
-
function $n(e) {
|
|
2089
|
-
return qn(e, "getThreeControls");
|
|
2090
|
-
}
|
|
2091
|
-
//#endregion
|
|
2092
|
-
//#region src/utils/smoothstep.ts
|
|
2093
|
-
var er = (e) => e * e * (3 - 2 * e);
|
|
2003
|
+
}, Pn = (e) => e * e * (3 - 2 * e);
|
|
2094
2004
|
//#endregion
|
|
2095
|
-
export {
|
|
2005
|
+
export { y as C, h as D, g as E, m as O, ee as S, _ as T, x as _, Nn as a, C as b, Tn as c, P as d, j as f, ne as g, ue as h, Dn as i, Je as l, A as m, En as n, kn as o, k as p, On as r, Mn as s, Pn as t, Ke as u, b as v, v as w, T as x, S as y };
|