import { XRController } from './xrController'; import { Camera } from '../core/camera'; import * as THREE from "three"; type XRMachineType = 'Pico' | 'Oculus' | 'VP'; interface XRInitOption { /** 使用WEBXR的当前设备*/ machineType: XRMachineType; /** 全景模式还是视差模式*/ isPanorama: boolean; /** 使用的参考空间类型*/ referenceSpaceType: XRReferenceSpaceType; onSessionStart?(session: XRSession): void; onSessionEnd?(): void; } declare class XRManager { /** 是否使用全景模式*/ isPanorama: boolean; /** 当前的设备*/ machineType: XRMachineType; /** 场景渲染器*/ renderer: THREE.WebGLRenderer; /** opengles句柄*/ gl: WebGLRenderingContext; /** 是否开启XR模式 */ enabled: boolean; /** WebXR模式Context */ session: XRSession | null; /** XR参考空间类型*/ referenceSpaceType: XRReferenceSpaceType; /** XR参考空间 */ referenceSpace: XRReferenceSpace | null; /** XR控制器 */ controllers: XRController[]; /** XR控制器控制数据 */ inputSourcesMap: Map; /** XR双相机 */ cameraVR: THREE.ArrayCamera; /** XR左眼相机*/ cameraL: THREE.PerspectiveCamera; /** XR右眼相机*/ cameraR: THREE.PerspectiveCamera; /** 是否在获取*/ isPresenting: boolean; /** 视锥近面*/ private currentDepthNear; /** 视锥远面*/ private currentDepthFar; /** 左眼相机位姿*/ private cameraLPos; /** 右眼相机位姿*/ private cameraRPos; /** XRSession 开始 */ private onSessionStartCallback; /** XRSession 结束 */ private onSessionEndCallback; constructor(renderer: THREE.WebGLRenderer, gl: WebGLRenderingContext, options?: Partial); getController(index: number): any; getRightController(): any; getLeftController(): any; getControllerGrip(index: number): any; getCameras(): any; private updateCamera; /** * @author jsantell / https://www.jsantell.com/ * * Assumes 2 cameras that are parallel and share an X-axis, and that * the cameras' projection and world matrices have already been set. * And that near and far planes are identical for both cameras. * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765 */ setProjectionFromUnion(camera: THREE.PerspectiveCamera, cameraL: THREE.PerspectiveCamera, cameraR: THREE.PerspectiveCamera): void; /** * 获取THREEJS用于渲染XR场景的双眼相机 * @param camera - 传统模式下渲染场景的THREEJS相机 * @returns - 用于渲染XR场景的双眼相机 */ getCamera(camera: Camera): any; private updateInputSources; private onSessionEvent; private onSessionEnd; private onRequestReferenceSpace; setSession(value: XRSession | null): void; } export { XRManager, XRInitOption, XRMachineType };