summaryrefslogtreecommitdiffhomepage
path: root/main/draw.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-17 22:34:08 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-17 22:34:08 +0200
commit2ce80cb4a85cc47dc10f0b70839b2d0f2381cca8 (patch)
tree25f81746e4302651e3a7561a8e6b7aa851219635 /main/draw.cpp
parentdefb979b7a1e56214ec4cd20151c210bd1bbcec8 (diff)
a
Diffstat (limited to 'main/draw.cpp')
-rw-r--r--main/draw.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/main/draw.cpp b/main/draw.cpp
index 85a4dcdd..b7dd420a 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -69,18 +69,30 @@ std::array<std::int16_t, 4> app::get_draw_bounds() const noexcept
void app::draw_world()
{
+#if 0
_floor_mesh.draw(_shader, *_world[chunk_coords{0, 0}]);
_wall_mesh.draw(_shader, *_world[chunk_coords{0, 0}]);
-#if 0
+#else
auto [minx, maxx, miny, maxy] = get_draw_bounds();
+ printf("%hd %hd -> %hd %hd\n", minx, miny, maxx, maxy);
+ fflush(stdout);
+
for (std::int16_t y = miny; y <= maxy; y++)
for (std::int16_t x = minx; x <= maxx; x++)
+ {
+ if (!_world.contains(chunk_coords{x, y}))
+ make_test_chunk(*_world[chunk_coords{x, y}]);
+ const with_shifted_camera_offset o{_shader, x, y};
_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++)
+ {
+ const with_shifted_camera_offset o{_shader, x, y};
_wall_mesh.draw(_shader, *_world[chunk_coords{x, y}]);
+ }
#endif
}