@voluma/vlam 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/effects.d.ts +90 -5
- package/dist/effects.js +183 -114
- package/dist/effects.js.map +1 -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 +748 -651
- package/dist/index.js.map +1 -1
- package/dist/lod-source.d.ts +7 -0
- package/dist/relighting-pass.d.ts +49 -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-utils.d.ts +1 -1
- package/dist/streamed-splat-mesh.d.ts +51 -25
- package/dist/worker-sorter.d.ts +13 -0
- 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
|
|
7
|
+
import { bool as vr, mat3 as He, vec3 as V, float as D, modelViewMatrix as ht, vec4 as H, modelWorldMatrix as Zr, int as te, attribute as Qr, ivec2 as gt, textureLoad as ne, varying as Te, colorSpaceToWorking as br, positionGeometry as nt, Fn as Y, cameraProjectionMatrix as yr, If as se, mix as xe, vec2 as he, Discard as Lt, texture as Pe, screenUV as Ee, uniform as I, uint as C, storage as G, atomicStore as Ne, instanceIndex as _, atomicAdd as sn, Loop as Fe, atomicLoad as Ve, uniformArray as Jr, floatBitsToUint as es, workgroupId as Gt, invocationLocalIndex as En, workgroupArray as ts, storageBarrier as St, workgroupBarrier as xt, atomicOr as ns, countOneBits as $t } from "three/tsl";
|
|
8
8
|
import { w as me, l as Bn } from "./logging-BfPdd7NJ.js";
|
|
9
9
|
import { s as qo } from "./logging-BfPdd7NJ.js";
|
|
10
|
-
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:
|
|
51
|
-
visible:
|
|
50
|
+
rotation: He(V(1, 0, 0), V(0, 1, 0), V(0, 0, 1)),
|
|
51
|
+
visible: vr(!0)
|
|
52
52
|
}, s = { offset: !1, scale: !1, rotation: !1, visible: !1 };
|
|
53
53
|
let o = null, a = null, c = null, l = null, h = null, d = null;
|
|
54
|
-
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,
|
|
@@ -161,7 +161,7 @@ class ms {
|
|
|
161
161
|
u(this, "activeSlotByPoolIndex");
|
|
162
162
|
u(this, "poolIndexTemplate", null);
|
|
163
163
|
if (!(r.capacity > 0)) throw new Error("SplatPool capacity must be positive.");
|
|
164
|
-
this.rows = Math.ceil(r.capacity / this.width),
|
|
164
|
+
this.rows = Math.ceil(r.capacity / this.width), vs(this.rows, r.maxTextureSize ?? 0, this.width);
|
|
165
165
|
const e = this.width * this.rows;
|
|
166
166
|
this.floatTextures = r.floatTextures === "float16" ? "float16" : "float32", this.packedShBands = r.packedShBands ?? 0;
|
|
167
167
|
const t = this.floatTextures === "float16" ? p.HalfFloatType : p.FloatType;
|
|
@@ -330,13 +330,13 @@ function ws(i) {
|
|
|
330
330
|
}
|
|
331
331
|
return 0;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function vs(i, r, e = wt) {
|
|
334
334
|
if (!(!(r > 0) || i <= r))
|
|
335
335
|
throw new Error(
|
|
336
336
|
`SplatPool: this scene needs a ${e}×${i} data texture, but this device caps texture dimensions at ${r} (about ${(r * e).toLocaleString("en-US")} pool splats). Lower the splat budget, or raise maxTextureDimension2D in the renderer's requiredLimits if the adapter advertises more.`
|
|
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) {
|
|
@@ -351,14 +351,14 @@ function qt(i, r, e) {
|
|
|
351
351
|
for (const o of s) i.addUpdateRange(o.start, o.count);
|
|
352
352
|
}
|
|
353
353
|
const In = 24, fn = In * In;
|
|
354
|
-
function
|
|
354
|
+
function bs(i, r) {
|
|
355
355
|
const e = Math.max(0, i);
|
|
356
356
|
if (e <= 0) return 0;
|
|
357
357
|
const t = Math.max(1e-4, r);
|
|
358
358
|
return 2 * Math.atan(0.5 * e / t);
|
|
359
359
|
}
|
|
360
360
|
function To(i) {
|
|
361
|
-
const r = Math.max(1e-4, i.depth), e = Math.max(1e-4, i.focusDistance), t =
|
|
361
|
+
const r = Math.max(1e-4, i.depth), e = Math.max(1e-4, i.focusDistance), t = bs(i.aperture, e);
|
|
362
362
|
if (t <= 0 || !(i.focalPx > 0)) return 0;
|
|
363
363
|
const n = Math.abs(r - e) / r, s = i.focalPx * Math.tan(0.5 * t), o = n * s, a = o * o, c = i.maxVariance ?? fn;
|
|
364
364
|
return Math.min(a, c);
|
|
@@ -372,7 +372,7 @@ function kr(i, r = { focusDistance: 10, aperture: 0 }) {
|
|
|
372
372
|
}
|
|
373
373
|
const Fn = 1024, ys = 1e30, Cr = 0.35 * 0.35;
|
|
374
374
|
function Tr(i, r, e, t) {
|
|
375
|
-
const n = V(1, 0, 0), s = V(0, 1, 0), o = V(0, 0, 1), a = i.mul(n), c = i.mul(s), l = i.mul(o), h = a.x, d = c.y, f = l.z,
|
|
375
|
+
const n = V(1, 0, 0), s = V(0, 1, 0), o = V(0, 0, 1), a = i.mul(n), c = i.mul(s), l = i.mul(o), h = a.x, d = c.y, f = l.z, g = a.cross(c), w = c.cross(l), m = l.cross(a), y = g.length(), v = w.length(), S = m.length(), R = y.greaterThanEqual(v).and(y.greaterThanEqual(S)), k = v.greaterThan(y).and(v.greaterThanEqual(S)), M = R.select(g, k.select(w, m)), x = M.div(M.length().max(1e-12)), b = x.dot(i.mul(x)), P = h.min(d).min(f).min(b).max(1e-12).mul(t), U = He(V(P, 0, 0), V(0, P, 0), V(0, 0, P));
|
|
376
376
|
return i.mul(D(1).sub(e)).add(U.mul(e));
|
|
377
377
|
}
|
|
378
378
|
function Pr(i, r, e) {
|
|
@@ -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,25 +438,25 @@ 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,
|
|
446
|
-
const B = y ? y.linear.inverse().mul(
|
|
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, v = y ? y.worldCenter : w, S = n === null ? null : (() => {
|
|
446
|
+
const B = y ? y.linear.inverse().mul(v.sub(s.localCameraPosition)).normalize() : v.sub(s.localCameraPosition).normalize(), E = B.x, T = B.y, O = B.z, F = Ir(n, t, f), $ = F(0).mul(T.mul(-rt)).add(F(1).mul(O.mul(rt))).add(F(2).mul(E.mul(-rt)));
|
|
447
447
|
if (n.bands === 1) return $;
|
|
448
|
-
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))
|
|
459
|
-
), F = (y ? y.linear.mul(T).mul(y.linear.transpose()) : T).inverse(), $ = s.localCameraPosition.sub(
|
|
459
|
+
), F = (y ? y.linear.mul(T).mul(y.linear.transpose()) : T).inverse(), $ = s.localCameraPosition.sub(v), N = F.mul(F.mul($)).normalize();
|
|
460
460
|
return N.mul(N.dot($).sign());
|
|
461
461
|
}, M = (B) => {
|
|
462
462
|
const E = e.channels.get(B);
|
|
@@ -467,20 +467,20 @@ function Dn(i, r, e) {
|
|
|
467
467
|
return ne(E.texture, f).r;
|
|
468
468
|
}, x = Rr(e.modifiers, s.localCameraPosition, {
|
|
469
469
|
index: d,
|
|
470
|
-
localCenter:
|
|
471
|
-
sourceCenter:
|
|
470
|
+
localCenter: v,
|
|
471
|
+
sourceCenter: w,
|
|
472
472
|
sourceToLocal: y == null ? void 0 : y.linear,
|
|
473
473
|
color: R,
|
|
474
474
|
makeNormal: k,
|
|
475
475
|
makeChannel: M
|
|
476
|
-
}),
|
|
477
|
-
o.srgbOutput ? x.color :
|
|
476
|
+
}), b = Te(
|
|
477
|
+
o.srgbOutput ? x.color : br(x.color, p.SRGBColorSpace)
|
|
478
478
|
), A = Te(nt.xy), P = r === "pick" ? Te(D(0), "pickViewDepth") : null, U = Te(D(1), "vOpacityCompensation"), L = o.lodAlpha ? Te(D(o.maxStdDev), "vAdjustedStdDev") : null, W = o.lodAlpha ? Te(D(1), "vAlpha2") : null;
|
|
479
479
|
if (i.vertexNode = Y(() => {
|
|
480
|
-
const B = x.offset === null ?
|
|
480
|
+
const B = x.offset === null ? v : v.add(x.offset), E = ht.mul(H(B, 1)).toVar(), T = yr.mul(E).toVar(), O = H(0, 0, 2, 1).toVar(), F = r === "pick" ? 1.2 + 2 * Fn : 1.2, $ = T.w.mul(F), N = T.z.greaterThan($.negate()).and(T.x.abs().lessThan($)).and(T.y.abs().lessThan($)), X = x.visible === null ? N : N.and(x.visible);
|
|
481
481
|
return se(X, () => {
|
|
482
482
|
P && P.assign(E.z.negate());
|
|
483
|
-
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),
|
|
505
|
+
s.focal.y.negate().mul(E.y).mul(z)
|
|
506
|
+
), ee = ht.toMat3().transpose(), ie = ee.mul(Z), be = ee.mul(q), Ae = ie.dot(J.mul(ie)), Re = be.dot(J.mul(be)), ye = ie.dot(J.mul(be)), re = x.scaleSquared === null ? Ae : Ae.mul(x.scaleSquared), de = x.scaleSquared === null ? Re : Re.mul(x.scaleSquared), le = x.scaleSquared === null ? ye : ye.mul(x.scaleSquared), Ie = E.z.negate().max(1e-4), Xe = s.dofFocusDistance.max(1e-4), Ye = s.dofAperture.max(0).mul(0.5).div(Xe).atan(), Le = Ie.sub(Xe).abs().div(Ie), Oe = s.focal.x.mul(Ye.tan()), vt = Le.mul(Oe), bt = vt.mul(vt).min(D(fn)), Ke = o.projectedFilterProfile === "lcc" ? 0.1 : 0.3, Ze = re.add(Ke).add(bt), st = de.add(Ke).add(bt), De = le, Sn = Ze.mul(st).sub(De.mul(De)).max(1e-9), xn = (o.antialias || o.projectedFilterProfile === "lcc" ? re.mul(de).sub(le.mul(le)).max(0) : re.add(Ke).mul(de.add(Ke)).sub(le.mul(le)).max(1e-9)).div(Sn).sqrt();
|
|
507
507
|
U.assign(
|
|
508
508
|
x.isotropicCovarianceMix === null ? xn : xe(xn, D(1), x.isotropicCovarianceMix)
|
|
509
509
|
);
|
|
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,22 +568,22 @@ 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
|
-
const ie = B.mul(L.mul(L).mul(-0.5)).exp(),
|
|
578
|
+
const ie = B.mul(L.mul(L).mul(-0.5)).exp(), be = W.mul(4).sub(3).min(5), Ae = be.mul(be).sub(1).mul(1 / Math.E).exp(), Re = ie.oneMinus().pow(Ae).oneMinus();
|
|
579
579
|
E = W.greaterThan(1).select(Re, ie.mul(W));
|
|
580
580
|
} else
|
|
581
|
-
E = B.mul(h).exp().mul(
|
|
582
|
-
const T = E.mul(U),
|
|
581
|
+
E = B.mul(h).exp().mul(b.a);
|
|
582
|
+
const T = E.mul(U), O = Pe(s.relightMap, Ee), F = s.relightSoftness.div(s.viewport.x.max(1)), $ = s.relightSoftness.div(s.viewport.y.max(1)), N = O, X = Pe(s.relightMap, Ee.add(he(F, 0))), j = Pe(s.relightMap, Ee.add(he(F.negate(), 0))), K = Pe(s.relightMap, Ee.add(he(0, $))), ae = Pe(s.relightMap, Ee.add(he(0, $.negate()))), fe = N.a.add(X.a).add(j.a).add(K.a).add(ae.a).max(1e-4), J = N.rgb.mul(N.a).add(X.rgb.mul(X.a)).add(j.rgb.mul(j.a)).add(K.rgb.mul(K.a)).add(ae.rgb.mul(ae.a)).div(fe), ce = fe.mul(0.2), z = H(J, ce), Z = s.relightSoftness.greaterThan(0.5).select(z, O), q = xe(
|
|
583
583
|
V(s.relightBackground),
|
|
584
584
|
Z.rgb.mul(s.relightBrightness),
|
|
585
585
|
Z.a
|
|
586
|
-
), ee = xe(
|
|
586
|
+
), ee = xe(b.rgb, b.rgb.mul(q), s.relightBlend);
|
|
587
587
|
return H(ee.mul(T), T);
|
|
588
588
|
})(), i.transparent = !0, i.depthTest = !0, i.depthWrite = !1, i.side = p.DoubleSide, i.blending = p.CustomBlending, i.blendSrc = p.OneFactor, i.blendDst = p.OneMinusSrcAlphaFactor, i.blendSrcAlpha = p.OneFactor, i.blendDstAlpha = p.OneMinusSrcAlphaFactor, i.toneMapped = !1;
|
|
589
589
|
else {
|
|
@@ -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
|
-
|
|
595
|
-
const T = B.mul(h).exp().mul(
|
|
596
|
-
|
|
594
|
+
Lt(B.greaterThan(1));
|
|
595
|
+
const T = B.mul(h).exp().mul(b.a).mul(U);
|
|
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,62 +712,62 @@ 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
|
-
),
|
|
726
|
+
), v = G(g, "uint", t), S = G(r.sourceIndexAttribute, "uint", t), R = G(r.splatIndexAttribute, "float", t), k = o ? G(o, "vec4", t) : null;
|
|
727
727
|
this.clearPass = Y(() => {
|
|
728
|
-
Ne(
|
|
728
|
+
Ne(w.element(_), C(0));
|
|
729
729
|
})().compute(c, [l]), this.histogramPass = Y(() => {
|
|
730
730
|
se(D(_).lessThan(this.activeCount), () => {
|
|
731
|
-
const x = te(S.element(_)),
|
|
731
|
+
const x = te(S.element(_)), b = n ? gt(
|
|
732
732
|
x.mod(te(s)),
|
|
733
733
|
x.div(te(s))
|
|
734
|
-
) : null, A = k ? k.element(x).xyz : ne(n,
|
|
734
|
+
) : null, A = k ? k.element(x).xyz : ne(n, b).xyz, P = a ? Br(
|
|
735
735
|
a.columns,
|
|
736
|
-
te(ne(a.sourceIdTexture,
|
|
736
|
+
te(ne(a.sourceIdTexture, b).r),
|
|
737
737
|
A
|
|
738
738
|
).worldCenter : A, L = this.viewRow2.xyz.dot(P).add(this.viewRow2.w).sub(this.depthMin).mul(this.depthScale).clamp(0, this.bucketMax).toUint();
|
|
739
|
-
|
|
739
|
+
v.element(_).assign(L), sn(w.element(L), C(1));
|
|
740
740
|
});
|
|
741
741
|
})().compute(t, [l]), this.scanBlocksPass = Y(() => {
|
|
742
|
-
const x = _.mul(C(l)).toVar(),
|
|
742
|
+
const x = _.mul(C(l)).toVar(), b = C(0).toVar();
|
|
743
743
|
Fe(l, ({ i: A }) => {
|
|
744
|
-
const P =
|
|
745
|
-
Ne(P,
|
|
746
|
-
}),
|
|
744
|
+
const P = w.element(x.add(C(A))), U = Ve(P).toVar();
|
|
745
|
+
Ne(P, b), b.addAssign(U);
|
|
746
|
+
}), m.element(_).assign(b);
|
|
747
747
|
})().compute(c / l, [64]), this.scanBlockSumsPass = Y(() => {
|
|
748
|
-
const x = _.mul(C(l)).toVar(),
|
|
748
|
+
const x = _.mul(C(l)).toVar(), b = C(0).toVar();
|
|
749
749
|
Fe(l, ({ i: A }) => {
|
|
750
|
-
const P =
|
|
751
|
-
P.assign(
|
|
752
|
-
}), y.element(_).assign(
|
|
750
|
+
const P = m.element(x.add(C(A))), U = P.toVar();
|
|
751
|
+
P.assign(b), b.addAssign(U);
|
|
752
|
+
}), y.element(_).assign(b);
|
|
753
753
|
})().compute(c / l / l, [64]);
|
|
754
754
|
const M = Y(() => {
|
|
755
755
|
se(_.equal(C(0)), () => {
|
|
756
756
|
const x = C(0).toVar();
|
|
757
|
-
Fe(c / l / l, ({ i:
|
|
758
|
-
const A = y.element(
|
|
759
|
-
y.element(
|
|
757
|
+
Fe(c / l / l, ({ i: b }) => {
|
|
758
|
+
const A = y.element(b).toVar();
|
|
759
|
+
y.element(b).assign(x), x.addAssign(A);
|
|
760
760
|
});
|
|
761
761
|
});
|
|
762
762
|
})().compute(1, [64]);
|
|
763
763
|
this.addBlockSumOffsetsPass = Y(() => {
|
|
764
|
-
|
|
764
|
+
m.element(_).addAssign(y.element(_.div(C(l))));
|
|
765
765
|
})().compute(c / l, [l]), this.addOffsetsPass = Y(() => {
|
|
766
|
-
const x =
|
|
767
|
-
Ne(x, Ve(x).add(
|
|
766
|
+
const x = w.element(_), b = m.element(_.shiftRight(C(Math.log2(l))));
|
|
767
|
+
Ne(x, Ve(x).add(b));
|
|
768
768
|
})().compute(c, [l]), this.scatterPass = Y(() => {
|
|
769
769
|
se(D(_).lessThan(this.activeCount), () => {
|
|
770
|
-
const x = S.element(_),
|
|
770
|
+
const x = S.element(_), b = v.element(_), A = sn(w.element(b), C(1));
|
|
771
771
|
R.element(A).assign(D(x));
|
|
772
772
|
});
|
|
773
773
|
})().compute(t, [l]), this.sortPasses = [
|
|
@@ -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);
|
|
@@ -920,6 +920,11 @@ class Ms {
|
|
|
920
920
|
u(this, "disposed", !1);
|
|
921
921
|
/** The active spans the in-flight sort was computed against. */
|
|
922
922
|
u(this, "sentSpans", null);
|
|
923
|
+
u(this, "submittedCount", 0);
|
|
924
|
+
u(this, "completedCount", 0);
|
|
925
|
+
u(this, "lastSubmittedAt", -1 / 0);
|
|
926
|
+
u(this, "lastCompletedAt", -1 / 0);
|
|
927
|
+
u(this, "lastLatencyMs", Number.NaN);
|
|
923
928
|
this.host = r, this.splatIndexAttribute = r.splatIndexAttribute, this.worker = new Rs(), this.worker.onmessage = (t) => {
|
|
924
929
|
this.applyOrder(t.data.order);
|
|
925
930
|
}, this.worker.onerror = (t) => {
|
|
@@ -932,7 +937,7 @@ class Ms {
|
|
|
932
937
|
}
|
|
933
938
|
sort(r, e, t) {
|
|
934
939
|
if (this.disposed || this.inFlight) return !1;
|
|
935
|
-
this.inFlight = !0, this.pushCenters(this.host.takeDirtyRows());
|
|
940
|
+
this.inFlight = !0, this.submittedCount++, this.lastSubmittedAt = performance.now(), this.pushCenters(this.host.takeDirtyRows());
|
|
936
941
|
const n = this.host.getActiveSpans();
|
|
937
942
|
this.sentSpans = n;
|
|
938
943
|
const s = {
|
|
@@ -943,6 +948,16 @@ class Ms {
|
|
|
943
948
|
};
|
|
944
949
|
return this.worker.postMessage(s), !0;
|
|
945
950
|
}
|
|
951
|
+
/** Internal timing diagnostics used by the demo's opt-in XR A/B harness. */
|
|
952
|
+
snapshot() {
|
|
953
|
+
return {
|
|
954
|
+
submittedCount: this.submittedCount,
|
|
955
|
+
completedCount: this.completedCount,
|
|
956
|
+
lastSubmittedAt: this.lastSubmittedAt,
|
|
957
|
+
lastCompletedAt: this.lastCompletedAt,
|
|
958
|
+
lastLatencyMs: this.lastLatencyMs
|
|
959
|
+
};
|
|
960
|
+
}
|
|
946
961
|
dispose() {
|
|
947
962
|
this.disposed || (this.disposed = !0, this.worker.terminate());
|
|
948
963
|
}
|
|
@@ -960,7 +975,7 @@ class Ms {
|
|
|
960
975
|
}
|
|
961
976
|
applyOrder(r) {
|
|
962
977
|
var s, o;
|
|
963
|
-
if (this.inFlight = !1, this.disposed) return;
|
|
978
|
+
if (this.inFlight = !1, this.completedCount++, this.lastCompletedAt = performance.now(), this.lastLatencyMs = this.lastCompletedAt - this.lastSubmittedAt, this.disposed) return;
|
|
964
979
|
const e = this.host.getActiveSpans(), t = this.sentSpans;
|
|
965
980
|
if (this.sentSpans = null, !t || t.length !== e.length) return;
|
|
966
981
|
for (let a = 0; a < t.length; a++)
|
|
@@ -1063,7 +1078,7 @@ function Ds(i, r, e, t, n) {
|
|
|
1063
1078
|
const s = e / -Wn.z;
|
|
1064
1079
|
return n.copy(it.ray.origin).addScaledVector(it.ray.direction, s), { point: n, distance: n.distanceTo(it.ray.origin) };
|
|
1065
1080
|
}
|
|
1066
|
-
const
|
|
1081
|
+
const Ht = new p.Vector2();
|
|
1067
1082
|
function pn(i, r) {
|
|
1068
1083
|
var c;
|
|
1069
1084
|
const e = r.xr;
|
|
@@ -1073,7 +1088,7 @@ function pn(i, r) {
|
|
|
1073
1088
|
if (!n) return null;
|
|
1074
1089
|
const s = n.viewport;
|
|
1075
1090
|
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(
|
|
1091
|
+
return (!(o > 0) || !(a > 0)) && (r.getDrawingBufferSize(Ht), o = Ht.x, a = Ht.y), { head: t, eye: n, width: o, height: a };
|
|
1077
1092
|
}
|
|
1078
1093
|
function Us(i) {
|
|
1079
1094
|
return i.isArrayCamera === !0;
|
|
@@ -1142,17 +1157,17 @@ class _s {
|
|
|
1142
1157
|
this.ensureResources(e);
|
|
1143
1158
|
const l = this.target, h = this.proxy, d = this.pickCamera;
|
|
1144
1159
|
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
|
|
1160
|
+
const f = "near" in e && typeof e.near == "number" ? e.near : 0.1, g = "far" in e && typeof e.far == "number" ? e.far : 1e3;
|
|
1161
|
+
this.near.value = f, this.far.value = g, this.alphaThreshold.value = (n == null ? void 0 : n.alphaThreshold) !== void 0 ? n.alphaThreshold : 0.1;
|
|
1162
|
+
const w = this.host.mesh, m = t.getRenderTarget(), y = t.getScissorTest();
|
|
1148
1163
|
t.getClearColor(this.savedClearColor);
|
|
1149
|
-
const
|
|
1150
|
-
h.matrix.copy(
|
|
1164
|
+
const v = t.getClearAlpha(), S = t.autoClear;
|
|
1165
|
+
h.matrix.copy(w.matrixWorld), h.matrixWorld.copy(w.matrixWorld), h.visible = this.host.getPickVisible(), h.layers.mask = w.layers.mask, h.renderOrder = w.renderOrder, l.viewport.set(0, 0, 1, 1), l.scissor.set(0, 0, 1, 1);
|
|
1151
1166
|
const R = (() => {
|
|
1152
1167
|
try {
|
|
1153
1168
|
return t.setRenderTarget(l), t.setScissorTest(!1), t.setClearColor(0, 0), t.autoClear = !0, t.clear(), t.setScissorTest(!0), t.autoClear = !1, t.render(this.scene, d), t.readRenderTargetPixelsAsync(l, 0, 0, 1, 1);
|
|
1154
1169
|
} finally {
|
|
1155
|
-
this.host.setView(e, s, o), t.setRenderTarget(
|
|
1170
|
+
this.host.setView(e, s, o), t.setRenderTarget(m), t.setScissorTest(y), t.setClearColor(this.savedClearColor, v), t.autoClear = S;
|
|
1156
1171
|
}
|
|
1157
1172
|
})();
|
|
1158
1173
|
let k;
|
|
@@ -1163,9 +1178,9 @@ class _s {
|
|
|
1163
1178
|
throw W;
|
|
1164
1179
|
}
|
|
1165
1180
|
if (this.host.isDisposed()) return null;
|
|
1166
|
-
const M = k[0], x = k[1],
|
|
1181
|
+
const M = k[0], x = k[1], b = k[2];
|
|
1167
1182
|
if (k[3] === 0) return null;
|
|
1168
|
-
const P = Ls(Fs(M, x,
|
|
1183
|
+
const P = Ls(Fs(M, x, b), f, g), { point: U, distance: L } = Ds(r.x, r.y, P, e, this.point);
|
|
1169
1184
|
return { point: U.clone(), distance: L };
|
|
1170
1185
|
}
|
|
1171
1186
|
ensureResources(r) {
|
|
@@ -1207,7 +1222,7 @@ function Wr() {
|
|
|
1207
1222
|
return r.needsUpdate = !0, r.magFilter = p.NearestFilter, r.minFilter = p.NearestFilter, r.generateMipmaps = !1, r;
|
|
1208
1223
|
}
|
|
1209
1224
|
const Vs = 1024, Ns = 1 << 21;
|
|
1210
|
-
class
|
|
1225
|
+
class zs {
|
|
1211
1226
|
/**
|
|
1212
1227
|
* @param centers - The pool's CPU centers (stride 4: x,y,z,_ per splat).
|
|
1213
1228
|
* @param poolIndices - The pool indices to index (e.g. the active list).
|
|
@@ -1232,36 +1247,36 @@ class Os {
|
|
|
1232
1247
|
return;
|
|
1233
1248
|
}
|
|
1234
1249
|
const n = [1 / 0, 1 / 0, 1 / 0], s = [-1 / 0, -1 / 0, -1 / 0];
|
|
1235
|
-
for (let
|
|
1236
|
-
const
|
|
1250
|
+
for (let w = 0; w < t; w++) {
|
|
1251
|
+
const m = e[w] * 4;
|
|
1237
1252
|
for (let y = 0; y < 3; y++) {
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1253
|
+
const v = r[m + y];
|
|
1254
|
+
v < n[y] && (n[y] = v), v > s[y] && (s[y] = v);
|
|
1240
1255
|
}
|
|
1241
1256
|
}
|
|
1242
1257
|
const o = [
|
|
1243
1258
|
s[0] - n[0],
|
|
1244
1259
|
s[1] - n[1],
|
|
1245
1260
|
s[2] - n[2]
|
|
1246
|
-
], a = o.filter((
|
|
1261
|
+
], a = o.filter((w) => w > 0), c = a.reduce((w, m) => w * m, 1);
|
|
1247
1262
|
let l = a.length > 0 ? Math.pow(c / t, 1 / a.length) : 1;
|
|
1248
1263
|
(!(l > 0) || !Number.isFinite(l)) && (l = 1);
|
|
1249
|
-
const h = (
|
|
1250
|
-
for (let
|
|
1251
|
-
const y = o[
|
|
1252
|
-
this.dims[
|
|
1264
|
+
const h = (w) => {
|
|
1265
|
+
for (let m = 0; m < 3; m++) {
|
|
1266
|
+
const y = o[m];
|
|
1267
|
+
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
1268
|
}
|
|
1254
1269
|
};
|
|
1255
1270
|
for (h(l); this.dims[0] * this.dims[1] * this.dims[2] > Ns; )
|
|
1256
1271
|
l *= 1.5, h(l);
|
|
1257
1272
|
const d = this.dims[0] * this.dims[1] * this.dims[2], f = new Int32Array(d + 1);
|
|
1258
|
-
for (let
|
|
1259
|
-
for (let
|
|
1273
|
+
for (let w = 0; w < t; w++) f[this.cellOf(e[w]) + 1]++;
|
|
1274
|
+
for (let w = 0; w < d; w++) f[w + 1] += f[w];
|
|
1260
1275
|
this.cellStart = f, this.items = new Uint32Array(t);
|
|
1261
|
-
const
|
|
1262
|
-
for (let
|
|
1263
|
-
const
|
|
1264
|
-
this.items[
|
|
1276
|
+
const g = Int32Array.from(f.subarray(0, d));
|
|
1277
|
+
for (let w = 0; w < t; w++) {
|
|
1278
|
+
const m = e[w];
|
|
1279
|
+
this.items[g[this.cellOf(m)]++] = m;
|
|
1265
1280
|
}
|
|
1266
1281
|
}
|
|
1267
1282
|
/** The cell index of pool splat `p`, clamped into range. */
|
|
@@ -1288,9 +1303,9 @@ class Os {
|
|
|
1288
1303
|
}
|
|
1289
1304
|
for (let h = a[2]; h <= c[2]; h++)
|
|
1290
1305
|
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[
|
|
1306
|
+
const f = (h * this.dims[1] + d) * this.dims[0], g = this.cellStart[f + a[0]], w = this.cellStart[f + c[0] + 1];
|
|
1307
|
+
for (let m = g; m < w; m++) {
|
|
1308
|
+
const y = this.items[m], v = y * 4, S = this.centers[v] - r, R = this.centers[v + 1] - e, k = this.centers[v + 2] - t, M = S * S + R * R + k * k;
|
|
1294
1309
|
M <= o && s(y, M);
|
|
1295
1310
|
}
|
|
1296
1311
|
}
|
|
@@ -1306,22 +1321,22 @@ class Os {
|
|
|
1306
1321
|
}), s < 0 ? null : { poolIndex: s, distSq: o };
|
|
1307
1322
|
}
|
|
1308
1323
|
}
|
|
1309
|
-
const
|
|
1324
|
+
const Os = 4, Q = class Q extends p.Mesh {
|
|
1310
1325
|
constructor(e, t = {}) {
|
|
1311
1326
|
var L, W;
|
|
1312
|
-
const n = Dr(t.sortIntervalMs), s = ((L = rs()) == null ? void 0 : L.isMobile) === !0, o =
|
|
1327
|
+
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
1328
|
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,
|
|
1329
|
+
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
1330
|
capacity: l,
|
|
1316
1331
|
floatTextures: t.poolFloatTextures,
|
|
1317
1332
|
packedShBands: d,
|
|
1318
1333
|
packedShTextureCount: d === 0 ? 0 : Math.ceil(cn(d) / 4),
|
|
1319
1334
|
...t.maxTextureSize === void 0 ? {} : { maxTextureSize: t.maxTextureSize }
|
|
1320
|
-
}),
|
|
1321
|
-
|
|
1335
|
+
}), w = f !== void 0 && d !== f.packedShBands;
|
|
1336
|
+
w && me(
|
|
1322
1337
|
`a mesh with shBands ${d} cannot share a pool built for ${f == null ? void 0 : f.packedShBands}; it allocated its own pool instead.`
|
|
1323
1338
|
);
|
|
1324
|
-
const
|
|
1339
|
+
const m = f === void 0 || w, y = m ? g() : f, v = Math.min(
|
|
1325
1340
|
y.capacity,
|
|
1326
1341
|
Math.ceil(l / Q.DATA_TEXTURE_WIDTH) * Q.DATA_TEXTURE_WIDTH
|
|
1327
1342
|
), S = y.centersTexture, R = y.colorsTexture, k = y.covarianceATexture, M = y.covarianceBTexture, x = c && e.sh && h ? lt(
|
|
@@ -1329,13 +1344,13 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1329
1344
|
e.sh.paletteWidth,
|
|
1330
1345
|
e.sh.paletteHeight,
|
|
1331
1346
|
p.FloatType
|
|
1332
|
-
) : null,
|
|
1347
|
+
) : null, b = y.shPackedTextures, A = new p.InstancedBufferGeometry();
|
|
1333
1348
|
A.setIndex([0, 1, 2, 0, 2, 3]), A.setAttribute(
|
|
1334
1349
|
"position",
|
|
1335
1350
|
new p.BufferAttribute(new Float32Array([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]), 3)
|
|
1336
1351
|
);
|
|
1337
|
-
const P = new Float32Array(
|
|
1338
|
-
for (let B = 0; B <
|
|
1352
|
+
const P = new Float32Array(v);
|
|
1353
|
+
for (let B = 0; B < v; B++) P[B] = B;
|
|
1339
1354
|
const U = new p.StorageInstancedBufferAttribute(P, 1);
|
|
1340
1355
|
A.setAttribute("splatIndex", U), A.instanceCount = 0;
|
|
1341
1356
|
super(A, new p.NodeMaterial());
|
|
@@ -1547,12 +1562,12 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1547
1562
|
u(this, "orientation");
|
|
1548
1563
|
/** Set once the pool has been checked against the device texture limit. */
|
|
1549
1564
|
u(this, "textureLimitChecked", !1);
|
|
1550
|
-
if (this.pool = y, this.ownsPool =
|
|
1565
|
+
if (this.pool = y, this.ownsPool = m, y.register(this), this.sortScheduler = new Ur(n, s), this.sortStrategy = t.sortStrategy ?? "counting", this.sortStrategy === "radix" && this.ensureRadixSorter(), this.performanceProfileValue = rn(t.performanceProfile), this.maxStdDevValue = o, this.minSplatSizePx = a, this.antialias = t.antialias ?? (c ? e.antialias ?? !1 : !1), this.projectedFilterProfile = t.projectedFilterProfile ?? "default", this.srgbOutput = t.srgbOutput ?? !1, this.maxSplatScreenRadius = Xt(t.maxSplatScreenRadius), this.minSplatScreenRadius = Xt(t.minSplatScreenRadius), this.screenBandMin.value = this.minSplatScreenRadius, this.screenBandMax.value = this.maxSplatScreenRadius, this.foveationMode = t.foveationMode ?? "band", this.foveationTargetPx = Hs(t.foveationTargetPx), this.foveationDrawBudget = Ys(t.foveationDrawBudget), this.foveationLimitPx = this.foveationTargetPx, this.maxSplatAspect = Xt(t.maxSplatAspect), this.lodAlpha = t.lodAlpha ?? !1, this.orientation = t.orientation ?? "y-up", this.splatIndexAttribute = U, this.sourceIndexAttribute = new p.StorageBufferAttribute(new Uint32Array(v), 1), this.dataTextures = y.coreTextures, this.isStatic = c, this.shEnabled = x !== null, this.shRange = { min: Ln(), max: Ln() }, this.frustumCulled = !1, x && (this.dataTextures = [...this.dataTextures, x]), b.length > 0 && (this.dataTextures = [...this.dataTextures, ...b]), this.materialInputs = {
|
|
1551
1566
|
textures: { centersTexture: S, colorsTexture: R, covarianceATexture: k, covarianceBTexture: M },
|
|
1552
1567
|
sh: c && e.sh && x ? { mode: "palette", bands: e.sh.bands, paletteTexture: x } : d !== 0 ? {
|
|
1553
1568
|
mode: "packed",
|
|
1554
1569
|
bands: d,
|
|
1555
|
-
textures:
|
|
1570
|
+
textures: b,
|
|
1556
1571
|
range: this.shRange
|
|
1557
1572
|
} : null
|
|
1558
1573
|
}, this.buildMaterial(this.materialInputs.textures, this.materialInputs.sh), c) {
|
|
@@ -1640,7 +1655,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1640
1655
|
* graph, same convention as {@link setPerformanceProfile}.
|
|
1641
1656
|
*/
|
|
1642
1657
|
setMaxStdDev(e) {
|
|
1643
|
-
const t =
|
|
1658
|
+
const t = On(e);
|
|
1644
1659
|
t === void 0 || t === this.maxStdDevValue || (this.maxStdDevValue = t, this.cachedUnifiedView = null, this.buildMaterial(this.materialInputs.textures, this.materialInputs.sh));
|
|
1645
1660
|
}
|
|
1646
1661
|
/**
|
|
@@ -1684,7 +1699,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1684
1699
|
const o = s.start + n;
|
|
1685
1700
|
this.writeSplatRows(o, t);
|
|
1686
1701
|
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),
|
|
1702
|
+
this.markRowsWritten(c, l - c + 1), Je.setFromArray(t.positions), this.localBounds.union(Je), this.boundsDirty = !0;
|
|
1688
1703
|
}
|
|
1689
1704
|
/**
|
|
1690
1705
|
* Overwrites splats at `offset` within a range **in place** - unlike
|
|
@@ -1703,7 +1718,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1703
1718
|
const o = s.start + n;
|
|
1704
1719
|
this.writeSplatRows(o, t);
|
|
1705
1720
|
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),
|
|
1721
|
+
this.markRowsWritten(c, l - c + 1), Je.setFromArray(t.positions), this.localBounds.union(Je), this.boundsDirty = !0, this.contentRevision++;
|
|
1707
1722
|
}
|
|
1708
1723
|
/**
|
|
1709
1724
|
* Zeros splats `[offset, offset + count)` of a range so they draw nothing
|
|
@@ -1718,8 +1733,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1718
1733
|
throw new RangeError("SplatMesh.degenerateRange: range out of bounds.");
|
|
1719
1734
|
const o = s.start + t, { centers: a, colors: c, covarianceA: l, covarianceB: h } = this.backing;
|
|
1720
1735
|
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,
|
|
1736
|
+
const d = Q.DATA_TEXTURE_WIDTH, f = Math.floor(o / d), g = Math.floor((o + n - 1) / d);
|
|
1737
|
+
this.markRowsWritten(f, g - f + 1), this.contentRevision++;
|
|
1723
1738
|
}
|
|
1724
1739
|
/**
|
|
1725
1740
|
* Copies one chunk's splats into the pool's backing arrays at `destination`.
|
|
@@ -1730,9 +1745,9 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1730
1745
|
const { centers: n, colors: s, covarianceA: o, covarianceB: a } = this.backing;
|
|
1731
1746
|
s.set(t.colors, e * 4);
|
|
1732
1747
|
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[
|
|
1748
|
+
for (let g = 0; g < c; g++) {
|
|
1749
|
+
const w = (e + g) * 4, m = g * 3, y = g * 6;
|
|
1750
|
+
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
1751
|
}
|
|
1737
1752
|
this.writePackedSh(e, t);
|
|
1738
1753
|
}
|
|
@@ -1872,7 +1887,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
1872
1887
|
this.ranges.set(c, l), this.markRowsWritten(o, s);
|
|
1873
1888
|
for (const h of this.channels.values())
|
|
1874
1889
|
h.backing.fill(h.fill, a, a + s * n), h.pendingRows.push({ start: o, count: s });
|
|
1875
|
-
return
|
|
1890
|
+
return Je.setFromArray(e.positions), this.localBounds.union(Je), this.boundsDirty = !0, t && this.activateRecord(l), this.contentRevision++, c;
|
|
1876
1891
|
}
|
|
1877
1892
|
/**
|
|
1878
1893
|
* Deactivates a previously appended range and frees its pool rows for
|
|
@@ -2289,8 +2304,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2289
2304
|
this.splatWorldPosition(d, Me);
|
|
2290
2305
|
const f = e.y - Me.y;
|
|
2291
2306
|
if (f < 0 || f > t) return;
|
|
2292
|
-
const
|
|
2293
|
-
|
|
2307
|
+
const g = Me.x - e.x, w = Me.z - e.z;
|
|
2308
|
+
g * g + w * w > a || Me.y > c && (c = Me.y, l = d);
|
|
2294
2309
|
}), l < 0) return null;
|
|
2295
2310
|
const h = this.splatWorldPosition(l, new p.Vector3());
|
|
2296
2311
|
return { point: h, drop: e.y - h.y };
|
|
@@ -2340,7 +2355,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2340
2355
|
ensureQueryGrid() {
|
|
2341
2356
|
if (this.queryGrid && this.queryGridEpoch === this.queryEpoch) return this.queryGrid;
|
|
2342
2357
|
const e = this.sourceIndexAttribute.array.subarray(0, this.activeCount);
|
|
2343
|
-
return this.queryGrid = new
|
|
2358
|
+
return this.queryGrid = new zs(this.backing.centers, e, this.activeCount), this.queryGridEpoch = this.queryEpoch, this.queryGrid;
|
|
2344
2359
|
}
|
|
2345
2360
|
/** World-space position of pool splat `poolIndex`, written into `out`. */
|
|
2346
2361
|
splatWorldPosition(e, t) {
|
|
@@ -2378,7 +2393,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2378
2393
|
this.channels.clear();
|
|
2379
2394
|
for (const t of this.uploadStaging.values())
|
|
2380
2395
|
for (const n of t.values()) n.dispose();
|
|
2381
|
-
this.uploadStaging.clear(), this.halfEncodeBuffers.clear(), this.lastRenderer && (
|
|
2396
|
+
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
2397
|
}
|
|
2383
2398
|
}
|
|
2384
2399
|
/** Matches the viewport / focal / local-camera uniforms written by {@link update}. */
|
|
@@ -2427,23 +2442,23 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2427
2442
|
const o = this.foveationLimitPx / s;
|
|
2428
2443
|
e.getWorldPosition(ot), this.worldToLocal(ot), Vn.copy(e.matrixWorld).invert(), Nn.multiplyMatrices(Vn, this.matrixWorld).premultiply(e.projectionMatrix);
|
|
2429
2444
|
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 +=
|
|
2432
|
-
const
|
|
2445
|
+
let f = 0, g = 0;
|
|
2446
|
+
for (let y = 0; y < d; y += zn) {
|
|
2447
|
+
const v = y * 4, S = l[v + 3];
|
|
2433
2448
|
if (S === 0) continue;
|
|
2434
2449
|
f++;
|
|
2435
|
-
const R = h[
|
|
2436
|
-
if (a[2] * R + a[6] * k + a[10] * M + a[14] <= -
|
|
2450
|
+
const R = h[v], k = h[v + 1], M = h[v + 2], b = (a[3] * R + a[7] * k + a[11] * M + a[15]) * 1.2;
|
|
2451
|
+
if (a[2] * R + a[6] * k + a[10] * M + a[14] <= -b) continue;
|
|
2437
2452
|
const P = a[0] * R + a[4] * k + a[8] * M + a[12];
|
|
2438
|
-
if (P >
|
|
2453
|
+
if (P > b || P < -b) continue;
|
|
2439
2454
|
const U = a[1] * R + a[5] * k + a[9] * M + a[13];
|
|
2440
|
-
if (U >
|
|
2441
|
-
const L = c[
|
|
2442
|
-
E > $ && N <= $ &&
|
|
2455
|
+
if (U > b || U < -b) continue;
|
|
2456
|
+
const L = c[v] + c[v + 3] + l[v + 1], W = 2 * Math.sqrt(Math.max(L, 0) / 3), B = S < 0, E = Math.abs(S), T = R - ot.x, O = k - ot.y, F = M - ot.z, $ = o * Math.sqrt(T * T + O * O + F * F), N = B ? 0 : W;
|
|
2457
|
+
E > $ && N <= $ && g++;
|
|
2443
2458
|
}
|
|
2444
2459
|
if (f === 0) return;
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2460
|
+
const w = g * zn, m = this.foveationDrawBudget;
|
|
2461
|
+
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
2462
|
}
|
|
2448
2463
|
/** Records a written row span for GPU upload and the sort-worker mirror. */
|
|
2449
2464
|
markRowsWritten(e, t) {
|
|
@@ -2505,9 +2520,9 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2505
2520
|
/** Uploads only the changed packed slots and invalidates the current depth order. */
|
|
2506
2521
|
commitActiveListMutation(e, t) {
|
|
2507
2522
|
var n;
|
|
2508
|
-
if (t > 0 && (
|
|
2523
|
+
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
2524
|
const s = this.sourceIndexAttribute.array, o = this.splatIndexAttribute.array;
|
|
2510
|
-
this.drawListSorted ? (o.set(s.subarray(0, this.activeCount)), this.activeCount > 0 &&
|
|
2525
|
+
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
2526
|
}
|
|
2512
2527
|
this.geometry.instanceCount = this.activeCount, this.activeListVersion++, this.sortScheduler.invalidateContent();
|
|
2513
2528
|
}
|
|
@@ -2592,7 +2607,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2592
2607
|
*/
|
|
2593
2608
|
syncHalfFloatPoolImages() {
|
|
2594
2609
|
const e = this.dataTextures[0], t = this.dataTextures[2], n = e.image.data, s = t.image.data;
|
|
2595
|
-
|
|
2610
|
+
qt(this.backing.centers, n), qt(this.backing.covarianceA, s), e.needsUpdate = !0, t.needsUpdate = !0;
|
|
2596
2611
|
}
|
|
2597
2612
|
/**
|
|
2598
2613
|
* Uploads the given row spans of one or more same-layout pool textures via
|
|
@@ -2607,23 +2622,23 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2607
2622
|
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
2623
|
}
|
|
2609
2624
|
for (const h of l)
|
|
2610
|
-
for (const { key: d, texture: f, data:
|
|
2611
|
-
const y =
|
|
2625
|
+
for (const { key: d, texture: f, data: g, type: w, encodeHalf: m } of o) {
|
|
2626
|
+
const y = g.subarray(
|
|
2612
2627
|
h.start * a * s,
|
|
2613
2628
|
(h.start + h.count) * a * s
|
|
2614
2629
|
);
|
|
2615
|
-
let
|
|
2616
|
-
if (
|
|
2630
|
+
let v = y;
|
|
2631
|
+
if (m) {
|
|
2617
2632
|
const R = this.acquireHalfEncodeBuffer(d, y.length);
|
|
2618
|
-
|
|
2633
|
+
qt(y, R, 0, y.length), v = R;
|
|
2619
2634
|
}
|
|
2620
2635
|
const S = this.acquireUploadStaging(
|
|
2621
2636
|
d,
|
|
2622
|
-
|
|
2637
|
+
v,
|
|
2623
2638
|
a,
|
|
2624
2639
|
h.count,
|
|
2625
2640
|
n,
|
|
2626
|
-
|
|
2641
|
+
w
|
|
2627
2642
|
);
|
|
2628
2643
|
e.copyTextureToTexture(S, f, null, Gs.set(0, h.start));
|
|
2629
2644
|
}
|
|
@@ -2649,7 +2664,7 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2649
2664
|
if (l)
|
|
2650
2665
|
return l.image = { data: t, width: n, height: s }, l.needsUpdate = !0, c.delete(s), c.set(s, l), l;
|
|
2651
2666
|
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 >
|
|
2667
|
+
if (o === p.RGBAIntegerFormat && (h.magFilter = p.NearestFilter, h.minFilter = p.NearestFilter), h.needsUpdate = !0, c.set(s, h), c.size > Os) {
|
|
2653
2668
|
const f = c.keys().next().value;
|
|
2654
2669
|
(d = c.get(f)) == null || d.dispose(), c.delete(f);
|
|
2655
2670
|
}
|
|
@@ -2807,8 +2822,8 @@ const zs = 4, Q = class Q extends p.Mesh {
|
|
|
2807
2822
|
};
|
|
2808
2823
|
u(Q, "DATA_TEXTURE_WIDTH", wt);
|
|
2809
2824
|
let pt = Q;
|
|
2810
|
-
const
|
|
2811
|
-
function
|
|
2825
|
+
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;
|
|
2826
|
+
function On(i) {
|
|
2812
2827
|
if (i !== void 0 && (!Number.isFinite(i) || i <= 0))
|
|
2813
2828
|
throw new RangeError("SplatMesh maxStdDev must be a finite number greater than 0.");
|
|
2814
2829
|
return i;
|
|
@@ -2818,7 +2833,7 @@ function js(i) {
|
|
|
2818
2833
|
throw new RangeError("SplatMesh minSplatSizePx must be a finite number >= 0.");
|
|
2819
2834
|
return i;
|
|
2820
2835
|
}
|
|
2821
|
-
function
|
|
2836
|
+
function Xt(i) {
|
|
2822
2837
|
if (i === void 0) return 0;
|
|
2823
2838
|
if (!Number.isFinite(i) || i < 0)
|
|
2824
2839
|
throw new RangeError("SplatMesh screen-radius cull must be a finite number ≥ 0.");
|
|
@@ -2849,59 +2864,60 @@ function Zs(i) {
|
|
|
2849
2864
|
})).sort((r, e) => r.leafStart - e.leafStart);
|
|
2850
2865
|
}
|
|
2851
2866
|
function Qs(i, r) {
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
return h || (h = { adds: [], removes: [] }, o.set(l, h)), h;
|
|
2867
|
+
const e = [...i, ...r.map(([, s]) => s.run)];
|
|
2868
|
+
if (e.length > 0 && e.every((s) => s.coverageGroup !== void 0)) {
|
|
2869
|
+
const s = /* @__PURE__ */ new Map(), o = (c) => {
|
|
2870
|
+
let l = s.get(c);
|
|
2871
|
+
return l || (l = { adds: [], removes: [] }, s.set(c, l)), l;
|
|
2858
2872
|
};
|
|
2859
|
-
for (const
|
|
2860
|
-
|
|
2861
|
-
for (const
|
|
2862
|
-
|
|
2863
|
-
const
|
|
2864
|
-
for (const
|
|
2865
|
-
const
|
|
2866
|
-
const w =
|
|
2867
|
-
let
|
|
2868
|
-
return
|
|
2873
|
+
for (const c of i)
|
|
2874
|
+
o(c.coverageGroup).adds.push(c);
|
|
2875
|
+
for (const c of r)
|
|
2876
|
+
o(c[1].run.coverageGroup).removes.push(c);
|
|
2877
|
+
const a = [];
|
|
2878
|
+
for (const c of s.values()) {
|
|
2879
|
+
const l = /* @__PURE__ */ new Map(), h = (f, g) => `${f}:${g}`, d = (f, g) => {
|
|
2880
|
+
const w = h(f, g);
|
|
2881
|
+
let m = l.get(w);
|
|
2882
|
+
return m || (m = { adds: [], removes: [], leafStart: f, leafEnd: g, addCount: 0 }, l.set(w, m)), m;
|
|
2869
2883
|
};
|
|
2870
|
-
for (const
|
|
2871
|
-
const g = f
|
|
2872
|
-
g.adds.push(
|
|
2884
|
+
for (const f of c.adds) {
|
|
2885
|
+
const g = d(f.leafStart, f.leafEnd);
|
|
2886
|
+
g.adds.push(f), g.addCount += f.count;
|
|
2873
2887
|
}
|
|
2874
|
-
for (const
|
|
2875
|
-
const g =
|
|
2876
|
-
w.removes.push(
|
|
2888
|
+
for (const f of c.removes) {
|
|
2889
|
+
const g = f[1].run, w = d(g.leafStart, g.leafEnd);
|
|
2890
|
+
w.removes.push(f), w.leafStart = Math.min(w.leafStart, g.leafStart), w.leafEnd = Math.max(w.leafEnd, g.leafEnd);
|
|
2877
2891
|
}
|
|
2878
|
-
|
|
2892
|
+
a.push(...l.values());
|
|
2879
2893
|
}
|
|
2880
|
-
return
|
|
2894
|
+
return a.sort((c, l) => c.leafStart - l.leafStart);
|
|
2881
2895
|
}
|
|
2882
2896
|
const t = [
|
|
2883
|
-
...i.map((
|
|
2884
|
-
start:
|
|
2885
|
-
end:
|
|
2886
|
-
add:
|
|
2897
|
+
...i.map((s) => ({
|
|
2898
|
+
start: s.leafStart,
|
|
2899
|
+
end: s.leafEnd,
|
|
2900
|
+
add: s,
|
|
2887
2901
|
remove: void 0
|
|
2888
2902
|
})),
|
|
2889
|
-
...r.map((
|
|
2890
|
-
start:
|
|
2891
|
-
end:
|
|
2903
|
+
...r.map((s) => ({
|
|
2904
|
+
start: s[1].run.leafStart,
|
|
2905
|
+
end: s[1].run.leafEnd,
|
|
2892
2906
|
add: void 0,
|
|
2893
|
-
remove:
|
|
2907
|
+
remove: s
|
|
2894
2908
|
}))
|
|
2895
|
-
].sort((
|
|
2896
|
-
for (const
|
|
2897
|
-
const
|
|
2898
|
-
|
|
2899
|
-
adds:
|
|
2900
|
-
removes:
|
|
2901
|
-
leafStart:
|
|
2902
|
-
leafEnd:
|
|
2903
|
-
addCount:
|
|
2909
|
+
].sort((s, o) => s.start - o.start || o.end - s.end), n = [];
|
|
2910
|
+
for (const s of t) {
|
|
2911
|
+
const o = n[n.length - 1];
|
|
2912
|
+
(!o || s.start >= o.leafEnd) && n.push({
|
|
2913
|
+
adds: [],
|
|
2914
|
+
removes: [],
|
|
2915
|
+
leafStart: s.start,
|
|
2916
|
+
leafEnd: s.end,
|
|
2917
|
+
addCount: 0
|
|
2904
2918
|
});
|
|
2919
|
+
const a = n[n.length - 1];
|
|
2920
|
+
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
2921
|
}
|
|
2906
2922
|
return n;
|
|
2907
2923
|
}
|
|
@@ -2932,6 +2948,8 @@ function ei(i, r) {
|
|
|
2932
2948
|
}
|
|
2933
2949
|
function $n(i) {
|
|
2934
2950
|
switch (i) {
|
|
2951
|
+
case "environment":
|
|
2952
|
+
return -1;
|
|
2935
2953
|
case "finest-target":
|
|
2936
2954
|
return 0;
|
|
2937
2955
|
case "coverage":
|
|
@@ -2949,8 +2967,9 @@ function mt(i, r) {
|
|
|
2949
2967
|
return i.coverageGroup < 0 ? `file:${r}` : i.phase === "finest-target" ? `cell:${i.coverageGroup}` : `slice:${i.coverageGroup}:${i.leafStart}:${i.leafEnd}`;
|
|
2950
2968
|
}
|
|
2951
2969
|
function ni(i, r = 10, e = !1) {
|
|
2952
|
-
const t =
|
|
2970
|
+
const t = vn(r), n = /* @__PURE__ */ new Map();
|
|
2953
2971
|
for (const [s, o] of i) {
|
|
2972
|
+
if (o.phase === "environment") continue;
|
|
2954
2973
|
const a = mt(o, s), c = n.get(a);
|
|
2955
2974
|
if (!c) {
|
|
2956
2975
|
n.set(a, {
|
|
@@ -2965,13 +2984,17 @@ function ni(i, r = 10, e = !1) {
|
|
|
2965
2984
|
o.distance < c.distance && (c.distance = o.distance), o.inView && (c.inView = !0), o.screenImportance < c.screenImportance && (c.screenImportance = o.screenImportance), o.phase === "finest-target" && (c.finest = !0), c.count++;
|
|
2966
2985
|
}
|
|
2967
2986
|
for (const [s, o] of i) {
|
|
2987
|
+
if (o.phase === "environment") {
|
|
2988
|
+
o.kind = "priority", o.groupDistance = 0, o.groupPending = 1, o.groupInView = !0, o.groupScreenImportance = Number.NEGATIVE_INFINITY, o.groupFinest = !0, o.groupId = "environment", o.groupClass = 0;
|
|
2989
|
+
continue;
|
|
2990
|
+
}
|
|
2968
2991
|
const a = mt(o, s), c = n.get(a);
|
|
2969
2992
|
if (!c) continue;
|
|
2970
2993
|
const l = c.inView ? 0 : c.distance <= t ? 1 : 2, h = l === 0 || l === 1 && e ? "priority" : "base";
|
|
2971
2994
|
o.groupDistance = c.distance, o.groupPending = c.count, o.groupInView = c.inView, o.groupScreenImportance = c.screenImportance, o.groupFinest = c.finest, o.groupId = a, o.groupClass = l, o.kind = h;
|
|
2972
2995
|
}
|
|
2973
2996
|
}
|
|
2974
|
-
function
|
|
2997
|
+
function vn(i, r = 2) {
|
|
2975
2998
|
return i;
|
|
2976
2999
|
}
|
|
2977
3000
|
function ri(i) {
|
|
@@ -2980,16 +3003,16 @@ function ri(i) {
|
|
|
2980
3003
|
function si(i, r, e = 2) {
|
|
2981
3004
|
if (i.level === 0) return "finest-target";
|
|
2982
3005
|
const t = i.distance ?? Number.POSITIVE_INFINITY;
|
|
2983
|
-
return i.inView === !1 && t >
|
|
3006
|
+
return i.inView === !1 && t > vn(r) ? "background" : "target";
|
|
2984
3007
|
}
|
|
2985
3008
|
function ii(i, r, e = 2) {
|
|
2986
3009
|
const t = i.distance ?? Number.POSITIVE_INFINITY;
|
|
2987
|
-
return i.inView === !1 && t >
|
|
3010
|
+
return i.inView === !1 && t > vn(r) ? "background" : "coverage";
|
|
2988
3011
|
}
|
|
2989
3012
|
function qn(i, r, e, t) {
|
|
2990
3013
|
const n = t.distance ?? Number.POSITIVE_INFINITY, s = t.level, o = t.inView !== !1, a = t.coverageGroup ?? -1, c = t.screenImportance ?? Number.POSITIVE_INFINITY, l = ti(e), h = i.get(r);
|
|
2991
3014
|
if (!h) {
|
|
2992
|
-
const
|
|
3015
|
+
const w = mt(
|
|
2993
3016
|
{ phase: e, coverageGroup: a, leafStart: t.leafStart, leafEnd: t.leafEnd },
|
|
2994
3017
|
r
|
|
2995
3018
|
);
|
|
@@ -3008,14 +3031,14 @@ function qn(i, r, e, t) {
|
|
|
3008
3031
|
groupInView: o,
|
|
3009
3032
|
groupScreenImportance: c,
|
|
3010
3033
|
groupFinest: e === "finest-target",
|
|
3011
|
-
groupId:
|
|
3034
|
+
groupId: w,
|
|
3012
3035
|
// Provisional; finalized in stampClassicFetchGroups().
|
|
3013
3036
|
groupClass: 2
|
|
3014
3037
|
});
|
|
3015
3038
|
return;
|
|
3016
3039
|
}
|
|
3017
|
-
const d = $n(e) < $n(h.phase), f = e === h.phase && (n < h.distance || n === h.distance && s < h.level),
|
|
3018
|
-
(d || f ||
|
|
3040
|
+
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;
|
|
3041
|
+
(d || f || g) && i.set(r, {
|
|
3019
3042
|
kind: l,
|
|
3020
3043
|
phase: e,
|
|
3021
3044
|
distance: n,
|
|
@@ -3034,11 +3057,11 @@ function qn(i, r, e, t) {
|
|
|
3034
3057
|
groupClass: h.groupClass
|
|
3035
3058
|
});
|
|
3036
3059
|
}
|
|
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 ||
|
|
3060
|
+
function Yt(i, r, e, t) {
|
|
3061
|
+
const n = i.groupDistance ?? i.distance, s = r.groupDistance ?? r.distance, o = i.groupPending ?? 1, a = r.groupPending ?? 1, c = i.groupId ?? mt(i, e), l = r.groupId ?? mt(r, t), h = i.groupClass ?? (i.inView ? 0 : 2), d = r.groupClass ?? (r.inView ? 0 : 2), f = i.groupScreenImportance ?? i.screenImportance, g = r.groupScreenImportance ?? r.screenImportance, w = i.groupFinest ? 0 : 1, m = r.groupFinest ? 0 : 1, y = (R) => R === "coverage" ? 0 : R === "background" ? 2 : 1, v = i.phase === "environment" ? 0 : 1, S = r.phase === "environment" ? 0 : 1;
|
|
3062
|
+
return v - S || h - d || w - m || f - g || n - s || a - o || (c < l ? -1 : c > l ? 1 : 0) || y(i.phase) - y(r.phase) || i.level - r.level || e - t;
|
|
3040
3063
|
}
|
|
3041
|
-
function
|
|
3064
|
+
function Kt(i, r, e) {
|
|
3042
3065
|
if (r < 0 || e < 0 || r + e > i.count)
|
|
3043
3066
|
throw new Error(
|
|
3044
3067
|
`Splat range [${r}, ${r + e}) exceeds its chunk's ${i.count} splats; the manifest and chunk data disagree.`
|
|
@@ -3248,11 +3271,11 @@ const wi = [
|
|
|
3248
3271
|
{ test: (i) => i.endsWith(".rad"), format: "rad" },
|
|
3249
3272
|
{ test: (i) => i === "lod-meta.json", format: "streamed-sog" }
|
|
3250
3273
|
];
|
|
3251
|
-
function
|
|
3274
|
+
function vi(i) {
|
|
3252
3275
|
const r = [];
|
|
3253
3276
|
for (const a of i.keys()) {
|
|
3254
|
-
const c =
|
|
3255
|
-
l && Vr(a) ===
|
|
3277
|
+
const c = Dt(a).toLowerCase(), l = wi.find((h) => h.test(c));
|
|
3278
|
+
l && Vr(a) === bi(i, l) && r.push({ path: a, format: l.format });
|
|
3256
3279
|
}
|
|
3257
3280
|
if (r.length === 0)
|
|
3258
3281
|
throw new dt(
|
|
@@ -3260,7 +3283,7 @@ function bi(i) {
|
|
|
3260
3283
|
{ phase: "manifest", url: "local-folder", retryable: !1 }
|
|
3261
3284
|
);
|
|
3262
3285
|
if (r.length > 1) {
|
|
3263
|
-
const a = r.map((c) =>
|
|
3286
|
+
const a = r.map((c) => Dt(c.path)).join(", ");
|
|
3264
3287
|
throw new dt(
|
|
3265
3288
|
`That folder holds more than one scene manifest (${a}) - drop one scene at a time.`,
|
|
3266
3289
|
{ phase: "manifest", url: "local-folder", retryable: !1 }
|
|
@@ -3276,13 +3299,13 @@ function bi(i) {
|
|
|
3276
3299
|
};
|
|
3277
3300
|
return { source: {
|
|
3278
3301
|
manifestUrl: s(e.path),
|
|
3279
|
-
resolve: (a) => s(t +
|
|
3302
|
+
resolve: (a) => s(t + Zt(a)),
|
|
3280
3303
|
size: (a) => {
|
|
3281
3304
|
var c;
|
|
3282
|
-
return Promise.resolve(((c = i.get(t +
|
|
3305
|
+
return Promise.resolve(((c = i.get(t + Zt(a))) == null ? void 0 : c.size) ?? null);
|
|
3283
3306
|
},
|
|
3284
3307
|
directoryFiles: (a) => {
|
|
3285
|
-
const c = t +
|
|
3308
|
+
const c = t + Zt(a).replace(/\/?$/, "/"), l = {};
|
|
3286
3309
|
for (const h of i.keys()) {
|
|
3287
3310
|
if (!h.startsWith(c)) continue;
|
|
3288
3311
|
const d = s(h);
|
|
@@ -3294,21 +3317,21 @@ function bi(i) {
|
|
|
3294
3317
|
for (const a of n.values()) URL.revokeObjectURL(a);
|
|
3295
3318
|
n.clear();
|
|
3296
3319
|
}
|
|
3297
|
-
}, format: e.format, name:
|
|
3320
|
+
}, format: e.format, name: Dt(e.path) };
|
|
3298
3321
|
}
|
|
3299
|
-
function
|
|
3322
|
+
function Zt(i) {
|
|
3300
3323
|
return i.replace(/^\.?\//, "");
|
|
3301
3324
|
}
|
|
3302
|
-
function
|
|
3325
|
+
function Dt(i) {
|
|
3303
3326
|
return i.slice(i.lastIndexOf("/") + 1);
|
|
3304
3327
|
}
|
|
3305
3328
|
function Vr(i) {
|
|
3306
3329
|
return i.split("/").length - 1;
|
|
3307
3330
|
}
|
|
3308
|
-
function
|
|
3331
|
+
function bi(i, r) {
|
|
3309
3332
|
let e = 1 / 0;
|
|
3310
3333
|
for (const t of i.keys())
|
|
3311
|
-
r.test(
|
|
3334
|
+
r.test(Dt(t).toLowerCase()) && (e = Math.min(e, Vr(t)));
|
|
3312
3335
|
return e;
|
|
3313
3336
|
}
|
|
3314
3337
|
const Nr = `var bt = Object.defineProperty;
|
|
@@ -4992,7 +5015,7 @@ class Qn {
|
|
|
4992
5015
|
(n = t.onProgress) == null || n.call(t, e.data.loaded, e.data.total);
|
|
4993
5016
|
return;
|
|
4994
5017
|
}
|
|
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(
|
|
5018
|
+
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
5019
|
}
|
|
4997
5020
|
}, this.worker.onerror = (e) => {
|
|
4998
5021
|
if (this.workerFailure) return;
|
|
@@ -5005,8 +5028,8 @@ class Qn {
|
|
|
5005
5028
|
}
|
|
5006
5029
|
/** Posts one load to this worker and tracks its pending promise. */
|
|
5007
5030
|
request(r, e, t) {
|
|
5008
|
-
if (this.disposed) return Promise.reject(
|
|
5009
|
-
if (e != null && e.aborted) return Promise.reject(
|
|
5031
|
+
if (this.disposed) return Promise.reject(ze("ChunkLoader has been disposed."));
|
|
5032
|
+
if (e != null && e.aborted) return Promise.reject(ze("Chunk load was cancelled."));
|
|
5010
5033
|
if (this.workerFailure) return Promise.reject(this.workerFailure);
|
|
5011
5034
|
const n = this.nextRequestId++, s = new Promise((a, c) => {
|
|
5012
5035
|
this.pending.set(n, { resolve: a, reject: c, ...t ? { onProgress: t } : {} });
|
|
@@ -5017,7 +5040,7 @@ class Qn {
|
|
|
5017
5040
|
if (!l) return;
|
|
5018
5041
|
this.pending.delete(n);
|
|
5019
5042
|
const h = { type: "cancel", id: n };
|
|
5020
|
-
this.disposed || this.worker.postMessage(h), l.reject(
|
|
5043
|
+
this.disposed || this.worker.postMessage(h), l.reject(ze("Chunk load was cancelled."));
|
|
5021
5044
|
};
|
|
5022
5045
|
e.addEventListener("abort", a, { once: !0 });
|
|
5023
5046
|
const c = this.pending.get(n);
|
|
@@ -5028,7 +5051,7 @@ class Qn {
|
|
|
5028
5051
|
}
|
|
5029
5052
|
/** Terminates this worker and rejects its in-flight requests. */
|
|
5030
5053
|
dispose() {
|
|
5031
|
-
this.disposed || (this.disposed = !0, this.worker.terminate(), this.rejectAll(
|
|
5054
|
+
this.disposed || (this.disposed = !0, this.worker.terminate(), this.rejectAll(ze("ChunkLoader has been disposed.")));
|
|
5032
5055
|
}
|
|
5033
5056
|
rejectAll(r) {
|
|
5034
5057
|
var e;
|
|
@@ -5037,7 +5060,7 @@ class Qn {
|
|
|
5037
5060
|
this.pending.clear();
|
|
5038
5061
|
}
|
|
5039
5062
|
}
|
|
5040
|
-
class
|
|
5063
|
+
class bn {
|
|
5041
5064
|
constructor() {
|
|
5042
5065
|
u(this, "streaming", new Qn(new yi()));
|
|
5043
5066
|
/** The in-flight construction; `null` until a one-shot format is requested. */
|
|
@@ -5118,8 +5141,8 @@ class vn {
|
|
|
5118
5141
|
}
|
|
5119
5142
|
/** Routes one load to the worker that owns its format. */
|
|
5120
5143
|
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(
|
|
5144
|
+
if (this.disposed) return Promise.reject(ze("ChunkLoader has been disposed."));
|
|
5145
|
+
if (t != null && t.aborted) return Promise.reject(ze("Chunk load was cancelled."));
|
|
5123
5146
|
const l = {
|
|
5124
5147
|
type: "load",
|
|
5125
5148
|
source: r,
|
|
@@ -5131,7 +5154,7 @@ class vn {
|
|
|
5131
5154
|
...c ? { progress: !0 } : {}
|
|
5132
5155
|
}, h = this.clientFor(e);
|
|
5133
5156
|
return h instanceof Promise ? h.then((d) => {
|
|
5134
|
-
if (this.disposed) throw
|
|
5157
|
+
if (this.disposed) throw ze("ChunkLoader has been disposed.");
|
|
5135
5158
|
return d.request(l, t, c);
|
|
5136
5159
|
}) : h.request(l, t, c);
|
|
5137
5160
|
}
|
|
@@ -5179,12 +5202,12 @@ function Li(i) {
|
|
|
5179
5202
|
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
5203
|
return Math.max(1, t) * r;
|
|
5181
5204
|
}
|
|
5182
|
-
class
|
|
5205
|
+
class Ut extends pt {
|
|
5183
5206
|
constructor(e, t, n, s, o, a = !1) {
|
|
5184
|
-
var
|
|
5207
|
+
var f, g, w;
|
|
5185
5208
|
super({ capacity: n }, s);
|
|
5186
5209
|
u(this, "scene");
|
|
5187
|
-
u(this, "loader", new
|
|
5210
|
+
u(this, "loader", new bn());
|
|
5188
5211
|
/**
|
|
5189
5212
|
* Cap the *classic* (non-page-table) chunk cache evicts against.
|
|
5190
5213
|
*
|
|
@@ -5368,11 +5391,13 @@ class Dt extends pt {
|
|
|
5368
5391
|
/** Set when the env tile is larger than the whole pool - terminal, warned once. */
|
|
5369
5392
|
u(this, "envUnfit", !1);
|
|
5370
5393
|
/**
|
|
5371
|
-
*
|
|
5372
|
-
*
|
|
5394
|
+
* Startup hold. `'capture'` waits for the first schedule after the host
|
|
5395
|
+
* applies the final camera; `'holding'` freezes that coverage set.
|
|
5373
5396
|
*/
|
|
5374
5397
|
u(this, "initialRevealPhase", "off");
|
|
5375
|
-
/**
|
|
5398
|
+
/** Which hold, if any, was armed at construction. Survives release for recapture. */
|
|
5399
|
+
u(this, "initialRevealHold", "off");
|
|
5400
|
+
/** Frozen nearby-detail / in-view coverage runs for {@link initialRevealPhase} `'holding'`. */
|
|
5376
5401
|
u(this, "frozenCriticalRuns", null);
|
|
5377
5402
|
/** Timestamp of the final-camera capture that began the current hold. */
|
|
5378
5403
|
u(this, "initialRevealStartedAt");
|
|
@@ -5388,13 +5413,15 @@ class Dt extends pt {
|
|
|
5388
5413
|
u(this, "coverageScratch");
|
|
5389
5414
|
u(this, "lastCameraPos", new p.Vector3(1 / 0, 1 / 0, 1 / 0));
|
|
5390
5415
|
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)
|
|
5416
|
+
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);
|
|
5417
|
+
const c = s.initialReveal === "hold-coverage" && this.scene.source.coverageRunsFor !== void 0, l = s.initialReveal === "hold-near-l0" && a;
|
|
5418
|
+
c || l ? (this.initialRevealHold = c ? "hold-coverage" : "hold-near-l0", this.initialRevealPhase = "capture", this.initialRevealStateValue = {
|
|
5392
5419
|
status: "pending",
|
|
5393
5420
|
stagedSplats: 0,
|
|
5394
5421
|
totalSplats: 0,
|
|
5395
5422
|
readyGroups: 0,
|
|
5396
5423
|
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 = (
|
|
5424
|
+
}) : (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
5425
|
// No weight supplied: claim an equal share rather than none, so a partly
|
|
5399
5426
|
// wired host degrades to round-robin instead of silently starving.
|
|
5400
5427
|
weight: () => {
|
|
@@ -5406,11 +5433,11 @@ class Dt extends pt {
|
|
|
5406
5433
|
},
|
|
5407
5434
|
shedFetches: (m) => this.abortFetches(m)
|
|
5408
5435
|
});
|
|
5409
|
-
const
|
|
5436
|
+
const h = s.foveationMode === "pagetable", d = h ? Math.max(
|
|
5410
5437
|
this.cpuCacheBytes,
|
|
5411
5438
|
Math.min(Fi, Li(e))
|
|
5412
5439
|
) : this.cpuCacheBytes;
|
|
5413
|
-
if (this.cacheBudgetHandle = (
|
|
5440
|
+
if (this.cacheBudgetHandle = (w = this.cacheBudget) == null ? void 0 : w.register({
|
|
5414
5441
|
// The governor weight `fetchWeight` already carries, so cache and network
|
|
5415
5442
|
// follow the same camera-projected measure. The `1` fallback matches
|
|
5416
5443
|
// `requestChunk`: a host that never wired weights gives every mesh an
|
|
@@ -5419,15 +5446,15 @@ class Dt extends pt {
|
|
|
5419
5446
|
var m;
|
|
5420
5447
|
return ((m = this.fetchWeight) == null ? void 0 : m.call(this)) ?? 1;
|
|
5421
5448
|
},
|
|
5422
|
-
ceilingBytes:
|
|
5449
|
+
ceilingBytes: d,
|
|
5423
5450
|
onAllowanceChanged: (m) => this.applyCacheAllowance(m)
|
|
5424
|
-
}), this.cacheLimitBytes = this.cacheBudget && this.cacheBudgetHandle ? this.cacheBudget.allowanceFor(this.cacheBudgetHandle) :
|
|
5451
|
+
}), 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
5452
|
if (!o)
|
|
5426
5453
|
throw new Error("StreamedSplatMesh: pagetable foveation requires the frontier worker.");
|
|
5427
5454
|
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
5455
|
min: s.minSplatScreenRadius ?? 0,
|
|
5429
5456
|
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 = (
|
|
5457
|
+
}), 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
5458
|
type: "init",
|
|
5432
5459
|
capacity: this.pagerSlots,
|
|
5433
5460
|
chunkSize: e.chunkSize ?? 65536,
|
|
@@ -5443,7 +5470,7 @@ class Dt extends pt {
|
|
|
5443
5470
|
* The returned static mesh shares this class's runtime budget contract.
|
|
5444
5471
|
*/
|
|
5445
5472
|
static async loadAutoLod(e, t) {
|
|
5446
|
-
const { StaticLodSplatMesh: n } = await Promise.resolve().then(() =>
|
|
5473
|
+
const { StaticLodSplatMesh: n } = await Promise.resolve().then(() => zi);
|
|
5447
5474
|
return n.load(e, t);
|
|
5448
5475
|
}
|
|
5449
5476
|
/**
|
|
@@ -5463,7 +5490,7 @@ class Dt extends pt {
|
|
|
5463
5490
|
*/
|
|
5464
5491
|
static async load(e, t = {}) {
|
|
5465
5492
|
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
|
|
5493
|
+
return Ut.fromSource(
|
|
5467
5494
|
mi(n, t.request),
|
|
5468
5495
|
o,
|
|
5469
5496
|
t
|
|
@@ -5486,7 +5513,7 @@ class Dt extends pt {
|
|
|
5486
5513
|
static async loadLocal(e, t = {}) {
|
|
5487
5514
|
let n;
|
|
5488
5515
|
try {
|
|
5489
|
-
n =
|
|
5516
|
+
n = vi(e);
|
|
5490
5517
|
} catch (s) {
|
|
5491
5518
|
throw s instanceof dt ? s : new dt(s instanceof Error ? s.message : String(s), {
|
|
5492
5519
|
phase: "manifest",
|
|
@@ -5496,7 +5523,7 @@ class Dt extends pt {
|
|
|
5496
5523
|
});
|
|
5497
5524
|
}
|
|
5498
5525
|
try {
|
|
5499
|
-
const s = await
|
|
5526
|
+
const s = await Ut.fromSource(n.source, n.format, t);
|
|
5500
5527
|
return s.localSource = n.source, s;
|
|
5501
5528
|
} catch (s) {
|
|
5502
5529
|
throw n.source.dispose(), s;
|
|
@@ -5518,66 +5545,68 @@ class Dt extends pt {
|
|
|
5518
5545
|
lodMultiplier: n.lodMultiplier ?? 2
|
|
5519
5546
|
}, 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
5547
|
f == null || f.throwIfAborted();
|
|
5521
|
-
let
|
|
5548
|
+
let g;
|
|
5522
5549
|
if (t === "rad")
|
|
5523
5550
|
try {
|
|
5524
|
-
const { buildRadScene:
|
|
5525
|
-
|
|
5526
|
-
} catch (
|
|
5527
|
-
throw At(
|
|
5551
|
+
const { buildRadScene: b } = await import("./formats/rad.js");
|
|
5552
|
+
g = await b(e, c, n.request, l, d);
|
|
5553
|
+
} catch (b) {
|
|
5554
|
+
throw At(b) ? b : Rt(b, { phase: "manifest", url: e.manifestUrl });
|
|
5528
5555
|
}
|
|
5529
5556
|
else {
|
|
5530
|
-
let
|
|
5557
|
+
let b;
|
|
5531
5558
|
try {
|
|
5532
|
-
|
|
5559
|
+
b = await fetch(e.manifestUrl, on(n.request, f));
|
|
5533
5560
|
} catch (A) {
|
|
5534
5561
|
throw At(A) ? A : Rt(A, { phase: "fetch", url: e.manifestUrl });
|
|
5535
5562
|
}
|
|
5536
|
-
if (!
|
|
5563
|
+
if (!b.ok)
|
|
5537
5564
|
throw Rt(
|
|
5538
|
-
new Error(`Failed to load manifest ${e.manifestUrl}: HTTP ${
|
|
5539
|
-
{ phase: "manifest", url: e.manifestUrl, status:
|
|
5565
|
+
new Error(`Failed to load manifest ${e.manifestUrl}: HTTP ${b.status}`),
|
|
5566
|
+
{ phase: "manifest", url: e.manifestUrl, status: b.status }
|
|
5540
5567
|
);
|
|
5541
5568
|
try {
|
|
5542
|
-
const A = await
|
|
5569
|
+
const A = await b.json();
|
|
5543
5570
|
if (t === "lcc2") {
|
|
5544
5571
|
const { buildLcc2Scene: P } = await import("./formats/lcc.js");
|
|
5545
|
-
|
|
5572
|
+
g = P(A, e, c, n.shBands ?? 0);
|
|
5546
5573
|
} else if (t === "lcc") {
|
|
5547
5574
|
const { buildLccScene: P } = await import("./formats/lcc.js");
|
|
5548
|
-
|
|
5575
|
+
g = await P(A, e, { ...c, shBands: l });
|
|
5549
5576
|
} else
|
|
5550
|
-
|
|
5577
|
+
g = di(A, e, c, n.shBands ?? 0);
|
|
5551
5578
|
} catch (A) {
|
|
5552
5579
|
throw At(A) ? A : Rt(A, { phase: "manifest", url: e.manifestUrl });
|
|
5553
5580
|
}
|
|
5554
5581
|
}
|
|
5555
5582
|
f == null || f.throwIfAborted();
|
|
5556
|
-
const
|
|
5557
|
-
|
|
5558
|
-
const y = Math.min(
|
|
5583
|
+
const w = (t === "lcc" || t === "rad") && d ? os(a, g.maxResidentSplats, s) : a, m = n.maxBudget === void 0 ? w : Math.min(o, w);
|
|
5584
|
+
g.source.budget = m;
|
|
5585
|
+
const y = Math.min(w, g.maxResidentSplats), v = n.experimentalStagedSwaps !== !1 ? 1.5 : 1.4, S = Math.max(
|
|
5559
5586
|
1,
|
|
5560
|
-
Math.ceil(y *
|
|
5561
|
-
), R =
|
|
5587
|
+
Math.ceil(y * v / _e)
|
|
5588
|
+
), R = g.foveation ? n.foveationMode ?? (t === "rad" ? "pagetable" : "frontier") : n.foveationMode;
|
|
5562
5589
|
let k;
|
|
5563
5590
|
if (R === "pagetable") {
|
|
5564
5591
|
k = (await import("./frontier-worker-CAnK_Cmu.js")).default, f == null || f.throwIfAborted();
|
|
5565
|
-
const A =
|
|
5592
|
+
const A = g.source;
|
|
5566
5593
|
A.needsParentSizes !== void 0 && (A.needsParentSizes = !1);
|
|
5567
5594
|
}
|
|
5568
|
-
const M = new
|
|
5595
|
+
const M = new Ut(
|
|
5596
|
+
g,
|
|
5569
5597
|
m,
|
|
5570
|
-
w,
|
|
5571
5598
|
S * _e,
|
|
5572
5599
|
{
|
|
5573
5600
|
...n,
|
|
5574
5601
|
// Classic LCC's useful first frame is the bounded nearby-detail set,
|
|
5575
|
-
// not its coarse shell.
|
|
5576
|
-
//
|
|
5602
|
+
// not its coarse shell. `.lcc2` waits for in-view coarsest coverage
|
|
5603
|
+
// so empty octree squares do not flash. Keep every other format
|
|
5604
|
+
// progressive, and let a caller explicitly request progressive for A/B.
|
|
5577
5605
|
...t === "lcc" && n.initialReveal === void 0 ? { initialReveal: "hold-near-l0" } : {},
|
|
5606
|
+
...t === "lcc2" && n.initialReveal === void 0 ? { initialReveal: "hold-coverage" } : {},
|
|
5578
5607
|
// The resolved ceiling, not the caller's raw option: it may have been
|
|
5579
5608
|
// lifted to a moderate capture's leaf count above.
|
|
5580
|
-
maxBudget:
|
|
5609
|
+
maxBudget: w,
|
|
5581
5610
|
// This line overrides `...options` above, so a declined request has to
|
|
5582
5611
|
// survive it - that is how `.rad` came to ignore both the `smooth`
|
|
5583
5612
|
// profile and an explicit `shBands: 0`. Only *zero* is re-applied here,
|
|
@@ -5585,7 +5614,7 @@ class Dt extends pt {
|
|
|
5585
5614
|
// requests by generating that many bands, whereas forcing a smaller
|
|
5586
5615
|
// count past one would mismatch the decoded chunk and degrade to
|
|
5587
5616
|
// neutral SH (see `SplatMesh.writePackedSh`).
|
|
5588
|
-
shBands: l === 0 ? 0 :
|
|
5617
|
+
shBands: l === 0 ? 0 : g.shBands ?? 0,
|
|
5589
5618
|
// Spark ships Mip-Splatting antialiasing ON (blurAmount 0.3 *with* opacity
|
|
5590
5619
|
// compensation `α·√(detRaw/detBlur)`). Match that default for `.rad`: the
|
|
5591
5620
|
// 0.3 low-pass without the compensation makes splats too opaque (uniform
|
|
@@ -5610,15 +5639,15 @@ class Dt extends pt {
|
|
|
5610
5639
|
// paged to the GPU, so the whole device budget buys on-screen detail); other
|
|
5611
5640
|
// foveated formats keep the GPU `frontier` cut. `foveationMode: 'band'` (or
|
|
5612
5641
|
// `'frontier'`) forces the legacy paths for A/B. Overrides any caller blob cull.
|
|
5613
|
-
...
|
|
5642
|
+
...g.foveation ? {
|
|
5614
5643
|
foveationMode: R,
|
|
5615
|
-
minSplatScreenRadius:
|
|
5616
|
-
maxSplatScreenRadius:
|
|
5644
|
+
minSplatScreenRadius: g.foveation.minScreenRadiusPx,
|
|
5645
|
+
maxSplatScreenRadius: g.foveation.maxScreenRadiusPx
|
|
5617
5646
|
} : {}
|
|
5618
5647
|
},
|
|
5619
5648
|
k,
|
|
5620
5649
|
t === "lcc"
|
|
5621
|
-
), x =
|
|
5650
|
+
), x = g.formatTransform ?? (M.orientation === "y-up" ? dn(t) : null);
|
|
5622
5651
|
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
5652
|
}
|
|
5624
5653
|
/** Slots the currently reserved pages can hold. */
|
|
@@ -5670,7 +5699,7 @@ class Dt extends pt {
|
|
|
5670
5699
|
const o = t + s, a = this.slabPages[Math.floor(o / this.slabPageSplats)];
|
|
5671
5700
|
if (!a) return;
|
|
5672
5701
|
const c = o % this.slabPageSplats, l = Math.min(n - s, this.slabPageSplats - c);
|
|
5673
|
-
this.overwriteRangeData(a,
|
|
5702
|
+
this.overwriteRangeData(a, Kt(e, s, l), c), s += l;
|
|
5674
5703
|
}
|
|
5675
5704
|
}
|
|
5676
5705
|
/** Zeros slots `[slot, slot + count)`, splitting at page boundaries like
|
|
@@ -6024,21 +6053,22 @@ class Dt extends pt {
|
|
|
6024
6053
|
}
|
|
6025
6054
|
/**
|
|
6026
6055
|
* Startup-hold progress for {@link StreamedSplatMeshOptions.initialReveal}.
|
|
6027
|
-
*
|
|
6028
|
-
* `'
|
|
6029
|
-
* `
|
|
6056
|
+
* Hosts using `'hold-near-l0'` or `'hold-coverage'` should keep the mesh
|
|
6057
|
+
* invisible while `status === 'pending'`, then reveal on `'ready'` or
|
|
6058
|
+
* `'degraded'`.
|
|
6030
6059
|
*/
|
|
6031
6060
|
get initialRevealState() {
|
|
6032
6061
|
return this.initialRevealStateValue;
|
|
6033
6062
|
}
|
|
6034
6063
|
/**
|
|
6035
|
-
* Captures a fresh
|
|
6036
|
-
*
|
|
6037
|
-
*
|
|
6038
|
-
*
|
|
6064
|
+
* Captures a fresh startup-hold set on the next {@link update}. Hosts that
|
|
6065
|
+
* apply their final initial camera pose after the mesh first receives frames
|
|
6066
|
+
* should call this before lifting their loading cover. It is a no-op when
|
|
6067
|
+
* the hold was never armed (progressive startup, or a format without the
|
|
6068
|
+
* matching LodSource hook).
|
|
6039
6069
|
*/
|
|
6040
6070
|
recaptureInitialReveal() {
|
|
6041
|
-
|
|
6071
|
+
this.initialRevealHold !== "off" && (this.frozenCriticalRuns = null, this.initialRevealStartedAt = void 0, this.initialRevealPhase = "capture", this.initialRevealStateValue = {
|
|
6042
6072
|
status: "pending",
|
|
6043
6073
|
stagedSplats: 0,
|
|
6044
6074
|
totalSplats: 0,
|
|
@@ -6099,21 +6129,21 @@ class Dt extends pt {
|
|
|
6099
6129
|
for (const { run: h } of this.resident.values()) {
|
|
6100
6130
|
const d = this.cache.get(h.file);
|
|
6101
6131
|
if (!d) continue;
|
|
6102
|
-
const f = d.data.positions,
|
|
6103
|
-
let
|
|
6104
|
-
for (let
|
|
6105
|
-
const y = h.offset +
|
|
6106
|
-
if (!(
|
|
6132
|
+
const f = d.data.positions, g = o.edits.get(h.file) ?? /* @__PURE__ */ new Map();
|
|
6133
|
+
let w = !1;
|
|
6134
|
+
for (let m = 0; m < h.count; m++) {
|
|
6135
|
+
const y = h.offset + m, v = f[y * 3 + 0] - at.x, S = f[y * 3 + 1] - at.y, R = f[y * 3 + 2] - at.z;
|
|
6136
|
+
if (!(v * v + S * S + R * R > a) && !g.has(y)) {
|
|
6107
6137
|
if (o.total >= o.maxEdits) {
|
|
6108
6138
|
o.warned || (o.warned = !0, me(
|
|
6109
6139
|
`StreamedSplatMesh.paintPersistent: channel "${e}" hit its maxEdits cap (${o.maxEdits}); further new edits are dropped.`
|
|
6110
6140
|
));
|
|
6111
6141
|
continue;
|
|
6112
6142
|
}
|
|
6113
|
-
o.total++,
|
|
6143
|
+
o.total++, g.set(y, s), w = !0, c++;
|
|
6114
6144
|
}
|
|
6115
6145
|
}
|
|
6116
|
-
|
|
6146
|
+
w && (o.edits.set(h.file, g), l.add(h.file));
|
|
6117
6147
|
}
|
|
6118
6148
|
if (l.size > 0)
|
|
6119
6149
|
for (const { run: h, handle: d } of this.resident.values())
|
|
@@ -6164,14 +6194,14 @@ class Dt extends pt {
|
|
|
6164
6194
|
let s = null;
|
|
6165
6195
|
if (this.onPerformanceEvent !== void 0) {
|
|
6166
6196
|
s = { resident: /* @__PURE__ */ new Map(), staged: /* @__PURE__ */ new Map() };
|
|
6167
|
-
for (const [
|
|
6168
|
-
for (const [
|
|
6197
|
+
for (const [b, A] of this.resident) s.resident.set(b, A.run.count);
|
|
6198
|
+
for (const [b, A] of this.staged) s.staged.set(b, A.uploadedCount);
|
|
6169
6199
|
}
|
|
6170
6200
|
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(
|
|
6173
|
-
const
|
|
6174
|
-
if (
|
|
6201
|
+
if (this.pendingWork = !1, this.lastScheduleTime = t, e.getWorldPosition(this.lastCameraPos), e.getWorldQuaternion(this.lastCameraQuat), je.copy(this.lastCameraPos), this.worldToLocal(je), sr.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse).multiply(this.matrixWorld), kt.setFromProjectionMatrix(sr), this.frontierWorker) {
|
|
6202
|
+
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(je).normalize();
|
|
6203
|
+
const b = e.projectionMatrix.elements[5] * this.pageTableViewportY / 2;
|
|
6204
|
+
if (b > 0 && (this.pageTableLimit = this.pageTableTargetPx / b), this.reschedulePageTable(je, We, kt, t), this.onPerformanceEvent === void 0) return null;
|
|
6175
6205
|
const A = performance.now();
|
|
6176
6206
|
return {
|
|
6177
6207
|
timestamp: A,
|
|
@@ -6190,68 +6220,79 @@ class Dt extends pt {
|
|
|
6190
6220
|
compacted: !1
|
|
6191
6221
|
};
|
|
6192
6222
|
}
|
|
6193
|
-
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(
|
|
6223
|
+
e.getWorldDirection(We).add(this.lastCameraPos), this.worldToLocal(We), We.sub(je).normalize();
|
|
6194
6224
|
const a = this.scene.source.computeDesiredRuns(
|
|
6195
|
-
|
|
6196
|
-
|
|
6225
|
+
je,
|
|
6226
|
+
kt,
|
|
6197
6227
|
t,
|
|
6198
6228
|
We
|
|
6199
|
-
), c = this.captureOrContinueInitialReveal(
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6229
|
+
), c = this.captureOrContinueInitialReveal(
|
|
6230
|
+
a,
|
|
6231
|
+
t,
|
|
6232
|
+
je,
|
|
6233
|
+
kt
|
|
6234
|
+
), l = c !== null, h = c ?? a, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set();
|
|
6235
|
+
for (const b of h)
|
|
6236
|
+
d.set(ue(b), b), f.add(b.file);
|
|
6237
|
+
for (const [b, A] of this.staged)
|
|
6238
|
+
d.has(b) || l && ((x = this.frozenCriticalRuns) != null && x.some((P) => ue(P) === b)) || (this.removeRange(A.handle), this.staged.delete(b));
|
|
6239
|
+
for (const [b, { controller: A }] of this.fetching)
|
|
6240
|
+
!f.has(b) && !this.scene.pinnedFiles.has(b) && A.abort();
|
|
6241
|
+
for (const b of this.retrying.keys())
|
|
6242
|
+
!f.has(b) && !this.scene.pinnedFiles.has(b) && this.retrying.delete(b);
|
|
6208
6243
|
this.neededFiles.clear();
|
|
6209
|
-
for (const
|
|
6210
|
-
const A =
|
|
6244
|
+
for (const b of h) {
|
|
6245
|
+
const A = ue(b);
|
|
6211
6246
|
if (this.resident.has(A)) continue;
|
|
6212
6247
|
const P = this.staged.get(A);
|
|
6213
|
-
P && P.uploadedCount ===
|
|
6248
|
+
P && P.uploadedCount === b.count || this.neededFiles.add(b.file);
|
|
6214
6249
|
}
|
|
6215
|
-
|
|
6250
|
+
this.envFile !== void 0 && this.envEnabled && this.envHandle === void 0 && !this.envUnfit && !this.failedFiles.has(this.envFile) && this.neededFiles.add(this.envFile);
|
|
6251
|
+
const g = h.filter((b) => !this.resident.has(ue(b))), w = l ? [] : [...this.resident.entries()].filter(([b]) => !d.has(b)), m = l ? (
|
|
6216
6252
|
// Mesh is invisible during the hold, so L0 cell-atomicity (no holes) is
|
|
6217
6253
|
// irrelevant - commit each frozen slice as it lands so a partial home
|
|
6218
6254
|
// cell cannot block reveal behind sibling subchunks still fetching.
|
|
6219
|
-
Zs(
|
|
6220
|
-
) : Qs(
|
|
6221
|
-
|
|
6222
|
-
(
|
|
6255
|
+
Zs(g)
|
|
6256
|
+
) : Qs(g, w), y = !l && Js(m);
|
|
6257
|
+
m.sort(
|
|
6258
|
+
(b, A) => y ? ei(b, A) : Gn(b) - Gn(A)
|
|
6223
6259
|
);
|
|
6224
|
-
const
|
|
6260
|
+
const v = /* @__PURE__ */ new Map();
|
|
6261
|
+
this.updateEnvironment(t, v);
|
|
6225
6262
|
let S = 0, R = !1, k = !1, M = !1;
|
|
6226
|
-
for (const
|
|
6227
|
-
if (!y &&
|
|
6263
|
+
for (const b of m) {
|
|
6264
|
+
if (!y && b.removes.length > 0 && R) {
|
|
6228
6265
|
if (this.neverRetireCoverageEarly || !k && this.retireHeldTicks < Ci) {
|
|
6229
6266
|
this.pendingWork = !0, M = !0;
|
|
6230
6267
|
continue;
|
|
6231
6268
|
}
|
|
6232
6269
|
this.fetchCountsValue.retiredEarly++;
|
|
6233
6270
|
}
|
|
6234
|
-
if (
|
|
6235
|
-
this.applyGroup(
|
|
6271
|
+
if (b.adds.length === 0) {
|
|
6272
|
+
this.applyGroup(b, t);
|
|
6236
6273
|
continue;
|
|
6237
6274
|
}
|
|
6238
|
-
const A =
|
|
6275
|
+
const A = b.adds.filter((L) => !this.cache.has(L.file)), P = l || ri(b) && this.initialRevealHold !== "hold-coverage";
|
|
6239
6276
|
if (A.length > 0) {
|
|
6240
6277
|
let L = !1;
|
|
6241
6278
|
for (const W of A)
|
|
6242
6279
|
this.failedFiles.has(W.file) || (qn(
|
|
6243
|
-
|
|
6280
|
+
v,
|
|
6244
6281
|
W.file,
|
|
6245
6282
|
si(W, this.scene.source.lodBaseDistance),
|
|
6246
6283
|
W
|
|
6247
6284
|
), L = !0);
|
|
6248
|
-
if (l || this.substituteCoverage(
|
|
6285
|
+
if (l || this.substituteCoverage(b, t, v, P), L && (this.pendingWork = !0, R = !0), !l) continue;
|
|
6286
|
+
}
|
|
6287
|
+
if (l && this.environmentPendingForReveal()) {
|
|
6288
|
+
this.pendingWork = !0, R = !0;
|
|
6289
|
+
continue;
|
|
6249
6290
|
}
|
|
6250
|
-
if ((l || this.stagedSwapsEnabled &&
|
|
6251
|
-
const L = this.stageGroup(
|
|
6252
|
-
if (S += L, !
|
|
6291
|
+
if ((l || this.stagedSwapsEnabled && b.addCount > this.appendCap) && this.canStageGroup(b)) {
|
|
6292
|
+
const L = this.stageGroup(b, t, Math.max(0, this.appendCap - S));
|
|
6293
|
+
if (S += L, !b.adds.every((W) => {
|
|
6253
6294
|
var B;
|
|
6254
|
-
return ((B = this.staged.get(
|
|
6295
|
+
return ((B = this.staged.get(ue(W))) == null ? void 0 : B.uploadedCount) === W.count;
|
|
6255
6296
|
})) {
|
|
6256
6297
|
this.pendingWork = !0, R = !0;
|
|
6257
6298
|
continue;
|
|
@@ -6260,10 +6301,10 @@ class Dt extends pt {
|
|
|
6260
6301
|
this.deferNextSortRequest(), this.pendingWork = !0, R = !0;
|
|
6261
6302
|
continue;
|
|
6262
6303
|
}
|
|
6263
|
-
this.commitStagedGroup(
|
|
6304
|
+
this.commitStagedGroup(b);
|
|
6264
6305
|
continue;
|
|
6265
6306
|
}
|
|
6266
|
-
if (!l && S > 0 && S +
|
|
6307
|
+
if (!l && S > 0 && S + b.addCount > this.appendCap) {
|
|
6267
6308
|
this.pendingWork = !0, R = !0;
|
|
6268
6309
|
continue;
|
|
6269
6310
|
}
|
|
@@ -6271,13 +6312,13 @@ class Dt extends pt {
|
|
|
6271
6312
|
this.pendingWork = !0, R = !0;
|
|
6272
6313
|
continue;
|
|
6273
6314
|
}
|
|
6274
|
-
if (!this.applyGroup(
|
|
6315
|
+
if (!this.applyGroup(b, t)) {
|
|
6275
6316
|
this.pendingWork = !0, k = !0;
|
|
6276
6317
|
continue;
|
|
6277
6318
|
}
|
|
6278
|
-
S +=
|
|
6319
|
+
S += b.addCount;
|
|
6279
6320
|
}
|
|
6280
|
-
return this.flushClassicFetches(
|
|
6321
|
+
return this.flushClassicFetches(v, this.scene.source.lodBaseDistance, l), this.retireHeldTicks = M ? this.retireHeldTicks + 1 : 0, l && (this.finishInitialRevealIfComplete(), this.initialRevealPhase === "holding" && (this.pendingWork = !0)), this.fetchCountsValue.cacheBytes = this.cacheBytesTotal, this.fetchCountsValue.cacheLimitBytes = this.cpuCacheBytes, this.cacheBytesTotal > this.cpuCacheBytes && (this.fetchCountsValue.cacheFull = !0), this.evictChunks(t), s === null ? null : this.createPerformanceEvent(
|
|
6281
6322
|
s.resident,
|
|
6282
6323
|
s.staged,
|
|
6283
6324
|
o,
|
|
@@ -6333,7 +6374,7 @@ class Dt extends pt {
|
|
|
6333
6374
|
publishInitialRevealProgress(e) {
|
|
6334
6375
|
const t = /* @__PURE__ */ new Map();
|
|
6335
6376
|
for (const c of e) {
|
|
6336
|
-
const l = c.coverageGroup;
|
|
6377
|
+
const l = c.coverageGroup !== void 0 ? `g:${c.coverageGroup}` : ue(c);
|
|
6337
6378
|
let h = t.get(l);
|
|
6338
6379
|
h || (h = [], t.set(l, h)), h.push(c);
|
|
6339
6380
|
}
|
|
@@ -6342,7 +6383,7 @@ class Dt extends pt {
|
|
|
6342
6383
|
let l = !0;
|
|
6343
6384
|
for (const h of c) {
|
|
6344
6385
|
s += h.count;
|
|
6345
|
-
const d =
|
|
6386
|
+
const d = ue(h);
|
|
6346
6387
|
if (this.resident.has(d)) {
|
|
6347
6388
|
n += h.count;
|
|
6348
6389
|
continue;
|
|
@@ -6385,68 +6426,100 @@ class Dt extends pt {
|
|
|
6385
6426
|
totalGroups: l
|
|
6386
6427
|
}, this.frozenCriticalRuns = null, this.initialRevealPhase = "released", this.pendingWork = !0;
|
|
6387
6428
|
}
|
|
6388
|
-
|
|
6429
|
+
/**
|
|
6430
|
+
* `.lcc2` coverage hold: freeze coarsest covering runs for in-view cells.
|
|
6431
|
+
* Missing `coverageRunsFor` (or an empty result after fallback) releases
|
|
6432
|
+
* immediately so the mesh does not stay hidden with nothing to fetch.
|
|
6433
|
+
*/
|
|
6434
|
+
captureCoverageHold(e, t, n) {
|
|
6435
|
+
var o, a;
|
|
6436
|
+
const s = ((a = (o = this.scene.source).coverageRunsFor) == null ? void 0 : a.call(o, e, t)) ?? [];
|
|
6437
|
+
if (s.length === 0) {
|
|
6438
|
+
if (this.environmentPendingForReveal()) {
|
|
6439
|
+
this.frozenCriticalRuns = [], this.initialRevealStartedAt = n, this.initialRevealPhase = "holding", this.publishInitialRevealProgress([]);
|
|
6440
|
+
return;
|
|
6441
|
+
}
|
|
6442
|
+
this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released";
|
|
6443
|
+
return;
|
|
6444
|
+
}
|
|
6445
|
+
if (!this.criticalRunsFitCapacity(s)) {
|
|
6446
|
+
this.frozenCriticalRuns = s, this.releaseInitialReveal("degraded", "capacity");
|
|
6447
|
+
return;
|
|
6448
|
+
}
|
|
6449
|
+
this.frozenCriticalRuns = s, this.initialRevealStartedAt = n, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(s);
|
|
6450
|
+
}
|
|
6451
|
+
captureOrContinueInitialReveal(e, t, n, s) {
|
|
6389
6452
|
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
|
-
|
|
6453
|
+
if (this.initialRevealPhase === "capture")
|
|
6454
|
+
if (this.initialRevealHold === "hold-coverage")
|
|
6455
|
+
this.captureCoverageHold(n, s, t);
|
|
6456
|
+
else {
|
|
6457
|
+
const o = this.selectHomeSeedRuns(e);
|
|
6458
|
+
let a = [];
|
|
6459
|
+
if (o.length === 0) {
|
|
6460
|
+
const c = this.scene.source.lodBaseDistance * this.scene.source.lodMultiplier * this.scene.source.lodMultiplier, l = e.filter(
|
|
6461
|
+
(d) => d.level <= 2 && d.coverageGroup !== void 0 && (d.distance ?? Number.POSITIVE_INFINITY) <= c
|
|
6462
|
+
), h = [...l].sort(
|
|
6463
|
+
(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
|
|
6464
|
+
)[0];
|
|
6465
|
+
if (!h)
|
|
6466
|
+
return this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released", null;
|
|
6467
|
+
if (a = h.coverageGroup !== void 0 ? l.filter((d) => d.coverageGroup === h.coverageGroup) : [h], this.criticalRunsFitCapacity(a) || (a = h.coverageGroup !== void 0 ? l.filter(
|
|
6468
|
+
(d) => d.coverageGroup === h.coverageGroup && this.criticalRunsFitCapacity([d])
|
|
6469
|
+
).slice(0, 1) : l.filter((d) => this.criticalRunsFitCapacity([d])).slice(0, 1)), a.length === 0 || !this.criticalRunsFitCapacity(a))
|
|
6470
|
+
return this.frozenCriticalRuns = a.length > 0 ? a : [h], this.releaseInitialReveal("degraded", "capacity"), null;
|
|
6471
|
+
this.frozenCriticalRuns = a, this.initialRevealStartedAt = t, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(a);
|
|
6472
|
+
} else {
|
|
6473
|
+
for (const c of [0, 1, 2]) {
|
|
6474
|
+
const l = this.coarsenHomeRuns(o, c);
|
|
6475
|
+
if (l.length !== 0) {
|
|
6476
|
+
if (this.criticalRunsFitCapacity(l)) {
|
|
6477
|
+
a = l;
|
|
6478
|
+
break;
|
|
6479
|
+
}
|
|
6480
|
+
a = l;
|
|
6413
6481
|
}
|
|
6414
|
-
s = a;
|
|
6415
6482
|
}
|
|
6483
|
+
if (a.length === 0)
|
|
6484
|
+
return this.initialRevealStateValue = { status: "ready" }, this.initialRevealPhase = "released", null;
|
|
6485
|
+
if (!this.criticalRunsFitCapacity(a))
|
|
6486
|
+
return this.frozenCriticalRuns = a, this.releaseInitialReveal("degraded", "capacity"), null;
|
|
6487
|
+
this.frozenCriticalRuns = a, this.initialRevealStartedAt = t, this.initialRevealPhase = "holding", this.publishInitialRevealProgress(a);
|
|
6416
6488
|
}
|
|
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
6489
|
}
|
|
6423
|
-
}
|
|
6424
6490
|
if (this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns) return null;
|
|
6425
6491
|
if (this.initialRevealStartedAt !== void 0 && t - this.initialRevealStartedAt >= Ri)
|
|
6426
6492
|
return this.releaseInitialReveal("degraded", "timeout"), null;
|
|
6427
|
-
for (const
|
|
6428
|
-
if (this.failedFiles.has(
|
|
6429
|
-
const
|
|
6430
|
-
if (!
|
|
6493
|
+
for (const o of this.frozenCriticalRuns)
|
|
6494
|
+
if (this.failedFiles.has(o.file) && !this.resident.has(ue(o))) {
|
|
6495
|
+
const a = this.staged.get(ue(o));
|
|
6496
|
+
if (!a || a.uploadedCount !== o.count)
|
|
6431
6497
|
return this.releaseInitialReveal("degraded", "fetch-failed"), null;
|
|
6432
6498
|
}
|
|
6433
6499
|
return this.publishInitialRevealProgress(this.frozenCriticalRuns), this.frozenCriticalRuns;
|
|
6434
6500
|
}
|
|
6435
6501
|
/** After staging/commits, release the hold when every frozen run is resident. */
|
|
6436
6502
|
finishInitialRevealIfComplete() {
|
|
6437
|
-
this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns || (this.publishInitialRevealProgress(this.frozenCriticalRuns), this.frozenCriticalRuns.every((e) => this.resident.has(
|
|
6503
|
+
this.initialRevealPhase !== "holding" || !this.frozenCriticalRuns || (this.publishInitialRevealProgress(this.frozenCriticalRuns), !this.environmentPendingForReveal() && this.frozenCriticalRuns.every((e) => this.resident.has(ue(e))) && this.releaseInitialReveal("ready"));
|
|
6504
|
+
}
|
|
6505
|
+
/**
|
|
6506
|
+
* Startup hold still needs the environment tile when the scene ships one
|
|
6507
|
+
* and it starts enabled. Failed / unfit / disabled tiles do not block reveal.
|
|
6508
|
+
*/
|
|
6509
|
+
environmentPendingForReveal() {
|
|
6510
|
+
return this.envFile !== void 0 && this.envEnabled && !this.envUnfit && this.envHandle === void 0 && !this.failedFiles.has(this.envFile);
|
|
6438
6511
|
}
|
|
6439
6512
|
/** Creates a marker for a changed streamed-LOD tick, if any. */
|
|
6440
6513
|
createPerformanceEvent(e, t, n, s) {
|
|
6441
6514
|
let o = 0, a = 0;
|
|
6442
|
-
for (const [f,
|
|
6443
|
-
a +=
|
|
6515
|
+
for (const [f, g] of this.resident)
|
|
6516
|
+
a += g.run.count, e.has(f) || (o += g.run.count);
|
|
6444
6517
|
let c = 0;
|
|
6445
|
-
for (const [f,
|
|
6446
|
-
this.resident.has(f) || (c +=
|
|
6518
|
+
for (const [f, g] of e)
|
|
6519
|
+
this.resident.has(f) || (c += g);
|
|
6447
6520
|
let l = 0;
|
|
6448
|
-
for (const [f,
|
|
6449
|
-
l += Math.max(0,
|
|
6521
|
+
for (const [f, g] of this.staged)
|
|
6522
|
+
l += Math.max(0, g.uploadedCount - (t.get(f) ?? 0));
|
|
6450
6523
|
const h = this.compactionCount !== n;
|
|
6451
6524
|
if (o === 0 && c === 0 && l === 0 && !h) return null;
|
|
6452
6525
|
const d = performance.now();
|
|
@@ -6469,7 +6542,7 @@ class Dt extends pt {
|
|
|
6469
6542
|
}
|
|
6470
6543
|
/** Returns whether all new rows can coexist with the currently visible region. */
|
|
6471
6544
|
canStageGroup(e) {
|
|
6472
|
-
return e.adds.filter((n) => !this.staged.has(
|
|
6545
|
+
return e.adds.filter((n) => !this.staged.has(ue(n))).reduce((n, s) => n + this.rowAlignedSplats(s.count), 0) <= this.freeSplatCapacity;
|
|
6473
6546
|
}
|
|
6474
6547
|
/**
|
|
6475
6548
|
* Uploads a bounded part of a replacement without rendering it.
|
|
@@ -6479,7 +6552,7 @@ class Dt extends pt {
|
|
|
6479
6552
|
if (n <= 0) return 0;
|
|
6480
6553
|
let s = 0;
|
|
6481
6554
|
for (const o of e.adds) {
|
|
6482
|
-
const a =
|
|
6555
|
+
const a = ue(o), c = this.cache.get(o.file);
|
|
6483
6556
|
if (!c) continue;
|
|
6484
6557
|
let l = this.staged.get(a);
|
|
6485
6558
|
if (!l) {
|
|
@@ -6502,7 +6575,7 @@ class Dt extends pt {
|
|
|
6502
6575
|
if (h <= 0) break;
|
|
6503
6576
|
if (this.writeInactiveRange(
|
|
6504
6577
|
l.handle,
|
|
6505
|
-
|
|
6578
|
+
Kt(c.data, o.offset + l.uploadedCount, h),
|
|
6506
6579
|
l.uploadedCount
|
|
6507
6580
|
), l.uploadedCount += h, c.lastUsed = t, s += h, l.uploadedCount === o.count) {
|
|
6508
6581
|
this.writeLodLevelChannel(l.handle, o.level);
|
|
@@ -6516,14 +6589,14 @@ class Dt extends pt {
|
|
|
6516
6589
|
/** Switches a fully staged region from old to new visibility in one tick. */
|
|
6517
6590
|
commitStagedGroup(e) {
|
|
6518
6591
|
for (const t of e.adds) {
|
|
6519
|
-
const n = this.staged.get(
|
|
6592
|
+
const n = this.staged.get(ue(t));
|
|
6520
6593
|
if (!n || n.uploadedCount !== t.count)
|
|
6521
6594
|
throw new Error("StreamedSplatMesh: incomplete staged group commit.");
|
|
6522
6595
|
}
|
|
6523
6596
|
for (const [t, n] of e.removes)
|
|
6524
6597
|
this.resident.has(t) && (this.removeRange(n.handle), this.resident.delete(t));
|
|
6525
6598
|
for (const t of e.adds) {
|
|
6526
|
-
const n =
|
|
6599
|
+
const n = ue(t), s = this.staged.get(n);
|
|
6527
6600
|
this.setRangeActive(s.handle, !0), this.resident.set(n, s), this.staged.delete(n);
|
|
6528
6601
|
}
|
|
6529
6602
|
}
|
|
@@ -6546,7 +6619,7 @@ class Dt extends pt {
|
|
|
6546
6619
|
appendRun(e, t) {
|
|
6547
6620
|
const n = this.cache.get(e.file);
|
|
6548
6621
|
if (!n) return;
|
|
6549
|
-
const s =
|
|
6622
|
+
const s = Kt(n.data, e.offset, e.count);
|
|
6550
6623
|
let o;
|
|
6551
6624
|
try {
|
|
6552
6625
|
o = this.appendRange(s);
|
|
@@ -6559,7 +6632,7 @@ class Dt extends pt {
|
|
|
6559
6632
|
return;
|
|
6560
6633
|
}
|
|
6561
6634
|
}
|
|
6562
|
-
this.resident.set(
|
|
6635
|
+
this.resident.set(ue(e), { run: e, handle: o }), n.lastUsed = t, this.writeLodLevelChannel(o, e.level);
|
|
6563
6636
|
for (const [a, c] of this.persistentChannels)
|
|
6564
6637
|
this.applyPersistentRun(a, c, e, o);
|
|
6565
6638
|
}
|
|
@@ -6604,25 +6677,25 @@ class Dt extends pt {
|
|
|
6604
6677
|
for (; l < o; ) {
|
|
6605
6678
|
const h = c.indexOf(0, l);
|
|
6606
6679
|
if (h < 0) break;
|
|
6607
|
-
const d = c.indexOf(1, h), f = d < 0 ? o : d,
|
|
6608
|
-
for (const
|
|
6609
|
-
if (!this.resident.has(
|
|
6680
|
+
const d = c.indexOf(1, h), f = d < 0 ? o : d, g = e.leafStart + h, w = e.leafStart + f;
|
|
6681
|
+
for (const m of this.scene.source.coarsestRunsFor(g, w))
|
|
6682
|
+
if (!this.resident.has(ue(m))) {
|
|
6610
6683
|
if (s) {
|
|
6611
|
-
this.fetchCountsValue.uncovered += Math.min(
|
|
6684
|
+
this.fetchCountsValue.uncovered += Math.min(m.leafEnd, w) - Math.max(m.leafStart, g);
|
|
6612
6685
|
continue;
|
|
6613
6686
|
}
|
|
6614
|
-
if (!this.cache.has(
|
|
6687
|
+
if (!this.cache.has(m.file)) {
|
|
6615
6688
|
qn(
|
|
6616
6689
|
n,
|
|
6617
|
-
|
|
6618
|
-
ii(
|
|
6619
|
-
|
|
6620
|
-
), this.fetchCountsValue.uncovered += Math.min(
|
|
6690
|
+
m.file,
|
|
6691
|
+
ii(m, this.scene.source.lodBaseDistance),
|
|
6692
|
+
m
|
|
6693
|
+
), this.fetchCountsValue.uncovered += Math.min(m.leafEnd, w) - Math.max(m.leafStart, g);
|
|
6621
6694
|
continue;
|
|
6622
6695
|
}
|
|
6623
|
-
for (const [y,
|
|
6624
|
-
|
|
6625
|
-
this.appendRun(
|
|
6696
|
+
for (const [y, v] of this.resident)
|
|
6697
|
+
v.run.leafStart < m.leafEnd && v.run.leafEnd > m.leafStart && (this.removeRange(v.handle), this.resident.delete(y));
|
|
6698
|
+
this.appendRun(m, t);
|
|
6626
6699
|
}
|
|
6627
6700
|
l = f;
|
|
6628
6701
|
}
|
|
@@ -6632,7 +6705,7 @@ class Dt extends pt {
|
|
|
6632
6705
|
if (e.size === 0) return;
|
|
6633
6706
|
ni(e, t, n);
|
|
6634
6707
|
const s = [...e.entries()].sort(
|
|
6635
|
-
(o, a) =>
|
|
6708
|
+
(o, a) => Yt(o[1], a[1], o[0], a[0])
|
|
6636
6709
|
);
|
|
6637
6710
|
this.preemptClassicFetches(s);
|
|
6638
6711
|
for (const [o, a] of s) this.requestChunk(o, a.kind, a);
|
|
@@ -6648,8 +6721,8 @@ class Dt extends pt {
|
|
|
6648
6721
|
if (this.cache.has(n) || this.fetching.has(n)) continue;
|
|
6649
6722
|
let o, a;
|
|
6650
6723
|
for (const [c, l] of this.fetching)
|
|
6651
|
-
l.classicWant && (!a ||
|
|
6652
|
-
if (a && o !== void 0 &&
|
|
6724
|
+
l.classicWant && (!a || Yt(l.classicWant, a, c, o) > 0) && (o = c, a = l.classicWant);
|
|
6725
|
+
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
6726
|
}
|
|
6654
6727
|
}
|
|
6655
6728
|
/**
|
|
@@ -6657,40 +6730,63 @@ class Dt extends pt {
|
|
|
6657
6730
|
* it is wanted. The tile has no LOD ladder and no manifest count, so it is
|
|
6658
6731
|
* appended whole (measuring its splat count at decode) and thereafter toggled
|
|
6659
6732
|
* by flipping its pool range active - never scheduled, refetched, or evicted.
|
|
6733
|
+
* When `pending` is supplied, a miss is ranked as an `'environment'` want so
|
|
6734
|
+
* it issues ahead of LOD coverage.
|
|
6660
6735
|
*/
|
|
6661
|
-
updateEnvironment(e) {
|
|
6662
|
-
const
|
|
6663
|
-
if (
|
|
6736
|
+
updateEnvironment(e, t) {
|
|
6737
|
+
const n = this.envFile;
|
|
6738
|
+
if (n === void 0 || this.envHandle !== void 0 || !this.envEnabled || this.envUnfit)
|
|
6664
6739
|
return;
|
|
6665
|
-
const
|
|
6666
|
-
if (!
|
|
6667
|
-
this.failedFiles.has(
|
|
6740
|
+
const s = this.cache.get(n);
|
|
6741
|
+
if (!s) {
|
|
6742
|
+
this.failedFiles.has(n) || (t ? this.enqueueEnvironmentFetch(t, n) : this.requestChunk(n, "priority"), this.pendingWork = !0);
|
|
6668
6743
|
return;
|
|
6669
6744
|
}
|
|
6670
|
-
const
|
|
6671
|
-
if (
|
|
6745
|
+
const o = Math.ceil(s.data.count / _e) * _e;
|
|
6746
|
+
if (o > this.capacity) {
|
|
6672
6747
|
this.envUnfit = !0, me(
|
|
6673
|
-
`the environment tile (${
|
|
6748
|
+
`the environment tile (${s.data.count} splats) exceeds the pool capacity (${this.capacity}); it will not be shown. Raise the splat budget to fit it.`
|
|
6674
6749
|
);
|
|
6675
6750
|
return;
|
|
6676
6751
|
}
|
|
6677
|
-
if (
|
|
6752
|
+
if (o > this.freeSplatCapacity) {
|
|
6678
6753
|
this.pendingWork = !0;
|
|
6679
6754
|
return;
|
|
6680
6755
|
}
|
|
6681
|
-
let
|
|
6756
|
+
let a;
|
|
6682
6757
|
try {
|
|
6683
|
-
|
|
6758
|
+
a = this.appendRange(s.data);
|
|
6684
6759
|
} catch {
|
|
6685
6760
|
this.compactionCount++, this.compact();
|
|
6686
6761
|
try {
|
|
6687
|
-
|
|
6762
|
+
a = this.appendRange(s.data);
|
|
6688
6763
|
} catch {
|
|
6689
6764
|
this.pendingWork = !0;
|
|
6690
6765
|
return;
|
|
6691
6766
|
}
|
|
6692
6767
|
}
|
|
6693
|
-
this.envHandle =
|
|
6768
|
+
this.envHandle = a, this.envSplatCount = s.data.count, s.lastUsed = e;
|
|
6769
|
+
}
|
|
6770
|
+
/** Ranks the env tile ahead of every LOD want in {@link flushClassicFetches}. */
|
|
6771
|
+
enqueueEnvironmentFetch(e, t) {
|
|
6772
|
+
e.has(t) || e.set(t, {
|
|
6773
|
+
kind: "priority",
|
|
6774
|
+
phase: "environment",
|
|
6775
|
+
distance: 0,
|
|
6776
|
+
level: 0,
|
|
6777
|
+
inView: !0,
|
|
6778
|
+
coverageGroup: -1,
|
|
6779
|
+
leafStart: 0,
|
|
6780
|
+
leafEnd: 0,
|
|
6781
|
+
screenImportance: Number.NEGATIVE_INFINITY,
|
|
6782
|
+
groupDistance: 0,
|
|
6783
|
+
groupPending: 1,
|
|
6784
|
+
groupInView: !0,
|
|
6785
|
+
groupScreenImportance: Number.NEGATIVE_INFINITY,
|
|
6786
|
+
groupFinest: !0,
|
|
6787
|
+
groupId: "environment",
|
|
6788
|
+
groupClass: 0
|
|
6789
|
+
});
|
|
6694
6790
|
}
|
|
6695
6791
|
/**
|
|
6696
6792
|
* Page-table reschedule (`foveationMode: 'pagetable'`): posts the camera to the
|
|
@@ -6734,11 +6830,11 @@ class Dt extends pt {
|
|
|
6734
6830
|
e.capacity !== t && (this.pendingWork = !0, this.lastScheduleTime = -1 / 0);
|
|
6735
6831
|
const n = performance.now(), s = e.moveSlots;
|
|
6736
6832
|
for (let f = 0; f < s.length; ) {
|
|
6737
|
-
let
|
|
6738
|
-
for (; f +
|
|
6739
|
-
|
|
6740
|
-
const
|
|
6741
|
-
|
|
6833
|
+
let g = 1;
|
|
6834
|
+
for (; f + g < s.length && s[f + g] === s[f] + g; )
|
|
6835
|
+
g++;
|
|
6836
|
+
const w = s[f], m = Math.min(g, t - w);
|
|
6837
|
+
m > 0 && this.writeSlabSlots(Ui(e.moves, f, m), w, m), f += g;
|
|
6742
6838
|
}
|
|
6743
6839
|
if (e.appends.count > 0) {
|
|
6744
6840
|
const f = Math.min(e.appends.count, t - e.appendStart);
|
|
@@ -6865,8 +6961,8 @@ class Dt extends pt {
|
|
|
6865
6961
|
h
|
|
6866
6962
|
);
|
|
6867
6963
|
else {
|
|
6868
|
-
const
|
|
6869
|
-
this.retrying.set(e, { attempts: d, readyAt: performance.now() +
|
|
6964
|
+
const g = Ei * 2 ** (d - 1);
|
|
6965
|
+
this.retrying.set(e, { attempts: d, readyAt: performance.now() + g });
|
|
6870
6966
|
}
|
|
6871
6967
|
}).finally(() => {
|
|
6872
6968
|
var h;
|
|
@@ -6896,7 +6992,7 @@ class Dt extends pt {
|
|
|
6896
6992
|
}
|
|
6897
6993
|
}
|
|
6898
6994
|
}
|
|
6899
|
-
const at = new p.Vector3(), nr = new p.Vector3(), rr = new p.Quaternion(),
|
|
6995
|
+
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
6996
|
function or(i) {
|
|
6901
6997
|
return Math.ceil(3 * Sr(i) / 4);
|
|
6902
6998
|
}
|
|
@@ -6919,7 +7015,7 @@ function Ui(i, r, e) {
|
|
|
6919
7015
|
};
|
|
6920
7016
|
}
|
|
6921
7017
|
async function _i(i, r = {}) {
|
|
6922
|
-
const e = new
|
|
7018
|
+
const e = new bn();
|
|
6923
7019
|
try {
|
|
6924
7020
|
return await e.load(i instanceof URL ? i.href : i, r);
|
|
6925
7021
|
} finally {
|
|
@@ -6927,14 +7023,14 @@ async function _i(i, r = {}) {
|
|
|
6927
7023
|
}
|
|
6928
7024
|
}
|
|
6929
7025
|
async function Bo(i, r = {}) {
|
|
6930
|
-
const e = new
|
|
7026
|
+
const e = new bn();
|
|
6931
7027
|
try {
|
|
6932
7028
|
return await e.loadFile(i, r);
|
|
6933
7029
|
} finally {
|
|
6934
7030
|
e.dispose();
|
|
6935
7031
|
}
|
|
6936
7032
|
}
|
|
6937
|
-
const
|
|
7033
|
+
const Ct = 4096, Wi = 250, Vi = (i) => {
|
|
6938
7034
|
const r = [
|
|
6939
7035
|
i.positions.buffer,
|
|
6940
7036
|
i.colors.buffer,
|
|
@@ -6945,9 +7041,9 @@ const kt = 4096, Wi = 250, Vi = (i) => {
|
|
|
6945
7041
|
if (!Number.isFinite(i) || i <= 0)
|
|
6946
7042
|
throw new RangeError("StaticLodSplatMesh budget must be a positive finite number.");
|
|
6947
7043
|
const e = Math.min(r, Math.floor(i));
|
|
6948
|
-
return e === r || e <
|
|
6949
|
-
|
|
6950
|
-
Math.floor(e /
|
|
7044
|
+
return e === r || e < Ct ? Math.max(1, e) : Math.max(
|
|
7045
|
+
Ct,
|
|
7046
|
+
Math.floor(e / Ct) * Ct
|
|
6951
7047
|
);
|
|
6952
7048
|
}, Ni = async (i, r, e) => {
|
|
6953
7049
|
const n = (await import("./static-lod-worker-D2fyqQZO.js")).default, s = new n();
|
|
@@ -6962,10 +7058,10 @@ const kt = 4096, Wi = 250, Vi = (i) => {
|
|
|
6962
7058
|
e == null || e.addEventListener("abort", c, { once: !0 }), s.onerror = (h) => {
|
|
6963
7059
|
e == null || e.removeEventListener("abort", c), s.terminate(), a(new Error(h.message));
|
|
6964
7060
|
}, s.onmessage = (h) => {
|
|
6965
|
-
var f,
|
|
7061
|
+
var f, g;
|
|
6966
7062
|
const d = h.data;
|
|
6967
7063
|
if (d.type === "progress") {
|
|
6968
|
-
(f = r.onLodProgress) == null || f.call(r, d.progress), (
|
|
7064
|
+
(f = r.onLodProgress) == null || f.call(r, d.progress), (g = r.onAutoLodProgress) == null || g.call(r, { phase: "lod-build", ...d.progress });
|
|
6969
7065
|
return;
|
|
6970
7066
|
}
|
|
6971
7067
|
if (d.type === "error") {
|
|
@@ -7016,8 +7112,8 @@ class yn extends pt {
|
|
|
7016
7112
|
const s = await _i(e, {
|
|
7017
7113
|
...t,
|
|
7018
7114
|
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, (
|
|
7115
|
+
var d, f, g;
|
|
7116
|
+
(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
7117
|
}
|
|
7022
7118
|
});
|
|
7023
7119
|
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 +7168,12 @@ class yn extends pt {
|
|
|
7072
7168
|
this.worker.postMessage(n);
|
|
7073
7169
|
}
|
|
7074
7170
|
}
|
|
7075
|
-
const
|
|
7171
|
+
const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7076
7172
|
__proto__: null,
|
|
7077
7173
|
StaticLodSplatMesh: yn
|
|
7078
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
7079
|
-
class
|
|
7080
|
-
constructor(r =
|
|
7174
|
+
}, Symbol.toStringTag, { value: "Module" })), zr = 256, Tt = "sourceId";
|
|
7175
|
+
class Oi {
|
|
7176
|
+
constructor(r = zr) {
|
|
7081
7177
|
/** `4 · MAX_SOURCES` vec4 columns; the TSL node both consumers index. */
|
|
7082
7178
|
u(this, "node");
|
|
7083
7179
|
/** CPU mirror of the same column-major matrices, for the WebGL2 sorter. */
|
|
@@ -7118,31 +7214,31 @@ function Gi(i, r) {
|
|
|
7118
7214
|
return r;
|
|
7119
7215
|
}
|
|
7120
7216
|
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,
|
|
7217
|
+
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
7218
|
return Math.sqrt(
|
|
7123
7219
|
Math.max(
|
|
7124
|
-
d + Math.abs(
|
|
7125
|
-
f + Math.abs(
|
|
7126
|
-
|
|
7220
|
+
d + Math.abs(w) + Math.abs(m),
|
|
7221
|
+
f + Math.abs(w) + Math.abs(y),
|
|
7222
|
+
g + Math.abs(m) + Math.abs(y)
|
|
7127
7223
|
)
|
|
7128
7224
|
);
|
|
7129
7225
|
}
|
|
7130
7226
|
class Io extends pt {
|
|
7131
7227
|
constructor(e) {
|
|
7132
|
-
const t = e.maxSources ??
|
|
7228
|
+
const t = e.maxSources ?? zr;
|
|
7133
7229
|
super({ capacity: e.capacity }, e);
|
|
7134
7230
|
u(this, "matrices");
|
|
7135
7231
|
u(this, "maxSources");
|
|
7136
7232
|
/** Indexed by source id; holes are left by {@link removeSource}. */
|
|
7137
7233
|
u(this, "sources", []);
|
|
7138
7234
|
u(this, "nextId", 0);
|
|
7139
|
-
this.matrices = new
|
|
7140
|
-
const n = this.channelTexture(
|
|
7235
|
+
this.matrices = new Oi(t), this.maxSources = t, this.defineChannel(Tt, { type: "float" });
|
|
7236
|
+
const n = this.channelTexture(Tt);
|
|
7141
7237
|
if (!n) throw new Error("SplatScene: sourceId channel texture missing.");
|
|
7142
7238
|
this.perSourceSort = {
|
|
7143
7239
|
sourceIdTexture: n,
|
|
7144
7240
|
columns: this.matrices.node,
|
|
7145
|
-
sourceIds: this.channelBacking(
|
|
7241
|
+
sourceIds: this.channelBacking(Tt),
|
|
7146
7242
|
matrices: this.matrices.matrices
|
|
7147
7243
|
}, this.rebuildGraph();
|
|
7148
7244
|
}
|
|
@@ -7167,7 +7263,7 @@ class Io extends pt {
|
|
|
7167
7263
|
const o = this.appendRange(e);
|
|
7168
7264
|
this.nextId++;
|
|
7169
7265
|
const a = new Float32Array(e.count);
|
|
7170
|
-
a.fill(s), this.writeChannel(o,
|
|
7266
|
+
a.fill(s), this.writeChannel(o, Tt, a);
|
|
7171
7267
|
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
7268
|
range: o,
|
|
7173
7269
|
correction: l,
|
|
@@ -7246,13 +7342,13 @@ class Io extends pt {
|
|
|
7246
7342
|
return e;
|
|
7247
7343
|
}
|
|
7248
7344
|
}
|
|
7249
|
-
const
|
|
7345
|
+
const Or = 24, qi = 32, un = 4, cr = (1 << Or) - 1;
|
|
7250
7346
|
function ji(i) {
|
|
7251
7347
|
if (!Number.isInteger(i) || i <= 0 || i % un !== 0)
|
|
7252
7348
|
throw new RangeError("Radix key width must be a positive multiple of four bits.");
|
|
7253
7349
|
return i / un;
|
|
7254
7350
|
}
|
|
7255
|
-
const
|
|
7351
|
+
const ve = 256, hn = 8, Qt = ve * hn, ut = 16, et = ve / 32, Pt = ut * et, Et = 256;
|
|
7256
7352
|
class Gr {
|
|
7257
7353
|
constructor(r) {
|
|
7258
7354
|
u(this, "kind", "radix");
|
|
@@ -7278,28 +7374,28 @@ class Gr {
|
|
|
7278
7374
|
this.renderer = r.renderer;
|
|
7279
7375
|
const o = r.exactDepth === !0;
|
|
7280
7376
|
this.exactDepth = o;
|
|
7281
|
-
const a = ji(o ? qi :
|
|
7377
|
+
const a = ji(o ? qi : Or), c = Math.ceil(e / Qt), l = ut * c, h = Math.ceil(l / Et), d = new p.StorageBufferAttribute(new Uint32Array(e), 1), f = new p.StorageBufferAttribute(new Uint32Array(e), 1), g = new p.StorageBufferAttribute(new Uint32Array(e), 1), w = new p.StorageBufferAttribute(new Uint32Array(e), 1), m = new p.StorageBufferAttribute(
|
|
7282
7378
|
new Uint32Array(l),
|
|
7283
7379
|
1
|
|
7284
|
-
), y = new p.StorageBufferAttribute(new Uint32Array(h), 1),
|
|
7285
|
-
new Uint32Array(c *
|
|
7380
|
+
), y = new p.StorageBufferAttribute(new Uint32Array(h), 1), v = new p.StorageBufferAttribute(
|
|
7381
|
+
new Uint32Array(c * Pt),
|
|
7286
7382
|
1
|
|
7287
7383
|
);
|
|
7288
7384
|
this.workingAttributes = [
|
|
7289
7385
|
d,
|
|
7290
7386
|
f,
|
|
7291
|
-
m,
|
|
7292
7387
|
g,
|
|
7293
7388
|
w,
|
|
7389
|
+
m,
|
|
7294
7390
|
y,
|
|
7295
|
-
|
|
7296
|
-
], this.mirrors = new
|
|
7297
|
-
const S = G(d, "uint", e), R = G(f, "uint", e), k = G(
|
|
7391
|
+
v
|
|
7392
|
+
], this.mirrors = new Vt(this.workingAttributes);
|
|
7393
|
+
const S = G(d, "uint", e), R = G(f, "uint", e), k = G(g, "uint", e), M = G(w, "uint", e), x = G(r.sourceIndexAttribute, "uint", e), b = G(r.splatIndexAttribute, "float", e), A = s ? G(s, "vec4", e) : null, P = G(m, "uint", l).toAtomic(), U = G(y, "uint", h), L = G(v, "uint", c * Pt).toAtomic(), W = Y(() => {
|
|
7298
7394
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7299
7395
|
const E = x.element(_), T = t ? gt(
|
|
7300
7396
|
te(E).mod(te(n)),
|
|
7301
7397
|
te(E).div(te(n))
|
|
7302
|
-
) : null,
|
|
7398
|
+
) : null, O = A ? A.element(E).xyz : ne(t, T).xyz, F = this.viewRow2.xyz.dot(O).add(this.viewRow2.w);
|
|
7303
7399
|
if (o) {
|
|
7304
7400
|
const $ = es(F), N = $.shiftRight(C(31)).equal(C(0)).select(C(2147483648), C(4294967295));
|
|
7305
7401
|
S.element(_).assign($.bitXor(N));
|
|
@@ -7307,24 +7403,24 @@ class Gr {
|
|
|
7307
7403
|
S.element(_).assign(F.sub(this.depthMin).mul(this.depthScale).clamp(0, cr).toUint());
|
|
7308
7404
|
k.element(_).assign(E);
|
|
7309
7405
|
});
|
|
7310
|
-
})().compute(e, [
|
|
7406
|
+
})().compute(e, [ve]);
|
|
7311
7407
|
this.stages.push(W);
|
|
7312
7408
|
for (let E = 0; E < a; E++) {
|
|
7313
|
-
const T = E % 2 === 0 ? S : R,
|
|
7409
|
+
const T = E % 2 === 0 ? S : R, O = E % 2 === 0 ? R : S, F = E % 2 === 0 ? k : M, $ = E % 2 === 0 ? M : k, N = C(E * un), X = Y(() => {
|
|
7314
7410
|
Ne(P.element(_), C(0));
|
|
7315
|
-
})().compute(l, [
|
|
7316
|
-
const
|
|
7411
|
+
})().compute(l, [ve]), j = Y(() => {
|
|
7412
|
+
const z = Gt.x.mul(C(Qt));
|
|
7317
7413
|
Fe(hn, ({ i: Z }) => {
|
|
7318
|
-
const q =
|
|
7414
|
+
const q = z.add(C(Z).mul(C(ve))).add(En);
|
|
7319
7415
|
se(D(q).lessThan(this.activeCount), () => {
|
|
7320
7416
|
const ee = T.element(q).shiftRight(N).bitAnd(C(15));
|
|
7321
|
-
sn(P.element(ee.mul(C(c)).add(
|
|
7417
|
+
sn(P.element(ee.mul(C(c)).add(Gt.x)), C(1));
|
|
7322
7418
|
});
|
|
7323
7419
|
});
|
|
7324
|
-
})().compute(c *
|
|
7325
|
-
const
|
|
7326
|
-
Fe(
|
|
7327
|
-
const ee =
|
|
7420
|
+
})().compute(c * ve, [ve]), K = Y(() => {
|
|
7421
|
+
const z = _.mul(C(Et)), Z = C(0).toVar();
|
|
7422
|
+
Fe(Et, ({ i: q }) => {
|
|
7423
|
+
const ee = z.add(C(q));
|
|
7328
7424
|
se(ee.lessThan(C(l)), () => {
|
|
7329
7425
|
const ie = Ve(P.element(ee)).toVar();
|
|
7330
7426
|
Ne(P.element(ee), Z), Z.addAssign(ie);
|
|
@@ -7332,54 +7428,54 @@ class Gr {
|
|
|
7332
7428
|
}), U.element(_).assign(Z);
|
|
7333
7429
|
})().compute(h, [64]), ae = Y(() => {
|
|
7334
7430
|
se(_.equal(C(0)), () => {
|
|
7335
|
-
const
|
|
7431
|
+
const z = C(0).toVar();
|
|
7336
7432
|
Fe(h, ({ i: Z }) => {
|
|
7337
7433
|
const q = U.element(Z).toVar();
|
|
7338
|
-
U.element(Z).assign(
|
|
7434
|
+
U.element(Z).assign(z), z.addAssign(q);
|
|
7339
7435
|
});
|
|
7340
7436
|
});
|
|
7341
7437
|
})().compute(1, [64]), fe = Y(() => {
|
|
7342
|
-
const
|
|
7438
|
+
const z = _.div(C(Et));
|
|
7343
7439
|
Ne(
|
|
7344
7440
|
P.element(_),
|
|
7345
|
-
Ve(P.element(_)).add(U.element(
|
|
7441
|
+
Ve(P.element(_)).add(U.element(z))
|
|
7346
7442
|
);
|
|
7347
|
-
})().compute(l, [
|
|
7348
|
-
const
|
|
7349
|
-
se(
|
|
7350
|
-
J.element(
|
|
7351
|
-
}), se(
|
|
7352
|
-
Ne(L.element(q.add(
|
|
7443
|
+
})().compute(l, [ve]), J = ts("uint", ut), ce = Y(() => {
|
|
7444
|
+
const z = En, Z = Gt.x, q = Z.mul(C(Pt));
|
|
7445
|
+
se(z.lessThan(C(ut)), () => {
|
|
7446
|
+
J.element(z).assign(C(0));
|
|
7447
|
+
}), se(z.lessThan(C(Pt)), () => {
|
|
7448
|
+
Ne(L.element(q.add(z)), C(0));
|
|
7353
7449
|
}), St(), xt(), Fe(hn, ({ i: ee }) => {
|
|
7354
|
-
const ie = Z.mul(C(Qt)).add(ee.toUint().mul(C(
|
|
7355
|
-
se(
|
|
7450
|
+
const ie = Z.mul(C(Qt)).add(ee.toUint().mul(C(ve))).add(z), be = D(ie).lessThan(this.activeCount), Ae = C(0).toVar(), Re = C(0).toVar(), ye = C(0).toVar();
|
|
7451
|
+
se(be, () => {
|
|
7356
7452
|
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(
|
|
7359
|
-
}), St(), xt(), se(
|
|
7360
|
-
const re =
|
|
7361
|
-
Fe(et, ({ i:
|
|
7362
|
-
se(C(
|
|
7453
|
+
const re = z.shiftRight(C(5)), de = z.bitAnd(C(31)), le = q.add(ye.mul(C(et))).add(re);
|
|
7454
|
+
ns(L.element(le), C(1).shiftLeft(de));
|
|
7455
|
+
}), St(), xt(), se(be, () => {
|
|
7456
|
+
const re = z.shiftRight(C(5)), de = z.bitAnd(C(31)), le = q.add(ye.mul(C(et))), Ie = J.element(ye).toVar();
|
|
7457
|
+
Fe(et, ({ i: Oe }) => {
|
|
7458
|
+
se(C(Oe).lessThan(re), () => {
|
|
7363
7459
|
Ie.addAssign(
|
|
7364
|
-
|
|
7460
|
+
$t(Ve(L.element(le.add(Oe.toUint()))))
|
|
7365
7461
|
);
|
|
7366
7462
|
});
|
|
7367
7463
|
});
|
|
7368
|
-
const
|
|
7464
|
+
const Xe = C(1).shiftLeft(de).sub(C(1));
|
|
7369
7465
|
Ie.addAssign(
|
|
7370
|
-
|
|
7466
|
+
$t(Ve(L.element(le.add(re))).bitAnd(Xe))
|
|
7371
7467
|
);
|
|
7372
7468
|
const Le = Ve(P.element(ye.mul(C(c)).add(Z))).add(Ie);
|
|
7373
|
-
|
|
7374
|
-
}), St(), xt(), se(
|
|
7469
|
+
O.element(Le).assign(Ae), $.element(Le).assign(Re);
|
|
7470
|
+
}), St(), xt(), se(z.lessThan(C(ut)), () => {
|
|
7375
7471
|
const re = C(0).toVar();
|
|
7376
|
-
Fe(et, ({ i:
|
|
7377
|
-
const le = q.add(
|
|
7378
|
-
re.addAssign(
|
|
7379
|
-
}), J.element(
|
|
7472
|
+
Fe(et, ({ i: de }) => {
|
|
7473
|
+
const le = q.add(z.mul(C(et))).add(de.toUint());
|
|
7474
|
+
re.addAssign($t(Ve(L.element(le)))), Ne(L.element(le), C(0));
|
|
7475
|
+
}), J.element(z).addAssign(re);
|
|
7380
7476
|
}), St(), xt();
|
|
7381
7477
|
});
|
|
7382
|
-
})().compute(c *
|
|
7478
|
+
})().compute(c * ve, [ve]);
|
|
7383
7479
|
this.stages.push(
|
|
7384
7480
|
X,
|
|
7385
7481
|
j,
|
|
@@ -7391,9 +7487,9 @@ class Gr {
|
|
|
7391
7487
|
}
|
|
7392
7488
|
const B = Y(() => {
|
|
7393
7489
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7394
|
-
|
|
7490
|
+
b.element(_).assign(D(k.element(_)));
|
|
7395
7491
|
});
|
|
7396
|
-
})().compute(e, [
|
|
7492
|
+
})().compute(e, [ve]);
|
|
7397
7493
|
this.stages.push(B);
|
|
7398
7494
|
}
|
|
7399
7495
|
sort(r, e, t) {
|
|
@@ -7410,14 +7506,14 @@ class Gr {
|
|
|
7410
7506
|
if (!this.disposed) {
|
|
7411
7507
|
this.disposed = !0;
|
|
7412
7508
|
for (const r of this.stages) r.dispose();
|
|
7413
|
-
|
|
7509
|
+
Nt(this.renderer, this.workingAttributes);
|
|
7414
7510
|
}
|
|
7415
7511
|
}
|
|
7416
7512
|
}
|
|
7417
7513
|
const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7418
7514
|
__proto__: null,
|
|
7419
7515
|
RadixSorter: Gr
|
|
7420
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
7516
|
+
}, Symbol.toStringTag, { value: "Module" })), Wt = class Wt {
|
|
7421
7517
|
constructor(r) {
|
|
7422
7518
|
/** World-space center xyz; w is the drawable flag (1 draw, 0 modifier-hidden). */
|
|
7423
7519
|
u(this, "centers");
|
|
@@ -7433,8 +7529,8 @@ const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7433
7529
|
u(this, "isotropicScreenRadius");
|
|
7434
7530
|
u(this, "mirrors");
|
|
7435
7531
|
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
|
|
7532
|
+
const e = r + Wt.SCRATCH_SLOTS;
|
|
7533
|
+
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
7534
|
this.centers,
|
|
7439
7535
|
this.colors,
|
|
7440
7536
|
this.covarianceA,
|
|
@@ -7467,8 +7563,8 @@ const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7467
7563
|
* same, silently, and cannot disturb a drawn slot: admission never allocates
|
|
7468
7564
|
* past `capacity` and the draw's `instanceCount` never covers it.
|
|
7469
7565
|
*/
|
|
7470
|
-
u(
|
|
7471
|
-
let
|
|
7566
|
+
u(Wt, "SCRATCH_SLOTS", 256);
|
|
7567
|
+
let _t = Wt;
|
|
7472
7568
|
class Xi {
|
|
7473
7569
|
constructor(r) {
|
|
7474
7570
|
/** World-space `xyzw` center buffer, one element per unified work slot. */
|
|
@@ -7498,15 +7594,15 @@ class Xi {
|
|
|
7498
7594
|
covarianceATexture: a,
|
|
7499
7595
|
covarianceBTexture: c,
|
|
7500
7596
|
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
|
|
7597
|
+
} = r, h = r.sh ?? null, d = r.modifiers ?? [], f = r.channels ?? /* @__PURE__ */ new Map(), g = r.localCameraPosition ?? I(new p.Vector3());
|
|
7598
|
+
this.workBuffer = r.workBuffer ?? new _t(e), this.capacity = this.workBuffer.capacity, this.centers = this.workBuffer.centers, this.colors = this.workBuffer.colors, this.covarianceA = this.workBuffer.covarianceA, this.covarianceB = this.workBuffer.covarianceB, this.isotropicMix = this.workBuffer.isotropicMix, this.isotropicScreenRadius = this.workBuffer.isotropicScreenRadius;
|
|
7599
|
+
const w = G(n, "uint", t), m = G(this.centers, "vec4", e), y = G(this.colors, "vec4", e), v = G(this.covarianceA, "vec4", e), S = G(this.covarianceB, "vec4", e), R = G(this.isotropicMix, "float", e), k = G(this.isotropicScreenRadius, "float", e);
|
|
7504
7600
|
this.pass = Y(() => {
|
|
7505
7601
|
se(D(_).lessThan(this.activeCount), () => {
|
|
7506
|
-
const M = te(
|
|
7602
|
+
const M = te(w.element(_)), x = gt(
|
|
7507
7603
|
M.mod(te(l)),
|
|
7508
7604
|
M.div(te(l))
|
|
7509
|
-
),
|
|
7605
|
+
), b = ne(s, x).xyz, A = _.add(this.targetOffset.toUint()), P = ne(a, x), U = ne(c, x), L = He(
|
|
7510
7606
|
V(P.x, P.y, P.z),
|
|
7511
7607
|
V(P.y, P.w, U.x),
|
|
7512
7608
|
V(P.z, U.x, U.y)
|
|
@@ -7516,18 +7612,18 @@ class Xi {
|
|
|
7516
7612
|
h,
|
|
7517
7613
|
{ covarianceBTexture: c },
|
|
7518
7614
|
x,
|
|
7519
|
-
|
|
7615
|
+
b.sub(g).normalize()
|
|
7520
7616
|
)
|
|
7521
7617
|
).clamp(0, 1),
|
|
7522
7618
|
W.a
|
|
7523
|
-
), E = this.sourceMatrix.mul(H(
|
|
7619
|
+
), E = this.sourceMatrix.mul(H(b, 1)).xyz, T = Rr(d, g, {
|
|
7524
7620
|
index: M,
|
|
7525
|
-
localCenter:
|
|
7621
|
+
localCenter: b,
|
|
7526
7622
|
color: B,
|
|
7527
7623
|
makeWorldCenter: () => E,
|
|
7528
7624
|
makeViewCenter: () => this.cameraViewMatrix.mul(H(E, 1)).xyz,
|
|
7529
7625
|
makeNormal: () => {
|
|
7530
|
-
const q = L.inverse(), ee =
|
|
7626
|
+
const q = L.inverse(), ee = g.sub(b), ie = q.mul(q.mul(ee)).normalize();
|
|
7531
7627
|
return ie.mul(ie.dot(ee).sign());
|
|
7532
7628
|
},
|
|
7533
7629
|
makeChannel: (q) => {
|
|
@@ -7538,9 +7634,9 @@ class Xi {
|
|
|
7538
7634
|
);
|
|
7539
7635
|
return ne(ee.texture, x).r;
|
|
7540
7636
|
}
|
|
7541
|
-
}),
|
|
7542
|
-
|
|
7543
|
-
const N = r.srgbOutput ? T.color :
|
|
7637
|
+
}), O = T.offset === null ? b : b.add(T.offset), F = T.visible === null ? vr(!0) : T.visible, $ = this.sourceMatrix.mul(H(O, 1)).xyz;
|
|
7638
|
+
m.element(A).assign(H($, F.select(D(1), D(0))));
|
|
7639
|
+
const N = r.srgbOutput ? T.color : br(T.color, p.SRGBColorSpace), X = r.lodAlpha ? N.a.mul(2) : N.a;
|
|
7544
7640
|
y.element(A).assign(H(N.rgb, F.select(X.mul(this.opacity), D(0))));
|
|
7545
7641
|
const j = T.rotation === null ? L : T.rotation.mul(L).mul(T.rotation.transpose());
|
|
7546
7642
|
let K = j;
|
|
@@ -7553,8 +7649,8 @@ class Xi {
|
|
|
7553
7649
|
q
|
|
7554
7650
|
);
|
|
7555
7651
|
}
|
|
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
|
-
|
|
7652
|
+
const ae = this.sourceMatrix.toMat3(), fe = ae.mul(K).mul(ae.transpose()), J = T.scaleSquared === null ? fe : fe.mul(T.scaleSquared), ce = J.mul(V(1, 0, 0)), z = J.mul(V(0, 1, 0)), Z = J.mul(V(0, 0, 1));
|
|
7653
|
+
v.element(A).assign(H(ce.x, ce.y, ce.z, z.y)), S.element(A).assign(H(z.z, Z.z, 0, 0)), R.element(A).assign(T.isotropicCovarianceMix === null ? D(0) : T.isotropicCovarianceMix), k.element(A).assign(
|
|
7558
7654
|
T.isotropicCovarianceMix === null ? D(0) : T.isotropicScreenRadiusPx ?? D(0)
|
|
7559
7655
|
);
|
|
7560
7656
|
});
|
|
@@ -7600,51 +7696,51 @@ class Xi {
|
|
|
7600
7696
|
function lr(i) {
|
|
7601
7697
|
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
7698
|
return r.vertexNode = Y(() => {
|
|
7603
|
-
const
|
|
7604
|
-
l.assign(n.element(
|
|
7605
|
-
const
|
|
7699
|
+
const g = t.element(_).toInt(), w = e.element(g), m = w.xyz, y = w.w.greaterThan(0.5);
|
|
7700
|
+
l.assign(n.element(g));
|
|
7701
|
+
const v = ht.mul(H(m, 1)).toVar(), S = yr.mul(v).toVar(), R = s.element(g), k = o.element(g), M = He(
|
|
7606
7702
|
V(R.x, R.y, R.z),
|
|
7607
7703
|
V(R.y, R.w, k.x),
|
|
7608
7704
|
V(R.z, k.x, k.y)
|
|
7609
|
-
), x = D(1).div(
|
|
7705
|
+
), x = D(1).div(v.z), b = x.mul(x), A = V(
|
|
7610
7706
|
i.focal.x.mul(x),
|
|
7611
7707
|
0,
|
|
7612
|
-
i.focal.x.negate().mul(
|
|
7708
|
+
i.focal.x.negate().mul(v.x).mul(b)
|
|
7613
7709
|
), P = V(
|
|
7614
7710
|
0,
|
|
7615
7711
|
i.focal.y.mul(x),
|
|
7616
|
-
i.focal.y.negate().mul(
|
|
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)),
|
|
7712
|
+
i.focal.y.negate().mul(v.y).mul(b)
|
|
7713
|
+
), U = ht.toMat3().transpose(), L = U.mul(A), W = U.mul(P), B = L.dot(M.mul(L)), E = W.dot(M.mul(W)), T = L.dot(M.mul(W)), O = v.z.negate().max(1e-4), F = i.dofFocusDistance.max(1e-4), $ = i.dofAperture.max(0).mul(0.5).div(F).atan(), N = O.sub(F).abs().div(O), X = i.focal.x.mul($.tan()), j = N.mul(X), K = j.mul(j).min(D(fn)), ae = B.add(i.projectedLowPassVariance).add(K), fe = E.add(i.projectedLowPassVariance).add(K), J = T, ce = a.element(g), z = ae.mul(fe).sub(J.mul(J)).max(1e-9), Z = B.mul(E).sub(T.mul(T)).max(0), q = B.add(i.projectedLowPassVariance).mul(E.add(i.projectedLowPassVariance)).sub(T.mul(T)).max(1e-9), ee = Z.div(z).sqrt(), ie = q.div(z).sqrt(), be = i.antialias.max(i.compensateProjectedLowPass), Ae = xe(ie, ee, be);
|
|
7618
7714
|
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,
|
|
7715
|
+
const Re = ae.add(fe).mul(0.5), ye = he(ae.sub(fe).mul(0.5), J).length();
|
|
7716
|
+
let re = Re.add(ye), de = Re.sub(ye).max(0);
|
|
7717
|
+
const le = Pr(re, de, ce);
|
|
7718
|
+
re = le.lambda1, de = le.lambda2;
|
|
7623
7719
|
const Ie = Er(
|
|
7624
7720
|
re,
|
|
7625
|
-
|
|
7721
|
+
de,
|
|
7626
7722
|
ce,
|
|
7627
|
-
c.element(
|
|
7723
|
+
c.element(g),
|
|
7628
7724
|
i.maxStdDev
|
|
7629
7725
|
);
|
|
7630
|
-
re = Ie.lambda1,
|
|
7631
|
-
const
|
|
7632
|
-
f.assign(
|
|
7633
|
-
const Le =
|
|
7634
|
-
|
|
7635
|
-
),
|
|
7636
|
-
|
|
7726
|
+
re = Ie.lambda1, de = Ie.lambda2;
|
|
7727
|
+
const Xe = l.a.mul(4).sub(3).min(5), Ye = l.a.greaterThan(1).select(i.maxStdDev.add(Xe.sub(1).mul(0.7)), i.maxStdDev);
|
|
7728
|
+
f.assign(Ye);
|
|
7729
|
+
const Le = he(J, re.sub(ae)).add(he(1e-6, 0)).normalize(), Oe = i.minSplatSizePx, vt = Le.mul(re.sqrt().mul(Ye).min(1024).max(Oe)), bt = he(Le.y, Le.x.negate()).mul(
|
|
7730
|
+
de.sqrt().mul(Ye).min(1024).max(Oe)
|
|
7731
|
+
), Ke = vt.mul(nt.x).add(bt.mul(nt.y)), Ze = S.xy.div(S.w), st = H(
|
|
7732
|
+
Ze.add(Ke.mul(2).div(i.viewport)),
|
|
7637
7733
|
S.z.div(S.w),
|
|
7638
7734
|
1
|
|
7639
7735
|
), De = S.w.mul(1.2);
|
|
7640
7736
|
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
7737
|
})(), r.fragmentNode = Y(() => {
|
|
7642
|
-
const
|
|
7643
|
-
|
|
7644
|
-
const
|
|
7738
|
+
const g = h.dot(h);
|
|
7739
|
+
Lt(g.greaterThan(1));
|
|
7740
|
+
const w = g.mul(f.mul(f).mul(-0.5)).exp(), m = l.a.mul(4).sub(3).min(5), y = m.mul(m).sub(1).mul(1 / Math.E).exp(), v = w.oneMinus().pow(y).oneMinus(), R = l.a.greaterThan(1).select(v, w.mul(l.a)).mul(d), k = Pe(i.relightMap, Ee), M = i.relightSoftness.div(i.viewport.x.max(1)), x = i.relightSoftness.div(i.viewport.y.max(1)), b = k, A = Pe(i.relightMap, Ee.add(he(M, 0))), P = Pe(i.relightMap, Ee.add(he(M.negate(), 0))), U = Pe(i.relightMap, Ee.add(he(0, x))), L = Pe(i.relightMap, Ee.add(he(0, x.negate()))), W = b.a.add(A.a).add(P.a).add(U.a).add(L.a).max(1e-4), B = b.rgb.mul(b.a).add(A.rgb.mul(A.a)).add(P.rgb.mul(P.a)).add(U.rgb.mul(U.a)).add(L.rgb.mul(L.a)).div(W), E = W.mul(0.2), T = H(B, E), O = i.relightSoftness.greaterThan(0.5).select(T, k), F = xe(
|
|
7645
7741
|
V(i.relightBackground),
|
|
7646
|
-
|
|
7647
|
-
|
|
7742
|
+
O.rgb.mul(i.relightBrightness),
|
|
7743
|
+
O.a
|
|
7648
7744
|
), $ = xe(l.rgb, l.rgb.mul(F), i.relightBlend);
|
|
7649
7745
|
return H($.mul(R), R);
|
|
7650
7746
|
})(), 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 +7803,7 @@ class Lo extends p.Mesh {
|
|
|
7707
7803
|
"UnifiedSplatRenderer requires a WebGPU backend (renderer.backend.isWebGPUBackend). On WebGL2 use standalone SplatMesh draws or static SplatScene."
|
|
7708
7804
|
);
|
|
7709
7805
|
ro(e, eo(t), t);
|
|
7710
|
-
const s = new
|
|
7806
|
+
const s = new _t(t), o = I(new p.Vector2()), a = I(new p.Vector2()), c = I(3), l = I(0), h = I(0), d = I(0.3), f = I(0), g = I(10), w = I(0), m = Wr(), y = I(0), v = I(mn), S = I(gn), R = I(wn), k = new p.StorageInstancedBufferAttribute(new Float32Array(t), 1), M = new p.InstancedBufferGeometry();
|
|
7711
7807
|
M.setIndex([0, 1, 2, 0, 2, 3]), M.setAttribute(
|
|
7712
7808
|
"position",
|
|
7713
7809
|
new p.BufferAttribute(new Float32Array([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]), 3)
|
|
@@ -7730,11 +7826,11 @@ class Lo extends p.Mesh {
|
|
|
7730
7826
|
antialias: h,
|
|
7731
7827
|
projectedLowPassVariance: d,
|
|
7732
7828
|
compensateProjectedLowPass: f,
|
|
7733
|
-
dofFocusDistance:
|
|
7734
|
-
dofAperture:
|
|
7735
|
-
relightMap:
|
|
7829
|
+
dofFocusDistance: g,
|
|
7830
|
+
dofAperture: w,
|
|
7831
|
+
relightMap: m,
|
|
7736
7832
|
relightBlend: y,
|
|
7737
|
-
relightBrightness:
|
|
7833
|
+
relightBrightness: v,
|
|
7738
7834
|
relightBackground: S,
|
|
7739
7835
|
relightSoftness: R
|
|
7740
7836
|
})
|
|
@@ -7804,15 +7900,15 @@ class Lo extends p.Mesh {
|
|
|
7804
7900
|
u(this, "disposed", !1);
|
|
7805
7901
|
const x = new Uint32Array(t);
|
|
7806
7902
|
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 =
|
|
7808
|
-
const
|
|
7903
|
+
this.workBuffer = s, this.focal = o, this.viewport = a, this.maxStdDev = c, this.minSplatSizePx = l, this.antialias = h, this.projectedLowPassVariance = d, this.compensateProjectedLowPass = f, this.dofFocusDistance = g, this.dofAperture = w, this.relightPlaceholder = m, this.relightMap = m, this.relightBlend = y, this.relightBrightness = v, this.relightBackground = S, this.relightSoftness = R, this.srgbOutput = n.srgbOutput ?? !1, this.sortScheduler = new Ur(void 0, as()), this.orderAttribute = k, this.workSourceIndex = new p.StorageBufferAttribute(x, 1), this.mirrors = new Vt([this.workSourceIndex, this.orderAttribute]), this.renderer = e;
|
|
7904
|
+
const b = {
|
|
7809
7905
|
renderer: e,
|
|
7810
7906
|
capacity: t,
|
|
7811
7907
|
centersBuffer: s.centers,
|
|
7812
7908
|
splatIndexAttribute: k,
|
|
7813
7909
|
sourceIndexAttribute: this.workSourceIndex
|
|
7814
7910
|
};
|
|
7815
|
-
this.sorter = n.sortStrategy === "exact" ? new Gr({ ...
|
|
7911
|
+
this.sorter = n.sortStrategy === "exact" ? new Gr({ ...b, exactDepth: !0 }) : new ft(b), this.frustumCulled = !1, this.matrixAutoUpdate = !1, this.matrix.identity(), this.matrixWorld.identity();
|
|
7816
7912
|
}
|
|
7817
7913
|
/** Fixed work-buffer splat capacity chosen at construction. */
|
|
7818
7914
|
get capacity() {
|
|
@@ -8023,88 +8119,88 @@ class Lo extends p.Mesh {
|
|
|
8023
8119
|
this.focal.value.set(h * c.x / 2, d * c.y / 2);
|
|
8024
8120
|
const f = this.candidateScratch;
|
|
8025
8121
|
f.length = 0;
|
|
8026
|
-
for (let
|
|
8027
|
-
const S = this.sources[
|
|
8028
|
-
S.source.update(e, this.renderer, { sort: !1 }), S.view = S.source.getUnifiedSourceView(), S.registrationOrder =
|
|
8029
|
-
}
|
|
8030
|
-
f.sort((
|
|
8031
|
-
const
|
|
8032
|
-
|
|
8033
|
-
let
|
|
8034
|
-
for (const
|
|
8035
|
-
const S =
|
|
8036
|
-
if (
|
|
8122
|
+
for (let v = 0; v < this.sources.length; v++) {
|
|
8123
|
+
const S = this.sources[v];
|
|
8124
|
+
S.source.update(e, this.renderer, { sort: !1 }), S.view = S.source.getUnifiedSourceView(), S.registrationOrder = v, f.push(S);
|
|
8125
|
+
}
|
|
8126
|
+
f.sort((v, S) => S.priority - v.priority || v.registrationOrder - S.registrationOrder), this.overflowedSourceCount = 0, this.overflowedSplatCount = 0, this.bounds.makeEmpty();
|
|
8127
|
+
const g = this.admittedScratch;
|
|
8128
|
+
g.length = 0;
|
|
8129
|
+
let w = 0;
|
|
8130
|
+
for (const v of f) {
|
|
8131
|
+
const S = v.view;
|
|
8132
|
+
if (v.graphRevision !== S.graphRevision) {
|
|
8037
8133
|
const R = this.createGather(S);
|
|
8038
|
-
|
|
8134
|
+
v.gather.dispose(), v.gather = R, v.graphRevision = S.graphRevision, v.lastGather = null;
|
|
8039
8135
|
}
|
|
8040
|
-
if (!
|
|
8041
|
-
|
|
8136
|
+
if (!v.visible) {
|
|
8137
|
+
v.lastGather = null;
|
|
8042
8138
|
continue;
|
|
8043
8139
|
}
|
|
8044
8140
|
if (S.activeCount === 0) {
|
|
8045
|
-
|
|
8141
|
+
v.lastGather = null;
|
|
8046
8142
|
continue;
|
|
8047
8143
|
}
|
|
8048
|
-
if (
|
|
8049
|
-
this.overflowedSourceCount++, this.overflowedSplatCount += S.activeCount,
|
|
8144
|
+
if (w + S.activeCount > this.workBuffer.capacity) {
|
|
8145
|
+
this.overflowedSourceCount++, this.overflowedSplatCount += S.activeCount, v.lastGather = null;
|
|
8050
8146
|
continue;
|
|
8051
8147
|
}
|
|
8052
|
-
|
|
8148
|
+
v.offset = w, g.push(v), this.bounds.union(S.worldBounds), w += S.activeCount;
|
|
8053
8149
|
}
|
|
8054
|
-
let
|
|
8055
|
-
for (const
|
|
8056
|
-
const S =
|
|
8057
|
-
|
|
8150
|
+
let m = !1;
|
|
8151
|
+
for (const v of g) {
|
|
8152
|
+
const S = v.view, R = v.offset, k = this.previousLayoutBySource.get(v.source), M = k !== void 0 && k.offset === R && k.activeCount === S.activeCount, x = v.lastGather, b = x !== null && M && x.activeCount === S.activeCount && x.contentRevision === S.contentRevision && x.offset === R && x.opacity === v.opacity && x.matrixWorld.equals(S.matrixWorld);
|
|
8153
|
+
b && // SH depends on camera position, not orientation. A stationary camera
|
|
8058
8154
|
// can reuse the resolved colors instead of re-running a full-source
|
|
8059
8155
|
// gather every frame; camera motion invalidates only SH-bearing slices.
|
|
8060
|
-
(S.sh === null || x.localCameraPosition.equals(S.localCameraPosition.value)) && (S.modifiers.length === 0 ||
|
|
8156
|
+
(S.sh === null || x.localCameraPosition.equals(S.localCameraPosition.value)) && (S.modifiers.length === 0 || v.cacheModifiers) && // Belt-and-braces: a placed pool's splats move without its own
|
|
8061
8157
|
// `matrixWorld` changing, so a cached gather would go stale silently.
|
|
8062
8158
|
// `addSource` already rejects these.
|
|
8063
|
-
!S.hasSourcePlacement || (
|
|
8159
|
+
!S.hasSourcePlacement || (v.gather.gather(
|
|
8064
8160
|
this.renderer,
|
|
8065
8161
|
S.activeCount,
|
|
8066
8162
|
R,
|
|
8067
8163
|
S.matrixWorld,
|
|
8068
8164
|
a.matrixWorldInverse,
|
|
8069
|
-
|
|
8070
|
-
),
|
|
8165
|
+
v.opacity
|
|
8166
|
+
), b || (m = !0), v.lastGather === null ? v.lastGather = {
|
|
8071
8167
|
activeCount: S.activeCount,
|
|
8072
8168
|
contentRevision: S.contentRevision,
|
|
8073
8169
|
offset: R,
|
|
8074
|
-
opacity:
|
|
8170
|
+
opacity: v.opacity,
|
|
8075
8171
|
matrixWorld: S.matrixWorld.clone(),
|
|
8076
8172
|
localCameraPosition: S.localCameraPosition.value.clone()
|
|
8077
|
-
} : (
|
|
8173
|
+
} : (v.lastGather.activeCount = S.activeCount, v.lastGather.contentRevision = S.contentRevision, v.lastGather.offset = R, v.lastGather.opacity = v.opacity, v.lastGather.matrixWorld.copy(S.matrixWorld), v.lastGather.localCameraPosition.copy(S.localCameraPosition.value)));
|
|
8078
8174
|
}
|
|
8079
|
-
let y =
|
|
8080
|
-
if (this.previousAdmittedTotal =
|
|
8081
|
-
for (let
|
|
8082
|
-
const S =
|
|
8175
|
+
let y = g.length !== this.previousLayout.length || w !== this.previousAdmittedTotal;
|
|
8176
|
+
if (this.previousAdmittedTotal = w, !y)
|
|
8177
|
+
for (let v = 0; v < g.length; v++) {
|
|
8178
|
+
const S = g[v], R = this.previousLayout[v];
|
|
8083
8179
|
if (R.source !== S.source || R.offset !== S.offset || R.activeCount !== S.view.activeCount) {
|
|
8084
8180
|
y = !0;
|
|
8085
8181
|
break;
|
|
8086
8182
|
}
|
|
8087
8183
|
}
|
|
8088
8184
|
if (y) {
|
|
8089
|
-
this.previousLayout =
|
|
8090
|
-
source:
|
|
8091
|
-
offset:
|
|
8092
|
-
activeCount:
|
|
8185
|
+
this.previousLayout = g.map((v) => ({
|
|
8186
|
+
source: v.source,
|
|
8187
|
+
offset: v.offset,
|
|
8188
|
+
activeCount: v.view.activeCount
|
|
8093
8189
|
})), this.previousLayoutBySource.clear();
|
|
8094
|
-
for (const
|
|
8190
|
+
for (const v of this.previousLayout) this.previousLayoutBySource.set(v.source, v);
|
|
8095
8191
|
}
|
|
8096
|
-
if ((
|
|
8097
|
-
const
|
|
8098
|
-
(n || this.sortScheduler.shouldSubmit(S, this.lastSortedModelView,
|
|
8192
|
+
if ((m || y) && this.sortScheduler.invalidateContent(), w > 0) {
|
|
8193
|
+
const v = performance.now(), S = a.matrixWorldInverse;
|
|
8194
|
+
(n || this.sortScheduler.shouldSubmit(S, this.lastSortedModelView, w, v)) && this.sorter.sort(S, w, this.bounds) && (this.lastSortedModelView.copy(S), this.sortScheduler.markAccepted(v));
|
|
8099
8195
|
}
|
|
8100
|
-
this.geometry.instanceCount =
|
|
8196
|
+
this.geometry.instanceCount = w, this.mirrors.settled || this.mirrors.release(this.renderer);
|
|
8101
8197
|
}
|
|
8102
8198
|
dispose() {
|
|
8103
8199
|
if (!this.disposed) {
|
|
8104
8200
|
this.disposed = !0;
|
|
8105
8201
|
for (const e of this.sources)
|
|
8106
8202
|
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(),
|
|
8203
|
+
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
8204
|
this.workBuffer.centers,
|
|
8109
8205
|
this.workBuffer.colors,
|
|
8110
8206
|
this.workBuffer.covarianceA,
|
|
@@ -8322,7 +8418,7 @@ function en(i) {
|
|
|
8322
8418
|
);
|
|
8323
8419
|
return i;
|
|
8324
8420
|
}
|
|
8325
|
-
const hr = new p.Vector3(), dr = new p.Matrix4(), fr = new p.Frustum(), tn = new p.Box3(),
|
|
8421
|
+
const hr = new p.Vector3(), dr = new p.Matrix4(), fr = new p.Frustum(), tn = new p.Box3(), Bt = new p.Sphere();
|
|
8326
8422
|
class Do {
|
|
8327
8423
|
constructor(r = {}) {
|
|
8328
8424
|
u(this, "entries", /* @__PURE__ */ new Map());
|
|
@@ -8336,7 +8432,7 @@ class Do {
|
|
|
8336
8432
|
u(this, "lastUpdateAt", -1 / 0);
|
|
8337
8433
|
/** Set by membership/priority changes: the next update ignores both damps. */
|
|
8338
8434
|
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 =
|
|
8435
|
+
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
8436
|
throw new RangeError("CameraBudgetGovernor maxWeight must be >= minWeight.");
|
|
8341
8437
|
}
|
|
8342
8438
|
/** The governor this drives; use it for fixed-weight members and diagnostics. */
|
|
@@ -8458,12 +8554,12 @@ class Do {
|
|
|
8458
8554
|
const { member: e, priority: t } = r;
|
|
8459
8555
|
if (t === 0 || !(e.effectiveVisibility ?? e.visible)) return 0;
|
|
8460
8556
|
if (e.updateWorldMatrix(!0, !1), tn.copy(e.computeSplatBounds()), tn.isEmpty()) return t * this.minWeight;
|
|
8461
|
-
tn.applyMatrix4(e.matrixWorld).getBoundingSphere(
|
|
8462
|
-
const n =
|
|
8557
|
+
tn.applyMatrix4(e.matrixWorld).getBoundingSphere(Bt);
|
|
8558
|
+
const n = Bt.radius;
|
|
8463
8559
|
if (!(n > 0)) return t * this.minWeight;
|
|
8464
|
-
const s =
|
|
8560
|
+
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
8561
|
if (!Number.isFinite(a)) return t * this.minWeight;
|
|
8466
|
-
const c = fr.intersectsSphere(
|
|
8562
|
+
const c = fr.intersectsSphere(Bt) ? 1 : this.offScreenWeight;
|
|
8467
8563
|
return t * a * c;
|
|
8468
8564
|
}
|
|
8469
8565
|
/** Whether a weight moved enough to be worth a reallocation. */
|
|
@@ -8479,7 +8575,7 @@ function ct(i, r) {
|
|
|
8479
8575
|
throw new RangeError(`CameraBudgetGovernor ${r} must be a non-negative finite number.`);
|
|
8480
8576
|
return i;
|
|
8481
8577
|
}
|
|
8482
|
-
function
|
|
8578
|
+
function It(i, r) {
|
|
8483
8579
|
if (!Number.isFinite(i) || i <= 0)
|
|
8484
8580
|
throw new RangeError(`CameraBudgetGovernor ${r} must be a positive finite number.`);
|
|
8485
8581
|
return i;
|
|
@@ -8584,7 +8680,7 @@ class _o {
|
|
|
8584
8680
|
tryAcquire(r, e) {
|
|
8585
8681
|
const t = r;
|
|
8586
8682
|
if (this.disposed || !t.live) return !1;
|
|
8587
|
-
const n =
|
|
8683
|
+
const n = Ft(t.client.weight());
|
|
8588
8684
|
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
8685
|
}
|
|
8590
8686
|
/**
|
|
@@ -8607,7 +8703,7 @@ class _o {
|
|
|
8607
8703
|
weightsChanged() {
|
|
8608
8704
|
if (!this.disposed) {
|
|
8609
8705
|
for (const r of this.entries)
|
|
8610
|
-
r.held > 0 &&
|
|
8706
|
+
r.held > 0 && Ft(r.client.weight()) <= 0 && r.client.shedFetches("sweep");
|
|
8611
8707
|
this.wake();
|
|
8612
8708
|
}
|
|
8613
8709
|
}
|
|
@@ -8642,7 +8738,7 @@ class _o {
|
|
|
8642
8738
|
shareFor(r, e) {
|
|
8643
8739
|
let t = 0, n = 0;
|
|
8644
8740
|
for (const c of this.entries) {
|
|
8645
|
-
const l = c === r ? e :
|
|
8741
|
+
const l = c === r ? e : Ft(c.client.weight());
|
|
8646
8742
|
c !== r && l <= 0 && c.held === 0 && !c.demanding || (t++, n += l);
|
|
8647
8743
|
}
|
|
8648
8744
|
if (t <= 1) return this.maxGlobalInflight;
|
|
@@ -8655,13 +8751,13 @@ class _o {
|
|
|
8655
8751
|
let r = null, e = -1 / 0;
|
|
8656
8752
|
for (const t of this.entries) {
|
|
8657
8753
|
if (!t.demanding) continue;
|
|
8658
|
-
const n =
|
|
8754
|
+
const n = Ft(t.client.weight());
|
|
8659
8755
|
n > e && (r = t, e = n);
|
|
8660
8756
|
}
|
|
8661
8757
|
r && (r.demanding = !1, r.client.onSlotAvailable());
|
|
8662
8758
|
}
|
|
8663
8759
|
}
|
|
8664
|
-
function
|
|
8760
|
+
function Ft(i) {
|
|
8665
8761
|
return Number.isFinite(i) && i > 0 ? i : 0;
|
|
8666
8762
|
}
|
|
8667
8763
|
const uo = 32 * 1024 * 1024, ho = 250, fo = 0.15;
|
|
@@ -8761,8 +8857,8 @@ class Wo {
|
|
|
8761
8857
|
for (const f of o) h += pr(f.client.weight());
|
|
8762
8858
|
const d = [];
|
|
8763
8859
|
for (const f of o) {
|
|
8764
|
-
const
|
|
8765
|
-
y >=
|
|
8860
|
+
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);
|
|
8861
|
+
y >= m ? (s.set(f, m), d.push(f)) : s.set(f, y);
|
|
8766
8862
|
}
|
|
8767
8863
|
if (d.length === 0) break;
|
|
8768
8864
|
for (const f of d)
|
|
@@ -8789,7 +8885,7 @@ function Vo(i, r) {
|
|
|
8789
8885
|
i.transform && mr(i.transform, "`transform`"), r && mr(r, "`worldMatrix`");
|
|
8790
8886
|
const e = new p.Matrix4();
|
|
8791
8887
|
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],
|
|
8888
|
+
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
8889
|
switch (i.kind) {
|
|
8794
8890
|
case "box": {
|
|
8795
8891
|
const y = i.halfExtents;
|
|
@@ -8797,28 +8893,28 @@ function Vo(i, r) {
|
|
|
8797
8893
|
throw new Error(
|
|
8798
8894
|
`createSelectionVolume: a box requires halfExtents with three positive components (got ${y ? `[${y.join(", ")}]` : "undefined"}).`
|
|
8799
8895
|
);
|
|
8800
|
-
const [
|
|
8896
|
+
const [v, S, R] = y;
|
|
8801
8897
|
return {
|
|
8802
|
-
containsPoint: (k, M, x) => Math.abs(n * k + a * M + h * x +
|
|
8898
|
+
containsPoint: (k, M, x) => Math.abs(n * k + a * M + h * x + g) <= v && Math.abs(s * k + c * M + d * x + w) <= S && Math.abs(o * k + l * M + f * x + m) <= R
|
|
8803
8899
|
};
|
|
8804
8900
|
}
|
|
8805
8901
|
case "sphere": {
|
|
8806
|
-
const y = nn(i.radius, "sphere", "radius"),
|
|
8902
|
+
const y = nn(i.radius, "sphere", "radius"), v = y * y;
|
|
8807
8903
|
return {
|
|
8808
8904
|
containsPoint: (S, R, k) => {
|
|
8809
|
-
const M = n * S + a * R + h * k +
|
|
8810
|
-
return M * M + x * x +
|
|
8905
|
+
const M = n * S + a * R + h * k + g, x = s * S + c * R + d * k + w, b = o * S + l * R + f * k + m;
|
|
8906
|
+
return M * M + x * x + b * b <= v;
|
|
8811
8907
|
}
|
|
8812
8908
|
};
|
|
8813
8909
|
}
|
|
8814
8910
|
case "cylinder": {
|
|
8815
|
-
const y = nn(i.radius, "cylinder", "radius"),
|
|
8911
|
+
const y = nn(i.radius, "cylinder", "radius"), v = nn(i.height, "cylinder", "height") / 2, S = y * y;
|
|
8816
8912
|
return {
|
|
8817
8913
|
containsPoint: (R, k, M) => {
|
|
8818
|
-
const x = s * R + c * k + d * M +
|
|
8819
|
-
if (Math.abs(x) >
|
|
8820
|
-
const
|
|
8821
|
-
return
|
|
8914
|
+
const x = s * R + c * k + d * M + w;
|
|
8915
|
+
if (Math.abs(x) > v) return !1;
|
|
8916
|
+
const b = n * R + a * k + h * M + g, A = o * R + l * k + f * M + m;
|
|
8917
|
+
return b * b + A * A <= S;
|
|
8822
8918
|
}
|
|
8823
8919
|
};
|
|
8824
8920
|
}
|
|
@@ -8862,7 +8958,7 @@ function mr(i, r) {
|
|
|
8862
8958
|
`createSelectionVolume: ${r} is not invertible (a zero scale axis collapses the volume).`
|
|
8863
8959
|
);
|
|
8864
8960
|
}
|
|
8865
|
-
function
|
|
8961
|
+
function zo(i, r) {
|
|
8866
8962
|
const e = ArrayBuffer.isView(r) ? wo(r, i.count) : mo(i, r), t = new Uint8Array(i.count);
|
|
8867
8963
|
for (const o of e) t[o] = 1;
|
|
8868
8964
|
const n = new Uint32Array(i.count - e.length);
|
|
@@ -8914,7 +9010,7 @@ function wo(i, r) {
|
|
|
8914
9010
|
}
|
|
8915
9011
|
return Uint32Array.from(i);
|
|
8916
9012
|
}
|
|
8917
|
-
class
|
|
9013
|
+
class Oo {
|
|
8918
9014
|
/** @param order Slot names, in fold order. Must be non-empty and unique. */
|
|
8919
9015
|
constructor(r) {
|
|
8920
9016
|
u(this, "order");
|
|
@@ -8979,11 +9075,12 @@ class zo {
|
|
|
8979
9075
|
}
|
|
8980
9076
|
}
|
|
8981
9077
|
export {
|
|
9078
|
+
Ho as ADAPTIVE_PIXEL_RATIO_WARMUP_FRAMES,
|
|
8982
9079
|
io as BudgetGovernor,
|
|
8983
9080
|
Do as CameraBudgetGovernor,
|
|
8984
9081
|
Wo as ChunkCacheBudget,
|
|
8985
9082
|
_o as ChunkFetchScheduler,
|
|
8986
|
-
|
|
9083
|
+
bn as ChunkLoader,
|
|
8987
9084
|
Xs as DEFAULT_FOVEATION_DRAW_BUDGET,
|
|
8988
9085
|
ln as DEFAULT_FOVEATION_TARGET_PX,
|
|
8989
9086
|
gn as DEFAULT_RELIGHT_BACKGROUND,
|
|
@@ -8993,29 +9090,29 @@ export {
|
|
|
8993
9090
|
In as MAX_DOF_RADIUS_PX,
|
|
8994
9091
|
fn as MAX_DOF_VARIANCE,
|
|
8995
9092
|
wr as MAX_SH_BANDS,
|
|
8996
|
-
|
|
8997
|
-
|
|
9093
|
+
zr as MAX_SOURCES,
|
|
9094
|
+
Oo as ModifierSlots,
|
|
8998
9095
|
wt as SPLAT_DATA_TEXTURE_WIDTH,
|
|
8999
9096
|
dt as SplatLoadError,
|
|
9000
9097
|
pt as SplatMesh,
|
|
9001
9098
|
ms as SplatPool,
|
|
9002
9099
|
Io as SplatScene,
|
|
9003
9100
|
yn as StaticLodSplatMesh,
|
|
9004
|
-
|
|
9101
|
+
Ut as StreamedSplatMesh,
|
|
9005
9102
|
Lo as UnifiedSplatRenderer,
|
|
9006
9103
|
Zi as WEBGPU_DEFAULT_MAX_STORAGE_BUFFER_BINDING_SIZE,
|
|
9007
9104
|
Ki as WORK_BUFFER_BYTES_PER_SLOT,
|
|
9008
9105
|
Yi as WORK_BUFFER_CENTERS_BYTES_PER_SPLAT,
|
|
9009
|
-
|
|
9010
|
-
|
|
9106
|
+
bs as apertureAngleFromSize,
|
|
9107
|
+
vs as assertPoolRowsFitDevice,
|
|
9011
9108
|
ro as assertStorageBufferFitsDevice,
|
|
9012
9109
|
kr as clampDepthOfFieldSettings,
|
|
9013
9110
|
_r as clampRelightingSettings,
|
|
9014
|
-
|
|
9111
|
+
Xo as classifySplatGpuClass,
|
|
9015
9112
|
To as computeDofCocVariancePx2,
|
|
9016
9113
|
Po as computeDofOpacityFade,
|
|
9017
9114
|
No as countInData,
|
|
9018
|
-
|
|
9115
|
+
vi as createLocalDataset,
|
|
9019
9116
|
Wr as createPlaceholderRelightTexture,
|
|
9020
9117
|
Vo as createSelectionVolume,
|
|
9021
9118
|
Uo as createSplatRenderer,
|
|
@@ -9024,7 +9121,7 @@ export {
|
|
|
9024
9121
|
no as deviceMaxStorageBufferBindingSize,
|
|
9025
9122
|
ws as deviceMaxTextureSize,
|
|
9026
9123
|
eo as estimateLargestStorageBufferBytes,
|
|
9027
|
-
|
|
9124
|
+
Yo as estimateSplatPoolBytes,
|
|
9028
9125
|
to as estimateUnifiedWorkBufferBytes,
|
|
9029
9126
|
Fo as estimateUnifiedWorkBufferPeakBytes,
|
|
9030
9127
|
mi as httpDatasetSource,
|
|
@@ -9032,19 +9129,19 @@ export {
|
|
|
9032
9129
|
as as isFillConstrainedSplatDevice,
|
|
9033
9130
|
_i as loadScene,
|
|
9034
9131
|
Bo as loadSceneFile,
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9132
|
+
zo as partitionSplatData,
|
|
9133
|
+
Ko as probeSplatGpuClass,
|
|
9134
|
+
Zo as recommendedMaxPixelRatio,
|
|
9038
9135
|
is as recommendedRadMaxStdDev,
|
|
9039
9136
|
ur as recommendedWebGpuRequiredLimits,
|
|
9040
|
-
|
|
9137
|
+
Qo as recommendedXrFramebufferScale,
|
|
9041
9138
|
ss as resolveCpuCacheBytes,
|
|
9042
9139
|
tt as resolveSplatBudget,
|
|
9043
9140
|
rn as resolveSplatPerformanceProfile,
|
|
9044
|
-
|
|
9141
|
+
Jo as resolveXrSplatBudget,
|
|
9045
9142
|
mo as selectInData,
|
|
9046
9143
|
qo as setVlamLogHandler,
|
|
9047
|
-
|
|
9144
|
+
ea as suggestAdaptivePixelRatio,
|
|
9048
9145
|
Jt as supportsUnifiedSplatRenderer,
|
|
9049
9146
|
Qi as supportsWebGpuPowerPreference,
|
|
9050
9147
|
Ji as webGpuPowerPreferenceOptions,
|