WebXRBackgroundRemover.d.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import type { WebXRSessionManager } from "../webXRSessionManager";
  2. import type { AbstractMesh } from "../../Meshes/abstractMesh";
  3. import { Observable } from "../../Misc/observable";
  4. import { WebXRAbstractFeature } from "./WebXRAbstractFeature";
  5. /**
  6. * Options interface for the background remover plugin
  7. */
  8. export interface IWebXRBackgroundRemoverOptions {
  9. /**
  10. * Further background meshes to disable when entering AR
  11. */
  12. backgroundMeshes?: AbstractMesh[];
  13. /**
  14. * flags to configure the removal of the environment helper.
  15. * If not set, the entire background will be removed. If set, flags should be set as well.
  16. */
  17. environmentHelperRemovalFlags?: {
  18. /**
  19. * Should the skybox be removed (default false)
  20. */
  21. skyBox?: boolean;
  22. /**
  23. * Should the ground be removed (default false)
  24. */
  25. ground?: boolean;
  26. };
  27. /**
  28. * don't disable the environment helper
  29. */
  30. ignoreEnvironmentHelper?: boolean;
  31. }
  32. /**
  33. * A module that will automatically disable background meshes when entering AR and will enable them when leaving AR.
  34. */
  35. export declare class WebXRBackgroundRemover extends WebXRAbstractFeature {
  36. /**
  37. * read-only options to be used in this module
  38. */
  39. readonly options: IWebXRBackgroundRemoverOptions;
  40. /**
  41. * The module's name
  42. */
  43. static readonly Name = "xr-background-remover";
  44. /**
  45. * The (Babylon) version of this module.
  46. * This is an integer representing the implementation version.
  47. * This number does not correspond to the WebXR specs version
  48. */
  49. static readonly Version = 1;
  50. /**
  51. * registered observers will be triggered when the background state changes
  52. */
  53. onBackgroundStateChangedObservable: Observable<boolean>;
  54. /**
  55. * constructs a new background remover module
  56. * @param _xrSessionManager the session manager for this module
  57. * @param options read-only options to be used in this module
  58. */
  59. constructor(_xrSessionManager: WebXRSessionManager,
  60. /**
  61. * read-only options to be used in this module
  62. */
  63. options?: IWebXRBackgroundRemoverOptions);
  64. /**
  65. * attach this feature
  66. * Will usually be called by the features manager
  67. *
  68. * @returns true if successful.
  69. */
  70. attach(): boolean;
  71. /**
  72. * detach this feature.
  73. * Will usually be called by the features manager
  74. *
  75. * @returns true if successful.
  76. */
  77. detach(): boolean;
  78. /**
  79. * Dispose this feature and all of the resources attached
  80. */
  81. dispose(): void;
  82. protected _onXRFrame(_xrFrame: XRFrame): void;
  83. private _setBackgroundState;
  84. }