/** * Screen-space outline of the clip caps (CAD mode). * * The caps carry no geometry of their own outline, and the faces next to a cut may * face away from the camera or belong to a touching solid, so the outline is found * in screen space instead: * * 1. Id pass into an offscreen target (color + depth + stencil): * - visible faces as black occluders (face pick layer + override material), so a * cap hidden behind another part gets no outline; face pixels within the line * width of a clip plane write {@link CUT_EDGE_ID} instead, which draws the cut * contour on the faces themselves (needed when the caps are behind the faces), * - the stencil meshes and caps (on {@link CAP_LAYER}) with each cap writing its * own id instead of its shaded color — the same stencil sequence as the main * render, since three orders them identically (material creation order). * 2. Composite over the canvas: a pixel is drawn in the edge color when its id is * larger than a neighbour's id, which yields a line on one side of every boundary * cap↔cap, cap↔surface and cap↔background. Cut-edge pixels are the largest id, so * where they meet a cap only they are drawn — one line, not two. */ import * as THREE from "three"; /** Render layer of the clip stencil meshes and cap quads (pick layers use 1-3). */ export declare const CAP_LAYER = 4; /** Id of face pixels on the cut contour (larger than any cap id). */ export declare const CUT_EDGE_ID = 16777215; /** Encode a cap id (1..2^24-1) as an exact 8-bit RGB color (0 = no cap). */ export declare function capIdColor(id: number): THREE.Vector3; /** Per-frame inputs of {@link CapOutlinePass.render}. */ export interface CapOutlineOptions { /** Clip planes and mode of the face materials (for the occluders). */ planes: THREE.Plane[]; intersection: boolean; /** Draw faces as occluders (off in transparent mode: caps show through faces). */ occlude: boolean; /** Outline color (sRGB hex). */ color: number; /** Switch the cap materials between shaded output and id output. */ setCapIdPass: (flag: boolean) => void; } export declare class CapOutlinePass { private target; private readonly occluder; /** Width of the cut contour on the faces, in device pixels (= outline width). */ private readonly cutWidth; private readonly composite; private readonly quadScene; private readonly quadCamera; private readonly quad; private readonly size; private readonly savedClearColor; private readonly savedViewport; constructor(); private ensureTarget; /** * Render the id pass and draw the outline over the current (canvas) framebuffer. * Call right after the main scene render. */ render(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, options: CapOutlineOptions): void; dispose(): void; }