summary refs log tree commit diff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index dcac677..b407a78 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -10,7 +10,6 @@
 #include "GFX/Texture.hpp"
 #include "GFX/Image/PPMParser.hpp"
 #include "World/World.hpp"
-#include "Util/ImageViewer.hpp"
 
 #define APP_NAME "Meowcraft"
 
@@ -66,7 +65,6 @@ void run() {
     auto model_uniform = program.uniform("model_matrix");
     auto view_uniform = program.uniform("view_matrix");
     auto projection_uniform = program.uniform("projection_matrix");
-
     auto sun_direction_uniform = program.uniform("sun_direction");
 
     program.bind();
@@ -101,7 +99,7 @@ void run() {
         glClearColor(0.85f, 0.85f, 0.85f, 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->position(), {});
+            auto model = Math::MVP::model(chunk.chunk.value().position(), {});
             model_uniform.set(model);
             render(chunk.mesh.value(), texture);
         }
@@ -130,11 +128,13 @@ void process_input(MC::GFX::Window& window, MC::GFX::Camera& camera) {
     float x = key(GLFW_KEY_D) - key(GLFW_KEY_A);
     float y = key(GLFW_KEY_SPACE) - key(GLFW_KEY_LEFT_SHIFT);
     float z = key(GLFW_KEY_S) - key(GLFW_KEY_W);
+    float boost = key(GLFW_KEY_LEFT_CONTROL) * 2.0f;
 
-    auto move_speed = 0.2f;
+    auto move_speed = 0.2f + boost;
     auto rotation_speed = 0.1f;
 
-    camera.move_relative({x * move_speed, y * move_speed, z * move_speed});
+    camera.move_relative({x * move_speed, 0.0f, z * move_speed});
+    camera.move({0.0f, y * move_speed, 0.0f});
     camera.rotate({r.y() * rotation_speed, r.x() * rotation_speed, 0.0f});
 }