Added Depth to models

This commit is contained in:
Aleksander Burkowski 2023-01-31 20:57:26 +01:00
parent 3fb7803413
commit 43a38c9c6d

View File

@ -263,47 +263,105 @@ void renderShadowapSun() {
glUseProgram(programDepth);
glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0));
/* 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::scale(glm::vec3(0.3f)));
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());
glm::mat4 model;
drawObjectDepth(models::floor,
lightVP,
glm::mat4());
model = glm::mat4() * glm::translate(glm::vec3(0, 2.6, 0));
drawObjectDepth(models::roof,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(0, 0, -2));
drawObjectDepth(models::longerWall,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(0, 0, 2));
model = glm::rotate(model, glm::radians(180.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::longerWall_d,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(2.5, 0, 0));
model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::smallerWall,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(-2.5, 0, 0));
model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::smallerWall_ww,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(0.0, 0.01, 0.9));
drawObjectDepth(models::carpet,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(-2.5, 0.99, -0.75)) * glm::scale(glm::vec3(0.36, 0.34, 0.36));
model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::window,
lightVP,
model);
model = glm::mat4();
model = glm::scale(glm::vec3(0.5f)) * translate(glm::vec3(0.8f, 0.0f, -3.0f));
model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::cabinet,
lightVP,
model);
model = glm::mat4();
model = glm::scale(glm::vec3(0.15f)) * glm::translate(glm::vec3(2.3f, 5.0f, -10.6f));
drawObjectDepth(models::potPlant,
lightVP,
model);
model = glm::mat4(1.0f);
model = glm::scale(glm::vec3(0.5f)) * glm::translate(glm::vec3(-2.65f, 0.0f, -1.65f));
model = glm::rotate(model, glm::radians(180.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::officeChair,
lightVP,
model);
model = glm::mat4();
model = glm::translate(glm::vec3(-0.7f, 0.75f, -1.7f)) * glm::scale(glm::vec3(0.001f));
drawObjectDepth(models::lamp,
lightVP,
model);
model = glm::mat4(1.0f) * glm::translate(glm::vec3(1.7f, 1.15f, 2.0f));
model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0.0, 1.0, 0.0)) * glm::scale(glm::vec3(1.0f, 1.1f, 1.3f));
drawObjectDepth(models::door,
lightVP,
model);
model = glm::mat4(1.0f) * glm::translate(glm::vec3(-2.2f, 0.38f, -1.5f));
drawObjectDepth(models::desk,
lightVP,
model);
model = glm::mat4(1.0f);
model = glm::scale(glm::vec3(0.4f)) * glm::translate(glm::vec3(0.0f, 3.6f, 0.0f));
drawObjectDepth(models::ceilingLamp,
lightVP,
model);
model = glm::mat4(1.0f) * glm::translate(glm::vec3(1.6f, 0.0f, -0.86f)) * glm::scale(glm::vec3(0.8f));
model = glm::rotate(model, glm::radians(270.0f), glm::vec3(0.0f, 1.0f, 0.0f));
drawObjectDepth(models::bed,
lightVP,
model);
model = glm::mat4() * glm::translate(glm::vec3(-1.8f, -0.2f, 2.15f)) * glm::scale(glm::vec3(0.015));
model = glm::rotate(model, glm::radians(180.0f), glm::vec3(0, 1, 0));
drawObjectDepth(models::bookShelf,
lightVP,
model);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT);