#pragma once #include "src/pass-mode.hpp" #include "src/quads.hpp" #include "src/ground-def.hpp" #include "loader/ground-cell.hpp" #include #include #include #include #include #include #include namespace floormat { class ground_atlas; class ground_atlas final { using quad = Quads::quad; using texcoords = std::array; static std::unique_ptr make_texcoords_array(Vector2ui pixel_size, Vector2ub tile_count); static texcoords make_texcoords(Vector2ui pixel_size, Vector2ub tile_count, size_t i); static String make_path(StringView name); ground_def _def; String _path; std::unique_ptr _texcoords; GL::Texture2D _tex; Vector2ui _pixel_size; public: ground_atlas(ground_def info, const ImageView2D& img); texcoords texcoords_for_id(size_t id) const; [[maybe_unused]] Vector2ui pixel_size() const { return _pixel_size; } size_t num_tiles() const; Vector2ub num_tiles2() const { return _def.size; } GL::Texture2D& texture() { return _tex; } StringView name() const { return _def.name; } enum pass_mode pass_mode() const; }; } // namespace floormat