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; int WIDTH = 500, HEIGHT = 500;
namespace models { 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 spaceshipContext;
Core::RenderContext sphereContext; Core::RenderContext sphereContext;
Core::RenderContext windowContext;
Core::RenderContext testContext;
Core::RenderContext windowFrame; Core::RenderContext windowFrame;
Core::RenderContext bookShelf; 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 { namespace textures {
GLuint sunTexture; GLuint sunTexture;
GLuint windowFrameTexture; GLuint windowFrameTexture;
GLuint bookShelfTexture; GLuint bookShelfTexture;
GLuint potPlantTexture;
GLuint officeChariTexture;
GLuint lampTexture;
GLuint doorTexture;
GLuint deskTexture;
GLuint ceilingLampTexture;
GLuint bedTexture;
} }
GLuint depthMapFBO; GLuint depthMapFBO;
@ -197,39 +200,39 @@ void renderShadowapSun() {
drawObjectDepth(sphereContext, drawObjectDepth(sphereContext,
lightVP, 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))); 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, //drawObjectDepth(models::bedContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::chairContext, //drawObjectDepth(models::chairContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::deskContext, //drawObjectDepth(models::deskContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::doorContext, //drawObjectDepth(models::doorContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::drawerContext, //drawObjectDepth(models::drawerContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::marbleBustContext, //drawObjectDepth(models::marbleBustContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::materaceContext, //drawObjectDepth(models::materaceContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::pencilsContext, //drawObjectDepth(models::pencilsContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::planeContext, //drawObjectDepth(models::planeContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::roomContext, //drawObjectDepth(models::roomContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
drawObjectDepth(models::windowContext, //drawObjectDepth(models::windowContext,
lightVP, // lightVP,
glm::mat4()); // glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
@ -256,6 +259,46 @@ void renderScene(GLFWwindow* window)
glUseProgram(program); 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(), drawObjectPBR(models::windowFrame, glm::mat4(),
textures::windowFrameTexture, textures::windowFrameTexture,
0.2f, 0.2f,
@ -265,18 +308,6 @@ void renderScene(GLFWwindow* window)
0.4f, 0.4f,
0.1f); 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 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir)); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({ glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
@ -357,19 +388,8 @@ void init(GLFWwindow* window)
loadModelToContext("./models/sphere.obj", sphereContext); loadModelToContext("./models/sphere.obj", sphereContext);
loadModelToContext("./models/spaceship.obj", shipContext); 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/spaceship.obj", models::spaceshipContext);
loadModelToContext("./models/sphere.obj", models::sphereContext); loadModelToContext("./models/sphere.obj", models::sphereContext);
loadModelToContext("./models/window.obj", models::windowContext);
loadModelToContext("./models2/Frame/Frame.obj", models::windowFrame); loadModelToContext("./models2/Frame/Frame.obj", models::windowFrame);
loadModelToContext("./models2/bookshelf/shelf.obj", models::bookShelf); loadModelToContext("./models2/bookshelf/shelf.obj", models::bookShelf);