import { GPUInteractionWorld } from './GPUInteractionWorld.cjs'; import type { Renderer } from 'three/webgpu'; import type { GPUInteractionCapabilityReport, GPUInteractionStorageRequiredRendererLimits } from './GPUInteractionCapabilityReport.cjs'; import type { GPUInteractionMetricSnapshot } from './GPUInteractionMetrics.cjs'; import type { GPUInteractionSource, GPUInteractionWorldOptions, GPUInteractionWorldSizingReport } from './GPUInteractionWorld.cjs'; export type GPUInteractionPhysicsStep = 'auto' | 'before' | 'after' | 'manual'; export type GPUInteractionPhysicsExecutionPhase = 'before' | 'after'; export interface GPUInteractionPhysicsOptions { [option: string]: unknown; step?: GPUInteractionPhysicsStep | undefined; } export interface GPUInteractionNormalizedPhysicsOptions { step: GPUInteractionPhysicsStep; sourceOptions: Record; } export interface GPUInteractionPhysicsSource extends GPUInteractionSource { interactionStepPhase?: GPUInteractionPhysicsExecutionPhase | null | undefined; interactionStorageBufferRequirement?: number | undefined; advancePhysics?(renderer: Renderer, deltaTime: number): unknown; } export interface GPUInteractionPhysicsEngine { createInteractionSource(options: Record): TSource; } export interface GPUInteractionPhysicsBinding { readonly engine: GPUInteractionPhysicsEngine; readonly source: GPUInteractionPhysicsSource; readonly stepPhase: GPUInteractionPhysicsExecutionPhase | null; } export interface GPUInteractionSimulationOptions { [option: string]: unknown; queryMode?: 'grid' | 'scan' | undefined; } export interface GPUInteractionSimulation { setInteractionWorld(world: GPUInteractionWorld, options: GPUInteractionSimulationOptions): unknown; clearInteractionWorld?(): void; step(renderer: Renderer, deltaTime: number): unknown; } export type GPUInteractionSystemOptions = GPUInteractionWorldOptions & { world?: GPUInteractionWorld | GPUInteractionWorldOptions | undefined; }; export interface GPUInteractionSystemRequiredRendererLimits extends GPUInteractionStorageRequiredRendererLimits { readonly maxStorageBuffersPerShaderStage: number; } declare const GPU_INTERACTION_SCAN_REQUIRED_STORAGE_BUFFERS_PER_SHADER_STAGE = 10; declare const GPU_INTERACTION_GRID_REQUIRED_STORAGE_BUFFERS_PER_SHADER_STAGE = 14; /** * GPUInteractionSystem - Orchestrates physics sources and GPU simulations. * * @class GPUInteractionSystem * @short Shared frame scheduler for physics-to-simulation interaction. * @category Simulation * @tags WebGPU, Compute, Physics */ declare class GPUInteractionSystem { world: GPUInteractionWorld; physics: GPUInteractionPhysicsBinding[]; simulations: GPUInteractionSimulation[]; simulationStorageBufferRequirements: Map; renderer: Renderer | null; initialized: boolean; disposed: boolean; stepping: boolean; constructor(options?: GPUInteractionSystemOptions); /** Add any physics engine exposing `createInteractionSource(options)`. */ addPhysics(physics: GPUInteractionPhysicsEngine, options?: GPUInteractionPhysicsOptions): TSource; /** Attach a simulation and its interaction options to the shared world. */ addSimulation(simulation: TSimulation, options?: GPUInteractionSimulationOptions): TSimulation; /** Detach a simulation without disposing it. */ removeSimulation(simulation: GPUInteractionSimulation): boolean; /** Initialize the shared interaction world after physics engines are ready. */ initialize(renderer: Renderer): Promise; /** Advance registered physics sources and simulations for one rendered frame. */ step(renderer?: Renderer | null, deltaTime?: number): Promise; /** Return the shared interaction metric snapshot. */ getMetrics(): GPUInteractionMetricSnapshot; /** Explicitly read bounded GPU broadphase counters. */ requestMetricsReadback(): Promise; /** Report shared interaction capabilities. */ getCapabilityReport(renderer?: Renderer | null): GPUInteractionCapabilityReport; /** Report shared interaction storage sizing. */ getSizingReport(): GPUInteractionWorldSizingReport; /** Report renderer limits required by interaction-enabled simulation passes. */ getRequiredRendererLimits(): GPUInteractionSystemRequiredRendererLimits; /** Detach simulations and dispose shared interaction resources. */ dispose(): void; _advancePhysics(phase: GPUInteractionPhysicsExecutionPhase, renderer: Renderer, deltaTime: number): Promise; _getRequiredStorageBuffersPerShaderStage(): number; _assertMutable(): void; _assertInitialized(): void; _assertUsable(): void; } export { GPU_INTERACTION_GRID_REQUIRED_STORAGE_BUFFERS_PER_SHADER_STAGE, GPU_INTERACTION_SCAN_REQUIRED_STORAGE_BUFFERS_PER_SHADER_STAGE, GPUInteractionSystem };