diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-12 11:55:26 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-12 11:55:26 +0100 |
commit | 3e3066111dd80ea7944f7897025952881b704352 (patch) | |
tree | 58915341e0427fc0267cb4a2e712f4d5233b4de5 /src | |
parent | 6e8473c60655a40a09ac0d2091deaf447ba54df4 (diff) |
add z component to anim_group world offset
Diffstat (limited to 'src')
-rw-r--r-- | src/anim-atlas.cpp | 13 | ||||
-rw-r--r-- | src/anim.cpp | 0 | ||||
-rw-r--r-- | src/anim.hpp | 3 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index c874150e..cbcaac78 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -82,21 +82,20 @@ auto anim_atlas::texcoords_for_frame(rotation r, std::size_t i) const noexcept - auto anim_atlas::frame_quad(const Vector3& center, rotation r, std::size_t i) const noexcept -> quad { enum : std::size_t { x, y, z }; - const auto g = group(r); const auto f = frame(r, i); - const auto size = Vector2d(f.size); const auto gx = (float)f.ground[x]*.5f, gy = (float)f.ground[y]*.5f; + const auto size = Vector2d(f.size); const auto sx = (float)size[x]*.5f, sy = (float)size[y]*.5f; const auto bottom_right = tile_shader::unproject({ sx - gx, sy - gy }), top_right = tile_shader::unproject({ sx - gx, - gy }), bottom_left = tile_shader::unproject({ - gx, sy - gy }), top_left = tile_shader::unproject({ - gx, - gy }); - const auto cx = center[x] + g.offset[x], cy = center[y] + g.offset[y], cz = center[z]; + const auto c = center + Vector3(group(r).offset); return {{ - { cx + bottom_right[x], cy + bottom_right[y], cz }, - { cx + top_right[x], cy + top_right[y], cz }, - { cx + bottom_left[x], cy + bottom_left[y], cz }, - { cx + top_left[x], cy + top_left[y], cz }, + { c[x] + bottom_right[x], c[y] + bottom_right[y], c[z] }, + { c[x] + top_right[x], c[y] + top_right[y], c[z] }, + { c[x] + bottom_left[x], c[y] + bottom_left[y], c[z] }, + { c[x] + top_left[x], c[y] + top_left[y], c[z] }, }}; } diff --git a/src/anim.cpp b/src/anim.cpp deleted file mode 100644 index e69de29b..00000000 --- a/src/anim.cpp +++ /dev/null diff --git a/src/anim.hpp b/src/anim.hpp index 771df5d7..447c0410 100644 --- a/src/anim.hpp +++ b/src/anim.hpp @@ -5,6 +5,7 @@ #include <Corrade/Containers/String.h> #include <Magnum/Magnum.h> #include <Magnum/Math/Vector2.h> +#include <Magnum/Math/Vector3.h> namespace floormat { @@ -25,7 +26,7 @@ struct anim_group final String name; std::vector<anim_frame> frames; Vector2ui ground; - Vector2b offset; + Vector3b offset; }; struct anim_def final |