webXRDefaultExperience.d.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. import { WebXRExperienceHelper } from "./webXRExperienceHelper";
  2. import type { Scene } from "../scene";
  3. import type { IWebXRInputOptions } from "./webXRInput";
  4. import { WebXRInput } from "./webXRInput";
  5. import type { IWebXRControllerPointerSelectionOptions } from "./features/WebXRControllerPointerSelection";
  6. import { WebXRControllerPointerSelection } from "./features/WebXRControllerPointerSelection";
  7. import type { IWebXRNearInteractionOptions } from "./features/WebXRNearInteraction";
  8. import { WebXRNearInteraction } from "./features/WebXRNearInteraction";
  9. import type { WebXRRenderTarget } from "./webXRTypes";
  10. import type { WebXREnterExitUIOptions } from "./webXREnterExitUI";
  11. import { WebXREnterExitUI } from "./webXREnterExitUI";
  12. import type { AbstractMesh } from "../Meshes/abstractMesh";
  13. import type { WebXRManagedOutputCanvasOptions } from "./webXRManagedOutputCanvas";
  14. import type { IWebXRTeleportationOptions } from "./features/WebXRControllerTeleportation";
  15. import { type IWebXRHandTrackingOptions } from "./features/WebXRHandTracking";
  16. import { WebXRMotionControllerTeleportation } from "./features/WebXRControllerTeleportation";
  17. /**
  18. * Options for the default xr helper
  19. */
  20. export declare class WebXRDefaultExperienceOptions {
  21. /**
  22. * Enable or disable default UI to enter XR
  23. */
  24. disableDefaultUI?: boolean;
  25. /**
  26. * Should pointer selection not initialize.
  27. * Note that disabling pointer selection also disables teleportation.
  28. * Defaults to false.
  29. */
  30. disablePointerSelection?: boolean;
  31. /**
  32. * Should teleportation not initialize. Defaults to false.
  33. */
  34. disableTeleportation?: boolean;
  35. /**
  36. * Should nearInteraction not initialize. Defaults to false.
  37. */
  38. disableNearInteraction?: boolean;
  39. /**
  40. * Should hand tracking be disabled. Defaults to false.
  41. */
  42. disableHandTracking?: boolean;
  43. /**
  44. * Floor meshes that will be used for teleport
  45. */
  46. floorMeshes?: Array<AbstractMesh>;
  47. /**
  48. * If set to true, the first frame will not be used to reset position
  49. * The first frame is mainly used when copying transformation from the old camera
  50. * Mainly used in AR
  51. */
  52. ignoreNativeCameraTransformation?: boolean;
  53. /**
  54. * Optional configuration for the XR input object
  55. */
  56. inputOptions?: Partial<IWebXRInputOptions>;
  57. /**
  58. * optional configuration for pointer selection
  59. */
  60. pointerSelectionOptions?: Partial<IWebXRControllerPointerSelectionOptions>;
  61. /**
  62. * optional configuration for near interaction
  63. */
  64. nearInteractionOptions?: Partial<IWebXRNearInteractionOptions>;
  65. /**
  66. * optional configuration for hand tracking
  67. */
  68. handSupportOptions?: Partial<IWebXRHandTrackingOptions>;
  69. /**
  70. * optional configuration for teleportation
  71. */
  72. teleportationOptions?: Partial<IWebXRTeleportationOptions>;
  73. /**
  74. * optional configuration for the output canvas
  75. */
  76. outputCanvasOptions?: WebXRManagedOutputCanvasOptions;
  77. /**
  78. * optional UI options. This can be used among other to change session mode and reference space type
  79. */
  80. uiOptions?: Partial<WebXREnterExitUIOptions>;
  81. /**
  82. * When loading teleportation and pointer select, use stable versions instead of latest.
  83. */
  84. useStablePlugins?: boolean;
  85. /**
  86. * An optional rendering group id that will be set globally for teleportation, pointer selection and default controller meshes
  87. */
  88. renderingGroupId?: number;
  89. /**
  90. * A list of optional features to init the session with
  91. * If set to true, all features we support will be added
  92. */
  93. optionalFeatures?: boolean | string[];
  94. }
  95. /**
  96. * Default experience for webxr
  97. */
  98. export declare class WebXRDefaultExperience {
  99. /**
  100. * Base experience
  101. */
  102. baseExperience: WebXRExperienceHelper;
  103. /**
  104. * Enables ui for entering/exiting xr
  105. */
  106. enterExitUI: WebXREnterExitUI;
  107. /**
  108. * Input experience extension
  109. */
  110. input: WebXRInput;
  111. /**
  112. * Enables laser pointer and selection
  113. */
  114. pointerSelection: WebXRControllerPointerSelection;
  115. /**
  116. * Default target xr should render to
  117. */
  118. renderTarget: WebXRRenderTarget;
  119. /**
  120. * Enables teleportation
  121. */
  122. teleportation: WebXRMotionControllerTeleportation;
  123. /**
  124. * Enables near interaction for hands/controllers
  125. */
  126. nearInteraction: WebXRNearInteraction;
  127. private constructor();
  128. /**
  129. * Creates the default xr experience
  130. * @param scene scene
  131. * @param options options for basic configuration
  132. * @returns resulting WebXRDefaultExperience
  133. */
  134. static CreateAsync(scene: Scene, options?: WebXRDefaultExperienceOptions): Promise<WebXRDefaultExperience>;
  135. /**
  136. * Disposes of the experience helper
  137. */
  138. dispose(): void;
  139. }