summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wall-atlas.cpp4
-rw-r--r--src/wall-atlas.hpp16
2 files changed, 16 insertions, 4 deletions
diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp
index 3c2ac3cf..9c700548 100644
--- a/src/wall-atlas.cpp
+++ b/src/wall-atlas.cpp
@@ -74,7 +74,7 @@ wall_atlas::wall_atlas(wall_atlas_def def, String path, const ImageView2D& img)
: _dir_array{std::move(def.direction_array)},
_frame_array{std::move(def.frames)},
_info{std::move(def.header)}, _path{std::move(path)},
- _direction_to_Direction_array_index{def.direction_to_Direction_array_index}
+ _direction_map{def.direction_map }
{
_texture.setLabel(_path)
.setWrapping(GL::SamplerWrapping::ClampToEdge)
@@ -93,7 +93,7 @@ auto wall_atlas::get_Direction(Direction_ num) const -> Direction*
if (_dir_array.isEmpty()) [[unlikely]]
return {};
- else if (auto DAI = _direction_to_Direction_array_index[(uint8_t)num]; DAI != default_DAI) [[likely]]
+ else if (auto DAI = _direction_map[(uint8_t)num]; DAI != default_DAI) [[likely]]
return const_cast<Direction*>(&_dir_array[DAI.val]);
else
return {};
diff --git a/src/wall-atlas.hpp b/src/wall-atlas.hpp
index e3470a56..2e6572e6 100644
--- a/src/wall-atlas.hpp
+++ b/src/wall-atlas.hpp
@@ -86,15 +86,27 @@ namespace floormat {
struct wall_atlas_def final
{
+ using Frame = Wall::Frame;
+ using Group = Wall::Group;
+ using Direction_ = Wall::Direction_;
+ using Direction = Wall::Direction;
+ using Info = Wall::Info;
+ using Tag = Wall::Tag;
+ using DirArrayIndex = Wall::DirArrayIndex;
+
bool operator==(const wall_atlas_def&) const noexcept;
Wall::Info header;
Array<Wall::Frame> frames;
Array<Wall::Direction> direction_array;
- std::array<Wall::DirArrayIndex, 4> direction_to_Direction_array_index;
+ std::array<Wall::DirArrayIndex, 4> direction_map;
static wall_atlas_def deserialize(StringView filename);
void serialize(StringView filename) const;
+ static void serialize(StringView filename,
+ const Info& header, ArrayView<const Frame> frames,
+ ArrayView<const Direction> direction_array,
+ std::array<DirArrayIndex, 4> direction_map);
};
class wall_atlas final
@@ -112,7 +124,7 @@ class wall_atlas final
Info _info;
String _path;
GL::Texture2D _texture{NoCreate};
- std::array<DirArrayIndex, 4> _direction_to_Direction_array_index;
+ std::array<DirArrayIndex, 4> _direction_map;
Direction* get_Direction(Direction_ num) const;