BsRenderer.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 Contains a basic sent of renderable types that may be supported by a renderer.
  10. * These can be used as a guide and renderer plugins can use their own types as needed.
  11. */
  12. enum RenderableType
  13. {
  14. RenType_UnlitUntextured,
  15. RenType_UnlitTextured
  16. // TODO - Add more types as I improve the Renderer with advanced techniques
  17. };
  18. /**
  19. * @brief Primarily rendering class that allows you to specify how to render objects that exist
  20. * in the scene graph. You need to provide your own implementation of your class.
  21. *
  22. * @note Normally you would iterate over all cameras, find visible objects for each camera and render
  23. * those objects in some way.
  24. */
  25. class BS_CORE_EXPORT Renderer
  26. {
  27. public:
  28. /**
  29. * @brief Name of the renderer. Used by materials to find
  30. * an appropriate technique for this renderer.
  31. */
  32. virtual const String& getName() const = 0;
  33. /**
  34. * @brief Called in order to render all currently active cameras.
  35. */
  36. virtual void renderAll() = 0;
  37. /**
  38. * @brief Allows you to register a callback for the specified viewport. The callback
  39. * will be called before rendering and you will be able to populate the
  40. * render queue with render commands that will be executed when rendering.
  41. */
  42. void addRenderCallback(const Viewport* viewport, std::function<void(const Viewport*, DrawList&)> callback);
  43. protected:
  44. UnorderedMap<const Viewport*, Vector<std::function<void(const Viewport*, DrawList&)>>> mRenderCallbacks;
  45. UnorderedSet<RendererMaterialParams> mRenderableMaterialParams;
  46. };
  47. }