BsRenderer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsGameObject.h"
  4. #include "BsEvent.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Primarily rendering class that allows you to specify how to render objects that exist
  9. * in the scene graph. You need to provide your own implementation of your class.
  10. *
  11. * @note Normally you would iterate over all cameras, find visible objects for each camera and render
  12. * those objects in some way.
  13. */
  14. class BS_CORE_EXPORT Renderer
  15. {
  16. public:
  17. /**
  18. * @brief Name of the renderer. Used by materials to find
  19. * an appropriate technique for this renderer.
  20. */
  21. virtual const String& getName() const = 0;
  22. /**
  23. * @brief Called in order to render all currently active cameras.
  24. */
  25. virtual void renderAll() = 0;
  26. /**
  27. * @brief Allows you to register a callback for the specified viewport. The callback
  28. * will be called before rendering and you will be able to populate the
  29. * render queue with render commands that will be executed when rendering.
  30. */
  31. void addRenderCallback(const Viewport* viewport, std::function<void(const Viewport*, DrawList&)> callback);
  32. protected:
  33. UnorderedMap<const Viewport*, Vector<std::function<void(const Viewport*, DrawList&)>>> mRenderCallbacks;
  34. };
  35. }