From f3d89a2e5a1348c26cbae54a4da696210b7ed3cc Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Sun, 12 Mar 2023 22:14:28 +0100 Subject: [PATCH] chunk release resources on destruction --- include/chunk.hpp | 2 +- src/chunk.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/chunk.hpp b/include/chunk.hpp index f69c5ec..0eb7184 100644 --- a/include/chunk.hpp +++ b/include/chunk.hpp @@ -15,7 +15,7 @@ #include "intervalmap.hpp" #include "shader.hpp" -#define CHUNK_SIZE 2 +#define CHUNK_SIZE 8 #define CHUNK_VOLUME (CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE) #define CHUNK_MAX_INDEX (CHUNK_VOLUME - 1) diff --git a/src/chunk.cpp b/src/chunk.cpp index baa5e0e..c92e8ef 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -33,6 +33,12 @@ namespace Chunk glDeleteBuffers(1, &(this->colorBuffer)); glDeleteBuffers(1, &(this->VBO)); glDeleteBuffers(1, &(this->EBO)); + + vertices.clear(); + indices.clear(); + colors.clear(); + + mutex_state.unlock(); } Block Chunk::getBlock(int x, int y, int z)