import type { TSLFloatNode, TSLMat3Node, TSLNode, TSLUniformNode, TSLUintNode, TSLVec4Node } from '../../types/tsl.js'; /** Scalar/vector/matrix field types supported by the MPM particle struct. */ export type MPMParticleFieldType = 'float' | 'int' | 'uint' | 'vec2' | 'ivec2' | 'uvec2' | 'vec3' | 'ivec3' | 'uvec3' | 'vec4' | 'ivec4' | 'uvec4' | 'mat2' | 'mat3' | 'mat4'; /** One material-owned field appended to the solver's particle struct. */ export interface MPMParticleField { /** TSL storage type appended to each particle. */ type: MPMParticleFieldType; } /** Material-owned fields keyed by their runtime struct member names. */ export type MPMParticleFieldMap = Record; /** Narrow particle struct access used by the built-in material models. */ export interface MPMParticleNode { /** Read a built-in vector field from the particle struct. */ get(field: 'position' | 'velocity'): TSLVec4Node; /** Read a built-in matrix field from the particle struct. */ get(field: 'C' | 'F'): TSLMat3Node; /** Read a custom material-owned field from the particle struct. */ get(field: string): TSLNode; } /** Particle access supplied to material initialization. */ export interface MPMMaterialParticleContext { /** Narrow typed view of the current particle struct. */ particle: MPMParticleNode; /** Current particle index when the calling pass exposes it. */ index?: TSLUintNode | undefined; } /** Particle and transfer values supplied while evaluating material stress. */ export interface MPMMaterialStressContext extends MPMMaterialParticleContext { /** Affine particle velocity field. */ C: TSLMat3Node; /** Current particle density. */ density: TSLFloatNode; /** Current solver substep duration. */ dt: TSLFloatNode; } /** Context supplied when a material updates deformation after grid transfer. */ export type MPMMaterialUpdateContext = MPMMaterialStressContext; /** Six-member runtime contract accepted by `MPMSolver`. */ export interface MPMMaterialModel { /** Stable material identifier used by diagnostics and tooling. */ name: string; /** Material-owned fields appended to the particle struct. */ particleFields: MPMParticleFieldMap; /** Mutable material parameters captured by the kernel graph. */ uniforms: TUniforms; /** Initialize material-owned state for one seeded particle. */ initParticle(context: MPMMaterialParticleContext): void; /** Return the material stress contribution for one particle. */ stress(context: MPMMaterialStressContext): TSLMat3Node; /** Update material deformation state after grid-to-particle transfer. */ updateDeformation(context: MPMMaterialUpdateContext): void; } /** Parameters for the built-in pressure-and-viscosity fluid model. */ export interface MPMFluidModelOptions { /** Tait pressure stiffness. */ stiffness?: number | undefined; /** Target particle density. */ restDensity?: number | undefined; /** Symmetric affine-velocity viscosity coefficient. */ viscosity?: number | undefined; } /** Mutable TSL uniforms owned by {@link MPMFluidModel}. */ export interface MPMFluidUniforms { /** Pressure stiffness uniform. */ stiffness: TSLUniformNode<'float', number>; /** Rest-density uniform. */ restDensity: TSLUniformNode<'float', number>; /** Viscosity uniform. */ viscosity: TSLUniformNode<'float', number>; } /** * Gamma=1 Tait fluid material used by the ocean example. Density is carried in * particle.velocity.w, leaving the 80-byte std430 particle stride unchanged. */ export declare class MPMFluidModel implements MPMMaterialModel { /** Stable material identifier. */ name: 'fluid'; /** Fluid model adds no fields beyond the core particle layout. */ particleFields: MPMParticleFieldMap; /** Live pressure, density, and viscosity controls. */ uniforms: MPMFluidUniforms; /** Create a fluid material with mutable TSL uniforms. */ constructor({ stiffness, restDensity, viscosity }?: MPMFluidModelOptions); /** Store rest density in the core velocity metadata lane. */ initParticle({ particle }: MPMMaterialParticleContext): void; /** Evaluate pressure and viscosity stress for one particle. */ stress({ C, density }: MPMMaterialStressContext): TSLMat3Node; /** Fluid particles have no persistent deformation state to update. */ updateDeformation(): void; /** Accept the shared material callback signature without changing state. */ updateDeformation(context: MPMMaterialUpdateContext): void; }