diff options
| author | Mel <einebeere@gmail.com> | 2023-06-12 17:09:55 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-06-12 17:14:03 +0200 |
| commit | d0de60dc33df75fbcacb53a09568b14d0fd48cb9 (patch) | |
| tree | 7aefdbb81f114552881834bd5b0d842bc2bdb691 /src/main.cpp | |
| parent | 23b0bc4d1ddc9fad3c32e8257497ddd13ac6a155 (diff) | |
| download | meowcraft-d0de60dc33df75fbcacb53a09568b14d0fd48cb9.tar.zst meowcraft-d0de60dc33df75fbcacb53a09568b14d0fd48cb9.zip | |
Multithreaded world generation with Perlin
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 10 |
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}); } |
