import * as THREE from 'three/webgpu'; import type { NodeBuilder, NodeMaterialParameters } from 'three/webgpu'; import type { TSLColorNode, TSLFloatNode, TSLFunction, TSLNode, TSLTextureNode, TSLVec3Node, TSLVec4Node } from '../types/tsl.js'; export type VolumeSmokeOutputMode = 'safe-premultiplied' | 'unclamped-hdr'; /** Scalar node/value accepted by smoke controls. */ export type VolumeSmokeScalarInput = TSLFloatNode | number; /** Vector node/value accepted by smoke controls. */ export type VolumeSmokeVec3Input = TSLVec3Node | THREE.Vector3; /** Color node/value accepted by smoke controls. */ export type VolumeSmokeColorInput = TSLColorNode | THREE.Color; /** Borrowed 3D texture or package-owned sampleable TSL texture contract. */ export type VolumeSmokeTexture3DInput = THREE.Texture | TSLTextureNode; /** Optional scene-depth texture node used to terminate the primary ray at opaque geometry. */ export type VolumeSmokeSceneDepthNode = TSLTextureNode; /** Per-sample fog hook. RGB is fog in-scatter and alpha is fog transmittance. */ export type VolumeSmokeFogNode = TSLFunction<[ worldPosition: TSLVec3Node, cameraDistance: TSLFloatNode ], TSLVec4Node>; /** Per-sample scene-shadow hook returning directional-light visibility in [0, 1]. */ export type VolumeSmokeSceneShadowNode = TSLFunction<[ worldPosition: TSLVec3Node ], TSLFloatNode>; /** Scalar node retained by the material; raw inputs are wrapped in uniforms. */ export type VolumeSmokeScalarNode = TSLFloatNode & { value?: number | undefined; }; /** Vec3 node retained by the material; raw inputs are wrapped in uniforms. */ export type VolumeSmokeVec3Node = TSLVec3Node & { value?: THREE.Vector3 | undefined; }; /** Color node retained by the material; raw colors are wrapped in uniforms. */ export type VolumeSmokeColorNode = TSLColorNode & { value?: THREE.Color | undefined; }; /** Constructor parameters for {@link VolumeSmokeNodeMaterial}. Input textures are borrowed. */ export interface VolumeSmokeNodeMaterialParameters extends NodeMaterialParameters { densityTexture: VolumeSmokeTexture3DInput; velocityTexture?: VolumeSmokeTexture3DInput | null | undefined; curlTexture?: VolumeSmokeTexture3DInput | null | undefined; pressureTexture?: VolumeSmokeTexture3DInput | null | undefined; divergenceTexture?: VolumeSmokeTexture3DInput | null | undefined; occupancyTexture?: VolumeSmokeTexture3DInput | null | undefined; lightOpticalDepthTexture?: VolumeSmokeTexture3DInput | null | undefined; sceneDepthNode?: VolumeSmokeSceneDepthNode | null | undefined; fogNode?: VolumeSmokeFogNode | null | undefined; sceneShadowNode?: VolumeSmokeSceneShadowNode | null | undefined; useFlowDetail?: boolean | undefined; useHighFrequencyDetail?: boolean | undefined; useDiagnosticLighting?: boolean | undefined; useMacrocellSkipping?: boolean | undefined; /** Multiply direct light by the light cache's `.y` (scene visibility baked by SmokeVolume `lightVisibilityNode`). */ useLightCacheVisibility?: boolean | undefined; /** Four extra density taps per step for the density gradient (surface/rim/ambient shaping). Off = one tap per step. */ useGradientLighting?: boolean | undefined; outputMode?: VolumeSmokeOutputMode | undefined; occupancyGridSize?: VolumeSmokeVec3Input | undefined; occupancyThreshold?: VolumeSmokeScalarInput | undefined; dyeTexelSize?: VolumeSmokeVec3Input | undefined; steps?: VolumeSmokeScalarInput | undefined; lightDir?: VolumeSmokeVec3Input | undefined; baseColor?: VolumeSmokeColorInput | undefined; skyColor?: VolumeSmokeColorInput | undefined; groundColor?: VolumeSmokeColorInput | undefined; highlightColor?: VolumeSmokeColorInput | undefined; lightColor?: VolumeSmokeColorInput | undefined; ambientLight?: VolumeSmokeScalarInput | undefined; lightStrength?: VolumeSmokeScalarInput | undefined; rimStrength?: VolumeSmokeScalarInput | undefined; densityBoost?: VolumeSmokeScalarInput | undefined; absorption?: VolumeSmokeScalarInput | undefined; curlInfluence?: VolumeSmokeScalarInput | undefined; velocityInfluence?: VolumeSmokeScalarInput | undefined; pressureInfluence?: VolumeSmokeScalarInput | undefined; divergenceInfluence?: VolumeSmokeScalarInput | undefined; brightness?: VolumeSmokeScalarInput | undefined; anisotropy?: VolumeSmokeScalarInput | undefined; phaseBack?: VolumeSmokeScalarInput | undefined; phaseForwardWeight?: VolumeSmokeScalarInput | undefined; scatteringAlbedo?: VolumeSmokeScalarInput | undefined; shadowSteps?: VolumeSmokeScalarInput | undefined; shadowIntensity?: VolumeSmokeScalarInput | undefined; adaptiveStepThreshold?: VolumeSmokeScalarInput | undefined; rayJitterStrength?: VolumeSmokeScalarInput | undefined; temporalJitter?: VolumeSmokeScalarInput | undefined; temporalFrame?: VolumeSmokeScalarInput | undefined; detailWarpStrength?: VolumeSmokeScalarInput | undefined; detailWarpMix?: VolumeSmokeScalarInput | undefined; detailNoiseScale?: VolumeSmokeScalarInput | undefined; detailNoiseStrength?: VolumeSmokeScalarInput | undefined; detailNoiseSpeed?: VolumeSmokeScalarInput | undefined; detailTime?: VolumeSmokeScalarInput | undefined; densitySmoothing?: VolumeSmokeScalarInput | undefined; gradientLighting?: VolumeSmokeScalarInput | undefined; surfaceLighting?: VolumeSmokeScalarInput | undefined; multipleScattering?: VolumeSmokeScalarInput | undefined; multipleScatteringOctaves?: VolumeSmokeScalarInput | undefined; multipleScatteringAttenuation?: VolumeSmokeScalarInput | undefined; multipleScatteringContribution?: VolumeSmokeScalarInput | undefined; multipleScatteringAnisotropy?: VolumeSmokeScalarInput | undefined; powderStrength?: VolumeSmokeScalarInput | undefined; ambientGradient?: VolumeSmokeScalarInput | undefined; ambientOcclusion?: VolumeSmokeScalarInput | undefined; fireColor?: VolumeSmokeColorInput | undefined; fireColorHot?: VolumeSmokeColorInput | undefined; fireIntensity?: VolumeSmokeScalarInput | undefined; firePower?: VolumeSmokeScalarInput | undefined; fireTemperatureScale?: VolumeSmokeScalarInput | undefined; fireBlackbody?: VolumeSmokeScalarInput | undefined; pointLightPosition?: VolumeSmokeVec3Input | undefined; pointLightColor?: VolumeSmokeColorInput | undefined; pointLightIntensity?: VolumeSmokeScalarInput | undefined; pointLightRadius?: VolumeSmokeScalarInput | undefined; } /** Mutable texture nodes sampled by the generated smoke graph. */ export interface VolumeSmokeTextureNodes { density: TSLTextureNode; velocity: TSLTextureNode | null; curl: TSLTextureNode | null; pressure: TSLTextureNode | null; divergence: TSLTextureNode | null; occupancy: TSLTextureNode | null; lightOpticalDepth: TSLTextureNode | null; } /** Public uniform/node controls retained by the material. */ export interface VolumeSmokeUniformNodes { dyeTexelSize: VolumeSmokeVec3Node; occupancyGridSize: VolumeSmokeVec3Node; occupancyThreshold: VolumeSmokeScalarNode; lightDir: VolumeSmokeVec3Node; baseColor: VolumeSmokeColorNode; skyColor: VolumeSmokeColorNode; groundColor: VolumeSmokeColorNode; highlightColor: VolumeSmokeColorNode; lightColor: VolumeSmokeColorNode; ambientLight: VolumeSmokeScalarNode; lightStrength: VolumeSmokeScalarNode; rimStrength: VolumeSmokeScalarNode; densityBoost: VolumeSmokeScalarNode; absorption: VolumeSmokeScalarNode; curlInfluence: VolumeSmokeScalarNode; velocityInfluence: VolumeSmokeScalarNode; pressureInfluence: VolumeSmokeScalarNode; divergenceInfluence: VolumeSmokeScalarNode; brightness: VolumeSmokeScalarNode; steps: VolumeSmokeScalarNode; anisotropy: VolumeSmokeScalarNode; phaseBack: VolumeSmokeScalarNode; phaseForwardWeight: VolumeSmokeScalarNode; scatteringAlbedo: VolumeSmokeScalarNode; shadowSteps: VolumeSmokeScalarNode; shadowIntensity: VolumeSmokeScalarNode; adaptiveStepThreshold: VolumeSmokeScalarNode; rayJitterStrength: VolumeSmokeScalarNode; temporalJitter: VolumeSmokeScalarNode; temporalFrame: VolumeSmokeScalarNode; detailWarpStrength: VolumeSmokeScalarNode; detailWarpMix: VolumeSmokeScalarNode; detailNoiseScale: VolumeSmokeScalarNode; detailNoiseStrength: VolumeSmokeScalarNode; detailNoiseSpeed: VolumeSmokeScalarNode; detailTime: VolumeSmokeScalarNode; densitySmoothing: VolumeSmokeScalarNode; gradientLighting: VolumeSmokeScalarNode; surfaceLighting: VolumeSmokeScalarNode; multipleScattering: VolumeSmokeScalarNode; multipleScatteringOctaves: VolumeSmokeScalarNode; multipleScatteringAttenuation: VolumeSmokeScalarNode; multipleScatteringContribution: VolumeSmokeScalarNode; multipleScatteringAnisotropy: VolumeSmokeScalarNode; powderStrength: VolumeSmokeScalarNode; ambientGradient: VolumeSmokeScalarNode; ambientOcclusion: VolumeSmokeScalarNode; fireColor: VolumeSmokeColorNode; fireColorHot: VolumeSmokeColorNode; fireIntensity: VolumeSmokeScalarNode; firePower: VolumeSmokeScalarNode; fireTemperatureScale: VolumeSmokeScalarNode; fireBlackbody: VolumeSmokeScalarNode; pointLightPosition: VolumeSmokeVec3Node; pointLightColor: VolumeSmokeColorNode; pointLightIntensity: VolumeSmokeScalarNode; pointLightRadius: VolumeSmokeScalarNode; } /** Compile-time shader switches rebuilt by {@link VolumeSmokeNodeMaterial.setShaderVariants}. */ export interface VolumeSmokeShaderVariants { useFlowDetail?: boolean | undefined; useHighFrequencyDetail?: boolean | undefined; useDiagnosticLighting?: boolean | undefined; useMacrocellSkipping?: boolean | undefined; useLightCacheVisibility?: boolean | undefined; useGradientLighting?: boolean | undefined; outputMode?: VolumeSmokeOutputMode | undefined; } /** Texture-node replacements. Occupancy and cached-light textures may be cleared with `null`. */ export interface VolumeSmokeTextureOptions { densityTexture?: VolumeSmokeTexture3DInput | null | undefined; velocityTexture?: VolumeSmokeTexture3DInput | null | undefined; curlTexture?: VolumeSmokeTexture3DInput | null | undefined; pressureTexture?: VolumeSmokeTexture3DInput | null | undefined; divergenceTexture?: VolumeSmokeTexture3DInput | null | undefined; occupancyTexture?: VolumeSmokeTexture3DInput | null | undefined; lightOpticalDepthTexture?: VolumeSmokeTexture3DInput | null | undefined; } /** Raw borrowed texture values synchronized into existing texture nodes. */ export interface VolumeSmokeTextureSyncOptions { densityTexture?: THREE.Texture | null | undefined; velocityTexture?: THREE.Texture | null | undefined; curlTexture?: THREE.Texture | null | undefined; pressureTexture?: THREE.Texture | null | undefined; divergenceTexture?: THREE.Texture | null | undefined; occupancyTexture?: THREE.Texture | null | undefined; lightOpticalDepthTexture?: THREE.Texture | null | undefined; } /** * Raymarched, premultiplied-alpha smoke material backed by borrowed 3D textures. * * The material owns its generated TSL graph and wrapper nodes, but never disposes caller-provided * texture values. Its inherited `copy()` and `dispose()` semantics remain unchanged: public texture * and uniform collections are copied by reference, while disposal releases material renderer state. */ export declare class VolumeSmokeNodeMaterial extends THREE.NodeMaterial { static get type(): 'VolumeSmokeNodeMaterial'; readonly isVolumeSmokeNodeMaterial: true; useFlowDetail: boolean; useHighFrequencyDetail: boolean; useDiagnosticLighting: boolean; useMacrocellSkipping: boolean; useLightCacheVisibility: boolean; useGradientLighting: boolean; outputMode: VolumeSmokeOutputMode; /** Borrowed scene-depth node. Null keeps the historical box-only march. */ sceneDepthNode: VolumeSmokeSceneDepthNode | null; /** Optional per-sample fog integration hook. */ fogNode: VolumeSmokeFogNode | null; /** Optional per-sample directional scene-shadow hook. */ sceneShadowNode: VolumeSmokeSceneShadowNode | null; /** Sampleable wrapper nodes whose underlying texture values remain caller-owned. */ textures: VolumeSmokeTextureNodes; /** Uniform or computed nodes controlling the current raymarch graph. */ readonly smokeUniforms: VolumeSmokeUniformNodes; /** Current generated smoke output, replaced whenever shader variants change. */ smokeNode: TSLVec4Node; constructor(parameters: VolumeSmokeNodeMaterialParameters); getSmokeNode(): TSLVec4Node; setupPremultipliedAlpha(_builder: NodeBuilder, outputNode: TOutputNode): TOutputNode; useSmokeOutput(): this; setSceneDepthNode(sceneDepthNode: VolumeSmokeSceneDepthNode | null): this; setFogNode(fogNode: VolumeSmokeFogNode | null): this; setSceneShadowNode(sceneShadowNode: VolumeSmokeSceneShadowNode | null): this; setShaderVariants({ useFlowDetail, useHighFrequencyDetail, useDiagnosticLighting, useMacrocellSkipping, useLightCacheVisibility, useGradientLighting, outputMode, }?: VolumeSmokeShaderVariants): this; setOutputMode(outputMode: VolumeSmokeOutputMode): this; setMacrocellSkipping(enabled: boolean, occupancyGridSize?: THREE.Vector3 | null): this; setVolumeTextures({ densityTexture, velocityTexture, curlTexture, pressureTexture, divergenceTexture, occupancyTexture, lightOpticalDepthTexture, }?: VolumeSmokeTextureOptions): void; syncVolumeTextures({ densityTexture, velocityTexture, curlTexture, pressureTexture, divergenceTexture, occupancyTexture, lightOpticalDepthTexture, }?: VolumeSmokeTextureSyncOptions): this; private _rebuildSmokeOutput; } export default VolumeSmokeNodeMaterial;