diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ground-atlas.cpp | 8 | ||||
-rw-r--r-- | src/ground-atlas.hpp | 14 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/ground-atlas.cpp b/src/ground-atlas.cpp index a64264ff..f918f940 100644 --- a/src/ground-atlas.cpp +++ b/src/ground-atlas.cpp @@ -12,14 +12,14 @@ namespace floormat { using namespace floormat::Quads; -ground_atlas::ground_atlas(StringView path, StringView name, const ImageView2D& image, Vector2ub tile_count, enum pass_mode p) : - texcoords_{make_texcoords_array(Vector2ui(image.size()), tile_count)}, - path_{path}, name_{name}, size_{image.size()}, dims_{tile_count}, passability{p} +ground_atlas::ground_atlas(ground_def info, String path, const ImageView2D& image) : + texcoords_{make_texcoords_array(Vector2ui(image.size()), info.size)}, + path_{std::move(path)}, name_{std::move(info.name)}, size_{image.size()}, dims_{info.size}, passability{info.pass} { constexpr auto variant_max = std::numeric_limits<variant_t>::max(); fm_soft_assert(num_tiles() <= variant_max); fm_soft_assert(dims_[0] > 0 && dims_[1] > 0); - fm_soft_assert(size_ % Vector2ui{tile_count} == Vector2ui()); + fm_soft_assert(size_ % Vector2ui{info.size} == Vector2ui()); tex_.setLabel(path_) .setWrapping(GL::SamplerWrapping::ClampToEdge) .setMagnificationFilter(GL::SamplerFilter::Nearest) diff --git a/src/ground-atlas.hpp b/src/ground-atlas.hpp index 94da682f..83b4705c 100644 --- a/src/ground-atlas.hpp +++ b/src/ground-atlas.hpp @@ -1,6 +1,7 @@ #pragma once #include "src/pass-mode.hpp" #include "src/quads.hpp" +#include "loader/ground-info.hpp" #include <array> #include <memory> #include <Corrade/Containers/Optional.h> @@ -11,6 +12,15 @@ namespace floormat { +struct ground_def +{ + String name; + Vector2ub size; + pass_mode pass; +}; + +class ground_atlas; + class ground_atlas final { using quad = Quads::quad; @@ -27,7 +37,7 @@ class ground_atlas final enum pass_mode passability; public: - ground_atlas(StringView path, StringView name, const ImageView2D& img, Vector2ub tile_count, enum pass_mode pass_mode); + ground_atlas(ground_def info, String path, const ImageView2D& img); texcoords texcoords_for_id(size_t id) const; [[maybe_unused]] Vector2ui pixel_size() const { return size_; } size_t num_tiles() const; @@ -39,6 +49,4 @@ public: static constexpr enum pass_mode default_pass_mode = pass_mode::pass; }; - - } // namespace floormat |