@voluma/vlam 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/effects.d.ts +99 -5
- package/dist/effects.js +214 -111
- package/dist/effects.js.map +1 -1
- package/dist/index.js +281 -219
- package/dist/index.js.map +1 -1
- package/dist/relighting-pass.d.ts +49 -0
- package/dist/streamed-splat-mesh-utils.d.ts +1 -1
- package/dist/streamed-splat-mesh.d.ts +14 -3
- package/dist/worker-sorter.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var u = (i, r, e) => Xr(i, typeof r != "symbol" ? r + "" : r, e);
|
|
|
4
4
|
import { r as rn, M as wr, L as Yr, a as ue } from "./splat-mesh-types-CTN_duw2.js";
|
|
5
5
|
import * as p from "three/webgpu";
|
|
6
6
|
import { WebGPURenderer as Kr } from "three/webgpu";
|
|
7
|
-
import { bool as
|
|
7
|
+
import { bool as vr, mat3 as He, vec3 as V, float as D, modelViewMatrix as ht, vec4 as H, modelWorldMatrix as Zr, int as te, attribute as Qr, ivec2 as gt, textureLoad as ne, varying as Te, colorSpaceToWorking as br, positionGeometry as nt, Fn as Y, cameraProjectionMatrix as yr, If as se, mix as xe, vec2 as he, Discard as Lt, texture as Pe, screenUV as Ee, uniform as I, uint as C, storage as G, atomicStore as Ne, instanceIndex as _, atomicAdd as sn, Loop as Fe, atomicLoad as Ve, uniformArray as Jr, floatBitsToUint as es, workgroupId as Gt, invocationLocalIndex as En, workgroupArray as ts, storageBarrier as St, workgroupBarrier as xt, atomicOr as ns, countOneBits as $t } from "three/tsl";
|
|
8
8
|
import { w as me, l as Bn } from "./logging-BfPdd7NJ.js";
|
|
9
9
|
import { s as qo } from "./logging-BfPdd7NJ.js";
|
|
10
10
|
import { d as rs, r as ss, a as tt, b as is, l as os, i as as } from "./splat-budget-DXew_86c.js";
|
|
@@ -48,7 +48,7 @@ function Rr(i, r, e) {
|
|
|
48
48
|
offset: V(0, 0, 0),
|
|
49
49
|
scale: D(1),
|
|
50
50
|
rotation: He(V(1, 0, 0), V(0, 1, 0), V(0, 0, 1)),
|
|
51
|
-
visible:
|
|
51
|
+
visible: vr(!0)
|
|
52
52
|
}, s = { offset: !1, scale: !1, rotation: !1, visible: !1 };
|
|
53
53
|
let o = null, a = null, c = null, l = null, h = null, d = null;
|
|
54
54
|
const f = /* @__PURE__ */ new Map(), g = {
|
|
@@ -161,7 +161,7 @@ class ms {
|
|
|
161
161
|
u(this, "activeSlotByPoolIndex");
|
|
162
162
|
u(this, "poolIndexTemplate", null);
|
|
163
163
|
if (!(r.capacity > 0)) throw new Error("SplatPool capacity must be positive.");
|
|
164
|
-
this.rows = Math.ceil(r.capacity / this.width),
|
|
164
|
+
this.rows = Math.ceil(r.capacity / this.width), vs(this.rows, r.maxTextureSize ?? 0, this.width);
|
|
165
165
|
const e = this.width * this.rows;
|
|
166
166
|
this.floatTextures = r.floatTextures === "float16" ? "float16" : "float32", this.packedShBands = r.packedShBands ?? 0;
|
|
167
167
|
const t = this.floatTextures === "float16" ? p.HalfFloatType : p.FloatType;
|
|
@@ -330,7 +330,7 @@ function ws(i) {
|
|
|
330
330
|
}
|
|
331
331
|
return 0;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function vs(i, r, e = wt) {
|
|
334
334
|
if (!(!(r > 0) || i <= r))
|
|
335
335
|
throw new Error(
|
|
336
336
|
`SplatPool: this scene needs a ${e}×${i} data texture, but this device caps texture dimensions at ${r} (about ${(r * e).toLocaleString("en-US")} pool splats). Lower the splat budget, or raise maxTextureDimension2D in the renderer's requiredLimits if the adapter advertises more.`
|
|
@@ -351,14 +351,14 @@ function jt(i, r, e) {
|
|
|
351
351
|
for (const o of s) i.addUpdateRange(o.start, o.count);
|
|
352
352
|
}
|
|
353
353
|
const In = 24, fn = In * In;
|
|
354
|
-
function
|
|
354
|
+
function bs(i, r) {
|
|
355
355
|
const e = Math.max(0, i);
|
|
356
356
|
if (e <= 0) return 0;
|
|
357
357
|
const t = Math.max(1e-4, r);
|
|
358
358
|
return 2 * Math.atan(0.5 * e / t);
|
|
359
359
|
}
|
|
360
360
|
function To(i) {
|
|
361
|
-
const r = Math.max(1e-4, i.depth), e = Math.max(1e-4, i.focusDistance), t =
|
|
361
|
+
const r = Math.max(1e-4, i.depth), e = Math.max(1e-4, i.focusDistance), t = bs(i.aperture, e);
|
|
362
362
|
if (t <= 0 || !(i.focalPx > 0)) return 0;
|
|
363
363
|
const n = Math.abs(r - e) / r, s = i.focalPx * Math.tan(0.5 * t), o = n * s, a = o * o, c = i.maxVariance ?? fn;
|
|
364
364
|
return Math.min(a, c);
|
|
@@ -372,7 +372,7 @@ function kr(i, r = { focusDistance: 10, aperture: 0 }) {
|
|
|
372
372
|
}
|
|
373
373
|
const Fn = 1024, ys = 1e30, Cr = 0.35 * 0.35;
|
|
374
374
|
function Tr(i, r, e, t) {
|
|
375
|
-
const n = V(1, 0, 0), s = V(0, 1, 0), o = V(0, 0, 1), a = i.mul(n), c = i.mul(s), l = i.mul(o), h = a.x, d = c.y, f = l.z, g = a.cross(c), w = c.cross(l), m = l.cross(a), y = g.length(),
|
|
375
|
+
const n = V(1, 0, 0), s = V(0, 1, 0), o = V(0, 0, 1), a = i.mul(n), c = i.mul(s), l = i.mul(o), h = a.x, d = c.y, f = l.z, g = a.cross(c), w = c.cross(l), m = l.cross(a), y = g.length(), v = w.length(), S = m.length(), R = y.greaterThanEqual(v).and(y.greaterThanEqual(S)), k = v.greaterThan(y).and(v.greaterThanEqual(S)), M = R.select(g, k.select(w, m)), x = M.div(M.length().max(1e-12)), b = x.dot(i.mul(x)), P = h.min(d).min(f).min(b).max(1e-12).mul(t), U = He(V(P, 0, 0), V(0, P, 0), V(0, 0, P));
|
|
376
376
|
return i.mul(D(1).sub(e)).add(U.mul(e));
|
|
377
377
|
}
|
|
378
378
|
function Pr(i, r, e) {
|
|
@@ -442,8 +442,8 @@ function Dn(i, r, e) {
|
|
|
442
442
|
m.columns,
|
|
443
443
|
ne(m.sourceIdTexture, f).r.toInt(),
|
|
444
444
|
w
|
|
445
|
-
) : null,
|
|
446
|
-
const B = y ? y.linear.inverse().mul(
|
|
445
|
+
) : null, v = y ? y.worldCenter : w, S = n === null ? null : (() => {
|
|
446
|
+
const B = y ? y.linear.inverse().mul(v.sub(s.localCameraPosition)).normalize() : v.sub(s.localCameraPosition).normalize(), E = B.x, T = B.y, O = B.z, F = Ir(n, t, f), $ = F(0).mul(T.mul(-rt)).add(F(1).mul(O.mul(rt))).add(F(2).mul(E.mul(-rt)));
|
|
447
447
|
if (n.bands === 1) return $;
|
|
448
448
|
const N = E.mul(E), X = T.mul(T), j = O.mul(O), K = $.add(F(3).mul(E.mul(T).mul(Be[0]))).add(F(4).mul(T.mul(O).mul(Be[1]))).add(F(5).mul(j.mul(2).sub(N).sub(X).mul(Be[2]))).add(F(6).mul(E.mul(O).mul(Be[3]))).add(F(7).mul(N.sub(X).mul(Be[4])));
|
|
449
449
|
return n.bands === 2 ? K : K.add(F(8).mul(T.mul(N.mul(3).sub(X)).mul(ge[0]))).add(F(9).mul(E.mul(T).mul(O).mul(ge[1]))).add(F(10).mul(T.mul(j.mul(4).sub(N).sub(X)).mul(ge[2]))).add(
|
|
@@ -456,7 +456,7 @@ function Dn(i, r, e) {
|
|
|
456
456
|
V(B.x.add(1e-8), B.y, B.z),
|
|
457
457
|
V(B.y, B.w.add(1e-8), E.x),
|
|
458
458
|
V(B.z, E.x, E.y.add(1e-8))
|
|
459
|
-
), F = (y ? y.linear.mul(T).mul(y.linear.transpose()) : T).inverse(), $ = s.localCameraPosition.sub(
|
|
459
|
+
), F = (y ? y.linear.mul(T).mul(y.linear.transpose()) : T).inverse(), $ = s.localCameraPosition.sub(v), N = F.mul(F.mul($)).normalize();
|
|
460
460
|
return N.mul(N.dot($).sign());
|
|
461
461
|
}, M = (B) => {
|
|
462
462
|
const E = e.channels.get(B);
|
|
@@ -467,17 +467,17 @@ function Dn(i, r, e) {
|
|
|
467
467
|
return ne(E.texture, f).r;
|
|
468
468
|
}, x = Rr(e.modifiers, s.localCameraPosition, {
|
|
469
469
|
index: d,
|
|
470
|
-
localCenter:
|
|
470
|
+
localCenter: v,
|
|
471
471
|
sourceCenter: w,
|
|
472
472
|
sourceToLocal: y == null ? void 0 : y.linear,
|
|
473
473
|
color: R,
|
|
474
474
|
makeNormal: k,
|
|
475
475
|
makeChannel: M
|
|
476
|
-
}),
|
|
477
|
-
o.srgbOutput ? x.color :
|
|
476
|
+
}), b = Te(
|
|
477
|
+
o.srgbOutput ? x.color : br(x.color, p.SRGBColorSpace)
|
|
478
478
|
), A = Te(nt.xy), P = r === "pick" ? Te(D(0), "pickViewDepth") : null, U = Te(D(1), "vOpacityCompensation"), L = o.lodAlpha ? Te(D(o.maxStdDev), "vAdjustedStdDev") : null, W = o.lodAlpha ? Te(D(1), "vAlpha2") : null;
|
|
479
479
|
if (i.vertexNode = Y(() => {
|
|
480
|
-
const B = x.offset === null ?
|
|
480
|
+
const B = x.offset === null ? v : v.add(x.offset), E = ht.mul(H(B, 1)).toVar(), T = yr.mul(E).toVar(), O = H(0, 0, 2, 1).toVar(), F = r === "pick" ? 1.2 + 2 * Fn : 1.2, $ = T.w.mul(F), N = T.z.greaterThan($.negate()).and(T.x.abs().lessThan($)).and(T.y.abs().lessThan($)), X = x.visible === null ? N : N.and(x.visible);
|
|
481
481
|
return se(X, () => {
|
|
482
482
|
P && P.assign(E.z.negate());
|
|
483
483
|
const j = ne(t.covarianceATexture, f), K = ne(t.covarianceBTexture, f), ae = He(
|
|
@@ -503,7 +503,7 @@ function Dn(i, r, e) {
|
|
|
503
503
|
0,
|
|
504
504
|
s.focal.y.mul(ce),
|
|
505
505
|
s.focal.y.negate().mul(E.y).mul(z)
|
|
506
|
-
), ee = ht.toMat3().transpose(), ie = ee.mul(Z),
|
|
506
|
+
), ee = ht.toMat3().transpose(), ie = ee.mul(Z), be = ee.mul(q), Ae = ie.dot(J.mul(ie)), Re = be.dot(J.mul(be)), ye = ie.dot(J.mul(be)), re = x.scaleSquared === null ? Ae : Ae.mul(x.scaleSquared), de = x.scaleSquared === null ? Re : Re.mul(x.scaleSquared), le = x.scaleSquared === null ? ye : ye.mul(x.scaleSquared), Ie = E.z.negate().max(1e-4), Xe = s.dofFocusDistance.max(1e-4), Ye = s.dofAperture.max(0).mul(0.5).div(Xe).atan(), Le = Ie.sub(Xe).abs().div(Ie), Oe = s.focal.x.mul(Ye.tan()), vt = Le.mul(Oe), bt = vt.mul(vt).min(D(fn)), Ke = o.projectedFilterProfile === "lcc" ? 0.1 : 0.3, Ze = re.add(Ke).add(bt), st = de.add(Ke).add(bt), De = le, Sn = Ze.mul(st).sub(De.mul(De)).max(1e-9), xn = (o.antialias || o.projectedFilterProfile === "lcc" ? re.mul(de).sub(le.mul(le)).max(0) : re.add(Ke).mul(de.add(Ke)).sub(le.mul(le)).max(1e-9)).div(Sn).sqrt();
|
|
507
507
|
U.assign(
|
|
508
508
|
x.isotropicCovarianceMix === null ? xn : xe(xn, D(1), x.isotropicCovarianceMix)
|
|
509
509
|
);
|
|
@@ -575,15 +575,15 @@ function Dn(i, r, e) {
|
|
|
575
575
|
Lt(B.greaterThan(1));
|
|
576
576
|
let E;
|
|
577
577
|
if (o.lodAlpha && L && W) {
|
|
578
|
-
const ie = B.mul(L.mul(L).mul(-0.5)).exp(),
|
|
578
|
+
const ie = B.mul(L.mul(L).mul(-0.5)).exp(), be = W.mul(4).sub(3).min(5), Ae = be.mul(be).sub(1).mul(1 / Math.E).exp(), Re = ie.oneMinus().pow(Ae).oneMinus();
|
|
579
579
|
E = W.greaterThan(1).select(Re, ie.mul(W));
|
|
580
580
|
} else
|
|
581
|
-
E = B.mul(h).exp().mul(
|
|
581
|
+
E = B.mul(h).exp().mul(b.a);
|
|
582
582
|
const T = E.mul(U), O = Pe(s.relightMap, Ee), F = s.relightSoftness.div(s.viewport.x.max(1)), $ = s.relightSoftness.div(s.viewport.y.max(1)), N = O, X = Pe(s.relightMap, Ee.add(he(F, 0))), j = Pe(s.relightMap, Ee.add(he(F.negate(), 0))), K = Pe(s.relightMap, Ee.add(he(0, $))), ae = Pe(s.relightMap, Ee.add(he(0, $.negate()))), fe = N.a.add(X.a).add(j.a).add(K.a).add(ae.a).max(1e-4), J = N.rgb.mul(N.a).add(X.rgb.mul(X.a)).add(j.rgb.mul(j.a)).add(K.rgb.mul(K.a)).add(ae.rgb.mul(ae.a)).div(fe), ce = fe.mul(0.2), z = H(J, ce), Z = s.relightSoftness.greaterThan(0.5).select(z, O), q = xe(
|
|
583
583
|
V(s.relightBackground),
|
|
584
584
|
Z.rgb.mul(s.relightBrightness),
|
|
585
585
|
Z.a
|
|
586
|
-
), ee = xe(
|
|
586
|
+
), ee = xe(b.rgb, b.rgb.mul(q), s.relightBlend);
|
|
587
587
|
return H(ee.mul(T), T);
|
|
588
588
|
})(), i.transparent = !0, i.depthTest = !0, i.depthWrite = !1, i.side = p.DoubleSide, i.blending = p.CustomBlending, i.blendSrc = p.OneFactor, i.blendDst = p.OneMinusSrcAlphaFactor, i.blendSrcAlpha = p.OneFactor, i.blendDstAlpha = p.OneMinusSrcAlphaFactor, i.toneMapped = !1;
|
|
589
589
|
else {
|
|
@@ -592,7 +592,7 @@ function Dn(i, r, e) {
|
|
|
592
592
|
i.fragmentNode = Y(() => {
|
|
593
593
|
const B = A.dot(A);
|
|
594
594
|
Lt(B.greaterThan(1));
|
|
595
|
-
const T = B.mul(h).exp().mul(
|
|
595
|
+
const T = B.mul(h).exp().mul(b.a).mul(U);
|
|
596
596
|
Lt(T.lessThan(a.alphaThreshold));
|
|
597
597
|
const F = P.sub(a.near).div(a.far.sub(a.near)).clamp(0, 1).mul(16777215), $ = F.div(65536).floor(), N = F.mod(65536).div(256).floor(), X = F.mod(256).floor();
|
|
598
598
|
return H($.div(255), N.div(255), X.div(255), 1);
|
|
@@ -723,51 +723,51 @@ const Ce = class Ce {
|
|
|
723
723
|
f,
|
|
724
724
|
"uint",
|
|
725
725
|
c / l / l
|
|
726
|
-
),
|
|
726
|
+
), v = G(g, "uint", t), S = G(r.sourceIndexAttribute, "uint", t), R = G(r.splatIndexAttribute, "float", t), k = o ? G(o, "vec4", t) : null;
|
|
727
727
|
this.clearPass = Y(() => {
|
|
728
728
|
Ne(w.element(_), C(0));
|
|
729
729
|
})().compute(c, [l]), this.histogramPass = Y(() => {
|
|
730
730
|
se(D(_).lessThan(this.activeCount), () => {
|
|
731
|
-
const x = te(S.element(_)),
|
|
731
|
+
const x = te(S.element(_)), b = n ? gt(
|
|
732
732
|
x.mod(te(s)),
|
|
733
733
|
x.div(te(s))
|
|
734
|
-
) : null, A = k ? k.element(x).xyz : ne(n,
|
|
734
|
+
) : null, A = k ? k.element(x).xyz : ne(n, b).xyz, P = a ? Br(
|
|
735
735
|
a.columns,
|
|
736
|
-
te(ne(a.sourceIdTexture,
|
|
736
|
+
te(ne(a.sourceIdTexture, b).r),
|
|
737
737
|
A
|
|
738
738
|
).worldCenter : A, L = this.viewRow2.xyz.dot(P).add(this.viewRow2.w).sub(this.depthMin).mul(this.depthScale).clamp(0, this.bucketMax).toUint();
|
|
739
|
-
|
|
739
|
+
v.element(_).assign(L), sn(w.element(L), C(1));
|
|
740
740
|
});
|
|
741
741
|
})().compute(t, [l]), this.scanBlocksPass = Y(() => {
|
|
742
|
-
const x = _.mul(C(l)).toVar(),
|
|
742
|
+
const x = _.mul(C(l)).toVar(), b = C(0).toVar();
|
|
743
743
|
Fe(l, ({ i: A }) => {
|
|
744
744
|
const P = w.element(x.add(C(A))), U = Ve(P).toVar();
|
|
745
|
-
Ne(P,
|
|
746
|
-
}), m.element(_).assign(
|
|
745
|
+
Ne(P, b), b.addAssign(U);
|
|
746
|
+
}), m.element(_).assign(b);
|
|
747
747
|
})().compute(c / l, [64]), this.scanBlockSumsPass = Y(() => {
|
|
748
|
-
const x = _.mul(C(l)).toVar(),
|
|
748
|
+
const x = _.mul(C(l)).toVar(), b = C(0).toVar();
|
|
749
749
|
Fe(l, ({ i: A }) => {
|
|
750
750
|
const P = m.element(x.add(C(A))), U = P.toVar();
|
|
751
|
-
P.assign(
|
|
752
|
-
}), y.element(_).assign(
|
|
751
|
+
P.assign(b), b.addAssign(U);
|
|
752
|
+
}), y.element(_).assign(b);
|
|
753
753
|
})().compute(c / l / l, [64]);
|
|
754
754
|
const M = Y(() => {
|
|
755
755
|
se(_.equal(C(0)), () => {
|
|
756
756
|
const x = C(0).toVar();
|
|
757
|
-
Fe(c / l / l, ({ i:
|
|
758
|
-
const A = y.element(
|
|
759
|
-
y.element(
|
|
757
|
+
Fe(c / l / l, ({ i: b }) => {
|
|
758
|
+
const A = y.element(b).toVar();
|
|
759
|
+
y.element(b).assign(x), x.addAssign(A);
|
|
760
760
|
});
|
|
761
761
|
});
|
|
762
762
|
})().compute(1, [64]);
|
|
763
763
|
this.addBlockSumOffsetsPass = Y(() => {
|
|
764
764
|
m.element(_).addAssign(y.element(_.div(C(l))));
|
|
765
765
|
})().compute(c / l, [l]), this.addOffsetsPass = Y(() => {
|
|
766
|
-
const x = w.element(_),
|
|
767
|
-
Ne(x, Ve(x).add(
|
|
766
|
+
const x = w.element(_), b = m.element(_.shiftRight(C(Math.log2(l))));
|
|
767
|
+
Ne(x, Ve(x).add(b));
|
|
768
768
|
})().compute(c, [l]), this.scatterPass = Y(() => {
|
|
769
769
|
se(D(_).lessThan(this.activeCount), () => {
|
|
770
|
-
const x = S.element(_),
|
|
770
|
+
const x = S.element(_), b = v.element(_), A = sn(w.element(b), C(1));
|
|
771
771
|
R.element(A).assign(D(x));
|
|
772
772
|
});
|
|
773
773
|
})().compute(t, [l]), this.sortPasses = [
|
|
@@ -920,6 +920,11 @@ class Ms {
|
|
|
920
920
|
u(this, "disposed", !1);
|
|
921
921
|
/** The active spans the in-flight sort was computed against. */
|
|
922
922
|
u(this, "sentSpans", null);
|
|
923
|
+
u(this, "submittedCount", 0);
|
|
924
|
+
u(this, "completedCount", 0);
|
|
925
|
+
u(this, "lastSubmittedAt", -1 / 0);
|
|
926
|
+
u(this, "lastCompletedAt", -1 / 0);
|
|
927
|
+
u(this, "lastLatencyMs", Number.NaN);
|
|
923
928
|
this.host = r, this.splatIndexAttribute = r.splatIndexAttribute, this.worker = new Rs(), this.worker.onmessage = (t) => {
|
|
924
929
|
this.applyOrder(t.data.order);
|
|
925
930
|
}, this.worker.onerror = (t) => {
|
|
@@ -932,7 +937,7 @@ class Ms {
|
|
|
932
937
|
}
|
|
933
938
|
sort(r, e, t) {
|
|
934
939
|
if (this.disposed || this.inFlight) return !1;
|
|
935
|
-
this.inFlight = !0, this.pushCenters(this.host.takeDirtyRows());
|
|
940
|
+
this.inFlight = !0, this.submittedCount++, this.lastSubmittedAt = performance.now(), this.pushCenters(this.host.takeDirtyRows());
|
|
936
941
|
const n = this.host.getActiveSpans();
|
|
937
942
|
this.sentSpans = n;
|
|
938
943
|
const s = {
|
|
@@ -943,6 +948,16 @@ class Ms {
|
|
|
943
948
|
};
|
|
944
949
|
return this.worker.postMessage(s), !0;
|
|
945
950
|
}
|
|
951
|
+
/** Internal timing diagnostics used by the demo's opt-in XR A/B harness. */
|
|
952
|
+
snapshot() {
|
|
953
|
+
return {
|
|
954
|
+
submittedCount: this.submittedCount,
|
|
955
|
+
completedCount: this.completedCount,
|
|
956
|
+
lastSubmittedAt: this.lastSubmittedAt,
|
|
957
|
+
lastCompletedAt: this.lastCompletedAt,
|
|
958
|
+
lastLatencyMs: this.lastLatencyMs
|
|
959
|
+
};
|
|
960
|
+
}
|
|
946
961
|
dispose() {
|
|
947
962
|
this.disposed || (this.disposed = !0, this.worker.terminate());
|
|
948
963
|
}
|
|
@@ -960,7 +975,7 @@ class Ms {
|
|
|
960
975
|
}
|
|
961
976
|
applyOrder(r) {
|
|
962
977
|
var s, o;
|
|
963
|
-
if (this.inFlight = !1, this.disposed) return;
|
|
978
|
+
if (this.inFlight = !1, this.completedCount++, this.lastCompletedAt = performance.now(), this.lastLatencyMs = this.lastCompletedAt - this.lastSubmittedAt, this.disposed) return;
|
|
964
979
|
const e = this.host.getActiveSpans(), t = this.sentSpans;
|
|
965
980
|
if (this.sentSpans = null, !t || t.length !== e.length) return;
|
|
966
981
|
for (let a = 0; a < t.length; a++)
|
|
@@ -1146,13 +1161,13 @@ class _s {
|
|
|
1146
1161
|
this.near.value = f, this.far.value = g, this.alphaThreshold.value = (n == null ? void 0 : n.alphaThreshold) !== void 0 ? n.alphaThreshold : 0.1;
|
|
1147
1162
|
const w = this.host.mesh, m = t.getRenderTarget(), y = t.getScissorTest();
|
|
1148
1163
|
t.getClearColor(this.savedClearColor);
|
|
1149
|
-
const
|
|
1164
|
+
const v = t.getClearAlpha(), S = t.autoClear;
|
|
1150
1165
|
h.matrix.copy(w.matrixWorld), h.matrixWorld.copy(w.matrixWorld), h.visible = this.host.getPickVisible(), h.layers.mask = w.layers.mask, h.renderOrder = w.renderOrder, l.viewport.set(0, 0, 1, 1), l.scissor.set(0, 0, 1, 1);
|
|
1151
1166
|
const R = (() => {
|
|
1152
1167
|
try {
|
|
1153
1168
|
return t.setRenderTarget(l), t.setScissorTest(!1), t.setClearColor(0, 0), t.autoClear = !0, t.clear(), t.setScissorTest(!0), t.autoClear = !1, t.render(this.scene, d), t.readRenderTargetPixelsAsync(l, 0, 0, 1, 1);
|
|
1154
1169
|
} finally {
|
|
1155
|
-
this.host.setView(e, s, o), t.setRenderTarget(m), t.setScissorTest(y), t.setClearColor(this.savedClearColor,
|
|
1170
|
+
this.host.setView(e, s, o), t.setRenderTarget(m), t.setScissorTest(y), t.setClearColor(this.savedClearColor, v), t.autoClear = S;
|
|
1156
1171
|
}
|
|
1157
1172
|
})();
|
|
1158
1173
|
let k;
|
|
@@ -1163,9 +1178,9 @@ class _s {
|
|
|
1163
1178
|
throw W;
|
|
1164
1179
|
}
|
|
1165
1180
|
if (this.host.isDisposed()) return null;
|
|
1166
|
-
const M = k[0], x = k[1],
|
|
1181
|
+
const M = k[0], x = k[1], b = k[2];
|
|
1167
1182
|
if (k[3] === 0) return null;
|
|
1168
|
-
const P = Ls(Fs(M, x,
|
|
1183
|
+
const P = Ls(Fs(M, x, b), f, g), { point: U, distance: L } = Ds(r.x, r.y, P, e, this.point);
|
|
1169
1184
|
return { point: U.clone(), distance: L };
|
|
1170
1185
|
}
|
|
1171
1186
|
ensureResources(r) {
|
|
@@ -1235,8 +1250,8 @@ class zs {
|
|
|
1235
1250
|
for (let w = 0; w < t; w++) {
|
|
1236
1251
|
const m = e[w] * 4;
|
|
1237
1252
|
for (let y = 0; y < 3; y++) {
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1253
|
+
const v = r[m + y];
|
|
1254
|
+
v < n[y] && (n[y] = v), v > s[y] && (s[y] = v);
|
|
1240
1255
|
}
|
|
1241
1256
|
}
|
|
1242
1257
|
const o = [
|
|
@@ -1290,7 +1305,7 @@ class zs {
|
|
|
1290
1305
|
for (let d = a[1]; d <= c[1]; d++) {
|
|
1291
1306
|
const f = (h * this.dims[1] + d) * this.dims[0], g = this.cellStart[f + a[0]], w = this.cellStart[f + c[0] + 1];
|
|
1292
1307
|
for (let m = g; m < w; m++) {
|
|
1293
|
-
const y = this.items[m],
|
|
1308
|
+
const y = this.items[m], v = y * 4, S = this.centers[v] - r, R = this.centers[v + 1] - e, k = this.centers[v + 2] - t, M = S * S + R * R + k * k;
|
|
1294
1309
|
M <= o && s(y, M);
|
|
1295
1310
|
}
|
|
1296
1311
|
}
|
|
@@ -1321,7 +1336,7 @@ const Os = 4, Q = class Q extends p.Mesh {
|
|
|
1321
1336
|
w && me(
|
|
1322
1337
|
`a mesh with shBands ${d} cannot share a pool built for ${f == null ? void 0 : f.packedShBands}; it allocated its own pool instead.`
|
|
1323
1338
|
);
|
|
1324
|
-
const m = f === void 0 || w, y = m ? g() : f,
|
|
1339
|
+
const m = f === void 0 || w, y = m ? g() : f, v = Math.min(
|
|
1325
1340
|
y.capacity,
|
|
1326
1341
|
Math.ceil(l / Q.DATA_TEXTURE_WIDTH) * Q.DATA_TEXTURE_WIDTH
|
|
1327
1342
|
), S = y.centersTexture, R = y.colorsTexture, k = y.covarianceATexture, M = y.covarianceBTexture, x = c && e.sh && h ? lt(
|
|
@@ -1329,13 +1344,13 @@ const Os = 4, Q = class Q extends p.Mesh {
|
|
|
1329
1344
|
e.sh.paletteWidth,
|
|
1330
1345
|
e.sh.paletteHeight,
|
|
1331
1346
|
p.FloatType
|
|
1332
|
-
) : null,
|
|
1347
|
+
) : null, b = y.shPackedTextures, A = new p.InstancedBufferGeometry();
|
|
1333
1348
|
A.setIndex([0, 1, 2, 0, 2, 3]), A.setAttribute(
|
|
1334
1349
|
"position",
|
|
1335
1350
|
new p.BufferAttribute(new Float32Array([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]), 3)
|
|
1336
1351
|
);
|
|
1337
|
-
const P = new Float32Array(
|
|
1338
|
-
for (let B = 0; B <
|
|
1352
|
+
const P = new Float32Array(v);
|
|
1353
|
+
for (let B = 0; B < v; B++) P[B] = B;
|
|
1339
1354
|
const U = new p.StorageInstancedBufferAttribute(P, 1);
|
|
1340
1355
|
A.setAttribute("splatIndex", U), A.instanceCount = 0;
|
|
1341
1356
|
super(A, new p.NodeMaterial());
|
|
@@ -1547,12 +1562,12 @@ const Os = 4, Q = class Q extends p.Mesh {
|
|
|
1547
1562
|
u(this, "orientation");
|
|
1548
1563
|
/** Set once the pool has been checked against the device texture limit. */
|
|
1549
1564
|
u(this, "textureLimitChecked", !1);
|
|
1550
|
-
if (this.pool = y, this.ownsPool = m, y.register(this), this.sortScheduler = new Ur(n, s), this.sortStrategy = t.sortStrategy ?? "counting", this.sortStrategy === "radix" && this.ensureRadixSorter(), this.performanceProfileValue = rn(t.performanceProfile), this.maxStdDevValue = o, this.minSplatSizePx = a, this.antialias = t.antialias ?? (c ? e.antialias ?? !1 : !1), this.projectedFilterProfile = t.projectedFilterProfile ?? "default", this.srgbOutput = t.srgbOutput ?? !1, this.maxSplatScreenRadius = Xt(t.maxSplatScreenRadius), this.minSplatScreenRadius = Xt(t.minSplatScreenRadius), this.screenBandMin.value = this.minSplatScreenRadius, this.screenBandMax.value = this.maxSplatScreenRadius, this.foveationMode = t.foveationMode ?? "band", this.foveationTargetPx = Hs(t.foveationTargetPx), this.foveationDrawBudget = Ys(t.foveationDrawBudget), this.foveationLimitPx = this.foveationTargetPx, this.maxSplatAspect = Xt(t.maxSplatAspect), this.lodAlpha = t.lodAlpha ?? !1, this.orientation = t.orientation ?? "y-up", this.splatIndexAttribute = U, this.sourceIndexAttribute = new p.StorageBufferAttribute(new Uint32Array(
|
|
1565
|
+
if (this.pool = y, this.ownsPool = m, y.register(this), this.sortScheduler = new Ur(n, s), this.sortStrategy = t.sortStrategy ?? "counting", this.sortStrategy === "radix" && this.ensureRadixSorter(), this.performanceProfileValue = rn(t.performanceProfile), this.maxStdDevValue = o, this.minSplatSizePx = a, this.antialias = t.antialias ?? (c ? e.antialias ?? !1 : !1), this.projectedFilterProfile = t.projectedFilterProfile ?? "default", this.srgbOutput = t.srgbOutput ?? !1, this.maxSplatScreenRadius = Xt(t.maxSplatScreenRadius), this.minSplatScreenRadius = Xt(t.minSplatScreenRadius), this.screenBandMin.value = this.minSplatScreenRadius, this.screenBandMax.value = this.maxSplatScreenRadius, this.foveationMode = t.foveationMode ?? "band", this.foveationTargetPx = Hs(t.foveationTargetPx), this.foveationDrawBudget = Ys(t.foveationDrawBudget), this.foveationLimitPx = this.foveationTargetPx, this.maxSplatAspect = Xt(t.maxSplatAspect), this.lodAlpha = t.lodAlpha ?? !1, this.orientation = t.orientation ?? "y-up", this.splatIndexAttribute = U, this.sourceIndexAttribute = new p.StorageBufferAttribute(new Uint32Array(v), 1), this.dataTextures = y.coreTextures, this.isStatic = c, this.shEnabled = x !== null, this.shRange = { min: Ln(), max: Ln() }, this.frustumCulled = !1, x && (this.dataTextures = [...this.dataTextures, x]), b.length > 0 && (this.dataTextures = [...this.dataTextures, ...b]), this.materialInputs = {
|
|
1551
1566
|
textures: { centersTexture: S, colorsTexture: R, covarianceATexture: k, covarianceBTexture: M },
|
|
1552
1567
|
sh: c && e.sh && x ? { mode: "palette", bands: e.sh.bands, paletteTexture: x } : d !== 0 ? {
|
|
1553
1568
|
mode: "packed",
|
|
1554
1569
|
bands: d,
|
|
1555
|
-
textures:
|
|
1570
|
+
textures: b,
|
|
1556
1571
|
range: this.shRange
|
|
1557
1572
|
} : null
|
|
1558
1573
|
}, this.buildMaterial(this.materialInputs.textures, this.materialInputs.sh), c) {
|
|
@@ -2429,16 +2444,16 @@ const Os = 4, Q = class Q extends p.Mesh {
|
|
|
2429
2444
|
const a = Nn.elements, { covarianceA: c, covarianceB: l, centers: h } = this.backing, d = l.length / 4;
|
|
2430
2445
|
let f = 0, g = 0;
|
|
2431
2446
|
for (let y = 0; y < d; y += zn) {
|
|
2432
|
-
const
|
|
2447
|
+
const v = y * 4, S = l[v + 3];
|
|
2433
2448
|
if (S === 0) continue;
|
|
2434
2449
|
f++;
|
|
2435
|
-
const R = h[
|
|
2436
|
-
if (a[2] * R + a[6] * k + a[10] * M + a[14] <= -
|
|
2450
|
+
const R = h[v], k = h[v + 1], M = h[v + 2], b = (a[3] * R + a[7] * k + a[11] * M + a[15]) * 1.2;
|
|
2451
|
+
if (a[2] * R + a[6] * k + a[10] * M + a[14] <= -b) continue;
|
|
2437
2452
|
const P = a[0] * R + a[4] * k + a[8] * M + a[12];
|
|
2438
|
-
if (P >
|
|
2453
|
+
if (P > b || P < -b) continue;
|
|
2439
2454
|
const U = a[1] * R + a[5] * k + a[9] * M + a[13];
|
|
2440
|
-
if (U >
|
|
2441
|
-
const L = c[
|
|
2455
|
+
if (U > b || U < -b) continue;
|
|
2456
|
+
const L = c[v] + c[v + 3] + l[v + 1], W = 2 * Math.sqrt(Math.max(L, 0) / 3), B = S < 0, E = Math.abs(S), T = R - ot.x, O = k - ot.y, F = M - ot.z, $ = o * Math.sqrt(T * T + O * O + F * F), N = B ? 0 : W;
|
|
2442
2457
|
E > $ && N <= $ && g++;
|
|
2443
2458
|
}
|
|
2444
2459
|
if (f === 0) return;
|
|
@@ -2612,14 +2627,14 @@ const Os = 4, Q = class Q extends p.Mesh {
|
|
|
2612
2627
|
h.start * a * s,
|
|
2613
2628
|
(h.start + h.count) * a * s
|
|
2614
2629
|
);
|
|
2615
|
-
let
|
|
2630
|
+
let v = y;
|
|
2616
2631
|
if (m) {
|
|
2617
2632
|
const R = this.acquireHalfEncodeBuffer(d, y.length);
|
|
2618
|
-
qt(y, R, 0, y.length),
|
|
2633
|
+
qt(y, R, 0, y.length), v = R;
|
|
2619
2634
|
}
|
|
2620
2635
|
const S = this.acquireUploadStaging(
|
|
2621
2636
|
d,
|
|
2622
|
-
|
|
2637
|
+
v,
|
|
2623
2638
|
a,
|
|
2624
2639
|
h.count,
|
|
2625
2640
|
n,
|
|
@@ -2933,6 +2948,8 @@ function ei(i, r) {
|
|
|
2933
2948
|
}
|
|
2934
2949
|
function $n(i) {
|
|
2935
2950
|
switch (i) {
|
|
2951
|
+
case "environment":
|
|
2952
|
+
return -1;
|
|
2936
2953
|
case "finest-target":
|
|
2937
2954
|
return 0;
|
|
2938
2955
|
case "coverage":
|
|
@@ -2950,8 +2967,9 @@ function mt(i, r) {
|
|
|
2950
2967
|
return i.coverageGroup < 0 ? `file:${r}` : i.phase === "finest-target" ? `cell:${i.coverageGroup}` : `slice:${i.coverageGroup}:${i.leafStart}:${i.leafEnd}`;
|
|
2951
2968
|
}
|
|
2952
2969
|
function ni(i, r = 10, e = !1) {
|
|
2953
|
-
const t =
|
|
2970
|
+
const t = vn(r), n = /* @__PURE__ */ new Map();
|
|
2954
2971
|
for (const [s, o] of i) {
|
|
2972
|
+
if (o.phase === "environment") continue;
|
|
2955
2973
|
const a = mt(o, s), c = n.get(a);
|
|
2956
2974
|
if (!c) {
|
|
2957
2975
|
n.set(a, {
|
|
@@ -2966,13 +2984,17 @@ function ni(i, r = 10, e = !1) {
|
|
|
2966
2984
|
o.distance < c.distance && (c.distance = o.distance), o.inView && (c.inView = !0), o.screenImportance < c.screenImportance && (c.screenImportance = o.screenImportance), o.phase === "finest-target" && (c.finest = !0), c.count++;
|
|
2967
2985
|
}
|
|
2968
2986
|
for (const [s, o] of i) {
|
|
2987
|
+
if (o.phase === "environment") {
|
|
2988
|
+
o.kind = "priority", o.groupDistance = 0, o.groupPending = 1, o.groupInView = !0, o.groupScreenImportance = Number.NEGATIVE_INFINITY, o.groupFinest = !0, o.groupId = "environment", o.groupClass = 0;
|
|
2989
|
+
continue;
|
|
2990
|
+
}
|
|
2969
2991
|
const a = mt(o, s), c = n.get(a);
|
|
2970
2992
|
if (!c) continue;
|
|
2971
2993
|
const l = c.inView ? 0 : c.distance <= t ? 1 : 2, h = l === 0 || l === 1 && e ? "priority" : "base";
|
|
2972
2994
|
o.groupDistance = c.distance, o.groupPending = c.count, o.groupInView = c.inView, o.groupScreenImportance = c.screenImportance, o.groupFinest = c.finest, o.groupId = a, o.groupClass = l, o.kind = h;
|
|
2973
2995
|
}
|
|
2974
2996
|
}
|
|
2975
|
-
function
|
|
2997
|
+
function vn(i, r = 2) {
|
|
2976
2998
|
return i;
|
|
2977
2999
|
}
|
|
2978
3000
|
function ri(i) {
|
|
@@ -2981,11 +3003,11 @@ function ri(i) {
|
|
|
2981
3003
|
function si(i, r, e = 2) {
|
|
2982
3004
|
if (i.level === 0) return "finest-target";
|
|
2983
3005
|
const t = i.distance ?? Number.POSITIVE_INFINITY;
|
|
2984
|
-
return i.inView === !1 && t >
|
|
3006
|
+
return i.inView === !1 && t > vn(r) ? "background" : "target";
|
|
2985
3007
|
}
|
|
2986
3008
|
function ii(i, r, e = 2) {
|
|
2987
3009
|
const t = i.distance ?? Number.POSITIVE_INFINITY;
|
|
2988
|
-
return i.inView === !1 && t >
|
|
3010
|
+
return i.inView === !1 && t > vn(r) ? "background" : "coverage";
|
|
2989
3011
|
}
|
|
2990
3012
|
function qn(i, r, e, t) {
|
|
2991
3013
|
const n = t.distance ?? Number.POSITIVE_INFINITY, s = t.level, o = t.inView !== !1, a = t.coverageGroup ?? -1, c = t.screenImportance ?? Number.POSITIVE_INFINITY, l = ti(e), h = i.get(r);
|
|
@@ -3036,8 +3058,8 @@ function qn(i, r, e, t) {
|
|
|
3036
3058
|
});
|
|
3037
3059
|
}
|
|
3038
3060
|
function Yt(i, r, e, t) {
|
|
3039
|
-
const n = i.groupDistance ?? i.distance, s = r.groupDistance ?? r.distance, o = i.groupPending ?? 1, a = r.groupPending ?? 1, c = i.groupId ?? mt(i, e), l = r.groupId ?? mt(r, t), h = i.groupClass ?? (i.inView ? 0 : 2), d = r.groupClass ?? (r.inView ? 0 : 2), f = i.groupScreenImportance ?? i.screenImportance, g = r.groupScreenImportance ?? r.screenImportance, w = i.groupFinest ? 0 : 1, m = r.groupFinest ? 0 : 1, y = (
|
|
3040
|
-
return h - d || w - m || f - g || n - s || a - o || (c < l ? -1 : c > l ? 1 : 0) || y(i.phase) - y(r.phase) || i.level - r.level || e - t;
|
|
3061
|
+
const n = i.groupDistance ?? i.distance, s = r.groupDistance ?? r.distance, o = i.groupPending ?? 1, a = r.groupPending ?? 1, c = i.groupId ?? mt(i, e), l = r.groupId ?? mt(r, t), h = i.groupClass ?? (i.inView ? 0 : 2), d = r.groupClass ?? (r.inView ? 0 : 2), f = i.groupScreenImportance ?? i.screenImportance, g = r.groupScreenImportance ?? r.screenImportance, w = i.groupFinest ? 0 : 1, m = r.groupFinest ? 0 : 1, y = (R) => R === "coverage" ? 0 : R === "background" ? 2 : 1, v = i.phase === "environment" ? 0 : 1, S = r.phase === "environment" ? 0 : 1;
|
|
3062
|
+
return v - S || h - d || w - m || f - g || n - s || a - o || (c < l ? -1 : c > l ? 1 : 0) || y(i.phase) - y(r.phase) || i.level - r.level || e - t;
|
|
3041
3063
|
}
|
|
3042
3064
|
function Kt(i, r, e) {
|
|
3043
3065
|
if (r < 0 || e < 0 || r + e > i.count)
|
|
@@ -3249,11 +3271,11 @@ const wi = [
|
|
|
3249
3271
|
{ test: (i) => i.endsWith(".rad"), format: "rad" },
|
|
3250
3272
|
{ test: (i) => i === "lod-meta.json", format: "streamed-sog" }
|
|
3251
3273
|
];
|
|
3252
|
-
function
|
|
3274
|
+
function vi(i) {
|
|
3253
3275
|
const r = [];
|
|
3254
3276
|
for (const a of i.keys()) {
|
|
3255
3277
|
const c = Dt(a).toLowerCase(), l = wi.find((h) => h.test(c));
|
|
3256
|
-
l && Vr(a) ===
|
|
3278
|
+
l && Vr(a) === bi(i, l) && r.push({ path: a, format: l.format });
|
|
3257
3279
|
}
|
|
3258
3280
|
if (r.length === 0)
|
|
3259
3281
|
throw new dt(
|
|
@@ -3306,7 +3328,7 @@ function Dt(i) {
|
|
|
3306
3328
|
function Vr(i) {
|
|
3307
3329
|
return i.split("/").length - 1;
|
|
3308
3330
|
}
|
|
3309
|
-
function
|
|
3331
|
+
function bi(i, r) {
|
|
3310
3332
|
let e = 1 / 0;
|
|
3311
3333
|
for (const t of i.keys())
|
|
3312
3334
|
r.test(Dt(t).toLowerCase()) && (e = Math.min(e, Vr(t)));
|
|
@@ -5038,7 +5060,7 @@ class Qn {
|
|
|
5038
5060
|
this.pending.clear();
|
|
5039
5061
|
}
|
|
5040
5062
|
}
|
|
5041
|
-
class
|
|
5063
|
+
class bn {
|
|
5042
5064
|
constructor() {
|
|
5043
5065
|
u(this, "streaming", new Qn(new yi()));
|
|
5044
5066
|
/** The in-flight construction; `null` until a one-shot format is requested. */
|
|
@@ -5185,7 +5207,7 @@ class Ut extends pt {
|
|
|
5185
5207
|
var f, g, w;
|
|
5186
5208
|
super({ capacity: n }, s);
|
|
5187
5209
|
u(this, "scene");
|
|
5188
|
-
u(this, "loader", new
|
|
5210
|
+
u(this, "loader", new bn());
|
|
5189
5211
|
/**
|
|
5190
5212
|
* Cap the *classic* (non-page-table) chunk cache evicts against.
|
|
5191
5213
|
*
|
|
@@ -5491,7 +5513,7 @@ class Ut extends pt {
|
|
|
5491
5513
|
static async loadLocal(e, t = {}) {
|
|
5492
5514
|
let n;
|
|
5493
5515
|
try {
|
|
5494
|
-
n =
|
|
5516
|
+
n = vi(e);
|
|
5495
5517
|
} catch (s) {
|
|
5496
5518
|
throw s instanceof dt ? s : new dt(s instanceof Error ? s.message : String(s), {
|
|
5497
5519
|
phase: "manifest",
|
|
@@ -5526,25 +5548,25 @@ class Ut extends pt {
|
|
|
5526
5548
|
let g;
|
|
5527
5549
|
if (t === "rad")
|
|
5528
5550
|
try {
|
|
5529
|
-
const { buildRadScene:
|
|
5530
|
-
g = await
|
|
5531
|
-
} catch (
|
|
5532
|
-
throw At(
|
|
5551
|
+
const { buildRadScene: b } = await import("./formats/rad.js");
|
|
5552
|
+
g = await b(e, c, n.request, l, d);
|
|
5553
|
+
} catch (b) {
|
|
5554
|
+
throw At(b) ? b : Rt(b, { phase: "manifest", url: e.manifestUrl });
|
|
5533
5555
|
}
|
|
5534
5556
|
else {
|
|
5535
|
-
let
|
|
5557
|
+
let b;
|
|
5536
5558
|
try {
|
|
5537
|
-
|
|
5559
|
+
b = await fetch(e.manifestUrl, on(n.request, f));
|
|
5538
5560
|
} catch (A) {
|
|
5539
5561
|
throw At(A) ? A : Rt(A, { phase: "fetch", url: e.manifestUrl });
|
|
5540
5562
|
}
|
|
5541
|
-
if (!
|
|
5563
|
+
if (!b.ok)
|
|
5542
5564
|
throw Rt(
|
|
5543
|
-
new Error(`Failed to load manifest ${e.manifestUrl}: HTTP ${
|
|
5544
|
-
{ phase: "manifest", url: e.manifestUrl, status:
|
|
5565
|
+
new Error(`Failed to load manifest ${e.manifestUrl}: HTTP ${b.status}`),
|
|
5566
|
+
{ phase: "manifest", url: e.manifestUrl, status: b.status }
|
|
5545
5567
|
);
|
|
5546
5568
|
try {
|
|
5547
|
-
const A = await
|
|
5569
|
+
const A = await b.json();
|
|
5548
5570
|
if (t === "lcc2") {
|
|
5549
5571
|
const { buildLcc2Scene: P } = await import("./formats/lcc.js");
|
|
5550
5572
|
g = P(A, e, c, n.shBands ?? 0);
|
|
@@ -5560,9 +5582,9 @@ class Ut extends pt {
|
|
|
5560
5582
|
f == null || f.throwIfAborted();
|
|
5561
5583
|
const w = (t === "lcc" || t === "rad") && d ? os(a, g.maxResidentSplats, s) : a, m = n.maxBudget === void 0 ? w : Math.min(o, w);
|
|
5562
5584
|
g.source.budget = m;
|
|
5563
|
-
const y = Math.min(w, g.maxResidentSplats),
|
|
5585
|
+
const y = Math.min(w, g.maxResidentSplats), v = n.experimentalStagedSwaps !== !1 ? 1.5 : 1.4, S = Math.max(
|
|
5564
5586
|
1,
|
|
5565
|
-
Math.ceil(y *
|
|
5587
|
+
Math.ceil(y * v / _e)
|
|
5566
5588
|
), R = g.foveation ? n.foveationMode ?? (t === "rad" ? "pagetable" : "frontier") : n.foveationMode;
|
|
5567
5589
|
let k;
|
|
5568
5590
|
if (R === "pagetable") {
|
|
@@ -6110,8 +6132,8 @@ class Ut extends pt {
|
|
|
6110
6132
|
const f = d.data.positions, g = o.edits.get(h.file) ?? /* @__PURE__ */ new Map();
|
|
6111
6133
|
let w = !1;
|
|
6112
6134
|
for (let m = 0; m < h.count; m++) {
|
|
6113
|
-
const y = h.offset + m,
|
|
6114
|
-
if (!(
|
|
6135
|
+
const y = h.offset + m, v = f[y * 3 + 0] - at.x, S = f[y * 3 + 1] - at.y, R = f[y * 3 + 2] - at.z;
|
|
6136
|
+
if (!(v * v + S * S + R * R > a) && !g.has(y)) {
|
|
6115
6137
|
if (o.total >= o.maxEdits) {
|
|
6116
6138
|
o.warned || (o.warned = !0, me(
|
|
6117
6139
|
`StreamedSplatMesh.paintPersistent: channel "${e}" hit its maxEdits cap (${o.maxEdits}); further new edits are dropped.`
|
|
@@ -6172,14 +6194,14 @@ class Ut extends pt {
|
|
|
6172
6194
|
let s = null;
|
|
6173
6195
|
if (this.onPerformanceEvent !== void 0) {
|
|
6174
6196
|
s = { resident: /* @__PURE__ */ new Map(), staged: /* @__PURE__ */ new Map() };
|
|
6175
|
-
for (const [
|
|
6176
|
-
for (const [
|
|
6197
|
+
for (const [b, A] of this.resident) s.resident.set(b, A.run.count);
|
|
6198
|
+
for (const [b, A] of this.staged) s.staged.set(b, A.uploadedCount);
|
|
6177
6199
|
}
|
|
6178
6200
|
const o = this.compactionCount;
|
|
6179
6201
|
if (this.pendingWork = !1, this.lastScheduleTime = t, e.getWorldPosition(this.lastCameraPos), e.getWorldQuaternion(this.lastCameraQuat), je.copy(this.lastCameraPos), this.worldToLocal(je), sr.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse).multiply(this.matrixWorld), kt.setFromProjectionMatrix(sr), this.frontierWorker) {
|
|
6180
6202
|
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(je).normalize();
|
|
6181
|
-
const
|
|
6182
|
-
if (
|
|
6203
|
+
const b = e.projectionMatrix.elements[5] * this.pageTableViewportY / 2;
|
|
6204
|
+
if (b > 0 && (this.pageTableLimit = this.pageTableTargetPx / b), this.reschedulePageTable(je, We, kt, t), this.onPerformanceEvent === void 0) return null;
|
|
6183
6205
|
const A = performance.now();
|
|
6184
6206
|
return {
|
|
6185
6207
|
timestamp: A,
|
|
@@ -6210,59 +6232,65 @@ class Ut extends pt {
|
|
|
6210
6232
|
je,
|
|
6211
6233
|
kt
|
|
6212
6234
|
), l = c !== null, h = c ?? a, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set();
|
|
6213
|
-
for (const
|
|
6214
|
-
d.set(ue(
|
|
6215
|
-
for (const [
|
|
6216
|
-
d.has(
|
|
6217
|
-
for (const [
|
|
6218
|
-
!f.has(
|
|
6219
|
-
for (const
|
|
6220
|
-
!f.has(
|
|
6235
|
+
for (const b of h)
|
|
6236
|
+
d.set(ue(b), b), f.add(b.file);
|
|
6237
|
+
for (const [b, A] of this.staged)
|
|
6238
|
+
d.has(b) || l && ((x = this.frozenCriticalRuns) != null && x.some((P) => ue(P) === b)) || (this.removeRange(A.handle), this.staged.delete(b));
|
|
6239
|
+
for (const [b, { controller: A }] of this.fetching)
|
|
6240
|
+
!f.has(b) && !this.scene.pinnedFiles.has(b) && A.abort();
|
|
6241
|
+
for (const b of this.retrying.keys())
|
|
6242
|
+
!f.has(b) && !this.scene.pinnedFiles.has(b) && this.retrying.delete(b);
|
|
6221
6243
|
this.neededFiles.clear();
|
|
6222
|
-
for (const
|
|
6223
|
-
const A = ue(
|
|
6244
|
+
for (const b of h) {
|
|
6245
|
+
const A = ue(b);
|
|
6224
6246
|
if (this.resident.has(A)) continue;
|
|
6225
6247
|
const P = this.staged.get(A);
|
|
6226
|
-
P && P.uploadedCount ===
|
|
6248
|
+
P && P.uploadedCount === b.count || this.neededFiles.add(b.file);
|
|
6227
6249
|
}
|
|
6228
|
-
|
|
6250
|
+
this.envFile !== void 0 && this.envEnabled && this.envHandle === void 0 && !this.envUnfit && !this.failedFiles.has(this.envFile) && this.neededFiles.add(this.envFile);
|
|
6251
|
+
const g = h.filter((b) => !this.resident.has(ue(b))), w = l ? [] : [...this.resident.entries()].filter(([b]) => !d.has(b)), m = l ? (
|
|
6229
6252
|
// Mesh is invisible during the hold, so L0 cell-atomicity (no holes) is
|
|
6230
6253
|
// irrelevant - commit each frozen slice as it lands so a partial home
|
|
6231
6254
|
// cell cannot block reveal behind sibling subchunks still fetching.
|
|
6232
6255
|
Zs(g)
|
|
6233
6256
|
) : Qs(g, w), y = !l && Js(m);
|
|
6234
6257
|
m.sort(
|
|
6235
|
-
(
|
|
6258
|
+
(b, A) => y ? ei(b, A) : Gn(b) - Gn(A)
|
|
6236
6259
|
);
|
|
6237
|
-
const
|
|
6260
|
+
const v = /* @__PURE__ */ new Map();
|
|
6261
|
+
this.updateEnvironment(t, v);
|
|
6238
6262
|
let S = 0, R = !1, k = !1, M = !1;
|
|
6239
|
-
for (const
|
|
6240
|
-
if (!y &&
|
|
6263
|
+
for (const b of m) {
|
|
6264
|
+
if (!y && b.removes.length > 0 && R) {
|
|
6241
6265
|
if (this.neverRetireCoverageEarly || !k && this.retireHeldTicks < Ci) {
|
|
6242
6266
|
this.pendingWork = !0, M = !0;
|
|
6243
6267
|
continue;
|
|
6244
6268
|
}
|
|
6245
6269
|
this.fetchCountsValue.retiredEarly++;
|
|
6246
6270
|
}
|
|
6247
|
-
if (
|
|
6248
|
-
this.applyGroup(
|
|
6271
|
+
if (b.adds.length === 0) {
|
|
6272
|
+
this.applyGroup(b, t);
|
|
6249
6273
|
continue;
|
|
6250
6274
|
}
|
|
6251
|
-
const A =
|
|
6275
|
+
const A = b.adds.filter((L) => !this.cache.has(L.file)), P = l || ri(b) && this.initialRevealHold !== "hold-coverage";
|
|
6252
6276
|
if (A.length > 0) {
|
|
6253
6277
|
let L = !1;
|
|
6254
6278
|
for (const W of A)
|
|
6255
6279
|
this.failedFiles.has(W.file) || (qn(
|
|
6256
|
-
|
|
6280
|
+
v,
|
|
6257
6281
|
W.file,
|
|
6258
6282
|
si(W, this.scene.source.lodBaseDistance),
|
|
6259
6283
|
W
|
|
6260
6284
|
), L = !0);
|
|
6261
|
-
if (l || this.substituteCoverage(
|
|
6285
|
+
if (l || this.substituteCoverage(b, t, v, P), L && (this.pendingWork = !0, R = !0), !l) continue;
|
|
6286
|
+
}
|
|
6287
|
+
if (l && this.environmentPendingForReveal()) {
|
|
6288
|
+
this.pendingWork = !0, R = !0;
|
|
6289
|
+
continue;
|
|
6262
6290
|
}
|
|
6263
|
-
if ((l || this.stagedSwapsEnabled &&
|
|
6264
|
-
const L = this.stageGroup(
|
|
6265
|
-
if (S += L, !
|
|
6291
|
+
if ((l || this.stagedSwapsEnabled && b.addCount > this.appendCap) && this.canStageGroup(b)) {
|
|
6292
|
+
const L = this.stageGroup(b, t, Math.max(0, this.appendCap - S));
|
|
6293
|
+
if (S += L, !b.adds.every((W) => {
|
|
6266
6294
|
var B;
|
|
6267
6295
|
return ((B = this.staged.get(ue(W))) == null ? void 0 : B.uploadedCount) === W.count;
|
|
6268
6296
|
})) {
|
|
@@ -6273,10 +6301,10 @@ class Ut extends pt {
|
|
|
6273
6301
|
this.deferNextSortRequest(), this.pendingWork = !0, R = !0;
|
|
6274
6302
|
continue;
|
|
6275
6303
|
}
|
|
6276
|
-
this.commitStagedGroup(
|
|
6304
|
+
this.commitStagedGroup(b);
|
|
6277
6305
|
continue;
|
|
6278
6306
|
}
|
|
6279
|
-
if (!l && S > 0 && S +
|
|
6307
|
+
if (!l && S > 0 && S + b.addCount > this.appendCap) {
|
|
6280
6308
|
this.pendingWork = !0, R = !0;
|
|
6281
6309
|
continue;
|
|
6282
6310
|
}
|
|
@@ -6284,13 +6312,13 @@ class Ut extends pt {
|
|
|
6284
6312
|
this.pendingWork = !0, R = !0;
|
|
6285
6313
|
continue;
|
|
6286
6314
|
}
|
|
6287
|
-
if (!this.applyGroup(
|
|
6315
|
+
if (!this.applyGroup(b, t)) {
|
|
6288
6316
|
this.pendingWork = !0, k = !0;
|
|
6289
6317
|
continue;
|
|
6290
6318
|
}
|
|
6291
|
-
S +=
|
|
6319
|
+
S += b.addCount;
|
|
6292
6320
|
}
|
|
6293
|
-
return this.flushClassicFetches(
|
|
6321
|
+
return this.flushClassicFetches(v, this.scene.source.lodBaseDistance, l), this.retireHeldTicks = M ? this.retireHeldTicks + 1 : 0, l && (this.finishInitialRevealIfComplete(), this.initialRevealPhase === "holding" && (this.pendingWork = !0)), this.fetchCountsValue.cacheBytes = this.cacheBytesTotal, this.fetchCountsValue.cacheLimitBytes = this.cpuCacheBytes, this.cacheBytesTotal > this.cpuCacheBytes && (this.fetchCountsValue.cacheFull = !0), this.evictChunks(t), s === null ? null : this.createPerformanceEvent(
|
|
6294
6322
|
s.resident,
|
|
6295
6323
|
s.staged,
|
|
6296
6324
|
o,
|
|
@@ -6407,6 +6435,10 @@ class Ut extends pt {
|
|
|
6407
6435
|
var o, a;
|
|
6408
6436
|
const s = ((a = (o = this.scene.source).coverageRunsFor) == null ? void 0 : a.call(o, e, t)) ?? [];
|
|
6409
6437
|
if (s.length === 0) {
|
|
6438
|
+
if (this.environmentPendingForReveal()) {
|
|
6439
|
+
this.frozenCriticalRuns = [], this.initialRevealStartedAt = n, this.initialRevealPhase = "holding", this.publishInitialRevealProgress([]);
|
|
6440
|
+
return;
|
|
6441
|
+
}
|
|
6410
6442
|
this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released";
|
|
6411
6443
|
return;
|
|
6412
6444
|
}
|
|
@@ -6468,7 +6500,14 @@ class Ut extends pt {
|
|
|
6468
6500
|
}
|
|
6469
6501
|
/** After staging/commits, release the hold when every frozen run is resident. */
|
|
6470
6502
|
finishInitialRevealIfComplete() {
|
|
6471
|
-
this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns || (this.publishInitialRevealProgress(this.frozenCriticalRuns), this.frozenCriticalRuns.every((e) => this.resident.has(ue(e))) && this.releaseInitialReveal("ready"));
|
|
6503
|
+
this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns || (this.publishInitialRevealProgress(this.frozenCriticalRuns), !this.environmentPendingForReveal() && this.frozenCriticalRuns.every((e) => this.resident.has(ue(e))) && this.releaseInitialReveal("ready"));
|
|
6504
|
+
}
|
|
6505
|
+
/**
|
|
6506
|
+
* Startup hold still needs the environment tile when the scene ships one
|
|
6507
|
+
* and it starts enabled. Failed / unfit / disabled tiles do not block reveal.
|
|
6508
|
+
*/
|
|
6509
|
+
environmentPendingForReveal() {
|
|
6510
|
+
return this.envFile !== void 0 && this.envEnabled && !this.envUnfit && this.envHandle === void 0 && !this.failedFiles.has(this.envFile);
|
|
6472
6511
|
}
|
|
6473
6512
|
/** Creates a marker for a changed streamed-LOD tick, if any. */
|
|
6474
6513
|
createPerformanceEvent(e, t, n, s) {
|
|
@@ -6654,8 +6693,8 @@ class Ut extends pt {
|
|
|
6654
6693
|
), this.fetchCountsValue.uncovered += Math.min(m.leafEnd, w) - Math.max(m.leafStart, g);
|
|
6655
6694
|
continue;
|
|
6656
6695
|
}
|
|
6657
|
-
for (const [y,
|
|
6658
|
-
|
|
6696
|
+
for (const [y, v] of this.resident)
|
|
6697
|
+
v.run.leafStart < m.leafEnd && v.run.leafEnd > m.leafStart && (this.removeRange(v.handle), this.resident.delete(y));
|
|
6659
6698
|
this.appendRun(m, t);
|
|
6660
6699
|
}
|
|
6661
6700
|
l = f;
|
|
@@ -6691,40 +6730,63 @@ class Ut extends pt {
|
|
|
6691
6730
|
* it is wanted. The tile has no LOD ladder and no manifest count, so it is
|
|
6692
6731
|
* appended whole (measuring its splat count at decode) and thereafter toggled
|
|
6693
6732
|
* by flipping its pool range active - never scheduled, refetched, or evicted.
|
|
6733
|
+
* When `pending` is supplied, a miss is ranked as an `'environment'` want so
|
|
6734
|
+
* it issues ahead of LOD coverage.
|
|
6694
6735
|
*/
|
|
6695
|
-
updateEnvironment(e) {
|
|
6696
|
-
const
|
|
6697
|
-
if (
|
|
6736
|
+
updateEnvironment(e, t) {
|
|
6737
|
+
const n = this.envFile;
|
|
6738
|
+
if (n === void 0 || this.envHandle !== void 0 || !this.envEnabled || this.envUnfit)
|
|
6698
6739
|
return;
|
|
6699
|
-
const
|
|
6700
|
-
if (!
|
|
6701
|
-
this.failedFiles.has(
|
|
6740
|
+
const s = this.cache.get(n);
|
|
6741
|
+
if (!s) {
|
|
6742
|
+
this.failedFiles.has(n) || (t ? this.enqueueEnvironmentFetch(t, n) : this.requestChunk(n, "priority"), this.pendingWork = !0);
|
|
6702
6743
|
return;
|
|
6703
6744
|
}
|
|
6704
|
-
const
|
|
6705
|
-
if (
|
|
6745
|
+
const o = Math.ceil(s.data.count / _e) * _e;
|
|
6746
|
+
if (o > this.capacity) {
|
|
6706
6747
|
this.envUnfit = !0, me(
|
|
6707
|
-
`the environment tile (${
|
|
6748
|
+
`the environment tile (${s.data.count} splats) exceeds the pool capacity (${this.capacity}); it will not be shown. Raise the splat budget to fit it.`
|
|
6708
6749
|
);
|
|
6709
6750
|
return;
|
|
6710
6751
|
}
|
|
6711
|
-
if (
|
|
6752
|
+
if (o > this.freeSplatCapacity) {
|
|
6712
6753
|
this.pendingWork = !0;
|
|
6713
6754
|
return;
|
|
6714
6755
|
}
|
|
6715
|
-
let
|
|
6756
|
+
let a;
|
|
6716
6757
|
try {
|
|
6717
|
-
|
|
6758
|
+
a = this.appendRange(s.data);
|
|
6718
6759
|
} catch {
|
|
6719
6760
|
this.compactionCount++, this.compact();
|
|
6720
6761
|
try {
|
|
6721
|
-
|
|
6762
|
+
a = this.appendRange(s.data);
|
|
6722
6763
|
} catch {
|
|
6723
6764
|
this.pendingWork = !0;
|
|
6724
6765
|
return;
|
|
6725
6766
|
}
|
|
6726
6767
|
}
|
|
6727
|
-
this.envHandle =
|
|
6768
|
+
this.envHandle = a, this.envSplatCount = s.data.count, s.lastUsed = e;
|
|
6769
|
+
}
|
|
6770
|
+
/** Ranks the env tile ahead of every LOD want in {@link flushClassicFetches}. */
|
|
6771
|
+
enqueueEnvironmentFetch(e, t) {
|
|
6772
|
+
e.has(t) || e.set(t, {
|
|
6773
|
+
kind: "priority",
|
|
6774
|
+
phase: "environment",
|
|
6775
|
+
distance: 0,
|
|
6776
|
+
level: 0,
|
|
6777
|
+
inView: !0,
|
|
6778
|
+
coverageGroup: -1,
|
|
6779
|
+
leafStart: 0,
|
|
6780
|
+
leafEnd: 0,
|
|
6781
|
+
screenImportance: Number.NEGATIVE_INFINITY,
|
|
6782
|
+
groupDistance: 0,
|
|
6783
|
+
groupPending: 1,
|
|
6784
|
+
groupInView: !0,
|
|
6785
|
+
groupScreenImportance: Number.NEGATIVE_INFINITY,
|
|
6786
|
+
groupFinest: !0,
|
|
6787
|
+
groupId: "environment",
|
|
6788
|
+
groupClass: 0
|
|
6789
|
+
});
|
|
6728
6790
|
}
|
|
6729
6791
|
/**
|
|
6730
6792
|
* Page-table reschedule (`foveationMode: 'pagetable'`): posts the camera to the
|
|
@@ -6953,7 +7015,7 @@ function Ui(i, r, e) {
|
|
|
6953
7015
|
};
|
|
6954
7016
|
}
|
|
6955
7017
|
async function _i(i, r = {}) {
|
|
6956
|
-
const e = new
|
|
7018
|
+
const e = new bn();
|
|
6957
7019
|
try {
|
|
6958
7020
|
return await e.load(i instanceof URL ? i.href : i, r);
|
|
6959
7021
|
} finally {
|
|
@@ -6961,7 +7023,7 @@ async function _i(i, r = {}) {
|
|
|
6961
7023
|
}
|
|
6962
7024
|
}
|
|
6963
7025
|
async function Bo(i, r = {}) {
|
|
6964
|
-
const e = new
|
|
7026
|
+
const e = new bn();
|
|
6965
7027
|
try {
|
|
6966
7028
|
return await e.loadFile(i, r);
|
|
6967
7029
|
} finally {
|
|
@@ -7286,7 +7348,7 @@ function ji(i) {
|
|
|
7286
7348
|
throw new RangeError("Radix key width must be a positive multiple of four bits.");
|
|
7287
7349
|
return i / un;
|
|
7288
7350
|
}
|
|
7289
|
-
const
|
|
7351
|
+
const ve = 256, hn = 8, Qt = ve * hn, ut = 16, et = ve / 32, Pt = ut * et, Et = 256;
|
|
7290
7352
|
class Gr {
|
|
7291
7353
|
constructor(r) {
|
|
7292
7354
|
u(this, "kind", "radix");
|
|
@@ -7315,7 +7377,7 @@ class Gr {
|
|
|
7315
7377
|
const a = ji(o ? qi : Or), c = Math.ceil(e / Qt), l = ut * c, h = Math.ceil(l / Et), d = new p.StorageBufferAttribute(new Uint32Array(e), 1), f = new p.StorageBufferAttribute(new Uint32Array(e), 1), g = new p.StorageBufferAttribute(new Uint32Array(e), 1), w = new p.StorageBufferAttribute(new Uint32Array(e), 1), m = new p.StorageBufferAttribute(
|
|
7316
7378
|
new Uint32Array(l),
|
|
7317
7379
|
1
|
|
7318
|
-
), y = new p.StorageBufferAttribute(new Uint32Array(h), 1),
|
|
7380
|
+
), y = new p.StorageBufferAttribute(new Uint32Array(h), 1), v = new p.StorageBufferAttribute(
|
|
7319
7381
|
new Uint32Array(c * Pt),
|
|
7320
7382
|
1
|
|
7321
7383
|
);
|
|
@@ -7326,9 +7388,9 @@ class Gr {
|
|
|
7326
7388
|
w,
|
|
7327
7389
|
m,
|
|
7328
7390
|
y,
|
|
7329
|
-
|
|
7391
|
+
v
|
|
7330
7392
|
], this.mirrors = new Vt(this.workingAttributes);
|
|
7331
|
-
const S = G(d, "uint", e), R = G(f, "uint", e), k = G(g, "uint", e), M = G(w, "uint", e), x = G(r.sourceIndexAttribute, "uint", e),
|
|
7393
|
+
const S = G(d, "uint", e), R = G(f, "uint", e), k = G(g, "uint", e), M = G(w, "uint", e), x = G(r.sourceIndexAttribute, "uint", e), b = G(r.splatIndexAttribute, "float", e), A = s ? G(s, "vec4", e) : null, P = G(m, "uint", l).toAtomic(), U = G(y, "uint", h), L = G(v, "uint", c * Pt).toAtomic(), W = Y(() => {
|
|
7332
7394
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7333
7395
|
const E = x.element(_), T = t ? gt(
|
|
7334
7396
|
te(E).mod(te(n)),
|
|
@@ -7341,21 +7403,21 @@ class Gr {
|
|
|
7341
7403
|
S.element(_).assign(F.sub(this.depthMin).mul(this.depthScale).clamp(0, cr).toUint());
|
|
7342
7404
|
k.element(_).assign(E);
|
|
7343
7405
|
});
|
|
7344
|
-
})().compute(e, [
|
|
7406
|
+
})().compute(e, [ve]);
|
|
7345
7407
|
this.stages.push(W);
|
|
7346
7408
|
for (let E = 0; E < a; E++) {
|
|
7347
7409
|
const T = E % 2 === 0 ? S : R, O = E % 2 === 0 ? R : S, F = E % 2 === 0 ? k : M, $ = E % 2 === 0 ? M : k, N = C(E * un), X = Y(() => {
|
|
7348
7410
|
Ne(P.element(_), C(0));
|
|
7349
|
-
})().compute(l, [
|
|
7411
|
+
})().compute(l, [ve]), j = Y(() => {
|
|
7350
7412
|
const z = Gt.x.mul(C(Qt));
|
|
7351
7413
|
Fe(hn, ({ i: Z }) => {
|
|
7352
|
-
const q = z.add(C(Z).mul(C(
|
|
7414
|
+
const q = z.add(C(Z).mul(C(ve))).add(En);
|
|
7353
7415
|
se(D(q).lessThan(this.activeCount), () => {
|
|
7354
7416
|
const ee = T.element(q).shiftRight(N).bitAnd(C(15));
|
|
7355
7417
|
sn(P.element(ee.mul(C(c)).add(Gt.x)), C(1));
|
|
7356
7418
|
});
|
|
7357
7419
|
});
|
|
7358
|
-
})().compute(c *
|
|
7420
|
+
})().compute(c * ve, [ve]), K = Y(() => {
|
|
7359
7421
|
const z = _.mul(C(Et)), Z = C(0).toVar();
|
|
7360
7422
|
Fe(Et, ({ i: q }) => {
|
|
7361
7423
|
const ee = z.add(C(q));
|
|
@@ -7378,19 +7440,19 @@ class Gr {
|
|
|
7378
7440
|
P.element(_),
|
|
7379
7441
|
Ve(P.element(_)).add(U.element(z))
|
|
7380
7442
|
);
|
|
7381
|
-
})().compute(l, [
|
|
7443
|
+
})().compute(l, [ve]), J = ts("uint", ut), ce = Y(() => {
|
|
7382
7444
|
const z = En, Z = Gt.x, q = Z.mul(C(Pt));
|
|
7383
7445
|
se(z.lessThan(C(ut)), () => {
|
|
7384
7446
|
J.element(z).assign(C(0));
|
|
7385
7447
|
}), se(z.lessThan(C(Pt)), () => {
|
|
7386
7448
|
Ne(L.element(q.add(z)), C(0));
|
|
7387
7449
|
}), St(), xt(), Fe(hn, ({ i: ee }) => {
|
|
7388
|
-
const ie = Z.mul(C(Qt)).add(ee.toUint().mul(C(
|
|
7389
|
-
se(
|
|
7450
|
+
const ie = Z.mul(C(Qt)).add(ee.toUint().mul(C(ve))).add(z), be = D(ie).lessThan(this.activeCount), Ae = C(0).toVar(), Re = C(0).toVar(), ye = C(0).toVar();
|
|
7451
|
+
se(be, () => {
|
|
7390
7452
|
Ae.assign(T.element(ie)), Re.assign(F.element(ie)), ye.assign(Ae.shiftRight(N).bitAnd(C(15)));
|
|
7391
7453
|
const re = z.shiftRight(C(5)), de = z.bitAnd(C(31)), le = q.add(ye.mul(C(et))).add(re);
|
|
7392
7454
|
ns(L.element(le), C(1).shiftLeft(de));
|
|
7393
|
-
}), St(), xt(), se(
|
|
7455
|
+
}), St(), xt(), se(be, () => {
|
|
7394
7456
|
const re = z.shiftRight(C(5)), de = z.bitAnd(C(31)), le = q.add(ye.mul(C(et))), Ie = J.element(ye).toVar();
|
|
7395
7457
|
Fe(et, ({ i: Oe }) => {
|
|
7396
7458
|
se(C(Oe).lessThan(re), () => {
|
|
@@ -7413,7 +7475,7 @@ class Gr {
|
|
|
7413
7475
|
}), J.element(z).addAssign(re);
|
|
7414
7476
|
}), St(), xt();
|
|
7415
7477
|
});
|
|
7416
|
-
})().compute(c *
|
|
7478
|
+
})().compute(c * ve, [ve]);
|
|
7417
7479
|
this.stages.push(
|
|
7418
7480
|
X,
|
|
7419
7481
|
j,
|
|
@@ -7425,9 +7487,9 @@ class Gr {
|
|
|
7425
7487
|
}
|
|
7426
7488
|
const B = Y(() => {
|
|
7427
7489
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7428
|
-
|
|
7490
|
+
b.element(_).assign(D(k.element(_)));
|
|
7429
7491
|
});
|
|
7430
|
-
})().compute(e, [
|
|
7492
|
+
})().compute(e, [ve]);
|
|
7431
7493
|
this.stages.push(B);
|
|
7432
7494
|
}
|
|
7433
7495
|
sort(r, e, t) {
|
|
@@ -7534,13 +7596,13 @@ class Xi {
|
|
|
7534
7596
|
dataTextureWidth: l
|
|
7535
7597
|
} = r, h = r.sh ?? null, d = r.modifiers ?? [], f = r.channels ?? /* @__PURE__ */ new Map(), g = r.localCameraPosition ?? I(new p.Vector3());
|
|
7536
7598
|
this.workBuffer = r.workBuffer ?? new _t(e), this.capacity = this.workBuffer.capacity, this.centers = this.workBuffer.centers, this.colors = this.workBuffer.colors, this.covarianceA = this.workBuffer.covarianceA, this.covarianceB = this.workBuffer.covarianceB, this.isotropicMix = this.workBuffer.isotropicMix, this.isotropicScreenRadius = this.workBuffer.isotropicScreenRadius;
|
|
7537
|
-
const w = G(n, "uint", t), m = G(this.centers, "vec4", e), y = G(this.colors, "vec4", e),
|
|
7599
|
+
const w = G(n, "uint", t), m = G(this.centers, "vec4", e), y = G(this.colors, "vec4", e), v = G(this.covarianceA, "vec4", e), S = G(this.covarianceB, "vec4", e), R = G(this.isotropicMix, "float", e), k = G(this.isotropicScreenRadius, "float", e);
|
|
7538
7600
|
this.pass = Y(() => {
|
|
7539
7601
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7540
7602
|
const M = te(w.element(_)), x = gt(
|
|
7541
7603
|
M.mod(te(l)),
|
|
7542
7604
|
M.div(te(l))
|
|
7543
|
-
),
|
|
7605
|
+
), b = ne(s, x).xyz, A = _.add(this.targetOffset.toUint()), P = ne(a, x), U = ne(c, x), L = He(
|
|
7544
7606
|
V(P.x, P.y, P.z),
|
|
7545
7607
|
V(P.y, P.w, U.x),
|
|
7546
7608
|
V(P.z, U.x, U.y)
|
|
@@ -7550,18 +7612,18 @@ class Xi {
|
|
|
7550
7612
|
h,
|
|
7551
7613
|
{ covarianceBTexture: c },
|
|
7552
7614
|
x,
|
|
7553
|
-
|
|
7615
|
+
b.sub(g).normalize()
|
|
7554
7616
|
)
|
|
7555
7617
|
).clamp(0, 1),
|
|
7556
7618
|
W.a
|
|
7557
|
-
), E = this.sourceMatrix.mul(H(
|
|
7619
|
+
), E = this.sourceMatrix.mul(H(b, 1)).xyz, T = Rr(d, g, {
|
|
7558
7620
|
index: M,
|
|
7559
|
-
localCenter:
|
|
7621
|
+
localCenter: b,
|
|
7560
7622
|
color: B,
|
|
7561
7623
|
makeWorldCenter: () => E,
|
|
7562
7624
|
makeViewCenter: () => this.cameraViewMatrix.mul(H(E, 1)).xyz,
|
|
7563
7625
|
makeNormal: () => {
|
|
7564
|
-
const q = L.inverse(), ee = g.sub(
|
|
7626
|
+
const q = L.inverse(), ee = g.sub(b), ie = q.mul(q.mul(ee)).normalize();
|
|
7565
7627
|
return ie.mul(ie.dot(ee).sign());
|
|
7566
7628
|
},
|
|
7567
7629
|
makeChannel: (q) => {
|
|
@@ -7572,9 +7634,9 @@ class Xi {
|
|
|
7572
7634
|
);
|
|
7573
7635
|
return ne(ee.texture, x).r;
|
|
7574
7636
|
}
|
|
7575
|
-
}), O = T.offset === null ?
|
|
7637
|
+
}), O = T.offset === null ? b : b.add(T.offset), F = T.visible === null ? vr(!0) : T.visible, $ = this.sourceMatrix.mul(H(O, 1)).xyz;
|
|
7576
7638
|
m.element(A).assign(H($, F.select(D(1), D(0))));
|
|
7577
|
-
const N = r.srgbOutput ? T.color :
|
|
7639
|
+
const N = r.srgbOutput ? T.color : br(T.color, p.SRGBColorSpace), X = r.lodAlpha ? N.a.mul(2) : N.a;
|
|
7578
7640
|
y.element(A).assign(H(N.rgb, F.select(X.mul(this.opacity), D(0))));
|
|
7579
7641
|
const j = T.rotation === null ? L : T.rotation.mul(L).mul(T.rotation.transpose());
|
|
7580
7642
|
let K = j;
|
|
@@ -7588,7 +7650,7 @@ class Xi {
|
|
|
7588
7650
|
);
|
|
7589
7651
|
}
|
|
7590
7652
|
const ae = this.sourceMatrix.toMat3(), fe = ae.mul(K).mul(ae.transpose()), J = T.scaleSquared === null ? fe : fe.mul(T.scaleSquared), ce = J.mul(V(1, 0, 0)), z = J.mul(V(0, 1, 0)), Z = J.mul(V(0, 0, 1));
|
|
7591
|
-
|
|
7653
|
+
v.element(A).assign(H(ce.x, ce.y, ce.z, z.y)), S.element(A).assign(H(z.z, Z.z, 0, 0)), R.element(A).assign(T.isotropicCovarianceMix === null ? D(0) : T.isotropicCovarianceMix), k.element(A).assign(
|
|
7592
7654
|
T.isotropicCovarianceMix === null ? D(0) : T.isotropicScreenRadiusPx ?? D(0)
|
|
7593
7655
|
);
|
|
7594
7656
|
});
|
|
@@ -7636,19 +7698,19 @@ function lr(i) {
|
|
|
7636
7698
|
return r.vertexNode = Y(() => {
|
|
7637
7699
|
const g = t.element(_).toInt(), w = e.element(g), m = w.xyz, y = w.w.greaterThan(0.5);
|
|
7638
7700
|
l.assign(n.element(g));
|
|
7639
|
-
const
|
|
7701
|
+
const v = ht.mul(H(m, 1)).toVar(), S = yr.mul(v).toVar(), R = s.element(g), k = o.element(g), M = He(
|
|
7640
7702
|
V(R.x, R.y, R.z),
|
|
7641
7703
|
V(R.y, R.w, k.x),
|
|
7642
7704
|
V(R.z, k.x, k.y)
|
|
7643
|
-
), x = D(1).div(
|
|
7705
|
+
), x = D(1).div(v.z), b = x.mul(x), A = V(
|
|
7644
7706
|
i.focal.x.mul(x),
|
|
7645
7707
|
0,
|
|
7646
|
-
i.focal.x.negate().mul(
|
|
7708
|
+
i.focal.x.negate().mul(v.x).mul(b)
|
|
7647
7709
|
), P = V(
|
|
7648
7710
|
0,
|
|
7649
7711
|
i.focal.y.mul(x),
|
|
7650
|
-
i.focal.y.negate().mul(
|
|
7651
|
-
), U = ht.toMat3().transpose(), L = U.mul(A), W = U.mul(P), B = L.dot(M.mul(L)), E = W.dot(M.mul(W)), T = L.dot(M.mul(W)), O =
|
|
7712
|
+
i.focal.y.negate().mul(v.y).mul(b)
|
|
7713
|
+
), U = ht.toMat3().transpose(), L = U.mul(A), W = U.mul(P), B = L.dot(M.mul(L)), E = W.dot(M.mul(W)), T = L.dot(M.mul(W)), O = v.z.negate().max(1e-4), F = i.dofFocusDistance.max(1e-4), $ = i.dofAperture.max(0).mul(0.5).div(F).atan(), N = O.sub(F).abs().div(O), X = i.focal.x.mul($.tan()), j = N.mul(X), K = j.mul(j).min(D(fn)), ae = B.add(i.projectedLowPassVariance).add(K), fe = E.add(i.projectedLowPassVariance).add(K), J = T, ce = a.element(g), z = ae.mul(fe).sub(J.mul(J)).max(1e-9), Z = B.mul(E).sub(T.mul(T)).max(0), q = B.add(i.projectedLowPassVariance).mul(E.add(i.projectedLowPassVariance)).sub(T.mul(T)).max(1e-9), ee = Z.div(z).sqrt(), ie = q.div(z).sqrt(), be = i.antialias.max(i.compensateProjectedLowPass), Ae = xe(ie, ee, be);
|
|
7652
7714
|
d.assign(xe(Ae, D(1), ce));
|
|
7653
7715
|
const Re = ae.add(fe).mul(0.5), ye = he(ae.sub(fe).mul(0.5), J).length();
|
|
7654
7716
|
let re = Re.add(ye), de = Re.sub(ye).max(0);
|
|
@@ -7664,9 +7726,9 @@ function lr(i) {
|
|
|
7664
7726
|
re = Ie.lambda1, de = Ie.lambda2;
|
|
7665
7727
|
const Xe = l.a.mul(4).sub(3).min(5), Ye = l.a.greaterThan(1).select(i.maxStdDev.add(Xe.sub(1).mul(0.7)), i.maxStdDev);
|
|
7666
7728
|
f.assign(Ye);
|
|
7667
|
-
const Le = he(J, re.sub(ae)).add(he(1e-6, 0)).normalize(), Oe = i.minSplatSizePx,
|
|
7729
|
+
const Le = he(J, re.sub(ae)).add(he(1e-6, 0)).normalize(), Oe = i.minSplatSizePx, vt = Le.mul(re.sqrt().mul(Ye).min(1024).max(Oe)), bt = he(Le.y, Le.x.negate()).mul(
|
|
7668
7730
|
de.sqrt().mul(Ye).min(1024).max(Oe)
|
|
7669
|
-
), Ke =
|
|
7731
|
+
), Ke = vt.mul(nt.x).add(bt.mul(nt.y)), Ze = S.xy.div(S.w), st = H(
|
|
7670
7732
|
Ze.add(Ke.mul(2).div(i.viewport)),
|
|
7671
7733
|
S.z.div(S.w),
|
|
7672
7734
|
1
|
|
@@ -7675,7 +7737,7 @@ function lr(i) {
|
|
|
7675
7737
|
})(), r.fragmentNode = Y(() => {
|
|
7676
7738
|
const g = h.dot(h);
|
|
7677
7739
|
Lt(g.greaterThan(1));
|
|
7678
|
-
const w = g.mul(f.mul(f).mul(-0.5)).exp(), m = l.a.mul(4).sub(3).min(5), y = m.mul(m).sub(1).mul(1 / Math.E).exp(),
|
|
7740
|
+
const w = g.mul(f.mul(f).mul(-0.5)).exp(), m = l.a.mul(4).sub(3).min(5), y = m.mul(m).sub(1).mul(1 / Math.E).exp(), v = w.oneMinus().pow(y).oneMinus(), R = l.a.greaterThan(1).select(v, w.mul(l.a)).mul(d), k = Pe(i.relightMap, Ee), M = i.relightSoftness.div(i.viewport.x.max(1)), x = i.relightSoftness.div(i.viewport.y.max(1)), b = k, A = Pe(i.relightMap, Ee.add(he(M, 0))), P = Pe(i.relightMap, Ee.add(he(M.negate(), 0))), U = Pe(i.relightMap, Ee.add(he(0, x))), L = Pe(i.relightMap, Ee.add(he(0, x.negate()))), W = b.a.add(A.a).add(P.a).add(U.a).add(L.a).max(1e-4), B = b.rgb.mul(b.a).add(A.rgb.mul(A.a)).add(P.rgb.mul(P.a)).add(U.rgb.mul(U.a)).add(L.rgb.mul(L.a)).div(W), E = W.mul(0.2), T = H(B, E), O = i.relightSoftness.greaterThan(0.5).select(T, k), F = xe(
|
|
7679
7741
|
V(i.relightBackground),
|
|
7680
7742
|
O.rgb.mul(i.relightBrightness),
|
|
7681
7743
|
O.a
|
|
@@ -7741,7 +7803,7 @@ class Lo extends p.Mesh {
|
|
|
7741
7803
|
"UnifiedSplatRenderer requires a WebGPU backend (renderer.backend.isWebGPUBackend). On WebGL2 use standalone SplatMesh draws or static SplatScene."
|
|
7742
7804
|
);
|
|
7743
7805
|
ro(e, eo(t), t);
|
|
7744
|
-
const s = new _t(t), o = I(new p.Vector2()), a = I(new p.Vector2()), c = I(3), l = I(0), h = I(0), d = I(0.3), f = I(0), g = I(10), w = I(0), m = Wr(), y = I(0),
|
|
7806
|
+
const s = new _t(t), o = I(new p.Vector2()), a = I(new p.Vector2()), c = I(3), l = I(0), h = I(0), d = I(0.3), f = I(0), g = I(10), w = I(0), m = Wr(), y = I(0), v = I(mn), S = I(gn), R = I(wn), k = new p.StorageInstancedBufferAttribute(new Float32Array(t), 1), M = new p.InstancedBufferGeometry();
|
|
7745
7807
|
M.setIndex([0, 1, 2, 0, 2, 3]), M.setAttribute(
|
|
7746
7808
|
"position",
|
|
7747
7809
|
new p.BufferAttribute(new Float32Array([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]), 3)
|
|
@@ -7768,7 +7830,7 @@ class Lo extends p.Mesh {
|
|
|
7768
7830
|
dofAperture: w,
|
|
7769
7831
|
relightMap: m,
|
|
7770
7832
|
relightBlend: y,
|
|
7771
|
-
relightBrightness:
|
|
7833
|
+
relightBrightness: v,
|
|
7772
7834
|
relightBackground: S,
|
|
7773
7835
|
relightSoftness: R
|
|
7774
7836
|
})
|
|
@@ -7838,15 +7900,15 @@ class Lo extends p.Mesh {
|
|
|
7838
7900
|
u(this, "disposed", !1);
|
|
7839
7901
|
const x = new Uint32Array(t);
|
|
7840
7902
|
for (let A = 0; A < t; A++) x[A] = A;
|
|
7841
|
-
this.workBuffer = s, this.focal = o, this.viewport = a, this.maxStdDev = c, this.minSplatSizePx = l, this.antialias = h, this.projectedLowPassVariance = d, this.compensateProjectedLowPass = f, this.dofFocusDistance = g, this.dofAperture = w, this.relightPlaceholder = m, this.relightMap = m, this.relightBlend = y, this.relightBrightness =
|
|
7842
|
-
const
|
|
7903
|
+
this.workBuffer = s, this.focal = o, this.viewport = a, this.maxStdDev = c, this.minSplatSizePx = l, this.antialias = h, this.projectedLowPassVariance = d, this.compensateProjectedLowPass = f, this.dofFocusDistance = g, this.dofAperture = w, this.relightPlaceholder = m, this.relightMap = m, this.relightBlend = y, this.relightBrightness = v, this.relightBackground = S, this.relightSoftness = R, this.srgbOutput = n.srgbOutput ?? !1, this.sortScheduler = new Ur(void 0, as()), this.orderAttribute = k, this.workSourceIndex = new p.StorageBufferAttribute(x, 1), this.mirrors = new Vt([this.workSourceIndex, this.orderAttribute]), this.renderer = e;
|
|
7904
|
+
const b = {
|
|
7843
7905
|
renderer: e,
|
|
7844
7906
|
capacity: t,
|
|
7845
7907
|
centersBuffer: s.centers,
|
|
7846
7908
|
splatIndexAttribute: k,
|
|
7847
7909
|
sourceIndexAttribute: this.workSourceIndex
|
|
7848
7910
|
};
|
|
7849
|
-
this.sorter = n.sortStrategy === "exact" ? new Gr({ ...
|
|
7911
|
+
this.sorter = n.sortStrategy === "exact" ? new Gr({ ...b, exactDepth: !0 }) : new ft(b), this.frustumCulled = !1, this.matrixAutoUpdate = !1, this.matrix.identity(), this.matrixWorld.identity();
|
|
7850
7912
|
}
|
|
7851
7913
|
/** Fixed work-buffer splat capacity chosen at construction. */
|
|
7852
7914
|
get capacity() {
|
|
@@ -8057,79 +8119,79 @@ class Lo extends p.Mesh {
|
|
|
8057
8119
|
this.focal.value.set(h * c.x / 2, d * c.y / 2);
|
|
8058
8120
|
const f = this.candidateScratch;
|
|
8059
8121
|
f.length = 0;
|
|
8060
|
-
for (let
|
|
8061
|
-
const S = this.sources[
|
|
8062
|
-
S.source.update(e, this.renderer, { sort: !1 }), S.view = S.source.getUnifiedSourceView(), S.registrationOrder =
|
|
8122
|
+
for (let v = 0; v < this.sources.length; v++) {
|
|
8123
|
+
const S = this.sources[v];
|
|
8124
|
+
S.source.update(e, this.renderer, { sort: !1 }), S.view = S.source.getUnifiedSourceView(), S.registrationOrder = v, f.push(S);
|
|
8063
8125
|
}
|
|
8064
|
-
f.sort((
|
|
8126
|
+
f.sort((v, S) => S.priority - v.priority || v.registrationOrder - S.registrationOrder), this.overflowedSourceCount = 0, this.overflowedSplatCount = 0, this.bounds.makeEmpty();
|
|
8065
8127
|
const g = this.admittedScratch;
|
|
8066
8128
|
g.length = 0;
|
|
8067
8129
|
let w = 0;
|
|
8068
|
-
for (const
|
|
8069
|
-
const S =
|
|
8070
|
-
if (
|
|
8130
|
+
for (const v of f) {
|
|
8131
|
+
const S = v.view;
|
|
8132
|
+
if (v.graphRevision !== S.graphRevision) {
|
|
8071
8133
|
const R = this.createGather(S);
|
|
8072
|
-
|
|
8134
|
+
v.gather.dispose(), v.gather = R, v.graphRevision = S.graphRevision, v.lastGather = null;
|
|
8073
8135
|
}
|
|
8074
|
-
if (!
|
|
8075
|
-
|
|
8136
|
+
if (!v.visible) {
|
|
8137
|
+
v.lastGather = null;
|
|
8076
8138
|
continue;
|
|
8077
8139
|
}
|
|
8078
8140
|
if (S.activeCount === 0) {
|
|
8079
|
-
|
|
8141
|
+
v.lastGather = null;
|
|
8080
8142
|
continue;
|
|
8081
8143
|
}
|
|
8082
8144
|
if (w + S.activeCount > this.workBuffer.capacity) {
|
|
8083
|
-
this.overflowedSourceCount++, this.overflowedSplatCount += S.activeCount,
|
|
8145
|
+
this.overflowedSourceCount++, this.overflowedSplatCount += S.activeCount, v.lastGather = null;
|
|
8084
8146
|
continue;
|
|
8085
8147
|
}
|
|
8086
|
-
|
|
8148
|
+
v.offset = w, g.push(v), this.bounds.union(S.worldBounds), w += S.activeCount;
|
|
8087
8149
|
}
|
|
8088
8150
|
let m = !1;
|
|
8089
|
-
for (const
|
|
8090
|
-
const S =
|
|
8091
|
-
|
|
8151
|
+
for (const v of g) {
|
|
8152
|
+
const S = v.view, R = v.offset, k = this.previousLayoutBySource.get(v.source), M = k !== void 0 && k.offset === R && k.activeCount === S.activeCount, x = v.lastGather, b = x !== null && M && x.activeCount === S.activeCount && x.contentRevision === S.contentRevision && x.offset === R && x.opacity === v.opacity && x.matrixWorld.equals(S.matrixWorld);
|
|
8153
|
+
b && // SH depends on camera position, not orientation. A stationary camera
|
|
8092
8154
|
// can reuse the resolved colors instead of re-running a full-source
|
|
8093
8155
|
// gather every frame; camera motion invalidates only SH-bearing slices.
|
|
8094
|
-
(S.sh === null || x.localCameraPosition.equals(S.localCameraPosition.value)) && (S.modifiers.length === 0 ||
|
|
8156
|
+
(S.sh === null || x.localCameraPosition.equals(S.localCameraPosition.value)) && (S.modifiers.length === 0 || v.cacheModifiers) && // Belt-and-braces: a placed pool's splats move without its own
|
|
8095
8157
|
// `matrixWorld` changing, so a cached gather would go stale silently.
|
|
8096
8158
|
// `addSource` already rejects these.
|
|
8097
|
-
!S.hasSourcePlacement || (
|
|
8159
|
+
!S.hasSourcePlacement || (v.gather.gather(
|
|
8098
8160
|
this.renderer,
|
|
8099
8161
|
S.activeCount,
|
|
8100
8162
|
R,
|
|
8101
8163
|
S.matrixWorld,
|
|
8102
8164
|
a.matrixWorldInverse,
|
|
8103
|
-
|
|
8104
|
-
),
|
|
8165
|
+
v.opacity
|
|
8166
|
+
), b || (m = !0), v.lastGather === null ? v.lastGather = {
|
|
8105
8167
|
activeCount: S.activeCount,
|
|
8106
8168
|
contentRevision: S.contentRevision,
|
|
8107
8169
|
offset: R,
|
|
8108
|
-
opacity:
|
|
8170
|
+
opacity: v.opacity,
|
|
8109
8171
|
matrixWorld: S.matrixWorld.clone(),
|
|
8110
8172
|
localCameraPosition: S.localCameraPosition.value.clone()
|
|
8111
|
-
} : (
|
|
8173
|
+
} : (v.lastGather.activeCount = S.activeCount, v.lastGather.contentRevision = S.contentRevision, v.lastGather.offset = R, v.lastGather.opacity = v.opacity, v.lastGather.matrixWorld.copy(S.matrixWorld), v.lastGather.localCameraPosition.copy(S.localCameraPosition.value)));
|
|
8112
8174
|
}
|
|
8113
8175
|
let y = g.length !== this.previousLayout.length || w !== this.previousAdmittedTotal;
|
|
8114
8176
|
if (this.previousAdmittedTotal = w, !y)
|
|
8115
|
-
for (let
|
|
8116
|
-
const S = g[
|
|
8177
|
+
for (let v = 0; v < g.length; v++) {
|
|
8178
|
+
const S = g[v], R = this.previousLayout[v];
|
|
8117
8179
|
if (R.source !== S.source || R.offset !== S.offset || R.activeCount !== S.view.activeCount) {
|
|
8118
8180
|
y = !0;
|
|
8119
8181
|
break;
|
|
8120
8182
|
}
|
|
8121
8183
|
}
|
|
8122
8184
|
if (y) {
|
|
8123
|
-
this.previousLayout = g.map((
|
|
8124
|
-
source:
|
|
8125
|
-
offset:
|
|
8126
|
-
activeCount:
|
|
8185
|
+
this.previousLayout = g.map((v) => ({
|
|
8186
|
+
source: v.source,
|
|
8187
|
+
offset: v.offset,
|
|
8188
|
+
activeCount: v.view.activeCount
|
|
8127
8189
|
})), this.previousLayoutBySource.clear();
|
|
8128
|
-
for (const
|
|
8190
|
+
for (const v of this.previousLayout) this.previousLayoutBySource.set(v.source, v);
|
|
8129
8191
|
}
|
|
8130
8192
|
if ((m || y) && this.sortScheduler.invalidateContent(), w > 0) {
|
|
8131
|
-
const
|
|
8132
|
-
(n || this.sortScheduler.shouldSubmit(S, this.lastSortedModelView, w,
|
|
8193
|
+
const v = performance.now(), S = a.matrixWorldInverse;
|
|
8194
|
+
(n || this.sortScheduler.shouldSubmit(S, this.lastSortedModelView, w, v)) && this.sorter.sort(S, w, this.bounds) && (this.lastSortedModelView.copy(S), this.sortScheduler.markAccepted(v));
|
|
8133
8195
|
}
|
|
8134
8196
|
this.geometry.instanceCount = w, this.mirrors.settled || this.mirrors.release(this.renderer);
|
|
8135
8197
|
}
|
|
@@ -8831,28 +8893,28 @@ function Vo(i, r) {
|
|
|
8831
8893
|
throw new Error(
|
|
8832
8894
|
`createSelectionVolume: a box requires halfExtents with three positive components (got ${y ? `[${y.join(", ")}]` : "undefined"}).`
|
|
8833
8895
|
);
|
|
8834
|
-
const [
|
|
8896
|
+
const [v, S, R] = y;
|
|
8835
8897
|
return {
|
|
8836
|
-
containsPoint: (k, M, x) => Math.abs(n * k + a * M + h * x + g) <=
|
|
8898
|
+
containsPoint: (k, M, x) => Math.abs(n * k + a * M + h * x + g) <= v && Math.abs(s * k + c * M + d * x + w) <= S && Math.abs(o * k + l * M + f * x + m) <= R
|
|
8837
8899
|
};
|
|
8838
8900
|
}
|
|
8839
8901
|
case "sphere": {
|
|
8840
|
-
const y = nn(i.radius, "sphere", "radius"),
|
|
8902
|
+
const y = nn(i.radius, "sphere", "radius"), v = y * y;
|
|
8841
8903
|
return {
|
|
8842
8904
|
containsPoint: (S, R, k) => {
|
|
8843
|
-
const M = n * S + a * R + h * k + g, x = s * S + c * R + d * k + w,
|
|
8844
|
-
return M * M + x * x +
|
|
8905
|
+
const M = n * S + a * R + h * k + g, x = s * S + c * R + d * k + w, b = o * S + l * R + f * k + m;
|
|
8906
|
+
return M * M + x * x + b * b <= v;
|
|
8845
8907
|
}
|
|
8846
8908
|
};
|
|
8847
8909
|
}
|
|
8848
8910
|
case "cylinder": {
|
|
8849
|
-
const y = nn(i.radius, "cylinder", "radius"),
|
|
8911
|
+
const y = nn(i.radius, "cylinder", "radius"), v = nn(i.height, "cylinder", "height") / 2, S = y * y;
|
|
8850
8912
|
return {
|
|
8851
8913
|
containsPoint: (R, k, M) => {
|
|
8852
8914
|
const x = s * R + c * k + d * M + w;
|
|
8853
|
-
if (Math.abs(x) >
|
|
8854
|
-
const
|
|
8855
|
-
return
|
|
8915
|
+
if (Math.abs(x) > v) return !1;
|
|
8916
|
+
const b = n * R + a * k + h * M + g, A = o * R + l * k + f * M + m;
|
|
8917
|
+
return b * b + A * A <= S;
|
|
8856
8918
|
}
|
|
8857
8919
|
};
|
|
8858
8920
|
}
|
|
@@ -9018,7 +9080,7 @@ export {
|
|
|
9018
9080
|
Do as CameraBudgetGovernor,
|
|
9019
9081
|
Wo as ChunkCacheBudget,
|
|
9020
9082
|
_o as ChunkFetchScheduler,
|
|
9021
|
-
|
|
9083
|
+
bn as ChunkLoader,
|
|
9022
9084
|
Xs as DEFAULT_FOVEATION_DRAW_BUDGET,
|
|
9023
9085
|
ln as DEFAULT_FOVEATION_TARGET_PX,
|
|
9024
9086
|
gn as DEFAULT_RELIGHT_BACKGROUND,
|
|
@@ -9041,8 +9103,8 @@ export {
|
|
|
9041
9103
|
Zi as WEBGPU_DEFAULT_MAX_STORAGE_BUFFER_BINDING_SIZE,
|
|
9042
9104
|
Ki as WORK_BUFFER_BYTES_PER_SLOT,
|
|
9043
9105
|
Yi as WORK_BUFFER_CENTERS_BYTES_PER_SPLAT,
|
|
9044
|
-
|
|
9045
|
-
|
|
9106
|
+
bs as apertureAngleFromSize,
|
|
9107
|
+
vs as assertPoolRowsFitDevice,
|
|
9046
9108
|
ro as assertStorageBufferFitsDevice,
|
|
9047
9109
|
kr as clampDepthOfFieldSettings,
|
|
9048
9110
|
_r as clampRelightingSettings,
|
|
@@ -9050,7 +9112,7 @@ export {
|
|
|
9050
9112
|
To as computeDofCocVariancePx2,
|
|
9051
9113
|
Po as computeDofOpacityFade,
|
|
9052
9114
|
No as countInData,
|
|
9053
|
-
|
|
9115
|
+
vi as createLocalDataset,
|
|
9054
9116
|
Wr as createPlaceholderRelightTexture,
|
|
9055
9117
|
Vo as createSelectionVolume,
|
|
9056
9118
|
Uo as createSplatRenderer,
|