/** * RaycastEngine - Handles raycasting, BVH management, and snap detection. * Extracted from the Renderer class to use composition pattern. */ import { Camera } from './camera.js'; import { Scene } from './scene.js'; import { Raycaster, type Intersection } from './raycaster.js'; import { SnapDetector, type SnapTarget, type SnapOptions, type EdgeLockInput, type MagneticSnapResult } from './snap-detector.js'; import type { PickOptions } from './types.js'; export declare class RaycastEngine { private camera; private scene; private canvas; private raycaster; private snapDetector; private bvh; private bvhCache; private readonly BVH_THRESHOLD; constructor(camera: Camera, scene: Scene, canvas: HTMLCanvasElement); /** * Collect all visible mesh data from the scene, applying visibility filters. */ /** Slab ray-AABB test, used to cull instanced occurrences before materializing * their (lazy) triangles. */ private rayHitsBounds; private collectVisibleMeshData; /** * Filter meshes using BVH acceleration structure if beneficial. * Rebuilds BVH if the mesh count has changed. */ private filterWithBVH; /** * Scale CSS pixel coordinates to canvas pixel coordinates. * Returns null if the canvas rect has zero dimensions. */ private scaleCoordinates; /** * Raycast into the scene to get precise 3D intersection point * This is more accurate than pick() as it returns the exact surface point * * Note: x, y are CSS pixel coordinates relative to the canvas element. * These are scaled internally to match the actual canvas pixel dimensions. */ raycastScene(x: number, y: number, options?: PickOptions & { snapOptions?: Partial; }): { intersection: Intersection; snap?: SnapTarget; } | null; /** * Raycast with magnetic edge snapping behavior * This provides the "stick and slide along edges" experience * * Note: x, y are CSS pixel coordinates relative to the canvas element. * These are scaled internally to match the actual canvas pixel dimensions. */ raycastSceneMagnetic(x: number, y: number, currentEdgeLock: EdgeLockInput, options?: PickOptions & { snapOptions?: Partial; }): MagneticSnapResult & { intersection: Intersection | null; }; /** * Invalidate BVH cache (call when geometry changes) */ invalidateBVHCache(): void; /** * Get the raycaster instance (for advanced usage) */ getRaycaster(): Raycaster; /** * Get the snap detector instance (for advanced usage) */ getSnapDetector(): SnapDetector; /** * Clear all caches (call when geometry changes) */ clearCaches(): void; } //# sourceMappingURL=raycast-engine.d.ts.map