From e66f7011fb23e3509ad95accec581f6269813266 Mon Sep 17 00:00:00 2001 From: Mel Date: Wed, 26 Oct 2022 04:05:47 +0200 Subject: Fixed attribute double free --- src/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index eafba6e..2589555 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,7 @@ #include "GFX/Texture.hpp" #include "GFX/Image/PPMParser.hpp" #include "World/World.hpp" +#include "Util/ImageViewer.hpp" #define APP_NAME "Meowcraft" @@ -49,6 +50,14 @@ void run() { glViewport(0, 0, w, h); }); + auto example_image = MC::GFX::Image::RawImage(10, 10, 3); + for (uint8_t x = 0; x < 10; x++) { + for (uint8_t y = 0; y < 10; y++) { + example_image.add({static_cast(x * 20), 0, static_cast(y * 20)}); + } + } + auto viewer = MC::Util::ImageViewer(example_image); + auto image = MC::GFX::Image::PPMParser(MC::Assets::Images::atlas).parse(); auto texture = MC::GFX::Texture(image); @@ -69,7 +78,7 @@ void run() { auto sun_direction_uniform = program.uniform("sun_direction"); program.bind(); - auto projection = Math::MVP::projection(ASPECT, FOV, 0.1f, 1000.0f); + auto projection = Math::MVP::perspective_projection(ASPECT, FOV, 0.1f, 1000.0f); projection_uniform.set(projection); Vector<3> sun_direction{1.0f, -1.0f, 0.0f}; @@ -105,6 +114,8 @@ void run() { render(chunk.mesh.value(), texture); } + viewer.render(); + time++; } } -- cgit 1.4.1