@voluma/vlam 0.2.0 → 0.2.2
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 +9 -1
- package/dist/formats/lcc.js +320 -292
- package/dist/formats/lcc.js.map +1 -1
- package/dist/formats/rad.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +528 -493
- package/dist/index.js.map +1 -1
- package/dist/lod-source.d.ts +7 -0
- package/dist/{splat-budget-PSojLJPO.js → splat-budget-DXew_86c.js} +64 -57
- package/dist/splat-budget-DXew_86c.js.map +1 -0
- package/dist/splat-budget.d.ts +24 -4
- package/dist/{splat-mesh-types-8QDjTbZO.js → splat-mesh-types-CTN_duw2.js} +2 -2
- package/dist/{splat-mesh-types-8QDjTbZO.js.map → splat-mesh-types-CTN_duw2.js.map} +1 -1
- package/dist/streamed-splat-mesh.d.ts +40 -25
- package/package.json +1 -1
- package/dist/splat-budget-PSojLJPO.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var Hr = Object.defineProperty;
|
|
2
2
|
var Xr = (i, r, e) => r in i ? Hr(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
3
|
var u = (i, r, e) => Xr(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { r as rn, M as wr, L as Yr, a as
|
|
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 br, mat3 as
|
|
7
|
+
import { bool as br, 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 vr, 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
|
-
import { d as rs, r as ss, a as tt, b as is, l as os, i as as } from "./splat-budget-
|
|
11
|
-
import {
|
|
12
|
-
import { e as
|
|
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";
|
|
11
|
+
import { A as Ho, c as Xo, e as Yo, p as Ko, f as Zo, g as Qo, h as Jo, s as ea } from "./splat-budget-DXew_86c.js";
|
|
12
|
+
import { e as qt } from "./half-float-Cs4FDq8Q.js";
|
|
13
13
|
import { a as cs, r as ls, n as us, s as Sr } from "./sh-pack-D5wAe5gg.js";
|
|
14
|
-
import { S as dt, t as on, r as xr, s as Ar, b as hs, c as
|
|
14
|
+
import { S as dt, t as on, r as xr, s as Ar, b as hs, c as ze, d as ds, e as fs, i as At, a as Rt } from "./loading-wLo8vRbA.js";
|
|
15
15
|
function ps() {
|
|
16
16
|
return new p.Matrix4().makeRotationX(Math.PI);
|
|
17
17
|
}
|
|
@@ -47,11 +47,11 @@ function Rr(i, r, e) {
|
|
|
47
47
|
color: e.color,
|
|
48
48
|
offset: V(0, 0, 0),
|
|
49
49
|
scale: D(1),
|
|
50
|
-
rotation:
|
|
50
|
+
rotation: He(V(1, 0, 0), V(0, 1, 0), V(0, 0, 1)),
|
|
51
51
|
visible: br(!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
|
-
const f = /* @__PURE__ */ new Map(),
|
|
54
|
+
const f = /* @__PURE__ */ new Map(), g = {
|
|
55
55
|
index: e.index,
|
|
56
56
|
localCenter: e.localCenter,
|
|
57
57
|
sourceCenter: e.sourceCenter ?? e.localCenter,
|
|
@@ -67,9 +67,9 @@ function Rr(i, r, e) {
|
|
|
67
67
|
get normal() {
|
|
68
68
|
return d ?? (d = e.makeNormal());
|
|
69
69
|
},
|
|
70
|
-
channel(
|
|
71
|
-
let
|
|
72
|
-
return
|
|
70
|
+
channel(w) {
|
|
71
|
+
let m = f.get(w);
|
|
72
|
+
return m || (m = e.makeChannel(w), f.set(w, m)), m;
|
|
73
73
|
},
|
|
74
74
|
get color() {
|
|
75
75
|
return n.color;
|
|
@@ -87,9 +87,9 @@ function Rr(i, r, e) {
|
|
|
87
87
|
return n.visible;
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
for (const
|
|
91
|
-
const
|
|
92
|
-
|
|
90
|
+
for (const w of i) {
|
|
91
|
+
const m = w(g);
|
|
92
|
+
m.color && (n.color = m.color), m.offset && (n.offset = m.offset, s.offset = !0), m.scale && (n.scale = m.scale, s.scale = !0), m.rotation && (n.rotation = m.rotation, s.rotation = !0), m.visible && (n.visible = m.visible, s.visible = !0), m.isotropicCovarianceMix !== void 0 && (o = m.isotropicCovarianceMix), m.isotropicVarianceScale !== void 0 && (a = m.isotropicVarianceScale), m.isotropicScreenRadiusPx !== void 0 && (c = m.isotropicScreenRadiusPx);
|
|
93
93
|
}
|
|
94
94
|
return {
|
|
95
95
|
color: n.color,
|
|
@@ -336,7 +336,7 @@ function bs(i, r, e = wt) {
|
|
|
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.`
|
|
337
337
|
);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function jt(i, r, e) {
|
|
340
340
|
let t = r, n = r + e;
|
|
341
341
|
const s = [];
|
|
342
342
|
for (const o of i.updateRanges) {
|
|
@@ -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,
|
|
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(), b = w.length(), S = m.length(), R = y.greaterThanEqual(b).and(y.greaterThanEqual(S)), k = b.greaterThan(y).and(b.greaterThanEqual(S)), M = R.select(g, k.select(w, m)), x = M.div(M.length().max(1e-12)), v = x.dot(i.mul(x)), P = h.min(d).min(f).min(v).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) {
|
|
@@ -393,7 +393,7 @@ function Ln() {
|
|
|
393
393
|
return I(new p.Vector3());
|
|
394
394
|
}
|
|
395
395
|
function Br(i, r, e) {
|
|
396
|
-
const t = r.mul(te(4)), n = i.element(t), s = i.element(t.add(te(1))), o = i.element(t.add(te(2))), a = i.element(t.add(te(3))), c = n.xyz.mul(e.x).add(s.xyz.mul(e.y)).add(o.xyz.mul(e.z)).add(a.xyz), l =
|
|
396
|
+
const t = r.mul(te(4)), n = i.element(t), s = i.element(t.add(te(1))), o = i.element(t.add(te(2))), a = i.element(t.add(te(3))), c = n.xyz.mul(e.x).add(s.xyz.mul(e.y)).add(o.xyz.mul(e.z)).add(a.xyz), l = He(n.xyz, s.xyz, o.xyz);
|
|
397
397
|
return { worldCenter: c, linear: l };
|
|
398
398
|
}
|
|
399
399
|
function cn(i) {
|
|
@@ -438,21 +438,21 @@ function Ss(i, r, e, t) {
|
|
|
438
438
|
return i.bands === 2 ? f : f.add(a(8).mul(s.mul(l.mul(3).sub(h)).mul(ge[0]))).add(a(9).mul(n.mul(s).mul(o).mul(ge[1]))).add(a(10).mul(s.mul(d.mul(4).sub(l).sub(h)).mul(ge[2]))).add(a(11).mul(o.mul(d.mul(2).sub(l.mul(3)).sub(h.mul(3))).mul(ge[3]))).add(a(12).mul(n.mul(d.mul(4).sub(l).sub(h)).mul(ge[4]))).add(a(13).mul(o.mul(l.sub(h)).mul(ge[5]))).add(a(14).mul(n.mul(l.sub(h.mul(3))).mul(ge[6])));
|
|
439
439
|
}
|
|
440
440
|
function Dn(i, r, e) {
|
|
441
|
-
const { textures: t, sh: n, uniforms: s, settings: o, pick: a } = e, c = te(wt), l = D(Fn), h = -0.5 * o.maxStdDev * o.maxStdDev, d = Qr("splatIndex", "float").toInt(), f = gt(d.mod(c), d.div(c)),
|
|
442
|
-
|
|
443
|
-
ne(
|
|
444
|
-
|
|
445
|
-
) : null, b = y ? y.worldCenter :
|
|
446
|
-
const B = y ? y.linear.inverse().mul(b.sub(s.localCameraPosition)).normalize() : b.sub(s.localCameraPosition).normalize(), E = B.x, T = B.y,
|
|
441
|
+
const { textures: t, sh: n, uniforms: s, settings: o, pick: a } = e, c = te(wt), l = D(Fn), h = -0.5 * o.maxStdDev * o.maxStdDev, d = Qr("splatIndex", "float").toInt(), f = gt(d.mod(c), d.div(c)), g = ne(t.colorsTexture, f), w = ne(t.centersTexture, f).xyz, m = e.sourcePlacement, y = m ? Br(
|
|
442
|
+
m.columns,
|
|
443
|
+
ne(m.sourceIdTexture, f).r.toInt(),
|
|
444
|
+
w
|
|
445
|
+
) : null, b = y ? y.worldCenter : w, S = n === null ? null : (() => {
|
|
446
|
+
const B = y ? y.linear.inverse().mul(b.sub(s.localCameraPosition)).normalize() : b.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
|
-
const N = E.mul(E), X = T.mul(T), j =
|
|
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(
|
|
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
|
+
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(
|
|
450
450
|
F(11).mul(
|
|
451
|
-
|
|
451
|
+
O.mul(j.mul(2).sub(N.mul(3)).sub(X.mul(3))).mul(ge[3])
|
|
452
452
|
)
|
|
453
|
-
).add(F(12).mul(E.mul(j.mul(4).sub(N).sub(X)).mul(ge[4]))).add(F(13).mul(
|
|
454
|
-
})(), R = S === null ?
|
|
455
|
-
const B = ne(t.covarianceATexture, f), E = ne(t.covarianceBTexture, f), T =
|
|
453
|
+
).add(F(12).mul(E.mul(j.mul(4).sub(N).sub(X)).mul(ge[4]))).add(F(13).mul(O.mul(N.sub(X)).mul(ge[5]))).add(F(14).mul(E.mul(N.sub(X.mul(3))).mul(ge[6])));
|
|
454
|
+
})(), R = S === null ? g : H(g.rgb.add(S).clamp(0, 1), g.a), k = () => {
|
|
455
|
+
const B = ne(t.covarianceATexture, f), E = ne(t.covarianceBTexture, f), T = He(
|
|
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))
|
|
@@ -468,7 +468,7 @@ function Dn(i, r, e) {
|
|
|
468
468
|
}, x = Rr(e.modifiers, s.localCameraPosition, {
|
|
469
469
|
index: d,
|
|
470
470
|
localCenter: b,
|
|
471
|
-
sourceCenter:
|
|
471
|
+
sourceCenter: w,
|
|
472
472
|
sourceToLocal: y == null ? void 0 : y.linear,
|
|
473
473
|
color: R,
|
|
474
474
|
makeNormal: k,
|
|
@@ -477,10 +477,10 @@ function Dn(i, r, e) {
|
|
|
477
477
|
o.srgbOutput ? x.color : vr(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 ? b : b.add(x.offset), E = ht.mul(H(B, 1)).toVar(), T = yr.mul(E).toVar(),
|
|
480
|
+
const B = x.offset === null ? b : b.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
|
-
const j = ne(t.covarianceATexture, f), K = ne(t.covarianceBTexture, f), ae =
|
|
483
|
+
const j = ne(t.covarianceATexture, f), K = ne(t.covarianceBTexture, f), ae = He(
|
|
484
484
|
V(j.x, j.y, j.z),
|
|
485
485
|
V(j.y, j.w, K.x),
|
|
486
486
|
V(j.z, K.x, K.y)
|
|
@@ -495,38 +495,38 @@ function Dn(i, r, e) {
|
|
|
495
495
|
oe
|
|
496
496
|
);
|
|
497
497
|
}
|
|
498
|
-
const ce = D(1).div(E.z),
|
|
498
|
+
const ce = D(1).div(E.z), z = ce.mul(ce), Z = V(
|
|
499
499
|
s.focal.x.mul(ce),
|
|
500
500
|
0,
|
|
501
|
-
s.focal.x.negate().mul(E.x).mul(
|
|
501
|
+
s.focal.x.negate().mul(E.x).mul(z)
|
|
502
502
|
), q = V(
|
|
503
503
|
0,
|
|
504
504
|
s.focal.y.mul(ce),
|
|
505
|
-
s.focal.y.negate().mul(E.y).mul(
|
|
506
|
-
), ee = ht.toMat3().transpose(), ie = ee.mul(Z), ve = ee.mul(q), Ae = ie.dot(J.mul(ie)), Re = ve.dot(J.mul(ve)), ye = ie.dot(J.mul(ve)), re = x.scaleSquared === null ? Ae : Ae.mul(x.scaleSquared),
|
|
505
|
+
s.focal.y.negate().mul(E.y).mul(z)
|
|
506
|
+
), ee = ht.toMat3().transpose(), ie = ee.mul(Z), ve = ee.mul(q), Ae = ie.dot(J.mul(ie)), Re = ve.dot(J.mul(ve)), ye = ie.dot(J.mul(ve)), 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()), bt = Le.mul(Oe), vt = bt.mul(bt).min(D(fn)), Ke = o.projectedFilterProfile === "lcc" ? 0.1 : 0.3, Ze = re.add(Ke).add(vt), st = de.add(Ke).add(vt), 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
|
);
|
|
510
|
-
const An =
|
|
511
|
-
let Ue = An.add(Rn),
|
|
510
|
+
const An = Ze.add(st).mul(0.5), Rn = he(Ze.sub(st).mul(0.5), De).length();
|
|
511
|
+
let Ue = An.add(Rn), Qe = An.sub(Rn).max(0);
|
|
512
512
|
if (x.isotropicCovarianceMix !== null) {
|
|
513
513
|
const oe = Pr(
|
|
514
514
|
Ue,
|
|
515
|
-
|
|
515
|
+
Qe,
|
|
516
516
|
x.isotropicCovarianceMix
|
|
517
517
|
);
|
|
518
|
-
if (Ue = oe.lambda1,
|
|
518
|
+
if (Ue = oe.lambda1, Qe = oe.lambda2, x.isotropicScreenRadiusPx !== null) {
|
|
519
519
|
const we = Er(
|
|
520
520
|
Ue,
|
|
521
|
-
|
|
521
|
+
Qe,
|
|
522
522
|
x.isotropicCovarianceMix,
|
|
523
523
|
x.isotropicScreenRadiusPx,
|
|
524
524
|
D(o.maxStdDev)
|
|
525
525
|
);
|
|
526
|
-
Ue = we.lambda1,
|
|
526
|
+
Ue = we.lambda1, Qe = we.lambda2;
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
const
|
|
529
|
+
const zt = he(De, Ue.sub(Ze)).add(he(1e-6, 0)).normalize();
|
|
530
530
|
let yt = D(o.maxStdDev);
|
|
531
531
|
if (o.lodAlpha && L && W) {
|
|
532
532
|
const oe = x.color.a.mul(2), we = oe.mul(4).sub(3).min(5);
|
|
@@ -535,13 +535,13 @@ function Dn(i, r, e) {
|
|
|
535
535
|
D(o.maxStdDev)
|
|
536
536
|
), L.assign(yt), W.assign(oe);
|
|
537
537
|
}
|
|
538
|
-
const $r = o.maxAspect && o.maxAspect > 0 ? Ue.min(
|
|
538
|
+
const $r = o.maxAspect && o.maxAspect > 0 ? Ue.min(Qe.mul(o.maxAspect * o.maxAspect)) : Ue, Mn = D(o.minSplatSizePx ?? 0), kn = zt.mul(
|
|
539
539
|
$r.sqrt().mul(yt).min(l).max(Mn)
|
|
540
|
-
), Cn =
|
|
541
|
-
|
|
540
|
+
), Cn = he(zt.y, zt.x.negate()).mul(
|
|
541
|
+
Qe.sqrt().mul(yt).min(l).max(Mn)
|
|
542
542
|
), Ot = () => {
|
|
543
543
|
const oe = kn.mul(nt.x).add(Cn.mul(nt.y)), we = T.xy.div(T.w);
|
|
544
|
-
|
|
544
|
+
O.assign(
|
|
545
545
|
H(
|
|
546
546
|
we.add(oe.mul(2).div(s.viewport)),
|
|
547
547
|
T.z.div(T.w),
|
|
@@ -568,18 +568,18 @@ function Dn(i, r, e) {
|
|
|
568
568
|
const oe = kn.length(), we = Cn.length(), $e = x.color.a, Se = $e.greaterThanEqual(1 / 255).and(oe.max(we).mul(2).greaterThanEqual(2)).and($e.mul(oe).mul(we).greaterThanEqual(3)), qe = x.isotropicCovarianceMix === null ? Se : Se.or(x.isotropicCovarianceMix.greaterThan(0));
|
|
569
569
|
se(Ge ? qe.and(Ge) : qe, Ot);
|
|
570
570
|
} else Ge ? se(Ge, Ot) : Ot();
|
|
571
|
-
}),
|
|
571
|
+
}), O;
|
|
572
572
|
})(), r === "display")
|
|
573
573
|
i.fragmentNode = Y(() => {
|
|
574
574
|
const B = A.dot(A);
|
|
575
|
-
|
|
575
|
+
Lt(B.greaterThan(1));
|
|
576
576
|
let E;
|
|
577
577
|
if (o.lodAlpha && L && W) {
|
|
578
578
|
const ie = B.mul(L.mul(L).mul(-0.5)).exp(), ve = W.mul(4).sub(3).min(5), Ae = ve.mul(ve).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
581
|
E = B.mul(h).exp().mul(v.a);
|
|
582
|
-
const T = E.mul(U),
|
|
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
|
|
@@ -591,9 +591,9 @@ function Dn(i, r, e) {
|
|
|
591
591
|
throw new Error("applySplatMaterialGraph in 'pick' mode requires pick uniforms.");
|
|
592
592
|
i.fragmentNode = Y(() => {
|
|
593
593
|
const B = A.dot(A);
|
|
594
|
-
|
|
594
|
+
Lt(B.greaterThan(1));
|
|
595
595
|
const T = B.mul(h).exp().mul(v.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);
|
|
599
599
|
})(), i.transparent = !1, i.depthTest = !0, i.depthWrite = !0, i.side = p.DoubleSide, i.blending = p.NoBlending, i.toneMapped = !1;
|
|
@@ -613,7 +613,7 @@ function As(i) {
|
|
|
613
613
|
const t = r.constructor;
|
|
614
614
|
return i.array = new t(0), e;
|
|
615
615
|
}
|
|
616
|
-
class
|
|
616
|
+
class Vt {
|
|
617
617
|
constructor(r) {
|
|
618
618
|
u(this, "pending");
|
|
619
619
|
/** Released attributes and the `version` they carried when released. */
|
|
@@ -712,20 +712,20 @@ const Ce = class Ce {
|
|
|
712
712
|
), f = new p.StorageBufferAttribute(
|
|
713
713
|
new Uint32Array(c / l / l),
|
|
714
714
|
1
|
|
715
|
-
),
|
|
715
|
+
), g = new p.StorageBufferAttribute(new Uint32Array(t), 1);
|
|
716
716
|
this.workingAttributes = [
|
|
717
717
|
h,
|
|
718
718
|
d,
|
|
719
719
|
f,
|
|
720
|
-
|
|
721
|
-
], this.mirrors = new
|
|
722
|
-
const
|
|
720
|
+
g
|
|
721
|
+
], this.mirrors = new Vt(this.workingAttributes);
|
|
722
|
+
const w = G(h, "uint", c).toAtomic(), m = G(d, "uint", c / l), y = G(
|
|
723
723
|
f,
|
|
724
724
|
"uint",
|
|
725
725
|
c / l / l
|
|
726
|
-
), b = G(
|
|
726
|
+
), b = 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
|
-
Ne(
|
|
728
|
+
Ne(w.element(_), C(0));
|
|
729
729
|
})().compute(c, [l]), this.histogramPass = Y(() => {
|
|
730
730
|
se(D(_).lessThan(this.activeCount), () => {
|
|
731
731
|
const x = te(S.element(_)), v = n ? gt(
|
|
@@ -736,18 +736,18 @@ const Ce = class Ce {
|
|
|
736
736
|
te(ne(a.sourceIdTexture, v).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
|
-
b.element(_).assign(L), sn(
|
|
739
|
+
b.element(_).assign(L), sn(w.element(L), C(1));
|
|
740
740
|
});
|
|
741
741
|
})().compute(t, [l]), this.scanBlocksPass = Y(() => {
|
|
742
742
|
const x = _.mul(C(l)).toVar(), v = C(0).toVar();
|
|
743
743
|
Fe(l, ({ i: A }) => {
|
|
744
|
-
const P =
|
|
744
|
+
const P = w.element(x.add(C(A))), U = Ve(P).toVar();
|
|
745
745
|
Ne(P, v), v.addAssign(U);
|
|
746
|
-
}),
|
|
746
|
+
}), m.element(_).assign(v);
|
|
747
747
|
})().compute(c / l, [64]), this.scanBlockSumsPass = Y(() => {
|
|
748
748
|
const x = _.mul(C(l)).toVar(), v = C(0).toVar();
|
|
749
749
|
Fe(l, ({ i: A }) => {
|
|
750
|
-
const P =
|
|
750
|
+
const P = m.element(x.add(C(A))), U = P.toVar();
|
|
751
751
|
P.assign(v), v.addAssign(U);
|
|
752
752
|
}), y.element(_).assign(v);
|
|
753
753
|
})().compute(c / l / l, [64]);
|
|
@@ -761,13 +761,13 @@ const Ce = class Ce {
|
|
|
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 =
|
|
766
|
+
const x = w.element(_), v = m.element(_.shiftRight(C(Math.log2(l))));
|
|
767
767
|
Ne(x, Ve(x).add(v));
|
|
768
768
|
})().compute(c, [l]), this.scatterPass = Y(() => {
|
|
769
769
|
se(D(_).lessThan(this.activeCount), () => {
|
|
770
|
-
const x = S.element(_), v = b.element(_), A = sn(
|
|
770
|
+
const x = S.element(_), v = b.element(_), A = sn(w.element(v), C(1));
|
|
771
771
|
R.element(A).assign(D(x));
|
|
772
772
|
});
|
|
773
773
|
})().compute(t, [l]), this.sortPasses = [
|
|
@@ -812,7 +812,7 @@ const Ce = class Ce {
|
|
|
812
812
|
if (!this.disposed) {
|
|
813
813
|
this.disposed = !0;
|
|
814
814
|
for (const r of this.sortPasses) r.dispose();
|
|
815
|
-
|
|
815
|
+
Nt(this.renderer, this.workingAttributes);
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
};
|
|
@@ -822,7 +822,7 @@ u(Ce, "BUCKET_COUNT", 1 << 22), u(Ce, "BLOCK_SIZE", 256), /**
|
|
|
822
822
|
*/
|
|
823
823
|
u(Ce, "MIN_BUCKET_COUNT", 65536);
|
|
824
824
|
let ft = Ce;
|
|
825
|
-
function
|
|
825
|
+
function Nt(i, r) {
|
|
826
826
|
const e = i._attributes;
|
|
827
827
|
if (e)
|
|
828
828
|
for (const t of r) e.delete(t);
|
|
@@ -1063,7 +1063,7 @@ function Ds(i, r, e, t, n) {
|
|
|
1063
1063
|
const s = e / -Wn.z;
|
|
1064
1064
|
return n.copy(it.ray.origin).addScaledVector(it.ray.direction, s), { point: n, distance: n.distanceTo(it.ray.origin) };
|
|
1065
1065
|
}
|
|
1066
|
-
const
|
|
1066
|
+
const Ht = new p.Vector2();
|
|
1067
1067
|
function pn(i, r) {
|
|
1068
1068
|
var c;
|
|
1069
1069
|
const e = r.xr;
|
|
@@ -1073,7 +1073,7 @@ function pn(i, r) {
|
|
|
1073
1073
|
if (!n) return null;
|
|
1074
1074
|
const s = n.viewport;
|
|
1075
1075
|
let o = (s == null ? void 0 : s.z) ?? 0, a = (s == null ? void 0 : s.w) ?? 0;
|
|
1076
|
-
return (!(o > 0) || !(a > 0)) && (r.getDrawingBufferSize(
|
|
1076
|
+
return (!(o > 0) || !(a > 0)) && (r.getDrawingBufferSize(Ht), o = Ht.x, a = Ht.y), { head: t, eye: n, width: o, height: a };
|
|
1077
1077
|
}
|
|
1078
1078
|
function Us(i) {
|
|
1079
1079
|
return i.isArrayCamera === !0;
|
|
@@ -1142,17 +1142,17 @@ class _s {
|
|
|
1142
1142
|
this.ensureResources(e);
|
|
1143
1143
|
const l = this.target, h = this.proxy, d = this.pickCamera;
|
|
1144
1144
|
this.cropCameraToPixel(d, e, s, o, a, c), this.host.setView(d, 1, 1);
|
|
1145
|
-
const f = "near" in e && typeof e.near == "number" ? e.near : 0.1,
|
|
1146
|
-
this.near.value = f, this.far.value =
|
|
1147
|
-
const
|
|
1145
|
+
const f = "near" in e && typeof e.near == "number" ? e.near : 0.1, g = "far" in e && typeof e.far == "number" ? e.far : 1e3;
|
|
1146
|
+
this.near.value = f, this.far.value = g, this.alphaThreshold.value = (n == null ? void 0 : n.alphaThreshold) !== void 0 ? n.alphaThreshold : 0.1;
|
|
1147
|
+
const w = this.host.mesh, m = t.getRenderTarget(), y = t.getScissorTest();
|
|
1148
1148
|
t.getClearColor(this.savedClearColor);
|
|
1149
1149
|
const b = t.getClearAlpha(), S = t.autoClear;
|
|
1150
|
-
h.matrix.copy(
|
|
1150
|
+
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
1151
|
const R = (() => {
|
|
1152
1152
|
try {
|
|
1153
1153
|
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
1154
|
} finally {
|
|
1155
|
-
this.host.setView(e, s, o), t.setRenderTarget(
|
|
1155
|
+
this.host.setView(e, s, o), t.setRenderTarget(m), t.setScissorTest(y), t.setClearColor(this.savedClearColor, b), t.autoClear = S;
|
|
1156
1156
|
}
|
|
1157
1157
|
})();
|
|
1158
1158
|
let k;
|
|
@@ -1165,7 +1165,7 @@ class _s {
|
|
|
1165
1165
|
if (this.host.isDisposed()) return null;
|
|
1166
1166
|
const M = k[0], x = k[1], v = k[2];
|
|
1167
1167
|
if (k[3] === 0) return null;
|
|
1168
|
-
const P = Ls(Fs(M, x, v), f,
|
|
1168
|
+
const P = Ls(Fs(M, x, v), f, g), { point: U, distance: L } = Ds(r.x, r.y, P, e, this.point);
|
|
1169
1169
|
return { point: U.clone(), distance: L };
|
|
1170
1170
|
}
|
|
1171
1171
|
ensureResources(r) {
|
|
@@ -1207,7 +1207,7 @@ function Wr() {
|
|
|
1207
1207
|
return r.needsUpdate = !0, r.magFilter = p.NearestFilter, r.minFilter = p.NearestFilter, r.generateMipmaps = !1, r;
|
|
1208
1208
|
}
|
|
1209
1209
|
const Vs = 1024, Ns = 1 << 21;
|
|
1210
|
-
class
|
|
1210
|
+
class zs {
|
|
1211
1211
|
/**
|
|
1212
1212
|
* @param centers - The pool's CPU centers (stride 4: x,y,z,_ per splat).
|
|
1213
1213
|
* @param poolIndices - The pool indices to index (e.g. the active list).
|
|
@@ -1232,10 +1232,10 @@ class Os {
|
|
|
1232
1232
|
return;
|
|
1233
1233
|
}
|
|
1234
1234
|
const n = [1 / 0, 1 / 0, 1 / 0], s = [-1 / 0, -1 / 0, -1 / 0];
|
|
1235
|
-
for (let
|
|
1236
|
-
const
|
|
1235
|
+
for (let w = 0; w < t; w++) {
|
|
1236
|
+
const m = e[w] * 4;
|
|
1237
1237
|
for (let y = 0; y < 3; y++) {
|
|
1238
|
-
const b = r[
|
|
1238
|
+
const b = r[m + y];
|
|
1239
1239
|
b < n[y] && (n[y] = b), b > s[y] && (s[y] = b);
|
|
1240
1240
|
}
|
|
1241
1241
|
}
|
|
@@ -1243,25 +1243,25 @@ class Os {
|
|
|
1243
1243
|
s[0] - n[0],
|
|
1244
1244
|
s[1] - n[1],
|
|
1245
1245
|
s[2] - n[2]
|
|
1246
|
-
], a = o.filter((
|
|
1246
|
+
], a = o.filter((w) => w > 0), c = a.reduce((w, m) => w * m, 1);
|
|
1247
1247
|
let l = a.length > 0 ? Math.pow(c / t, 1 / a.length) : 1;
|
|
1248
1248
|
(!(l > 0) || !Number.isFinite(l)) && (l = 1);
|
|
1249
|
-
const h = (
|
|
1250
|
-
for (let
|
|
1251
|
-
const y = o[
|
|
1252
|
-
this.dims[
|
|
1249
|
+
const h = (w) => {
|
|
1250
|
+
for (let m = 0; m < 3; m++) {
|
|
1251
|
+
const y = o[m];
|
|
1252
|
+
this.dims[m] = y > 0 ? Math.max(1, Math.min(Vs, Math.round(y / w) || 1)) : 1, this.cellSize[m] = this.dims[m] > 0 && y / this.dims[m] || 1, this.min[m] = n[m];
|
|
1253
1253
|
}
|
|
1254
1254
|
};
|
|
1255
1255
|
for (h(l); this.dims[0] * this.dims[1] * this.dims[2] > Ns; )
|
|
1256
1256
|
l *= 1.5, h(l);
|
|
1257
1257
|
const d = this.dims[0] * this.dims[1] * this.dims[2], f = new Int32Array(d + 1);
|
|
1258
|
-
for (let
|
|
1259
|
-
for (let
|
|
1258
|
+
for (let w = 0; w < t; w++) f[this.cellOf(e[w]) + 1]++;
|
|
1259
|
+
for (let w = 0; w < d; w++) f[w + 1] += f[w];
|
|
1260
1260
|
this.cellStart = f, this.items = new Uint32Array(t);
|
|
1261
|
-
const
|
|
1262
|
-
for (let
|
|
1263
|
-
const
|
|
1264
|
-
this.items[
|
|
1261
|
+
const g = Int32Array.from(f.subarray(0, d));
|
|
1262
|
+
for (let w = 0; w < t; w++) {
|
|
1263
|
+
const m = e[w];
|
|
1264
|
+
this.items[g[this.cellOf(m)]++] = m;
|
|
1265
1265
|
}
|
|
1266
1266
|
}
|
|
1267
1267
|
/** The cell index of pool splat `p`, clamped into range. */
|
|
@@ -1288,9 +1288,9 @@ class Os {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
for (let h = a[2]; h <= c[2]; h++)
|
|
1290
1290
|
for (let d = a[1]; d <= c[1]; d++) {
|
|
1291
|
-
const f = (h * this.dims[1] + d) * this.dims[0],
|
|
1292
|
-
for (let
|
|
1293
|
-
const y = this.items[
|
|
1291
|
+
const f = (h * this.dims[1] + d) * this.dims[0], g = this.cellStart[f + a[0]], w = this.cellStart[f + c[0] + 1];
|
|
1292
|
+
for (let m = g; m < w; m++) {
|
|
1293
|
+
const y = this.items[m], b = y * 4, S = this.centers[b] - r, R = this.centers[b + 1] - e, k = this.centers[b + 2] - t, M = S * S + R * R + k * k;
|
|
1294
1294
|
M <= o && s(y, M);
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
@@ -1306,22 +1306,22 @@ class Os {
|
|
|
1306
1306
|
}), s < 0 ? null : { poolIndex: s, distSq: o };
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
|
-
const
|
|
1309
|
+
const Os = 4, Q = class Q extends p.Mesh {
|
|
1310
1310
|
constructor(e, t = {}) {
|
|
1311
1311
|
var L, W;
|
|
1312
|
-
const n = Dr(t.sortIntervalMs), s = ((L = rs()) == null ? void 0 : L.isMobile) === !0, o =
|
|
1312
|
+
const n = Dr(t.sortIntervalMs), s = ((L = rs()) == null ? void 0 : L.isMobile) === !0, o = On(t.maxStdDev) ?? 3, a = js(t.minSplatSizePx) ?? (s ? 1.5 : 0), c = !("capacity" in e), l = c ? e.count : e.capacity;
|
|
1313
1313
|
if (l <= 0) throw new Error("SplatMesh capacity must be positive.");
|
|
1314
|
-
const h = (t.shBands ?? (rn(t.performanceProfile) === "smooth" ? 0 : wr)) !== 0, d = c ? h ? ((W = e.shPacked) == null ? void 0 : W.bands) ?? 0 : 0 : t.shBands ?? 0, f = t.pool,
|
|
1314
|
+
const h = (t.shBands ?? (rn(t.performanceProfile) === "smooth" ? 0 : wr)) !== 0, d = c ? h ? ((W = e.shPacked) == null ? void 0 : W.bands) ?? 0 : 0 : t.shBands ?? 0, f = t.pool, g = () => new ms({
|
|
1315
1315
|
capacity: l,
|
|
1316
1316
|
floatTextures: t.poolFloatTextures,
|
|
1317
1317
|
packedShBands: d,
|
|
1318
1318
|
packedShTextureCount: d === 0 ? 0 : Math.ceil(cn(d) / 4),
|
|
1319
1319
|
...t.maxTextureSize === void 0 ? {} : { maxTextureSize: t.maxTextureSize }
|
|
1320
|
-
}),
|
|
1321
|
-
|
|
1320
|
+
}), w = f !== void 0 && d !== f.packedShBands;
|
|
1321
|
+
w && me(
|
|
1322
1322
|
`a mesh with shBands ${d} cannot share a pool built for ${f == null ? void 0 : f.packedShBands}; it allocated its own pool instead.`
|
|
1323
1323
|
);
|
|
1324
|
-
const
|
|
1324
|
+
const m = f === void 0 || w, y = m ? g() : f, b = Math.min(
|
|
1325
1325
|
y.capacity,
|
|
1326
1326
|
Math.ceil(l / Q.DATA_TEXTURE_WIDTH) * Q.DATA_TEXTURE_WIDTH
|
|
1327
1327
|
), S = y.centersTexture, R = y.colorsTexture, k = y.covarianceATexture, M = y.covarianceBTexture, x = c && e.sh && h ? lt(
|
|
@@ -1547,7 +1547,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1547
1547
|
u(this, "orientation");
|
|
1548
1548
|
/** Set once the pool has been checked against the device texture limit. */
|
|
1549
1549
|
u(this, "textureLimitChecked", !1);
|
|
1550
|
-
if (this.pool = y, this.ownsPool =
|
|
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(b), 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]), v.length > 0 && (this.dataTextures = [...this.dataTextures, ...v]), this.materialInputs = {
|
|
1551
1551
|
textures: { centersTexture: S, colorsTexture: R, covarianceATexture: k, covarianceBTexture: M },
|
|
1552
1552
|
sh: c && e.sh && x ? { mode: "palette", bands: e.sh.bands, paletteTexture: x } : d !== 0 ? {
|
|
1553
1553
|
mode: "packed",
|
|
@@ -1640,7 +1640,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1640
1640
|
* graph, same convention as {@link setPerformanceProfile}.
|
|
1641
1641
|
*/
|
|
1642
1642
|
setMaxStdDev(e) {
|
|
1643
|
-
const t =
|
|
1643
|
+
const t = On(e);
|
|
1644
1644
|
t === void 0 || t === this.maxStdDevValue || (this.maxStdDevValue = t, this.cachedUnifiedView = null, this.buildMaterial(this.materialInputs.textures, this.materialInputs.sh));
|
|
1645
1645
|
}
|
|
1646
1646
|
/**
|
|
@@ -1684,7 +1684,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1684
1684
|
const o = s.start + n;
|
|
1685
1685
|
this.writeSplatRows(o, t);
|
|
1686
1686
|
const a = Q.DATA_TEXTURE_WIDTH, c = Math.floor(o / a), l = Math.floor((o + t.count - 1) / a);
|
|
1687
|
-
this.markRowsWritten(c, l - c + 1),
|
|
1687
|
+
this.markRowsWritten(c, l - c + 1), Je.setFromArray(t.positions), this.localBounds.union(Je), this.boundsDirty = !0;
|
|
1688
1688
|
}
|
|
1689
1689
|
/**
|
|
1690
1690
|
* Overwrites splats at `offset` within a range **in place** - unlike
|
|
@@ -1703,7 +1703,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1703
1703
|
const o = s.start + n;
|
|
1704
1704
|
this.writeSplatRows(o, t);
|
|
1705
1705
|
const a = Q.DATA_TEXTURE_WIDTH, c = Math.floor(o / a), l = Math.floor((o + t.count - 1) / a);
|
|
1706
|
-
this.markRowsWritten(c, l - c + 1),
|
|
1706
|
+
this.markRowsWritten(c, l - c + 1), Je.setFromArray(t.positions), this.localBounds.union(Je), this.boundsDirty = !0, this.contentRevision++;
|
|
1707
1707
|
}
|
|
1708
1708
|
/**
|
|
1709
1709
|
* Zeros splats `[offset, offset + count)` of a range so they draw nothing
|
|
@@ -1718,8 +1718,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1718
1718
|
throw new RangeError("SplatMesh.degenerateRange: range out of bounds.");
|
|
1719
1719
|
const o = s.start + t, { centers: a, colors: c, covarianceA: l, covarianceB: h } = this.backing;
|
|
1720
1720
|
a.fill(0, o * 4, (o + n) * 4), c.fill(0, o * 4, (o + n) * 4), l.fill(0, o * 4, (o + n) * 4), h.fill(0, o * 4, (o + n) * 4);
|
|
1721
|
-
const d = Q.DATA_TEXTURE_WIDTH, f = Math.floor(o / d),
|
|
1722
|
-
this.markRowsWritten(f,
|
|
1721
|
+
const d = Q.DATA_TEXTURE_WIDTH, f = Math.floor(o / d), g = Math.floor((o + n - 1) / d);
|
|
1722
|
+
this.markRowsWritten(f, g - f + 1), this.contentRevision++;
|
|
1723
1723
|
}
|
|
1724
1724
|
/**
|
|
1725
1725
|
* Copies one chunk's splats into the pool's backing arrays at `destination`.
|
|
@@ -1730,9 +1730,9 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1730
1730
|
const { centers: n, colors: s, covarianceA: o, covarianceB: a } = this.backing;
|
|
1731
1731
|
s.set(t.colors, e * 4);
|
|
1732
1732
|
const c = t.count, l = t.positions, h = t.covariances, d = this.shEnabled && t.sh ? t.sh.labels : null, f = t.frontierParent ?? null;
|
|
1733
|
-
for (let
|
|
1734
|
-
const
|
|
1735
|
-
n[
|
|
1733
|
+
for (let g = 0; g < c; g++) {
|
|
1734
|
+
const w = (e + g) * 4, m = g * 3, y = g * 6;
|
|
1735
|
+
n[w + 0] = l[m + 0], n[w + 1] = l[m + 1], n[w + 2] = l[m + 2], o[w + 0] = h[y + 0], o[w + 1] = h[y + 1], o[w + 2] = h[y + 2], o[w + 3] = h[y + 3], a[w + 0] = h[y + 4], a[w + 1] = h[y + 5], a[w + 2] = d ? d[g] : 0, a[w + 3] = f ? f[g] : 0;
|
|
1736
1736
|
}
|
|
1737
1737
|
this.writePackedSh(e, t);
|
|
1738
1738
|
}
|
|
@@ -1872,7 +1872,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1872
1872
|
this.ranges.set(c, l), this.markRowsWritten(o, s);
|
|
1873
1873
|
for (const h of this.channels.values())
|
|
1874
1874
|
h.backing.fill(h.fill, a, a + s * n), h.pendingRows.push({ start: o, count: s });
|
|
1875
|
-
return
|
|
1875
|
+
return Je.setFromArray(e.positions), this.localBounds.union(Je), this.boundsDirty = !0, t && this.activateRecord(l), this.contentRevision++, c;
|
|
1876
1876
|
}
|
|
1877
1877
|
/**
|
|
1878
1878
|
* Deactivates a previously appended range and frees its pool rows for
|
|
@@ -2289,8 +2289,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2289
2289
|
this.splatWorldPosition(d, Me);
|
|
2290
2290
|
const f = e.y - Me.y;
|
|
2291
2291
|
if (f < 0 || f > t) return;
|
|
2292
|
-
const
|
|
2293
|
-
|
|
2292
|
+
const g = Me.x - e.x, w = Me.z - e.z;
|
|
2293
|
+
g * g + w * w > a || Me.y > c && (c = Me.y, l = d);
|
|
2294
2294
|
}), l < 0) return null;
|
|
2295
2295
|
const h = this.splatWorldPosition(l, new p.Vector3());
|
|
2296
2296
|
return { point: h, drop: e.y - h.y };
|
|
@@ -2340,7 +2340,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2340
2340
|
ensureQueryGrid() {
|
|
2341
2341
|
if (this.queryGrid && this.queryGridEpoch === this.queryEpoch) return this.queryGrid;
|
|
2342
2342
|
const e = this.sourceIndexAttribute.array.subarray(0, this.activeCount);
|
|
2343
|
-
return this.queryGrid = new
|
|
2343
|
+
return this.queryGrid = new zs(this.backing.centers, e, this.activeCount), this.queryGridEpoch = this.queryEpoch, this.queryGrid;
|
|
2344
2344
|
}
|
|
2345
2345
|
/** World-space position of pool splat `poolIndex`, written into `out`. */
|
|
2346
2346
|
splatWorldPosition(e, t) {
|
|
@@ -2378,7 +2378,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2378
2378
|
this.channels.clear();
|
|
2379
2379
|
for (const t of this.uploadStaging.values())
|
|
2380
2380
|
for (const n of t.values()) n.dispose();
|
|
2381
|
-
this.uploadStaging.clear(), this.halfEncodeBuffers.clear(), this.lastRenderer && (
|
|
2381
|
+
this.uploadStaging.clear(), this.halfEncodeBuffers.clear(), this.lastRenderer && (Nt(this.lastRenderer, [this.sourceIndexAttribute]), this.lastRenderer = null), this.pendingUploadRows = [], this.workerDirtyRows = [], this.queryGrid = null, this.ranges.clear();
|
|
2382
2382
|
}
|
|
2383
2383
|
}
|
|
2384
2384
|
/** Matches the viewport / focal / local-camera uniforms written by {@link update}. */
|
|
@@ -2427,8 +2427,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2427
2427
|
const o = this.foveationLimitPx / s;
|
|
2428
2428
|
e.getWorldPosition(ot), this.worldToLocal(ot), Vn.copy(e.matrixWorld).invert(), Nn.multiplyMatrices(Vn, this.matrixWorld).premultiply(e.projectionMatrix);
|
|
2429
2429
|
const a = Nn.elements, { covarianceA: c, covarianceB: l, centers: h } = this.backing, d = l.length / 4;
|
|
2430
|
-
let f = 0,
|
|
2431
|
-
for (let y = 0; y < d; y +=
|
|
2430
|
+
let f = 0, g = 0;
|
|
2431
|
+
for (let y = 0; y < d; y += zn) {
|
|
2432
2432
|
const b = y * 4, S = l[b + 3];
|
|
2433
2433
|
if (S === 0) continue;
|
|
2434
2434
|
f++;
|
|
@@ -2438,12 +2438,12 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2438
2438
|
if (P > v || P < -v) continue;
|
|
2439
2439
|
const U = a[1] * R + a[5] * k + a[9] * M + a[13];
|
|
2440
2440
|
if (U > v || U < -v) continue;
|
|
2441
|
-
const L = c[b] + c[b + 3] + l[b + 1], W = 2 * Math.sqrt(Math.max(L, 0) / 3), B = S < 0, E = Math.abs(S), T = R - ot.x,
|
|
2442
|
-
E > $ && N <= $ &&
|
|
2441
|
+
const L = c[b] + c[b + 3] + l[b + 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
|
+
E > $ && N <= $ && g++;
|
|
2443
2443
|
}
|
|
2444
2444
|
if (f === 0) return;
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2445
|
+
const w = g * zn, m = this.foveationDrawBudget;
|
|
2446
|
+
w > m * 1.1 ? this.foveationLimitPx = Math.min(this.foveationLimitPx * 1.15, qs) : w < m * 0.7 && (this.foveationLimitPx = Math.max(this.foveationLimitPx / 1.12, this.foveationTargetPx));
|
|
2447
2447
|
}
|
|
2448
2448
|
/** Records a written row span for GPU upload and the sort-worker mirror. */
|
|
2449
2449
|
markRowsWritten(e, t) {
|
|
@@ -2505,9 +2505,9 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2505
2505
|
/** Uploads only the changed packed slots and invalidates the current depth order. */
|
|
2506
2506
|
commitActiveListMutation(e, t) {
|
|
2507
2507
|
var n;
|
|
2508
|
-
if (t > 0 && (
|
|
2508
|
+
if (t > 0 && (jt(this.sourceIndexAttribute, e, t), this.sourceIndexAttribute.needsUpdate = !0), ((n = this.sorter) == null ? void 0 : n.kind) === "worker" || this.sorter === null) {
|
|
2509
2509
|
const s = this.sourceIndexAttribute.array, o = this.splatIndexAttribute.array;
|
|
2510
|
-
this.drawListSorted ? (o.set(s.subarray(0, this.activeCount)), this.activeCount > 0 &&
|
|
2510
|
+
this.drawListSorted ? (o.set(s.subarray(0, this.activeCount)), this.activeCount > 0 && jt(this.splatIndexAttribute, 0, this.activeCount), this.splatIndexAttribute.needsUpdate = !0, this.drawListSorted = !1) : t > 0 && (o.set(s.subarray(e, e + t), e), jt(this.splatIndexAttribute, e, t), this.splatIndexAttribute.needsUpdate = !0);
|
|
2511
2511
|
}
|
|
2512
2512
|
this.geometry.instanceCount = this.activeCount, this.activeListVersion++, this.sortScheduler.invalidateContent();
|
|
2513
2513
|
}
|
|
@@ -2592,7 +2592,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2592
2592
|
*/
|
|
2593
2593
|
syncHalfFloatPoolImages() {
|
|
2594
2594
|
const e = this.dataTextures[0], t = this.dataTextures[2], n = e.image.data, s = t.image.data;
|
|
2595
|
-
|
|
2595
|
+
qt(this.backing.centers, n), qt(this.backing.covarianceA, s), e.needsUpdate = !0, t.needsUpdate = !0;
|
|
2596
2596
|
}
|
|
2597
2597
|
/**
|
|
2598
2598
|
* Uploads the given row spans of one or more same-layout pool textures via
|
|
@@ -2607,15 +2607,15 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2607
2607
|
d && h.start <= d.start + d.count ? d.count = Math.max(d.count, h.start + h.count - d.start) : l.push({ start: h.start, count: h.count });
|
|
2608
2608
|
}
|
|
2609
2609
|
for (const h of l)
|
|
2610
|
-
for (const { key: d, texture: f, data:
|
|
2611
|
-
const y =
|
|
2610
|
+
for (const { key: d, texture: f, data: g, type: w, encodeHalf: m } of o) {
|
|
2611
|
+
const y = g.subarray(
|
|
2612
2612
|
h.start * a * s,
|
|
2613
2613
|
(h.start + h.count) * a * s
|
|
2614
2614
|
);
|
|
2615
2615
|
let b = y;
|
|
2616
|
-
if (
|
|
2616
|
+
if (m) {
|
|
2617
2617
|
const R = this.acquireHalfEncodeBuffer(d, y.length);
|
|
2618
|
-
|
|
2618
|
+
qt(y, R, 0, y.length), b = R;
|
|
2619
2619
|
}
|
|
2620
2620
|
const S = this.acquireUploadStaging(
|
|
2621
2621
|
d,
|
|
@@ -2623,7 +2623,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2623
2623
|
a,
|
|
2624
2624
|
h.count,
|
|
2625
2625
|
n,
|
|
2626
|
-
|
|
2626
|
+
w
|
|
2627
2627
|
);
|
|
2628
2628
|
e.copyTextureToTexture(S, f, null, Gs.set(0, h.start));
|
|
2629
2629
|
}
|
|
@@ -2649,7 +2649,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2649
2649
|
if (l)
|
|
2650
2650
|
return l.image = { data: t, width: n, height: s }, l.needsUpdate = !0, c.delete(s), c.set(s, l), l;
|
|
2651
2651
|
const h = new p.DataTexture(t, n, s, o, a);
|
|
2652
|
-
if (o === p.RGBAIntegerFormat && (h.magFilter = p.NearestFilter, h.minFilter = p.NearestFilter), h.needsUpdate = !0, c.set(s, h), c.size >
|
|
2652
|
+
if (o === p.RGBAIntegerFormat && (h.magFilter = p.NearestFilter, h.minFilter = p.NearestFilter), h.needsUpdate = !0, c.set(s, h), c.size > Os) {
|
|
2653
2653
|
const f = c.keys().next().value;
|
|
2654
2654
|
(d = c.get(f)) == null || d.dispose(), c.delete(f);
|
|
2655
2655
|
}
|
|
@@ -2807,8 +2807,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2807
2807
|
};
|
|
2808
2808
|
u(Q, "DATA_TEXTURE_WIDTH", wt);
|
|
2809
2809
|
let pt = Q;
|
|
2810
|
-
const
|
|
2811
|
-
function
|
|
2810
|
+
const Je = new p.Box3(), Gs = new p.Vector2(), pe = new p.Vector3(), Me = new p.Vector3(), Mt = new p.Vector3(), ke = new p.Vector2(), ot = new p.Vector3(), Vn = new p.Matrix4(), Nn = new p.Matrix4(), $s = 180, zn = 31, qs = 64;
|
|
2811
|
+
function On(i) {
|
|
2812
2812
|
if (i !== void 0 && (!Number.isFinite(i) || i <= 0))
|
|
2813
2813
|
throw new RangeError("SplatMesh maxStdDev must be a finite number greater than 0.");
|
|
2814
2814
|
return i;
|
|
@@ -2818,7 +2818,7 @@ function js(i) {
|
|
|
2818
2818
|
throw new RangeError("SplatMesh minSplatSizePx must be a finite number >= 0.");
|
|
2819
2819
|
return i;
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function Xt(i) {
|
|
2822
2822
|
if (i === void 0) return 0;
|
|
2823
2823
|
if (!Number.isFinite(i) || i < 0)
|
|
2824
2824
|
throw new RangeError("SplatMesh screen-radius cull must be a finite number ≥ 0.");
|
|
@@ -2849,59 +2849,60 @@ function Zs(i) {
|
|
|
2849
2849
|
})).sort((r, e) => r.leafStart - e.leafStart);
|
|
2850
2850
|
}
|
|
2851
2851
|
function Qs(i, r) {
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
return h || (h = { adds: [], removes: [] }, o.set(l, h)), h;
|
|
2852
|
+
const e = [...i, ...r.map(([, s]) => s.run)];
|
|
2853
|
+
if (e.length > 0 && e.every((s) => s.coverageGroup !== void 0)) {
|
|
2854
|
+
const s = /* @__PURE__ */ new Map(), o = (c) => {
|
|
2855
|
+
let l = s.get(c);
|
|
2856
|
+
return l || (l = { adds: [], removes: [] }, s.set(c, l)), l;
|
|
2858
2857
|
};
|
|
2859
|
-
for (const
|
|
2860
|
-
|
|
2861
|
-
for (const
|
|
2862
|
-
|
|
2863
|
-
const
|
|
2864
|
-
for (const
|
|
2865
|
-
const
|
|
2866
|
-
const w =
|
|
2867
|
-
let
|
|
2868
|
-
return
|
|
2858
|
+
for (const c of i)
|
|
2859
|
+
o(c.coverageGroup).adds.push(c);
|
|
2860
|
+
for (const c of r)
|
|
2861
|
+
o(c[1].run.coverageGroup).removes.push(c);
|
|
2862
|
+
const a = [];
|
|
2863
|
+
for (const c of s.values()) {
|
|
2864
|
+
const l = /* @__PURE__ */ new Map(), h = (f, g) => `${f}:${g}`, d = (f, g) => {
|
|
2865
|
+
const w = h(f, g);
|
|
2866
|
+
let m = l.get(w);
|
|
2867
|
+
return m || (m = { adds: [], removes: [], leafStart: f, leafEnd: g, addCount: 0 }, l.set(w, m)), m;
|
|
2869
2868
|
};
|
|
2870
|
-
for (const
|
|
2871
|
-
const g = f
|
|
2872
|
-
g.adds.push(
|
|
2869
|
+
for (const f of c.adds) {
|
|
2870
|
+
const g = d(f.leafStart, f.leafEnd);
|
|
2871
|
+
g.adds.push(f), g.addCount += f.count;
|
|
2873
2872
|
}
|
|
2874
|
-
for (const
|
|
2875
|
-
const g =
|
|
2876
|
-
w.removes.push(
|
|
2873
|
+
for (const f of c.removes) {
|
|
2874
|
+
const g = f[1].run, w = d(g.leafStart, g.leafEnd);
|
|
2875
|
+
w.removes.push(f), w.leafStart = Math.min(w.leafStart, g.leafStart), w.leafEnd = Math.max(w.leafEnd, g.leafEnd);
|
|
2877
2876
|
}
|
|
2878
|
-
|
|
2877
|
+
a.push(...l.values());
|
|
2879
2878
|
}
|
|
2880
|
-
return
|
|
2879
|
+
return a.sort((c, l) => c.leafStart - l.leafStart);
|
|
2881
2880
|
}
|
|
2882
2881
|
const t = [
|
|
2883
|
-
...i.map((
|
|
2884
|
-
start:
|
|
2885
|
-
end:
|
|
2886
|
-
add:
|
|
2882
|
+
...i.map((s) => ({
|
|
2883
|
+
start: s.leafStart,
|
|
2884
|
+
end: s.leafEnd,
|
|
2885
|
+
add: s,
|
|
2887
2886
|
remove: void 0
|
|
2888
2887
|
})),
|
|
2889
|
-
...r.map((
|
|
2890
|
-
start:
|
|
2891
|
-
end:
|
|
2888
|
+
...r.map((s) => ({
|
|
2889
|
+
start: s[1].run.leafStart,
|
|
2890
|
+
end: s[1].run.leafEnd,
|
|
2892
2891
|
add: void 0,
|
|
2893
|
-
remove:
|
|
2892
|
+
remove: s
|
|
2894
2893
|
}))
|
|
2895
|
-
].sort((
|
|
2896
|
-
for (const
|
|
2897
|
-
const
|
|
2898
|
-
|
|
2899
|
-
adds:
|
|
2900
|
-
removes:
|
|
2901
|
-
leafStart:
|
|
2902
|
-
leafEnd:
|
|
2903
|
-
addCount:
|
|
2894
|
+
].sort((s, o) => s.start - o.start || o.end - s.end), n = [];
|
|
2895
|
+
for (const s of t) {
|
|
2896
|
+
const o = n[n.length - 1];
|
|
2897
|
+
(!o || s.start >= o.leafEnd) && n.push({
|
|
2898
|
+
adds: [],
|
|
2899
|
+
removes: [],
|
|
2900
|
+
leafStart: s.start,
|
|
2901
|
+
leafEnd: s.end,
|
|
2902
|
+
addCount: 0
|
|
2904
2903
|
});
|
|
2904
|
+
const a = n[n.length - 1];
|
|
2905
|
+
a.leafEnd = Math.max(a.leafEnd, s.end), s.add && (a.adds.push(s.add), a.addCount += s.add.count), s.remove && a.removes.push(s.remove);
|
|
2905
2906
|
}
|
|
2906
2907
|
return n;
|
|
2907
2908
|
}
|
|
@@ -2989,7 +2990,7 @@ function ii(i, r, e = 2) {
|
|
|
2989
2990
|
function qn(i, r, e, t) {
|
|
2990
2991
|
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);
|
|
2991
2992
|
if (!h) {
|
|
2992
|
-
const
|
|
2993
|
+
const w = mt(
|
|
2993
2994
|
{ phase: e, coverageGroup: a, leafStart: t.leafStart, leafEnd: t.leafEnd },
|
|
2994
2995
|
r
|
|
2995
2996
|
);
|
|
@@ -3008,14 +3009,14 @@ function qn(i, r, e, t) {
|
|
|
3008
3009
|
groupInView: o,
|
|
3009
3010
|
groupScreenImportance: c,
|
|
3010
3011
|
groupFinest: e === "finest-target",
|
|
3011
|
-
groupId:
|
|
3012
|
+
groupId: w,
|
|
3012
3013
|
// Provisional; finalized in stampClassicFetchGroups().
|
|
3013
3014
|
groupClass: 2
|
|
3014
3015
|
});
|
|
3015
3016
|
return;
|
|
3016
3017
|
}
|
|
3017
|
-
const d = $n(e) < $n(h.phase), f = e === h.phase && (n < h.distance || n === h.distance && s < h.level),
|
|
3018
|
-
(d || f ||
|
|
3018
|
+
const d = $n(e) < $n(h.phase), f = e === h.phase && (n < h.distance || n === h.distance && s < h.level), g = e === h.phase && n === h.distance && s === h.level && o && !h.inView;
|
|
3019
|
+
(d || f || g) && i.set(r, {
|
|
3019
3020
|
kind: l,
|
|
3020
3021
|
phase: e,
|
|
3021
3022
|
distance: n,
|
|
@@ -3034,11 +3035,11 @@ function qn(i, r, e, t) {
|
|
|
3034
3035
|
groupClass: h.groupClass
|
|
3035
3036
|
});
|
|
3036
3037
|
}
|
|
3037
|
-
function
|
|
3038
|
-
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,
|
|
3039
|
-
return h - d ||
|
|
3038
|
+
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 = (b) => b === "coverage" ? 0 : b === "background" ? 2 : 1;
|
|
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;
|
|
3040
3041
|
}
|
|
3041
|
-
function
|
|
3042
|
+
function Kt(i, r, e) {
|
|
3042
3043
|
if (r < 0 || e < 0 || r + e > i.count)
|
|
3043
3044
|
throw new Error(
|
|
3044
3045
|
`Splat range [${r}, ${r + e}) exceeds its chunk's ${i.count} splats; the manifest and chunk data disagree.`
|
|
@@ -3251,7 +3252,7 @@ const wi = [
|
|
|
3251
3252
|
function bi(i) {
|
|
3252
3253
|
const r = [];
|
|
3253
3254
|
for (const a of i.keys()) {
|
|
3254
|
-
const c =
|
|
3255
|
+
const c = Dt(a).toLowerCase(), l = wi.find((h) => h.test(c));
|
|
3255
3256
|
l && Vr(a) === vi(i, l) && r.push({ path: a, format: l.format });
|
|
3256
3257
|
}
|
|
3257
3258
|
if (r.length === 0)
|
|
@@ -3260,7 +3261,7 @@ function bi(i) {
|
|
|
3260
3261
|
{ phase: "manifest", url: "local-folder", retryable: !1 }
|
|
3261
3262
|
);
|
|
3262
3263
|
if (r.length > 1) {
|
|
3263
|
-
const a = r.map((c) =>
|
|
3264
|
+
const a = r.map((c) => Dt(c.path)).join(", ");
|
|
3264
3265
|
throw new dt(
|
|
3265
3266
|
`That folder holds more than one scene manifest (${a}) - drop one scene at a time.`,
|
|
3266
3267
|
{ phase: "manifest", url: "local-folder", retryable: !1 }
|
|
@@ -3276,13 +3277,13 @@ function bi(i) {
|
|
|
3276
3277
|
};
|
|
3277
3278
|
return { source: {
|
|
3278
3279
|
manifestUrl: s(e.path),
|
|
3279
|
-
resolve: (a) => s(t +
|
|
3280
|
+
resolve: (a) => s(t + Zt(a)),
|
|
3280
3281
|
size: (a) => {
|
|
3281
3282
|
var c;
|
|
3282
|
-
return Promise.resolve(((c = i.get(t +
|
|
3283
|
+
return Promise.resolve(((c = i.get(t + Zt(a))) == null ? void 0 : c.size) ?? null);
|
|
3283
3284
|
},
|
|
3284
3285
|
directoryFiles: (a) => {
|
|
3285
|
-
const c = t +
|
|
3286
|
+
const c = t + Zt(a).replace(/\/?$/, "/"), l = {};
|
|
3286
3287
|
for (const h of i.keys()) {
|
|
3287
3288
|
if (!h.startsWith(c)) continue;
|
|
3288
3289
|
const d = s(h);
|
|
@@ -3294,12 +3295,12 @@ function bi(i) {
|
|
|
3294
3295
|
for (const a of n.values()) URL.revokeObjectURL(a);
|
|
3295
3296
|
n.clear();
|
|
3296
3297
|
}
|
|
3297
|
-
}, format: e.format, name:
|
|
3298
|
+
}, format: e.format, name: Dt(e.path) };
|
|
3298
3299
|
}
|
|
3299
|
-
function
|
|
3300
|
+
function Zt(i) {
|
|
3300
3301
|
return i.replace(/^\.?\//, "");
|
|
3301
3302
|
}
|
|
3302
|
-
function
|
|
3303
|
+
function Dt(i) {
|
|
3303
3304
|
return i.slice(i.lastIndexOf("/") + 1);
|
|
3304
3305
|
}
|
|
3305
3306
|
function Vr(i) {
|
|
@@ -3308,7 +3309,7 @@ function Vr(i) {
|
|
|
3308
3309
|
function vi(i, r) {
|
|
3309
3310
|
let e = 1 / 0;
|
|
3310
3311
|
for (const t of i.keys())
|
|
3311
|
-
r.test(
|
|
3312
|
+
r.test(Dt(t).toLowerCase()) && (e = Math.min(e, Vr(t)));
|
|
3312
3313
|
return e;
|
|
3313
3314
|
}
|
|
3314
3315
|
const Nr = `var bt = Object.defineProperty;
|
|
@@ -4992,7 +4993,7 @@ class Qn {
|
|
|
4992
4993
|
(n = t.onProgress) == null || n.call(t, e.data.loaded, e.data.total);
|
|
4993
4994
|
return;
|
|
4994
4995
|
}
|
|
4995
|
-
this.pending.delete(e.data.id), (s = t.removeAbortListener) == null || s.call(t), e.data.ok ? t.resolve(e.data.data) : e.data.cancelled ? t.reject(
|
|
4996
|
+
this.pending.delete(e.data.id), (s = t.removeAbortListener) == null || s.call(t), e.data.ok ? t.resolve(e.data.data) : e.data.cancelled ? t.reject(ze("Chunk load was cancelled.")) : t.reject(ds(e.data.error));
|
|
4996
4997
|
}
|
|
4997
4998
|
}, this.worker.onerror = (e) => {
|
|
4998
4999
|
if (this.workerFailure) return;
|
|
@@ -5005,8 +5006,8 @@ class Qn {
|
|
|
5005
5006
|
}
|
|
5006
5007
|
/** Posts one load to this worker and tracks its pending promise. */
|
|
5007
5008
|
request(r, e, t) {
|
|
5008
|
-
if (this.disposed) return Promise.reject(
|
|
5009
|
-
if (e != null && e.aborted) return Promise.reject(
|
|
5009
|
+
if (this.disposed) return Promise.reject(ze("ChunkLoader has been disposed."));
|
|
5010
|
+
if (e != null && e.aborted) return Promise.reject(ze("Chunk load was cancelled."));
|
|
5010
5011
|
if (this.workerFailure) return Promise.reject(this.workerFailure);
|
|
5011
5012
|
const n = this.nextRequestId++, s = new Promise((a, c) => {
|
|
5012
5013
|
this.pending.set(n, { resolve: a, reject: c, ...t ? { onProgress: t } : {} });
|
|
@@ -5017,7 +5018,7 @@ class Qn {
|
|
|
5017
5018
|
if (!l) return;
|
|
5018
5019
|
this.pending.delete(n);
|
|
5019
5020
|
const h = { type: "cancel", id: n };
|
|
5020
|
-
this.disposed || this.worker.postMessage(h), l.reject(
|
|
5021
|
+
this.disposed || this.worker.postMessage(h), l.reject(ze("Chunk load was cancelled."));
|
|
5021
5022
|
};
|
|
5022
5023
|
e.addEventListener("abort", a, { once: !0 });
|
|
5023
5024
|
const c = this.pending.get(n);
|
|
@@ -5028,7 +5029,7 @@ class Qn {
|
|
|
5028
5029
|
}
|
|
5029
5030
|
/** Terminates this worker and rejects its in-flight requests. */
|
|
5030
5031
|
dispose() {
|
|
5031
|
-
this.disposed || (this.disposed = !0, this.worker.terminate(), this.rejectAll(
|
|
5032
|
+
this.disposed || (this.disposed = !0, this.worker.terminate(), this.rejectAll(ze("ChunkLoader has been disposed.")));
|
|
5032
5033
|
}
|
|
5033
5034
|
rejectAll(r) {
|
|
5034
5035
|
var e;
|
|
@@ -5118,8 +5119,8 @@ class vn {
|
|
|
5118
5119
|
}
|
|
5119
5120
|
/** Routes one load to the worker that owns its format. */
|
|
5120
5121
|
request(r, e, t, n, s, o, a, c) {
|
|
5121
|
-
if (this.disposed) return Promise.reject(
|
|
5122
|
-
if (t != null && t.aborted) return Promise.reject(
|
|
5122
|
+
if (this.disposed) return Promise.reject(ze("ChunkLoader has been disposed."));
|
|
5123
|
+
if (t != null && t.aborted) return Promise.reject(ze("Chunk load was cancelled."));
|
|
5123
5124
|
const l = {
|
|
5124
5125
|
type: "load",
|
|
5125
5126
|
source: r,
|
|
@@ -5131,7 +5132,7 @@ class vn {
|
|
|
5131
5132
|
...c ? { progress: !0 } : {}
|
|
5132
5133
|
}, h = this.clientFor(e);
|
|
5133
5134
|
return h instanceof Promise ? h.then((d) => {
|
|
5134
|
-
if (this.disposed) throw
|
|
5135
|
+
if (this.disposed) throw ze("ChunkLoader has been disposed.");
|
|
5135
5136
|
return d.request(l, t, c);
|
|
5136
5137
|
}) : h.request(l, t, c);
|
|
5137
5138
|
}
|
|
@@ -5179,9 +5180,9 @@ function Li(i) {
|
|
|
5179
5180
|
const r = 52 + (i.shBands ? 16 * Math.ceil(Sr(i.shBands) / 4) : 0), t = (i.chunkSize === void 0 ? void 0 : i.chunkSize * i.chunkUrls.length) ?? i.contentSplatCount ?? i.maxResidentSplats;
|
|
5180
5181
|
return Math.max(1, t) * r;
|
|
5181
5182
|
}
|
|
5182
|
-
class
|
|
5183
|
+
class Ut extends pt {
|
|
5183
5184
|
constructor(e, t, n, s, o, a = !1) {
|
|
5184
|
-
var
|
|
5185
|
+
var f, g, w;
|
|
5185
5186
|
super({ capacity: n }, s);
|
|
5186
5187
|
u(this, "scene");
|
|
5187
5188
|
u(this, "loader", new vn());
|
|
@@ -5368,11 +5369,13 @@ class Dt extends pt {
|
|
|
5368
5369
|
/** Set when the env tile is larger than the whole pool - terminal, warned once. */
|
|
5369
5370
|
u(this, "envUnfit", !1);
|
|
5370
5371
|
/**
|
|
5371
|
-
*
|
|
5372
|
-
*
|
|
5372
|
+
* Startup hold. `'capture'` waits for the first schedule after the host
|
|
5373
|
+
* applies the final camera; `'holding'` freezes that coverage set.
|
|
5373
5374
|
*/
|
|
5374
5375
|
u(this, "initialRevealPhase", "off");
|
|
5375
|
-
/**
|
|
5376
|
+
/** Which hold, if any, was armed at construction. Survives release for recapture. */
|
|
5377
|
+
u(this, "initialRevealHold", "off");
|
|
5378
|
+
/** Frozen nearby-detail / in-view coverage runs for {@link initialRevealPhase} `'holding'`. */
|
|
5376
5379
|
u(this, "frozenCriticalRuns", null);
|
|
5377
5380
|
/** Timestamp of the final-camera capture that began the current hold. */
|
|
5378
5381
|
u(this, "initialRevealStartedAt");
|
|
@@ -5388,13 +5391,15 @@ class Dt extends pt {
|
|
|
5388
5391
|
u(this, "coverageScratch");
|
|
5389
5392
|
u(this, "lastCameraPos", new p.Vector3(1 / 0, 1 / 0, 1 / 0));
|
|
5390
5393
|
u(this, "lastCameraQuat", new p.Quaternion());
|
|
5391
|
-
this.scene = e, this.budgetValue = t, this.maximumBudget = s.maxBudget === void 0 ? t : Math.max(t, tt(s.maxBudget)), this.lodScaleValue = Hn(s.lodScale), this.stagedSwapsEnabled = s.experimentalStagedSwaps !== !1, this.neverRetireCoverageEarly = a, this.appendCap = ci(s.maxSplatsPerSwap)
|
|
5394
|
+
this.scene = e, this.budgetValue = t, this.maximumBudget = s.maxBudget === void 0 ? t : Math.max(t, tt(s.maxBudget)), this.lodScaleValue = Hn(s.lodScale), this.stagedSwapsEnabled = s.experimentalStagedSwaps !== !1, this.neverRetireCoverageEarly = a, this.appendCap = ci(s.maxSplatsPerSwap);
|
|
5395
|
+
const c = s.initialReveal === "hold-coverage" && this.scene.source.coverageRunsFor !== void 0, l = s.initialReveal === "hold-near-l0" && a;
|
|
5396
|
+
c || l ? (this.initialRevealHold = c ? "hold-coverage" : "hold-near-l0", this.initialRevealPhase = "capture", this.initialRevealStateValue = {
|
|
5392
5397
|
status: "pending",
|
|
5393
5398
|
stagedSplats: 0,
|
|
5394
5399
|
totalSplats: 0,
|
|
5395
5400
|
readyGroups: 0,
|
|
5396
5401
|
totalGroups: 0
|
|
5397
|
-
}) : (this.initialRevealPhase = "off", this.initialRevealStateValue = { status: "disabled" }), this.onPerformanceEvent = s.onPerformanceEvent, this.cpuCacheBytes = s.cpuCacheBytes ?? li(), this.requestOptions = s.request, this.envFile = (
|
|
5402
|
+
}) : (this.initialRevealHold = "off", this.initialRevealPhase = "off", this.initialRevealStateValue = { status: "disabled" }), this.onPerformanceEvent = s.onPerformanceEvent, this.cpuCacheBytes = s.cpuCacheBytes ?? li(), this.requestOptions = s.request, this.envFile = (f = e.environment) == null ? void 0 : f.file, this.envEnabled = s.environmentEnabled !== !1, this.fetchWeight = s.fetchWeight, this.fetchScheduler = s.fetchScheduler, this.cacheBudget = s.cacheBudget, this.fetchHandle = (g = this.fetchScheduler) == null ? void 0 : g.register({
|
|
5398
5403
|
// No weight supplied: claim an equal share rather than none, so a partly
|
|
5399
5404
|
// wired host degrades to round-robin instead of silently starving.
|
|
5400
5405
|
weight: () => {
|
|
@@ -5406,11 +5411,11 @@ class Dt extends pt {
|
|
|
5406
5411
|
},
|
|
5407
5412
|
shedFetches: (m) => this.abortFetches(m)
|
|
5408
5413
|
});
|
|
5409
|
-
const
|
|
5414
|
+
const h = s.foveationMode === "pagetable", d = h ? Math.max(
|
|
5410
5415
|
this.cpuCacheBytes,
|
|
5411
5416
|
Math.min(Fi, Li(e))
|
|
5412
5417
|
) : this.cpuCacheBytes;
|
|
5413
|
-
if (this.cacheBudgetHandle = (
|
|
5418
|
+
if (this.cacheBudgetHandle = (w = this.cacheBudget) == null ? void 0 : w.register({
|
|
5414
5419
|
// The governor weight `fetchWeight` already carries, so cache and network
|
|
5415
5420
|
// follow the same camera-projected measure. The `1` fallback matches
|
|
5416
5421
|
// `requestChunk`: a host that never wired weights gives every mesh an
|
|
@@ -5419,15 +5424,15 @@ class Dt extends pt {
|
|
|
5419
5424
|
var m;
|
|
5420
5425
|
return ((m = this.fetchWeight) == null ? void 0 : m.call(this)) ?? 1;
|
|
5421
5426
|
},
|
|
5422
|
-
ceilingBytes:
|
|
5427
|
+
ceilingBytes: d,
|
|
5423
5428
|
onAllowanceChanged: (m) => this.applyCacheAllowance(m)
|
|
5424
|
-
}), this.cacheLimitBytes = this.cacheBudget && this.cacheBudgetHandle ? this.cacheBudget.allowanceFor(this.cacheBudgetHandle) :
|
|
5429
|
+
}), this.cacheLimitBytes = this.cacheBudget && this.cacheBudgetHandle ? this.cacheBudget.allowanceFor(this.cacheBudgetHandle) : d, h || (this.cpuCacheBytes = this.cacheLimitBytes), this.fetchCountsValue.cacheLimitBytes = this.cacheLimitBytes, s.foveationMode === "pagetable") {
|
|
5425
5430
|
if (!o)
|
|
5426
5431
|
throw new Error("StreamedSplatMesh: pagetable foveation requires the frontier worker.");
|
|
5427
5432
|
this.pageTableDrawTarget = s.foveationDrawBudget ?? Ii, this.pageTableDrawTargetExplicit = s.foveationDrawBudget !== void 0, this.pageTableDrawBudget = Math.min(t, this.pageTableDrawTarget), this.pageTableTargetPx = s.foveationTargetPx ?? ln, this.pageTableFoveation = { ...er, ...s.frontierFoveation }, (s.minSplatScreenRadius !== void 0 || s.maxSplatScreenRadius !== void 0) && (this.frontierBandBase = {
|
|
5428
5433
|
min: s.minSplatScreenRadius ?? 0,
|
|
5429
5434
|
max: s.maxSplatScreenRadius ?? 0
|
|
5430
|
-
}), this.slabPageSplats = Math.min(tr, n), this.slabCeiling = n, this.syncSlabPages(this.pageTableDrawBudget), this.frontierWorker = new o(), this.frontierWorker.onmessage = (
|
|
5435
|
+
}), this.slabPageSplats = Math.min(tr, n), this.slabCeiling = n, this.syncSlabPages(this.pageTableDrawBudget), this.frontierWorker = new o(), this.frontierWorker.onmessage = (y) => this.applyFrontierPlan(y.data), this.pagerSlots = this.slabSlots, this.postToWorker({
|
|
5431
5436
|
type: "init",
|
|
5432
5437
|
capacity: this.pagerSlots,
|
|
5433
5438
|
chunkSize: e.chunkSize ?? 65536,
|
|
@@ -5443,7 +5448,7 @@ class Dt extends pt {
|
|
|
5443
5448
|
* The returned static mesh shares this class's runtime budget contract.
|
|
5444
5449
|
*/
|
|
5445
5450
|
static async loadAutoLod(e, t) {
|
|
5446
|
-
const { StaticLodSplatMesh: n } = await Promise.resolve().then(() =>
|
|
5451
|
+
const { StaticLodSplatMesh: n } = await Promise.resolve().then(() => zi);
|
|
5447
5452
|
return n.load(e, t);
|
|
5448
5453
|
}
|
|
5449
5454
|
/**
|
|
@@ -5463,7 +5468,7 @@ class Dt extends pt {
|
|
|
5463
5468
|
*/
|
|
5464
5469
|
static async load(e, t = {}) {
|
|
5465
5470
|
const n = xr(e, t.baseUrl).href, s = n.toLowerCase(), o = t.format !== void 0 && t.format !== "auto" ? t.format : s.endsWith(".lcc2") ? "lcc2" : s.endsWith(".lcc") ? "lcc" : s.endsWith(".rad") ? "rad" : "streamed-sog";
|
|
5466
|
-
return
|
|
5471
|
+
return Ut.fromSource(
|
|
5467
5472
|
mi(n, t.request),
|
|
5468
5473
|
o,
|
|
5469
5474
|
t
|
|
@@ -5496,7 +5501,7 @@ class Dt extends pt {
|
|
|
5496
5501
|
});
|
|
5497
5502
|
}
|
|
5498
5503
|
try {
|
|
5499
|
-
const s = await
|
|
5504
|
+
const s = await Ut.fromSource(n.source, n.format, t);
|
|
5500
5505
|
return s.localSource = n.source, s;
|
|
5501
5506
|
} catch (s) {
|
|
5502
5507
|
throw n.source.dispose(), s;
|
|
@@ -5518,11 +5523,11 @@ class Dt extends pt {
|
|
|
5518
5523
|
lodMultiplier: n.lodMultiplier ?? 2
|
|
5519
5524
|
}, l = n.shBands ?? (rn(n.performanceProfile, s) === "smooth" ? 0 : wr), h = is(s), d = n.budget === void 0 && n.maxBudget === void 0 && n.budgetCap === void 0, f = n.signal;
|
|
5520
5525
|
f == null || f.throwIfAborted();
|
|
5521
|
-
let
|
|
5526
|
+
let g;
|
|
5522
5527
|
if (t === "rad")
|
|
5523
5528
|
try {
|
|
5524
5529
|
const { buildRadScene: v } = await import("./formats/rad.js");
|
|
5525
|
-
|
|
5530
|
+
g = await v(e, c, n.request, l, d);
|
|
5526
5531
|
} catch (v) {
|
|
5527
5532
|
throw At(v) ? v : Rt(v, { phase: "manifest", url: e.manifestUrl });
|
|
5528
5533
|
}
|
|
@@ -5542,42 +5547,44 @@ class Dt extends pt {
|
|
|
5542
5547
|
const A = await v.json();
|
|
5543
5548
|
if (t === "lcc2") {
|
|
5544
5549
|
const { buildLcc2Scene: P } = await import("./formats/lcc.js");
|
|
5545
|
-
|
|
5550
|
+
g = P(A, e, c, n.shBands ?? 0);
|
|
5546
5551
|
} else if (t === "lcc") {
|
|
5547
5552
|
const { buildLccScene: P } = await import("./formats/lcc.js");
|
|
5548
|
-
|
|
5553
|
+
g = await P(A, e, { ...c, shBands: l });
|
|
5549
5554
|
} else
|
|
5550
|
-
|
|
5555
|
+
g = di(A, e, c, n.shBands ?? 0);
|
|
5551
5556
|
} catch (A) {
|
|
5552
5557
|
throw At(A) ? A : Rt(A, { phase: "manifest", url: e.manifestUrl });
|
|
5553
5558
|
}
|
|
5554
5559
|
}
|
|
5555
5560
|
f == null || f.throwIfAborted();
|
|
5556
|
-
const
|
|
5557
|
-
|
|
5558
|
-
const y = Math.min(
|
|
5561
|
+
const w = (t === "lcc" || t === "rad") && d ? os(a, g.maxResidentSplats, s) : a, m = n.maxBudget === void 0 ? w : Math.min(o, w);
|
|
5562
|
+
g.source.budget = m;
|
|
5563
|
+
const y = Math.min(w, g.maxResidentSplats), b = n.experimentalStagedSwaps !== !1 ? 1.5 : 1.4, S = Math.max(
|
|
5559
5564
|
1,
|
|
5560
5565
|
Math.ceil(y * b / _e)
|
|
5561
|
-
), R =
|
|
5566
|
+
), R = g.foveation ? n.foveationMode ?? (t === "rad" ? "pagetable" : "frontier") : n.foveationMode;
|
|
5562
5567
|
let k;
|
|
5563
5568
|
if (R === "pagetable") {
|
|
5564
5569
|
k = (await import("./frontier-worker-CAnK_Cmu.js")).default, f == null || f.throwIfAborted();
|
|
5565
|
-
const A =
|
|
5570
|
+
const A = g.source;
|
|
5566
5571
|
A.needsParentSizes !== void 0 && (A.needsParentSizes = !1);
|
|
5567
5572
|
}
|
|
5568
|
-
const M = new
|
|
5573
|
+
const M = new Ut(
|
|
5574
|
+
g,
|
|
5569
5575
|
m,
|
|
5570
|
-
w,
|
|
5571
5576
|
S * _e,
|
|
5572
5577
|
{
|
|
5573
5578
|
...n,
|
|
5574
5579
|
// Classic LCC's useful first frame is the bounded nearby-detail set,
|
|
5575
|
-
// not its coarse shell.
|
|
5576
|
-
//
|
|
5580
|
+
// not its coarse shell. `.lcc2` waits for in-view coarsest coverage
|
|
5581
|
+
// so empty octree squares do not flash. Keep every other format
|
|
5582
|
+
// progressive, and let a caller explicitly request progressive for A/B.
|
|
5577
5583
|
...t === "lcc" && n.initialReveal === void 0 ? { initialReveal: "hold-near-l0" } : {},
|
|
5584
|
+
...t === "lcc2" && n.initialReveal === void 0 ? { initialReveal: "hold-coverage" } : {},
|
|
5578
5585
|
// The resolved ceiling, not the caller's raw option: it may have been
|
|
5579
5586
|
// lifted to a moderate capture's leaf count above.
|
|
5580
|
-
maxBudget:
|
|
5587
|
+
maxBudget: w,
|
|
5581
5588
|
// This line overrides `...options` above, so a declined request has to
|
|
5582
5589
|
// survive it - that is how `.rad` came to ignore both the `smooth`
|
|
5583
5590
|
// profile and an explicit `shBands: 0`. Only *zero* is re-applied here,
|
|
@@ -5585,7 +5592,7 @@ class Dt extends pt {
|
|
|
5585
5592
|
// requests by generating that many bands, whereas forcing a smaller
|
|
5586
5593
|
// count past one would mismatch the decoded chunk and degrade to
|
|
5587
5594
|
// neutral SH (see `SplatMesh.writePackedSh`).
|
|
5588
|
-
shBands: l === 0 ? 0 :
|
|
5595
|
+
shBands: l === 0 ? 0 : g.shBands ?? 0,
|
|
5589
5596
|
// Spark ships Mip-Splatting antialiasing ON (blurAmount 0.3 *with* opacity
|
|
5590
5597
|
// compensation `α·√(detRaw/detBlur)`). Match that default for `.rad`: the
|
|
5591
5598
|
// 0.3 low-pass without the compensation makes splats too opaque (uniform
|
|
@@ -5610,15 +5617,15 @@ class Dt extends pt {
|
|
|
5610
5617
|
// paged to the GPU, so the whole device budget buys on-screen detail); other
|
|
5611
5618
|
// foveated formats keep the GPU `frontier` cut. `foveationMode: 'band'` (or
|
|
5612
5619
|
// `'frontier'`) forces the legacy paths for A/B. Overrides any caller blob cull.
|
|
5613
|
-
...
|
|
5620
|
+
...g.foveation ? {
|
|
5614
5621
|
foveationMode: R,
|
|
5615
|
-
minSplatScreenRadius:
|
|
5616
|
-
maxSplatScreenRadius:
|
|
5622
|
+
minSplatScreenRadius: g.foveation.minScreenRadiusPx,
|
|
5623
|
+
maxSplatScreenRadius: g.foveation.maxScreenRadiusPx
|
|
5617
5624
|
} : {}
|
|
5618
5625
|
},
|
|
5619
5626
|
k,
|
|
5620
5627
|
t === "lcc"
|
|
5621
|
-
), x =
|
|
5628
|
+
), x = g.formatTransform ?? (M.orientation === "y-up" ? dn(t) : null);
|
|
5622
5629
|
return x && (M.matrix.copy(x), M.matrix.decompose(M.position, M.quaternion, M.scale), M.matrixWorldNeedsUpdate = !0), f != null && f.aborted && (M.dispose(), f.throwIfAborted()), M;
|
|
5623
5630
|
}
|
|
5624
5631
|
/** Slots the currently reserved pages can hold. */
|
|
@@ -5670,7 +5677,7 @@ class Dt extends pt {
|
|
|
5670
5677
|
const o = t + s, a = this.slabPages[Math.floor(o / this.slabPageSplats)];
|
|
5671
5678
|
if (!a) return;
|
|
5672
5679
|
const c = o % this.slabPageSplats, l = Math.min(n - s, this.slabPageSplats - c);
|
|
5673
|
-
this.overwriteRangeData(a,
|
|
5680
|
+
this.overwriteRangeData(a, Kt(e, s, l), c), s += l;
|
|
5674
5681
|
}
|
|
5675
5682
|
}
|
|
5676
5683
|
/** Zeros slots `[slot, slot + count)`, splitting at page boundaries like
|
|
@@ -6024,21 +6031,22 @@ class Dt extends pt {
|
|
|
6024
6031
|
}
|
|
6025
6032
|
/**
|
|
6026
6033
|
* Startup-hold progress for {@link StreamedSplatMeshOptions.initialReveal}.
|
|
6027
|
-
*
|
|
6028
|
-
* `'
|
|
6029
|
-
* `
|
|
6034
|
+
* Hosts using `'hold-near-l0'` or `'hold-coverage'` should keep the mesh
|
|
6035
|
+
* invisible while `status === 'pending'`, then reveal on `'ready'` or
|
|
6036
|
+
* `'degraded'`.
|
|
6030
6037
|
*/
|
|
6031
6038
|
get initialRevealState() {
|
|
6032
6039
|
return this.initialRevealStateValue;
|
|
6033
6040
|
}
|
|
6034
6041
|
/**
|
|
6035
|
-
* Captures a fresh
|
|
6036
|
-
*
|
|
6037
|
-
*
|
|
6038
|
-
*
|
|
6042
|
+
* Captures a fresh startup-hold set on the next {@link update}. Hosts that
|
|
6043
|
+
* apply their final initial camera pose after the mesh first receives frames
|
|
6044
|
+
* should call this before lifting their loading cover. It is a no-op when
|
|
6045
|
+
* the hold was never armed (progressive startup, or a format without the
|
|
6046
|
+
* matching LodSource hook).
|
|
6039
6047
|
*/
|
|
6040
6048
|
recaptureInitialReveal() {
|
|
6041
|
-
|
|
6049
|
+
this.initialRevealHold !== "off" && (this.frozenCriticalRuns = null, this.initialRevealStartedAt = void 0, this.initialRevealPhase = "capture", this.initialRevealStateValue = {
|
|
6042
6050
|
status: "pending",
|
|
6043
6051
|
stagedSplats: 0,
|
|
6044
6052
|
totalSplats: 0,
|
|
@@ -6099,21 +6107,21 @@ class Dt extends pt {
|
|
|
6099
6107
|
for (const { run: h } of this.resident.values()) {
|
|
6100
6108
|
const d = this.cache.get(h.file);
|
|
6101
6109
|
if (!d) continue;
|
|
6102
|
-
const f = d.data.positions,
|
|
6103
|
-
let
|
|
6104
|
-
for (let
|
|
6105
|
-
const y = h.offset +
|
|
6106
|
-
if (!(b * b + S * S + R * R > a) && !
|
|
6110
|
+
const f = d.data.positions, g = o.edits.get(h.file) ?? /* @__PURE__ */ new Map();
|
|
6111
|
+
let w = !1;
|
|
6112
|
+
for (let m = 0; m < h.count; m++) {
|
|
6113
|
+
const y = h.offset + m, b = f[y * 3 + 0] - at.x, S = f[y * 3 + 1] - at.y, R = f[y * 3 + 2] - at.z;
|
|
6114
|
+
if (!(b * b + S * S + R * R > a) && !g.has(y)) {
|
|
6107
6115
|
if (o.total >= o.maxEdits) {
|
|
6108
6116
|
o.warned || (o.warned = !0, me(
|
|
6109
6117
|
`StreamedSplatMesh.paintPersistent: channel "${e}" hit its maxEdits cap (${o.maxEdits}); further new edits are dropped.`
|
|
6110
6118
|
));
|
|
6111
6119
|
continue;
|
|
6112
6120
|
}
|
|
6113
|
-
o.total++,
|
|
6121
|
+
o.total++, g.set(y, s), w = !0, c++;
|
|
6114
6122
|
}
|
|
6115
6123
|
}
|
|
6116
|
-
|
|
6124
|
+
w && (o.edits.set(h.file, g), l.add(h.file));
|
|
6117
6125
|
}
|
|
6118
6126
|
if (l.size > 0)
|
|
6119
6127
|
for (const { run: h, handle: d } of this.resident.values())
|
|
@@ -6168,10 +6176,10 @@ class Dt extends pt {
|
|
|
6168
6176
|
for (const [v, A] of this.staged) s.staged.set(v, A.uploadedCount);
|
|
6169
6177
|
}
|
|
6170
6178
|
const o = this.compactionCount;
|
|
6171
|
-
if (this.pendingWork = !1, this.lastScheduleTime = t, e.getWorldPosition(this.lastCameraPos), e.getWorldQuaternion(this.lastCameraQuat),
|
|
6172
|
-
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(
|
|
6179
|
+
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
|
+
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(je).normalize();
|
|
6173
6181
|
const v = e.projectionMatrix.elements[5] * this.pageTableViewportY / 2;
|
|
6174
|
-
if (v > 0 && (this.pageTableLimit = this.pageTableTargetPx / v), this.reschedulePageTable(
|
|
6182
|
+
if (v > 0 && (this.pageTableLimit = this.pageTableTargetPx / v), this.reschedulePageTable(je, We, kt, t), this.onPerformanceEvent === void 0) return null;
|
|
6175
6183
|
const A = performance.now();
|
|
6176
6184
|
return {
|
|
6177
6185
|
timestamp: A,
|
|
@@ -6190,40 +6198,45 @@ class Dt extends pt {
|
|
|
6190
6198
|
compacted: !1
|
|
6191
6199
|
};
|
|
6192
6200
|
}
|
|
6193
|
-
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(
|
|
6201
|
+
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(je).normalize();
|
|
6194
6202
|
const a = this.scene.source.computeDesiredRuns(
|
|
6195
|
-
|
|
6196
|
-
|
|
6203
|
+
je,
|
|
6204
|
+
kt,
|
|
6197
6205
|
t,
|
|
6198
6206
|
We
|
|
6199
|
-
), c = this.captureOrContinueInitialReveal(
|
|
6207
|
+
), c = this.captureOrContinueInitialReveal(
|
|
6208
|
+
a,
|
|
6209
|
+
t,
|
|
6210
|
+
je,
|
|
6211
|
+
kt
|
|
6212
|
+
), l = c !== null, h = c ?? a, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set();
|
|
6200
6213
|
for (const v of h)
|
|
6201
|
-
d.set(
|
|
6214
|
+
d.set(ue(v), v), f.add(v.file);
|
|
6202
6215
|
for (const [v, A] of this.staged)
|
|
6203
|
-
d.has(v) || l && ((x = this.frozenCriticalRuns) != null && x.some((P) =>
|
|
6216
|
+
d.has(v) || l && ((x = this.frozenCriticalRuns) != null && x.some((P) => ue(P) === v)) || (this.removeRange(A.handle), this.staged.delete(v));
|
|
6204
6217
|
for (const [v, { controller: A }] of this.fetching)
|
|
6205
6218
|
!f.has(v) && !this.scene.pinnedFiles.has(v) && A.abort();
|
|
6206
6219
|
for (const v of this.retrying.keys())
|
|
6207
6220
|
!f.has(v) && !this.scene.pinnedFiles.has(v) && this.retrying.delete(v);
|
|
6208
6221
|
this.neededFiles.clear();
|
|
6209
6222
|
for (const v of h) {
|
|
6210
|
-
const A =
|
|
6223
|
+
const A = ue(v);
|
|
6211
6224
|
if (this.resident.has(A)) continue;
|
|
6212
6225
|
const P = this.staged.get(A);
|
|
6213
6226
|
P && P.uploadedCount === v.count || this.neededFiles.add(v.file);
|
|
6214
6227
|
}
|
|
6215
|
-
const
|
|
6228
|
+
const g = h.filter((v) => !this.resident.has(ue(v))), w = l ? [] : [...this.resident.entries()].filter(([v]) => !d.has(v)), m = l ? (
|
|
6216
6229
|
// Mesh is invisible during the hold, so L0 cell-atomicity (no holes) is
|
|
6217
6230
|
// irrelevant - commit each frozen slice as it lands so a partial home
|
|
6218
6231
|
// cell cannot block reveal behind sibling subchunks still fetching.
|
|
6219
|
-
Zs(
|
|
6220
|
-
) : Qs(
|
|
6221
|
-
|
|
6232
|
+
Zs(g)
|
|
6233
|
+
) : Qs(g, w), y = !l && Js(m);
|
|
6234
|
+
m.sort(
|
|
6222
6235
|
(v, A) => y ? ei(v, A) : Gn(v) - Gn(A)
|
|
6223
6236
|
);
|
|
6224
6237
|
const b = /* @__PURE__ */ new Map();
|
|
6225
6238
|
let S = 0, R = !1, k = !1, M = !1;
|
|
6226
|
-
for (const v of
|
|
6239
|
+
for (const v of m) {
|
|
6227
6240
|
if (!y && v.removes.length > 0 && R) {
|
|
6228
6241
|
if (this.neverRetireCoverageEarly || !k && this.retireHeldTicks < Ci) {
|
|
6229
6242
|
this.pendingWork = !0, M = !0;
|
|
@@ -6235,7 +6248,7 @@ class Dt extends pt {
|
|
|
6235
6248
|
this.applyGroup(v, t);
|
|
6236
6249
|
continue;
|
|
6237
6250
|
}
|
|
6238
|
-
const A = v.adds.filter((L) => !this.cache.has(L.file)), P = l || ri(v);
|
|
6251
|
+
const A = v.adds.filter((L) => !this.cache.has(L.file)), P = l || ri(v) && this.initialRevealHold !== "hold-coverage";
|
|
6239
6252
|
if (A.length > 0) {
|
|
6240
6253
|
let L = !1;
|
|
6241
6254
|
for (const W of A)
|
|
@@ -6251,7 +6264,7 @@ class Dt extends pt {
|
|
|
6251
6264
|
const L = this.stageGroup(v, t, Math.max(0, this.appendCap - S));
|
|
6252
6265
|
if (S += L, !v.adds.every((W) => {
|
|
6253
6266
|
var B;
|
|
6254
|
-
return ((B = this.staged.get(
|
|
6267
|
+
return ((B = this.staged.get(ue(W))) == null ? void 0 : B.uploadedCount) === W.count;
|
|
6255
6268
|
})) {
|
|
6256
6269
|
this.pendingWork = !0, R = !0;
|
|
6257
6270
|
continue;
|
|
@@ -6333,7 +6346,7 @@ class Dt extends pt {
|
|
|
6333
6346
|
publishInitialRevealProgress(e) {
|
|
6334
6347
|
const t = /* @__PURE__ */ new Map();
|
|
6335
6348
|
for (const c of e) {
|
|
6336
|
-
const l = c.coverageGroup;
|
|
6349
|
+
const l = c.coverageGroup !== void 0 ? `g:${c.coverageGroup}` : ue(c);
|
|
6337
6350
|
let h = t.get(l);
|
|
6338
6351
|
h || (h = [], t.set(l, h)), h.push(c);
|
|
6339
6352
|
}
|
|
@@ -6342,7 +6355,7 @@ class Dt extends pt {
|
|
|
6342
6355
|
let l = !0;
|
|
6343
6356
|
for (const h of c) {
|
|
6344
6357
|
s += h.count;
|
|
6345
|
-
const d =
|
|
6358
|
+
const d = ue(h);
|
|
6346
6359
|
if (this.resident.has(d)) {
|
|
6347
6360
|
n += h.count;
|
|
6348
6361
|
continue;
|
|
@@ -6385,68 +6398,89 @@ class Dt extends pt {
|
|
|
6385
6398
|
totalGroups: l
|
|
6386
6399
|
}, this.frozenCriticalRuns = null, this.initialRevealPhase = "released", this.pendingWork = !0;
|
|
6387
6400
|
}
|
|
6388
|
-
|
|
6401
|
+
/**
|
|
6402
|
+
* `.lcc2` coverage hold: freeze coarsest covering runs for in-view cells.
|
|
6403
|
+
* Missing `coverageRunsFor` (or an empty result after fallback) releases
|
|
6404
|
+
* immediately so the mesh does not stay hidden with nothing to fetch.
|
|
6405
|
+
*/
|
|
6406
|
+
captureCoverageHold(e, t, n) {
|
|
6407
|
+
var o, a;
|
|
6408
|
+
const s = ((a = (o = this.scene.source).coverageRunsFor) == null ? void 0 : a.call(o, e, t)) ?? [];
|
|
6409
|
+
if (s.length === 0) {
|
|
6410
|
+
this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released";
|
|
6411
|
+
return;
|
|
6412
|
+
}
|
|
6413
|
+
if (!this.criticalRunsFitCapacity(s)) {
|
|
6414
|
+
this.frozenCriticalRuns = s, this.releaseInitialReveal("degraded", "capacity");
|
|
6415
|
+
return;
|
|
6416
|
+
}
|
|
6417
|
+
this.frozenCriticalRuns = s, this.initialRevealStartedAt = n, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(s);
|
|
6418
|
+
}
|
|
6419
|
+
captureOrContinueInitialReveal(e, t, n, s) {
|
|
6389
6420
|
if (this.initialRevealPhase === "off" || this.initialRevealPhase === "released") return null;
|
|
6390
|
-
if (this.initialRevealPhase === "capture")
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
const o = this.
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6421
|
+
if (this.initialRevealPhase === "capture")
|
|
6422
|
+
if (this.initialRevealHold === "hold-coverage")
|
|
6423
|
+
this.captureCoverageHold(n, s, t);
|
|
6424
|
+
else {
|
|
6425
|
+
const o = this.selectHomeSeedRuns(e);
|
|
6426
|
+
let a = [];
|
|
6427
|
+
if (o.length === 0) {
|
|
6428
|
+
const c = this.scene.source.lodBaseDistance * this.scene.source.lodMultiplier * this.scene.source.lodMultiplier, l = e.filter(
|
|
6429
|
+
(d) => d.level <= 2 && d.coverageGroup !== void 0 && (d.distance ?? Number.POSITIVE_INFINITY) <= c
|
|
6430
|
+
), h = [...l].sort(
|
|
6431
|
+
(d, f) => (d.distance ?? Number.POSITIVE_INFINITY) - (f.distance ?? Number.POSITIVE_INFINITY) || (d.inView === !0 ? 0 : 1) - (f.inView === !0 ? 0 : 1) || (d.screenImportance ?? Number.POSITIVE_INFINITY) - (f.screenImportance ?? Number.POSITIVE_INFINITY) || d.leafStart - f.leafStart
|
|
6432
|
+
)[0];
|
|
6433
|
+
if (!h)
|
|
6434
|
+
return this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released", null;
|
|
6435
|
+
if (a = h.coverageGroup !== void 0 ? l.filter((d) => d.coverageGroup === h.coverageGroup) : [h], this.criticalRunsFitCapacity(a) || (a = h.coverageGroup !== void 0 ? l.filter(
|
|
6436
|
+
(d) => d.coverageGroup === h.coverageGroup && this.criticalRunsFitCapacity([d])
|
|
6437
|
+
).slice(0, 1) : l.filter((d) => this.criticalRunsFitCapacity([d])).slice(0, 1)), a.length === 0 || !this.criticalRunsFitCapacity(a))
|
|
6438
|
+
return this.frozenCriticalRuns = a.length > 0 ? a : [h], this.releaseInitialReveal("degraded", "capacity"), null;
|
|
6439
|
+
this.frozenCriticalRuns = a, this.initialRevealStartedAt = t, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(a);
|
|
6440
|
+
} else {
|
|
6441
|
+
for (const c of [0, 1, 2]) {
|
|
6442
|
+
const l = this.coarsenHomeRuns(o, c);
|
|
6443
|
+
if (l.length !== 0) {
|
|
6444
|
+
if (this.criticalRunsFitCapacity(l)) {
|
|
6445
|
+
a = l;
|
|
6446
|
+
break;
|
|
6447
|
+
}
|
|
6448
|
+
a = l;
|
|
6413
6449
|
}
|
|
6414
|
-
s = a;
|
|
6415
6450
|
}
|
|
6451
|
+
if (a.length === 0)
|
|
6452
|
+
return this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released", null;
|
|
6453
|
+
if (!this.criticalRunsFitCapacity(a))
|
|
6454
|
+
return this.frozenCriticalRuns = a, this.releaseInitialReveal("degraded", "capacity"), null;
|
|
6455
|
+
this.frozenCriticalRuns = a, this.initialRevealStartedAt = t, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(a);
|
|
6416
6456
|
}
|
|
6417
|
-
if (s.length === 0)
|
|
6418
|
-
return this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released", null;
|
|
6419
|
-
if (!this.criticalRunsFitCapacity(s))
|
|
6420
|
-
return this.frozenCriticalRuns = s, this.releaseInitialReveal("degraded", "capacity"), null;
|
|
6421
|
-
this.frozenCriticalRuns = s, this.initialRevealStartedAt = t, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(s);
|
|
6422
6457
|
}
|
|
6423
|
-
}
|
|
6424
6458
|
if (this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns) return null;
|
|
6425
6459
|
if (this.initialRevealStartedAt !== void 0 && t - this.initialRevealStartedAt >= Ri)
|
|
6426
6460
|
return this.releaseInitialReveal("degraded", "timeout"), null;
|
|
6427
|
-
for (const
|
|
6428
|
-
if (this.failedFiles.has(
|
|
6429
|
-
const
|
|
6430
|
-
if (!
|
|
6461
|
+
for (const o of this.frozenCriticalRuns)
|
|
6462
|
+
if (this.failedFiles.has(o.file) && !this.resident.has(ue(o))) {
|
|
6463
|
+
const a = this.staged.get(ue(o));
|
|
6464
|
+
if (!a || a.uploadedCount !== o.count)
|
|
6431
6465
|
return this.releaseInitialReveal("degraded", "fetch-failed"), null;
|
|
6432
6466
|
}
|
|
6433
6467
|
return this.publishInitialRevealProgress(this.frozenCriticalRuns), this.frozenCriticalRuns;
|
|
6434
6468
|
}
|
|
6435
6469
|
/** After staging/commits, release the hold when every frozen run is resident. */
|
|
6436
6470
|
finishInitialRevealIfComplete() {
|
|
6437
|
-
this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns || (this.publishInitialRevealProgress(this.frozenCriticalRuns), this.frozenCriticalRuns.every((e) => this.resident.has(
|
|
6471
|
+
this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns || (this.publishInitialRevealProgress(this.frozenCriticalRuns), this.frozenCriticalRuns.every((e) => this.resident.has(ue(e))) && this.releaseInitialReveal("ready"));
|
|
6438
6472
|
}
|
|
6439
6473
|
/** Creates a marker for a changed streamed-LOD tick, if any. */
|
|
6440
6474
|
createPerformanceEvent(e, t, n, s) {
|
|
6441
6475
|
let o = 0, a = 0;
|
|
6442
|
-
for (const [f,
|
|
6443
|
-
a +=
|
|
6476
|
+
for (const [f, g] of this.resident)
|
|
6477
|
+
a += g.run.count, e.has(f) || (o += g.run.count);
|
|
6444
6478
|
let c = 0;
|
|
6445
|
-
for (const [f,
|
|
6446
|
-
this.resident.has(f) || (c +=
|
|
6479
|
+
for (const [f, g] of e)
|
|
6480
|
+
this.resident.has(f) || (c += g);
|
|
6447
6481
|
let l = 0;
|
|
6448
|
-
for (const [f,
|
|
6449
|
-
l += Math.max(0,
|
|
6482
|
+
for (const [f, g] of this.staged)
|
|
6483
|
+
l += Math.max(0, g.uploadedCount - (t.get(f) ?? 0));
|
|
6450
6484
|
const h = this.compactionCount !== n;
|
|
6451
6485
|
if (o === 0 && c === 0 && l === 0 && !h) return null;
|
|
6452
6486
|
const d = performance.now();
|
|
@@ -6469,7 +6503,7 @@ class Dt extends pt {
|
|
|
6469
6503
|
}
|
|
6470
6504
|
/** Returns whether all new rows can coexist with the currently visible region. */
|
|
6471
6505
|
canStageGroup(e) {
|
|
6472
|
-
return e.adds.filter((n) => !this.staged.has(
|
|
6506
|
+
return e.adds.filter((n) => !this.staged.has(ue(n))).reduce((n, s) => n + this.rowAlignedSplats(s.count), 0) <= this.freeSplatCapacity;
|
|
6473
6507
|
}
|
|
6474
6508
|
/**
|
|
6475
6509
|
* Uploads a bounded part of a replacement without rendering it.
|
|
@@ -6479,7 +6513,7 @@ class Dt extends pt {
|
|
|
6479
6513
|
if (n <= 0) return 0;
|
|
6480
6514
|
let s = 0;
|
|
6481
6515
|
for (const o of e.adds) {
|
|
6482
|
-
const a =
|
|
6516
|
+
const a = ue(o), c = this.cache.get(o.file);
|
|
6483
6517
|
if (!c) continue;
|
|
6484
6518
|
let l = this.staged.get(a);
|
|
6485
6519
|
if (!l) {
|
|
@@ -6502,7 +6536,7 @@ class Dt extends pt {
|
|
|
6502
6536
|
if (h <= 0) break;
|
|
6503
6537
|
if (this.writeInactiveRange(
|
|
6504
6538
|
l.handle,
|
|
6505
|
-
|
|
6539
|
+
Kt(c.data, o.offset + l.uploadedCount, h),
|
|
6506
6540
|
l.uploadedCount
|
|
6507
6541
|
), l.uploadedCount += h, c.lastUsed = t, s += h, l.uploadedCount === o.count) {
|
|
6508
6542
|
this.writeLodLevelChannel(l.handle, o.level);
|
|
@@ -6516,14 +6550,14 @@ class Dt extends pt {
|
|
|
6516
6550
|
/** Switches a fully staged region from old to new visibility in one tick. */
|
|
6517
6551
|
commitStagedGroup(e) {
|
|
6518
6552
|
for (const t of e.adds) {
|
|
6519
|
-
const n = this.staged.get(
|
|
6553
|
+
const n = this.staged.get(ue(t));
|
|
6520
6554
|
if (!n || n.uploadedCount !== t.count)
|
|
6521
6555
|
throw new Error("StreamedSplatMesh: incomplete staged group commit.");
|
|
6522
6556
|
}
|
|
6523
6557
|
for (const [t, n] of e.removes)
|
|
6524
6558
|
this.resident.has(t) && (this.removeRange(n.handle), this.resident.delete(t));
|
|
6525
6559
|
for (const t of e.adds) {
|
|
6526
|
-
const n =
|
|
6560
|
+
const n = ue(t), s = this.staged.get(n);
|
|
6527
6561
|
this.setRangeActive(s.handle, !0), this.resident.set(n, s), this.staged.delete(n);
|
|
6528
6562
|
}
|
|
6529
6563
|
}
|
|
@@ -6546,7 +6580,7 @@ class Dt extends pt {
|
|
|
6546
6580
|
appendRun(e, t) {
|
|
6547
6581
|
const n = this.cache.get(e.file);
|
|
6548
6582
|
if (!n) return;
|
|
6549
|
-
const s =
|
|
6583
|
+
const s = Kt(n.data, e.offset, e.count);
|
|
6550
6584
|
let o;
|
|
6551
6585
|
try {
|
|
6552
6586
|
o = this.appendRange(s);
|
|
@@ -6559,7 +6593,7 @@ class Dt extends pt {
|
|
|
6559
6593
|
return;
|
|
6560
6594
|
}
|
|
6561
6595
|
}
|
|
6562
|
-
this.resident.set(
|
|
6596
|
+
this.resident.set(ue(e), { run: e, handle: o }), n.lastUsed = t, this.writeLodLevelChannel(o, e.level);
|
|
6563
6597
|
for (const [a, c] of this.persistentChannels)
|
|
6564
6598
|
this.applyPersistentRun(a, c, e, o);
|
|
6565
6599
|
}
|
|
@@ -6604,25 +6638,25 @@ class Dt extends pt {
|
|
|
6604
6638
|
for (; l < o; ) {
|
|
6605
6639
|
const h = c.indexOf(0, l);
|
|
6606
6640
|
if (h < 0) break;
|
|
6607
|
-
const d = c.indexOf(1, h), f = d < 0 ? o : d,
|
|
6608
|
-
for (const
|
|
6609
|
-
if (!this.resident.has(
|
|
6641
|
+
const d = c.indexOf(1, h), f = d < 0 ? o : d, g = e.leafStart + h, w = e.leafStart + f;
|
|
6642
|
+
for (const m of this.scene.source.coarsestRunsFor(g, w))
|
|
6643
|
+
if (!this.resident.has(ue(m))) {
|
|
6610
6644
|
if (s) {
|
|
6611
|
-
this.fetchCountsValue.uncovered += Math.min(
|
|
6645
|
+
this.fetchCountsValue.uncovered += Math.min(m.leafEnd, w) - Math.max(m.leafStart, g);
|
|
6612
6646
|
continue;
|
|
6613
6647
|
}
|
|
6614
|
-
if (!this.cache.has(
|
|
6648
|
+
if (!this.cache.has(m.file)) {
|
|
6615
6649
|
qn(
|
|
6616
6650
|
n,
|
|
6617
|
-
|
|
6618
|
-
ii(
|
|
6619
|
-
|
|
6620
|
-
), this.fetchCountsValue.uncovered += Math.min(
|
|
6651
|
+
m.file,
|
|
6652
|
+
ii(m, this.scene.source.lodBaseDistance),
|
|
6653
|
+
m
|
|
6654
|
+
), this.fetchCountsValue.uncovered += Math.min(m.leafEnd, w) - Math.max(m.leafStart, g);
|
|
6621
6655
|
continue;
|
|
6622
6656
|
}
|
|
6623
6657
|
for (const [y, b] of this.resident)
|
|
6624
|
-
b.run.leafStart <
|
|
6625
|
-
this.appendRun(
|
|
6658
|
+
b.run.leafStart < m.leafEnd && b.run.leafEnd > m.leafStart && (this.removeRange(b.handle), this.resident.delete(y));
|
|
6659
|
+
this.appendRun(m, t);
|
|
6626
6660
|
}
|
|
6627
6661
|
l = f;
|
|
6628
6662
|
}
|
|
@@ -6632,7 +6666,7 @@ class Dt extends pt {
|
|
|
6632
6666
|
if (e.size === 0) return;
|
|
6633
6667
|
ni(e, t, n);
|
|
6634
6668
|
const s = [...e.entries()].sort(
|
|
6635
|
-
(o, a) =>
|
|
6669
|
+
(o, a) => Yt(o[1], a[1], o[0], a[0])
|
|
6636
6670
|
);
|
|
6637
6671
|
this.preemptClassicFetches(s);
|
|
6638
6672
|
for (const [o, a] of s) this.requestChunk(o, a.kind, a);
|
|
@@ -6648,8 +6682,8 @@ class Dt extends pt {
|
|
|
6648
6682
|
if (this.cache.has(n) || this.fetching.has(n)) continue;
|
|
6649
6683
|
let o, a;
|
|
6650
6684
|
for (const [c, l] of this.fetching)
|
|
6651
|
-
l.classicWant && (!a ||
|
|
6652
|
-
if (a && o !== void 0 &&
|
|
6685
|
+
l.classicWant && (!a || Yt(l.classicWant, a, c, o) > 0) && (o = c, a = l.classicWant);
|
|
6686
|
+
if (a && o !== void 0 && Yt(s, a, n, o) < 0 && ((t = this.fetching.get(o)) == null || t.controller.abort()), this.fetching.size >= this.maxInflight) return;
|
|
6653
6687
|
}
|
|
6654
6688
|
}
|
|
6655
6689
|
/**
|
|
@@ -6734,11 +6768,11 @@ class Dt extends pt {
|
|
|
6734
6768
|
e.capacity !== t && (this.pendingWork = !0, this.lastScheduleTime = -1 / 0);
|
|
6735
6769
|
const n = performance.now(), s = e.moveSlots;
|
|
6736
6770
|
for (let f = 0; f < s.length; ) {
|
|
6737
|
-
let
|
|
6738
|
-
for (; f +
|
|
6739
|
-
|
|
6740
|
-
const
|
|
6741
|
-
|
|
6771
|
+
let g = 1;
|
|
6772
|
+
for (; f + g < s.length && s[f + g] === s[f] + g; )
|
|
6773
|
+
g++;
|
|
6774
|
+
const w = s[f], m = Math.min(g, t - w);
|
|
6775
|
+
m > 0 && this.writeSlabSlots(Ui(e.moves, f, m), w, m), f += g;
|
|
6742
6776
|
}
|
|
6743
6777
|
if (e.appends.count > 0) {
|
|
6744
6778
|
const f = Math.min(e.appends.count, t - e.appendStart);
|
|
@@ -6865,8 +6899,8 @@ class Dt extends pt {
|
|
|
6865
6899
|
h
|
|
6866
6900
|
);
|
|
6867
6901
|
else {
|
|
6868
|
-
const
|
|
6869
|
-
this.retrying.set(e, { attempts: d, readyAt: performance.now() +
|
|
6902
|
+
const g = Ei * 2 ** (d - 1);
|
|
6903
|
+
this.retrying.set(e, { attempts: d, readyAt: performance.now() + g });
|
|
6870
6904
|
}
|
|
6871
6905
|
}).finally(() => {
|
|
6872
6906
|
var h;
|
|
@@ -6896,7 +6930,7 @@ class Dt extends pt {
|
|
|
6896
6930
|
}
|
|
6897
6931
|
}
|
|
6898
6932
|
}
|
|
6899
|
-
const at = new p.Vector3(), nr = new p.Vector3(), rr = new p.Quaternion(),
|
|
6933
|
+
const at = new p.Vector3(), nr = new p.Vector3(), rr = new p.Quaternion(), je = new p.Vector3(), sr = new p.Matrix4(), kt = new p.Frustum(), Di = new p.Sphere(), We = new p.Vector3(), ir = new p.Vector2();
|
|
6900
6934
|
function or(i) {
|
|
6901
6935
|
return Math.ceil(3 * Sr(i) / 4);
|
|
6902
6936
|
}
|
|
@@ -6934,7 +6968,7 @@ async function Bo(i, r = {}) {
|
|
|
6934
6968
|
e.dispose();
|
|
6935
6969
|
}
|
|
6936
6970
|
}
|
|
6937
|
-
const
|
|
6971
|
+
const Ct = 4096, Wi = 250, Vi = (i) => {
|
|
6938
6972
|
const r = [
|
|
6939
6973
|
i.positions.buffer,
|
|
6940
6974
|
i.colors.buffer,
|
|
@@ -6945,9 +6979,9 @@ const kt = 4096, Wi = 250, Vi = (i) => {
|
|
|
6945
6979
|
if (!Number.isFinite(i) || i <= 0)
|
|
6946
6980
|
throw new RangeError("StaticLodSplatMesh budget must be a positive finite number.");
|
|
6947
6981
|
const e = Math.min(r, Math.floor(i));
|
|
6948
|
-
return e === r || e <
|
|
6949
|
-
|
|
6950
|
-
Math.floor(e /
|
|
6982
|
+
return e === r || e < Ct ? Math.max(1, e) : Math.max(
|
|
6983
|
+
Ct,
|
|
6984
|
+
Math.floor(e / Ct) * Ct
|
|
6951
6985
|
);
|
|
6952
6986
|
}, Ni = async (i, r, e) => {
|
|
6953
6987
|
const n = (await import("./static-lod-worker-D2fyqQZO.js")).default, s = new n();
|
|
@@ -6962,10 +6996,10 @@ const kt = 4096, Wi = 250, Vi = (i) => {
|
|
|
6962
6996
|
e == null || e.addEventListener("abort", c, { once: !0 }), s.onerror = (h) => {
|
|
6963
6997
|
e == null || e.removeEventListener("abort", c), s.terminate(), a(new Error(h.message));
|
|
6964
6998
|
}, s.onmessage = (h) => {
|
|
6965
|
-
var f,
|
|
6999
|
+
var f, g;
|
|
6966
7000
|
const d = h.data;
|
|
6967
7001
|
if (d.type === "progress") {
|
|
6968
|
-
(f = r.onLodProgress) == null || f.call(r, d.progress), (
|
|
7002
|
+
(f = r.onLodProgress) == null || f.call(r, d.progress), (g = r.onAutoLodProgress) == null || g.call(r, { phase: "lod-build", ...d.progress });
|
|
6969
7003
|
return;
|
|
6970
7004
|
}
|
|
6971
7005
|
if (d.type === "error") {
|
|
@@ -7016,8 +7050,8 @@ class yn extends pt {
|
|
|
7016
7050
|
const s = await _i(e, {
|
|
7017
7051
|
...t,
|
|
7018
7052
|
onProgress: (l, h) => {
|
|
7019
|
-
var d, f,
|
|
7020
|
-
(d = t.onProgress) == null || d.call(t, l, h), (f = t.onAutoLodProgress) == null || f.call(t, { phase: "download", completed: l, total: h }), !n && h > 0 && l >= h && (n = !0, (
|
|
7053
|
+
var d, f, g;
|
|
7054
|
+
(d = t.onProgress) == null || d.call(t, l, h), (f = t.onAutoLodProgress) == null || f.call(t, { phase: "download", completed: l, total: h }), !n && h > 0 && l >= h && (n = !0, (g = t.onAutoLodProgress) == null || g.call(t, { phase: "decode", completed: 0, total: 1 }));
|
|
7021
7055
|
}
|
|
7022
7056
|
});
|
|
7023
7057
|
n || (a = t.onAutoLodProgress) == null || a.call(t, { phase: "decode", completed: 0, total: 1 }), (c = t.onAutoLodProgress) == null || c.call(t, { phase: "decode", completed: 1, total: 1 });
|
|
@@ -7072,12 +7106,12 @@ class yn extends pt {
|
|
|
7072
7106
|
this.worker.postMessage(n);
|
|
7073
7107
|
}
|
|
7074
7108
|
}
|
|
7075
|
-
const
|
|
7109
|
+
const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7076
7110
|
__proto__: null,
|
|
7077
7111
|
StaticLodSplatMesh: yn
|
|
7078
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
7079
|
-
class
|
|
7080
|
-
constructor(r =
|
|
7112
|
+
}, Symbol.toStringTag, { value: "Module" })), zr = 256, Tt = "sourceId";
|
|
7113
|
+
class Oi {
|
|
7114
|
+
constructor(r = zr) {
|
|
7081
7115
|
/** `4 · MAX_SOURCES` vec4 columns; the TSL node both consumers index. */
|
|
7082
7116
|
u(this, "node");
|
|
7083
7117
|
/** CPU mirror of the same column-major matrices, for the WebGL2 sorter. */
|
|
@@ -7118,31 +7152,31 @@ function Gi(i, r) {
|
|
|
7118
7152
|
return r;
|
|
7119
7153
|
}
|
|
7120
7154
|
function $i(i) {
|
|
7121
|
-
const r = i.elements, e = r[0], t = r[1], n = r[2], s = r[4], o = r[5], a = r[6], c = r[8], l = r[9], h = r[10], d = e * e + t * t + n * n, f = s * s + o * o + a * a,
|
|
7155
|
+
const r = i.elements, e = r[0], t = r[1], n = r[2], s = r[4], o = r[5], a = r[6], c = r[8], l = r[9], h = r[10], d = e * e + t * t + n * n, f = s * s + o * o + a * a, g = c * c + l * l + h * h, w = e * s + t * o + n * a, m = e * c + t * l + n * h, y = s * c + o * l + a * h;
|
|
7122
7156
|
return Math.sqrt(
|
|
7123
7157
|
Math.max(
|
|
7124
|
-
d + Math.abs(
|
|
7125
|
-
f + Math.abs(
|
|
7126
|
-
|
|
7158
|
+
d + Math.abs(w) + Math.abs(m),
|
|
7159
|
+
f + Math.abs(w) + Math.abs(y),
|
|
7160
|
+
g + Math.abs(m) + Math.abs(y)
|
|
7127
7161
|
)
|
|
7128
7162
|
);
|
|
7129
7163
|
}
|
|
7130
7164
|
class Io extends pt {
|
|
7131
7165
|
constructor(e) {
|
|
7132
|
-
const t = e.maxSources ??
|
|
7166
|
+
const t = e.maxSources ?? zr;
|
|
7133
7167
|
super({ capacity: e.capacity }, e);
|
|
7134
7168
|
u(this, "matrices");
|
|
7135
7169
|
u(this, "maxSources");
|
|
7136
7170
|
/** Indexed by source id; holes are left by {@link removeSource}. */
|
|
7137
7171
|
u(this, "sources", []);
|
|
7138
7172
|
u(this, "nextId", 0);
|
|
7139
|
-
this.matrices = new
|
|
7140
|
-
const n = this.channelTexture(
|
|
7173
|
+
this.matrices = new Oi(t), this.maxSources = t, this.defineChannel(Tt, { type: "float" });
|
|
7174
|
+
const n = this.channelTexture(Tt);
|
|
7141
7175
|
if (!n) throw new Error("SplatScene: sourceId channel texture missing.");
|
|
7142
7176
|
this.perSourceSort = {
|
|
7143
7177
|
sourceIdTexture: n,
|
|
7144
7178
|
columns: this.matrices.node,
|
|
7145
|
-
sourceIds: this.channelBacking(
|
|
7179
|
+
sourceIds: this.channelBacking(Tt),
|
|
7146
7180
|
matrices: this.matrices.matrices
|
|
7147
7181
|
}, this.rebuildGraph();
|
|
7148
7182
|
}
|
|
@@ -7167,7 +7201,7 @@ class Io extends pt {
|
|
|
7167
7201
|
const o = this.appendRange(e);
|
|
7168
7202
|
this.nextId++;
|
|
7169
7203
|
const a = new Float32Array(e.count);
|
|
7170
|
-
a.fill(s), this.writeChannel(o,
|
|
7204
|
+
a.fill(s), this.writeChannel(o, Tt, a);
|
|
7171
7205
|
const l = (n.orientation ?? "y-up") === "y-up" ? dn(e.sourceFormat) : null, h = new p.Box3().setFromArray(e.positions), d = h.getBoundingSphere(new p.Sphere()), f = {
|
|
7172
7206
|
range: o,
|
|
7173
7207
|
correction: l,
|
|
@@ -7246,13 +7280,13 @@ class Io extends pt {
|
|
|
7246
7280
|
return e;
|
|
7247
7281
|
}
|
|
7248
7282
|
}
|
|
7249
|
-
const
|
|
7283
|
+
const Or = 24, qi = 32, un = 4, cr = (1 << Or) - 1;
|
|
7250
7284
|
function ji(i) {
|
|
7251
7285
|
if (!Number.isInteger(i) || i <= 0 || i % un !== 0)
|
|
7252
7286
|
throw new RangeError("Radix key width must be a positive multiple of four bits.");
|
|
7253
7287
|
return i / un;
|
|
7254
7288
|
}
|
|
7255
|
-
const be = 256, hn = 8, Qt = be * hn, ut = 16, et = be / 32,
|
|
7289
|
+
const be = 256, hn = 8, Qt = be * hn, ut = 16, et = be / 32, Pt = ut * et, Et = 256;
|
|
7256
7290
|
class Gr {
|
|
7257
7291
|
constructor(r) {
|
|
7258
7292
|
u(this, "kind", "radix");
|
|
@@ -7278,28 +7312,28 @@ class Gr {
|
|
|
7278
7312
|
this.renderer = r.renderer;
|
|
7279
7313
|
const o = r.exactDepth === !0;
|
|
7280
7314
|
this.exactDepth = o;
|
|
7281
|
-
const a = ji(o ? qi :
|
|
7315
|
+
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(
|
|
7282
7316
|
new Uint32Array(l),
|
|
7283
7317
|
1
|
|
7284
7318
|
), y = new p.StorageBufferAttribute(new Uint32Array(h), 1), b = new p.StorageBufferAttribute(
|
|
7285
|
-
new Uint32Array(c *
|
|
7319
|
+
new Uint32Array(c * Pt),
|
|
7286
7320
|
1
|
|
7287
7321
|
);
|
|
7288
7322
|
this.workingAttributes = [
|
|
7289
7323
|
d,
|
|
7290
7324
|
f,
|
|
7291
|
-
m,
|
|
7292
7325
|
g,
|
|
7293
7326
|
w,
|
|
7327
|
+
m,
|
|
7294
7328
|
y,
|
|
7295
7329
|
b
|
|
7296
|
-
], this.mirrors = new
|
|
7297
|
-
const S = G(d, "uint", e), R = G(f, "uint", e), k = G(
|
|
7330
|
+
], 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), v = 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(b, "uint", c * Pt).toAtomic(), W = Y(() => {
|
|
7298
7332
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7299
7333
|
const E = x.element(_), T = t ? gt(
|
|
7300
7334
|
te(E).mod(te(n)),
|
|
7301
7335
|
te(E).div(te(n))
|
|
7302
|
-
) : null,
|
|
7336
|
+
) : null, O = A ? A.element(E).xyz : ne(t, T).xyz, F = this.viewRow2.xyz.dot(O).add(this.viewRow2.w);
|
|
7303
7337
|
if (o) {
|
|
7304
7338
|
const $ = es(F), N = $.shiftRight(C(31)).equal(C(0)).select(C(2147483648), C(4294967295));
|
|
7305
7339
|
S.element(_).assign($.bitXor(N));
|
|
@@ -7310,21 +7344,21 @@ class Gr {
|
|
|
7310
7344
|
})().compute(e, [be]);
|
|
7311
7345
|
this.stages.push(W);
|
|
7312
7346
|
for (let E = 0; E < a; E++) {
|
|
7313
|
-
const T = E % 2 === 0 ? S : R,
|
|
7347
|
+
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(() => {
|
|
7314
7348
|
Ne(P.element(_), C(0));
|
|
7315
7349
|
})().compute(l, [be]), j = Y(() => {
|
|
7316
|
-
const
|
|
7350
|
+
const z = Gt.x.mul(C(Qt));
|
|
7317
7351
|
Fe(hn, ({ i: Z }) => {
|
|
7318
|
-
const q =
|
|
7352
|
+
const q = z.add(C(Z).mul(C(be))).add(En);
|
|
7319
7353
|
se(D(q).lessThan(this.activeCount), () => {
|
|
7320
7354
|
const ee = T.element(q).shiftRight(N).bitAnd(C(15));
|
|
7321
|
-
sn(P.element(ee.mul(C(c)).add(
|
|
7355
|
+
sn(P.element(ee.mul(C(c)).add(Gt.x)), C(1));
|
|
7322
7356
|
});
|
|
7323
7357
|
});
|
|
7324
7358
|
})().compute(c * be, [be]), K = Y(() => {
|
|
7325
|
-
const
|
|
7326
|
-
Fe(
|
|
7327
|
-
const ee =
|
|
7359
|
+
const z = _.mul(C(Et)), Z = C(0).toVar();
|
|
7360
|
+
Fe(Et, ({ i: q }) => {
|
|
7361
|
+
const ee = z.add(C(q));
|
|
7328
7362
|
se(ee.lessThan(C(l)), () => {
|
|
7329
7363
|
const ie = Ve(P.element(ee)).toVar();
|
|
7330
7364
|
Ne(P.element(ee), Z), Z.addAssign(ie);
|
|
@@ -7332,51 +7366,51 @@ class Gr {
|
|
|
7332
7366
|
}), U.element(_).assign(Z);
|
|
7333
7367
|
})().compute(h, [64]), ae = Y(() => {
|
|
7334
7368
|
se(_.equal(C(0)), () => {
|
|
7335
|
-
const
|
|
7369
|
+
const z = C(0).toVar();
|
|
7336
7370
|
Fe(h, ({ i: Z }) => {
|
|
7337
7371
|
const q = U.element(Z).toVar();
|
|
7338
|
-
U.element(Z).assign(
|
|
7372
|
+
U.element(Z).assign(z), z.addAssign(q);
|
|
7339
7373
|
});
|
|
7340
7374
|
});
|
|
7341
7375
|
})().compute(1, [64]), fe = Y(() => {
|
|
7342
|
-
const
|
|
7376
|
+
const z = _.div(C(Et));
|
|
7343
7377
|
Ne(
|
|
7344
7378
|
P.element(_),
|
|
7345
|
-
Ve(P.element(_)).add(U.element(
|
|
7379
|
+
Ve(P.element(_)).add(U.element(z))
|
|
7346
7380
|
);
|
|
7347
7381
|
})().compute(l, [be]), J = ts("uint", ut), ce = Y(() => {
|
|
7348
|
-
const
|
|
7349
|
-
se(
|
|
7350
|
-
J.element(
|
|
7351
|
-
}), se(
|
|
7352
|
-
Ne(L.element(q.add(
|
|
7382
|
+
const z = En, Z = Gt.x, q = Z.mul(C(Pt));
|
|
7383
|
+
se(z.lessThan(C(ut)), () => {
|
|
7384
|
+
J.element(z).assign(C(0));
|
|
7385
|
+
}), se(z.lessThan(C(Pt)), () => {
|
|
7386
|
+
Ne(L.element(q.add(z)), C(0));
|
|
7353
7387
|
}), St(), xt(), Fe(hn, ({ i: ee }) => {
|
|
7354
|
-
const ie = Z.mul(C(Qt)).add(ee.toUint().mul(C(be))).add(
|
|
7388
|
+
const ie = Z.mul(C(Qt)).add(ee.toUint().mul(C(be))).add(z), ve = D(ie).lessThan(this.activeCount), Ae = C(0).toVar(), Re = C(0).toVar(), ye = C(0).toVar();
|
|
7355
7389
|
se(ve, () => {
|
|
7356
7390
|
Ae.assign(T.element(ie)), Re.assign(F.element(ie)), ye.assign(Ae.shiftRight(N).bitAnd(C(15)));
|
|
7357
|
-
const re =
|
|
7358
|
-
ns(L.element(le), C(1).shiftLeft(
|
|
7391
|
+
const re = z.shiftRight(C(5)), de = z.bitAnd(C(31)), le = q.add(ye.mul(C(et))).add(re);
|
|
7392
|
+
ns(L.element(le), C(1).shiftLeft(de));
|
|
7359
7393
|
}), St(), xt(), se(ve, () => {
|
|
7360
|
-
const re =
|
|
7361
|
-
Fe(et, ({ i:
|
|
7362
|
-
se(C(
|
|
7394
|
+
const re = z.shiftRight(C(5)), de = z.bitAnd(C(31)), le = q.add(ye.mul(C(et))), Ie = J.element(ye).toVar();
|
|
7395
|
+
Fe(et, ({ i: Oe }) => {
|
|
7396
|
+
se(C(Oe).lessThan(re), () => {
|
|
7363
7397
|
Ie.addAssign(
|
|
7364
|
-
|
|
7398
|
+
$t(Ve(L.element(le.add(Oe.toUint()))))
|
|
7365
7399
|
);
|
|
7366
7400
|
});
|
|
7367
7401
|
});
|
|
7368
|
-
const
|
|
7402
|
+
const Xe = C(1).shiftLeft(de).sub(C(1));
|
|
7369
7403
|
Ie.addAssign(
|
|
7370
|
-
|
|
7404
|
+
$t(Ve(L.element(le.add(re))).bitAnd(Xe))
|
|
7371
7405
|
);
|
|
7372
7406
|
const Le = Ve(P.element(ye.mul(C(c)).add(Z))).add(Ie);
|
|
7373
|
-
|
|
7374
|
-
}), St(), xt(), se(
|
|
7407
|
+
O.element(Le).assign(Ae), $.element(Le).assign(Re);
|
|
7408
|
+
}), St(), xt(), se(z.lessThan(C(ut)), () => {
|
|
7375
7409
|
const re = C(0).toVar();
|
|
7376
|
-
Fe(et, ({ i:
|
|
7377
|
-
const le = q.add(
|
|
7378
|
-
re.addAssign(
|
|
7379
|
-
}), J.element(
|
|
7410
|
+
Fe(et, ({ i: de }) => {
|
|
7411
|
+
const le = q.add(z.mul(C(et))).add(de.toUint());
|
|
7412
|
+
re.addAssign($t(Ve(L.element(le)))), Ne(L.element(le), C(0));
|
|
7413
|
+
}), J.element(z).addAssign(re);
|
|
7380
7414
|
}), St(), xt();
|
|
7381
7415
|
});
|
|
7382
7416
|
})().compute(c * be, [be]);
|
|
@@ -7410,14 +7444,14 @@ class Gr {
|
|
|
7410
7444
|
if (!this.disposed) {
|
|
7411
7445
|
this.disposed = !0;
|
|
7412
7446
|
for (const r of this.stages) r.dispose();
|
|
7413
|
-
|
|
7447
|
+
Nt(this.renderer, this.workingAttributes);
|
|
7414
7448
|
}
|
|
7415
7449
|
}
|
|
7416
7450
|
}
|
|
7417
7451
|
const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7418
7452
|
__proto__: null,
|
|
7419
7453
|
RadixSorter: Gr
|
|
7420
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
7454
|
+
}, Symbol.toStringTag, { value: "Module" })), Wt = class Wt {
|
|
7421
7455
|
constructor(r) {
|
|
7422
7456
|
/** World-space center xyz; w is the drawable flag (1 draw, 0 modifier-hidden). */
|
|
7423
7457
|
u(this, "centers");
|
|
@@ -7433,8 +7467,8 @@ const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7433
7467
|
u(this, "isotropicScreenRadius");
|
|
7434
7468
|
u(this, "mirrors");
|
|
7435
7469
|
this.capacity = r;
|
|
7436
|
-
const e = r +
|
|
7437
|
-
this.centers = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.colors = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.covarianceA = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.covarianceB = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.isotropicMix = new p.StorageBufferAttribute(new Float32Array(e), 1), this.isotropicScreenRadius = new p.StorageBufferAttribute(new Float32Array(e), 1), this.mirrors = new
|
|
7470
|
+
const e = r + Wt.SCRATCH_SLOTS;
|
|
7471
|
+
this.centers = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.colors = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.covarianceA = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.covarianceB = new p.StorageBufferAttribute(new Float32Array(e * 4), 4), this.isotropicMix = new p.StorageBufferAttribute(new Float32Array(e), 1), this.isotropicScreenRadius = new p.StorageBufferAttribute(new Float32Array(e), 1), this.mirrors = new Vt([
|
|
7438
7472
|
this.centers,
|
|
7439
7473
|
this.colors,
|
|
7440
7474
|
this.covarianceA,
|
|
@@ -7467,8 +7501,8 @@ const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7467
7501
|
* same, silently, and cannot disturb a drawn slot: admission never allocates
|
|
7468
7502
|
* past `capacity` and the draw's `instanceCount` never covers it.
|
|
7469
7503
|
*/
|
|
7470
|
-
u(
|
|
7471
|
-
let
|
|
7504
|
+
u(Wt, "SCRATCH_SLOTS", 256);
|
|
7505
|
+
let _t = Wt;
|
|
7472
7506
|
class Xi {
|
|
7473
7507
|
constructor(r) {
|
|
7474
7508
|
/** World-space `xyzw` center buffer, one element per unified work slot. */
|
|
@@ -7498,15 +7532,15 @@ class Xi {
|
|
|
7498
7532
|
covarianceATexture: a,
|
|
7499
7533
|
covarianceBTexture: c,
|
|
7500
7534
|
dataTextureWidth: l
|
|
7501
|
-
} = r, h = r.sh ?? null, d = r.modifiers ?? [], f = r.channels ?? /* @__PURE__ */ new Map(),
|
|
7502
|
-
this.workBuffer = r.workBuffer ?? new
|
|
7503
|
-
const
|
|
7535
|
+
} = r, h = r.sh ?? null, d = r.modifiers ?? [], f = r.channels ?? /* @__PURE__ */ new Map(), g = r.localCameraPosition ?? I(new p.Vector3());
|
|
7536
|
+
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), b = G(this.covarianceA, "vec4", e), S = G(this.covarianceB, "vec4", e), R = G(this.isotropicMix, "float", e), k = G(this.isotropicScreenRadius, "float", e);
|
|
7504
7538
|
this.pass = Y(() => {
|
|
7505
7539
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7506
|
-
const M = te(
|
|
7540
|
+
const M = te(w.element(_)), x = gt(
|
|
7507
7541
|
M.mod(te(l)),
|
|
7508
7542
|
M.div(te(l))
|
|
7509
|
-
), v = ne(s, x).xyz, A = _.add(this.targetOffset.toUint()), P = ne(a, x), U = ne(c, x), L =
|
|
7543
|
+
), v = ne(s, x).xyz, A = _.add(this.targetOffset.toUint()), P = ne(a, x), U = ne(c, x), L = He(
|
|
7510
7544
|
V(P.x, P.y, P.z),
|
|
7511
7545
|
V(P.y, P.w, U.x),
|
|
7512
7546
|
V(P.z, U.x, U.y)
|
|
@@ -7516,18 +7550,18 @@ class Xi {
|
|
|
7516
7550
|
h,
|
|
7517
7551
|
{ covarianceBTexture: c },
|
|
7518
7552
|
x,
|
|
7519
|
-
v.sub(
|
|
7553
|
+
v.sub(g).normalize()
|
|
7520
7554
|
)
|
|
7521
7555
|
).clamp(0, 1),
|
|
7522
7556
|
W.a
|
|
7523
|
-
), E = this.sourceMatrix.mul(H(v, 1)).xyz, T = Rr(d,
|
|
7557
|
+
), E = this.sourceMatrix.mul(H(v, 1)).xyz, T = Rr(d, g, {
|
|
7524
7558
|
index: M,
|
|
7525
7559
|
localCenter: v,
|
|
7526
7560
|
color: B,
|
|
7527
7561
|
makeWorldCenter: () => E,
|
|
7528
7562
|
makeViewCenter: () => this.cameraViewMatrix.mul(H(E, 1)).xyz,
|
|
7529
7563
|
makeNormal: () => {
|
|
7530
|
-
const q = L.inverse(), ee =
|
|
7564
|
+
const q = L.inverse(), ee = g.sub(v), ie = q.mul(q.mul(ee)).normalize();
|
|
7531
7565
|
return ie.mul(ie.dot(ee).sign());
|
|
7532
7566
|
},
|
|
7533
7567
|
makeChannel: (q) => {
|
|
@@ -7538,8 +7572,8 @@ class Xi {
|
|
|
7538
7572
|
);
|
|
7539
7573
|
return ne(ee.texture, x).r;
|
|
7540
7574
|
}
|
|
7541
|
-
}),
|
|
7542
|
-
|
|
7575
|
+
}), O = T.offset === null ? v : v.add(T.offset), F = T.visible === null ? br(!0) : T.visible, $ = this.sourceMatrix.mul(H(O, 1)).xyz;
|
|
7576
|
+
m.element(A).assign(H($, F.select(D(1), D(0))));
|
|
7543
7577
|
const N = r.srgbOutput ? T.color : vr(T.color, p.SRGBColorSpace), X = r.lodAlpha ? N.a.mul(2) : N.a;
|
|
7544
7578
|
y.element(A).assign(H(N.rgb, F.select(X.mul(this.opacity), D(0))));
|
|
7545
7579
|
const j = T.rotation === null ? L : T.rotation.mul(L).mul(T.rotation.transpose());
|
|
@@ -7553,8 +7587,8 @@ class Xi {
|
|
|
7553
7587
|
q
|
|
7554
7588
|
);
|
|
7555
7589
|
}
|
|
7556
|
-
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)),
|
|
7557
|
-
b.element(A).assign(H(ce.x, ce.y, ce.z,
|
|
7590
|
+
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
|
+
b.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(
|
|
7558
7592
|
T.isotropicCovarianceMix === null ? D(0) : T.isotropicScreenRadiusPx ?? D(0)
|
|
7559
7593
|
);
|
|
7560
7594
|
});
|
|
@@ -7600,9 +7634,9 @@ class Xi {
|
|
|
7600
7634
|
function lr(i) {
|
|
7601
7635
|
const r = new p.NodeMaterial(), e = G(i.centers, "vec4", i.capacity), t = G(i.order, "float", i.capacity), n = G(i.colors, "vec4", i.capacity), s = G(i.covarianceA, "vec4", i.capacity), o = G(i.covarianceB, "vec4", i.capacity), a = G(i.isotropicMix, "float", i.capacity), c = G(i.isotropicScreenRadius, "float", i.capacity), l = Te(H(1, 1, 1, 1), "vWorkColor"), h = Te(nt.xy, "vWorkQuadPosition"), d = Te(D(1), "vWorkOpacityCompensation"), f = Te(D(0), "vWorkAdjustedStdDev");
|
|
7602
7636
|
return r.vertexNode = Y(() => {
|
|
7603
|
-
const
|
|
7604
|
-
l.assign(n.element(
|
|
7605
|
-
const b = ht.mul(H(
|
|
7637
|
+
const g = t.element(_).toInt(), w = e.element(g), m = w.xyz, y = w.w.greaterThan(0.5);
|
|
7638
|
+
l.assign(n.element(g));
|
|
7639
|
+
const b = ht.mul(H(m, 1)).toVar(), S = yr.mul(b).toVar(), R = s.element(g), k = o.element(g), M = He(
|
|
7606
7640
|
V(R.x, R.y, R.z),
|
|
7607
7641
|
V(R.y, R.w, k.x),
|
|
7608
7642
|
V(R.z, k.x, k.y)
|
|
@@ -7614,37 +7648,37 @@ function lr(i) {
|
|
|
7614
7648
|
0,
|
|
7615
7649
|
i.focal.y.mul(x),
|
|
7616
7650
|
i.focal.y.negate().mul(b.y).mul(v)
|
|
7617
|
-
), 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)),
|
|
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 = b.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(), ve = i.antialias.max(i.compensateProjectedLowPass), Ae = xe(ie, ee, ve);
|
|
7618
7652
|
d.assign(xe(Ae, D(1), ce));
|
|
7619
|
-
const Re = ae.add(fe).mul(0.5), ye =
|
|
7620
|
-
let re = Re.add(ye),
|
|
7621
|
-
const le = Pr(re,
|
|
7622
|
-
re = le.lambda1,
|
|
7653
|
+
const Re = ae.add(fe).mul(0.5), ye = he(ae.sub(fe).mul(0.5), J).length();
|
|
7654
|
+
let re = Re.add(ye), de = Re.sub(ye).max(0);
|
|
7655
|
+
const le = Pr(re, de, ce);
|
|
7656
|
+
re = le.lambda1, de = le.lambda2;
|
|
7623
7657
|
const Ie = Er(
|
|
7624
7658
|
re,
|
|
7625
|
-
|
|
7659
|
+
de,
|
|
7626
7660
|
ce,
|
|
7627
|
-
c.element(
|
|
7661
|
+
c.element(g),
|
|
7628
7662
|
i.maxStdDev
|
|
7629
7663
|
);
|
|
7630
|
-
re = Ie.lambda1,
|
|
7631
|
-
const
|
|
7632
|
-
f.assign(
|
|
7633
|
-
const Le =
|
|
7634
|
-
|
|
7635
|
-
),
|
|
7636
|
-
|
|
7664
|
+
re = Ie.lambda1, de = Ie.lambda2;
|
|
7665
|
+
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
|
+
f.assign(Ye);
|
|
7667
|
+
const Le = he(J, re.sub(ae)).add(he(1e-6, 0)).normalize(), Oe = i.minSplatSizePx, bt = Le.mul(re.sqrt().mul(Ye).min(1024).max(Oe)), vt = he(Le.y, Le.x.negate()).mul(
|
|
7668
|
+
de.sqrt().mul(Ye).min(1024).max(Oe)
|
|
7669
|
+
), Ke = bt.mul(nt.x).add(vt.mul(nt.y)), Ze = S.xy.div(S.w), st = H(
|
|
7670
|
+
Ze.add(Ke.mul(2).div(i.viewport)),
|
|
7637
7671
|
S.z.div(S.w),
|
|
7638
7672
|
1
|
|
7639
7673
|
), De = S.w.mul(1.2);
|
|
7640
7674
|
return S.z.greaterThan(De.negate()).and(S.x.abs().lessThan(De)).and(S.y.abs().lessThan(De)).and(y).select(st, H(0, 0, 2, 1));
|
|
7641
7675
|
})(), r.fragmentNode = Y(() => {
|
|
7642
|
-
const
|
|
7643
|
-
|
|
7644
|
-
const
|
|
7676
|
+
const g = h.dot(h);
|
|
7677
|
+
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(), b = w.oneMinus().pow(y).oneMinus(), R = l.a.greaterThan(1).select(b, 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)), v = 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 = v.a.add(A.a).add(P.a).add(U.a).add(L.a).max(1e-4), B = v.rgb.mul(v.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(
|
|
7645
7679
|
V(i.relightBackground),
|
|
7646
|
-
|
|
7647
|
-
|
|
7680
|
+
O.rgb.mul(i.relightBrightness),
|
|
7681
|
+
O.a
|
|
7648
7682
|
), $ = xe(l.rgb, l.rgb.mul(F), i.relightBlend);
|
|
7649
7683
|
return H($.mul(R), R);
|
|
7650
7684
|
})(), r.transparent = !0, r.depthTest = !0, r.depthWrite = !1, r.side = p.DoubleSide, r.blending = p.CustomBlending, r.blendSrc = p.OneFactor, r.blendDst = p.OneMinusSrcAlphaFactor, r.blendSrcAlpha = p.OneFactor, r.blendDstAlpha = p.OneMinusSrcAlphaFactor, r.toneMapped = !1, r;
|
|
@@ -7707,7 +7741,7 @@ class Lo extends p.Mesh {
|
|
|
7707
7741
|
"UnifiedSplatRenderer requires a WebGPU backend (renderer.backend.isWebGPUBackend). On WebGL2 use standalone SplatMesh draws or static SplatScene."
|
|
7708
7742
|
);
|
|
7709
7743
|
ro(e, eo(t), t);
|
|
7710
|
-
const s = new
|
|
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), b = I(mn), S = I(gn), R = I(wn), k = new p.StorageInstancedBufferAttribute(new Float32Array(t), 1), M = new p.InstancedBufferGeometry();
|
|
7711
7745
|
M.setIndex([0, 1, 2, 0, 2, 3]), M.setAttribute(
|
|
7712
7746
|
"position",
|
|
7713
7747
|
new p.BufferAttribute(new Float32Array([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]), 3)
|
|
@@ -7730,9 +7764,9 @@ class Lo extends p.Mesh {
|
|
|
7730
7764
|
antialias: h,
|
|
7731
7765
|
projectedLowPassVariance: d,
|
|
7732
7766
|
compensateProjectedLowPass: f,
|
|
7733
|
-
dofFocusDistance:
|
|
7734
|
-
dofAperture:
|
|
7735
|
-
relightMap:
|
|
7767
|
+
dofFocusDistance: g,
|
|
7768
|
+
dofAperture: w,
|
|
7769
|
+
relightMap: m,
|
|
7736
7770
|
relightBlend: y,
|
|
7737
7771
|
relightBrightness: b,
|
|
7738
7772
|
relightBackground: S,
|
|
@@ -7804,7 +7838,7 @@ class Lo extends p.Mesh {
|
|
|
7804
7838
|
u(this, "disposed", !1);
|
|
7805
7839
|
const x = new Uint32Array(t);
|
|
7806
7840
|
for (let A = 0; A < t; A++) x[A] = A;
|
|
7807
|
-
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 =
|
|
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 = b, 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;
|
|
7808
7842
|
const v = {
|
|
7809
7843
|
renderer: e,
|
|
7810
7844
|
capacity: t,
|
|
@@ -8028,9 +8062,9 @@ class Lo extends p.Mesh {
|
|
|
8028
8062
|
S.source.update(e, this.renderer, { sort: !1 }), S.view = S.source.getUnifiedSourceView(), S.registrationOrder = b, f.push(S);
|
|
8029
8063
|
}
|
|
8030
8064
|
f.sort((b, S) => S.priority - b.priority || b.registrationOrder - S.registrationOrder), this.overflowedSourceCount = 0, this.overflowedSplatCount = 0, this.bounds.makeEmpty();
|
|
8031
|
-
const
|
|
8032
|
-
|
|
8033
|
-
let
|
|
8065
|
+
const g = this.admittedScratch;
|
|
8066
|
+
g.length = 0;
|
|
8067
|
+
let w = 0;
|
|
8034
8068
|
for (const b of f) {
|
|
8035
8069
|
const S = b.view;
|
|
8036
8070
|
if (b.graphRevision !== S.graphRevision) {
|
|
@@ -8045,14 +8079,14 @@ class Lo extends p.Mesh {
|
|
|
8045
8079
|
b.lastGather = null;
|
|
8046
8080
|
continue;
|
|
8047
8081
|
}
|
|
8048
|
-
if (
|
|
8082
|
+
if (w + S.activeCount > this.workBuffer.capacity) {
|
|
8049
8083
|
this.overflowedSourceCount++, this.overflowedSplatCount += S.activeCount, b.lastGather = null;
|
|
8050
8084
|
continue;
|
|
8051
8085
|
}
|
|
8052
|
-
b.offset =
|
|
8086
|
+
b.offset = w, g.push(b), this.bounds.union(S.worldBounds), w += S.activeCount;
|
|
8053
8087
|
}
|
|
8054
|
-
let
|
|
8055
|
-
for (const b of
|
|
8088
|
+
let m = !1;
|
|
8089
|
+
for (const b of g) {
|
|
8056
8090
|
const S = b.view, R = b.offset, k = this.previousLayoutBySource.get(b.source), M = k !== void 0 && k.offset === R && k.activeCount === S.activeCount, x = b.lastGather, v = x !== null && M && x.activeCount === S.activeCount && x.contentRevision === S.contentRevision && x.offset === R && x.opacity === b.opacity && x.matrixWorld.equals(S.matrixWorld);
|
|
8057
8091
|
v && // SH depends on camera position, not orientation. A stationary camera
|
|
8058
8092
|
// can reuse the resolved colors instead of re-running a full-source
|
|
@@ -8067,7 +8101,7 @@ class Lo extends p.Mesh {
|
|
|
8067
8101
|
S.matrixWorld,
|
|
8068
8102
|
a.matrixWorldInverse,
|
|
8069
8103
|
b.opacity
|
|
8070
|
-
), v || (
|
|
8104
|
+
), v || (m = !0), b.lastGather === null ? b.lastGather = {
|
|
8071
8105
|
activeCount: S.activeCount,
|
|
8072
8106
|
contentRevision: S.contentRevision,
|
|
8073
8107
|
offset: R,
|
|
@@ -8076,35 +8110,35 @@ class Lo extends p.Mesh {
|
|
|
8076
8110
|
localCameraPosition: S.localCameraPosition.value.clone()
|
|
8077
8111
|
} : (b.lastGather.activeCount = S.activeCount, b.lastGather.contentRevision = S.contentRevision, b.lastGather.offset = R, b.lastGather.opacity = b.opacity, b.lastGather.matrixWorld.copy(S.matrixWorld), b.lastGather.localCameraPosition.copy(S.localCameraPosition.value)));
|
|
8078
8112
|
}
|
|
8079
|
-
let y =
|
|
8080
|
-
if (this.previousAdmittedTotal =
|
|
8081
|
-
for (let b = 0; b <
|
|
8082
|
-
const S =
|
|
8113
|
+
let y = g.length !== this.previousLayout.length || w !== this.previousAdmittedTotal;
|
|
8114
|
+
if (this.previousAdmittedTotal = w, !y)
|
|
8115
|
+
for (let b = 0; b < g.length; b++) {
|
|
8116
|
+
const S = g[b], R = this.previousLayout[b];
|
|
8083
8117
|
if (R.source !== S.source || R.offset !== S.offset || R.activeCount !== S.view.activeCount) {
|
|
8084
8118
|
y = !0;
|
|
8085
8119
|
break;
|
|
8086
8120
|
}
|
|
8087
8121
|
}
|
|
8088
8122
|
if (y) {
|
|
8089
|
-
this.previousLayout =
|
|
8123
|
+
this.previousLayout = g.map((b) => ({
|
|
8090
8124
|
source: b.source,
|
|
8091
8125
|
offset: b.offset,
|
|
8092
8126
|
activeCount: b.view.activeCount
|
|
8093
8127
|
})), this.previousLayoutBySource.clear();
|
|
8094
8128
|
for (const b of this.previousLayout) this.previousLayoutBySource.set(b.source, b);
|
|
8095
8129
|
}
|
|
8096
|
-
if ((
|
|
8130
|
+
if ((m || y) && this.sortScheduler.invalidateContent(), w > 0) {
|
|
8097
8131
|
const b = performance.now(), S = a.matrixWorldInverse;
|
|
8098
|
-
(n || this.sortScheduler.shouldSubmit(S, this.lastSortedModelView,
|
|
8132
|
+
(n || this.sortScheduler.shouldSubmit(S, this.lastSortedModelView, w, b)) && this.sorter.sort(S, w, this.bounds) && (this.lastSortedModelView.copy(S), this.sortScheduler.markAccepted(b));
|
|
8099
8133
|
}
|
|
8100
|
-
this.geometry.instanceCount =
|
|
8134
|
+
this.geometry.instanceCount = w, this.mirrors.settled || this.mirrors.release(this.renderer);
|
|
8101
8135
|
}
|
|
8102
8136
|
dispose() {
|
|
8103
8137
|
if (!this.disposed) {
|
|
8104
8138
|
this.disposed = !0;
|
|
8105
8139
|
for (const e of this.sources)
|
|
8106
8140
|
e.gather.dispose(), e.source.visible = e.originalVisible, e.source.setUnifiedPickVisibility(null), e.lastGather = null;
|
|
8107
|
-
this.sources.length = 0, this.previousLayout = [], this.previousLayoutBySource.clear(), this.candidateScratch.length = 0, this.admittedScratch.length = 0, this.sourceMaxStdDev = null, this.sourceAntialias = null, this.sourceProjectedFilterProfile = null, this.sorter.dispose(), this.geometry.dispose(), this.material.dispose(), this.relightPlaceholder.dispose(),
|
|
8141
|
+
this.sources.length = 0, this.previousLayout = [], this.previousLayoutBySource.clear(), this.candidateScratch.length = 0, this.admittedScratch.length = 0, this.sourceMaxStdDev = null, this.sourceAntialias = null, this.sourceProjectedFilterProfile = null, this.sorter.dispose(), this.geometry.dispose(), this.material.dispose(), this.relightPlaceholder.dispose(), Nt(this.renderer, [
|
|
8108
8142
|
this.workBuffer.centers,
|
|
8109
8143
|
this.workBuffer.colors,
|
|
8110
8144
|
this.workBuffer.covarianceA,
|
|
@@ -8322,7 +8356,7 @@ function en(i) {
|
|
|
8322
8356
|
);
|
|
8323
8357
|
return i;
|
|
8324
8358
|
}
|
|
8325
|
-
const hr = new p.Vector3(), dr = new p.Matrix4(), fr = new p.Frustum(), tn = new p.Box3(),
|
|
8359
|
+
const hr = new p.Vector3(), dr = new p.Matrix4(), fr = new p.Frustum(), tn = new p.Box3(), Bt = new p.Sphere();
|
|
8326
8360
|
class Do {
|
|
8327
8361
|
constructor(r = {}) {
|
|
8328
8362
|
u(this, "entries", /* @__PURE__ */ new Map());
|
|
@@ -8336,7 +8370,7 @@ class Do {
|
|
|
8336
8370
|
u(this, "lastUpdateAt", -1 / 0);
|
|
8337
8371
|
/** Set by membership/priority changes: the next update ignores both damps. */
|
|
8338
8372
|
u(this, "forceNext", !0);
|
|
8339
|
-
if (this.budgetGovernor = r.governor ?? new io(r), this.minIntervalMs = ct(r.minIntervalMs ?? 250, "minIntervalMs"), this.weightDeadband = ct(r.weightDeadband ?? 0.15, "weightDeadband"), this.falloff =
|
|
8373
|
+
if (this.budgetGovernor = r.governor ?? new io(r), this.minIntervalMs = ct(r.minIntervalMs ?? 250, "minIntervalMs"), this.weightDeadband = ct(r.weightDeadband ?? 0.15, "weightDeadband"), this.falloff = It(r.falloff ?? 1, "falloff"), this.offScreenWeight = It(r.offScreenWeight ?? 0.25, "offScreenWeight"), this.minWeight = It(r.minWeight ?? 0.05, "minWeight"), this.maxWeight = It(r.maxWeight ?? 8, "maxWeight"), this.maxWeight < this.minWeight)
|
|
8340
8374
|
throw new RangeError("CameraBudgetGovernor maxWeight must be >= minWeight.");
|
|
8341
8375
|
}
|
|
8342
8376
|
/** The governor this drives; use it for fixed-weight members and diagnostics. */
|
|
@@ -8458,12 +8492,12 @@ class Do {
|
|
|
8458
8492
|
const { member: e, priority: t } = r;
|
|
8459
8493
|
if (t === 0 || !(e.effectiveVisibility ?? e.visible)) return 0;
|
|
8460
8494
|
if (e.updateWorldMatrix(!0, !1), tn.copy(e.computeSplatBounds()), tn.isEmpty()) return t * this.minWeight;
|
|
8461
|
-
tn.applyMatrix4(e.matrixWorld).getBoundingSphere(
|
|
8462
|
-
const n =
|
|
8495
|
+
tn.applyMatrix4(e.matrixWorld).getBoundingSphere(Bt);
|
|
8496
|
+
const n = Bt.radius;
|
|
8463
8497
|
if (!(n > 0)) return t * this.minWeight;
|
|
8464
|
-
const s =
|
|
8498
|
+
const s = Bt.center.distanceTo(hr) - n, o = Math.max(s, n * 1e-3, 1e-6), a = oo((n / o) ** this.falloff, this.minWeight, this.maxWeight);
|
|
8465
8499
|
if (!Number.isFinite(a)) return t * this.minWeight;
|
|
8466
|
-
const c = fr.intersectsSphere(
|
|
8500
|
+
const c = fr.intersectsSphere(Bt) ? 1 : this.offScreenWeight;
|
|
8467
8501
|
return t * a * c;
|
|
8468
8502
|
}
|
|
8469
8503
|
/** Whether a weight moved enough to be worth a reallocation. */
|
|
@@ -8479,7 +8513,7 @@ function ct(i, r) {
|
|
|
8479
8513
|
throw new RangeError(`CameraBudgetGovernor ${r} must be a non-negative finite number.`);
|
|
8480
8514
|
return i;
|
|
8481
8515
|
}
|
|
8482
|
-
function
|
|
8516
|
+
function It(i, r) {
|
|
8483
8517
|
if (!Number.isFinite(i) || i <= 0)
|
|
8484
8518
|
throw new RangeError(`CameraBudgetGovernor ${r} must be a positive finite number.`);
|
|
8485
8519
|
return i;
|
|
@@ -8584,7 +8618,7 @@ class _o {
|
|
|
8584
8618
|
tryAcquire(r, e) {
|
|
8585
8619
|
const t = r;
|
|
8586
8620
|
if (this.disposed || !t.live) return !1;
|
|
8587
|
-
const n =
|
|
8621
|
+
const n = Ft(t.client.weight());
|
|
8588
8622
|
return e === "sweep" && n <= 0 ? (t.demanding = !1, !1) : this.inflightCount >= this.maxGlobalInflight || t.held >= this.shareFor(t, n) ? (t.demanding = !0, !1) : (t.held++, t.demanding = !1, this.inflightCount++, !0);
|
|
8589
8623
|
}
|
|
8590
8624
|
/**
|
|
@@ -8607,7 +8641,7 @@ class _o {
|
|
|
8607
8641
|
weightsChanged() {
|
|
8608
8642
|
if (!this.disposed) {
|
|
8609
8643
|
for (const r of this.entries)
|
|
8610
|
-
r.held > 0 &&
|
|
8644
|
+
r.held > 0 && Ft(r.client.weight()) <= 0 && r.client.shedFetches("sweep");
|
|
8611
8645
|
this.wake();
|
|
8612
8646
|
}
|
|
8613
8647
|
}
|
|
@@ -8642,7 +8676,7 @@ class _o {
|
|
|
8642
8676
|
shareFor(r, e) {
|
|
8643
8677
|
let t = 0, n = 0;
|
|
8644
8678
|
for (const c of this.entries) {
|
|
8645
|
-
const l = c === r ? e :
|
|
8679
|
+
const l = c === r ? e : Ft(c.client.weight());
|
|
8646
8680
|
c !== r && l <= 0 && c.held === 0 && !c.demanding || (t++, n += l);
|
|
8647
8681
|
}
|
|
8648
8682
|
if (t <= 1) return this.maxGlobalInflight;
|
|
@@ -8655,13 +8689,13 @@ class _o {
|
|
|
8655
8689
|
let r = null, e = -1 / 0;
|
|
8656
8690
|
for (const t of this.entries) {
|
|
8657
8691
|
if (!t.demanding) continue;
|
|
8658
|
-
const n =
|
|
8692
|
+
const n = Ft(t.client.weight());
|
|
8659
8693
|
n > e && (r = t, e = n);
|
|
8660
8694
|
}
|
|
8661
8695
|
r && (r.demanding = !1, r.client.onSlotAvailable());
|
|
8662
8696
|
}
|
|
8663
8697
|
}
|
|
8664
|
-
function
|
|
8698
|
+
function Ft(i) {
|
|
8665
8699
|
return Number.isFinite(i) && i > 0 ? i : 0;
|
|
8666
8700
|
}
|
|
8667
8701
|
const uo = 32 * 1024 * 1024, ho = 250, fo = 0.15;
|
|
@@ -8761,8 +8795,8 @@ class Wo {
|
|
|
8761
8795
|
for (const f of o) h += pr(f.client.weight());
|
|
8762
8796
|
const d = [];
|
|
8763
8797
|
for (const f of o) {
|
|
8764
|
-
const
|
|
8765
|
-
y >=
|
|
8798
|
+
const g = pr(f.client.weight()), w = h > 0 ? l * g / h : l / o.size, m = po(f.client.ceilingBytes), y = Math.floor(n + w);
|
|
8799
|
+
y >= m ? (s.set(f, m), d.push(f)) : s.set(f, y);
|
|
8766
8800
|
}
|
|
8767
8801
|
if (d.length === 0) break;
|
|
8768
8802
|
for (const f of d)
|
|
@@ -8789,7 +8823,7 @@ function Vo(i, r) {
|
|
|
8789
8823
|
i.transform && mr(i.transform, "`transform`"), r && mr(r, "`worldMatrix`");
|
|
8790
8824
|
const e = new p.Matrix4();
|
|
8791
8825
|
i.transform && e.copy(i.transform).invert(), r && e.multiply(r);
|
|
8792
|
-
const t = e.elements, n = t[0], s = t[1], o = t[2], a = t[4], c = t[5], l = t[6], h = t[8], d = t[9], f = t[10],
|
|
8826
|
+
const t = e.elements, n = t[0], s = t[1], o = t[2], a = t[4], c = t[5], l = t[6], h = t[8], d = t[9], f = t[10], g = t[12], w = t[13], m = t[14];
|
|
8793
8827
|
switch (i.kind) {
|
|
8794
8828
|
case "box": {
|
|
8795
8829
|
const y = i.halfExtents;
|
|
@@ -8799,14 +8833,14 @@ function Vo(i, r) {
|
|
|
8799
8833
|
);
|
|
8800
8834
|
const [b, S, R] = y;
|
|
8801
8835
|
return {
|
|
8802
|
-
containsPoint: (k, M, x) => Math.abs(n * k + a * M + h * x +
|
|
8836
|
+
containsPoint: (k, M, x) => Math.abs(n * k + a * M + h * x + g) <= b && Math.abs(s * k + c * M + d * x + w) <= S && Math.abs(o * k + l * M + f * x + m) <= R
|
|
8803
8837
|
};
|
|
8804
8838
|
}
|
|
8805
8839
|
case "sphere": {
|
|
8806
8840
|
const y = nn(i.radius, "sphere", "radius"), b = y * y;
|
|
8807
8841
|
return {
|
|
8808
8842
|
containsPoint: (S, R, k) => {
|
|
8809
|
-
const M = n * S + a * R + h * k +
|
|
8843
|
+
const M = n * S + a * R + h * k + g, x = s * S + c * R + d * k + w, v = o * S + l * R + f * k + m;
|
|
8810
8844
|
return M * M + x * x + v * v <= b;
|
|
8811
8845
|
}
|
|
8812
8846
|
};
|
|
@@ -8815,9 +8849,9 @@ function Vo(i, r) {
|
|
|
8815
8849
|
const y = nn(i.radius, "cylinder", "radius"), b = nn(i.height, "cylinder", "height") / 2, S = y * y;
|
|
8816
8850
|
return {
|
|
8817
8851
|
containsPoint: (R, k, M) => {
|
|
8818
|
-
const x = s * R + c * k + d * M +
|
|
8852
|
+
const x = s * R + c * k + d * M + w;
|
|
8819
8853
|
if (Math.abs(x) > b) return !1;
|
|
8820
|
-
const v = n * R + a * k + h * M +
|
|
8854
|
+
const v = n * R + a * k + h * M + g, A = o * R + l * k + f * M + m;
|
|
8821
8855
|
return v * v + A * A <= S;
|
|
8822
8856
|
}
|
|
8823
8857
|
};
|
|
@@ -8862,7 +8896,7 @@ function mr(i, r) {
|
|
|
8862
8896
|
`createSelectionVolume: ${r} is not invertible (a zero scale axis collapses the volume).`
|
|
8863
8897
|
);
|
|
8864
8898
|
}
|
|
8865
|
-
function
|
|
8899
|
+
function zo(i, r) {
|
|
8866
8900
|
const e = ArrayBuffer.isView(r) ? wo(r, i.count) : mo(i, r), t = new Uint8Array(i.count);
|
|
8867
8901
|
for (const o of e) t[o] = 1;
|
|
8868
8902
|
const n = new Uint32Array(i.count - e.length);
|
|
@@ -8914,7 +8948,7 @@ function wo(i, r) {
|
|
|
8914
8948
|
}
|
|
8915
8949
|
return Uint32Array.from(i);
|
|
8916
8950
|
}
|
|
8917
|
-
class
|
|
8951
|
+
class Oo {
|
|
8918
8952
|
/** @param order Slot names, in fold order. Must be non-empty and unique. */
|
|
8919
8953
|
constructor(r) {
|
|
8920
8954
|
u(this, "order");
|
|
@@ -8979,6 +9013,7 @@ class zo {
|
|
|
8979
9013
|
}
|
|
8980
9014
|
}
|
|
8981
9015
|
export {
|
|
9016
|
+
Ho as ADAPTIVE_PIXEL_RATIO_WARMUP_FRAMES,
|
|
8982
9017
|
io as BudgetGovernor,
|
|
8983
9018
|
Do as CameraBudgetGovernor,
|
|
8984
9019
|
Wo as ChunkCacheBudget,
|
|
@@ -8993,15 +9028,15 @@ export {
|
|
|
8993
9028
|
In as MAX_DOF_RADIUS_PX,
|
|
8994
9029
|
fn as MAX_DOF_VARIANCE,
|
|
8995
9030
|
wr as MAX_SH_BANDS,
|
|
8996
|
-
|
|
8997
|
-
|
|
9031
|
+
zr as MAX_SOURCES,
|
|
9032
|
+
Oo as ModifierSlots,
|
|
8998
9033
|
wt as SPLAT_DATA_TEXTURE_WIDTH,
|
|
8999
9034
|
dt as SplatLoadError,
|
|
9000
9035
|
pt as SplatMesh,
|
|
9001
9036
|
ms as SplatPool,
|
|
9002
9037
|
Io as SplatScene,
|
|
9003
9038
|
yn as StaticLodSplatMesh,
|
|
9004
|
-
|
|
9039
|
+
Ut as StreamedSplatMesh,
|
|
9005
9040
|
Lo as UnifiedSplatRenderer,
|
|
9006
9041
|
Zi as WEBGPU_DEFAULT_MAX_STORAGE_BUFFER_BINDING_SIZE,
|
|
9007
9042
|
Ki as WORK_BUFFER_BYTES_PER_SLOT,
|
|
@@ -9011,7 +9046,7 @@ export {
|
|
|
9011
9046
|
ro as assertStorageBufferFitsDevice,
|
|
9012
9047
|
kr as clampDepthOfFieldSettings,
|
|
9013
9048
|
_r as clampRelightingSettings,
|
|
9014
|
-
|
|
9049
|
+
Xo as classifySplatGpuClass,
|
|
9015
9050
|
To as computeDofCocVariancePx2,
|
|
9016
9051
|
Po as computeDofOpacityFade,
|
|
9017
9052
|
No as countInData,
|
|
@@ -9024,7 +9059,7 @@ export {
|
|
|
9024
9059
|
no as deviceMaxStorageBufferBindingSize,
|
|
9025
9060
|
ws as deviceMaxTextureSize,
|
|
9026
9061
|
eo as estimateLargestStorageBufferBytes,
|
|
9027
|
-
|
|
9062
|
+
Yo as estimateSplatPoolBytes,
|
|
9028
9063
|
to as estimateUnifiedWorkBufferBytes,
|
|
9029
9064
|
Fo as estimateUnifiedWorkBufferPeakBytes,
|
|
9030
9065
|
mi as httpDatasetSource,
|
|
@@ -9032,19 +9067,19 @@ export {
|
|
|
9032
9067
|
as as isFillConstrainedSplatDevice,
|
|
9033
9068
|
_i as loadScene,
|
|
9034
9069
|
Bo as loadSceneFile,
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9070
|
+
zo as partitionSplatData,
|
|
9071
|
+
Ko as probeSplatGpuClass,
|
|
9072
|
+
Zo as recommendedMaxPixelRatio,
|
|
9038
9073
|
is as recommendedRadMaxStdDev,
|
|
9039
9074
|
ur as recommendedWebGpuRequiredLimits,
|
|
9040
|
-
|
|
9075
|
+
Qo as recommendedXrFramebufferScale,
|
|
9041
9076
|
ss as resolveCpuCacheBytes,
|
|
9042
9077
|
tt as resolveSplatBudget,
|
|
9043
9078
|
rn as resolveSplatPerformanceProfile,
|
|
9044
|
-
|
|
9079
|
+
Jo as resolveXrSplatBudget,
|
|
9045
9080
|
mo as selectInData,
|
|
9046
9081
|
qo as setVlamLogHandler,
|
|
9047
|
-
|
|
9082
|
+
ea as suggestAdaptivePixelRatio,
|
|
9048
9083
|
Jt as supportsUnifiedSplatRenderer,
|
|
9049
9084
|
Qi as supportsWebGpuPowerPreference,
|
|
9050
9085
|
Ji as webGpuPowerPreferenceOptions,
|