import * as THREE from 'three/webgpu'; /** Decoded frame payload retained by the bounded sequence cache. */ export type SplatSequenceFrameData = Record & { count?: number | undefined; }; /** Custom render-complete event emitted by GaussianSplats. */ export interface SplatSequenceRenderEvent { type: 'rendercomplete'; version: number; [key: string]: unknown; } /** Structural Gaussian mesh surface consumed by sequence playback. */ export type SplatSequenceMesh = THREE.Object3D & { readonly isGaussianSplats: true; count?: number | undefined; maxSplats?: number | undefined; splatCapacity?: number | undefined; renderVersion: number; _data?: SplatSequenceFrameData | undefined; _loadTimings?: Record | undefined; setData(data: SplatSequenceFrameData): void; waitForRender(options?: SplatSequenceWaitOptions): Promise; dispose(): void; addEventListener(type: 'rendercomplete', listener: (event: SplatSequenceRenderEvent) => void): void; removeEventListener(type: 'rendercomplete', listener: (event: SplatSequenceRenderEvent) => void): void; }; /** Deferred buffer source accepted by the default frame loader. */ export type SplatSequenceBuffer = ArrayBuffer | Uint8Array; /** Deferred buffer source accepted by the default frame loader. */ export interface SplatSequenceBufferSource { buffer: SplatSequenceBuffer | PromiseLike; filename?: string | undefined; name?: string | undefined; } /** URL descriptor accepted by the default frame loader and analysis helpers. */ export interface SplatSequenceURLSource { url: string; name?: string | undefined; filename?: string | undefined; } /** Every source form accepted by sequence analysis and playback. */ export type SplatSequenceSource = string | Blob | SplatSequenceMesh | SplatSequenceBufferSource | SplatSequenceURLSource; /** Typed result accepted from a custom frame loader. */ export type SplatSequenceLoadedFrameInput = SplatSequenceMesh | { splats: unknown; owned?: boolean | undefined; reusable?: boolean | undefined; }; /** Normalized ownership/cache state tracked for one loaded frame. */ export interface SplatSequenceFrameRecord { splats?: SplatSequenceMesh | undefined; data?: SplatSequenceFrameData | undefined; owned: boolean; reusable: boolean; cached?: boolean | undefined; frame?: number | undefined; onRender?: ((event: SplatSequenceRenderEvent) => void) | null | undefined; } /** Options passed through to SplatMesh loading and parsing. */ export type SplatSequenceSplatOptions = Record; /** Async custom frame-loader seam. */ export type SplatSequenceFrameLoader = (source: SplatSequenceSource, frameIndex: number, splatOptions: Readonly) => Promise | SplatSequenceLoadedFrameInput; /** Construction/loading options for {@link SplatSequence}. */ export interface SplatSequenceOptions { frameRate?: number | undefined; loop?: boolean | undefined; autoplay?: boolean | undefined; sortFrames?: boolean | undefined; disposeFrames?: boolean | undefined; strict?: boolean | undefined; playbackSpeed?: number | undefined; splatOptions?: SplatSequenceSplatOptions | undefined; loadFrame?: SplatSequenceFrameLoader | null | undefined; cacheFrames?: boolean | undefined; maxCachedFrames?: number | undefined; } /** Result of numbered-source validation and stable sorting. */ export interface SplatSequenceAnalysis { valid: boolean; errors: string[]; prefix: string | null; sources: SplatSequenceSource[]; frameNumbers: number[]; missingFrames: number[]; duplicateFrames: number[]; } /** Render-wait options forwarded to GaussianSplats. */ export interface SplatSequenceWaitOptions { afterVersion?: number | undefined; signal?: AbortSignal | undefined; timeout?: number | undefined; } /** Minimal renderer accepted by deterministic sequence preparation. */ export interface SplatSequenceRenderer { render: (...arguments_: never[]) => unknown; } /** Options for loading one frame through the render-complete gate. */ export interface SplatSequencePrepareOptions { renderer?: SplatSequenceRenderer | undefined; camera?: THREE.Camera | undefined; scene?: THREE.Scene | undefined; signal?: AbortSignal | undefined; timeout?: number | undefined; } /** Deterministic frame-range options. */ export interface SplatSequenceRenderRange { start?: number | undefined; end?: number | undefined; step?: number | undefined; signal?: AbortSignal | undefined; timeout?: number | undefined; } /** Capture context delivered after one frame completes rendering. */ export interface SplatSequenceRenderContext { frame: number; splats: SplatSequenceMesh | null; renderer: SplatSequenceRenderer; scene: THREE.Scene; camera: THREE.Camera; } /** Sequence lifecycle and frame-loading event payloads. */ export interface SplatSequenceEventMap extends THREE.Object3DEventMap { frameschange: { frames: SplatSequenceSource[]; }; play: Record; pause: Record; ended: Record; loadstart: { frame: number; source: SplatSequenceSource | undefined; cached?: boolean | undefined; }; loaderror: { frame: number; source: SplatSequenceSource | undefined; error: unknown; }; framechange: { frame: number; splats: SplatSequenceMesh; previous: SplatSequenceMesh | null; reused?: boolean | undefined; }; frameready: { frame: number; splats: SplatSequenceMesh; renderEvent: SplatSequenceRenderEvent; }; dispose: Record; } /** * Plays numbered Gaussian splat files as a frame sequence. * * Call {@link SplatSequence#update} from the application render loop. Frame requests are * coalesced while loading, so slow decoders skip stale frames instead of building a queue. * * @class SplatSequence * @extends THREE.Object3D * @short Playback controller for animated Gaussian splat frame sequences. * @category GaussianSplatting * @tags WebGPU, Animation */ export declare class SplatSequence extends THREE.Object3D { /** Runtime type guard that is always `true` for splat sequences. */ readonly isSplatSequence: true; /** Playback frames per second. */ frameRate: number; /** Whether playback wraps at the final frame. */ loop: boolean; /** Playback-speed multiplier. */ playbackSpeed: number; /** Whether numbered sources are sorted before playback. */ sortFrames: boolean; /** Whether sequence-owned frame meshes are disposed after replacement. */ disposeFrames: boolean; /** Whether inputs must form one complete numbered sequence. */ strict: boolean; /** Options forwarded when a frame creates its Gaussian mesh. */ splatOptions: SplatSequenceSplatOptions; /** Optional custom asynchronous frame loader. */ loadFrame: SplatSequenceFrameLoader | null; /** Ordered frame sources currently assigned to the sequence. */ frames: SplatSequenceSource[]; /** Renderable splat mesh for the active frame, or `null` before loading. */ activeSplats: SplatSequenceMesh | null; /** Zero-based active frame index, or `-1` before a frame is active. */ currentFrame: number; /** Current playback time in seconds. */ time: number; /** Whether calls to {@link update} advance playback. */ playing: boolean; /** Whether decoded owned frames are retained for reuse. */ cacheFrames: boolean; /** Maximum number of decoded owned frames retained by the cache. */ maxCachedFrames: number; private _activeRecord; private _retiredRecords; private _requestedFrame; private _loadPromise; private _generation; private _disposed; private _readyFrame; private _readySplats; private _frameCache; /** * Inspect numbered PLY sources for sequence compatibility. * * @param {Array<*>} sources Candidate frame sources. * @returns {Object} Validation result, sorted sources, and missing or duplicate frame numbers. */ static analyze(sources: readonly SplatSequenceSource[]): SplatSequenceAnalysis; /** Return whether sources form one valid numbered splat sequence. */ static isSequence(sources: readonly SplatSequenceSource[]): boolean; /** * Group mixed files into numbered PLY sequences by filename prefix. * * @param {Array<*>} sources Mixed file sources. * @returns {Array} Sequence validation records. */ static groupSequences(sources: readonly SplatSequenceSource[]): SplatSequenceAnalysis[]; /** * Strictly validate and load a local numbered PLY sequence. * * @param {Array<*>} files Numbered PLY Files or Blobs. * @param {Object} [options={}] Sequence options. * @returns {Promise} Loaded sequence. */ static fromFiles(files: SplatSequenceSource[], options?: SplatSequenceOptions): Promise; /** * Load a sequence and its first frame. * * @param {Array<*>} sources Frame URLs, Files/Blobs, SplatMesh objects, or { buffer, filename } records. * @param {Object} [options={}] Sequence and SplatMesh options. * @returns {Promise} Loaded sequence. */ static load(sources: SplatSequenceSource[], options?: SplatSequenceOptions): Promise; /** * Create a splat sequence controller. * * @param {Array<*>} [sources=[]] Frame sources. * @param {Object} [options={}] Sequence options. * @param {number} [options.frameRate=30] Playback frames per second. * @param {boolean} [options.loop=true] Loop playback at the end. * @param {boolean} [options.autoplay=false] Begin playing after SplatSequence.load resolves. * @param {boolean} [options.sortFrames=true] Sort sources by trailing frame number. * @param {boolean} [options.disposeFrames=true] Dispose sequence-owned frames after replacement. * @param {boolean} [options.strict=false] Require one valid numbered PLY sequence. * @param {number} [options.playbackSpeed=1] Playback speed multiplier. * @param {Object} [options.splatOptions] Options passed to SplatMesh.load or SplatMesh.parse. * @param {Function} [options.loadFrame] Optional async custom frame loader. */ constructor(sources?: SplatSequenceSource[], options?: SplatSequenceOptions); /** Number of frame sources in the sequence. */ get frameCount(): number; /** Sequence duration in seconds. */ get duration(): number; /** * Replace the sequence sources and clear the active frame. * * @param {Array<*>} sources New frame sources. * @returns {this} */ setFrames(sources: SplatSequenceSource[]): this; /** Begin sequence playback. */ play(): this; /** Pause sequence playback. */ pause(): this; /** Stop playback and request the first frame. */ stop(): this; /** * Request a frame. Newer requests replace stale queued requests while a frame loads. * * @param {number} frameIndex Zero-based frame index. * @returns {Promise} Active SplatMesh after queued loading completes. */ setFrame(frameIndex: number): Promise; /** Seek to a zero-based frame index. */ seekFrame(frameIndex: number): Promise; /** Seek to a playback time in seconds. */ seekSeconds(seconds: number): Promise; /** * Load a frame and wait until it completes a render. When a renderer is provided, this * method renders the containing scene immediately; otherwise it waits for the application render loop. * * @param {number} frameIndex Zero-based frame index. * @param {Object} [options={}] Preparation options. * @param {THREE.WebGPURenderer} [options.renderer] Renderer used for an immediate deterministic render. * @param {THREE.Camera} [options.camera] Camera used for an immediate deterministic render. * @param {THREE.Scene} [options.scene] Scene to render. Defaults to the containing scene. * @param {AbortSignal} [options.signal] Optional cancellation signal. * @param {number} [options.timeout=0] Optional render wait timeout in milliseconds. * @returns {Promise} Render-ready SplatMesh. */ prepareFrame(frameIndex: number, options?: SplatSequencePrepareOptions): Promise; /** * Deterministically render a frame range and invoke a capture callback after every frame. * * @param {THREE.WebGPURenderer} renderer Renderer used for each frame. * @param {THREE.Scene} scene Scene containing this sequence. * @param {THREE.Camera} camera Render camera. * @param {Function} onFrame Async callback receiving { frame, splats, renderer, scene, camera }. * @param {Object} [options={}] Range and cancellation options. * @returns {Promise} */ renderFrames(renderer: SplatSequenceRenderer, scene: THREE.Scene, camera: THREE.Camera, onFrame: (context: SplatSequenceRenderContext) => Promise | unknown, options?: SplatSequenceRenderRange): Promise; /** Activate the next frame, wrapping at the end. */ nextFrame(): Promise; /** Activate the previous frame, wrapping at the beginning. */ previousFrame(): Promise; /** * Advance playback and request the corresponding frame. * * @param {number} deltaSeconds Elapsed seconds since the previous update. */ update(deltaSeconds: number): void; private _loadFrame; private _cacheFrameData; private _touchFrameCache; private _requestFrame; private _drainFrameRequests; private _activateFrame; private _reuseActiveFrame; private _onFrameRendered; private _releaseActiveFrame; private _releaseAllFrames; private _disposeRecord; /** Dispose the sequence and its active sequence-owned frame. */ dispose(): void; }