From ca6ff463979d5c250ab04e940bead875f11e7352 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 29 Nov 2022 19:35:25 +0100 Subject: scenery wip --- draw/anim.cpp | 9 ++++++--- draw/anim.hpp | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'draw') 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 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 { -- cgit v1.2.3