diff options
Diffstat (limited to 'main/draw.cpp')
-rw-r--r-- | main/draw.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index a7ee2ec3..e2bcdd31 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -1,22 +1,18 @@ #include "app.hpp" #include "tile-defs.hpp" #include "camera-offset.hpp" -#include <Magnum/Math/Vector3.h> #include <Magnum/GL/DefaultFramebuffer.h> #include <Magnum/GL/Renderer.h> -#include <Magnum/Trade/AbstractImporter.h> namespace floormat { void app::drawEvent() { - GL::defaultFramebuffer.clear(GL::FramebufferClear::Color); - GL::Renderer::setDepthFunction(GL::Renderer::DepthFunction::Never); - { const float dt = std::min(1.f/10, timeline.previousFrameDuration()); update(dt); } + GL::defaultFramebuffer.clear(GL::FramebufferClear::Color); _shader.set_tint({1, 1, 1, 1}); { const with_shifted_camera_offset o{_shader, BASE_X, BASE_Y}; @@ -35,7 +31,7 @@ std::array<std::int16_t, 4> app::get_draw_bounds() const noexcept { std::int16_t minx = BASE_X, maxx = BASE_X, miny = BASE_Y, maxy = BASE_Y; { - const auto fn = [&](std::int32_t x, std::int32_t y) { + auto fn = [&](std::int32_t x, std::int32_t y) { const auto pos = pixel_to_tile({float(x + BASE_X), float(y + BASE_Y)}).chunk(); minx = std::min(minx, pos.x); maxx = std::max(maxx, pos.x); @@ -49,7 +45,6 @@ std::array<std::int16_t, 4> app::get_draw_bounds() const noexcept fn(0, y); fn(x, y); } - fflush(stdout); return {minx, maxx, miny, maxy}; } @@ -57,21 +52,13 @@ void app::draw_world() { auto [minx, maxx, miny, maxy] = get_draw_bounds(); - _shader.set_tint({1, 1, 1, 1}); - for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) - { - auto c = _world[chunk_coords{x, y}]; - _floor_mesh.draw(_shader, *c); - } + _floor_mesh.draw(_shader, *_world[chunk_coords{x, y}]); for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) - { - auto c = _world[chunk_coords{x, y}]; - _wall_mesh.draw(_shader, *c); - } + _wall_mesh.draw(_shader, *_world[chunk_coords{x, y}]); } void app::draw_wireframe_quad(global_coords pos) |