Removed one loader limit for first 4 chunks loading
This commit is contained in:
parent
aa08a0bc6b
commit
4661ace697
@ -10,6 +10,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#define MIN_SURROUNDING 9
|
||||||
|
|
||||||
|
|
||||||
ChunksController::ChunksController(Chunks* chunks, Lighting* lighting) : chunks(chunks), lighting(lighting){
|
ChunksController::ChunksController(Chunks* chunks, Lighting* lighting) : chunks(chunks), lighting(lighting){
|
||||||
loadersCount = std::thread::hardware_concurrency() - 1;
|
loadersCount = std::thread::hardware_concurrency() - 1;
|
||||||
@ -29,9 +31,6 @@ ChunksController::~ChunksController(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ChunksController::countFreeLoaders(){
|
int ChunksController::countFreeLoaders(){
|
||||||
if (_totalLoaded < 4)
|
|
||||||
return loaders[0]->isBusy() ? 0 : 1;
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < loadersCount; i++){
|
for (int i = 0; i < loadersCount; i++){
|
||||||
if (!loaders[i]->isBusy())
|
if (!loaders[i]->isBusy())
|
||||||
@ -97,7 +96,6 @@ bool ChunksController::loadVisible(WorldFiles* worldFiles){
|
|||||||
}
|
}
|
||||||
if (freeLoader == nullptr)
|
if (freeLoader == nullptr)
|
||||||
return false;
|
return false;
|
||||||
_totalLoaded++;
|
|
||||||
chunk = new Chunk(nearX+ox,nearY+oy,nearZ+oz);
|
chunk = new Chunk(nearX+ox,nearY+oy,nearZ+oz);
|
||||||
if (worldFiles->getChunk(chunk->x, chunk->z, (char*)chunk->voxels))
|
if (worldFiles->getChunk(chunk->x, chunk->z, (char*)chunk->voxels))
|
||||||
chunk->loaded = true;
|
chunk->loaded = true;
|
||||||
@ -149,7 +147,7 @@ bool ChunksController::_buildMeshes(VoxelRenderer* renderer, int tick) {
|
|||||||
Mesh* mesh = chunks->meshes[index];
|
Mesh* mesh = chunks->meshes[index];
|
||||||
if (mesh != nullptr && !chunk->modified)
|
if (mesh != nullptr && !chunk->modified)
|
||||||
continue;
|
continue;
|
||||||
if (!chunk->ready || chunk->surrounding < 9){
|
if (!chunk->ready || chunk->surrounding < MIN_SURROUNDING){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int lx = x - w / 2;
|
int lx = x - w / 2;
|
||||||
|
|||||||
@ -13,7 +13,6 @@ private:
|
|||||||
Lighting* lighting;
|
Lighting* lighting;
|
||||||
ChunksLoader** loaders;
|
ChunksLoader** loaders;
|
||||||
int loadersCount;
|
int loadersCount;
|
||||||
int _totalLoaded = 0;
|
|
||||||
public:
|
public:
|
||||||
ChunksController(Chunks* chunks, Lighting* lighting);
|
ChunksController(Chunks* chunks, Lighting* lighting);
|
||||||
~ChunksController();
|
~ChunksController();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user