From 2a3f976b5e7e786eec3521e133258e2dcacaa8da Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 21 Mar 2015 18:57:14 +0100 Subject: [PATCH] Slight fps increas by reducing the amount the point lights have to render. --- game/graphics.cc | 2 +- game/level.cc | 3 +++ game/loader.cc | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/game/graphics.cc b/game/graphics.cc index 8f63d5e..cd643cd 100644 --- a/game/graphics.cc +++ b/game/graphics.cc @@ -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), diff --git a/game/level.cc b/game/level.cc index 20e9443..989624a 100644 --- a/game/level.cc +++ b/game/level.cc @@ -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; diff --git a/game/loader.cc b/game/loader.cc index cc7c616..f372682 100644 --- a/game/loader.cc +++ b/game/loader.cc @@ -2,7 +2,7 @@ #include using namespace tinyxml2; -const int chunkSize = 30; +const int chunkSize = 25; Loader::Loader() { }