diff --git a/src/voxels/ChunksController.cpp b/src/voxels/ChunksController.cpp index 16d484a5..d288181e 100644 --- a/src/voxels/ChunksController.cpp +++ b/src/voxels/ChunksController.cpp @@ -10,6 +10,8 @@ #include #include +#define MIN_SURROUNDING 9 + ChunksController::ChunksController(Chunks* chunks, Lighting* lighting) : chunks(chunks), lighting(lighting){ loadersCount = std::thread::hardware_concurrency() - 1; @@ -29,9 +31,6 @@ ChunksController::~ChunksController(){ } int ChunksController::countFreeLoaders(){ - if (_totalLoaded < 4) - return loaders[0]->isBusy() ? 0 : 1; - int count = 0; for (int i = 0; i < loadersCount; i++){ if (!loaders[i]->isBusy()) @@ -97,7 +96,6 @@ bool ChunksController::loadVisible(WorldFiles* worldFiles){ } if (freeLoader == nullptr) return false; - _totalLoaded++; chunk = new Chunk(nearX+ox,nearY+oy,nearZ+oz); if (worldFiles->getChunk(chunk->x, chunk->z, (char*)chunk->voxels)) chunk->loaded = true; @@ -149,7 +147,7 @@ bool ChunksController::_buildMeshes(VoxelRenderer* renderer, int tick) { Mesh* mesh = chunks->meshes[index]; if (mesh != nullptr && !chunk->modified) continue; - if (!chunk->ready || chunk->surrounding < 9){ + if (!chunk->ready || chunk->surrounding < MIN_SURROUNDING){ continue; } int lx = x - w / 2; diff --git a/src/voxels/ChunksController.h b/src/voxels/ChunksController.h index 15656065..d31d925f 100644 --- a/src/voxels/ChunksController.h +++ b/src/voxels/ChunksController.h @@ -13,7 +13,6 @@ private: Lighting* lighting; ChunksLoader** loaders; int loadersCount; - int _totalLoaded = 0; public: ChunksController(Chunks* chunks, Lighting* lighting); ~ChunksController();