#ifndef LLMR_RENDERER_PAINTER #define LLMR_RENDERER_PAINTER #include "shader-fill.hpp" #include "shader-plain.hpp" #include "shader-outline.hpp" #include "shader-line.hpp" #include "../map/tile.hpp" namespace llmr { class Settings; class Transform; class Style; class LayerDescription; class FillBucket; class LineBucket; class Painter { public: Painter(Transform& transform, Settings& settings, Style& style); // Make noncopyable Painter(const Painter&) = delete; Painter(const Painter&&) = delete; Painter &operator=(const Painter&) = delete; Painter &operator=(const Painter&&) = delete; void setup(); void teardown(); void clear(); void render(const std::shared_ptr& tile); void renderLayers(const std::shared_ptr& tile, const std::vector& layers); void renderDebug(const std::shared_ptr& tile); void renderMatte(); void renderBackground(); void renderFill(FillBucket& bucket, const std::string& layer_name); void renderLine(LineBucket& bucket, const std::string& layer_name); void drawClippingMask(); bool switchShader(std::shared_ptr shader); private: void setupShaders(); void changeMatrix(const std::shared_ptr& tile); public: private: Transform& transform; Settings& settings; Style& style; float nativeMatrix[16]; float matrix[16]; float exMatrix[16]; std::shared_ptr currentShader; std::shared_ptr fillShader; std::shared_ptr plainShader; std::shared_ptr outlineShader; std::shared_ptr lineShader; uint32_t tile_stencil_buffer; uint32_t tile_border_buffer; uint32_t matte_buffer; }; } #endif