From 1d36a84f93afc7840f38e8455b4415672707968d Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Wed, 4 Oct 2023 12:55:16 +0200 Subject: [PATCH] chunk: mesh data is managed by the rendering thread now --- include/chunk.hpp | 4 ---- src/chunk.cpp | 15 --------------- 2 files changed, 19 deletions(-) diff --git a/include/chunk.hpp b/include/chunk.hpp index 19a9dc6..2ae8daf 100644 --- a/include/chunk.hpp +++ b/include/chunk.hpp @@ -52,9 +52,6 @@ namespace Chunk ~Chunk(); public: - void createBuffers(); - void deleteBuffers(); - glm::vec3 getPosition() { return this->position; } void setState(chunk_state_t nstate, bool value); bool getState(chunk_state_t n) { return (this->state & n) == n; } @@ -72,7 +69,6 @@ namespace Chunk std::unique_ptr getBlocksArray(int* len) { return (this->blocks.toArray(len)); } public: - GLuint VAO{0}, VBO{0}, extentsBuffer{0}, texinfoBuffer{0}, numVertices{0}; std::atomic unload_timer{0}; chunk_index_t getIndex(){ return this->index; } diff --git a/src/chunk.cpp b/src/chunk.cpp index 6eebecd..b85443d 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -36,21 +36,6 @@ namespace Chunk { } - void Chunk::createBuffers(){ - glGenVertexArrays(1, &(this->VAO)); - glGenBuffers(1, &(this->VBO)); - glGenBuffers(1, &(this->extentsBuffer)); - glGenBuffers(1, &(this->texinfoBuffer)); - - } - - void Chunk::deleteBuffers(){ - glDeleteBuffers(1, &(this->VBO)); - glDeleteBuffers(1, &(this->extentsBuffer)); - glDeleteBuffers(1, &(this->texinfoBuffer)); - glDeleteVertexArrays(1, &(this->VAO)); - } - Block Chunk::getBlock(int x, int y, int z) { if(x < 0 || y < 0 || z < 0 || x > CHUNK_SIZE -1 || y > CHUNK_SIZE -1 || z > CHUNK_SIZE-1 ||