depthRendererSceneComponent.d.ts 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import type { Nullable } from "../types";
  2. import { Scene } from "../scene";
  3. import { DepthRenderer } from "./depthRenderer";
  4. import type { Camera } from "../Cameras/camera";
  5. import type { ISceneComponent } from "../sceneComponent";
  6. declare module "../scene" {
  7. interface Scene {
  8. /** @internal (Backing field) */
  9. _depthRenderer: {
  10. [id: string]: DepthRenderer;
  11. };
  12. /**
  13. * Creates a depth renderer a given camera which contains a depth map which can be used for post processing.
  14. * @param camera The camera to create the depth renderer on (default: scene's active camera)
  15. * @param storeNonLinearDepth Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z
  16. * @param force32bitsFloat Forces 32 bits float when supported (else 16 bits float is prioritized over 32 bits float if supported)
  17. * @param samplingMode The sampling mode to be used with the render target (Linear, Nearest...)
  18. * @param storeCameraSpaceZ Defines whether the depth stored is the Z coordinate in camera space. If true, storeNonLinearDepth has no effect. (Default: false)
  19. * @returns the created depth renderer
  20. */
  21. enableDepthRenderer(camera?: Nullable<Camera>, storeNonLinearDepth?: boolean, force32bitsFloat?: boolean, samplingMode?: number, storeCameraSpaceZ?: boolean): DepthRenderer;
  22. /**
  23. * Disables a depth renderer for a given camera
  24. * @param camera The camera to disable the depth renderer on (default: scene's active camera)
  25. */
  26. disableDepthRenderer(camera?: Nullable<Camera>): void;
  27. }
  28. }
  29. /**
  30. * Defines the Depth Renderer scene component responsible to manage a depth buffer useful
  31. * in several rendering techniques.
  32. */
  33. export declare class DepthRendererSceneComponent implements ISceneComponent {
  34. /**
  35. * The component name helpful to identify the component in the list of scene components.
  36. */
  37. readonly name = "DepthRenderer";
  38. /**
  39. * The scene the component belongs to.
  40. */
  41. scene: Scene;
  42. /**
  43. * Creates a new instance of the component for the given scene
  44. * @param scene Defines the scene to register the component in
  45. */
  46. constructor(scene: Scene);
  47. /**
  48. * Registers the component in a given scene
  49. */
  50. register(): void;
  51. /**
  52. * Rebuilds the elements related to this component in case of
  53. * context lost for instance.
  54. */
  55. rebuild(): void;
  56. /**
  57. * Disposes the component and the associated resources
  58. */
  59. dispose(): void;
  60. private _gatherRenderTargets;
  61. private _gatherActiveCameraRenderTargets;
  62. }