chunk: vram buffers are managed by renderer now
parent
7786d4f04d
commit
7c82a71dd0
|
@ -52,9 +52,6 @@ namespace Chunk
|
||||||
~Chunk();
|
~Chunk();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void createBuffers();
|
|
||||||
void deleteBuffers();
|
|
||||||
|
|
||||||
glm::vec3 getPosition() { return this->position; }
|
glm::vec3 getPosition() { return this->position; }
|
||||||
void setState(chunk_state_t nstate, bool value);
|
void setState(chunk_state_t nstate, bool value);
|
||||||
bool getState(chunk_state_t n) { return (this->state & n) == n; }
|
bool getState(chunk_state_t n) { return (this->state & n) == n; }
|
||||||
|
@ -72,7 +69,6 @@ namespace Chunk
|
||||||
std::unique_ptr<Block[]> getBlocksArray(int* len) { return (this->blocks.toArray(len)); }
|
std::unique_ptr<Block[]> getBlocksArray(int* len) { return (this->blocks.toArray(len)); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLuint VAO{0}, VBO{0}, extentsBuffer{0}, texinfoBuffer{0}, numVertices{0};
|
|
||||||
std::atomic<float> unload_timer{0};
|
std::atomic<float> unload_timer{0};
|
||||||
chunk_index_t getIndex(){ return this->index; }
|
chunk_index_t getIndex(){ return this->index; }
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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 ||
|
if(x < 0 || y < 0 || z < 0 || x > CHUNK_SIZE -1 || y > CHUNK_SIZE -1 || z > CHUNK_SIZE-1 ||
|
||||||
|
|
Loading…
Reference in New Issue