Added chunks counter to debug info screen

This commit is contained in:
MihailRis
2022-06-29 15:18:31 +03:00
committed by GitHub
parent 265ebc0927
commit 191b88192b
5 changed files with 10 additions and 5 deletions
+4
View File
@@ -23,6 +23,7 @@ Chunks::Chunks(int w, int h, int d, int ox, int oy, int oz) : w(w), h(h), d(d),
chunks[i] = nullptr;
meshes[i] = nullptr;
}
chunksCount = 0;
}
Chunks::~Chunks(){
@@ -281,6 +282,7 @@ void Chunks::translate(WorldFiles* worldFiles, int dx, int dy, int dz){
worldFiles->put((const char*)chunk->voxels, chunk->x, chunk->z);
chunk->decref();
delete mesh;
chunksCount--;
continue;
}
meshesSecond[(ny * d + nz) * w + nx] = mesh;
@@ -317,6 +319,7 @@ bool Chunks::putChunk(Chunk* chunk) {
if (x < 0 || y < 0 || z < 0 || x >= w || y >= h || z >= d)
return false;
chunks[(y * d + z) * w + x] = chunk;
chunksCount++;
return true;
}
@@ -329,4 +332,5 @@ void Chunks::clear(bool freeMemory){
chunks[i] = nullptr;
meshes[i] = nullptr;
}
chunksCount = 0;
}
+1
View File
@@ -20,6 +20,7 @@ public:
Mesh** meshes;
Mesh** meshesSecond;
size_t volume;
size_t chunksCount;
unsigned int w,h,d;
int ox,oy,oz;
+1 -1
View File
@@ -106,7 +106,7 @@ bool ChunksController::loadVisible(WorldFiles* worldFiles){
if (worldFiles->getChunk(chunk->x, chunk->z, (char*)chunk->voxels))
chunk->loaded = true;
chunks->chunks[index] = chunk;
chunks->putChunk(chunk);
Chunk* closes[27];
for (int i = 0; i < 27; i++)