diff options
-rw-r--r-- | editor/draw.cpp | 4 | ||||
-rw-r--r-- | editor/update.cpp | 5 | ||||
-rw-r--r-- | floormat/app.hpp | 2 | ||||
-rw-r--r-- | main/draw.cpp | 11 |
4 files changed, 14 insertions, 8 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp index 2944eae6..6ee32738 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -66,7 +66,9 @@ void app::draw_cursor() void app::draw_collision_boxes() { - const auto [z_min, z_max] = get_z_bounds(); + auto [z_min, z_max, z_cur, only] = get_z_bounds(); + if (only) + z_min = z_max = z_cur; const auto [minx, maxx, miny, maxy] = M->get_draw_bounds(); const auto sz = M->window_size(); auto& world = M->world(); diff --git a/editor/update.cpp b/editor/update.cpp index 9384cc17..d5eb2039 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -237,10 +237,7 @@ void app::set_cursor() auto app::get_z_bounds() -> z_bounds { - if (_render_all_z_levels) - return { chunk_z_min, chunk_z_max }; - else - return { _z_level, _z_level }; + return { chunk_z_min, chunk_z_max, _z_level, !_render_all_z_levels }; } void app::update(float dt) diff --git a/floormat/app.hpp b/floormat/app.hpp index 50dca6f9..91ca9a8b 100644 --- a/floormat/app.hpp +++ b/floormat/app.hpp @@ -18,7 +18,7 @@ struct chunk; struct floormat_app { - struct z_bounds final { int8_t min, max; }; + struct z_bounds final { int8_t min, max, cur; bool only; }; explicit floormat_app() noexcept; virtual ~floormat_app() noexcept; diff --git a/main/draw.cpp b/main/draw.cpp index 0e0f7c68..51031427 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -116,7 +116,7 @@ auto main_impl::get_draw_bounds() const noexcept -> draw_bounds void main_impl::draw_world() noexcept { - const auto [z_min, z_max] = app.get_z_bounds(); + const auto [z_min, z_max, z_cur, only] = app.get_z_bounds(); const auto [minx, maxx, miny, maxy] = get_draw_bounds(); const auto sz = window_size(); @@ -131,6 +131,12 @@ void main_impl::draw_world() noexcept GL::Renderer::setDepthMask(true); for (int8_t z = z_max; z >= z_min; z--) + { + if (only && z != z_cur) + _shader.set_tint({1, 1, 1, 0.75}); + else + _shader.set_tint({1, 1, 1, 1}); + for (int16_t y = maxy; y >= miny; y--) for (int16_t x = maxx; x >= minx; x--) { @@ -142,10 +148,11 @@ void main_impl::draw_world() noexcept const with_shifted_camera_offset o{_shader, ch, {minx, miny}, {maxx, maxy}}; if (check_chunk_visible(_shader.camera_offset(), sz)) { - _wall_mesh.draw(_shader, c); _floor_mesh.draw(_shader, c); + _wall_mesh.draw(_shader, c); } } + } GL::Renderer::setDepthMask(false); |