import { GPUInteractionBuffers } from './GPUInteractionBuffers.cjs'; import { GPUInteractionMetrics } from './GPUInteractionMetrics.cjs'; import { GPUInteractionSpatialGrid } from './GPUInteractionSpatialGrid.cjs'; import type { Renderer } from 'three/webgpu'; import type { GPUInteractionCapabilityReport } from './GPUInteractionCapabilityReport.cjs'; import type { GPUInteractionMetricSnapshot } from './GPUInteractionMetrics.cjs'; import type { GPUInteractionGridOptions, GPUInteractionSpatialGridSizingReport } from './GPUInteractionSpatialGrid.cjs'; export interface GPUInteractionWorldOptions { maxColliders?: number | undefined; maxFeedbackColliders?: number | undefined; maxGridLinks?: number | undefined; maxGlobalColliders?: number | undefined; grid?: GPUInteractionGridOptions | undefined; } export interface GPUInteractionWorldConfig { readonly maxColliders: number; readonly maxFeedbackColliders: number; readonly maxGridLinks: number; readonly maxGlobalColliders: number; readonly grid: GPUInteractionGridOptions; } export interface GPUInteractionSourceRange { readonly baseColliderSlot: number; readonly capacity: number; } export interface GPUInteractionSource { readonly capacity: number; attach(world: GPUInteractionWorld, range: GPUInteractionSourceRange): void; detach?(): void; initialize?(renderer: Renderer): unknown; update?(renderer: Renderer, deltaTime: number): number | null | undefined; afterFeedbackResolved?(renderer: Renderer): void; dispose?(): void; } export interface GPUInteractionWorldSizingReport extends GPUInteractionSpatialGridSizingReport { readonly maxColliders: number; readonly maxFeedbackColliders: number; readonly maxGridLinks: number; readonly maxGlobalColliders: number; readonly grid: GPUInteractionGridOptions; readonly colliderBytes: number; readonly feedbackBytes: number; readonly totalBytes: number; } /** * GPUInteractionWorld - Shared moving-collider world for GPU simulations. * * @class GPUInteractionWorld * @short Shared GPU collider layout and source lifecycle for simulations. * @category Simulation * @tags WebGPU, Compute, Physics */ declare class GPUInteractionWorld { options: Readonly; metrics: GPUInteractionMetrics; spatialGrid: GPUInteractionSpatialGrid; sources: GPUInteractionSource[]; ranges: Map; authorities: Map; buffers: GPUInteractionBuffers | null; renderer: Renderer | null; initialized: boolean; disposed: boolean; frameOpen: boolean; _nextColliderSlot: number; _hasFeedbackContributions: boolean; _metricsReadbackPromise: Promise | null; constructor(options?: GPUInteractionWorldOptions); /** Add a fixed-capacity collider source before initialization. */ addSource(source: TSource): TSource; /** Remove a collider source before initialization. */ removeSource(source: GPUInteractionSource): boolean; /** Allocate canonical GPU buffers and initialize attached sources. */ initialize(renderer: Renderer): Promise; /** Capture source transforms and open one rendered interaction frame. */ beginFrame(renderer?: Renderer | null, deltaTime?: number): this; /** Close the rendered interaction frame and resolve enabled feedback producers. */ resolveFeedback(renderer?: Renderer | null): this; /** Return a frozen interaction metric snapshot. */ getMetrics(): GPUInteractionMetricSnapshot; /** Refresh bounded broadphase counters without reading collider or simulation data. */ requestMetricsReadback(renderer?: Renderer | null): Promise; /** Reset accumulated interaction metrics. */ resetMetrics(): this; /** Report fixed capacity and estimated storage requirements. */ getSizingReport(): GPUInteractionWorldSizingReport; /** * Report interaction capabilities and renderer-limit compatibility. * * @param {THREE.WebGPURenderer|null} [renderer=this.renderer] Optional renderer for pre-initialization capability checks. * @returns {Readonly} Interaction capability report. */ getCapabilityReport(renderer?: Renderer | null): GPUInteractionCapabilityReport; claimAuthority(authorityKey: unknown, source: GPUInteractionSource, dynamic?: boolean): void; releaseAuthority(authorityKey: unknown, source: GPUInteractionSource): void; /** Dispose sources and canonical GPU buffers. */ dispose(): void; _repackSourceRanges(): void; _assertMutableSources(): void; _assertInitialized(): void; _assertUsable(): void; } export { GPUInteractionWorld };