/** * Per-source world transforms for a unified {@link MergedSplatMesh} pool. * * Multiple splat clouds are concatenated into one pool in their own local * space; each cloud ("source") then carries a world matrix applied **in the * shader** - never baked into the pool data. That is what lets a source move * every frame at full rate: only this small uniform array changes, and neither * the pool textures nor the sort keys are rewritten. * * The same matrix array node is shared by two consumers so they always agree, * both through `sourceWorldTransform` in `splat-mesh-material.ts`: * - the material graph, which places a splat's center and covariance **before** * the modifier stack runs, so effects see the splat where it visually is, and * - the depth sorter, which transforms each splat's center to world space * before computing its view-space depth (see `ComputeSorter`). * * Internal. Nothing here is exported from `index.ts`. */ import * as THREE from 'three/webgpu'; import { uniformArray } from 'three/tsl'; /** * Maximum number of sources a unified pool can hold. Sized generously - the * uniform array costs `4 · MAX_MERGED_SPLAT_SOURCES` vec4s (16 KB at 256), well under the * uniform-buffer limit - while bounding the per-splat index range. */ export declare const MAX_MERGED_SPLAT_SOURCES = 256; /** The channel both the material graph and the sorter read as a source id. */ export declare const SOURCE_ID_CHANNEL = "sourceId"; /** * A live, shader-visible array of source world matrices, stored as four vec4 * **columns** per source (three.js `Matrix4.elements` are column-major, so a * column maps to `elements[k*4 .. k*4+3]`). Mutating an entry re-uploads with * the frame's uniforms - no material or pipeline rebuild. */ export declare class SourceMatrixArray { /** `4 · MAX_MERGED_SPLAT_SOURCES` vec4 columns; the TSL node both consumers index. */ readonly node: ReturnType; /** CPU mirror of the same column-major matrices, for the WebGL2 sorter. */ readonly matrices: Float32Array; private readonly columns; constructor(maxSources?: number); /** Writes source `id`'s world matrix (column-major columns copied verbatim). */ set(id: number, matrix: THREE.Matrix4): void; } /** A source's local bounding sphere plus its world matrix, for pool bounds. */ export interface SourceBounds { readonly center: THREE.Vector3; readonly radius: number; readonly matrix: THREE.Matrix4; } /** * The world-space bounding sphere enclosing every source, for the sorter's * depth quantization range. Each source sphere is transformed by its matrix * (radius scaled by a conservative maximum linear stretch) and the results * unioned. */ export declare function worldBoundsOf(sources: readonly SourceBounds[], out: THREE.Sphere): THREE.Sphere;