Now loading the resolution of the shadow cube maps from config.xml.
This commit is contained in:
parent
dbf5a88ddb
commit
9297aa69a4
@ -5,7 +5,7 @@ Application::Application() {
|
|||||||
Loader loader = Loader();
|
Loader loader = Loader();
|
||||||
//load the config.xml
|
//load the config.xml
|
||||||
loader.loadConfig(this);
|
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()
|
void Application::init()
|
||||||
@ -87,6 +87,10 @@ void Application::setWindowHeight(int windowHeight) {
|
|||||||
this->windowHeight = windowHeight;
|
this->windowHeight = windowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::setShadowCubeSize(int shadowCubeSize) {
|
||||||
|
this->shadowCubeSize = shadowCubeSize;
|
||||||
|
}
|
||||||
|
|
||||||
void Application::setFarPlane(float farPlane) {
|
void Application::setFarPlane(float farPlane) {
|
||||||
this->farPlane = farPlane;
|
this->farPlane = farPlane;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ class Application {
|
|||||||
void ignoredOneMouseUpdate();
|
void ignoredOneMouseUpdate();
|
||||||
void setWindowWidth(int windowWidth);
|
void setWindowWidth(int windowWidth);
|
||||||
void setWindowHeight(int windowHeight);
|
void setWindowHeight(int windowHeight);
|
||||||
|
void setShadowCubeSize(int shadowCubeSize);
|
||||||
void setFarPlane(float farPlane);
|
void setFarPlane(float farPlane);
|
||||||
void setCompositionsPath(std::string compositionsPath);
|
void setCompositionsPath(std::string compositionsPath);
|
||||||
void setShaderPath(std::string shaderPath);
|
void setShaderPath(std::string shaderPath);
|
||||||
@ -36,6 +37,7 @@ class Application {
|
|||||||
Level level;
|
Level level;
|
||||||
int windowWidth;
|
int windowWidth;
|
||||||
int windowHeight;
|
int windowHeight;
|
||||||
|
int shadowCubeSize;
|
||||||
float farPlane;
|
float farPlane;
|
||||||
std::string compositionsPath;
|
std::string compositionsPath;
|
||||||
std::string shaderPath;
|
std::string shaderPath;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
<height>786</height>
|
<height>786</height>
|
||||||
</resolution>
|
</resolution>
|
||||||
|
|
||||||
|
<shadowCubeSize>1024</shadowCubeSize>
|
||||||
|
|
||||||
<farPlane>150.0</farPlane>
|
<farPlane>150.0</farPlane>
|
||||||
|
|
||||||
<compositionsPath>../Levels/ObjectSetups/Compositions.xml</compositionsPath>
|
<compositionsPath>../Levels/ObjectSetups/Compositions.xml</compositionsPath>
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
using namespace ACGL::OpenGL;
|
using namespace ACGL::OpenGL;
|
||||||
|
|
||||||
const int Graphics::cube_size = 1024;
|
|
||||||
const double lightUpdateDelay = 0.5f;
|
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->windowSize = windowSize;
|
||||||
this->nearPlane = nearPlane;
|
this->nearPlane = nearPlane;
|
||||||
this->farPlane = farPlane;
|
this->farPlane = farPlane;
|
||||||
|
this->cube_size = cube_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::Graphics() {
|
Graphics::Graphics() {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
class Graphics {
|
class Graphics {
|
||||||
public:
|
public:
|
||||||
Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane);
|
Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane, int cube_size);
|
||||||
Graphics();
|
Graphics();
|
||||||
void init(Level* level);
|
void init(Level* level);
|
||||||
void render(double time);
|
void render(double time);
|
||||||
@ -31,7 +31,7 @@ class Graphics {
|
|||||||
std::vector<ACGL::OpenGL::SharedTextureCubeMap> depth_cubeMaps;
|
std::vector<ACGL::OpenGL::SharedTextureCubeMap> depth_cubeMaps;
|
||||||
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube;
|
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube;
|
||||||
ACGL::OpenGL::SharedTexture2D depthTexture_cube;
|
ACGL::OpenGL::SharedTexture2D depthTexture_cube;
|
||||||
static const int cube_size;
|
int cube_size;
|
||||||
Level* level;
|
Level* level;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ Loader::Loader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Loader::loadConfig(Application* application) {
|
void Loader::loadConfig(Application* application) {
|
||||||
int windowWidth, windowHeight;
|
int windowWidth, windowHeight, shadowCubeSize;
|
||||||
float farPlane;
|
float farPlane;
|
||||||
std::string compositionsPath, shaderPath, geometryPath, texturePath, scriptPath, heightmapPath, levelXmlPath;
|
std::string compositionsPath, shaderPath, geometryPath, texturePath, scriptPath, heightmapPath, levelXmlPath;
|
||||||
XMLDocument* config = new XMLDocument();
|
XMLDocument* config = new XMLDocument();
|
||||||
@ -18,7 +18,9 @@ void Loader::loadConfig(Application* application) {
|
|||||||
XMLElement* resolution = config->FirstChildElement("resolution");
|
XMLElement* resolution = config->FirstChildElement("resolution");
|
||||||
errorCheck(resolution->FirstChildElement("width")->QueryIntText(&windowWidth));
|
errorCheck(resolution->FirstChildElement("width")->QueryIntText(&windowWidth));
|
||||||
errorCheck(resolution->FirstChildElement("height")->QueryIntText(&windowHeight));
|
errorCheck(resolution->FirstChildElement("height")->QueryIntText(&windowHeight));
|
||||||
|
errorCheck(config->FirstChildElement("shadowCubeSize")->QueryIntText(&shadowCubeSize));
|
||||||
errorCheck(config->FirstChildElement("farPlane")->QueryFloatText(&farPlane));
|
errorCheck(config->FirstChildElement("farPlane")->QueryFloatText(&farPlane));
|
||||||
|
|
||||||
const char* charCompositionsPath = config->FirstChildElement("compositionsPath")->GetText();
|
const char* charCompositionsPath = config->FirstChildElement("compositionsPath")->GetText();
|
||||||
if(charCompositionsPath == NULL){
|
if(charCompositionsPath == NULL){
|
||||||
printf("XMLError: No compositionsPath found.\n");
|
printf("XMLError: No compositionsPath found.\n");
|
||||||
@ -70,6 +72,7 @@ void Loader::loadConfig(Application* application) {
|
|||||||
|
|
||||||
application->setWindowWidth(windowWidth);
|
application->setWindowWidth(windowWidth);
|
||||||
application->setWindowHeight(windowHeight);
|
application->setWindowHeight(windowHeight);
|
||||||
|
application->setShadowCubeSize(shadowCubeSize);
|
||||||
application->setFarPlane(farPlane);
|
application->setFarPlane(farPlane);
|
||||||
application->setCompositionsPath(compositionsPath);
|
application->setCompositionsPath(compositionsPath);
|
||||||
application->setShaderPath(shaderPath);
|
application->setShaderPath(shaderPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user