Added a parameter to getSurroundingChunks to limit the chunkRenderDistance.
This commit is contained in:
parent
9ea1630057
commit
b110551db6
@ -141,14 +141,19 @@ void Level::enqueueObjects(Graphics* graphics) {
|
||||
graphics->enqueueObjects(&sortedCrossChunkObjects);
|
||||
}
|
||||
|
||||
std::vector<Chunk*> Level::getSurroundingChunks() {
|
||||
std::vector<Chunk*> Level::getSurroundingChunks(int chunkRenderDistance) {
|
||||
int renderDistance = 0;
|
||||
if (chunkRenderDistance < 0) {
|
||||
if ((int)farPlane % chunkSize == 0) {
|
||||
renderDistance = (((int)skydomeSize)+chunkSize/2)/chunkSize;
|
||||
}
|
||||
else {
|
||||
renderDistance = ((((int)skydomeSize)+chunkSize/2)/chunkSize) + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
renderDistance = chunkRenderDistance;
|
||||
}
|
||||
int xPosition = ((int)cameraCenter->getPosition().x + (terrain.getHeightmapWidth()/2))/chunkSize;
|
||||
int zPosition = ((int)cameraCenter->getPosition().z + (terrain.getHeightmapHeight()/2))/chunkSize;
|
||||
int xStart = xPosition - renderDistance;
|
||||
|
@ -86,7 +86,7 @@ class Level {
|
||||
void sortObjects(int textureCount);
|
||||
std::vector<Light*>* getClosestLights();
|
||||
private:
|
||||
std::vector<Chunk*> getSurroundingChunks();
|
||||
std::vector<Chunk*> getSurroundingChunks(int chunkRenderDistance);
|
||||
lua_State* luaState=nullptr;
|
||||
std::vector<Object*> crossChunkObjects;
|
||||
std::vector<std::vector<Object*>> sortedCrossChunkObjects;
|
||||
|
Loading…
Reference in New Issue
Block a user