import type { Five } from '@realsee/five'; import * as THREE from 'three'; import { Magnifier, type MagnifierParameter, type PointIntersection } from '../shared-utils'; export { CLOSEUP_DISTANCE } from './closeupView'; /** 近景取景方式 */ export type MeasureCloseupMode = /** 只旋转、不平移:与主视图共用机位,无新增视差;默认 */ 'rotate' /** 旧行为:把相机推到落点附近 0.6m,再朝法线偏转;放大倍率高,但会产生视差 */ | 'push' /** 完全沿用主相机,只放大局部像素 */ | 'off'; export interface MeasureMagnifierOptions extends MagnifierParameter { /** 是否绘制坐标轴 / 平面框叠加层,默认 true(关掉后行为与现状 Magnifier 完全一致) */ overlayEnabled?: boolean; /** 兼容旧参数:false 等价于 closeupMode='off' */ closeupEnabled?: boolean; /** 近景取景方式,默认 'rotate' */ closeupMode?: MeasureCloseupMode; } export declare function getMeasureMagnifierDefaults(): MeasureMagnifierOptions; /** * 量尺 V2 用的放大镜。 * * 完全复用 Magnifier 的「读像素 + 放大」逻辑(直接 super.render()), * 只是在其之后往同一个 2D canvas 上叠加坐标轴与落点平面框。 */ export declare class MeasureMagnifier extends Magnifier { /** 父类把 five 存成了 private,这里自己留一份,叠加层投影时要用 */ private overlayFive; /** 父类把 context 存成了 private;getContext('2d') 拿到的是同一个实例 */ private overlayContext; /** 由 PointSelector 的 intersectionUpdate 事件注入 */ private overlayIntersection; private overlayEnabled; private closeupMode; /** 本次渲染实际使用的相机(推近后的副本),叠加层投影必须和它一致 */ private overlayCamera; /** 本次放大镜渲染的落点;相机取向以它为准,避免和交点数据错帧 */ private renderPoint; /** 近景视角的平滑状态 */ private closeupState; constructor(five: Five, options?: MeasureMagnifierOptions); renderWithPoint(point: THREE.Vector3): void; /** 每次交点更新时调用;传 null 表示当前没有命中任何模型 */ setIntersection(intersection: PointIntersection | null): void; /** 开关叠加层,用于灰度 / 排查问题 */ setOverlayEnabled(enabled: boolean): void; /** 开关近景 3D 视角,用于灰度 / 对比;开启时使用默认的 rotate 模式 */ setCloseupEnabled(enabled: boolean): void; /** 切换近景取景方式,用于三种模式的对比 */ setCloseupMode(mode: MeasureCloseupMode): void; getCloseupMode(): MeasureCloseupMode; render(): void; private renderOverlay; /** * 近景 3D 视角:读像素前调整相机取向,让视线朝落点所在表面的法线偏一点 * (斜向 / 侧向的表面在放大镜里以更接近正面的角度呈现),读完立即还原。 * * 两种模式: * - rotate(默认):只旋转、不平移。与主视图共用同一机位,不产生视差,全景 / 模型都按同一视点采样; * - push(旧行为):把相机推到落点附近 0.6m,放大倍率更高,但会产生视差和近距透视形变。 * * 姿态由主相机绕落点做最小旋转得到:偏转角有上限、画面不翻滚。 */ private moveCameraCloseup; /** 只记录投影要用的矩阵;Five 的相机 clone() 开销大,也不保证可用 */ private snapshotOverlayCamera; private getOverlayContext; /** * 还原 Magnifier.render() 内部的取值,用来把世界坐标映射到放大镜 canvas 坐标。 * 这些换算必须和父类保持一致,父类改动时需要同步。 */ private getOverlayViewport; }