utilityLayerRenderer.d.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import type { IDisposable } from "../scene";
  2. import { Scene } from "../scene";
  3. import type { Nullable } from "../types";
  4. import { Observable } from "../Misc/observable";
  5. import type { AbstractMesh } from "../Meshes/abstractMesh";
  6. import { HemisphericLight } from "../Lights/hemisphericLight";
  7. import type { Camera } from "../Cameras/camera";
  8. /**
  9. * Renders a layer on top of an existing scene
  10. */
  11. export declare class UtilityLayerRenderer implements IDisposable {
  12. /** the original scene that will be rendered on top of */
  13. originalScene: Scene;
  14. private _pointerCaptures;
  15. private _lastPointerEvents;
  16. /** @internal */
  17. static _DefaultUtilityLayer: Nullable<UtilityLayerRenderer>;
  18. /** @internal */
  19. static _DefaultKeepDepthUtilityLayer: Nullable<UtilityLayerRenderer>;
  20. private _sharedGizmoLight;
  21. private _renderCamera;
  22. /**
  23. * Gets the camera that is used to render the utility layer (when not set, this will be the last active camera)
  24. * @param getRigParentIfPossible if the current active camera is a rig camera, should its parent camera be returned
  25. * @returns the camera that is used when rendering the utility layer
  26. */
  27. getRenderCamera(getRigParentIfPossible?: boolean): Camera;
  28. /**
  29. * Sets the camera that should be used when rendering the utility layer (If set to null the last active camera will be used)
  30. * @param cam the camera that should be used when rendering the utility layer
  31. */
  32. setRenderCamera(cam: Nullable<Camera>): void;
  33. /**
  34. * @internal
  35. * Light which used by gizmos to get light shading
  36. */
  37. _getSharedGizmoLight(): HemisphericLight;
  38. /**
  39. * If the picking should be done on the utility layer prior to the actual scene (Default: true)
  40. */
  41. pickUtilitySceneFirst: boolean;
  42. /**
  43. * A shared utility layer that can be used to overlay objects into a scene (Depth map of the previous scene is cleared before drawing on top of it)
  44. */
  45. static get DefaultUtilityLayer(): UtilityLayerRenderer;
  46. /**
  47. * Creates an utility layer, and set it as a default utility layer
  48. * @param scene associated scene
  49. * @internal
  50. */
  51. static _CreateDefaultUtilityLayerFromScene(scene: Scene): UtilityLayerRenderer;
  52. /**
  53. * A shared utility layer that can be used to embed objects into a scene (Depth map of the previous scene is not cleared before drawing on top of it)
  54. */
  55. static get DefaultKeepDepthUtilityLayer(): UtilityLayerRenderer;
  56. /**
  57. * The scene that is rendered on top of the original scene
  58. */
  59. utilityLayerScene: Scene;
  60. /**
  61. * If the utility layer should automatically be rendered on top of existing scene
  62. */
  63. shouldRender: boolean;
  64. /**
  65. * If set to true, only pointer down onPointerObservable events will be blocked when picking is occluded by original scene
  66. */
  67. onlyCheckPointerDownEvents: boolean;
  68. /**
  69. * If set to false, only pointerUp, pointerDown and pointerMove will be sent to the utilityLayerScene (false by default)
  70. */
  71. processAllEvents: boolean;
  72. /**
  73. * Set to false to disable picking
  74. */
  75. pickingEnabled: boolean;
  76. /**
  77. * Observable raised when the pointer moves from the utility layer scene to the main scene
  78. */
  79. onPointerOutObservable: Observable<number>;
  80. /** Gets or sets a predicate that will be used to indicate utility meshes present in the main scene */
  81. mainSceneTrackerPredicate: (mesh: Nullable<AbstractMesh>) => boolean;
  82. private _afterRenderObserver;
  83. private _sceneDisposeObserver;
  84. private _originalPointerObserver;
  85. /**
  86. * Instantiates a UtilityLayerRenderer
  87. * @param originalScene the original scene that will be rendered on top of
  88. * @param handleEvents boolean indicating if the utility layer should handle events
  89. */
  90. constructor(
  91. /** the original scene that will be rendered on top of */
  92. originalScene: Scene, handleEvents?: boolean);
  93. private _notifyObservers;
  94. /**
  95. * Renders the utility layers scene on top of the original scene
  96. */
  97. render(): void;
  98. /**
  99. * Disposes of the renderer
  100. */
  101. dispose(): void;
  102. private _updateCamera;
  103. }