1 |
|
2 |
|
3 | import { ArrayCamera } from "../../cameras/ArrayCamera.js";
|
4 | import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
|
5 | import { EventDispatcher } from "../../core/EventDispatcher.js";
|
6 | import { Vector4 } from "../../math/Vector4.js";
|
7 | import { Mesh } from "../../objects/Mesh.js";
|
8 | import { Texture } from "../../textures/Texture.js";
|
9 | import { WebGLRenderer } from "../WebGLRenderer.js";
|
10 | import { XRGripSpace, XRHandSpace, XRTargetRaySpace } from "./WebXRController.js";
|
11 |
|
12 | export type WebXRCamera = PerspectiveCamera & { viewport: Vector4 };
|
13 | export type WebXRArrayCamera = Omit<ArrayCamera, "cameras"> & { cameras: [WebXRCamera, WebXRCamera] };
|
14 |
|
15 | export interface WebXRManagerEventMap {
|
16 | sessionstart: {};
|
17 | sessionend: {};
|
18 | planeadded: { data: XRPlane };
|
19 | planeremoved: { data: XRPlane };
|
20 | planechanged: { data: XRPlane };
|
21 | planesdetected: { data: XRPlaneSet };
|
22 | }
|
23 |
|
24 | export class WebXRManager extends EventDispatcher<WebXRManagerEventMap> {
|
25 | |
26 |
|
27 |
|
28 | cameraAutoUpdate: boolean;
|
29 |
|
30 | |
31 |
|
32 |
|
33 | enabled: boolean;
|
34 |
|
35 | |
36 |
|
37 |
|
38 | isPresenting: boolean;
|
39 |
|
40 | constructor(renderer: WebGLRenderer, gl: WebGLRenderingContext);
|
41 |
|
42 | getController: (index: number) => XRTargetRaySpace;
|
43 |
|
44 | getControllerGrip: (index: number) => XRGripSpace;
|
45 |
|
46 | getHand: (index: number) => XRHandSpace;
|
47 |
|
48 | setFramebufferScaleFactor: (value: number) => void;
|
49 |
|
50 | setReferenceSpaceType: (value: XRReferenceSpaceType) => void;
|
51 |
|
52 | getReferenceSpace: () => XRReferenceSpace | null;
|
53 |
|
54 | setReferenceSpace: (value: XRReferenceSpace) => void;
|
55 |
|
56 | getBaseLayer: () => XRWebGLLayer | XRProjectionLayer;
|
57 |
|
58 | getBinding: () => XRWebGLBinding;
|
59 |
|
60 | getFrame: () => XRFrame;
|
61 |
|
62 | getSession: () => XRSession | null;
|
63 |
|
64 | setSession: (value: XRSession | null) => Promise<void>;
|
65 |
|
66 | getEnvironmentBlendMode: () => XREnvironmentBlendMode | undefined;
|
67 |
|
68 | getDepthTexture: () => Texture | null;
|
69 |
|
70 | updateCamera: (camera: PerspectiveCamera) => void;
|
71 |
|
72 | getCamera: () => WebXRArrayCamera;
|
73 |
|
74 | getFoveation: () => number | undefined;
|
75 |
|
76 | setFoveation: (value: number) => void;
|
77 |
|
78 | hasDepthSensing: () => boolean;
|
79 |
|
80 | getDepthSensingMesh: () => Mesh | null;
|
81 |
|
82 | setAnimationLoop: (callback: XRFrameRequestCallback | null) => void;
|
83 |
|
84 | dispose: () => void;
|
85 | }
|