import type { SplatData } from '../core/splat-data'; /** Options for {@link limitSplatCount}. */ export interface LimitSplatCountOptions { /** * Attach {@link SplatData.drawOrder}, the kept splats ranked by importance, * even when nothing had to be thinned. Set for loads under a scene budget, * which may later shrink the mesh to a prefix of that order. */ drawOrder?: boolean; } /** * Thins a decoded whole-file scene to at most `maxCount` splats, keeping the * ones that contribute most to the image and dropping the rest. * * Importance is opacity × covariance trace (the sum of the squared axis * scales), a cheap proxy for how much color a splat lays down on screen; the * faint and tiny splats it drops are the ones a viewer least notices. The * cut-off is found with a log-spaced histogram in O(n), not a sort, and the * survivors keep their file order, so a Morton-ordered SOG stays spatially * coherent. Ties at the threshold are thinned evenly across the file rather * than taken first-come, which would empty one region of the scene. * * Runs in the load workers. It compacts the input's arrays **in place** and * shrinks them, so the caller must not use `data` afterwards. * * @returns `data` unchanged when it already fits and no draw order was asked * for; otherwise the thinned scene with `sourceCount` set to the original * count, and `drawOrder` when `options.drawOrder` is set. */ export declare function limitSplatCount(data: SplatData, maxCount: number, options?: LimitSplatCountOptions): SplatData; /** * Keeps the first `count` splats of `data.drawOrder` - its most visible ones - * in file order, re-ranking the draw order to match. Used on the main thread * when a scene budget must take back part of a share it already granted. * Compacts the arrays in place, like {@link limitSplatCount}. */ export declare function limitToDrawOrder(data: SplatData, count: number): SplatData; /** * The importance score of one splat: `log2(opacity × covariance trace)`, or * `-Infinity` for a splat that lays down no color. Shared by every path that * thins, so a parser scoring from its quantized inputs ranks exactly as * {@link limitSplatCount} would on the decoded scene. * * @param opacity - Linear opacity in [0, 1]. * @param trace - Sum of the covariance diagonal (the squared axis scales). */ export declare function importanceScore(opacity: number, trace: number): number; /** * Buckets importance scores into a log-spaced histogram's bins: bin 0 holds * the non-contributing splats, real scores span 1..65535 between the scene's * own minimum and maximum. */ export declare function importanceBins(scores: Float32Array): Uint16Array; /** * Marks exactly `target` splats to keep: every splat above the threshold bin, * plus an evenly spaced share of the bin itself. */ export declare function keepMostImportant(bins: Uint16Array, target: number): Uint8Array; /** * Ranks the kept splats by importance bin, highest first, file order within a * bin: a counting sort, O(n). Indices address the compacted (kept-only) * arrays. Bucketing rather than an exact sort keeps runs of neighbouring * splats together, and any prefix of the result is itself a most-visible * selection, which is what a later shrink relies on. * * @param keep - Keep mask over `bins`, or `null` when every splat was kept. * @param kept - The number of set entries in `keep` (or `bins.length`). */ export declare function drawOrderFromBins(bins: Uint16Array, keep: Uint8Array | null, kept: number): Uint32Array;