VolumetricLightingAccumulation.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (C) 2009-2021, 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. namespace anki {
  8. /// @addtogroup renderer
  9. /// @{
  10. /// Volumetric lighting. It accumulates lighting in a volume texture.
  11. class VolumetricLightingAccumulation : public RendererObject
  12. {
  13. public:
  14. VolumetricLightingAccumulation(Renderer* r);
  15. ~VolumetricLightingAccumulation();
  16. ANKI_USE_RESULT Error init(const ConfigSet& config);
  17. /// Populate the rendergraph.
  18. void populateRenderGraph(RenderingContext& ctx);
  19. RenderTargetHandle getRt() const
  20. {
  21. return m_runCtx.m_rts[1];
  22. }
  23. /// Get the last cluster split in Z axis that will be affected by lighting.
  24. U32 getFinalZSplit() const
  25. {
  26. return m_finalZSplit;
  27. }
  28. private:
  29. ShaderProgramResourcePtr m_prog;
  30. ShaderProgramPtr m_grProg;
  31. Array<TexturePtr, 2> m_rtTextures;
  32. ImageResourcePtr m_noiseImage;
  33. U32 m_finalZSplit = 0;
  34. Array<U32, 3> m_workgroupSize = {};
  35. Array<U32, 3> m_volumeSize;
  36. class
  37. {
  38. public:
  39. Array<RenderTargetHandle, 2> m_rts;
  40. } m_runCtx; ///< Runtime context.
  41. void run(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx);
  42. };
  43. /// @}
  44. } // end namespace anki