/** * Per-source modifier stacks for the pooled draw. * * `UnifiedSplatMesh` gathers each source through that source's own modifier * stack, in the source's local frame, so an SDF shape authored in mesh-local * coordinates, a main-splat tint, or a marker-only light lands exactly where * it does on a standalone mesh. The pooled draw has one vertex program for * every source, so it folds each distinct stack once and selects the result * by the instance's source id. Inside a stack the context is remapped to that * source's frame: * * - `localCenter` / `sourceCenter`: the pool-frame center (the source's local * position; sources are never re-based in the pool), * - `worldCenter`, `viewCenter`: the placed position, as drawn, * - `cameraLocal`: the camera in the source frame (a per-source table row), * - `normal`: the drawn normal brought back to the source frame, * - `localToView`: view rotation composed with the source's linear placement. * * Outputs come back to the drawn (world) frame: offsets through the source's * linear placement, rotations by conjugation. Sources sharing an identical * stack share one fold. * * Each group runs in a real branch (`If` on the instance's source id), so a * splat pays for its own source's effects only, however many markers carry * stacks. Two TSL rules keep that correct: * * - Every input the folds share (incoming color, centers, camera, normal, * placement) is materialized into a variable before the first branch. * Three emits a node where it is first referenced; a shared node first * emitted inside one group's branch would be read uninitialized by every * other group (the symptom: every source but the last group vanished). * - The branches write one packed `mat4` result, and the returned `visible` * always reads it, so the material emits the whole block at the top of its * vertex stage before any of its own branches. */ import type * as THREE from 'three/webgpu'; import type { SplatModifier } from '../../core/splat-modifier'; type Node = THREE.Node; /** One group of sources drawing through the same stack. */ export interface PooledStackGroup { ids: readonly number[]; modifiers: readonly SplatModifier[]; } /** Groups sources by stack contents (element-wise identity, order-sensitive). */ export declare function groupSourceStacks(sources: readonly { id: number; modifiers: readonly SplatModifier[]; }[]): PooledStackGroup[]; /** * Builds the one modifier that evaluates every group's stack in its sources' * frames. `null` when no source carries a stack. */ export declare function createSourceStacksModifier(options: { groups: readonly PooledStackGroup[]; sourceId: Node<'int'>; columns: { element(index: Node<'int'> | number): unknown; }; data: { element(index: Node<'int'> | number): unknown; }; }): SplatModifier | null; export {};