Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Tim Sylvester <tim@wetdogweather.com> Co-authored-by: mwilsnd <mwilsnd@gmail.com> Co-authored-by: Stefan Karschti <stefan.karschti@gmail.com> Co-authored-by: Bart Louwers <bart@emeel.net> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: mwilsnd <53413200+mwilsnd@users.noreply.github.com> Co-authored-by: Alex Cristici <alex@skoon.energy> Co-authored-by: Bart Louwers <bart.louwers@gmail.com> Co-authored-by: Wei Chen <alanchenboy@gmail.com> Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com> Co-authored-by: tdcosta100 <tdcosta100@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
73 lines
2.0 KiB
C++
73 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <mbgl/gfx/types.hpp>
|
|
#include <mbgl/util/size.hpp>
|
|
|
|
#include <functional>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace mbgl {
|
|
|
|
namespace gfx {
|
|
class Context;
|
|
class Texture2D;
|
|
class OffscreenTexture;
|
|
class UploadPass;
|
|
using Texture2DPtr = std::shared_ptr<Texture2D>;
|
|
} // namespace gfx
|
|
|
|
class LayerGroupBase;
|
|
class PaintParameters;
|
|
class RenderOrchestrator;
|
|
class RenderTree;
|
|
|
|
using LayerGroupBasePtr = std::shared_ptr<LayerGroupBase>;
|
|
|
|
/// Render target class
|
|
class RenderTarget {
|
|
public:
|
|
RenderTarget(gfx::Context& context, const Size size, const gfx::TextureChannelDataType type);
|
|
~RenderTarget();
|
|
|
|
/// Get the render target texture
|
|
const gfx::Texture2DPtr& getTexture();
|
|
|
|
/// @brief Add a layer group to the render target
|
|
/// @param replace Flag to replace if exists
|
|
/// @return whether added
|
|
bool addLayerGroup(LayerGroupBasePtr, bool replace);
|
|
|
|
/// @brief Remove a layer group
|
|
/// @param layerIndex index of the layer to remove
|
|
/// @return whether removed
|
|
bool removeLayerGroup(const int32_t layerIndex);
|
|
|
|
/// Get the layer group count
|
|
size_t numLayerGroups() const noexcept;
|
|
|
|
/// @brief Get a specific layer group by index
|
|
/// @param layerIndex index
|
|
/// @return the layer group if existant, othewise a shared null pointer
|
|
const LayerGroupBasePtr& getLayerGroup(const int32_t layerIndex) const;
|
|
|
|
/// Execute the given function for each contained layer group
|
|
void visitLayerGroups(std::function<void(LayerGroupBase&)>);
|
|
void visitLayerGroups(std::function<void(const LayerGroupBase&)>) const;
|
|
|
|
/// Upload the layer groups
|
|
void upload(gfx::UploadPass& uploadPass);
|
|
|
|
/// Render the layer groups
|
|
void render(RenderOrchestrator&, const RenderTree&, PaintParameters&);
|
|
|
|
protected:
|
|
gfx::Context& context;
|
|
std::unique_ptr<gfx::OffscreenTexture> offscreenTexture;
|
|
using LayerGroupMap = std::map<int32_t, LayerGroupBasePtr>;
|
|
LayerGroupMap layerGroupsByLayerIndex;
|
|
};
|
|
|
|
} // namespace mbgl
|