diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-08 03:12:42 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-08 03:12:54 +0100 |
commit | 2afb0e9f9021424a672265a5c574905a99c28878 (patch) | |
tree | d0d88dd4b0881e7308f0b307db504af24f95aa41 /src/anim-atlas.cpp | |
parent | 2e753568b4024e6c84b9c49db6cfdcae20277b28 (diff) |
make {,un}project() accept single-precision too
Diffstat (limited to 'src/anim-atlas.cpp')
-rw-r--r-- | src/anim-atlas.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index 8326ac5e..2005526b 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -85,12 +85,12 @@ auto anim_atlas::frame_quad(const Vector3& center, rotation r, std::size_t i) co { const auto f = frame(r, i); const auto size = Vector2d(f.size); - const double gx = f.ground[0]*.5, gy = f.ground[1]*.5; - const double sx = size[0]*.5, sy = size[1]*.5; - const auto bottom_right = Vector2(tile_shader::unproject({ sx - gx, sy - gy })), - top_right = Vector2(tile_shader::unproject({ sx - gx, - gy })), - bottom_left = Vector2(tile_shader::unproject({ - gx, sy - gy })), - top_left = Vector2(tile_shader::unproject({ - gx, - gy })); + const auto gx = (float)f.ground[0]*.5f, gy = (float)f.ground[1]*.5f; + const auto sx = (float)size[0]*.5f, sy = (float)size[1]*.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[0], cy = center[1], cz = center[2]; return {{ { cx + bottom_right[0], cy + bottom_right[1], cz }, |