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