import { Camera, Ray, WebGLRenderer, Scene, Vector3, WebGLRenderTarget } from 'three'; import { PointCloudMaterial } from '../../../../rendering'; import { PointCloudOctree } from './PointCloudOctree'; import { IPointCloudTreeNode } from './IPointCloudTreeNode'; import { PickPoint, PointCloudHit } from '../types/types'; export interface RenderedNode { node: IPointCloudTreeNode; octree: PointCloudOctree; } export interface IPickState { renderTarget: WebGLRenderTarget; material: PointCloudMaterial; scene: Scene; } export interface PickParams { pickWindowSize: number; pickOutsideClipRegion: boolean; /** * If provided, the picking will use this pixel position instead of the `Ray` passed to the `pick` * method. */ pixelPosition: Vector3; /** * Function which gets called after a picking material has been created and setup and before the * point cloud is rendered into the picking render target. This gives applications a chance to * customize the renderTarget and the material. * * @param material The pick material. * @param renterTarget The render target used for picking. */ onBeforePickRender: (material: PointCloudMaterial, renterTarget: WebGLRenderTarget) => void; /** * Whether the camera is currently known to be in motion (e.g. during an interactive zoom/pan/ * orbit). When true, the full-frame pick cache is never rebuilt for this call, regardless of * how long ago it was last invalidated. Confirmed by measurement: a full-frame rebuild's async * GPU readback (tens to hundreds of ms) routinely doesn't finish before the next camera-change * invalidates it again during continuous motion, so the rebuild is started, pays its full cost, * gets discarded, and the caller still has to fall back to a windowed pick anyway. Falls back to * the time-based holdoff when omitted. */ cameraInMotion?: boolean; /** * Unconditionally skips the full-frame pick cache (both serving from it and rebuilding it) for * this call, regardless of camera-motion state. Intended for callers that pick on every input * event of a fast, continuous interaction (e.g. wheel-driven zoom-to-cursor) where even * checking/rebuilding the cache adds latency that matters more than the cache's benefit - unlike * `cameraInMotion`, this doesn't depend on the camera having already started moving, which * matters because some callers pick *before* moving the camera for that same input event. */ forceWindowedPick?: boolean; } /** * Helper class for PointCloudOctreePicker. */ export declare class PointCloudOctreePickerHelper { private static readonly helperVec3; private static readonly helperSphere; private readonly _renderer; private readonly _rendererStateHelper; constructor(renderer: WebGLRenderer); resetState(): void; prepareRender(x: number, y: number, width: number, height: number, pickMaterial: PointCloudMaterial, pickState: IPickState): void; render(camera: Camera, pickMaterial: PointCloudMaterial, octrees: PointCloudOctree[], ray: Ray | undefined, pickState: IPickState, params: Partial, nodeIndexBits?: number): RenderedNode[]; private static nodesOnRay; readPixelsAsync(x: number, y: number, width: number, height: number, renderTarget: WebGLRenderTarget, pixels?: Uint8Array): Promise; private static createTempNodes; private static updatePickMaterial; static updatePickRenderTarget(pickState: IPickState, width: number, height: number): void; private static makePickRenderTarget; static computeBitSplit(nodeCount: number, maxPointsPerNode: number): number | undefined; static decodePackedPixel(packedIndex: number, nodeIndexBits: number): { nodeIndex: number; pointIndex: number; }; static findHit(pixels: Uint8Array, pickWndSize: number, nodes: RenderedNode[], camera: Camera, nodeIndexBits?: number): PointCloudHit | null; static findHitInBuffer(ibuffer: Uint32Array, bufferWidth: number, bufferHeight: number, centerX: number, centerY: number, windowSize: number, nodes: RenderedNode[], camera: Camera, nodeIndexBits: number): PointCloudHit | null; static getPickPoint(hit: PointCloudHit | null, nodes: RenderedNode[]): PickPoint | null; static getPointPosition(nodes: RenderedNode[], pcIndex: number, pIndex: number): Vector3; private static addPositionToPickPoint; private static addNormalToPickPoint; static getPickState(): IPickState; }