diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-29 19:35:25 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-29 19:35:25 +0100 |
commit | ca6ff463979d5c250ab04e940bead875f11e7352 (patch) | |
tree | 479b06c90e1af3652c30e5554c3cada57ac81975 /draw | |
parent | cd1e7b6564e8508f84e84706557b89eb5471a978 (diff) |
scenery wip
Diffstat (limited to 'draw')
-rw-r--r-- | draw/anim.cpp | 9 | ||||
-rw-r--r-- | draw/anim.hpp | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp index 82f0d746..951c7f5a 100644 --- a/draw/anim.cpp +++ b/draw/anim.cpp @@ -22,13 +22,11 @@ std::array<UnsignedShort, 6> anim_mesh::make_index_array() }}; } -void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy) +void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, const Vector3& center, float depth) { - const auto center = Vector3(xy.x, xy.y, 0.f) * TILE_SIZE; const auto pos = atlas.frame_quad(center, r, frame); const auto& g = atlas.group(r); const auto texcoords = atlas.texcoords_for_frame(r, frame, !g.mirror_from.isEmpty()); - const float depth = tile_shader::depth_value(xy, .25f); quad_data array; for (std::size_t i = 0; i < 4; i++) array[i] = { pos[i], texcoords[i], depth }; @@ -37,4 +35,9 @@ void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::si shader.draw(_mesh); } +void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy) +{ + draw(shader, atlas, r, frame, Vector3(xy.x, xy.y, 0.f) * TILE_SIZE, tile_shader::depth_value(xy, .25f)); +} + } // namespace floormat diff --git a/draw/anim.hpp b/draw/anim.hpp index 2b88e7af..e11d45ae 100644 --- a/draw/anim.hpp +++ b/draw/anim.hpp @@ -23,6 +23,7 @@ struct anim_mesh final { anim_mesh(); void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy); + void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, const Vector3& pos, float depth); private: struct vertex_data final { |