#pragma once #include #include #include #include #include #include namespace mbgl { namespace gfx { class UploadPass; } // namespace gfx class LinePatternPos { public: float width; float height; float y; }; enum class LinePatternCap : bool { Square = false, Round = true, }; class LineAtlas { public: LineAtlas(Size); ~LineAtlas(); // Binds the atlas texture to the GPU, and uploads data if it is out of date. gfx::TextureBinding textureBinding(); // Uploads the texture to the GPU to be available when we need it. This is a lazy operation; // the texture is only bound when the data is out of date (=dirty). void upload(gfx::UploadPass&); LinePatternPos getDashPosition(const std::vector&, LinePatternCap); LinePatternPos addDash(const std::vector& dasharray, LinePatternCap); Size getSize() const; private: const AlphaImage image; bool dirty; optional texture; uint32_t nextRow = 0; std::unordered_map positions; }; } // namespace mbgl