From 7b20942c765334687fd5f58df4c0190601b97b58 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 22 Oct 2022 00:16:14 +0200 Subject: Fix chunk index hash to show infinite world --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 960112e..e600802 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -55,7 +55,7 @@ void run() { MC::World::World world; MC::GFX::Camera camera{}; - camera.set_position({0.0f, 0.0f, 3.0f}); + camera.set_position({0.0f, 22.0f, 0.0f}); MC::GFX::Shading::Program program( MC::GFX::Shading::Shader::create_fragment(), @@ -92,19 +92,19 @@ void run() { auto view = Math::MVP::view(camera.position(), camera.angles()); view_uniform.set(view); + 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(), {}); model_uniform.set(model); render(chunk.mesh.value(), texture); } + time++; } } void render(MC::GFX::BindableMesh& mesh, MC::GFX::Texture& texture) { - glClearColor(0.85f, 0.85f, 0.85f, 1.0f); // #DBDBDB - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - texture.bind(); mesh.bind(); glDrawElements(GL_TRIANGLES, mesh.size(), GL_UNSIGNED_INT, nullptr); @@ -125,7 +125,7 @@ void process_input(MC::GFX::Window& window, MC::GFX::Camera& camera) { float y = key(GLFW_KEY_SPACE) - key(GLFW_KEY_LEFT_SHIFT); float z = key(GLFW_KEY_S) - key(GLFW_KEY_W); - auto move_speed = 0.5f; + auto move_speed = 0.2f; auto rotation_speed = 0.1f; camera.move_relative({x * move_speed, y * move_speed, z * move_speed}); -- cgit 1.4.1