Bloom.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright (C) 2009-present, 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/Gr.h>
  8. #include <AnKi/Resource/ImageResource.h>
  9. namespace anki {
  10. // Forward
  11. extern NumericCVar<F32> g_bloomThresholdCVar;
  12. /// @addtogroup renderer
  13. /// @{
  14. /// Bloom passes.
  15. class Bloom : public RendererObject
  16. {
  17. public:
  18. Bloom();
  19. ~Bloom();
  20. Error init()
  21. {
  22. const Error err = initInternal();
  23. if(err)
  24. {
  25. ANKI_R_LOGE("Failed to initialize bloom passes");
  26. }
  27. return err;
  28. }
  29. /// Populate the rendergraph.
  30. void populateRenderGraph(RenderingContext& ctx);
  31. RenderTargetHandle getRt() const
  32. {
  33. return m_runCtx.m_upscaleRt;
  34. }
  35. private:
  36. class
  37. {
  38. public:
  39. ShaderProgramResourcePtr m_prog;
  40. ShaderProgramPtr m_grProg;
  41. RenderTargetDesc m_rtDescr;
  42. } m_exposure;
  43. class
  44. {
  45. public:
  46. ImageResourcePtr m_lensDirtImage;
  47. ShaderProgramResourcePtr m_prog;
  48. ShaderProgramPtr m_grProg;
  49. RenderTargetDesc m_rtDescr;
  50. } m_upscale;
  51. class
  52. {
  53. public:
  54. RenderTargetHandle m_exposureRt;
  55. RenderTargetHandle m_upscaleRt;
  56. } m_runCtx;
  57. Error initExposure();
  58. Error initUpscale();
  59. Error initInternal();
  60. void getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
  61. [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override;
  62. };
  63. /// @}
  64. } // end namespace anki