/* ============================================================================= * B05_Profile_UI_Viewer_Camera.ts * B05 뷰어의 **직교(원근 없음) 카메라**(2026-08-25 사용자 확정) — 탑뷰에서 구조물· * 절단 경계가 원근으로 일그러지지 않는다. 화면 배율은 camera.zoom이 지고(커서 피벗 * 유틸이 조작), 절두체 반높이는 fit()이 정한다. Viewer 700줄 제한으로 분리. * ========================================================================== */ import * as THREE from "three"; export interface OrthoCameraRig { camera: THREE.OrthographicCamera; /** 뷰포트 종횡비 반영(리사이즈 시). */ setAspect(aspect: number): void; /** 절두체 반높이(월드 m) 지정 — fit()이 화면 배율을 잡을 때 쓴다. zoom은 1로 되돌린다. */ setHalfHeight(halfHeight: number): void; } export function createOrthoCameraRig(): OrthoCameraRig { const camera = new THREE.OrthographicCamera(-100, 100, 100, -100, 0.1, 100000); camera.position.set(100, 120, 100); let halfHeight = 100; let aspect = 1; const apply = (): void => { camera.left = -halfHeight * aspect; camera.right = halfHeight * aspect; camera.top = halfHeight; camera.bottom = -halfHeight; camera.updateProjectionMatrix(); }; return { camera, setAspect(value: number): void { aspect = value; apply(); }, setHalfHeight(value: number): void { halfHeight = value; camera.zoom = 1; apply(); }, }; }