// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "RenderTarget.hpp" #include "display/shader/Shader.hpp" #include "display/shader/UIShader.hpp" #include "util/flag.hpp" #define RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST FLAG_DEFINE(0) #define RENDER_MANAGER_RENDER_FLAG_BLEND FLAG_DEFINE(1) typedef flag_t renderflag_t; namespace Dawn { class DawnGame; class RenderPipeline; class IRenderManager { protected: renderflag_t renderFlags = 0; public: DawnGame *game; RenderPipeline *renderPipeline; /** * Default constructor for a render manager instance. * * @param game Game that this render manager belongs to. */ IRenderManager(DawnGame *game) { assertNotNull(game); this->game = game; } /** * Returns the primary render target (the backbuffer) that draws directly * to the screen. * * @return Shared pointer to the backbuffer render target. */ virtual RenderTarget * getBackBuffer() = 0; /** * Returns the current render pipeline intended to be used for rendering * the currently active scene on the game instance. * * @return Reference to the currently active main scene render pipeline. */ virtual RenderPipeline * getRenderPipeline() = 0; /** * Returns the default shader, the default shader will be applied to the * materials first. * * @return Reference to the default shader. */ virtual Shader * getDefaultShader() = 0; /** * Returns the UI Shader used by the game's UI engine. * * @return Pointer to the UI Shader. */ virtual UIShader * getUIShader() = 0; /** * Sets the render flags for the render manager to use. * * @param renderFlags Render flags to use. */ virtual void setRenderFlags(renderflag_t renderFlags) = 0; /** * Initialize / Start the Render Manager. * * @param game Game instance this render manager belongs to. */ virtual void init() = 0; /** * Perform a synchronous frame update on the render manager. */ virtual void update() = 0; }; }