depthPeelingRenderer.d.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import type { Effect } from "../Materials/effect";
  2. import type { SubMesh } from "../Meshes/subMesh";
  3. import type { AbstractMesh } from "../Meshes/abstractMesh";
  4. import { SmartArray } from "../Misc/smartArray";
  5. import type { Scene } from "../scene";
  6. import type { PrePassRenderer } from "./prePassRenderer";
  7. import "../Shaders/postprocess.vertex";
  8. import "../Shaders/oitFinal.fragment";
  9. import "../Shaders/oitBackBlend.fragment";
  10. /**
  11. * The depth peeling renderer that performs
  12. * Order independant transparency (OIT).
  13. * This should not be instanciated directly, as it is part of a scene component
  14. */
  15. export declare class DepthPeelingRenderer {
  16. private _scene;
  17. private _engine;
  18. private _depthMrts;
  19. private _thinTextures;
  20. private _colorMrts;
  21. private _blendBackMrt;
  22. private _outputRT;
  23. private _blendBackEffectWrapper;
  24. private _blendBackEffectWrapperPingPong;
  25. private _finalEffectWrapper;
  26. private _effectRenderer;
  27. private _currentPingPongState;
  28. private _prePassEffectConfiguration;
  29. private _blendBackTexture;
  30. private _layoutCacheFormat;
  31. private _layoutCache;
  32. private _renderPassIds;
  33. private _candidateSubMeshes;
  34. private _excludedSubMeshes;
  35. private _excludedMeshes;
  36. private static _DEPTH_CLEAR_VALUE;
  37. private static _MIN_DEPTH;
  38. private static _MAX_DEPTH;
  39. private _colorCache;
  40. private _passCount;
  41. /**
  42. * Number of depth peeling passes. As we are using dual depth peeling, each pass two levels of transparency are processed.
  43. */
  44. get passCount(): number;
  45. set passCount(count: number);
  46. private _useRenderPasses;
  47. /**
  48. * Instructs the renderer to use render passes. It is an optimization that makes the rendering faster for some engines (like WebGPU) but that consumes more memory, so it is disabled by default.
  49. */
  50. get useRenderPasses(): boolean;
  51. set useRenderPasses(usePasses: boolean);
  52. /**
  53. * Add a mesh in the exclusion list to prevent it to be handled by the depth peeling renderer
  54. * @param mesh The mesh to exclude from the depth peeling renderer
  55. */
  56. addExcludedMesh(mesh: AbstractMesh): void;
  57. /**
  58. * Remove a mesh from the exclusion list of the depth peeling renderer
  59. * @param mesh The mesh to remove
  60. */
  61. removeExcludedMesh(mesh: AbstractMesh): void;
  62. /**
  63. * Instanciates the depth peeling renderer
  64. * @param scene Scene to attach to
  65. * @param passCount Number of depth layers to peel
  66. * @returns The depth peeling renderer
  67. */
  68. constructor(scene: Scene, passCount?: number);
  69. private _createRenderPassIds;
  70. private _releaseRenderPassIds;
  71. private _createTextures;
  72. private _disposeTextures;
  73. private _updateTextures;
  74. private _updateTextureReferences;
  75. private _createEffects;
  76. /**
  77. * Links to the prepass renderer
  78. * @param prePassRenderer The scene PrePassRenderer
  79. */
  80. setPrePassRenderer(prePassRenderer: PrePassRenderer): void;
  81. /**
  82. * Binds depth peeling textures on an effect
  83. * @param effect The effect to bind textures on
  84. */
  85. bind(effect: Effect): void;
  86. private _renderSubMeshes;
  87. private _finalCompose;
  88. /**
  89. * Checks if the depth peeling renderer is ready to render transparent meshes
  90. * @returns true if the depth peeling renderer is ready to render the transparent meshes
  91. */
  92. isReady(): boolean;
  93. /**
  94. * Renders transparent submeshes with depth peeling
  95. * @param transparentSubMeshes List of transparent meshes to render
  96. * @returns The array of submeshes that could not be handled by this renderer
  97. */
  98. render(transparentSubMeshes: SmartArray<SubMesh>): SmartArray<SubMesh>;
  99. /**
  100. * Disposes the depth peeling renderer and associated ressources
  101. */
  102. dispose(): void;
  103. }