/** * Shape tessellation and decomposition for rendering CAD objects. */ import { NestedGroup } from "./nestedgroup.js"; import { BoundingBox } from "./bbox.js"; import type { Shapes, VisibilityState } from "../core/types.js"; /** * Tree data structure for shape visibility navigation. * Maps object names to either nested tree data or visibility state. */ interface ShapeTreeData { [key: string]: ShapeTreeData | VisibilityState; } /** * Result from rendering tessellated shapes. */ interface RenderResult { group: NestedGroup; tree: ShapeTreeData; } /** * Configuration options for shape rendering. */ interface ShapeRenderConfig { cadWidth: number; height: number; edgeColor: number; transparent: boolean; defaultOpacity: number; metalness: number; roughness: number; normalLen: number; } /** * Handles tessellation and decomposition of CAD shapes for rendering. */ declare class ShapeRenderer { private config; private _bbox; constructor(config: ShapeRenderConfig); /** * Get the computed bounding box (set after rendering if shapes.bb is defined). */ get bbox(): BoundingBox | null; /** * Update configuration (e.g., when state changes). */ updateConfig(config: Partial): void; /** * Render tessellated shapes of a CAD object. * @param shapes - The Shapes object representing the tessellated CAD object. * @returns A nested THREE.Group object. */ private _renderTessellatedShapes; /** * Retrieve the navigation tree from a Shapes object. * @param shapes - The Shapes object. * @returns The navigation tree object. */ private _getTree; /** * Decompose a CAD object into faces, edges and vertices. * @param part - The part to decompose. * @returns A decomposed part object. */ private _decompose; /** * Convert Shape arrays to TypedArrays for efficient rendering. * Note: This mutates the shape in place. */ private _convertArrays; /** * Recursively process shapes, converting arrays and decomposing parts. */ private _processShapes; /** * Render the shapes of the CAD object. * @param exploded - Whether to render the compact or exploded version * @param shapes - The Shapes object. * @returns A nested THREE.Group object and navigation tree. */ render(exploded: boolean, shapes: Shapes): RenderResult; } export { ShapeRenderer }; export type { ShapeTreeData, RenderResult, ShapeRenderConfig };