diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-12-01 06:57:01 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-12-01 06:57:14 +0100 |
commit | b025c445ec226a279f7ec5d56ac320a0d53bf2cf (patch) | |
tree | eb2395438d0ba544085d448dbf130c434a6a7c27 | |
parent | c472b8d4d2719537ccf7b11f80717ca0cf3c22c2 (diff) |
a
-rw-r--r-- | src/wall-atlas.cpp | 42 | ||||
-rw-r--r-- | src/wall-atlas.hpp | 1 | ||||
-rw-r--r-- | walls/concrete-wall1.json | 50 | ||||
-rw-r--r-- | walls/concrete-wall1.png | bin | 0 -> 71441 bytes |
4 files changed, 50 insertions, 43 deletions
diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp index c8006b1b..d617f341 100644 --- a/src/wall-atlas.cpp +++ b/src/wall-atlas.cpp @@ -12,48 +12,6 @@ namespace floormat { wall_atlas::wall_atlas() noexcept = default; wall_atlas::~wall_atlas() noexcept = default; -#if 0 -void wall_atlas::validate(const wall_atlas& a, const ImageView2D& img) noexcept(false) -{ - // todo - - const auto pixels = img.pixels(); - const auto size = pixels.size(); - const auto width = size[1], height = size[0]; - - fm_soft_assert(width * height > 0); - - for (const auto& frame : a.raw_frame_array()) - { - fm_soft_assert(frame.offset < Vector2ui{(unsigned)width, (unsigned)height}); - fm_soft_assert((int)frame.offset.y() + iTILE_SIZE.z() <= (int)height); - fm_soft_assert((int)frame.offset.x() < iTILE_SIZE2.x()); - // todo check frame offset + size based on wall_atlas::expected_size() - } - - const auto frame_count = a.raw_frame_array().size(); - bool got_group = false; - - for (auto [_str, _group, tag] : Direction::groups) - { - const auto* dir = a.direction((size_t)tag); - if (!dir) - continue; - const auto* g = a.group(dir, tag); - if (!g) - continue; - got_group = true; - fm_soft_assert(g->count > 0 == g->index < (uint32_t)-1); - if (g->count > 0) - { - fm_soft_assert(g->index < frame_count); - fm_soft_assert(g->index + g->count <= frame_count); - } - } - fm_soft_assert(got_group); -} -#endif - Vector2ui wall_atlas::expected_size(unsigned depth, Group_ group) { constexpr auto size = Vector3ui{iTILE_SIZE}; diff --git a/src/wall-atlas.hpp b/src/wall-atlas.hpp index 31f62388..f3b659a4 100644 --- a/src/wall-atlas.hpp +++ b/src/wall-atlas.hpp @@ -149,7 +149,6 @@ public: GL::Texture2D& texture(); static size_t enum_to_index(enum rotation x); - //static void validate(const wall_atlas& a, const ImageView2D& img) noexcept(false); static Vector2ui expected_size(unsigned depth, Group_ group); struct dir_tuple diff --git a/walls/concrete-wall1.json b/walls/concrete-wall1.json new file mode 100644 index 00000000..b65e32fb --- /dev/null +++ b/walls/concrete-wall1.json @@ -0,0 +1,50 @@ +{
+ "depth": 20,
+ "frames": [
+ {
+ "offset": "0 x 0",
+ "size": "64 x 192"
+ },
+ {
+ "offset": "64 x 0",
+ "size": "64 x 192"
+ },
+ {
+ "offset": "128 x 0",
+ "size": "64 x 192"
+ },
+ {
+ "offset": "192 x 0",
+ "size": "20 x 192"
+ },
+ {
+ "offset": "212 x 0",
+ "size": "20 x 192"
+ }
+ ],
+ "n": {
+ "pass-mode": "blocked",
+ "side": {
+ "count": 1,
+ "from-rotation": null,
+ "mirrored": false,
+ "offset": 3,
+ "pixel-size": "20 x 192"
+ },
+ "top": {
+ "count": 1,
+ "from-rotation": null,
+ "mirrored": false,
+ "offset": 4,
+ "pixel-size": "192 x 20"
+ },
+ "wall": {
+ "count": 3,
+ "from-rotation": null,
+ "mirrored": false,
+ "offset": 0,
+ "pixel-size": "64 x 192"
+ }
+ },
+ "name": "concrete-wall1"
+}
diff --git a/walls/concrete-wall1.png b/walls/concrete-wall1.png Binary files differnew file mode 100644 index 00000000..137f3295 --- /dev/null +++ b/walls/concrete-wall1.png |