chunk release resources on destruction

vertex-deduplication
EmaMaker 2023-03-12 22:14:28 +01:00
parent ddd047e82f
commit f3d89a2e5a
2 changed files with 7 additions and 1 deletions

View File

@ -15,7 +15,7 @@
#include "intervalmap.hpp" #include "intervalmap.hpp"
#include "shader.hpp" #include "shader.hpp"
#define CHUNK_SIZE 2 #define CHUNK_SIZE 8
#define CHUNK_VOLUME (CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE) #define CHUNK_VOLUME (CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE)
#define CHUNK_MAX_INDEX (CHUNK_VOLUME - 1) #define CHUNK_MAX_INDEX (CHUNK_VOLUME - 1)

View File

@ -33,6 +33,12 @@ namespace Chunk
glDeleteBuffers(1, &(this->colorBuffer)); glDeleteBuffers(1, &(this->colorBuffer));
glDeleteBuffers(1, &(this->VBO)); glDeleteBuffers(1, &(this->VBO));
glDeleteBuffers(1, &(this->EBO)); glDeleteBuffers(1, &(this->EBO));
vertices.clear();
indices.clear();
colors.clear();
mutex_state.unlock();
} }
Block Chunk::getBlock(int x, int y, int z) Block Chunk::getBlock(int x, int y, int z)