diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/main.cpp b/src/main.cpp index 58c7b8a..d69dccd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,6 +13,7 @@ #include "Mouse.hpp" #include "Texture.hpp" #include "Image/PPMParser.hpp" +#include "World/Generator.hpp" #define APP_NAME "Meowcraft" @@ -56,37 +57,11 @@ void run() { auto image = MC::Image::PPMParser(MC::Assets::Images::atlas).parse(); auto texture = MC::Texture(image); - MC::Mesh shape({ - {-1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f}, {1.0f, -1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, - {-1.0f, 1.0f, -1.0f}, {1.0f, 1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, - - {-1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {-1.0f, -1.0f, -1.0f}, - {1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, 1.0f}, - - {-1.0f, 1.0f, -1.0f}, {1.0f, 1.0f, -1.0f}, {1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, - {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, - }, - { - {0.5f, 0.5f}, {0.0f, 0.5f}, {0.0f, 1.0f}, {0.5f, 1.0f}, - {0.5f, 0.5f}, {0.0f, 0.5f}, {0.0f, 1.0f}, {0.5f, 1.0f}, - - {0.5f, 0.5f}, {0.0f, 0.5f}, {0.0f, 1.0f}, {0.5f, 1.0f}, - {0.5f, 0.5f}, {0.0f, 0.5f}, {0.0f, 1.0f}, {0.5f, 1.0f}, - - {0.0f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.0f}, {0.0f, 0.0f}, - {0.5f, 0.5f}, {1.0f, 0.5f}, {1.0f, 0.0f}, {0.5f, 0.0f}, - }, - { - 0, 1, 3, 1, 2, 3, - 4, 5, 7, 5, 6, 7, - 8, 9, 11, 9, 10, 11, - 12, 13, 15, 13, 14, 15, - 16, 17, 19, 17, 18, 19, - 20, 21, 23, 21, 22, 23, - 24, 25, 27, 25, 26, 27, - }); + MC::Generator generator; + auto chunk = generator.generate(0, 0); + auto chunk_mesh = chunk.mesh(); - auto mesh = MC::Binder::load(shape); + auto mesh = MC::Binder::load(chunk_mesh); MC::Camera camera{}; camera.set_position({0.0f, 0.0f, 3.0f}); @@ -104,6 +79,9 @@ void run() { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + uint64_t time = 0; while (!window.should_close()) { @@ -117,8 +95,7 @@ void run() { program.bind(); - auto angle = std::fmod(time / 10.0f, 360.0f); - auto model = Math::MVP::model({0.0f, 0.0f, 0.0f}, {angle, angle, 0.0f}); + auto model = Math::MVP::model({}, {}); model_uniform.set(model); auto view = Math::MVP::view(camera.position(), camera.angles()); |
