@speridlabs/visus 2.4.2 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +344 -336
- package/dist/main.es.js +6 -6
- package/dist/main.umd.js +5 -5
- package/dist/react.d.ts +2 -0
- package/dist/react.es.js +144 -140
- package/package.json +1 -1
package/dist/react.es.js
CHANGED
|
@@ -148,7 +148,7 @@ function at() {
|
|
|
148
148
|
configurable: !0
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function m() {
|
|
152
152
|
var i = a(this.type);
|
|
153
153
|
return x[i] || (x[i] = !0, console.error(
|
|
154
154
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
@@ -163,7 +163,7 @@ function at() {
|
|
|
163
163
|
_owner: R
|
|
164
164
|
}, (q !== void 0 ? q : null) !== null ? Object.defineProperty(i, "ref", {
|
|
165
165
|
enumerable: !1,
|
|
166
|
-
get:
|
|
166
|
+
get: m
|
|
167
167
|
}) : Object.defineProperty(i, "ref", { enumerable: !1, value: null }), i._store = {}, Object.defineProperty(i._store, "validated", {
|
|
168
168
|
configurable: !1,
|
|
169
169
|
enumerable: !1,
|
|
@@ -186,7 +186,7 @@ function at() {
|
|
|
186
186
|
value: G
|
|
187
187
|
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function f(i, A, q, O, R, d, P, G) {
|
|
190
190
|
var M = A.children;
|
|
191
191
|
if (M !== void 0)
|
|
192
192
|
if (O)
|
|
@@ -253,7 +253,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
253
253
|
)(), X = I(s(n)), $ = {};
|
|
254
254
|
ye.Fragment = C, ye.jsx = function(i, A, q, O, R) {
|
|
255
255
|
var d = 1e4 > b.recentlyCreatedOwnerStacks++;
|
|
256
|
-
return
|
|
256
|
+
return f(
|
|
257
257
|
i,
|
|
258
258
|
A,
|
|
259
259
|
q,
|
|
@@ -265,7 +265,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
265
265
|
);
|
|
266
266
|
}, ye.jsxs = function(i, A, q, O, R) {
|
|
267
267
|
var d = 1e4 > b.recentlyCreatedOwnerStacks++;
|
|
268
|
-
return
|
|
268
|
+
return f(
|
|
269
269
|
i,
|
|
270
270
|
A,
|
|
271
271
|
q,
|
|
@@ -369,8 +369,8 @@ class ct {
|
|
|
369
369
|
throw new Error(
|
|
370
370
|
`Splat index out of bounds: ${e} >= ${this.numSplats}`
|
|
371
371
|
);
|
|
372
|
-
const c = e * 3,
|
|
373
|
-
this.positions[c] = t.x, this.positions[c + 1] = t.y, this.positions[c + 2] = t.z, this.rotations[
|
|
372
|
+
const c = e * 3, m = e * 4, g = e * 3, f = e * 3;
|
|
373
|
+
this.positions[c] = t.x, this.positions[c + 1] = t.y, this.positions[c + 2] = t.z, this.rotations[m] = s.x, this.rotations[m + 1] = s.y, this.rotations[m + 2] = s.z, this.rotations[m + 3] = s.w, this.scales[g] = r.x, this.scales[g + 1] = r.y, this.scales[g + 2] = r.z, this.colors[f] = n.r, this.colors[f + 1] = n.g, this.colors[f + 2] = n.b, this.opacities[e] = o;
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Get a splat's data
|
|
@@ -543,7 +543,7 @@ class Ie {
|
|
|
543
543
|
// .g = Means Upper (RGB)
|
|
544
544
|
// .b = Rotation (RGBA)
|
|
545
545
|
// .a = Scale (RGB)
|
|
546
|
-
constructor(e, t, s, r, n, o, c,
|
|
546
|
+
constructor(e, t, s, r, n, o, c, m) {
|
|
547
547
|
// Info data - cpu
|
|
548
548
|
w(this, "numSplats");
|
|
549
549
|
w(this, "textureWidth");
|
|
@@ -558,7 +558,7 @@ class Ie {
|
|
|
558
558
|
// RGBA8 Texture Content:
|
|
559
559
|
// .rgb = Color, .a = Opacity
|
|
560
560
|
w(this, "packedGeometry");
|
|
561
|
-
this.numSplats = e, this.textureWidth = t, this.textureHeight = s, this.boundingBox =
|
|
561
|
+
this.numSplats = e, this.textureWidth = t, this.textureHeight = s, this.boundingBox = m, this.ranges = c, this.centers = r, this.packedColor = o, this.packedGeometry = n;
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
564
564
|
* Optional: Reconstruct a full JS object for a specific splat.
|
|
@@ -580,24 +580,24 @@ class we {
|
|
|
580
580
|
*/
|
|
581
581
|
// prettier-ignore
|
|
582
582
|
static packPly(e) {
|
|
583
|
-
const t = e.numSplats, s = Math.ceil(Math.sqrt(t)), r = Math.ceil(t / s), n = s * r, { ranges: o, colorScale: c } = this.calculatePlyRanges(e),
|
|
583
|
+
const t = e.numSplats, s = Math.ceil(Math.sqrt(t)), r = Math.ceil(t / s), n = s * r, { ranges: o, colorScale: c } = this.calculatePlyRanges(e), m = new Uint32Array(n * 4), g = new Uint8Array(n * 4), f = new u.Quaternion();
|
|
584
584
|
for (let l = 0; l < t; l++) {
|
|
585
585
|
const h = l * 4, p = l * 3, v = l * 4, C = e.positions[p + 0], k = e.positions[p + 1], B = e.positions[p + 2], U = this.clamp01(this.norm(C, o.means.min.x, o.means.max.x)), F = this.clamp01(this.norm(k, o.means.min.y, o.means.max.y)), N = this.clamp01(this.norm(B, o.means.min.z, o.means.max.z)), W = U * 65535 | 0, T = F * 65535 | 0, S = N * 65535 | 0;
|
|
586
|
-
|
|
587
|
-
let z =
|
|
586
|
+
m[h + 0] = this.pack4Bytes(W & 255, T & 255, S & 255, 0), m[h + 1] = this.pack4Bytes(W >> 8, T >> 8, S >> 8, 0), f.set(e.rotations[v], e.rotations[v + 1], e.rotations[v + 2], e.rotations[v + 3]).normalize();
|
|
587
|
+
let z = f.w, E = f.x, y = f.y, b = f.z;
|
|
588
588
|
const j = Math.abs(z), L = Math.abs(E), I = Math.abs(y), D = Math.abs(b);
|
|
589
589
|
let x = 0, _ = j;
|
|
590
590
|
L > _ && (_ = L, x = 1), I > _ && (_ = I, x = 2), D > _ && (_ = D, x = 3), (x === 0 ? z : x === 1 ? E : x === 2 ? y : b) < 0 && (z = -z, E = -E, y = -y, b = -b);
|
|
591
591
|
let $ = 0, i = 0, A = 0;
|
|
592
592
|
x === 0 && ($ = E, i = y, A = b), x === 1 && ($ = z, i = y, A = b), x === 2 && ($ = z, i = E, A = b), x === 3 && ($ = z, i = E, A = y);
|
|
593
593
|
const q = (te) => Math.min(255, Math.max(0, Math.round((0.5 + te / Math.SQRT2) * 255)));
|
|
594
|
-
|
|
594
|
+
m[h + 2] = this.pack4Bytes(q($), q(i), q(A), x);
|
|
595
595
|
const O = this.norm(e.scales[p + 0], o.scales.min.x, o.scales.max.x), R = this.norm(e.scales[p + 1], o.scales.min.y, o.scales.max.y), d = this.norm(e.scales[p + 2], o.scales.min.z, o.scales.max.z);
|
|
596
|
-
|
|
596
|
+
m[h + 3] = this.pack4Bytes(Math.floor(O * 255), Math.floor(R * 255), Math.floor(d * 255), 0);
|
|
597
597
|
const P = this.clamp01(e.colors[p + 0] * c), G = this.clamp01(e.colors[p + 1] * c), M = this.clamp01(e.colors[p + 2] * c), V = (P - 0.5) / de, H = (G - 0.5) / de, Z = (M - 0.5) / de, Q = this.clamp01(this.norm(V, o.sh0.min.x, o.sh0.max.x)), J = this.clamp01(this.norm(H, o.sh0.min.y, o.sh0.max.y)), K = this.clamp01(this.norm(Z, o.sh0.min.z, o.sh0.max.z)), ee = this.clamp01(e.opacities[l]);
|
|
598
598
|
g[h + 0] = Math.round(Q * 255), g[h + 1] = Math.round(J * 255), g[h + 2] = Math.round(K * 255), g[h + 3] = Math.round(ee * 255);
|
|
599
599
|
}
|
|
600
|
-
return new Ie(t, s, r, e.positions,
|
|
600
|
+
return new Ie(t, s, r, e.positions, m, g, o, e.boundingBox);
|
|
601
601
|
}
|
|
602
602
|
/**
|
|
603
603
|
* Packs SOGS data.
|
|
@@ -613,10 +613,10 @@ class we {
|
|
|
613
613
|
n && typeof n.width == "number" && typeof n.height == "number" && (s = n.width, r = n.height);
|
|
614
614
|
const o = s * r;
|
|
615
615
|
if (o < t) throw new Error(`SOG v1 texture too small: ${s}x${r}=${o} < count=${t}`);
|
|
616
|
-
const c = this.convertSogsRanges(e.ranges),
|
|
617
|
-
v(
|
|
616
|
+
const c = this.convertSogsRanges(e.ranges), m = e.ranges.means.mins[0], g = e.ranges.means.mins[1], f = e.ranges.means.mins[2], l = e.ranges.means.maxs[0], h = e.ranges.means.maxs[1], p = e.ranges.means.maxs[2], v = (L) => Math.sign(L) * (Math.exp(Math.abs(L)) - 1), C = new u.Vector3(
|
|
617
|
+
v(m),
|
|
618
618
|
v(g),
|
|
619
|
-
v(
|
|
619
|
+
v(f)
|
|
620
620
|
), k = new u.Vector3(
|
|
621
621
|
v(l),
|
|
622
622
|
v(h),
|
|
@@ -625,7 +625,7 @@ class we {
|
|
|
625
625
|
c.means.min.copy(C), c.means.max.copy(k);
|
|
626
626
|
const B = e, U = this.getPixels(B.means_l), F = this.getPixels(B.means_u), N = this.getPixels(B.quats), W = this.getPixels(B.scales), T = this.getPixels(B.sh0), S = new Uint32Array(o * 4), z = new Uint8Array(o * 4), E = new Float32Array(t * 3);
|
|
627
627
|
for (let L = 0; L < t; L++) {
|
|
628
|
-
const I = L * 4, D = F[I + 0], x = U[I + 0], _ = F[I + 1], X = U[I + 1], $ = F[I + 2], i = U[I + 2], A = (D << 8 | x) / 65535, q = (_ << 8 | X) / 65535, O = ($ << 8 | i) / 65535, R = this.sogsDecode(A,
|
|
628
|
+
const I = L * 4, D = F[I + 0], x = U[I + 0], _ = F[I + 1], X = U[I + 1], $ = F[I + 2], i = U[I + 2], A = (D << 8 | x) / 65535, q = (_ << 8 | X) / 65535, O = ($ << 8 | i) / 65535, R = this.sogsDecode(A, m, l), d = this.sogsDecode(q, g, h), P = this.sogsDecode(O, f, p);
|
|
629
629
|
E[L * 3 + 0] = R, E[L * 3 + 1] = d, E[L * 3 + 2] = P;
|
|
630
630
|
const G = this.clamp01(this.norm(R, C.x, k.x)) * 65535 | 0, M = this.clamp01(this.norm(d, C.y, k.y)) * 65535 | 0, V = this.clamp01(this.norm(P, C.z, k.z)) * 65535 | 0;
|
|
631
631
|
S[I + 0] = this.pack4Bytes(G & 255, M & 255, V & 255, 0), S[I + 1] = this.pack4Bytes(G >> 8, M >> 8, V >> 8, 0), S[I + 3] = this.pack4Bytes(W[I], W[I + 1], W[I + 2], 0);
|
|
@@ -647,12 +647,12 @@ class we {
|
|
|
647
647
|
n && typeof n.width == "number" && typeof n.height == "number" && (s = n.width, r = n.height);
|
|
648
648
|
const o = s * r;
|
|
649
649
|
if (o < t) throw new Error(`SOG v2 texture too small: ${s}x${r}=${o} < count=${t}`);
|
|
650
|
-
const c = e.ranges.means.mins[0],
|
|
650
|
+
const c = e.ranges.means.mins[0], m = e.ranges.means.mins[1], g = e.ranges.means.mins[2], f = e.ranges.means.maxs[0], l = e.ranges.means.maxs[1], h = e.ranges.means.maxs[2], p = (D) => Math.sign(D) * (Math.exp(Math.abs(D)) - 1), v = new u.Vector3(
|
|
651
651
|
p(c),
|
|
652
|
-
p(
|
|
652
|
+
p(m),
|
|
653
653
|
p(g)
|
|
654
654
|
), C = new u.Vector3(
|
|
655
|
-
p(
|
|
655
|
+
p(f),
|
|
656
656
|
p(l),
|
|
657
657
|
p(h)
|
|
658
658
|
), k = (D) => {
|
|
@@ -694,7 +694,7 @@ class we {
|
|
|
694
694
|
}
|
|
695
695
|
}, N = this.getPixels(e.means_l), W = this.getPixels(e.means_u), T = this.getPixels(e.quats), S = this.getPixels(e.scales), z = this.getPixels(e.sh0), E = new Uint32Array(o * 4), y = new Uint8Array(o * 4), b = new Float32Array(t * 3);
|
|
696
696
|
for (let D = 0; D < t; D++) {
|
|
697
|
-
const x = D * 4, _ = W[x + 0], X = N[x + 0], $ = W[x + 1], i = N[x + 1], A = W[x + 2], q = N[x + 2], O = (_ << 8 | X) / 65535, R = ($ << 8 | i) / 65535, d = (A << 8 | q) / 65535, P = this.sogsDecode(O, c,
|
|
697
|
+
const x = D * 4, _ = W[x + 0], X = N[x + 0], $ = W[x + 1], i = N[x + 1], A = W[x + 2], q = N[x + 2], O = (_ << 8 | X) / 65535, R = ($ << 8 | i) / 65535, d = (A << 8 | q) / 65535, P = this.sogsDecode(O, c, f), G = this.sogsDecode(R, m, l), M = this.sogsDecode(d, g, h);
|
|
698
698
|
b[D * 3 + 0] = P, b[D * 3 + 1] = G, b[D * 3 + 2] = M;
|
|
699
699
|
const V = this.clamp01(this.norm(P, v.x, C.x)) * 65535 | 0, H = this.clamp01(this.norm(G, v.y, C.y)) * 65535 | 0, Z = this.clamp01(this.norm(M, v.z, C.z)) * 65535 | 0;
|
|
700
700
|
E[x + 0] = this.pack4Bytes(V & 255, H & 255, Z & 255, 0), E[x + 1] = this.pack4Bytes(V >> 8, H >> 8, Z >> 8, 0);
|
|
@@ -730,19 +730,19 @@ class we {
|
|
|
730
730
|
}
|
|
731
731
|
static calculatePlyRanges(e) {
|
|
732
732
|
const t = new u.Vector3(1 / 0, 1 / 0, 1 / 0), s = new u.Vector3(-1 / 0, -1 / 0, -1 / 0), r = new u.Vector3(1 / 0, 1 / 0, 1 / 0), n = new u.Vector3(-1 / 0, -1 / 0, -1 / 0), o = new u.Vector3(1 / 0, 1 / 0, 1 / 0), c = new u.Vector3(-1 / 0, -1 / 0, -1 / 0);
|
|
733
|
-
let
|
|
734
|
-
for (let
|
|
735
|
-
const l =
|
|
736
|
-
t.x = Math.min(t.x, h), s.x = Math.max(s.x, h), t.y = Math.min(t.y, p), s.y = Math.max(s.y, p), t.z = Math.min(t.z, v), s.z = Math.max(s.z, v), r.x = Math.min(r.x, e.scales[l]), n.x = Math.max(n.x, e.scales[l]), r.y = Math.min(r.y, e.scales[l + 1]), n.y = Math.max(n.y, e.scales[l + 1]), r.z = Math.min(r.z, e.scales[l + 2]), n.z = Math.max(n.z, e.scales[l + 2]),
|
|
737
|
-
|
|
733
|
+
let m = 0;
|
|
734
|
+
for (let f = 0; f < e.numSplats; f++) {
|
|
735
|
+
const l = f * 3, h = e.positions[l + 0], p = e.positions[l + 1], v = e.positions[l + 2];
|
|
736
|
+
t.x = Math.min(t.x, h), s.x = Math.max(s.x, h), t.y = Math.min(t.y, p), s.y = Math.max(s.y, p), t.z = Math.min(t.z, v), s.z = Math.max(s.z, v), r.x = Math.min(r.x, e.scales[l]), n.x = Math.max(n.x, e.scales[l]), r.y = Math.min(r.y, e.scales[l + 1]), n.y = Math.max(n.y, e.scales[l + 1]), r.z = Math.min(r.z, e.scales[l + 2]), n.z = Math.max(n.z, e.scales[l + 2]), m = Math.max(
|
|
737
|
+
m,
|
|
738
738
|
e.colors[l],
|
|
739
739
|
e.colors[l + 1],
|
|
740
740
|
e.colors[l + 2]
|
|
741
741
|
);
|
|
742
742
|
}
|
|
743
|
-
const g =
|
|
744
|
-
for (let
|
|
745
|
-
const l =
|
|
743
|
+
const g = m > 1.5 ? 1 / 255 : 1;
|
|
744
|
+
for (let f = 0; f < e.numSplats; f++) {
|
|
745
|
+
const l = f * 3, h = this.clamp01(e.colors[l + 0] * g), p = this.clamp01(e.colors[l + 1] * g), v = this.clamp01(e.colors[l + 2] * g), C = (h - 0.5) / de, k = (p - 0.5) / de, B = (v - 0.5) / de;
|
|
746
746
|
o.x = Math.min(o.x, C), c.x = Math.max(c.x, C), o.y = Math.min(o.y, k), c.y = Math.max(c.y, k), o.z = Math.min(o.z, B), c.z = Math.max(c.z, B);
|
|
747
747
|
}
|
|
748
748
|
return {
|
|
@@ -770,14 +770,14 @@ class we {
|
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
class lt extends u.Loader {
|
|
773
|
-
constructor(t) {
|
|
773
|
+
constructor(t, s) {
|
|
774
774
|
super(t);
|
|
775
775
|
w(this, "requestId", 0);
|
|
776
776
|
w(this, "worker");
|
|
777
777
|
w(this, "pendingCallbacks", /* @__PURE__ */ new Map());
|
|
778
|
-
this.withCredentials = !
|
|
779
|
-
const
|
|
780
|
-
this.worker = new Worker(URL.createObjectURL(
|
|
778
|
+
this.withCredentials = (s == null ? void 0 : s.withCredentials) ?? !1;
|
|
779
|
+
const r = this.createWorkerCode(), n = new Blob([r], { type: "application/javascript" });
|
|
780
|
+
this.worker = new Worker(URL.createObjectURL(n)), this.worker.onmessage = this.onWorkerMessage.bind(this);
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
783
783
|
* Handles messages received from the parsing worker
|
|
@@ -799,8 +799,8 @@ class lt extends u.Loader {
|
|
|
799
799
|
n.boundingBox.maxY,
|
|
800
800
|
n.boundingBox.maxZ
|
|
801
801
|
), this.worker.terminate();
|
|
802
|
-
const
|
|
803
|
-
c.dispose(), o.resolve(
|
|
802
|
+
const m = we.packPly(c);
|
|
803
|
+
c.dispose(), o.resolve(m);
|
|
804
804
|
} catch (c) {
|
|
805
805
|
o.reject(c);
|
|
806
806
|
}
|
|
@@ -817,10 +817,10 @@ class lt extends u.Loader {
|
|
|
817
817
|
o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
|
|
818
818
|
t,
|
|
819
819
|
(c) => {
|
|
820
|
-
this.parseAsync(c).then((
|
|
821
|
-
s && s(
|
|
822
|
-
}).catch((
|
|
823
|
-
n ? n(
|
|
820
|
+
this.parseAsync(c).then((m) => {
|
|
821
|
+
s && s(m);
|
|
822
|
+
}).catch((m) => {
|
|
823
|
+
n ? n(m) : console.error(m), this.manager.itemError(t);
|
|
824
824
|
});
|
|
825
825
|
},
|
|
826
826
|
r,
|
|
@@ -839,8 +839,8 @@ class lt extends u.Loader {
|
|
|
839
839
|
o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
|
|
840
840
|
t,
|
|
841
841
|
(c) => {
|
|
842
|
-
this.parseAsync(c).then(r).catch((
|
|
843
|
-
n(
|
|
842
|
+
this.parseAsync(c).then(r).catch((m) => {
|
|
843
|
+
n(m), this.manager.itemError(t);
|
|
844
844
|
});
|
|
845
845
|
},
|
|
846
846
|
s,
|
|
@@ -881,11 +881,11 @@ class lt extends u.Loader {
|
|
|
881
881
|
self.onmessage = (r) => {
|
|
882
882
|
const { requestId: n, buffer: o } = r.data;
|
|
883
883
|
try {
|
|
884
|
-
const c = s(o),
|
|
884
|
+
const c = s(o), m = {
|
|
885
885
|
requestId: n,
|
|
886
886
|
result: c
|
|
887
887
|
};
|
|
888
|
-
self.postMessage(
|
|
888
|
+
self.postMessage(m, [
|
|
889
889
|
c.positions,
|
|
890
890
|
c.rotations,
|
|
891
891
|
c.scales,
|
|
@@ -893,15 +893,15 @@ class lt extends u.Loader {
|
|
|
893
893
|
c.opacities
|
|
894
894
|
]);
|
|
895
895
|
} catch (c) {
|
|
896
|
-
const
|
|
896
|
+
const m = {
|
|
897
897
|
requestId: n,
|
|
898
898
|
error: c instanceof Error ? c.message : String(c)
|
|
899
899
|
};
|
|
900
|
-
self.postMessage(
|
|
900
|
+
self.postMessage(m);
|
|
901
901
|
}
|
|
902
902
|
};
|
|
903
903
|
function s(r) {
|
|
904
|
-
const n = new TextDecoder(), o = new Uint8Array(r), c = [112, 108, 121, 10],
|
|
904
|
+
const n = new TextDecoder(), o = new Uint8Array(r), c = [112, 108, 121, 10], m = `
|
|
905
905
|
end_header
|
|
906
906
|
`;
|
|
907
907
|
for (let R = 0; R < c.length; R++)
|
|
@@ -910,15 +910,15 @@ end_header
|
|
|
910
910
|
"Invalid PLY file: Missing magic bytes"
|
|
911
911
|
);
|
|
912
912
|
let g = 0;
|
|
913
|
-
for (let R = 0; R < o.length -
|
|
913
|
+
for (let R = 0; R < o.length - m.length; R++) {
|
|
914
914
|
let d = !0;
|
|
915
|
-
for (let P = 0; P <
|
|
916
|
-
if (o[R + P] !==
|
|
915
|
+
for (let P = 0; P < m.length; P++)
|
|
916
|
+
if (o[R + P] !== m.charCodeAt(P)) {
|
|
917
917
|
d = !1;
|
|
918
918
|
break;
|
|
919
919
|
}
|
|
920
920
|
if (d) {
|
|
921
|
-
g = R +
|
|
921
|
+
g = R + m.length;
|
|
922
922
|
break;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
@@ -1166,11 +1166,11 @@ var ve = function(a, e, t) {
|
|
|
1166
1166
|
var c;
|
|
1167
1167
|
if (t) {
|
|
1168
1168
|
c = new pe(1 << e);
|
|
1169
|
-
var
|
|
1169
|
+
var m = 15 - e;
|
|
1170
1170
|
for (r = 0; r < s; ++r)
|
|
1171
1171
|
if (a[r])
|
|
1172
|
-
for (var g = r << 4 | a[r],
|
|
1173
|
-
c[Be[l] >>
|
|
1172
|
+
for (var g = r << 4 | a[r], f = e - a[r], l = o[a[r] - 1]++ << f, h = l | (1 << f) - 1; l <= h; ++l)
|
|
1173
|
+
c[Be[l] >> m] = g;
|
|
1174
1174
|
} else
|
|
1175
1175
|
for (c = new pe(s), r = 0; r < s; ++r)
|
|
1176
1176
|
a[r] && (c[r] = Be[o[a[r] - 1]++] >> 15 - a[r]);
|
|
@@ -1226,7 +1226,7 @@ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = f
|
|
|
1226
1226
|
var r = a.length, n = s ? s.length : 0;
|
|
1227
1227
|
if (!r || e.f && !e.l)
|
|
1228
1228
|
return t || new se(0);
|
|
1229
|
-
var o = !t, c = o || e.i != 2,
|
|
1229
|
+
var o = !t, c = o || e.i != 2, m = e.i;
|
|
1230
1230
|
o && (t = new se(r * 3));
|
|
1231
1231
|
var g = function(Z) {
|
|
1232
1232
|
var Q = t.length;
|
|
@@ -1234,10 +1234,10 @@ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = f
|
|
|
1234
1234
|
var J = new se(Math.max(Q * 2, Z));
|
|
1235
1235
|
J.set(t), t = J;
|
|
1236
1236
|
}
|
|
1237
|
-
},
|
|
1237
|
+
}, f = e.f || 0, l = e.p || 0, h = e.b || 0, p = e.l, v = e.d, C = e.m, k = e.n, B = r * 8;
|
|
1238
1238
|
do {
|
|
1239
1239
|
if (!p) {
|
|
1240
|
-
|
|
1240
|
+
f = ne(a, l, 1);
|
|
1241
1241
|
var U = ne(a, l + 1, 3);
|
|
1242
1242
|
if (l += 3, U)
|
|
1243
1243
|
if (U == 1)
|
|
@@ -1267,14 +1267,14 @@ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = f
|
|
|
1267
1267
|
else {
|
|
1268
1268
|
var F = gt(l) + 4, N = a[F - 4] | a[F - 3] << 8, W = F + N;
|
|
1269
1269
|
if (W > r) {
|
|
1270
|
-
|
|
1270
|
+
m && re(0);
|
|
1271
1271
|
break;
|
|
1272
1272
|
}
|
|
1273
|
-
c && g(h + N), t.set(a.subarray(F, W), h), e.b = h += N, e.p = l = W * 8, e.f =
|
|
1273
|
+
c && g(h + N), t.set(a.subarray(F, W), h), e.b = h += N, e.p = l = W * 8, e.f = f;
|
|
1274
1274
|
continue;
|
|
1275
1275
|
}
|
|
1276
1276
|
if (l > B) {
|
|
1277
|
-
|
|
1277
|
+
m && re(0);
|
|
1278
1278
|
break;
|
|
1279
1279
|
}
|
|
1280
1280
|
}
|
|
@@ -1282,7 +1282,7 @@ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = f
|
|
|
1282
1282
|
for (var i = (1 << C) - 1, A = (1 << k) - 1, q = l; ; q = l) {
|
|
1283
1283
|
var x = p[_e(a, l) & i], O = x >> 4;
|
|
1284
1284
|
if (l += x & 15, l > B) {
|
|
1285
|
-
|
|
1285
|
+
m && re(0);
|
|
1286
1286
|
break;
|
|
1287
1287
|
}
|
|
1288
1288
|
if (x || re(2), O < 256)
|
|
@@ -1304,7 +1304,7 @@ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = f
|
|
|
1304
1304
|
$ += _e(a, l) & (1 << d) - 1, l += d;
|
|
1305
1305
|
}
|
|
1306
1306
|
if (l > B) {
|
|
1307
|
-
|
|
1307
|
+
m && re(0);
|
|
1308
1308
|
break;
|
|
1309
1309
|
}
|
|
1310
1310
|
c && g(h + 131072);
|
|
@@ -1318,8 +1318,8 @@ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = f
|
|
|
1318
1318
|
t[h] = t[h - $];
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
|
-
e.l = p, e.p = q, e.b = h, e.f =
|
|
1322
|
-
} while (!
|
|
1321
|
+
e.l = p, e.p = q, e.b = h, e.f = f, p && (f = 1, e.m = C, e.d = v, e.n = k);
|
|
1322
|
+
} while (!f);
|
|
1323
1323
|
return h != t.length && o ? qe(t, 0, h) : t.subarray(0, h);
|
|
1324
1324
|
}, vt = /* @__PURE__ */ new se(0), ie = function(a, e) {
|
|
1325
1325
|
return a[e] | a[e + 1] << 8;
|
|
@@ -1359,8 +1359,8 @@ function At(a, e) {
|
|
|
1359
1359
|
var kt = function(a, e) {
|
|
1360
1360
|
return e + 30 + ie(a, e + 26) + ie(a, e + 28);
|
|
1361
1361
|
}, Et = function(a, e, t) {
|
|
1362
|
-
var s = ie(a, e + 28), r = At(a.subarray(e + 46, e + 46 + s), !(ie(a, e + 8) & 2048)), n = e + 46 + s, o = ae(a, e + 20), c = t && o == 4294967295 ? Ct(a, n) : [o, ae(a, e + 24), ae(a, e + 42)],
|
|
1363
|
-
return [ie(a, e + 10),
|
|
1362
|
+
var s = ie(a, e + 28), r = At(a.subarray(e + 46, e + 46 + s), !(ie(a, e + 8) & 2048)), n = e + 46 + s, o = ae(a, e + 20), c = t && o == 4294967295 ? Ct(a, n) : [o, ae(a, e + 24), ae(a, e + 42)], m = c[0], g = c[1], f = c[2];
|
|
1363
|
+
return [ie(a, e + 10), m, g, r, n + ie(a, e + 30) + ie(a, e + 32), f];
|
|
1364
1364
|
}, Ct = function(a, e) {
|
|
1365
1365
|
for (; ie(a, e) != 1; e += 4 + ie(a, e + 2))
|
|
1366
1366
|
;
|
|
@@ -1377,9 +1377,9 @@ function It(a, e) {
|
|
|
1377
1377
|
var c = ae(a, s - 12);
|
|
1378
1378
|
o = ae(a, c) == 101075792, o && (r = ae(a, c + 32), n = ae(a, c + 48));
|
|
1379
1379
|
}
|
|
1380
|
-
for (var
|
|
1381
|
-
var g = Et(a, n, o),
|
|
1382
|
-
n = v,
|
|
1380
|
+
for (var m = 0; m < r; ++m) {
|
|
1381
|
+
var g = Et(a, n, o), f = g[0], l = g[1], h = g[2], p = g[3], v = g[4], C = g[5], k = kt(a, C);
|
|
1382
|
+
n = v, f ? f == 8 ? t[p] = bt(a.subarray(k, k + l), { out: new se(h) }) : re(14, "unknown compression type " + f) : t[p] = qe(a, k, k + l);
|
|
1383
1383
|
}
|
|
1384
1384
|
return t;
|
|
1385
1385
|
}
|
|
@@ -1431,7 +1431,7 @@ const ke = (a) => typeof a == "number" && Number.isFinite(a), he = (a, e) => {
|
|
|
1431
1431
|
const e = a, t = e.version ?? 1;
|
|
1432
1432
|
if (t !== 1 && t !== 2) throw new Error(`Unsupported SOG version: ${String(t)}`);
|
|
1433
1433
|
if (t === 1) {
|
|
1434
|
-
const
|
|
1434
|
+
const f = he(e, "means"), l = he(e, "sh0"), h = he(e, "quats"), p = he(e, "scales"), v = typeof e.count == "number" && Number.isFinite(e.count) ? e.count : void 0, C = Array.isArray(f.shape) ? f.shape : void 0, k = C && typeof C[0] == "number" ? C[0] : void 0;
|
|
1435
1435
|
if (v === void 0 && k === void 0) throw new Error("Invalid SOGS metadata: unable to determine splat count");
|
|
1436
1436
|
if (v !== void 0 && k !== void 0 && v !== k) throw new Error("Inconsistent SOGS metadata: count does not match means.shape[0]");
|
|
1437
1437
|
return {
|
|
@@ -1439,20 +1439,20 @@ const ke = (a) => typeof a == "number" && Number.isFinite(a), he = (a, e) => {
|
|
|
1439
1439
|
numSplats: (v ?? k) | 0,
|
|
1440
1440
|
files: {
|
|
1441
1441
|
sh0: ue(l, "sh0"),
|
|
1442
|
-
means: ue(
|
|
1442
|
+
means: ue(f, "means"),
|
|
1443
1443
|
quats: ue(h, "quats"),
|
|
1444
1444
|
scales: ue(p, "scales")
|
|
1445
1445
|
},
|
|
1446
1446
|
ranges: {
|
|
1447
1447
|
sh0: Rt(l, "sh0"),
|
|
1448
|
-
means: ze(
|
|
1448
|
+
means: ze(f, "means"),
|
|
1449
1449
|
scales: ze(p, "scales")
|
|
1450
1450
|
}
|
|
1451
1451
|
};
|
|
1452
1452
|
}
|
|
1453
1453
|
const s = e.count;
|
|
1454
1454
|
if (!ke(s)) throw new Error('Invalid SOG v2 metadata: missing/invalid "count"');
|
|
1455
|
-
const r = s | 0, n = he(e, "means"), o = he(e, "sh0"), c = he(e, "quats"),
|
|
1455
|
+
const r = s | 0, n = he(e, "means"), o = he(e, "sh0"), c = he(e, "quats"), m = he(e, "scales");
|
|
1456
1456
|
return {
|
|
1457
1457
|
version: 2,
|
|
1458
1458
|
numSplats: r,
|
|
@@ -1460,20 +1460,20 @@ const ke = (a) => typeof a == "number" && Number.isFinite(a), he = (a, e) => {
|
|
|
1460
1460
|
sh0: ue(o, "sh0"),
|
|
1461
1461
|
means: ue(n, "means"),
|
|
1462
1462
|
quats: ue(c, "quats"),
|
|
1463
|
-
scales: ue(
|
|
1463
|
+
scales: ue(m, "scales")
|
|
1464
1464
|
},
|
|
1465
1465
|
ranges: {
|
|
1466
1466
|
means: ze(n, "means"),
|
|
1467
1467
|
sh0: { codebook: je(o, "sh0") },
|
|
1468
|
-
scales: { codebook: je(
|
|
1468
|
+
scales: { codebook: je(m, "scales") }
|
|
1469
1469
|
},
|
|
1470
1470
|
antialias: typeof e.antialias == "boolean" ? e.antialias : void 0
|
|
1471
1471
|
// prettier-ignore
|
|
1472
1472
|
};
|
|
1473
1473
|
};
|
|
1474
1474
|
class _t extends u.Loader {
|
|
1475
|
-
constructor(e) {
|
|
1476
|
-
super(e), this.withCredentials = !
|
|
1475
|
+
constructor(e, t) {
|
|
1476
|
+
super(e), this.withCredentials = (t == null ? void 0 : t.withCredentials) ?? !1;
|
|
1477
1477
|
}
|
|
1478
1478
|
/**
|
|
1479
1479
|
* Detect if a buffer is a ZIP file by checking magic bytes
|
|
@@ -1536,18 +1536,18 @@ class _t extends u.Loader {
|
|
|
1536
1536
|
return this.parseMetaAsync(e, n);
|
|
1537
1537
|
}
|
|
1538
1538
|
async parseMetaAsync(e, t) {
|
|
1539
|
-
const s = Ge(t), { numSplats: r, files: n, ranges: o, version: c } = s,
|
|
1540
|
-
|
|
1539
|
+
const s = Ge(t), { numSplats: r, files: n, ranges: o, version: c } = s, m = new u.TextureLoader(this.manager);
|
|
1540
|
+
m.setPath(this.path), m.setRequestHeader(this.requestHeader), m.setWithCredentials(this.withCredentials);
|
|
1541
1541
|
const g = (F, N) => {
|
|
1542
1542
|
try {
|
|
1543
1543
|
return new URL(N, F).toString();
|
|
1544
1544
|
} catch {
|
|
1545
1545
|
return F.substring(0, F.lastIndexOf("/") + 1) + N;
|
|
1546
1546
|
}
|
|
1547
|
-
},
|
|
1547
|
+
}, f = (F, N) => {
|
|
1548
1548
|
const W = g(e, F);
|
|
1549
1549
|
return new Promise((T, S) => {
|
|
1550
|
-
|
|
1550
|
+
m.load(
|
|
1551
1551
|
W,
|
|
1552
1552
|
(z) => {
|
|
1553
1553
|
z.generateMipmaps = !1, z.magFilter = u.NearestFilter, z.minFilter = u.NearestFilter, z.flipY = !1, T(z);
|
|
@@ -1569,11 +1569,11 @@ class _t extends u.Loader {
|
|
|
1569
1569
|
if (!Array.isArray(n.quats) || n.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
|
|
1570
1570
|
if (!Array.isArray(n.scales) || n.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
|
|
1571
1571
|
const [l, h, p, v, C] = await Promise.all([
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1572
|
+
f(n.means[0], "means_l"),
|
|
1573
|
+
f(n.means[1], "means_u"),
|
|
1574
|
+
f(n.quats[0], "quats"),
|
|
1575
|
+
f(n.scales[0], "scales"),
|
|
1576
|
+
f(n.sh0[0], "sh0")
|
|
1577
1577
|
]), k = { means_l: l, means_u: h, quats: p, scales: v, sh0: C };
|
|
1578
1578
|
if (c === 1) {
|
|
1579
1579
|
const F = new Le(r, o, k), N = we.packSogs(F);
|
|
@@ -1585,7 +1585,7 @@ class _t extends u.Loader {
|
|
|
1585
1585
|
async parseZipAsync(e) {
|
|
1586
1586
|
const t = It(new Uint8Array(e)), s = Object.keys(t), r = s.find((y) => y.toLowerCase().endsWith("meta.json")) ?? null;
|
|
1587
1587
|
if (!r) throw new Error("SOGS loader: zip missing meta.json");
|
|
1588
|
-
const n = r.includes("/") ? r.slice(0, r.lastIndexOf("/") + 1) : "", o = new TextDecoder(), c = JSON.parse(o.decode(t[r])),
|
|
1588
|
+
const n = r.includes("/") ? r.slice(0, r.lastIndexOf("/") + 1) : "", o = new TextDecoder(), c = JSON.parse(o.decode(t[r])), m = Ge(c), { numSplats: g, files: f, ranges: l, version: h } = m, p = (y) => y.replace(/\\/g, "/").replace(/^\.?\//, ""), v = (y) => {
|
|
1589
1589
|
const b = p(y), j = [p(n + b), b];
|
|
1590
1590
|
for (const D of j) {
|
|
1591
1591
|
const x = t[D];
|
|
@@ -1622,16 +1622,16 @@ class _t extends u.Loader {
|
|
|
1622
1622
|
);
|
|
1623
1623
|
});
|
|
1624
1624
|
};
|
|
1625
|
-
if (!Array.isArray(
|
|
1626
|
-
if (!Array.isArray(
|
|
1627
|
-
if (!Array.isArray(
|
|
1628
|
-
if (!Array.isArray(
|
|
1625
|
+
if (!Array.isArray(f.sh0) || f.sh0.length < 1) throw new Error("SOGS loader: files.sh0 must have at least 1 entry (sh0)");
|
|
1626
|
+
if (!Array.isArray(f.means) || f.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
|
|
1627
|
+
if (!Array.isArray(f.quats) || f.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
|
|
1628
|
+
if (!Array.isArray(f.scales) || f.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
|
|
1629
1629
|
const [U, F, N, W, T] = await Promise.all([
|
|
1630
|
-
B(
|
|
1631
|
-
B(
|
|
1632
|
-
B(
|
|
1633
|
-
B(
|
|
1634
|
-
B(
|
|
1630
|
+
B(f.means[0], "means_l"),
|
|
1631
|
+
B(f.means[1], "means_u"),
|
|
1632
|
+
B(f.quats[0], "quats"),
|
|
1633
|
+
B(f.scales[0], "scales"),
|
|
1634
|
+
B(f.sh0[0], "sh0")
|
|
1635
1635
|
]), S = { means_l: U, means_u: F, quats: N, scales: W, sh0: T };
|
|
1636
1636
|
if (h === 1) {
|
|
1637
1637
|
const y = new Le(g, l, S), b = we.packSogs(y);
|
|
@@ -1693,19 +1693,19 @@ class Tt extends u.EventDispatcher {
|
|
|
1693
1693
|
const c = this.orderTexture.image.data;
|
|
1694
1694
|
for (let h = 0; h < o; h++) c[h] = h;
|
|
1695
1695
|
this.orderTexture.source.data.updateRanges || (this.orderTexture.source.data.updateRanges = []), this.orderTexture.needsUpdate = !0;
|
|
1696
|
-
const
|
|
1697
|
-
order:
|
|
1696
|
+
const m = c.buffer.slice(0), g = n ? s.buffer : s.buffer.slice(0), f = {
|
|
1697
|
+
order: m,
|
|
1698
1698
|
centers: g
|
|
1699
1699
|
}, l = [
|
|
1700
|
-
|
|
1700
|
+
m,
|
|
1701
1701
|
g
|
|
1702
1702
|
];
|
|
1703
1703
|
if (r) {
|
|
1704
1704
|
this.chunks = r.slice();
|
|
1705
1705
|
const h = this.chunks.buffer.slice(0);
|
|
1706
|
-
|
|
1706
|
+
f.chunks = h, l.push(h);
|
|
1707
1707
|
}
|
|
1708
|
-
this.worker.postMessage(
|
|
1708
|
+
this.worker.postMessage(f, l), queueMicrotask(() => {
|
|
1709
1709
|
this.dispatchEvent({
|
|
1710
1710
|
type: "updated",
|
|
1711
1711
|
count: o
|
|
@@ -1725,23 +1725,23 @@ class Tt extends u.EventDispatcher {
|
|
|
1725
1725
|
let s;
|
|
1726
1726
|
const r = [];
|
|
1727
1727
|
if (!t) {
|
|
1728
|
-
const
|
|
1728
|
+
const m = this.centers.buffer.slice(0);
|
|
1729
1729
|
return s = {
|
|
1730
|
-
centers:
|
|
1730
|
+
centers: m,
|
|
1731
1731
|
mapping: null
|
|
1732
|
-
}, r.push(
|
|
1732
|
+
}, r.push(m), this.worker.postMessage(s, r);
|
|
1733
1733
|
}
|
|
1734
1734
|
const n = new Float32Array(t.length * 3);
|
|
1735
|
-
for (let
|
|
1736
|
-
const g = t[
|
|
1735
|
+
for (let m = 0; m < t.length; m++) {
|
|
1736
|
+
const g = t[m];
|
|
1737
1737
|
if (g * 3 + 2 >= this.centers.length) {
|
|
1738
1738
|
console.warn(
|
|
1739
1739
|
`SplatSorter: Mapping index ${g} out of bounds.`
|
|
1740
1740
|
);
|
|
1741
1741
|
continue;
|
|
1742
1742
|
}
|
|
1743
|
-
const
|
|
1744
|
-
n[l + 0] = this.centers[
|
|
1743
|
+
const f = g * 3, l = m * 3;
|
|
1744
|
+
n[l + 0] = this.centers[f + 0], n[l + 1] = this.centers[f + 1], n[l + 2] = this.centers[f + 2];
|
|
1745
1745
|
}
|
|
1746
1746
|
const o = n.buffer.slice(0), c = t.buffer.slice(0);
|
|
1747
1747
|
s = {
|
|
@@ -1777,8 +1777,8 @@ class Tt extends u.EventDispatcher {
|
|
|
1777
1777
|
*/
|
|
1778
1778
|
createWorkerCode() {
|
|
1779
1779
|
return `(${(function() {
|
|
1780
|
-
let s = null, r = null, n = null, o = null, c = null,
|
|
1781
|
-
const
|
|
1780
|
+
let s = null, r = null, n = null, o = null, c = null, m = null, g = !1;
|
|
1781
|
+
const f = { x: 0, y: 0, z: 0 }, l = { x: 0, y: 0, z: 0 }, h = { x: 0, y: 0, z: 0 }, p = { x: 0, y: 0, z: 0 };
|
|
1782
1782
|
let v = null, C = null;
|
|
1783
1783
|
const k = 32, B = new Array(k).fill(0), U = new Array(k).fill(0), F = new Array(k).fill(0), N = (T, S, z) => {
|
|
1784
1784
|
for (; T <= S; ) {
|
|
@@ -1789,7 +1789,7 @@ class Tt extends u.EventDispatcher {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
return ~T;
|
|
1791
1791
|
}, W = () => {
|
|
1792
|
-
if (!s || !r || !c || !
|
|
1792
|
+
if (!s || !r || !c || !m)
|
|
1793
1793
|
return;
|
|
1794
1794
|
if (r.length === 0) {
|
|
1795
1795
|
const d = {
|
|
@@ -1799,10 +1799,10 @@ class Tt extends u.EventDispatcher {
|
|
|
1799
1799
|
self.postMessage(d, [s.buffer]), s = null;
|
|
1800
1800
|
return;
|
|
1801
1801
|
}
|
|
1802
|
-
const T = c.x, S = c.y, z = c.z, E =
|
|
1802
|
+
const T = c.x, S = c.y, z = c.z, E = m.x, y = m.y, b = m.z, j = 1e-4, L = Math.abs(T - f.x) > j || Math.abs(S - f.y) > j || Math.abs(z - f.z) > j, I = Math.abs(E - l.x) > j || Math.abs(y - l.y) > j || Math.abs(b - l.z) > j;
|
|
1803
1803
|
if (!g && !L && !I)
|
|
1804
1804
|
return;
|
|
1805
|
-
g = !1,
|
|
1805
|
+
g = !1, f.x = T, f.y = S, f.z = z, l.x = E, l.y = y, l.z = b;
|
|
1806
1806
|
let D = 1 / 0, x = -1 / 0;
|
|
1807
1807
|
for (let d = 0; d < 8; ++d) {
|
|
1808
1808
|
const P = d & 1 ? h.x : p.x, G = d & 2 ? h.y : p.y, M = d & 4 ? h.z : p.z, V = P * E + G * y + M * b;
|
|
@@ -1903,7 +1903,7 @@ class Tt extends u.EventDispatcher {
|
|
|
1903
1903
|
h.x = Math.min(h.x, r[y + 0]), p.x = Math.max(p.x, r[y + 0]), h.y = Math.min(h.y, r[y + 1]), p.y = Math.max(p.y, r[y + 1]), h.z = Math.min(h.z, r[y + 2]), p.z = Math.max(p.z, r[y + 2]);
|
|
1904
1904
|
}
|
|
1905
1905
|
} else z && r && r.length === 0 && (h.x = p.x = h.y = p.y = h.z = p.z = 0);
|
|
1906
|
-
S.cameraPosition && (c = S.cameraPosition), S.cameraDirection && (
|
|
1906
|
+
S.cameraPosition && (c = S.cameraPosition), S.cameraDirection && (m = S.cameraDirection), W();
|
|
1907
1907
|
};
|
|
1908
1908
|
}).toString()})();`;
|
|
1909
1909
|
}
|
|
@@ -2358,24 +2358,24 @@ const xe = class xe extends u.Mesh {
|
|
|
2358
2358
|
-1,
|
|
2359
2359
|
1,
|
|
2360
2360
|
0
|
|
2361
|
-
]), c = new Uint16Array([0, 1, 2, 0, 2, 3]),
|
|
2361
|
+
]), c = new Uint16Array([0, 1, 2, 0, 2, 3]), m = new Float32Array(4 * 3 * s);
|
|
2362
2362
|
for (let h = 0; h < s; h++) {
|
|
2363
2363
|
const p = h * 4 * 3;
|
|
2364
2364
|
for (let v = 0; v < 4; v++)
|
|
2365
|
-
|
|
2365
|
+
m[p + v * 3 + 0] = o[v * 3 + 0], m[p + v * 3 + 1] = o[v * 3 + 1], m[p + v * 3 + 2] = h;
|
|
2366
2366
|
}
|
|
2367
2367
|
const g = new Uint32Array(6 * s);
|
|
2368
2368
|
for (let h = 0; h < s; h++) {
|
|
2369
2369
|
const p = h * 6, v = h * 4;
|
|
2370
2370
|
g[p + 0] = c[0] + v, g[p + 1] = c[1] + v, g[p + 2] = c[2] + v, g[p + 3] = c[3] + v, g[p + 4] = c[4] + v, g[p + 5] = c[5] + v;
|
|
2371
2371
|
}
|
|
2372
|
-
n.setAttribute("position", new u.BufferAttribute(
|
|
2373
|
-
const
|
|
2374
|
-
|
|
2372
|
+
n.setAttribute("position", new u.BufferAttribute(m, 3)), n.setIndex(new u.BufferAttribute(g, 1));
|
|
2373
|
+
const f = new u.InstancedBufferGeometry();
|
|
2374
|
+
f.index = n.index, f.setAttribute("position", n.getAttribute("position"));
|
|
2375
2375
|
const l = new Uint32Array(r);
|
|
2376
2376
|
for (let h = 0; h < r; h++)
|
|
2377
2377
|
l[h] = h * s;
|
|
2378
|
-
return
|
|
2378
|
+
return f.setAttribute("splatInstanceIndex", new u.InstancedBufferAttribute(l, 1, !1)), f.instanceCount = 0, f;
|
|
2379
2379
|
}
|
|
2380
2380
|
/**
|
|
2381
2381
|
* Create chunks data (bounding box min/max) for the sorter.
|
|
@@ -2437,23 +2437,27 @@ const Ae = /* @__PURE__ */ new Map(), jt = ({
|
|
|
2437
2437
|
url: a,
|
|
2438
2438
|
type: e,
|
|
2439
2439
|
debug: t = !1,
|
|
2440
|
-
|
|
2441
|
-
|
|
2440
|
+
withCredentials: s = !1,
|
|
2441
|
+
splatOptions: r = {},
|
|
2442
|
+
...n
|
|
2442
2443
|
}) => {
|
|
2443
2444
|
if (!a) throw new Error('Splat component requires either "url" or "plyUrl" prop');
|
|
2444
|
-
const
|
|
2445
|
-
t && console.debug("SPLAT: rendering", { url: a, type:
|
|
2446
|
-
const [
|
|
2445
|
+
const o = Ft(a, e);
|
|
2446
|
+
t && console.debug("SPLAT: rendering", { url: a, type: o, splatOptions: r, meshProps: n });
|
|
2447
|
+
const [c, m] = tt(null), g = st(null);
|
|
2447
2448
|
return rt(() => {
|
|
2448
|
-
const
|
|
2449
|
-
return Ot(
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2449
|
+
const f = Je(a, o, r, s);
|
|
2450
|
+
return Ot(
|
|
2451
|
+
a,
|
|
2452
|
+
o,
|
|
2453
|
+
r,
|
|
2454
|
+
s
|
|
2455
|
+
).then((l) => {
|
|
2456
|
+
m(l);
|
|
2457
|
+
}), () => {
|
|
2458
|
+
t && console.debug("SPLAT: releasing mesh for", a), Ut(f);
|
|
2455
2459
|
};
|
|
2456
|
-
}, [a,
|
|
2460
|
+
}, [a, o, r, s, t]), c ? /* @__PURE__ */ it.jsx("primitive", { ref: g, object: c, ...n }) : null;
|
|
2457
2461
|
}, qt = (a) => {
|
|
2458
2462
|
const e = a.toLowerCase();
|
|
2459
2463
|
return e.endsWith(".ply") ? "ply" : e.endsWith(".sogs") || e.endsWith(".zip") || e.endsWith(".json") || e.endsWith(".sog") || e.endsWith(".sogs") || e.endsWith(".zip") ? "sogs" : null;
|
|
@@ -2462,12 +2466,12 @@ const Ae = /* @__PURE__ */ new Map(), jt = ({
|
|
|
2462
2466
|
const t = qt(a);
|
|
2463
2467
|
if (t) return t;
|
|
2464
2468
|
throw new Error(`Cannot determine file type from URL: "${a}". `);
|
|
2465
|
-
}, Je = (a, e, t) => `${a}:${e}:${JSON.stringify(t)}`, Ot = async (a, e, t) => {
|
|
2466
|
-
const
|
|
2467
|
-
if (
|
|
2468
|
-
return
|
|
2469
|
-
const
|
|
2470
|
-
return Ae.set(
|
|
2469
|
+
}, Je = (a, e, t, s) => `${a}:${e}:${JSON.stringify(t)}:${s}`, Ot = async (a, e, t, s) => {
|
|
2470
|
+
const r = Je(a, e, t, s), n = Ae.get(r);
|
|
2471
|
+
if (n)
|
|
2472
|
+
return n.refCount++, n.mesh;
|
|
2473
|
+
const c = await (e === "ply" ? new lt(void 0, { withCredentials: s }) : new _t(void 0, { withCredentials: s })).loadAsync(a), m = new De(c, t);
|
|
2474
|
+
return Ae.set(r, { mesh: m, refCount: 1 }), m;
|
|
2471
2475
|
};
|
|
2472
2476
|
function Ut(a) {
|
|
2473
2477
|
const e = Ae.get(a);
|