Now loading the resolution of the shadow cube maps from config.xml.
This commit is contained in:
parent
2b4a8885b5
commit
8cc467a806
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -3,6 +3,8 @@
|
||||
<height>786</height>
|
||||
</resolution>
|
||||
|
||||
<shadowCubeSize>1024</shadowCubeSize>
|
||||
|
||||
<farPlane>150.0</farPlane>
|
||||
|
||||
<compositionsPath>../Levels/ObjectSetups/Compositions.xml</compositionsPath>
|
||||
|
@ -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() {
|
||||
|
@ -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<ACGL::OpenGL::SharedTextureCubeMap> depth_cubeMaps;
|
||||
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube;
|
||||
ACGL::OpenGL::SharedTexture2D depthTexture_cube;
|
||||
static const int cube_size;
|
||||
int cube_size;
|
||||
Level* level;
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user