diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-20 06:29:31 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-20 07:54:17 +0100 |
| commit | 1c13313ec845d43077bd7e78538358ca4e007f8a (patch) | |
| tree | 95923091df12f95bae5049d88037c9c8ff39f07f /draw/anim.cpp | |
| parent | 38a87664deaedacf0aa8e97d9b0aa46dfb6c8ae6 (diff) | |
sort entities by id rather than draw order
Diffstat (limited to 'draw/anim.cpp')
| -rw-r--r-- | draw/anim.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp index 60e9b54c..afdaa344 100644 --- a/draw/anim.cpp +++ b/draw/anim.cpp @@ -48,12 +48,10 @@ void anim_mesh::add_clickable(tile_shader& shader, const Vector2i& win_size, con void anim_mesh::draw(tile_shader& shader, chunk& c) { constexpr auto quad_index_count = 6; - auto [mesh_] = c.ensure_scenery_mesh(); - const auto& es = c.entities(); + + auto [mesh_, es, size] = c.ensure_scenery_mesh(_draw_array); GL::MeshView mesh{mesh_}; [[maybe_unused]] size_t draw_count = 0; - - const auto size = es.size(); const auto max_index = uint32_t(size*quad_index_count - 1); const auto do_draw = [&](size_t from, size_t to, anim_atlas* atlas) { @@ -75,7 +73,8 @@ void anim_mesh::draw(tile_shader& shader, chunk& c) for (auto k = 0_uz; k < size; k++) { - const auto& e = *es[k]; + fm_assert(es[k].e); + const auto& e = *es[k].e; auto& atlas = *e.atlas; if (last && &atlas != last.atlas) { |
