import type { Object3D, Quaternion, Renderer, Vector3 } from 'three/webgpu'; import type { GPUInteractionAffectsTarget, GPUInteractionNormalizedShape, GPUInteractionShapeDescriptor } from './GPUInteractionLayout.js'; import type { GPUInteractionBuffers } from './GPUInteractionBuffers.js'; export interface KinematicInteractionSourceOptions { shape?: GPUInteractionShapeDescriptor | undefined; affects?: readonly GPUInteractionAffectsTarget[] | undefined; layer?: number | undefined; mask?: number | undefined; friction?: number | undefined; restitution?: number | undefined; } export interface KinematicInteractionWorld { buffers?: GPUInteractionBuffers | null | undefined; } export interface KinematicInteractionSourceRange { baseColliderSlot: number; } /** * CPU-driven interaction source: publishes one moving `Object3D` (any group or * mesh animated on the CPU) as a kinematic collider in a * {@link GPUInteractionWorld}. The collider slot is written through the * world's CPU `writeCollider` path each frame; linear velocity is derived from * the frame-to-frame transform delta so consumers with look-ahead avoidance * (boids) can anticipate the sweep. Capacity is exactly 1. * * @example * const source = new KinematicInteractionSource( { shape: { type: 'sphere', radius: 12 } } ); * source.setTarget( movingMesh ); * world.addSource( source ); */ export declare class KinematicInteractionSource { shape: GPUInteractionNormalizedShape; affectsFlags: number; layer: number; mask: number; friction: number; restitution: number; capacity: 1; world: KinematicInteractionWorld | null; baseColliderSlot: number; target: Object3D | null; _position: Vector3; _quaternion: Quaternion; _scale: Vector3; _previousPosition: Vector3; _hasPrevious: boolean; /** * @param {Object} [options] * @param {Object} [options.shape] `{ type: 'sphere'|'box'|'capsule', radius, halfExtents, halfHeight }`. * @param {string[]} [options.affects=['boids','fluid','smoke']] Which simulations sense it. * @param {number} [options.layer=1] Interaction layer bits. * @param {number} [options.mask=0xffffffff] Interaction mask bits. * @param {number} [options.friction=0.5] * @param {number} [options.restitution=0] */ constructor(options?: KinematicInteractionSourceOptions); /** * Track an object. Its world transform is sampled every frame. * * @param {THREE.Object3D|null} object * @returns {KinematicInteractionSource} this */ setTarget(object: Object3D | null): this; attach(world: KinematicInteractionWorld, range: KinematicInteractionSourceRange): void; /** Conservative world-space bound of the shape for the broadphase AABB. */ _boundRadius(): number; /** * Called by the world during `beginFrame`. Writes the collider slot from * the target's current world transform. * * @param {THREE.WebGPURenderer} renderer Unused (CPU write path). * @param {number} [deltaTime=0] Frame delta for velocity derivation. * @returns {number} Active collider count (0 or 1). */ update(_renderer: Renderer, deltaTime?: number): 0 | 1; detach(): void; dispose(): void; }