webXRTypes.ts 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Nullable } from "../../types";
  2. import { IDisposable } from "../../scene";
  3. /**
  4. * States of the webXR experience
  5. */
  6. export enum WebXRState {
  7. /**
  8. * Transitioning to being in XR mode
  9. */
  10. ENTERING_XR,
  11. /**
  12. * Transitioning to non XR mode
  13. */
  14. EXITING_XR,
  15. /**
  16. * In XR mode and presenting
  17. */
  18. IN_XR,
  19. /**
  20. * Not entered XR mode
  21. */
  22. NOT_IN_XR
  23. }
  24. /**
  25. * Abstraction of the XR render target
  26. */
  27. export interface WebXRRenderTarget extends IDisposable {
  28. /**
  29. * xrpresent context of the canvas which can be used to display/mirror xr content
  30. */
  31. canvasContext: WebGLRenderingContext;
  32. /**
  33. * xr layer for the canvas
  34. */
  35. xrLayer: Nullable<XRWebGLLayer>;
  36. /**
  37. * Initializes the xr layer for the session
  38. * @param xrSession xr session
  39. * @returns a promise that will resolve once the XR Layer has been created
  40. */
  41. initializeXRLayerAsync(xrSession: XRSession) : Promise<void>;
  42. }