diff --git a/models2/room/smallerWall.mtl b/models2/room/smallerWall.mtl new file mode 100644 index 0000000..108bc29 --- /dev/null +++ b/models2/room/smallerWall.mtl @@ -0,0 +1,12 @@ +# Blender 3.4.1 MTL File: 'untitled.blend' +# www.blender.org + +newmtl Material.002 +Ns 250.000000 +Ka 1.000000 1.000000 1.000000 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 +map_Kd smallerWall.png diff --git a/models2/room/smallerWall.obj b/models2/room/smallerWall.obj new file mode 100644 index 0000000..18bc68b --- /dev/null +++ b/models2/room/smallerWall.obj @@ -0,0 +1,16 @@ +# Blender 3.4.1 +# www.blender.org +mtllib smallerWall.mtl +o Plane +v -2.000000 0.000000 -0.000000 +v 2.000000 0.000000 -0.000000 +v -2.000000 2.600000 0.000000 +v 2.000000 2.600000 0.000000 +vn -0.0000 -0.0000 1.0000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.000000 1.000000 +vt 1.000000 1.000000 +s 0 +usemtl Material.002 +f 1/1/1 2/2/1 4/4/1 3/3/1 diff --git a/models2/room/smallerWall.png b/models2/room/smallerWall.png new file mode 100644 index 0000000..23a0d11 Binary files /dev/null and b/models2/room/smallerWall.png differ diff --git a/models2/room/smallerWall_ww.mtl b/models2/room/smallerWall_ww.mtl new file mode 100644 index 0000000..108bc29 --- /dev/null +++ b/models2/room/smallerWall_ww.mtl @@ -0,0 +1,12 @@ +# Blender 3.4.1 MTL File: 'untitled.blend' +# www.blender.org + +newmtl Material.002 +Ns 250.000000 +Ka 1.000000 1.000000 1.000000 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 +map_Kd smallerWall.png diff --git a/models2/room/smallerWall_ww.obj b/models2/room/smallerWall_ww.obj new file mode 100644 index 0000000..6c024ed --- /dev/null +++ b/models2/room/smallerWall_ww.obj @@ -0,0 +1,47 @@ +# Blender 3.4.1 +# www.blender.org +mtllib smallerWall_ww.mtl +o Plane +v -2.000000 0.000000 -0.000000 +v 2.000000 0.000000 -0.000000 +v -2.000000 2.600000 0.000000 +v 2.000000 2.600000 0.000000 +v -0.292093 2.600000 0.000000 +v 1.727409 2.600000 0.000000 +v -0.292093 0.000000 -0.000000 +v 1.727409 0.000000 -0.000000 +v -2.000000 2.284286 0.000000 +v 2.000000 2.284286 0.000000 +v -0.292093 2.284286 0.000000 +v 1.727409 2.284286 0.000000 +v -2.000000 1.054286 -0.000000 +v 2.000000 1.054286 -0.000000 +v -0.292093 1.054286 -0.000000 +v 1.727409 1.054286 -0.000000 +vn -0.0000 -0.0000 1.0000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.000000 1.000000 +vt 1.000000 1.000000 +vt 0.512748 1.000000 +vt 0.846081 1.000000 +vt 0.512748 0.000000 +vt 0.846081 0.000000 +vt 0.000000 0.878571 +vt 1.000000 0.878571 +vt 0.512748 0.878571 +vt 0.846081 0.878571 +vt 0.000000 0.405494 +vt 1.000000 0.405495 +vt 0.512748 0.405495 +vt 0.846081 0.405495 +s 0 +usemtl Material.002 +f 12/12/1 10/10/1 4/4/1 6/6/1 +f 9/9/1 11/11/1 5/5/1 3/3/1 +f 11/11/1 12/12/1 6/6/1 5/5/1 +f 13/13/1 15/15/1 11/11/1 9/9/1 +f 16/16/1 14/14/1 10/10/1 12/12/1 +f 8/8/1 2/2/1 14/14/1 16/16/1 +f 1/1/1 7/7/1 15/15/1 13/13/1 +f 7/7/1 8/8/1 16/16/1 15/15/1 diff --git a/models2/window/untitled.blend b/models2/window/untitled.blend index 1cc80be..1a3b44c 100644 Binary files a/models2/window/untitled.blend and b/models2/window/untitled.blend differ diff --git a/models2/window/untitled.blend1 b/models2/window/untitled.blend1 index 56acd5b..a87c01b 100644 Binary files a/models2/window/untitled.blend1 and b/models2/window/untitled.blend1 differ diff --git a/src/ex_9_1.hpp b/src/ex_9_1.hpp index da417a9..6689b21 100644 --- a/src/ex_9_1.hpp +++ b/src/ex_9_1.hpp @@ -39,6 +39,8 @@ namespace models { Core::RenderContext carpet; Core::RenderContext roof; Core::RenderContext longerWall; + Core::RenderContext smallerWall; + Core::RenderContext smallerWall_ww; } namespace textures { GLuint floorTexture; @@ -56,6 +58,7 @@ namespace textures { GLuint carpetTexture; GLuint roofTexture; GLuint longerWallTexture; + GLuint smallerWallTexture; } GLuint depthMapFBO; @@ -91,7 +94,8 @@ Core::RenderContext sphereContext; glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, 0.369280f); glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f); -glm::vec3 sunColor = glm::vec3(0.9f, 0.9f, 0.7f)*5; +glm::vec3 sunColor = glm::vec3(0.9f, 0.9f, 0.7f); + glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f); glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f); @@ -103,7 +107,7 @@ GLuint VAO,VBO; float aspectRatio = 1.f; -float exposition = 1.f; +float exposition = 4.f; glm::vec3 pointlightPos = glm::vec3(0, 2, 0); glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6); @@ -274,14 +278,14 @@ void renderScene(GLFWwindow* window) updateDeltaTime(time); renderShadowapSun(); - //space lamp - //glUseProgram(programSun); - //glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - //glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)); - //glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation); - //glUniform3f(glGetUniformLocation(programSun, "color"), sunColor.x / 2, sunColor.y / 2, sunColor.z / 2); - //glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition); - //Core::DrawContext(sphereContext); + /*space lamp*/ + glUseProgram(programSun); + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)); + glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation); + glUniform3f(glGetUniformLocation(programSun, "color"), sunColor.x, sunColor.y, sunColor.z); + glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition); + Core::DrawContext(sphereContext); glUseProgram(program); @@ -302,17 +306,32 @@ void renderScene(GLFWwindow* window) textures::longerWallTexture, 0, 0); - //drawObjectPBR(models::carpet, glm::mat4() * glm::scale(glm::vec3(3)), - // textures::carpetTexture, - // 0, - // 0 - //); - - //drawObjectPBR(models::window, glm::mat4(), - // textures::windowFrameTexture, - // 0.2, - // 0.1 - //); + glm::mat4 model = glm::mat4() * glm::translate(glm::vec3(2.5, 0, 0)); + model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0)); + drawObjectPBR(models::smallerWall, model, + textures::longerWallTexture, + 0, + 0 + ); + model = glm::mat4() * glm::translate(glm::vec3(-2.5, 0, 0)); + model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0)); + drawObjectPBR(models::smallerWall_ww, model, + textures::longerWallTexture, + 0, + 0 + ); + drawObjectPBR(models::carpet, glm::mat4() * glm::translate(glm::vec3(0.0 ,0.01 ,0.9)), + textures::carpetTexture, + 0, + 0 + ); + model = glm::mat4() * glm::translate(glm::vec3(-2.5, 1.5, -0.5)) * glm::scale(glm::vec3(0.4)); + model = glm::rotate(model, glm::radians(90.0f), glm::vec3(0, 1, 0)); + drawObjectPBR(models::window, model, + textures::windowFrameTexture, + 0.2, + 0.1 + ); //drawObjectPBR(models::potPlant, glm::mat4() * glm::scale(glm::vec3(0.2f)) * glm::translate(glm::vec3(-5.0f, 55.0f, -6.0f)), // textures::potPlantTexture, // 1.0f, @@ -455,6 +474,9 @@ void init(GLFWwindow* window) loadModelToContext("./models2/room/floor.obj", models::floor); loadModelToContext("./models2/room/floor.obj", models::roof); loadModelToContext("./models2/room/longerWall.obj", models::longerWall); + loadModelToContext("./models2/room/smallerWall.obj", models::smallerWall); + loadModelToContext("./models2/room/smallerWall_ww.obj", models::smallerWall_ww); + textures::floorTexture = Core::LoadTexture("./models2/room/wood.png"); textures::flashlightTexture = Core::LoadTexture("./models/FlashlightTexture.png"); @@ -472,6 +494,7 @@ void init(GLFWwindow* window) textures::carpetTexture = Core::LoadTexture("./models2/carpet/1251.jpg"); textures::roofTexture = Core::LoadTexture("./models2/room/roof.png"); textures::longerWallTexture = Core::LoadTexture("./models2/room/longerWall.png"); + textures::longerWallTexture = Core::LoadTexture("./models2/room/smallerWall.png"); } void shutdown(GLFWwindow* window)