diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-05-26 11:51:38 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-05-26 11:51:38 +0200 |
commit | 7d421d0069dbc8bcf948a29d39c3f8e65de19b33 (patch) | |
tree | 35c04379407563c8d9fbb03f0116e9d1732028ba /draw | |
parent | a768733aec06a395ad409e5ed8c49dee69414d64 (diff) |
draw, editor, main: add toggling vobj display
Diffstat (limited to 'draw')
-rw-r--r-- | draw/anim.cpp | 7 | ||||
-rw-r--r-- | draw/anim.hpp | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp index 87003f82..03f6df76 100644 --- a/draw/anim.cpp +++ b/draw/anim.cpp @@ -55,7 +55,7 @@ void anim_mesh::add_clickable(tile_shader& shader, const Vector2i& win_size, } } -void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, std::vector<clickable>& list) +void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, std::vector<clickable>& list, bool draw_vobjs) { constexpr auto quad_index_count = 6; @@ -78,6 +78,7 @@ void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, st fm_assert(x.e); add_clickable(shader, win_size, x.data.in, x.data, list); auto& e = *x.e; + auto& atlas = *e.atlas; fm_assert(e.is_dynamic() == (x.mesh_idx == (uint32_t)-1)); if (!e.is_dynamic()) @@ -88,6 +89,10 @@ void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, st } else { + if (!draw_vobjs) [[likely]] + if (e.is_virtual()) [[unlikely]] + continue; + const auto depth0 = e.depth_offset(); const auto depth = tile_shader::depth_value(e.coord.local(), depth0); draw(shader, atlas, e.r, e.frame, e.coord.local(), e.offset, depth); diff --git a/draw/anim.hpp b/draw/anim.hpp index a7129fe1..ebee14be 100644 --- a/draw/anim.hpp +++ b/draw/anim.hpp @@ -26,7 +26,7 @@ struct anim_mesh final { anim_mesh(); - void draw(tile_shader& shader, const Vector2i& win_size, chunk& c, std::vector<clickable>& list); + void draw(tile_shader& shader, const Vector2i& win_size, chunk& c, std::vector<clickable>& list, bool draw_vobjs); void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, const Vector3& pos, float depth); void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float dpeth); static void add_clickable(tile_shader& shader, const Vector2i& win_size, |