mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Fixed first chunks lighting concurrency problem
This commit is contained in:
parent
07e2fe8b3b
commit
35f8ebe79c
1 changed files with 9 additions and 1 deletions
|
|
@ -61,16 +61,24 @@ bool ChunksController::loadVisible(WorldFiles* worldFiles){
|
|||
if (chunk != nullptr)
|
||||
return false;
|
||||
|
||||
static int _totalLoaded = 0;
|
||||
|
||||
ChunksLoader* freeLoader = nullptr;
|
||||
for (int i = 0; i < LOADERS_COUNT; i++){
|
||||
ChunksLoader* loader = loaders[i];
|
||||
if (loader->isBusy())
|
||||
if (loader->isBusy()){
|
||||
// Use only one loader at start to prevent near chunks lighting artifacts
|
||||
if (_totalLoaded < 4){
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
freeLoader = loader;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue