// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "dawnlibs.hpp" #define RENDER_TARGET_CLEAR_COLOR 1 << 0 #define RENDER_TARGET_CLEAR_DEPTH 1 << 1 namespace Dawn { class RenderTarget { public: /** * 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; /** * Returns the scale (as in pixel density) of the render target. This is * typically 1.0f, but on high DPI displays this may be 2.0f or higher. * * @return The scale of the render target. */ virtual float_t getScale() = 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(const 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(const int32_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; /** * Destroys the render target. */ virtual ~RenderTarget() { } }; }