Restructuring the project directory

This commit is contained in:
2021-01-16 19:57:22 +01:00
parent 938450ce75
commit 7e9702431f
31 changed files with 68 additions and 53 deletions

7
.gitmodules vendored Normal file
View File

@@ -0,0 +1,7 @@
[submodule "resources"]
path = data/res
url = git@gitlab.com:4VRDriver/fall-fever-resources.git
[submodule "data/res"]
path = data/res
url = git@gitlab.com:4VRDriver/fall-fever-resources.git

View File

@@ -2,19 +2,19 @@
"models": [
{
"unique_name": "fallback",
"path": "res/models/fallback.ffo"
"path": "data/res/models/fallback.ffo"
},
{
"unique_name": "backpack",
"path": "res/models/backpack.ffo"
"path": "data/res/models/backpack.ffo"
},
{
"unique_name": "ground",
"path": "res/models/wood_floor.ffo"
"path": "data/res/models/wood_floor.ffo"
},
{
"unique_name": "cube",
"path": "res/models/cube.ffo"
"path": "data/res/models/cube.ffo"
}
],
"entities": [
@@ -38,6 +38,6 @@
}
],
"skybox": {
"texturePath": "res/textures/skybox/"
"texturePath": "data/res/textures/skybox/"
}
}

1
data/res Submodule

Submodule data/res added at 84f2a02390

View File

@@ -3,19 +3,19 @@
{
"position": [0.0, 0.0],
"dimensions": [1.0, 1.0],
"texture": "res/textures/loading.png"
"texture": "data/res/textures/loading.png"
}
],
"mainMenuScreen": [
{
"position": [0.5, 0.5],
"dimensions": [0.25, 0.25],
"texture": "res/textures/container.png"
"texture": "data/res/textures/container.png"
},
{
"position": [0.75, 0.0],
"dimensions": [0.25, 0.25],
"texture": "res/textures/tex2.png"
"texture": "data/res/textures/tex2.png"
}
]
}

40
data/shaderPrograms.json Normal file
View File

@@ -0,0 +1,40 @@
{
"shaderPrograms": [
{
"unique_name": "defaultProgram",
"vertexPath": "data/shaders/basic.vert",
"fragmentPath": "data/shaders/basic.frag"
},
{
"unique_name": "lightProgram",
"vertexPath": "data/shaders/light.vert",
"fragmentPath": "data/shaders/light.frag"
},
{
"unique_name": "skyboxProgram",
"vertexPath": "data/shaders/skybox.vert",
"fragmentPath": "data/shaders/skybox.frag"
},
{
"unique_name": "postProcessingProgram",
"vertexPath": "data/shaders/postprocessing.vert",
"fragmentPath": "data/shaders/postprocessing.frag"
},
{
"unique_name": "menuProgram",
"vertexPath": "data/shaders/menu.vert",
"fragmentPath": "data/shaders/menu.frag"
},
{
"unique_name": "directionalShadowDepthProgram",
"vertexPath": "data/shaders/directionalShadowDepth.vert",
"fragmentPath": "data/shaders/directionalShadowDepth.frag"
},
{
"unique_name": "pointShadowDepthProgram",
"vertexPath": "data/shaders/pointShadowDepth.vert",
"fragmentPath": "data/shaders/pointShadowDepth.frag",
"geometryPath": "data/shaders/pointShadowDepth.geom"
}
]
}

View File

@@ -1,40 +0,0 @@
{
"shaderPrograms": [
{
"unique_name": "defaultProgram",
"vertexPath": "res/shaders/basic.vert",
"fragmentPath": "res/shaders/basic.frag"
},
{
"unique_name": "lightProgram",
"vertexPath": "res/shaders/light.vert",
"fragmentPath": "res/shaders/light.frag"
},
{
"unique_name": "skyboxProgram",
"vertexPath": "res/shaders/skybox.vert",
"fragmentPath": "res/shaders/skybox.frag"
},
{
"unique_name": "postProcessingProgram",
"vertexPath": "res/shaders/postprocessing.vert",
"fragmentPath": "res/shaders/postprocessing.frag"
},
{
"unique_name": "menuProgram",
"vertexPath": "res/shaders/menu.vert",
"fragmentPath": "res/shaders/menu.frag"
},
{
"unique_name": "directionalShadowDepthProgram",
"vertexPath": "res/shaders/directionalShadowDepth.vert",
"fragmentPath": "res/shaders/directionalShadowDepth.frag"
},
{
"unique_name": "pointShadowDepthProgram",
"vertexPath": "res/shaders/pointShadowDepth.vert",
"fragmentPath": "res/shaders/pointShadowDepth.frag",
"geometryPath": "res/shaders/pointShadowDepth.geom"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 KiB

View File

@@ -30,7 +30,7 @@ Controller::Controller()
camera = new Camera(90.0f, gameWindow->getWindowAspectRatio());
JsonParser shaderParser("res/shaderPrograms.json");
JsonParser shaderParser("data/shaderPrograms.json");
shaderPrograms = shaderParser.getShaderPrograms();
pp_framebuffer = new Framebuffer(gameWindow->getWindowWidth(), gameWindow->getWindowHeight(), getShaderProgramByName("postProcessingProgram"));
@@ -110,6 +110,7 @@ void Controller::run()
static glm::vec3 lightColor = glm::vec3(1.f);
static float intensity = 20.f;
world->updatePointLight(0, true, world->getEntityByName("light")->getPosition(), lightColor, intensity);
world->updateDirectionalLight(true, world->getDirectionalLight()->getDirection(), lightColor);
getShaderProgramByName("lightProgram")->bind();
getShaderProgramByName("lightProgram")->setUniform("v_lightColor", lightColor * 100.0f);
getShaderProgramByName("lightProgram")->unbind();

View File

@@ -122,3 +122,8 @@ void DirectionalLight::setDirection(glm::vec3 direction)
this->direction = direction;
update();
}
glm::vec3 DirectionalLight::getDirection()
{
return direction;
}

View File

@@ -69,6 +69,8 @@ public:
void setDirection(glm::vec3 direction);
glm::vec3 getDirection();
private:
void update() override;

View File

@@ -4,7 +4,7 @@
Menu::Menu(Framebuffer *p_framebuffer, ShaderProgram *p_shaderProgram) :
framebuffer(p_framebuffer), shaderProgram(p_shaderProgram)
{
JsonParser screenParser("res/screens.json");
JsonParser screenParser("data/screens.json");
screens = screenParser.getScreens(shaderProgram, framebuffer);
}

View File

@@ -43,4 +43,3 @@ void Widget::draw(ShaderProgram *shaderProgram)
widgetMesh->draw(shaderProgram);
shaderProgram->unbind();
}

View File

@@ -19,12 +19,12 @@ World::World(std::vector<ShaderProgram*> shaderPrograms) :
shaderProgram->setUniform("u_material.shininess", 100.0f);
shaderProgram->unbind();
JsonParser modelParser("res/models.json");
JsonParser modelParser("data/models.json");
models = modelParser.getModels();
entities = modelParser.getEntities(models, shaderPrograms);
skybox = modelParser.getSkybox(getModelByName("cube"), Controller::getShaderProgramByName(shaderPrograms, "skyboxProgram"));
JsonParser lightParser("res/lights.json");
JsonParser lightParser("data/lights.json");
lights = lightParser.getLights(shaderProgram);
}