Slight fps increas by reducing the amount the point lights have to render.

This commit is contained in:
Faerbit 2015-03-21 18:57:14 +01:00
parent 1fd6058eaf
commit 2a3f976b5e
3 changed files with 5 additions and 2 deletions

View File

@ -361,7 +361,7 @@ void Graphics::render(double time)
depthCubeShader->setUniform("farPlane", farPlane);
// render depth textures for point lights
glViewport(0, 0, cube_size, cube_size);
glm::mat4 depthProjectionMatrix_pointlights = glm::perspective(1.571f, (float)cube_size/(float)cube_size, 0.1f, farPlane);
glm::mat4 depthProjectionMatrix_pointlights = glm::perspective(1.571f, (float)cube_size/(float)cube_size, 0.1f, 50.0f);
glm::vec3 looking_directions[6] = {glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f),
glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, 0.0f, -1.0f)};
glm::vec3 upvectors[6] = {glm::vec3(0.0f, -1.0f, 0.0f),glm::vec3(0.0f, -1.0f, 0.0f),glm::vec3(0.0f, 0.0f, -1.0f),

View File

@ -61,6 +61,9 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
else {
renderDistance = ((((int)skydomeSize)+chunkSize/2)/chunkSize) + 1;
}
if(!lightingPass) {
renderDistance = 1;
}
int xPosition = ((int)cameraCenter->getPosition().x + (terrain.getHeightmapWidth()/2))/chunkSize;
int zPosition = ((int)cameraCenter->getPosition().z + (terrain.getHeightmapHeight()/2))/chunkSize;
int xStart = xPosition - renderDistance;

View File

@ -2,7 +2,7 @@
#include <ACGL/OpenGL/Objects/VertexArrayObject.hh>
using namespace tinyxml2;
const int chunkSize = 30;
const int chunkSize = 25;
Loader::Loader() {
}