summary refs log tree commit diff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-06-30 15:15:00 +0200
committerMel <einebeere@gmail.com>2023-06-30 15:15:00 +0200
commit424d00eaf7335e1c6427f40260d55782c3fd902c (patch)
tree62550b085078d84c8a48cbb01f4f7738bfeeb3da /src/main.cpp
parent6d61b17c4289185d59d37caae8070a40e91fba40 (diff)
downloadmeowcraft-424d00eaf7335e1c6427f40260d55782c3fd902c.tar.zst
meowcraft-424d00eaf7335e1c6427f40260d55782c3fd902c.zip
Avoid per-frame chunk copies and don't render block faces between chunks
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp6
1 files changed, 3 insertions, 3 deletions
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++;