#pragma once #include #include #include namespace mbgl { namespace gfx { class UniformBuffer; using UniformBufferPtr = std::shared_ptr; } // namespace gfx namespace style { class LayerProperties; enum class TranslateAnchorType : bool; } // namespace style class TransformState; class LayerGroupBase; class PaintParameters; class RenderTree; class UnwrappedTileID; using mat4 = std::array; /** Base class for layer tweakers, which manipulate layer group per frame */ class LayerTweaker { protected: LayerTweaker(Immutable properties); public: LayerTweaker() = delete; virtual ~LayerTweaker() = default; virtual void execute(LayerGroupBase&, const RenderTree&, const PaintParameters&) = 0; protected: /// Calculate matrices for this tile. /// @param nearClipped If true, the near plane is moved further to enhance depth buffer precision. /// @param inViewportPixelUnits If false, the translation is scaled based on the current zoom. static mat4 getTileMatrix(const UnwrappedTileID&, const RenderTree&, const TransformState&, const std::array& translation, style::TranslateAnchorType, bool nearClipped, bool inViewportPixelUnits, bool aligned = false); protected: Immutable evaluatedProperties; }; } // namespace mbgl