/** * Per-source shader tables for the pooled draw, packed into two uniform arrays. * * On WebGL2 three emits every `uniformArray` as its own std140 uniform block, * and a vertex stage may bind as few as 12 blocks (the WebGL2 minimum). One * array per per-source quantity (matrix, opacity, LOD alpha, SH range, …) * spent five of them before any host effect; these tables use two, and size * them to the live source count rather than the configured maximum. */ import * as THREE from 'three/webgpu'; import { uniformArray } from 'three/tsl'; /** vec4 rows per source in {@link PooledSourceTables.dataNode}. */ export declare const SOURCE_DATA_ROWS = 7; /** * Row: x = display opacity, y = stored-alpha multiplier (2 for `.rad`), * z = draw mask (1 drawn, 0 masked; {@link PooledSourceTables.setDrawMask}). */ export declare const ROW_PARAMS = 0; /** Rows: packed-SH dequantization range (xyz). */ export declare const ROW_SH_MIN = 1; export declare const ROW_SH_MAX = 2; /** Row: camera position in the source's local frame (xyz). */ export declare const ROW_CAMERA_LOCAL = 3; /** Rows: columns of the inverse of the source's linear (3×3) placement. */ export declare const ROW_INVERSE_LINEAR = 4; export declare class PooledSourceTables { readonly capacity: number; /** Four vec4 columns per source world matrix (three's column-major order). */ readonly columnsNode: ReturnType; /** {@link SOURCE_DATA_ROWS} vec4 rows per source. */ readonly dataNode: ReturnType; /** CPU copy of the world matrices, read by the sort worker. */ readonly matrices: Float32Array; private readonly columns; private readonly data; constructor(capacity: number); /** Smallest power-of-two capacity holding source ids `0 … count-1`. */ static capacityFor(count: number, max: number): number; /** A larger table carrying every row of `previous`. */ static grownFrom(previous: PooledSourceTables, capacity: number): PooledSourceTables; setMatrix(id: number, matrix: THREE.Matrix4): void; setParams(id: number, opacity: number, alphaScale: number): void; setOpacity(id: number, opacity: number): void; /** Draw mask for one source; independent of opacity so neither write disturbs the other. */ setDrawMask(id: number, drawn: boolean): void; setShRange(id: number, min: THREE.Vector3 | null, max: THREE.Vector3 | null): void; /** Writes the camera position in source `id`'s local frame. */ setCameraLocal(id: number, worldCamera: THREE.Vector3, sourceWorld: THREE.Matrix4): void; /** Current camera-local rows, so a secondary view can restore them. */ snapshotCameraLocal(): Float32Array; restoreCameraLocal(snapshot: Float32Array): void; private row; }