WebXRRawCameraAccess.d.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import type { WebXRSessionManager } from "../webXRSessionManager";
  2. import { WebXRAbstractFeature } from "./WebXRAbstractFeature";
  3. import { Observable } from "../../Misc/observable";
  4. import { BaseTexture } from "../../Materials/Textures/baseTexture";
  5. /**
  6. * Options for raw camera access
  7. */
  8. export interface IWebXRRawCameraAccessOptions {
  9. /**
  10. * Keep the created textures and metadata when detaching the feature.
  11. */
  12. doNotDisposeOnDetach?: boolean;
  13. }
  14. /**
  15. * WebXR Feature for WebXR raw camera access
  16. * @since 6.31.0
  17. * @see https://immersive-web.github.io/raw-camera-access/
  18. */
  19. export declare class WebXRRawCameraAccess extends WebXRAbstractFeature {
  20. readonly options: IWebXRRawCameraAccessOptions;
  21. private _cachedInternalTextures;
  22. /**
  23. * This is an array of camera views
  24. * Note that mostly the array will contain a single view
  25. * If you want to know the order of the views, use the `viewIndex` array
  26. */
  27. texturesData: BaseTexture[];
  28. /**
  29. * If needed, this array will contain the eye definition of each texture in `texturesArray`
  30. */
  31. viewIndex: string[];
  32. /**
  33. * If needed, this array will contain the camera's intrinsics
  34. * You can use this data to convert from camera space to screen space and vice versa
  35. */
  36. cameraIntrinsics: {
  37. u0: number;
  38. v0: number;
  39. ax: number;
  40. ay: number;
  41. gamma: number;
  42. width: number;
  43. height: number;
  44. viewportX: number;
  45. viewportY: number;
  46. }[];
  47. /**
  48. * An observable that will notify when the camera's textures are updated
  49. */
  50. onTexturesUpdatedObservable: Observable<BaseTexture[]>;
  51. private _glBinding?;
  52. private _glContext;
  53. /**
  54. * The module's name
  55. */
  56. static readonly Name = "xr-raw-camera-access";
  57. /**
  58. * The (Babylon) version of this module.
  59. * This is an integer representing the implementation version.
  60. * This number does not correspond to the WebXR specs version
  61. */
  62. static readonly Version = 1;
  63. /**
  64. * Creates a new instance of the feature
  65. * @param _xrSessionManager the WebXRSessionManager
  66. * @param options options for the Feature
  67. */
  68. constructor(_xrSessionManager: WebXRSessionManager, options?: IWebXRRawCameraAccessOptions);
  69. attach(force?: boolean | undefined): boolean;
  70. detach(): boolean;
  71. /**
  72. * Dispose this feature and all of the resources attached
  73. */
  74. dispose(): void;
  75. /**
  76. * @see https://github.com/immersive-web/raw-camera-access/blob/main/explainer.md
  77. * @param view the XRView to update
  78. * @param index the index of the view in the views array
  79. */
  80. private _updateCameraIntrinsics;
  81. private _updateInternalTextures;
  82. protected _onXRFrame(_xrFrame: XRFrame): void;
  83. }