MotionBlur.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. namespace anki {
  8. /// @addtogroup renderer
  9. /// @{
  10. ANKI_CVAR2(NumericCVar<U32>, Render, MotionBlur, TileSize, 32, 8, 64, "Motion blur tile size")
  11. ANKI_CVAR2(NumericCVar<U32>, Render, MotionBlur, SampleCount, 16, 0, 64, "Motion blur sample count")
  12. /// Motion blur.
  13. class MotionBlur : public RendererObject
  14. {
  15. public:
  16. MotionBlur()
  17. {
  18. registerDebugRenderTarget("MotionBlur");
  19. }
  20. Error init();
  21. void populateRenderGraph(RenderingContext& ctx);
  22. void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, U32(DebugRenderTargetRegister::kCount)>& handles,
  23. [[maybe_unused]] DebugRenderTargetDrawStyle& drawStyle) const override
  24. {
  25. ANKI_ASSERT(rtName == "MotionBlur");
  26. handles[0] = m_runCtx.m_rt;
  27. }
  28. RenderTargetHandle getRt() const
  29. {
  30. return m_runCtx.m_rt;
  31. }
  32. private:
  33. ShaderProgramResourcePtr m_prog;
  34. ShaderProgramPtr m_maxVelocityGrProg;
  35. ShaderProgramPtr m_maxNeightbourVelocityGrProg;
  36. ShaderProgramPtr m_reconstructGrProg;
  37. RenderTargetDesc m_maxVelocityRtDesc;
  38. RenderTargetDesc m_maxNeighbourVelocityRtDesc;
  39. RenderTargetDesc m_finalRtDesc;
  40. class
  41. {
  42. public:
  43. RenderTargetHandle m_rt;
  44. } m_runCtx;
  45. };
  46. /// @}
  47. } // end namespace anki