import * as THREE from 'three/webgpu'; import type { LodRun } from '../../streaming/lod-scheduler'; import type { LodSource, LodSourceOptions } from '../../streaming/lod-source'; import type { SplatData } from '../../core/splat-data'; export declare class RadFoveatedSource implements LodSource { budget: number; lodBaseDistance: number; lodMultiplier: number; private readonly chunkSize; private readonly chunkCounts; private readonly numChunks; private readonly decoded; /** Real bounds of a decoded chunk (AABB of its splat centers). */ private readonly bounds; /** Region estimated from decoded parents, to rank an undecoded chunk. */ private readonly estBounds; /** Per chunk: the chunks its internal splats refine into (for prefetch). */ private readonly childChunks; /** Inverts the tree's forward links to give each splat its parent's size, * for the frontier cut. Fed the same `own_size` measure the material derives. */ private readonly parentSizes; /** Splats chunk 0's coarse shell draws (the minimum-coverage floor). */ coverageSplatCount: number; /** * Whether per-splat `parent_size` is needed. Only the GPU cuts * (`foveationMode: 'band' | 'frontier'`) read `frontierParent`; the page-table * pager runs its own traversal in the worker and `gatherGlobals` never carries * it. Computing it anyway costs a full covariance pass per chunk *and* leaves * one pending-range object per internal node alive in {@link RadParentSizes} * until its child chunk decodes - tens of millions of live objects on an * 800-chunk capture, enough GC pressure to read as a frozen page. */ needsParentSizes: boolean; private readonly scratchPoint; constructor(chunkSize: number, chunkCounts: readonly number[], options: LodSourceOptions); onChunkDecoded(file: number, data: SplatData): void; /** * Computes each splat's `parent_size` for the frontier cut and packs it, with * a leaf-sign bit, onto `data.frontierParent` (uploaded into `covarianceB.w`). * * `own_size` is derived from the covariance the same way the material does - * `2·√(trace(Σ)/3)`, which with the merged-node-expanded scales already carries * the expansion - so a node's own size and its children's `parent_size` are the * identical measure, giving clean level transitions. * * The catch: this source streams chunks in **camera** order, not tree order, so * a child frequently decodes before its parent and `RadParentSizes` returns * `Infinity` (unknown). Making every such splat a root would defeat the cut - * a root always passes the "parent too big" half, so it can never be culled and * the drawn count runs away. Instead an unknown parent falls back to Spark's * ~1.75× merge ratio (`parent ≈ own · 1.75`), which brackets the splat to one * level per ray (a per-splat band). Chunk 0 - the always-resident coarse shell - * keeps the true-root sentinel so far rays always have coverage. */ private attachFrontierParent; computeDesiredRuns(cameraLocal: THREE.Vector3, frustum: THREE.Frustum, _now: number): LodRun[]; /** The coarse shell covers far/loading regions via the band cull, so there * are no separate substitute runs. */ coarsestRunsFor(): LodRun[]; /** Chunk 0's coarse shell plus the nearest decoded chunks, up to the budget. */ private buildResident; private nearestUndecodedRefinements; /** Refine priority for an undecoded chunk (higher = sooner): nearest, in-view * region first, scored against its *localized* estimated bounds (not the * scene-spanning whole-chunk bounds). Off-screen regions - not drawn - are * strongly penalized so the surfaces the camera faces refine first. */ private refineScore; private chunkDistance; /** One run covering a whole chunk; the material cull selects splats within. */ private wholeChunkRun; }