import * as THREE from "three"; import { type ObjectGroup } from "../scene/objectgroup.js"; import type { Camera } from "../camera/camera.js"; /** * Filter types for topology-based raycasting. */ export declare const TopoFilter: { none: null; vertex: "vertex"; edge: "edge"; face: "face"; solid: "solid"; }; export type TopoFilterType = (typeof TopoFilter)[keyof typeof TopoFilter]; interface RaycastFilters { topoFilter: TopoFilterType[]; } interface RaycastCallback { (event: { mouse?: "left" | "right"; shift?: boolean; key?: string; }): void; } /** * Represents a picked object from raycasting. * Can represent either a single shape or all faces of a solid. */ export declare class PickedObject { obj: ObjectGroup; fromSolid: boolean; /** * Create a PickedObject. * @param objectGroup - The picked ObjectGroup. * @param fromSolid - Whether this pick is from a solid selection. */ constructor(objectGroup: ObjectGroup, fromSolid: boolean); /** * Returns all the faces ObjectGroups that define the solid from the picked object. */ private _getSolidObjectGroups; /** * If the picked object is part of a solid, returns all the faces ObjectGroups that define the solid. * Otherwise, returns the picked object. */ objs(): ObjectGroup[]; } /** * Handles mouse-based raycasting for object selection in the 3D scene. * Supports topology filtering and provides click/keyboard callbacks. */ declare class Raycaster { camera: Camera | null; group: THREE.Object3D | null; domElement: HTMLElement | null; width: number; height: number; threshold: number; callback: RaycastCallback; raycaster: THREE.Raycaster; raycastMode: boolean; lastPosition: THREE.Vector3 | null; mouse: THREE.Vector2; mouseMoved: boolean; filters: RaycastFilters; /** * Create a Raycaster for object picking. * @param camera - The camera used for ray projection. * @param domElement - The DOM element to listen for events. * @param width - Viewport width in pixels. * @param height - Viewport height in pixels. * @param threshold - Point picking threshold in world units. * @param group - The scene group to raycast against. * @param callback - Callback for pick events. */ constructor(camera: Camera, domElement: HTMLElement, width: number, height: number, threshold: number, group: THREE.Object3D, callback: RaycastCallback); /** * Dispose of event listeners and clean up resources. */ dispose(): void; /** * Initialize event listeners and enable raycast mode. */ init(): void; /** * Retrieve all the valid intersected objects by a ray caster from the mouse. */ getIntersectedObjs(): THREE.Intersection[]; /** * Retrieve all the valid intersected objects by a ray caster from the mouse. * The objects are sorted by their distance from the ray. (The closest first) */ getValidIntersectedObjs(): THREE.Intersection[]; /** * Handle left mouse button down event */ onMouseKeyDown: (e: MouseEvent) => void; /** * Handle left mouse button up event */ onMouseKeyUp: (e: MouseEvent) => void; /** * Handle key down event */ onKeyDown: (e: KeyboardEvent) => void; /** * Get the current mouse position */ onPointerMove: (e: MouseEvent) => void; } export { Raycaster };