diff --git a/application.cc b/application.cc index 870c40b..6e263e8 100644 --- a/application.cc +++ b/application.cc @@ -5,7 +5,7 @@ Application::Application() { Loader loader = Loader(); //load the config.xml loader.loadConfig(this); - graphics = Graphics(glm::uvec2(windowWidth, windowHeight), 0.1f, farPlane); + graphics = Graphics(glm::uvec2(windowWidth, windowHeight), 0.1f, farPlane, shadowCubeSize); } void Application::init() @@ -87,6 +87,10 @@ void Application::setWindowHeight(int windowHeight) { this->windowHeight = windowHeight; } +void Application::setShadowCubeSize(int shadowCubeSize) { + this->shadowCubeSize = shadowCubeSize; +} + void Application::setFarPlane(float farPlane) { this->farPlane = farPlane; } diff --git a/application.hh b/application.hh index 97c40f6..0a58d84 100644 --- a/application.hh +++ b/application.hh @@ -20,6 +20,7 @@ class Application { void ignoredOneMouseUpdate(); void setWindowWidth(int windowWidth); void setWindowHeight(int windowHeight); + void setShadowCubeSize(int shadowCubeSize); void setFarPlane(float farPlane); void setCompositionsPath(std::string compositionsPath); void setShaderPath(std::string shaderPath); @@ -36,6 +37,7 @@ class Application { Level level; int windowWidth; int windowHeight; + int shadowCubeSize; float farPlane; std::string compositionsPath; std::string shaderPath; diff --git a/data/config.xml b/data/config.xml index c8e3185..fd1c30f 100644 --- a/data/config.xml +++ b/data/config.xml @@ -3,6 +3,8 @@ 786 +1024 + 150.0 ../Levels/ObjectSetups/Compositions.xml diff --git a/graphics.cc b/graphics.cc index b985123..6f61565 100644 --- a/graphics.cc +++ b/graphics.cc @@ -7,13 +7,13 @@ using namespace ACGL::OpenGL; -const int Graphics::cube_size = 1024; const double lightUpdateDelay = 0.5f; -Graphics::Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane) { +Graphics::Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane, int cube_size) { this->windowSize = windowSize; this->nearPlane = nearPlane; this->farPlane = farPlane; + this->cube_size = cube_size; } Graphics::Graphics() { diff --git a/graphics.hh b/graphics.hh index c26425b..96259cd 100644 --- a/graphics.hh +++ b/graphics.hh @@ -10,7 +10,7 @@ class Graphics { public: - Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane); + Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane, int cube_size); Graphics(); void init(Level* level); void render(double time); @@ -31,7 +31,7 @@ class Graphics { std::vector depth_cubeMaps; ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube; ACGL::OpenGL::SharedTexture2D depthTexture_cube; - static const int cube_size; + int cube_size; Level* level; }; diff --git a/loader.cc b/loader.cc index 2c05154..b33c130 100644 --- a/loader.cc +++ b/loader.cc @@ -5,7 +5,7 @@ Loader::Loader() { } void Loader::loadConfig(Application* application) { - int windowWidth, windowHeight; + int windowWidth, windowHeight, shadowCubeSize; float farPlane; std::string compositionsPath, shaderPath, geometryPath, texturePath, scriptPath, heightmapPath, levelXmlPath; XMLDocument* config = new XMLDocument(); @@ -18,7 +18,9 @@ void Loader::loadConfig(Application* application) { XMLElement* resolution = config->FirstChildElement("resolution"); errorCheck(resolution->FirstChildElement("width")->QueryIntText(&windowWidth)); errorCheck(resolution->FirstChildElement("height")->QueryIntText(&windowHeight)); + errorCheck(config->FirstChildElement("shadowCubeSize")->QueryIntText(&shadowCubeSize)); errorCheck(config->FirstChildElement("farPlane")->QueryFloatText(&farPlane)); + const char* charCompositionsPath = config->FirstChildElement("compositionsPath")->GetText(); if(charCompositionsPath == NULL){ printf("XMLError: No compositionsPath found.\n"); @@ -70,6 +72,7 @@ void Loader::loadConfig(Application* application) { application->setWindowWidth(windowWidth); application->setWindowHeight(windowHeight); + application->setShadowCubeSize(shadowCubeSize); application->setFarPlane(farPlane); application->setCompositionsPath(compositionsPath); application->setShaderPath(shaderPath);