import * as THREE from 'three/webgpu'; import type { TSLFloatNode, TSLTextureNode, TSLUniformNode, TSLVec3Node } from '../types/tsl.cjs'; import type { WaterVolume } from '../Simulation/MPM/WaterVolume.cjs'; type WaterFloatUniform = TSLUniformNode<'float', number>; type WaterVec3Uniform = TSLUniformNode<'vec3', THREE.Vector3>; export interface WaterCausticsOptions { resolution?: number | undefined; intensity?: number | undefined; chromatic?: boolean | undefined; temporal?: number | boolean | undefined; } export interface WaterCausticsUniforms { sunDirection: WaterVec3Uniform; intensity: WaterFloatUniform; absorption: WaterFloatUniform; temporal: WaterFloatUniform; historyValid: WaterFloatUniform; } /** * Simulation-driven sun caustics and column transmittance for a WaterVolume. * A displaced SurfaceField grid conserves source-cell energy while refracting * it onto the floor plane; a small temporal resolve settles triangle shimmer. * * @short Refracted SurfaceField beam-compression caustics + water sun shadow texture. * @category Materials * @tags WebGPU, TSL, Water, Caustics, Shadows */ export declare class WaterCaustics { /** Borrowed water simulation that supplies the surface field and transforms. */ water: WaterVolume; /** Width and height of the square caustics targets. */ resolution: number; /** Whether sampling applies a small wavelength-dependent offset. */ chromatic: boolean; /** Mutable sun, intensity, absorption, and temporal uniforms. */ uniforms: WaterCausticsUniforms; private _currentTarget; private _historyRead; private _historyWrite; private _textureNode; private _historyInputNode; private _scene; private _camera; private _mesh; private _quad; private _material; private _temporalMaterial; private _clearColor; private _disposed; /** Create simulation-driven caustics for a texture-backed water surface. */ constructor(water: WaterVolume, { resolution, intensity, chromatic, temporal, }?: WaterCausticsOptions); private _buildCausticsMaterial; private _buildTemporalMaterial; /** Latest resolved caustics and sun-transmittance texture. */ get texture(): THREE.Texture; /** Stable texture node; its backing history texture follows ping-pong swaps. */ get textureNode(): TSLTextureNode; /** Sample RGB caustic irradiance at a world-space receiver position. */ sample(worldPosition: TSLVec3Node): TSLVec3Node; /** Sample column sun transmittance at a world-space receiver position. */ sampleShadow(worldPosition: TSLVec3Node): TSLFloatNode; /** Invalidate temporal caustics history before the next update. */ resetHistory(): this; /** Render the caustic field after the water step and before the scene pass. */ update(renderer: THREE.Renderer): this; /** Dispose all caustics render targets, geometry, and materials. */ dispose(): void; } export default WaterCaustics;