Removed one loader limit for first 4 chunks loading

This commit is contained in:
MihailRis 2022-03-07 01:35:59 +03:00 committed by GitHub
parent aa08a0bc6b
commit 4661ace697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -10,6 +10,8 @@
#include <iostream>
#include <thread>
#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;

View File

@ -13,7 +13,6 @@ private:
Lighting* lighting;
ChunksLoader** loaders;
int loadersCount;
int _totalLoaded = 0;
public:
ChunksController(Chunks* chunks, Lighting* lighting);
~ChunksController();