/** * The `.csgs` driver of {@link SplatClipMesh}: on WebGPU a `SplatModifier` * evaluates the hat curves (`csgs-curve-modifier.ts`), so a section is * uploaded once and a frame costs no CPU evaluation and no upload. N pool * ranges and N parts of a knot texture hold resident sections; the next ones * in the direction of play are staged a chunk at a time under a byte budget, * and a section change flips two active prefixes and the uniforms in one * frame. A position-only modifier in `sortDisplacement` lets a standalone * WebGPU sort see the moving centers; a unified draw sorts gathered centers * and honours the same `invalidateSortDisplacement` revision. * * Elsewhere (WebGL2, a worker sorter, or a clip the GPU path cannot hold) the * clip plays on the shared frame path, its worker evaluating whole frames. */ import * as THREE from 'three/webgpu'; import { type CsgsGpuSection } from '../formats/csgs/csgs-gpu-layout'; import type { SplatClip } from './splat-clip'; import type { SplatClipDriver, SplatClipFrame, SplatFrameBuffers } from './splat-clip-playback'; /** * What a host knows of one section of a `.csgs` clip: a span of frames * played by one fixed set of splats. * * @experimental */ export interface CsgsSectionInfo { /** First frame of the section. */ readonly g0: number; /** Frames the section spans. */ readonly nframes: number; /** Splats the section holds (alive or not at a given frame). */ readonly count: number; /** * Whether the GPU path can play this section: every knot fits a half * float, and no curve has more than 7 knots. */ readonly gpuEligible: boolean; } /** What the `.csgs` driver plays from: a worker-backed clip, or the procedural test clip. */ export interface CsgsClipSource { readonly sections: readonly CsgsSectionInfo[]; /** Evaluates integer frame `frame`, every splat of its section in its own slot. */ evaluate(frame: number, recycle?: SplatFrameBuffers, sh?: boolean): Promise; /** Packs section `index` for the GPU path. */ gpuSection(index: number): Promise; } /** Index of the section holding integer frame `frame`, or -1. */ export declare function csgsSectionAt(sections: readonly CsgsSectionInfo[], frame: number): number; /** One box around every section's position knots (empty for no splats). */ export declare function unionCsgsBounds(sections: readonly CsgsSectionInfo[]): THREE.Box3; /** The `.csgs` driver over `source` (see the module comment). */ export declare function csgsClipDriver(clip: Pick, source: CsgsClipSource): SplatClipDriver;