/** * Stable water product API. * * @module three-blocks/water */ import type { Camera, Color, Matrix4, Node, NodeMaterial, Object3D, Renderer, Texture, Vector3 } from 'three/webgpu'; import type { GPUInteractionWorld } from './experimental/gpu-interaction.js'; /** Calibrated starting profile for the stable water block. */ export type WaterPreset = 'pool' | 'calm' | 'ocean-swell' | 'storm'; /** Direction accepted by one procedural ocean-wave component. */ export type WaterWaveDirection = readonly [x: number, z: number] | { /** Optional X component of an object-form direction. */ x?: number | undefined; /** Optional Y component retained for Three.js vector compatibility. */ y?: number | undefined; /** Optional Z component of an object-form direction. */ z?: number | undefined; }; /** One dispersive wave component used by the ocean presets. */ export interface WaterWaveComponentOptions { /** Explicit X wave-number component. */ kx?: number | undefined; /** Explicit Z wave-number component. */ kz?: number | undefined; /** Wavelength in world units; used when explicit wave numbers are omitted. */ wavelength?: number | undefined; /** Horizontal propagation direction. */ direction?: WaterWaveDirection | undefined; /** Surface displacement amplitude in world units. */ amplitude?: number | undefined; /** Initial phase in radians. */ phase?: number | undefined; } /** Procedural wave and wavemaker controls. */ export interface WaterVolumeWavesOptions { /** Energy multiplier applied to all components. */ energy?: number | undefined; /** Explicit wave spectrum; omission uses the ocean-swell spectrum. */ components?: readonly WaterWaveComponentOptions[] | undefined; /** Rate at which the wavemaker nudges particles toward the analytic field. */ nudgeRate?: number | undefined; /** Wave displacement scale used while seeding particles. */ seedScale?: number | undefined; } /** Fluid material controls resolved after the selected preset. */ export interface WaterVolumeMaterialOptions { /** Pressure stiffness of the fluid model. */ stiffness?: number | undefined; /** Rest density; omission derives it from the seed lattice. */ restDensity?: number | undefined; /** Velocity-gradient viscosity. */ viscosity?: number | undefined; } /** Horizontal boundary response used by the water volume. */ export type WaterVolumeBoundaryMode = 'absorbing' | 'reflective'; /** Domain-boundary response controls. */ export interface WaterVolumeBoundaryOptions { /** Grid-cell margin reserved around the simulation domain. */ margin?: number | undefined; /** Tangential velocity retained at the floor. */ floorFriction?: number | undefined; /** Restoring velocity applied near walls. */ wallPushback?: number | undefined; /** Velocity retained after boundary projection. */ velocityDamping?: number | undefined; /** Horizontal open-water or closed-tank response. */ mode?: WaterVolumeBoundaryMode | undefined; /** Normalized width of the absorbing rim. */ rimWidth?: number | undefined; /** Velocity retained inside the absorbing rim. */ rimDamping?: number | undefined; } /** Explicit particle lattice used during initial seeding. */ export interface WaterVolumeLattice { /** Particle columns along the local X axis. */ x: number; /** Particle layers along the local Y axis. */ y: number; /** Particle columns along the local Z axis. */ z: number; } /** Initial water-column layout controls. */ export interface WaterVolumeSeedOptions { /** Apply hydrostatic density profiling to the initial column. */ profile?: boolean | undefined; /** Include analytic wave displacement in the initial column. */ waves?: boolean | undefined; /** Explicit lattice dimensions, or `null` for capacity-derived dimensions. */ lattice?: WaterVolumeLattice | null | undefined; } /** World-space pointer-force controls. */ export interface WaterVolumePointerOptions { /** World-space pointer influence radius. */ radius?: number | undefined; /** Horizontal pointer impulse. */ impulse?: number | undefined; /** Per-step pointer-force decay. */ decay?: number | undefined; /** Vertical attenuation applied away from the water surface. */ verticalFalloff?: number | undefined; /** Upward impulse mixed into pointer interaction. */ lift?: number | undefined; } /** Bounded splash-emitter pool controls. */ export interface WaterVolumeSplashOptions { /** Number of independently fading splash slots. */ slots?: number | undefined; } /** Top-down surface-field and height-probe controls. */ export interface WaterSurfaceFieldOptions { /** Density threshold treated as the fluid surface. */ isoMass?: number | undefined; /** Per-step foam-coverage decay. */ foamDecay?: number | undefined; /** Foam deposition gain. */ foamGain?: number | undefined; /** Minimum particle speed contributing to foam. */ foamSpeedThreshold?: number | undefined; /** Maximum number of concurrent height probes. */ probeCapacity?: number | undefined; /** Maintain a sampleable surface-field texture. */ texture?: boolean | undefined; } /** Diffuse whitewater simulation controls. */ export interface WaterFoamOptions { /** Maximum number of live diffuse particles. */ capacity?: number | undefined; /** Diffuse particles spawned per eligible fluid particle. */ spawnRate?: number | undefined; /** Relative contribution from trapped-air motion. */ trappedAirStrength?: number | undefined; /** Relative contribution from surface crests. */ crestStrength?: number | undefined; /** Drag applied to airborne spray. */ sprayDrag?: number | undefined; /** Upward acceleration applied to submerged bubbles. */ bubbleBuoyancy?: number | undefined; /** Drag applied to submerged bubbles. */ bubbleDrag?: number | undefined; /** Fraction of diffuse particles deposited into the surface foam field. */ foamDepositRate?: number | undefined; /** Deterministic random seed. */ seed?: number | undefined; } /** Intentional performance and scheduling controls for the underlying MPM solver. */ export interface WaterVolumeSolverOptions { /** Fused production graph or readable reference graph. */ formulation?: 'fused' | 'reference' | undefined; /** Maximum particle velocity in simulation units per second. */ maxVelocity?: number | undefined; /** GPU workgroup width used by particle passes. */ workgroupSize?: number | undefined; /** Solver substeps submitted for one host step. */ substeps?: number | undefined; /** Grid accumulation strategy. */ p2gMode?: 'auto' | 'atomic' | 'subgroup' | undefined; /** Enable the density-prediction correction path. */ densityPrediction?: boolean | undefined; /** Maintain the packed render-facing grid mirror. */ packedGridMirror?: boolean | undefined; } /** * Collider-response controls for water driven by a shared interaction world. * * These are the water side of the contract: the world publishes where each * collider is and how fast it is moving, and these values decide what the * fluid does about it. They are independent of the per-source `friction` and * `restitution` carried by a {@link GPUInteractionWorld} source — for water, * the simulation-side values below are the ones that apply. */ export interface WaterVolumeInteractionOptions { /** Respond to shared colliders at all; defaults to `true`. */ enabled?: boolean | undefined; /** Interaction layer bits this volume occupies; defaults to `1`. */ layer?: number | undefined; /** Interaction mask bits this volume senses; defaults to every bit. */ mask?: number | undefined; /** Tangential fraction removed on contact; defaults to `0`, so water slides. */ friction?: number | undefined; /** Approach fraction reflected on contact; defaults to `0`, so impacts are absorbed. */ restitution?: number | undefined; /** Particle radius at which the response triggers, in world units; defaults to `0`. */ particleRadius?: number | undefined; /** Separation speed gained per world unit of penetration; defaults to `30`. */ pushRate?: number | undefined; /** Cap on the separation speed, in world units per second; defaults to `6`. */ maxSeparationSpeed?: number | undefined; } /** Construction controls for the stable ocean/tank water volume. */ export interface WaterVolumeOptions { /** Maximum particle capacity. */ capacity?: number | undefined; /** Integer MPM grid resolution. */ gridSize?: Vector3 | undefined; /** World-space dimensions of the bound water domain. */ domainSize?: Vector3 | undefined; /** Initial water-column height as a fraction of domain height. */ fillHeight?: number | undefined; /** Calibrated starting profile. */ preset?: WaterPreset | undefined; /** Positive world-space gravity magnitude in metres per second squared. */ gravity?: number | undefined; /** Wave controls, or `null` to disable procedural ocean waves. */ waves?: WaterVolumeWavesOptions | null | undefined; /** Fluid material overrides. */ material?: WaterVolumeMaterialOptions | undefined; /** Domain-boundary overrides. */ boundary?: WaterVolumeBoundaryOptions | undefined; /** Initial particle-layout overrides. */ seed?: WaterVolumeSeedOptions | undefined; /** Pointer-force overrides. */ pointer?: WaterVolumePointerOptions | undefined; /** Splash-emitter pool overrides. */ splash?: WaterVolumeSplashOptions | undefined; /** Surface-field controls, `true` for defaults, or `false` to disable it. */ surfaceField?: WaterSurfaceFieldOptions | boolean | undefined; /** Diffuse-whitewater controls, `true` for defaults, or `false` to disable it. */ foam?: WaterFoamOptions | boolean | undefined; /** * Shared interaction world whose colliders this water responds to. * * Construct it from `three-blocks/experimental/gpu-interaction`. Passing it * here is the safe path: the response compiles into the solver kernels, so * it has to be present before the first {@link WaterVolume.seed}. */ interactionWorld?: GPUInteractionWorld | null | undefined; /** Collider-response overrides applied when `interactionWorld` is set. */ interaction?: WaterVolumeInteractionOptions | undefined; /** Underlying MPM performance and scheduling overrides. */ solver?: WaterVolumeSolverOptions | undefined; } /** Domain-object binding controls for {@link WaterVolume}. */ export interface WaterVolumeDomainBindingOptions { /** Re-read the object's world matrix before every solver step. */ autoUpdate?: boolean | undefined; } /** Read-only scheduling and block-state snapshot for the most recent water step. */ export interface WaterVolumeStepStats { /** Compute dispatches submitted by the step. */ readonly dispatches: number; /** Renderer compute submissions used by the step. */ readonly submissions: number; /** Solver substeps submitted for the host delta. */ readonly substeps: number; /** Active particle count. */ readonly particleCount: number; /** Calibrated preset active for the water block. */ readonly preset: WaterPreset; /** Resolved material rest density. */ readonly restDensity: number; /** Hydrostatic seed-profile coefficient. */ readonly profileBeta: number; /** Height probes pending or sampled by the surface field. */ readonly probeCount: number; } /** Display controls for the free diffuse-whitewater sprite mesh. */ export interface WaterFoamMeshOptions { /** Base world-space particle size. */ baseSize?: number | undefined; /** Minimum rendered particle diameter in pixels. */ minPixelSize?: number | undefined; /** Maximum rendered particle diameter in pixels. */ maxPixelSize?: number | undefined; /** Fraction of the live whitewater population displayed. */ displayFraction?: number | undefined; /** World-space sun direction used for sprite lighting. */ sunDirection?: Vector3 | undefined; } /** Display controls for the surface-deposited foam sprite mesh. */ export interface WaterSurfaceFoamMeshOptions { /** Candidate foam splats emitted per surface-field column. */ splatsPerColumn?: number | undefined; /** Base world-space splat size. */ baseSize?: number | undefined; /** Minimum rendered splat diameter in pixels. */ minPixelSize?: number | undefined; /** Maximum rendered splat diameter in pixels. */ maxPixelSize?: number | undefined; /** Fraction of eligible surface splats displayed. */ displayFraction?: number | undefined; /** Stable position-jitter amplitude within a surface cell. */ jitter?: number | undefined; /** Foam coverage below which splats are rejected. */ coverageThreshold?: number | undefined; /** Feather width around the coverage threshold. */ coverageFeather?: number | undefined; /** Enable age-dependent foam appearance. */ aging?: boolean | undefined; } interface WaterVolumeConstructor { /** Create a stable particle-water simulation with optional solver controls. */ new (options?: WaterVolumeOptions): WaterVolume; readonly prototype: WaterVolume; } /** * Stable MLS-MPM water facade. Construct and configure the block, call * {@link WaterVolume.seed} once, then call {@link WaterVolume.step} before any * surface renderer update in each frame. The block owns its solver, surface field, * and optional foam simulation; the renderer and bound domain object remain caller-owned. * Invalid capacities, grids, preset values, or use before seeding/after teardown can * throw. Dispose dependent surface renderers first, then call {@link WaterVolume.dispose}; * disposal is safe to repeat. */ export interface WaterVolume { /** Calibrated preset resolved at construction. */ readonly preset: WaterPreset; /** Maximum particle capacity fixed at construction. */ readonly capacity: number; /** Elapsed simulation time; assigning updates subsequent wave evaluation. */ time: number; /** Active particle count, bounded by {@link WaterVolume.capacity}. */ particleCount: number; /** Runtime energy multiplier for the analytic wave field. */ waveEnergy: number; /** Seed solver-owned particles before the first step; repeated seeding resets them. */ seed(renderer: Renderer): this; /** Submit one water step before updating dependent surface renderers. */ step(renderer: Renderer, dt: number): this; /** Set or clear the world-space pointer force for the next step. */ setPointer(worldPosition: Vector3 | null, strength?: number): this; /** Queue one bounded world-space splash impulse for the next step. */ addSplash(x: number, y: number, z: number, vx?: number, vy?: number, vz?: number, radius?: number, strength?: number): this; /** * Attach or detach the shared interaction world before the first step. * * The collider response compiles into the solver kernels, so this must be * called before the first {@link WaterVolume.seed} or {@link WaterVolume.step}; * afterwards it throws. Pass `null` to clear. Options merge over the * constructor's `interaction` values. */ setInteractionWorld(world: GPUInteractionWorld | null, options?: WaterVolumeInteractionOptions): this; /** Bind the normalized volume to a caller-owned object's world transform. */ bindDomain(object: Object3D, options?: WaterVolumeDomainBindingOptions): this; /** Copy an explicit world transform into the volume mapping. */ setDomainTransform(matrixWorld: Matrix4): this; /** Refresh an auto-bound domain after its object transform changes. */ syncDomainTransform(force?: boolean): this; /** Change the positive world-space gravity magnitude for later steps. */ setGravity(magnitude: number): this; /** Resolve the simulated water height at a world-space X/Z position. */ getHeightAt(worldX: number, worldZ: number): Promise; /** Return the transformed still-water level at the domain center. */ getStillWaterLevel(): number; /** Return a read-only snapshot of the most recent solver step. */ getLastStepStats(): Readonly; /** Create a block-owned diffuse-particle view whose mesh resources the caller disposes. */ createFoamMesh(options?: WaterFoamMeshOptions): Object3D; /** Create a surface-field foam view whose mesh resources the caller disposes. */ createSurfaceFoamMesh(options?: WaterSurfaceFoamMeshOptions): Object3D; /** Release block-owned simulation resources; safe to call repeatedly. */ dispose(): void; } /** Runtime-identical constructor for the narrow stable water-volume facade. */ export declare const WaterVolume: WaterVolumeConstructor; /** Curated initial appearance controls for {@link WaterNodeMaterial}. */ export interface WaterMaterialUniformOptions { /** Per-channel absorption coefficients. */ absorption?: Vector3 | undefined; /** In-scattered light color. */ scatterColor?: Color | undefined; /** Depth over which in-scattering approaches its maximum. */ scatterDepth?: number | undefined; /** Refraction displacement strength. */ refractionStrength?: number | undefined; /** Chromatic dispersion strength. */ dispersionStrength?: number | undefined; /** Base water-surface roughness. */ baseRoughness?: number | undefined; /** World-space sun direction. */ sunDirection?: Vector3 | undefined; /** Sun-light color. */ sunColor?: Color | undefined; /** Direct-sun intensity. */ sunStrength?: number | undefined; /** Influence of the sun-shadow sampler on the in-scattered body colour. */ scatterShadow?: number | undefined; /** Procedural specular-glitter intensity. */ glitterStrength?: number | undefined; /** Foam albedo color. */ foamColor?: Color | undefined; /** Foam-coverage threshold. */ foamThreshold?: number | undefined; /** Foam opacity. */ foamOpacity?: number | undefined; /** Subsurface-scattering strength. */ sssStrength?: number | undefined; /** Maximum resolved optical thickness. */ thicknessMax?: number | undefined; } /** Screen-space reflection controls for the water composite. */ export interface WaterMaterialSSROptions { /** Coarse reflection-march steps. */ steps?: number | undefined; /** Binary refinement steps after an intersection. */ refine?: number | undefined; /** Maximum reflection distance in view units. */ maxDistance?: number | undefined; /** Accepted depth separation at an intersection. */ thickness?: number | undefined; } /** Construction inputs for the fullscreen stable water composite. */ export interface WaterNodeMaterialOptions { /** Borrowed scene-color texture node sampled behind the water. */ sceneColorNode: Node; /** Borrowed scene-depth texture node used for intersections and refraction. */ sceneDepthNode: Node; /** Borrowed environment texture or already-built environment node. */ envNode?: Texture | Node | null | undefined; /** Resolve the renderer's separate whitewater accumulation target. */ compositeWhitewater?: boolean | undefined; /** Enable physical screen-space refraction. */ physicalRefraction?: boolean | undefined; /** Enable reflections with defaults, provide overrides, or disable them. */ ssr?: WaterMaterialSSROptions | boolean | undefined; /** World-space width of contact foam; zero disables it. */ contactFoam?: number | undefined; /** Initial chromatic dispersion strength. */ dispersion?: number | undefined; /** Initial procedural glitter strength. */ glitter?: number | undefined; /** Suppress motion-heavy glitter and temporal effects. */ reducedMotion?: boolean | undefined; /** Use the underwater composite branch. */ underwater?: boolean | undefined; /** Curated initial appearance values copied into material-owned uniforms. */ uniforms?: WaterMaterialUniformOptions | undefined; } interface WaterNodeMaterialConstructor { /** Create the water material for a surface or raymarch renderer. */ new (surface: WaterSurfaceRenderer | WaterRayMarchRenderer, options: WaterNodeMaterialOptions): WaterNodeMaterial; readonly prototype: WaterNodeMaterial; } /** * Three.js node-material facade for compositing either public water surface * renderer. The material borrows scene nodes, environment textures, and the * renderer output; it owns only its generated graph and material renderer state. * Construct it after the surface renderer, update that renderer before drawing, * and call inherited `dispose()` before disposing the surface renderer. Missing * scene color or depth nodes throw during construction. */ export interface WaterNodeMaterial extends NodeMaterial { } /** Runtime-identical constructor for the narrow stable water-material facade. */ export declare const WaterNodeMaterial: WaterNodeMaterialConstructor; /** Construction controls for screen-space fluid surface reconstruction. */ export interface WaterSurfaceRendererOptions { /** Particle splat radius in world units. */ worldRadius?: number | undefined; /** Gaussian sigma in world units, or `null` for the radius-derived default. */ worldSigma?: number | null | undefined; /** Depth and normal target scale relative to the drawing buffer. */ resolutionScale?: number | undefined; /** Thickness target scale relative to the drawing buffer. */ thicknessScale?: number | undefined; /** Whitewater target scale relative to the drawing buffer. */ whitewaterScale?: number | undefined; /** Narrow-range horizontal/vertical filter iterations. */ filterIterations?: number | undefined; /** Maximum adaptive filter half-width in texels. */ filterRadius?: number | undefined; /** Depth discontinuity range as a multiple of particle radius. */ depthRangeFactor?: number | undefined; /** Per-particle optical-thickness contribution. */ thicknessStrength?: number | undefined; /** Thickness splat radius relative to depth splats. */ thicknessRadiusScale?: number | undefined; /** Maximum thickness depth as a multiple of particle radius. */ thicknessRangeFactor?: number | undefined; /** Thickness falloff distance, or `null` for the radius-derived default. */ thicknessFalloff?: number | null | undefined; /** Thickness Gaussian blur half-width in texels. */ thicknessBlurRadius?: number | undefined; /** Final edge-preserving depth smoothing half-width in texels. */ depthSmoothingRadius?: number | undefined; /** Local temporal-history weight. */ temporalBlend?: number | undefined; /** * Read nearest-hit view distance from an existing per-pixel surface instead * of splatting every particle — e.g. a {@link ComputeSphereRasterizer}. */ depthSource?: ((surface: WaterSurfaceRenderer) => Node) | null | undefined; /** Read optical thickness from a fullscreen node instead of splatting it. */ thicknessSource?: ((surface: WaterSurfaceRenderer) => Node) | null | undefined; } /** Perspective camera contract used by both water surface renderers. */ export interface WaterSurfaceCamera extends Camera { /** Positive near clipping plane. */ near: number; /** Far clipping plane greater than {@link WaterSurfaceCamera.near}. */ far: number; } interface WaterSurfaceRendererConstructor { /** Create a mesh-surface renderer for a water simulation. */ new (renderer: Renderer, source: WaterVolume, options?: WaterSurfaceRendererOptions): WaterSurfaceRenderer; readonly prototype: WaterSurfaceRenderer; } /** * Screen-space surface reconstruction facade for a seeded {@link WaterVolume}. * It owns all render targets, helper materials, and particle-splat geometry; the * renderer, volume, camera, and optional whitewater mesh remain caller-owned. * Call the volume step first, then {@link WaterSurfaceRenderer.update}, then draw * the water material. Invalid dimensions and use after teardown throw. Dispose * the water material first; this renderer's disposal is safe to repeat. */ export interface WaterSurfaceRenderer { /** Active particle count used by the next reconstruction update. */ readonly count: number; /** Reconstruction-target width after the most recent resize. */ readonly width: number; /** Reconstruction-target height after the most recent resize. */ readonly height: number; /** Full drawing-buffer width after the most recent resize. */ readonly fullWidth: number; /** Full drawing-buffer height after the most recent resize. */ readonly fullHeight: number; /** Attach or clear a caller-owned whitewater mesh used during accumulation. */ setWhitewaterMesh(mesh: Object3D | null | undefined): this; /** Invalidate temporal history after camera cuts or discontinuous source changes. */ resetHistory(): this; /** Change the active particle count, bounded by the source capacity. */ setCount(count: number): this; /** Change the world-space splat radius and dependent reconstruction ranges. */ setWorldRadius(radius: number): this; /** Resize owned targets to the renderer drawing buffer. */ resize(): this; /** Reconstruct water after simulation and before drawing the composite material. */ update(renderer: Renderer, camera: WaterSurfaceCamera): this; /** Release renderer-owned targets, helper materials, and geometry; safe to repeat. */ dispose(): void; } /** Runtime-identical constructor for the narrow screen-space water-renderer facade. */ export declare const WaterSurfaceRenderer: WaterSurfaceRendererConstructor; /** Named coherent quality tier for grid raymarching. */ export type WaterRayMarchQualityPreset = 'performance' | 'balanced' | 'high' | 'cinematic' | 'extreme'; /** Supported volumetric scattering sample counts. */ export type WaterRayMarchScatterSamples = 0 | 4 | 8 | 12; /** Supported analytic wave-reflection march lengths. */ export type WaterRayMarchReflectionSteps = 0 | 24 | 32; /** Complete read-only quality snapshot for grid raymarching. */ export interface WaterRayMarchQualitySettings { /** Trace-target scale relative to the drawing buffer. */ readonly resolutionScale: number; /** Whitewater-target scale relative to the drawing buffer. */ readonly whitewaterScale: number; /** Distance multiplier for each grid traversal step. */ readonly stepScale: number; /** Density threshold multiplier used to resolve the surface. */ readonly isoScale: number; /** Maximum accumulated fluid thickness in grid units. */ readonly maxThickness: number; /** Edge-aware resolve depth range. */ readonly resolveDepthRange: number; /** Hard cap on raymarch steps. */ readonly maxSteps: number; /** Binary surface-refinement steps. */ readonly refinementSteps: number; /** Normal-field smoothing strength. */ readonly normalSmoothing: number; /** Edge-aware normal-filter radius. */ readonly normalFilterRadius: number; /** Sample the continuous trilinear density field. */ readonly trilinearTracing: boolean; /** Volumetric scattering sample count. */ readonly scatterSamples: WaterRayMarchScatterSamples; /** Analytic wave-reflection march length. */ readonly wavesReflectionSteps: WaterRayMarchReflectionSteps; /** Enable temporal surface accumulation. */ readonly temporal: boolean; } /** Optional overrides applied over a named raymarch quality tier. */ export interface WaterRayMarchQualityOverrides { /** Override trace-target scale. */ resolutionScale?: number | undefined; /** Override whitewater-target scale. */ whitewaterScale?: number | undefined; /** Override grid traversal step scale. */ stepScale?: number | undefined; /** Override surface-density threshold scale. */ isoScale?: number | undefined; /** Override maximum accumulated thickness. */ maxThickness?: number | undefined; /** Override edge-aware resolve range. */ resolveDepthRange?: number | undefined; /** Override raymarch step cap. */ maxSteps?: number | undefined; /** Override binary surface refinements. */ refinementSteps?: number | undefined; /** Override normal smoothing. */ normalSmoothing?: number | undefined; /** Override normal-filter radius. */ normalFilterRadius?: number | undefined; /** Override continuous trilinear density sampling. */ trilinearTracing?: boolean | undefined; /** Override volumetric scattering samples. */ scatterSamples?: WaterRayMarchScatterSamples | undefined; /** Override analytic wave-reflection steps. */ wavesReflectionSteps?: WaterRayMarchReflectionSteps | undefined; /** Override temporal accumulation. */ temporal?: boolean | undefined; } /** Construction controls for the grid-raymarched water surface. */ export interface WaterRayMarchRendererOptions extends WaterRayMarchQualityOverrides { /** Named coherent starting tier. */ qualityPreset?: WaterRayMarchQualityPreset | string | undefined; /** Mirror packed render data into a filterable 3D texture. */ textureGridMirror?: boolean | undefined; } /** Trace-only options that can change without selecting a new quality tier. */ export interface WaterRayMarchTraceOptions { /** Hard cap on raymarch steps. */ maxSteps?: number | undefined; /** Binary surface-refinement steps. */ refinementSteps?: number | undefined; /** Normal-field smoothing strength. */ normalSmoothing?: number | undefined; /** Edge-aware normal-filter radius. */ normalFilterRadius?: number | undefined; /** Sample the continuous trilinear density field. */ trilinearTracing?: boolean | undefined; /** Volumetric scattering sample count. */ scatterSamples?: WaterRayMarchScatterSamples | undefined; /** Analytic wave-reflection march length. */ wavesReflectionSteps?: WaterRayMarchReflectionSteps | undefined; /** Enable temporal surface accumulation. */ temporal?: boolean | undefined; } /** Named quality snapshot returned by {@link WaterRayMarchRenderer.getQualitySettings}. */ export interface WaterRayMarchQualitySnapshot extends WaterRayMarchQualitySettings { /** Named tier over which explicit overrides were applied. */ readonly qualityPreset: WaterRayMarchQualityPreset; } interface WaterRayMarchRendererConstructor { /** Create a raymarched renderer for a water simulation. */ new (renderer: Renderer, water: WaterVolume, options?: WaterRayMarchRendererOptions): WaterRayMarchRenderer; readonly prototype: WaterRayMarchRenderer; } /** * Grid-raymarched surface renderer for a seeded {@link WaterVolume}. It owns its * trace, resolve, temporal, and whitewater targets plus an optional grid-mirror * texture; the renderer, volume, camera, and whitewater mesh remain caller-owned. * Call the water step first, then {@link WaterRayMarchRenderer.update}, then draw * the water material. Unknown quality tiers, incompatible solver configuration, * and use after teardown throw. Dispose the material first; renderer disposal is * safe to repeat. */ export interface WaterRayMarchRenderer { /** Named quality tier beneath the current explicit overrides. */ readonly qualityPreset: WaterRayMarchQualityPreset; /** Current trace-target scale. */ readonly resolutionScale: number; /** Current whitewater-target scale. */ readonly whitewaterScale: number; /** Attach or clear a caller-owned whitewater mesh used during accumulation. */ setWhitewaterMesh(mesh: Object3D | null | undefined): this; /** Change trace resolution and resize owned targets. */ setResolutionScale(scale: number): this; /** Change whitewater resolution and resize the owned accumulation target. */ setWhitewaterScale(scale: number): this; /** Apply a coherent quality tier followed by explicit overrides. */ setQualityPreset(name: WaterRayMarchQualityPreset | string, overrides?: WaterRayMarchQualityOverrides): this; /** Return a detached, read-only snapshot of the current quality configuration. */ getQualitySettings(): Readonly; /** Change trace-loop and temporal choices without replacing the named tier. */ setTraceOptions(options?: WaterRayMarchTraceOptions): this; /** Invalidate temporal history after camera cuts or discontinuous source changes. */ resetHistory(): this; /** Resize owned targets to the renderer drawing buffer. */ resize(): this; /** Raymarch water after simulation and before drawing the composite material. */ update(renderer: Renderer, camera: WaterSurfaceCamera): this; /** Release owned targets, materials, and grid-mirror resources; safe to repeat. */ dispose(): void; } /** Runtime-identical constructor for the narrow grid-raymarched water facade. */ export declare const WaterRayMarchRenderer: WaterRayMarchRendererConstructor; /** Stable water rasterization, composition, and quality extensions. */ export { ComputeSphereRasterizer } from './Compute/ComputeSphereRasterizer.js'; export { WaterCaustics } from './Materials/WaterCaustics.js'; export { createWaterComposite } from './Materials/WaterNodeMaterial.js'; export { WATER_RAYMARCH_QUALITY_PRESETS, getWaterRayMarchQualityPreset, } from './Materials/WaterRayMarchRenderer.js';