BsRenderer.h 1.3 KB

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