CmRenderer.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmGameObject.h"
  4. #include "BsEvent.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Allows you to customize how are objects rendered. You need to
  9. * provide your own implementation of your class.
  10. */
  11. class CM_EXPORT Renderer
  12. {
  13. public:
  14. /**
  15. * @brief Name of the renderer. Used by materials to find
  16. * an appropriate technique for this renderer.
  17. */
  18. virtual const String& getName() const = 0;
  19. /**
  20. * @brief Called in order to render all currentlx active cameras.
  21. */
  22. virtual void renderAll() = 0;
  23. /**
  24. * @brief Allows you to register a callback for the specified viewport. The callback
  25. * will be called before rendering and you will be able to populate the
  26. * render queue with render commands that will be executed when rendering.
  27. */
  28. void addRenderCallback(const Viewport* viewport, std::function<void(const Viewport*, RenderQueue&)> callback);
  29. protected:
  30. UnorderedMap<const Viewport*, Vector<std::function<void(const Viewport*, RenderQueue&)>>> mRenderCallbacks;
  31. };
  32. }