// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "util/flag.hpp" #include "display/Color.hpp" #include "event/Event.hpp" #define RENDER_TARGET_CLEAR_FLAG_COLOR FLAG_DEFINE(0) #define RENDER_TARGET_CLEAR_FLAG_DEPTH FLAG_DEFINE(1) namespace Dawn { class RenderTarget { public: Event eventRenderTargetResized; /** * Return the width of the render target. * * @return The width of the render target. */ virtual float_t getWidth() = 0; /** * Return the height of the render target. * * @return The height of the render target. */ virtual float_t getHeight() = 0; /** * Sets the clear color of the render target when the clear method for * the color buffer is requested. * * @param color Color to use for the clear operation. */ virtual void setClearColor(struct Color color) = 0; /** * Request the existing data in the render target to be cleared out. We * typically assume the render target can support multiple buffer types, * so you can opt to only clear certain buffer types. * * @param clearFlags Flags to request what is going to be cleared. */ virtual void clear(flag8_t clearFlags) = 0; /** * Bind the render target for rendering to. The proceeding render requests * will want to render to this render target directly. In future I may * see if we can have multiple render targets bound at once to make this * operation perform faster. */ virtual void bind() = 0; }; }