import type { BrickBox, FluidSimulation } from './FluidSimulation.ts'; import type { LightingDivisor, RenderSettings } from './types.ts'; /** What the renderer reads of a simulation. */ export type RenderSource = Pick; /** * The renderer's camera-independent state: the boxes it marches and their page tables, * and in every brick slot the flags of its 8-cell blocks and its incident light * at the selected resolution (lighting.wgsl). Slots keep both as long as they keep their bricks. */ export declare class VolumeLighting { private device; private uniform; private sampler; private blackbodyTexture; /** The boxes (rgba32float, `BOX_ROW` a row, two texels each), and their page tables * (r32float, `PAGE_ROW` entries a row). */ boxes: GPUTexture; pages: GPUTexture; /** Every tile slot's coordinates and box (RenderBricks.tiles). */ tiles: GPUBuffer; /** Flags of every slot's 8-cell blocks (rg16float), and its incident light with an * apron (rgba16float), laid out slot by slot like the pools. */ occupancy: GPUTexture; light: GPUTexture; /** Fine heat/flame/fuel. Full-resolution smoke uses a smoothed RGBA scratch copy; * coarse smoke keeps the original fine fields and borrows its own R16 predictor. * The simulation owns both borrowed textures. */ fields: GPUTexture; smoke: GPUTexture; /** The boxes as last uploaded, in bricks, and the version of the simulation's bricks * they came with (RenderBricks). */ boxList: readonly BrickBox[]; version: number; private pipelines; /** The boxes changed since the last `encode`: their page tables are empty, and bricks * that were outside every box need their occupancy and light. */ private stale; private lastStep; private lastLightStep; /** The step the occupancy was last built for, or -1 when it is out of date. */ private occupancyStep; private lastSettings; /** Bind groups for each field pool, which alternate with their scratch. */ private groups; private constructor(); static create(device: GPUDevice, uniform: GPUBuffer, sampler: GPUSampler, blackbodyTexture: GPUTexture): Promise; invalidate(): void; /** Bytes of the native textures/buffer this cache owns, from their actual sizes. * The simulation accounts for the borrowed predictor textures; the caller owns the * uniform and blackbody table. Driver padding is not exposed by WebGPU. */ get memoryBytes(): number; /** * Upload the simulation's boxes, empty page tables for them and its tile table, after * they changed. The next `encode` fills the page tables. True when they changed. */ sync(simulation: RenderSource): boolean; /** Size the rendering pools to the field pool's slots; true when their layout changed. */ private sizePools; /** * Bring the page tables, the occupancy and the lighting up to date with the simulation's * latest step: the page tables and occupancy every step. Incident light is smooth in * time, so it is built every second step, the slots given out in between at once; new * settings, boxes or pools build it whole at once. True when it encoded work. */ encode(encoder: GPUCommandEncoder, simulation: RenderSource, settings: RenderSettings, sceneKey?: string, lightingDivisor?: LightingDivisor): boolean; dispose(): void; }