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/anim-atlas.cpp | |
parent | 6e8473c60655a40a09ac0d2091deaf447ba54df4 (diff) |
add z component to anim_group world offset
Diffstat (limited to 'src/anim-atlas.cpp')
-rw-r--r-- | src/anim-atlas.cpp | 13 |
1 files changed, 6 insertions, 7 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] }, }}; } |