From 424d00eaf7335e1c6427f40260d55782c3fd902c Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 30 Jun 2023 15:15:00 +0200 Subject: Avoid per-frame chunk copies and don't render block faces between chunks --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index b0939c1..a264f3e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,10 +102,10 @@ void run() { glClearColor(sky_color.x(), sky_color.y(), sky_color.z(), 1.0f); // #DBDBDB glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - for (auto& chunk : world.get_visible_chunks(camera.position())) { - auto model = Math::MVP::model(chunk.chunk.value().position(), {}); + for (auto chunk : world.get_visible_chunks(camera.position())) { + auto model = Math::MVP::model(chunk->chunk.value().position(), {}); model_uniform.set(model); - render(chunk.mesh.value(), texture); + render(chunk->mesh.value(), texture); } time++; -- cgit 1.4.1