Yet another cleanup

This commit is contained in:
Aleksander Burkowski 2023-01-25 14:43:39 +01:00
parent ca6464a20b
commit 4122c2a302

View File

@ -21,28 +21,31 @@ const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
int WIDTH = 500, HEIGHT = 500;
namespace models {
Core::RenderContext bedContext;
Core::RenderContext chairContext;
Core::RenderContext deskContext;
Core::RenderContext doorContext;
Core::RenderContext drawerContext;
Core::RenderContext marbleBustContext;
Core::RenderContext materaceContext;
Core::RenderContext pencilsContext;
Core::RenderContext planeContext;
Core::RenderContext roomContext;
Core::RenderContext spaceshipContext;
Core::RenderContext sphereContext;
Core::RenderContext windowContext;
Core::RenderContext testContext;
Core::RenderContext windowFrame;
Core::RenderContext bookShelf;
Core::RenderContext window;
Core::RenderContext potPlant;
Core::RenderContext officeChair;
Core::RenderContext lamp;
Core::RenderContext door;
Core::RenderContext ceilingLamp;
Core::RenderContext desk;
Core::RenderContext bed;
}
namespace textures {
GLuint sunTexture;
GLuint windowFrameTexture;
GLuint bookShelfTexture;
GLuint potPlantTexture;
GLuint officeChariTexture;
GLuint lampTexture;
GLuint doorTexture;
GLuint deskTexture;
GLuint ceilingLampTexture;
GLuint bedTexture;
}
GLuint depthMapFBO;
@ -197,39 +200,39 @@ void renderShadowapSun() {
drawObjectDepth(sphereContext,
lightVP,
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)));
drawObjectDepth(models::bedContext,
lightVP,
glm::mat4());
drawObjectDepth(models::chairContext,
lightVP,
glm::mat4());
drawObjectDepth(models::deskContext,
lightVP,
glm::mat4());
drawObjectDepth(models::doorContext,
lightVP,
glm::mat4());
drawObjectDepth(models::drawerContext,
lightVP,
glm::mat4());
drawObjectDepth(models::marbleBustContext,
lightVP,
glm::mat4());
drawObjectDepth(models::materaceContext,
lightVP,
glm::mat4());
drawObjectDepth(models::pencilsContext,
lightVP,
glm::mat4());
drawObjectDepth(models::planeContext,
lightVP,
glm::mat4());
drawObjectDepth(models::roomContext,
lightVP,
glm::mat4());
drawObjectDepth(models::windowContext,
lightVP,
glm::mat4());
//drawObjectDepth(models::bedContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::chairContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::deskContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::doorContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::drawerContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::marbleBustContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::materaceContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::pencilsContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::planeContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::roomContext,
// lightVP,
// glm::mat4());
//drawObjectDepth(models::windowContext,
// lightVP,
// glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@ -256,6 +259,46 @@ void renderScene(GLFWwindow* window)
glUseProgram(program);
drawObjectPBR(models::window, glm::mat4(),
textures::windowFrameTexture,
0.2,
0.1
);
drawObjectPBR(models::potPlant, glm::mat4(),
textures::potPlantTexture,
0.3f,
0.2f
);
drawObjectPBR(models::officeChair, glm::mat4(),
textures::officeChariTexture,
0.2f,
0.0f
);
drawObjectPBR(models::lamp, glm::mat4(),
textures::lampTexture,
0.3f,
0.0f
);
drawObjectPBR(models::door, glm::mat4(),
textures::doorTexture,
0.4f,
0.0f
);
drawObjectPBR(models::desk, glm::mat4(),
textures::deskTexture,
0.4f,
0.0f
);
drawObjectPBR(models::ceilingLamp, glm::mat4(),
textures::ceilingLampTexture,
0.2f,
0.0f
);
drawObjectPBR(models::bed, glm::mat4(),
textures::bedTexture,
0.3f,
0.0f
);
drawObjectPBR(models::windowFrame, glm::mat4(),
textures::windowFrameTexture,
0.2f,
@ -265,18 +308,6 @@ void renderScene(GLFWwindow* window)
0.4f,
0.1f);
//drawObjectPBR(models::bedContext, glm::mat4(), 0.2f, 0.0f);
//drawObjectPBR(models::chairContext, glm::mat4(), 0.4f, 0.0f);
//drawObjectPBR(models::deskContext, glm::mat4(), 0.2f, 0.0f);
//drawObjectPBR(models::doorContext, glm::mat4(), 0.2f, 0.0f);
//drawObjectPBR(models::drawerContext, glm::mat4(), 0.2f, 0.0f);
//drawObjectPBR(models::marbleBustContext, glm::mat4(), 0.5f, 1.0f);
//drawObjectPBR(models::materaceContext, glm::mat4(), 0.8f, 0.0f);
//drawObjectPBR(models::pencilsContext, glm::mat4(), 0.1f, 0.0f);
//drawObjectPBR(models::planeContext, glm::mat4(), 0.2f, 0.0f);
//drawObjectPBR(models::roomContext, glm::mat4(), 0.8f, 0.0f);
//drawObjectPBR(models::windowContext, glm::mat4(), 0.2f, 0.0f);
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
@ -357,19 +388,8 @@ void init(GLFWwindow* window)
loadModelToContext("./models/sphere.obj", sphereContext);
loadModelToContext("./models/spaceship.obj", shipContext);
loadModelToContext("./models/bed.obj", models::bedContext);
loadModelToContext("./models/chair.obj", models::chairContext);
loadModelToContext("./models/desk.obj", models::deskContext);
loadModelToContext("./models/door.obj", models::doorContext);
loadModelToContext("./models/drawer.obj", models::drawerContext);
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
loadModelToContext("./models/materace.obj", models::materaceContext);
loadModelToContext("./models/pencils.obj", models::pencilsContext);
loadModelToContext("./models/plane.obj", models::planeContext);
loadModelToContext("./models/room.obj", models::roomContext);
loadModelToContext("./models/spaceship.obj", models::spaceshipContext);
loadModelToContext("./models/sphere.obj", models::sphereContext);
loadModelToContext("./models/window.obj", models::windowContext);
loadModelToContext("./models2/Frame/Frame.obj", models::windowFrame);
loadModelToContext("./models2/bookshelf/shelf.obj", models::bookShelf);