From 79223b4c02a90472a985c0eff31d65406636641c Mon Sep 17 00:00:00 2001 From: Faerbit Date: Tue, 17 Mar 2015 19:10:23 +0100 Subject: [PATCH] Do not render behind the skydome. --- game/application.cc | 2 +- game/level.cc | 6 +++--- game/level.hh | 2 +- game/loader.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/game/application.cc b/game/application.cc index b100894..f1c0884 100644 --- a/game/application.cc +++ b/game/application.cc @@ -22,7 +22,7 @@ void Application::init() } void Application::initLevel() { - this->level = Level(levelXmlPath, farPlane); + this->level = Level(levelXmlPath); level.getPhysics()->init(geometryPath); // Don't change this! ignoredMouseUpdates = 0; diff --git a/game/level.cc b/game/level.cc index bcb1125..0ef2205 100644 --- a/game/level.cc +++ b/game/level.cc @@ -2,7 +2,7 @@ #include "loader.hh" #include -Level::Level(std::string xmlFilePath, float farPlane){ +Level::Level(std::string xmlFilePath) { // default value skydomeSize = 50.0f; physics = Physics(); @@ -55,10 +55,10 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, glm::mat4* viewProjectionMatrix, std::vector* shadowVPs) { int renderDistance = 0; if ((int)farPlane % chunkSize == 0) { - renderDistance = farPlane/chunkSize; + renderDistance = (int)skydomeSize/chunkSize; } else { - renderDistance = (farPlane/chunkSize) + 1; + renderDistance = ((int)skydomeSize/chunkSize) + 1; } int xPosition = ((int)cameraCenter->getPosition().x + (terrain.getHeightmapWidth()/2))/chunkSize; int zPosition = ((int)cameraCenter->getPosition().z + (terrain.getHeightmapHeight()/2))/chunkSize; diff --git a/game/level.hh b/game/level.hh index 8d99bd9..587a72f 100644 --- a/game/level.hh +++ b/game/level.hh @@ -23,7 +23,7 @@ extern "C" { class Level { public: - Level(std::string xmlFilePath, float farPlane); + Level(std::string xmlFilePath); Level(); ~Level(); void load(); diff --git a/game/loader.cc b/game/loader.cc index 7bad3bb..dc8bab0 100644 --- a/game/loader.cc +++ b/game/loader.cc @@ -2,7 +2,7 @@ #include using namespace tinyxml2; -const int chunkSize = 50; +const int chunkSize = 30; Loader::Loader() { }