IndirectDiffuseProbes.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright (C) 2009-2023, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Renderer/RendererObject.h>
  7. #include <AnKi/Renderer/Utils/TraditionalDeferredShading.h>
  8. #include <AnKi/Collision/Forward.h>
  9. namespace anki {
  10. /// @addtogroup renderer
  11. /// @{
  12. /// Ambient global illumination passes.
  13. ///
  14. /// It builds a volume clipmap with ambient GI information.
  15. class IndirectDiffuseProbes : public RendererObject
  16. {
  17. public:
  18. Error init();
  19. /// Populate the rendergraph.
  20. void populateRenderGraph(RenderingContext& ctx);
  21. RenderTargetHandle getCurrentlyRefreshedVolumeRt() const
  22. {
  23. ANKI_ASSERT(m_runCtx.m_probeVolumeHandle.isValid());
  24. return m_runCtx.m_probeVolumeHandle;
  25. }
  26. Bool hasCurrentlyRefreshedVolumeRt() const
  27. {
  28. return m_runCtx.m_probeVolumeHandle.isValid();
  29. }
  30. private:
  31. class
  32. {
  33. public:
  34. Array<RenderTargetDescription, kGBufferColorRenderTargetCount> m_colorRtDescrs;
  35. RenderTargetDescription m_depthRtDescr;
  36. FramebufferDescription m_fbDescr;
  37. } m_gbuffer; ///< G-buffer pass.
  38. class
  39. {
  40. public:
  41. RenderTargetDescription m_rtDescr;
  42. FramebufferDescription m_fbDescr;
  43. } m_shadowMapping;
  44. class LS
  45. {
  46. public:
  47. RenderTargetDescription m_rtDescr;
  48. FramebufferDescription m_fbDescr;
  49. TraditionalDeferredLightShading m_deferred;
  50. } m_lightShading; ///< Light shading.
  51. class
  52. {
  53. public:
  54. ShaderProgramResourcePtr m_prog;
  55. ShaderProgramPtr m_grProg;
  56. } m_irradiance; ///< Irradiance.
  57. static constexpr U32 kProbeCellRefreshesPerFrame = 2;
  58. U32 m_tileSize = 0;
  59. class
  60. {
  61. public:
  62. RenderTargetHandle m_probeVolumeHandle;
  63. } m_runCtx;
  64. Error initInternal();
  65. Error initGBuffer();
  66. Error initShadowMapping();
  67. Error initLightShading();
  68. Error initIrradiance();
  69. };
  70. /// @}
  71. } // end namespace anki