import * as THREE from 'three/webgpu'; import type { SplatDatasetSource } from './dataset-source'; /** * Parser for the Streamed SOG manifest (`lod-meta.json`, version 1). * * The manifest describes a large scene as a binary spatial tree whose leaves * each cover one region at several levels of detail. LOD level 0 is the * finest; higher levels are progressively coarser. Each leaf references, per * level, a contiguous `[offset, offset + count)` splat range inside one chunk * file (an unbundled SOG v2 directory). One chunk file serves many leaves. * * Spec: * https://developer.playcanvas.com/user-manual/gaussian-splatting/formats/streamed-sog/ */ /** A leaf's splat range at one LOD level. */ export interface LodRange { /** Index into {@link LodManifest.chunkUrls}. */ readonly file: number; /** First splat row within that chunk's decoded arrays. */ readonly offset: number; /** Number of splats. */ readonly count: number; } /** A spatial region, present at one or more LOD levels. */ export interface LodLeaf { readonly bounds: THREE.Box3; /** Range per level; `lods[level]` is undefined if absent at that level. */ readonly lods: readonly (LodRange | undefined)[]; /** * Leaves with the same group are budgeted atomically. Formats may use this * when one spatial region is split into several independently streamed * ranges: the ranges may arrive separately, but must select one LOD cut. */ readonly budgetGroup?: number; } export interface LodManifest { /** Leaves in tree-traversal order (load-bearing: adjacent leaves within a * chunk have contiguous ranges, which the scheduler coalesces into runs). */ readonly leaves: readonly LodLeaf[]; /** Absolute chunk-directory URLs, indexed by {@link LodRange.file}. */ readonly chunkUrls: readonly string[]; /** * Chunk directories relative to the manifest, aligned with {@link chunkUrls}. * Only the unbundled-SOG layout has them; formats whose chunks are single * files (LCC of either generation) leave this out. */ readonly chunkDirectories?: readonly string[]; /** Total splats per LOD level (index = level). */ readonly counts: readonly number[]; readonly lodLevels: number; /** Root bounding box of the whole scene. */ readonly bounds: THREE.Box3; } /** * Parses a `lod-meta.json` object into a flat, render-ready manifest. * * @param json - The parsed manifest JSON. * @param baseUrl - URL of the manifest, used to resolve chunk directories. * @throws {Error} on an unsupported version or malformed tree. */ export declare function parseLodManifest(json: unknown, source: SplatDatasetSource): LodManifest;