Ms.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <anki/renderer/RenderingPass.h>
  7. #include <anki/Gr.h>
  8. namespace anki
  9. {
  10. /// @addtogroup renderer
  11. /// @{
  12. /// Material stage also known as G buffer stage. It populates the G buffer
  13. class Ms : public RenderingPass
  14. {
  15. anki_internal:
  16. static const U ATTACHMENT_COUNT = 3;
  17. static const Array<PixelFormat, ATTACHMENT_COUNT> RT_PIXEL_FORMATS;
  18. static const PixelFormat DEPTH_RT_PIXEL_FORMAT;
  19. Ms(Renderer* r)
  20. : RenderingPass(r)
  21. {
  22. }
  23. ~Ms();
  24. ANKI_USE_RESULT Error init(const ConfigSet& initializer);
  25. ANKI_USE_RESULT Error run(CommandBufferPtr& jobs);
  26. TexturePtr& getRt0()
  27. {
  28. return m_rt0;
  29. }
  30. TexturePtr& getRt1()
  31. {
  32. return m_rt1;
  33. }
  34. TexturePtr& getRt2()
  35. {
  36. return m_rt2;
  37. }
  38. TexturePtr getDepthRt() const
  39. {
  40. return m_depthRt;
  41. }
  42. FramebufferPtr& getFramebuffer()
  43. {
  44. return m_fb;
  45. }
  46. private:
  47. FramebufferPtr m_fb;
  48. /// Contains diffuse color and emission
  49. TexturePtr m_rt0;
  50. /// Contains specular color, roughness
  51. TexturePtr m_rt1;
  52. /// Contains normals
  53. TexturePtr m_rt2;
  54. /// Depth stencil
  55. TexturePtr m_depthRt;
  56. DArray<CommandBufferPtr> m_secondLevelCmdbs;
  57. ANKI_USE_RESULT Error initInternal(const ConfigSet& initializer);
  58. /// Create a G buffer FBO
  59. ANKI_USE_RESULT Error createRt(U32 samples);
  60. };
  61. /// @}
  62. } // end namespace anki