#pragma once #include #include #include #include #include namespace mbgl { namespace gl { class Config; } // namespace gl typedef struct { float width; float height; float y; } LinePatternPos; class LineAtlas { public: LineAtlas(GLsizei width, GLsizei height); ~LineAtlas(); // Binds the atlas texture to the GPU, and uploads data if it is out of date. void bind(gl::ObjectStore&, gl::Config&, uint32_t unit); // 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(gl::ObjectStore&, gl::Config&, uint32_t unit); LinePatternPos getDashPosition(const std::vector&, bool); LinePatternPos addDash(const std::vector& dasharray, bool round); const GLsizei width; const GLsizei height; private: const std::unique_ptr data; bool dirty; mbgl::optional texture; int nextRow = 0; std::map positions; }; } // namespace mbgl