import type { ComputeNode } from 'three/webgpu'; import type { TSLBoolNode, TSLFloatNode, TSLIntNode, TSLMat3Node, TSLNode, TSLStorageNode, TSLUintNode, TSLVec3Node } from '../../../types/tsl.js'; import type { MPMMaterialModel, MPMParticleNode } from '../MPMFluidModel.js'; import type { MPMGridAtomicTargetNode, MPMGridContributionMode, MPMGridMirrorStorageNode, MPMIVec3Node } from '../MPMKernelUtils.js'; /** Runtime behavior profile for production or byte-comparable r185 capture. */ export type MPMIntegrationProfile = 'production' | 'three-r185-strict'; /** Normalized-domain boundary controls applied during particle/grid updates. */ export interface MPMBoundaryOptions { /** Grid-cell inset that defines the active domain boundary. */ margin: number; /** Tangential velocity multiplier applied at the floor. */ floorFriction: number; /** Inward velocity applied when particles cross a wall. */ wallPushback: number; /** Per-step velocity damping applied at boundaries. */ velocityDamping: number; } export interface MPMWritableParticleNode extends MPMParticleNode { readonly isNode: true; assign(value: MPMWritableParticleNode): TSLNode; } export interface MPMIndexableMat3Node { readonly isNode: true; element(index: TSLIntNode | number): TSLVec3Node; } export interface MPMMixedComparisonIntNode { readonly isNode: true; greaterThan(value: TSLFloatNode): TSLBoolNode; } /** Mutable TSL values supplied to a custom particle-force hook. */ export interface MPMParticleForceContext { /** Current normalized-domain particle position. */ position: TSLVec3Node; /** Mutable particle velocity. */ velocity: TSLVec3Node; /** Current particle density. */ density: TSLFloatNode; /** Current solver substep duration. */ dt: TSLFloatNode; } /** Mutable TSL values supplied after grid-to-particle transfer. */ export interface MPMParticleUpdateContext extends Omit { /** Current particle index. */ index: TSLUintNode; } /** Mutable TSL values supplied to a custom grid-force hook. */ export interface MPMGridForceContext { /** Integer coordinate of the current grid cell. */ cell: MPMIVec3Node; /** Normalized-domain cell-center position. */ position: TSLVec3Node; /** Mutable mass-normalized grid velocity. */ velocity: TSLVec3Node; /** Mass accumulated in the current grid cell. */ mass: TSLFloatNode; /** Current solver substep duration. */ dt: TSLFloatNode; /** Simulation time at the start of the frame. */ time: TSLFloatNode; } /** TSL callback that applies a custom per-particle force. */ export type MPMParticleForce = (context: MPMParticleForceContext) => void; /** TSL callback that observes or adjusts an updated particle. */ export type MPMParticleUpdate = (context: MPMParticleUpdateContext) => void; /** TSL callback that applies a custom force to one grid cell. */ export type MPMGridForce = (context: MPMGridForceContext) => void; export interface MPMParticleGridPassOptions { particles: TSLStorageNode<'struct'>; gridAtomic: TSLStorageNode<'struct'>; gridSize: TSLVec3Node; particleCount: number; particleCountNode: TSLUintNode; workgroupSize: number; p2gMode?: MPMGridContributionMode | undefined; } export interface MPMMaterialParticleGridPassOptions extends MPMParticleGridPassOptions { material: MPMMaterialModel; dt: TSLFloatNode; } export interface MPMGridMirrorPassOptions { gridMirror: MPMGridMirrorStorageNode; gridSize: TSLVec3Node; packedGridMirror: boolean; } export interface MPMSubgroupComputeNode extends ComputeNode { dispatchSize: number[]; mpmSubgroupDispatch: true; } export declare function requireMPMParticleNode(value: unknown): MPMWritableParticleNode; export declare function requireMPMIndexableMat3Node(value: unknown): MPMIndexableMat3Node; export declare function requireMPMMat3Node(value: unknown, label: string): TSLMat3Node; export declare function requireMPMMixedComparisonIntNode(value: unknown): MPMMixedComparisonIntNode; export declare function requireMPMGridAtomicTarget(value: unknown): MPMGridAtomicTargetNode; export declare function requireMPMIntNode(value: unknown, label: string): TSLIntNode; export declare function requireMPMComputeNode(value: unknown, label: string): ComputeNode; export declare function configureMPMSubgroupComputeNode(value: unknown, dispatchSize: number[]): MPMSubgroupComputeNode;