diff --git a/include/chunk.hpp b/include/chunk.hpp index 5ecafe4..26a7f86 100644 --- a/include/chunk.hpp +++ b/include/chunk.hpp @@ -65,12 +65,15 @@ namespace Chunk public: GLuint VAO{0}, VBO{0}, extentsBuffer{0}, texinfoBuffer{0}, numVertices{0}; std::atomic unload_timer{0}; + chunk_index_t getIndex(){ return this->index; } private: glm::vec3 position{}; IntervalMap blocks{}; std::atomic_uint8_t state{0}; + + chunk_index_t index; }; }; diff --git a/src/chunk.cpp b/src/chunk.cpp index f7822e0..982edf8 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -29,6 +29,7 @@ namespace Chunk this->position = pos; this->setState(CHUNK_STATE_EMPTY, true); this->setBlocks(0, CHUNK_MAX_INDEX, Block::AIR); + this->index = calculateIndex(pos); } Chunk ::~Chunk()