diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-09 20:40:31 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-09 20:40:31 +0100 |
commit | 0ec88d181a5a5c3c3e791426b7fa01d44195ec8c (patch) | |
tree | 0c72a6fed79d5a4bb2e9d610cf03079cc342fae2 /main/draw.cpp | |
parent | 9482f370e56397d50e5d7efef81a33af7390d07a (diff) |
add forgotten animation drawing
Diffstat (limited to 'main/draw.cpp')
-rw-r--r-- | main/draw.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 2b17ce9b..86d93582 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -86,12 +86,12 @@ void main_impl::draw_world() noexcept for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) { - if (const chunk_coords c = {x, y}; !_world.contains(c)) - app.maybe_initialize_chunk(c, _world[c]); - const chunk_coords c{x, y}; - const with_shifted_camera_offset o{_shader, c}; + const chunk_coords pos{x, y}; + if (!_world.contains(pos)) + app.maybe_initialize_chunk(pos, _world[pos]); + const with_shifted_camera_offset o{_shader, pos}; if (check_chunk_visible(_shader.camera_offset(), sz)) - _floor_mesh.draw(_shader, _world[c]); + _floor_mesh.draw(_shader, _world[pos]); } GL::Renderer::enable(GL::Renderer::Feature::DepthTest); @@ -104,10 +104,14 @@ void main_impl::draw_world() noexcept for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) { - const chunk_coords c{x, y}; - const with_shifted_camera_offset o{_shader, c}; + const chunk_coords pos{x, y}; + auto& c = _world[pos]; + const with_shifted_camera_offset o{_shader, pos}; if (check_chunk_visible(_shader.camera_offset(), sz)) - _wall_mesh.draw(_shader, _world[c]); + { + _wall_mesh.draw(_shader, c); + _anim_mesh.draw(_shader, c); + } } GL::Renderer::disable(GL::Renderer::Feature::DepthTest); } |