import { Object3D, type WebGPURenderer } from 'three/webgpu'; import { Collider, Emitter, Explosion, Force } from './handles.ts'; import { type DeepReadonly, type ColliderOptions, type DebugOptions, type EmitterOptions, type ExplosionOptions, type ForceOptions, type ResolvedSimulationOptions, type SimulationConfigureOptions, type SimulationOptions } from './options.ts'; export interface SimulationStats { /** Seconds simulated since initialization or the last reset. */ simulationTime: number; /** Seconds of `update()` time not simulated: each call runs at most one step. */ droppedTime: number; /** Requested GPU bytes for owned simulation and volume-rendering resources, including * screen-sized volume slices. Before initialization, an allocation estimate. Excludes * Three.js scene targets/geometry, driver alignment, and transient growth overlap. */ estimatedMemoryBytes: number; /** The content needs more than `grid.maxVoxels`; bricks it reaches past the budget stay * empty. */ gridLimited: boolean; /** Flame, heat, smoke and fuel cells the solver computed on the latest measured step: * the bricks near content and sources. */ activeVoxels: number; } /** A real-time flame simulation in a Three.js scene. It runs in world space, wherever its * emitters are: the ground is world y = 0, and storage follows the fire and smoke. Keep its * own transform at the identity. */ export declare class FireSimulation extends Object3D { readonly isFireSimulation = true; private options; private readonly host; private readonly emitters; private readonly explosions; private readonly forces; private readonly colliders; private pending; private owner?; private initialization?; private fluid?; private surface?; /** Explosions whose flames still light the scene, by their burst. */ private bursts; /** Outlines of the bricks that hold storage, while the brick view is on, and when they * were last read back. */ private brickView?; private brickRead; private debugField; private accumulator; private droppedTime; private disposed; private nextHandle; private nextEvent; constructor(options?: SimulationOptions); private assertAlive; private assertReady; initialize(renderer: WebGPURenderer): Promise; private initializeResources; addFire(options?: EmitterOptions): Emitter; addFlameJet(options?: EmitterOptions): Emitter; addSmoke(options?: EmitterOptions): Emitter; addEmitter(options?: EmitterOptions): Emitter; private addContinuous; addExplosion(options?: ExplosionOptions): Explosion; /** A force everywhere, or only within the union of the target emitters' regions. */ addForce(options: ForceOptions, targets?: readonly Emitter[]): Force; addCollider(options: ColliderOptions): Collider; /** Change any settings except voxelSize, brickSize, velocityDivisor, smokeDivisor, scalarMacCormack and seed without clearing the simulation. */ configure(patch: SimulationConfigureOptions): this; getOptions(): DeepReadonly; get stats(): DeepReadonly; /** View a single simulation field, or outline the bricks the solver computes. */ debug(options: DebugOptions): this; /** Read the bricks back for the brick view, a few times a second. */ private refreshBricks; /** Where flames light the scene from: every emitter, and every explosion while it burns * (SceneLights). */ private lightAnchors; private queueExplosion; private detach; /** Advance by `deltaSeconds` of real time in fixed 1/60 s steps, at most one a call: a * frame slower than a step drops the time it cannot keep up with (`stats.droppedTime`), * so the simulation slows down instead of running more steps every frame. */ update(deltaSeconds: number): void; /** One fixed step of the emitters, explosions, forces and colliders as they are now. */ private step; reset(): void; dispose(): void; }