diff --git a/Release/grk-cw9.exe b/Release/grk-cw9.exe index 3578659..2f89c2e 100644 Binary files a/Release/grk-cw9.exe and b/Release/grk-cw9.exe differ diff --git a/Release/grk-cw9.pdb b/Release/grk-cw9.pdb index 1ccf5f5..cd714de 100644 Binary files a/Release/grk-cw9.pdb and b/Release/grk-cw9.pdb differ diff --git a/cw 9/Release/grk-cw9.iobj b/cw 9/Release/grk-cw9.iobj index 02ca801..749c99f 100644 Binary files a/cw 9/Release/grk-cw9.iobj and b/cw 9/Release/grk-cw9.iobj differ diff --git a/cw 9/Release/grk-cw9.ipdb b/cw 9/Release/grk-cw9.ipdb index cb9821f..7ab8499 100644 Binary files a/cw 9/Release/grk-cw9.ipdb and b/cw 9/Release/grk-cw9.ipdb differ diff --git a/cw 9/Release/grk-cw9.log b/cw 9/Release/grk-cw9.log index dbe4f7f..57910a9 100644 --- a/cw 9/Release/grk-cw9.log +++ b/cw 9/Release/grk-cw9.log @@ -9,50 +9,61 @@ C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(100,9): wa C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(101,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(111,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(115,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(234,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(248,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(273,38): warning C4305: "=": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(302,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(479,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(495,98): warning C4305: "argument": obcięcie z "double" do "T" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(270,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(284,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(309,38): warning C4305: "=": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(338,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(527,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(541,98): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(498,68): warning C4305: "argument": obcięcie z "double" do "T" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(544,68): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(591,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(599,108): warning C4305: "argument": obcięcie z "double" do "T" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(576,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(590,99): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(607,87): warning C4305: "argument": obcięcie z "double" do "T" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(593,69): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(607,223): warning C4305: "argument": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(610,59): warning C4305: "argument": obcięcie z "double" do "T" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(685,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(694,108): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(611,37): warning C4305: "argument": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(643,2): warning C4305: "argument": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(738,108): warning C4305: "argument": obcięcie z "double" do "T" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(702,87): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(961,21): warning C4305: "-=": obcięcie z "double" do "float" -C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(963,21): warning C4305: "+=": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(702,223): warning C4305: "argument": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(705,59): warning C4305: "argument": obcięcie z "double" do "T" + with + [ + T=float + ] +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(706,37): warning C4305: "argument": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(726,2): warning C4305: "argument": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(825,108): warning C4305: "argument": obcięcie z "double" do "T" + with + [ + T=float + ] +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(1088,21): warning C4305: "-=": obcięcie z "double" do "float" +C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(1090,21): warning C4305: "+=": obcięcie z "double" do "float" Trwa generowanie kodu - 1 of 676 functions ( 0.1%) were compiled, the rest were copied from previous compilation. + 2 of 687 functions ( 0.3%) were compiled, the rest were copied from previous compilation. 0 functions were new in current compilation - 7 functions had inline decision re-evaluated but remain unchanged + 10 functions had inline decision re-evaluated but remain unchanged Zakończono generowanie kodu grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\graf\GRK_Project\Release\grk-cw9.exe diff --git a/cw 9/Release/grk-cw9.tlog/link.read.1.tlog b/cw 9/Release/grk-cw9.tlog/link.read.1.tlog index c8f9ec8..1e885c7 100644 Binary files a/cw 9/Release/grk-cw9.tlog/link.read.1.tlog and b/cw 9/Release/grk-cw9.tlog/link.read.1.tlog differ diff --git a/cw 9/Release/main.obj b/cw 9/Release/main.obj index 7930051..964b711 100644 Binary files a/cw 9/Release/main.obj and b/cw 9/Release/main.obj differ diff --git a/cw 9/shaders/shader_9_1.frag b/cw 9/shaders/shader_9_1.frag index 69bea75..76aa573 100644 --- a/cw 9/shaders/shader_9_1.frag +++ b/cw 9/shaders/shader_9_1.frag @@ -4,12 +4,14 @@ float AMBIENT = 0.03; float PI = 3.14; uniform sampler2D depthMap; +uniform sampler2D depthMap2; uniform vec3 cameraPos; uniform vec3 color; uniform vec3 sunDir; +uniform vec3 sunDir2; uniform vec3 sunColor; uniform vec3 lightPos; @@ -38,6 +40,7 @@ in vec3 sunDirTS; in vec3 test; in vec4 sunSpacePos; +in vec4 sunSpacePos2; float DistributionGGX(vec3 normal, vec3 H, float roughness){ float a = roughness*roughness; @@ -112,6 +115,16 @@ float calculateShadow() { } } +float calculateShadow2() { + + vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5; + + float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x; + + float diff = (0.001+closestDepth) - sunSpacePosNormalized.z; + + return (0.5*(diff)/abs(diff))+0.5; +} void main() { @@ -142,6 +155,8 @@ void main() //sun ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir); + //sun2 + ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir); outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); //outColor = vec4(roughness,metallic,0,1); diff --git a/cw 9/shaders/shader_9_1.vert b/cw 9/shaders/shader_9_1.vert index 58c4888..ffce73c 100644 --- a/cw 9/shaders/shader_9_1.vert +++ b/cw 9/shaders/shader_9_1.vert @@ -9,6 +9,7 @@ layout(location = 4) in vec3 vertexBitangent; uniform mat4 transformation; uniform mat4 modelMatrix; uniform mat4 LightVP; +uniform mat4 LightVP2; out vec3 vecNormal; out vec3 worldPos; @@ -23,6 +24,7 @@ out vec3 lightDirTS; out vec3 spotlightDirTS; out vec3 sunDirTS; out vec4 sunSpacePos; +out vec4 sunSpacePos2; void main() { @@ -42,4 +44,5 @@ void main() spotlightDirTS = TBN*SL; sunDirTS = TBN*sunDir; sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1); + sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1); } diff --git a/cw 9/shaders/shader_tex.frag b/cw 9/shaders/shader_tex.frag index 0fe13d3..0b9b88c 100644 --- a/cw 9/shaders/shader_tex.frag +++ b/cw 9/shaders/shader_tex.frag @@ -4,12 +4,14 @@ float AMBIENT = 0.03; float PI = 3.14; uniform sampler2D depthMap; +uniform sampler2D depthMap2; uniform vec3 cameraPos; uniform sampler2D colorTexture; uniform vec3 sunDir; +uniform vec3 sunDir2; uniform vec3 sunColor; uniform vec3 lightPos; @@ -39,6 +41,7 @@ in vec3 spotlightDirTS; in vec3 sunDirTS; in vec4 sunSpacePos; +in vec4 sunSpacePos2; vec3 color; @@ -114,6 +117,16 @@ float calculateShadow() { return (0.5*(diff)/abs(diff))+0.5; } +float calculateShadow2() { + + vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5; + + float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x; + + float diff = (0.001+closestDepth) - sunSpacePosNormalized.z; + + return (0.5*(diff)/abs(diff))+0.5; +} void main() { @@ -148,6 +161,8 @@ void main() //ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir); ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir); + //sun2 + ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir); outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); } \ No newline at end of file diff --git a/cw 9/shaders/shader_tex.vert b/cw 9/shaders/shader_tex.vert index 05f1647..869afa1 100644 --- a/cw 9/shaders/shader_tex.vert +++ b/cw 9/shaders/shader_tex.vert @@ -9,6 +9,7 @@ layout(location = 4) in vec3 vertexBitangent; uniform mat4 transformation; uniform mat4 modelMatrix; uniform mat4 LightVP; +uniform mat4 LightVP2; out vec3 vecNormal; out vec3 worldPos; @@ -24,6 +25,8 @@ out vec3 spotlightDirTS; out vec3 sunDirTS; out vec2 vecTex; out vec4 sunSpacePos; +out vec4 sunSpacePos2; + void main() { @@ -46,5 +49,6 @@ void main() spotlightDirTS = TBN*SL; sunDirTS = TBN*sunDir; sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1); + sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1); } \ No newline at end of file diff --git a/cw 9/shaders/shader_tex_pbr.frag b/cw 9/shaders/shader_tex_pbr.frag index 4246280..ae5561e 100644 --- a/cw 9/shaders/shader_tex_pbr.frag +++ b/cw 9/shaders/shader_tex_pbr.frag @@ -8,6 +8,7 @@ float PI = 3.14; uniform vec3 cameraPos; uniform sampler2D depthMap; +uniform sampler2D depthMap2; uniform sampler2D colorTexture; uniform sampler2D metallicTexture; uniform sampler2D roughnessTexture; @@ -15,6 +16,7 @@ uniform sampler2D aoTexture; uniform sampler2D normalSampler; uniform vec3 sunDir; +uniform vec3 sunDir2; uniform vec3 sunColor; uniform vec3 lightPos; @@ -46,6 +48,7 @@ float metallic; float roughness; in vec4 sunSpacePos; +in vec4 sunSpacePos2; float DistributionGGX(vec3 normal, vec3 H, float roughness){ @@ -119,6 +122,17 @@ float calculateShadow() { return (0.5*(diff)/abs(diff))+0.5; } +float calculateShadow2() { + + vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5; + + float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x; + + float diff = (0.001+closestDepth) - sunSpacePosNormalized.z; + + return (0.5*(diff)/abs(diff))+0.5; +} + void main() { @@ -157,6 +171,9 @@ void main() //sun //ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir); ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir); - + //outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); + + //sun2 + ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir); outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); } \ No newline at end of file diff --git a/cw 9/shaders/shader_tex_pbr.vert b/cw 9/shaders/shader_tex_pbr.vert index 4258289..7485d32 100644 --- a/cw 9/shaders/shader_tex_pbr.vert +++ b/cw 9/shaders/shader_tex_pbr.vert @@ -9,6 +9,7 @@ layout(location = 4) in vec3 vertexBitangent; uniform mat4 transformation; uniform mat4 modelMatrix; uniform mat4 LightVP; +uniform mat4 LightVP2; out vec3 vecNormal; out vec3 worldPos; @@ -24,6 +25,8 @@ out vec3 spotlightDirTS; out vec3 sunDirTS; out vec2 vecTex; out vec4 sunSpacePos; +out vec4 sunSpacePos2; + void main() { @@ -45,5 +48,6 @@ void main() spotlightDirTS = TBN*SL; sunDirTS = TBN*sunDir; sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1); + sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1); } diff --git a/cw 9/shaders/shader_tex_pbr_arm.frag b/cw 9/shaders/shader_tex_pbr_arm.frag index 2d440a8..bf8dfbf 100644 --- a/cw 9/shaders/shader_tex_pbr_arm.frag +++ b/cw 9/shaders/shader_tex_pbr_arm.frag @@ -8,11 +8,13 @@ float PI = 3.14; uniform vec3 cameraPos; uniform sampler2D depthMap; +uniform sampler2D depthMap2; uniform sampler2D colorTexture; uniform sampler2D armTexture; uniform sampler2D normalSampler; uniform vec3 sunDir; +uniform vec3 sunDir2; uniform vec3 sunColor; uniform vec3 lightPos; @@ -44,6 +46,7 @@ float metallic; float roughness; in vec4 sunSpacePos; +in vec4 sunSpacePos2; float DistributionGGX(vec3 normal, vec3 H, float roughness){ @@ -118,6 +121,17 @@ float calculateShadow() { } +float calculateShadow2() { + + vec4 sunSpacePosNormalized = (0.5 * sunSpacePos2 / (sunSpacePos2.w)) + 0.5; + + float closestDepth = texture2D(depthMap2, sunSpacePosNormalized.xy).x; + + float diff = (0.001+closestDepth) - sunSpacePosNormalized.z; + + return (0.5*(diff)/abs(diff))+0.5; +} + void main() { color = texture2D(colorTexture, vecTex).xyz; @@ -155,6 +169,9 @@ void main() //sun //ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir); ilumination=ilumination+PBRLight(sunDir, sunColor * calculateShadow(), normal, viewDir); + + //sun2 + ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir); outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); } \ No newline at end of file diff --git a/cw 9/shaders/shader_tex_pbr_arm.vert b/cw 9/shaders/shader_tex_pbr_arm.vert index 4258289..53d5f74 100644 --- a/cw 9/shaders/shader_tex_pbr_arm.vert +++ b/cw 9/shaders/shader_tex_pbr_arm.vert @@ -9,6 +9,7 @@ layout(location = 4) in vec3 vertexBitangent; uniform mat4 transformation; uniform mat4 modelMatrix; uniform mat4 LightVP; +uniform mat4 LightVP2; out vec3 vecNormal; out vec3 worldPos; @@ -24,6 +25,7 @@ out vec3 spotlightDirTS; out vec3 sunDirTS; out vec2 vecTex; out vec4 sunSpacePos; +out vec4 sunSpacePos2; void main() { @@ -45,5 +47,6 @@ void main() spotlightDirTS = TBN*SL; sunDirTS = TBN*sunDir; sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1); + sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1); } diff --git a/cw 9/sound/ocean.wav b/cw 9/sound/ocean.wav new file mode 100644 index 0000000..37a816e Binary files /dev/null and b/cw 9/sound/ocean.wav differ diff --git a/cw 9/src/ex_9_1.hpp b/cw 9/src/ex_9_1.hpp index e0c3b98..0272ade 100644 --- a/cw 9/src/ex_9_1.hpp +++ b/cw 9/src/ex_9_1.hpp @@ -20,7 +20,7 @@ const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024; -int WIDTH = 500, HEIGHT = 500; +int WIDTH = 1000, HEIGHT = 1000; CollisionSystem collisionSystem; @@ -73,6 +73,11 @@ namespace models { Core::RenderContext laptopContext; Core::RenderContext screenContext; + Core::RenderContext mugContext; + Core::RenderContext carContext; + Core::RenderContext books1Context; + Core::RenderContext books2Context; + Core::RenderContext cactusContext; } std::vector faces = { @@ -186,10 +191,36 @@ namespace texture { GLuint laptop_ao; GLuint laptop_normal; + GLuint mug_albedo; + GLuint mug_metallic; + GLuint mug_roughness; + GLuint mug_ao; + GLuint mug_normal; + + GLuint car_albedo; + GLuint car_metallic; + GLuint car_roughness; + GLuint car_ao; + GLuint car_normal; + + GLuint books_albedo; + GLuint books_metallic; + GLuint books_roughness; + GLuint books_ao; + GLuint books_normal; + + GLuint cactus_albedo; + GLuint cactus_metallic; + GLuint cactus_roughness; + GLuint cactus_ao; + GLuint cactus_normal; + } GLuint depthMapFBO; GLuint depthMap; +GLuint depthMapFBO2; +GLuint depthMap2; GLuint program; GLuint programSun; @@ -211,13 +242,15 @@ TriangleSoup water; glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, -0.069280f); glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f); +glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f); +glm::vec3 sunDir2 = glm::vec3(0.93633f, 0.351106, -0.003226f); glm::vec3 sunColor = glm::vec3(0.9f, 0.9f, 0.7f) * 5; glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f); glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f); -glm::vec3 spaceshipPos = glm::vec3(0.065808f, 1.250000f, -2.189549f); +glm::vec3 spaceshipPos = glm::vec3(0.065808f, 1.250000f, -1.189549f); glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f); GLuint VAO, VBO; @@ -225,6 +258,9 @@ float aspectRatio = 1.f; float exposition = 1.f; +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)); +glm::mat4 lightVP2 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos2, sunPos2 - sunDir2, glm::vec3(0, 1, 0)); + glm::vec3 pointlightPos = glm::vec3(0, 2, 0); glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6); @@ -333,6 +369,7 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec glUniform3f(glGetUniformLocation(program, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z); glUniform3f(glGetUniformLocation(program, "sunDir"), sunDir.x, sunDir.y, sunDir.z); + glUniform3f(glGetUniformLocation(program, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z); glUniform3f(glGetUniformLocation(program, "sunColor"), sunColor.x, sunColor.y, sunColor.z); glUniform3f(glGetUniformLocation(program, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); @@ -343,9 +380,11 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec glUniform3f(glGetUniformLocation(program, "spotlightColor"), spotlightColor.x, spotlightColor.y, spotlightColor.z); glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spotlightPhi); - 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)); + glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVP); Core::SetActiveTexture(depthMap, "depthMap", program, 0); + glUniformMatrix4fv(glGetUniformLocation(program, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); + Core::SetActiveTexture(depthMap2, "depthMap2", program, 1); Core::DrawContext(context); } @@ -367,6 +406,7 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro glUniform3f(glGetUniformLocation(programTex, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z); glUniform3f(glGetUniformLocation(programTex, "sunDir"), sunDir.x, sunDir.y, sunDir.z); + glUniform3f(glGetUniformLocation(programTex, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z); glUniform3f(glGetUniformLocation(programTex, "sunColor"), sunColor.x, sunColor.y, sunColor.z); glUniform3f(glGetUniformLocation(programTex, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); @@ -380,9 +420,11 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro //Core::DrawContext(context); - 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)); + glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP"), 1, GL_FALSE, (float*)&lightVP); Core::SetActiveTexture(depthMap, "depthMap", programTex, 1); + glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); + Core::SetActiveTexture(depthMap2, "depthMap2", programTex, 2); Core::DrawContext(context); } @@ -404,6 +446,7 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin glUniform3f(glGetUniformLocation(programTexPBR, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z); glUniform3f(glGetUniformLocation(programTexPBR, "sunDir"), sunDir.x, sunDir.y, sunDir.z); + glUniform3f(glGetUniformLocation(programTexPBR, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z); glUniform3f(glGetUniformLocation(programTexPBR, "sunColor"), sunColor.x, sunColor.y, sunColor.z); glUniform3f(glGetUniformLocation(programTexPBR, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); @@ -421,9 +464,11 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin //Core::DrawContext(context); - 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)); + glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP"), 1, GL_FALSE, (float*)&lightVP); Core::SetActiveTexture(depthMap, "depthMap", programTexPBR, 0); + glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); + Core::SetActiveTexture(depthMap2, "depthMap2", programTexPBR, 6); Core::DrawContext(context); } @@ -445,6 +490,7 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G glUniform3f(glGetUniformLocation(programTexPBR_ARM, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z); glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir"), sunDir.x, sunDir.y, sunDir.z); + glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z); glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunColor"), sunColor.x, sunColor.y, sunColor.z); glUniform3f(glGetUniformLocation(programTexPBR_ARM, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); @@ -460,9 +506,11 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G //Core::DrawContext(context); - 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)); + glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP"), 1, GL_FALSE, (float*)&lightVP); Core::SetActiveTexture(depthMap, "depthMap", programTexPBR_ARM, 0); + glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); + Core::SetActiveTexture(depthMap2, "depthMap2", programTexPBR_ARM, 4); Core::DrawContext(context); } @@ -490,35 +538,11 @@ void renderShadowapSun() { //ustawianie programu 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))); - /* - drawObjectTexPBR(models::bedContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); - drawObjectTexPBR(models::mattressContext, glm::mat4(), texture::sheets_roughness, texture::sheets_metallic, texture::sheets_albedo, texture::sheets_normal, texture::sheets_ao); - drawObjectTexPBR(models::bed_pillowContext, glm::mat4(), texture::sheets_roughness, texture::sheets_metallic, texture::sheets_albedo, texture::sheets_normal, texture::sheets_ao); - drawObjectTexPBR(models::floorContext, glm::mat4(), texture::floor_roughness, texture::floor_metallic, texture::floor_albedo, texture::floor_normal, texture::floor_ao); - drawObjectTexPBR(models::desk_topContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); - drawObjectTexPBR(models::desk_bottomContext, glm::mat4(), texture::black_metal_roughness, texture::black_metal_metallic, texture::black_metal_albedo, texture::black_metal_normal, texture::black_metal_ao); - drawObjectTexPBR(models::framesContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); - drawObjectTexPBR(models::wallContext, glm::mat4(), texture::white_paint_roughness, texture::white_paint_metallic, texture::white_paint_albedo, texture::white_paint_normal, texture::white_paint_ao); - drawObjectTexPBR(models::foldingContext, glm::mat4(), texture::bamboo_roughness, texture::bamboo_metallic, texture::bamboo_albedo, texture::bamboo_normal, texture::bamboo_ao); - drawObjectTexPBR(models::couchContext, glm::mat4(), texture::couch_roughness, texture::couch_metallic, texture::couch_albedo, texture::couch_normal, texture::couch_ao); - drawObjectTexPBR(models::doorContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); - drawObjectTexPBR(models::chairContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); - drawObjectTexPBR_ARM(models::roofContext, glm::mat4(), texture::wall_albedo, texture::wall_normal, texture::wall_arm); - drawObjectTexPBR_ARM(models::blanketContext, glm::mat4(), texture::blanket_albedo, texture::blanket_normal, texture::blanket_arm); - drawObjectTexPBR_ARM(models::drawerContext, glm::mat4(), texture::drawer_albedo, texture::drawer_normal, texture::drawer_arm); - drawObjectTexPBR_ARM(models::clockContext, glm::mat4(), texture::clock_albedo, texture::clock_normal, texture::clock_arm); - drawObjectTexPBR_ARM(models::plantContext, glm::mat4(), texture::plant_albedo, texture::clock_normal, texture::plant_arm); - drawObjectTexPBR_ARM(models::c_tableContext, glm::mat4(), texture::c_table_albedo, texture::c_table_normal, texture::c_table_arm); - drawObjectTexPBR_ARM(models::vaseContext, glm::mat4(), texture::vase_albedo, texture::vase_normal, texture::vase_arm); - */ - drawObjectDepth(models::bedContext, lightVP, glm::mat4()); drawObjectDepth(models::mattressContext, lightVP, glm::mat4()); drawObjectDepth(models::bed_pillowContext, lightVP, glm::mat4()); @@ -539,10 +563,60 @@ void renderShadowapSun() { drawObjectDepth(models::plantContext, lightVP, glm::mat4()); drawObjectDepth(models::c_tableContext, lightVP, glm::mat4()); drawObjectDepth(models::foldingContext, lightVP, glm::mat4()); + drawObjectDepth(models::mugContext, lightVP, glm::mat4()); + drawObjectDepth(models::carContext, lightVP, glm::mat4()); + drawObjectDepth(models::books1Context, lightVP, glm::mat4()); + drawObjectDepth(models::books2Context, lightVP, glm::mat4()); + drawObjectDepth(models::cactusContext, lightVP, glm::mat4()); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, WIDTH, HEIGHT); +} +void renderShadowapSun2() { + float time = glfwGetTime(); + glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); + //uzupelnij o renderowanie glebokosci do tekstury + glUseProgram(programDepth); + //ustawianie przestrzeni rysowania + glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); + //bindowanie FBO + glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO2); + //czyszczenie mapy głębokości + glClear(GL_DEPTH_BUFFER_BIT); + //ustawianie programu + glUseProgram(programDepth); + drawObjectDepth(sphereContext, lightVP2, 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, + lightVP2, 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, lightVP2, glm::mat4()); + drawObjectDepth(models::mattressContext, lightVP2, glm::mat4()); + drawObjectDepth(models::bed_pillowContext, lightVP2, glm::mat4()); + drawObjectDepth(models::floorContext, lightVP2, glm::mat4()); + drawObjectDepth(models::desk_topContext, lightVP2, glm::mat4()); + drawObjectDepth(models::desk_bottomContext, lightVP2, glm::mat4()); + drawObjectDepth(models::framesContext, lightVP2, glm::mat4()); + drawObjectDepth(models::wallContext, lightVP2, glm::mat4()); + drawObjectDepth(models::foldingContext, lightVP2, glm::mat4()); + drawObjectDepth(models::couchContext, lightVP2, glm::mat4()); + drawObjectDepth(models::laptopContext, lightVP2, glm::mat4()); + drawObjectDepth(models::doorContext, lightVP2, glm::mat4()); + drawObjectDepth(models::chairContext, lightVP2, glm::mat4()); + drawObjectDepth(models::roofContext, lightVP2, glm::mat4()); + drawObjectDepth(models::blanketContext, lightVP2, glm::mat4()); + drawObjectDepth(models::drawerContext, lightVP2, glm::mat4()); + drawObjectDepth(models::clockContext, lightVP2, glm::mat4()); + drawObjectDepth(models::plantContext, lightVP2, glm::mat4()); + drawObjectDepth(models::c_tableContext, lightVP2, glm::mat4()); + drawObjectDepth(models::foldingContext, lightVP2, glm::mat4()); + drawObjectDepth(models::mugContext, lightVP2, glm::mat4()); + drawObjectDepth(models::carContext, lightVP2, glm::mat4()); + drawObjectDepth(models::books1Context, lightVP2, glm::mat4()); + drawObjectDepth(models::books2Context, lightVP2, glm::mat4()); + drawObjectDepth(models::cactusContext, lightVP2, glm::mat4()); glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, WIDTH, HEIGHT); } @@ -567,6 +641,26 @@ void initDepthMap() glBindFramebuffer(GL_FRAMEBUFFER, 0); } +void initDepthMap2() +{ + glGenFramebuffers(1, &depthMapFBO2); + + glGenTextures(1, &depthMap2); + glBindTexture(GL_TEXTURE_2D, depthMap2); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, + SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO2); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap2, 0); + glDrawBuffer(GL_NONE); + glReadBuffer(GL_NONE); + glBindFramebuffer(GL_FRAMEBUFFER, 0); +} + void drawObjectColorWater(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float time, GLuint textureID) { glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * glm::mat4(glm::mat3(createCameraMatrix())); @@ -592,6 +686,7 @@ void renderScene(GLFWwindow* window) updateDeltaTime(time); renderShadowapSun(); + renderShadowapSun2(); //space lamp glUseProgram(programSun); @@ -610,18 +705,6 @@ void renderScene(GLFWwindow* window) 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::vec3(0.5, 0.5, 0.5), 0.7, 0.0); - //drawObjectPBR(models::bedContext, glm::mat4(), glm::vec3(0.03f, 0.03f, 0.03f), 0.2f, 0.0f); - //drawObjectPBR(models::chairContext, glm::mat4(), glm::vec3(0.195239f, 0.37728f, 0.8f), 0.4f, 0.0f); - //drawObjectPBR(models::deskContext, glm::mat4(), glm::vec3(0.428691f, 0.08022f, 0.036889f), 0.2f, 0.0f); - //drawObjectPBR(models::doorContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); - //drawObjectPBR(models::drawerContext, glm::mat4(), glm::vec3(0.428691f, 0.08022f, 0.036889f), 0.2f, 0.0f); - //drawObjectPBR(models::marbleBustContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f); - //drawObjectPBR(models::materaceContext, glm::mat4(), glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f); - //drawObjectPBR(models::pencilsContext, glm::mat4(), glm::vec3(0.10039f, 0.018356f, 0.001935f), 0.1f, 0.0f); - //drawObjectPBR(models::planeContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); - //drawObjectPBR(models::roomContext, glm::mat4(), glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f); - //drawObjectPBR(models::windowContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 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({ @@ -667,7 +750,11 @@ void renderScene(GLFWwindow* window) drawObjectTexPBR(models::doorContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); drawObjectTexPBR(models::chairContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); drawObjectTexPBR(models::laptopContext, glm::mat4(), texture::laptop_roughness, texture::laptop_metallic, texture::laptop_albedo, texture::laptop_normal, texture::laptop_ao); - + drawObjectTexPBR(models::mugContext, glm::mat4(), texture::mug_roughness, texture::mug_metallic, texture::mug_albedo, texture::mug_normal, texture::mug_ao); + drawObjectTexPBR(models::carContext, glm::mat4(), texture::car_roughness, texture::car_metallic, texture::car_albedo, texture::car_normal, texture::car_ao); + drawObjectTexPBR(models::cactusContext, glm::mat4(), texture::cactus_roughness, texture::cactus_metallic, texture::cactus_albedo, texture::cactus_normal, texture::cactus_ao); + drawObjectTexPBR(models::books1Context, glm::mat4(), texture::books_roughness, texture::books_metallic, texture::books_albedo, texture::books_normal, texture::books_ao); + drawObjectTexPBR(models::books2Context, glm::mat4(), texture::books_roughness, texture::books_metallic, texture::books_albedo, texture::books_normal, texture::books_ao); @@ -738,6 +825,8 @@ void init(GLFWwindow* window) glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); initDepthMap(); + initDepthMap2(); + PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP); glEnable(GL_DEPTH_TEST); program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag"); programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag"); @@ -855,6 +944,30 @@ void init(GLFWwindow* window) texture::laptop_normal = Core::LoadTexture("textures/laptop/normal.png"); texture::screen = Core::LoadTexture("textures/visual.png"); + texture::mug_albedo = Core::LoadTexture("textures/mug/albedo.png"); + texture::mug_metallic = Core::LoadTexture("textures/mug/metallic.png"); + texture::mug_roughness = Core::LoadTexture("textures/mug/roughness.png"); + texture::mug_ao = Core::LoadTexture("textures/mug/ao.png"); + texture::mug_normal = Core::LoadTexture("textures/mug/normal.png"); + + texture::car_albedo = Core::LoadTexture("textures/car/albedo.jpg"); + texture::car_metallic = Core::LoadTexture("textures/car/metallic.jpg"); + texture::car_roughness = Core::LoadTexture("textures/car/roughness.jpg"); + texture::car_ao = Core::LoadTexture("textures/car/ao.jpg"); + texture::car_normal = Core::LoadTexture("textures/car/normal.jpg"); + + texture::books_albedo = Core::LoadTexture("textures/books/albedo.png"); + texture::books_metallic = Core::LoadTexture("textures/books/metallic.png"); + texture::books_roughness = Core::LoadTexture("textures/books/roughness.png"); + texture::books_ao = Core::LoadTexture("textures/books/ao.png"); + texture::books_normal = Core::LoadTexture("textures/books/normal.png"); + + texture::cactus_albedo = Core::LoadTexture("textures/cactus/albedo.png"); + texture::cactus_metallic = Core::LoadTexture("textures/cactus/metallic.png"); + texture::cactus_roughness = Core::LoadTexture("textures/cactus/roughness.png"); + texture::cactus_ao = Core::LoadTexture("textures/cactus/ao.png"); + texture::cactus_normal = Core::LoadTexture("textures/cactus/normal.png"); + loadModelToContext("./models/sphere.obj", sphereContext, false); loadModelToContext("./models/spaceship.obj", shipContext, false); //loadModelToContext("./models/bed.obj", models::bedContext, true); @@ -881,25 +994,31 @@ void init(GLFWwindow* window) loadModelToContext("./models/bed_frame.obj", models::bedContext, true); loadModelToContext("./models/bed_mattress.obj", models::mattressContext, true); loadModelToContext("./models/bed_pillow.obj", models::bed_pillowContext, false); - loadModelToContext("./models/paplan.obj", models::blanketContext, true); + loadModelToContext("./models/paplan.obj", models::blanketContext, false); loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, true); - loadModelToContext("./models/PC_desk_bake_004.obj", models::desk_bottomContext, true); + loadModelToContext("./models/PC_desk_bake_004.obj", models::desk_bottomContext, false); loadModelToContext("./models/Cube_002.obj", models::paper_stack2Context, false); loadModelToContext("./models/Cube_009.obj", models::paper_stack3Context, false); loadModelToContext("./models/windows_v.obj", models::framesContext, false); - loadModelToContext("./models/Cylinder.obj", models::trashcanContext, true); + loadModelToContext("./models/Cylinder.obj", models::trashcanContext, false); loadModelToContext("./models/drawer_cabinet.obj", models::drawerContext, true); - loadModelToContext("./models/alarm_clock_01.obj", models::clockContext, true); - loadModelToContext("./models/potted_plant_04.obj", models::plantContext, true); - loadModelToContext("./models/modern_coffee_table_01.obj", models::c_tableContext, true); + loadModelToContext("./models/alarm_clock_01.obj", models::clockContext, false); + loadModelToContext("./models/potted_plant_04.obj", models::plantContext, false); + loadModelToContext("./models/modern_coffee_table_01.obj", models::c_tableContext, false); loadModelToContext("./models/20848_Folding_Screen_v3.obj", models::foldingContext, true); loadModelToContext("./models/Foot_Rest_001.obj", models::couchContext, false); - loadModelToContext("./models/dor.obj", models::doorContext, true); + loadModelToContext("./models/dor.obj", models::doorContext, false); loadModelToContext("./models/uploads_files_1938755_KAUSTBY.obj", models::chairContext, false); - loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, true); + loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, false); loadModelToContext("./models/laptop.obj", models::laptopContext, false); loadModelToContext("./models/screen.obj", models::screenContext, false); + loadModelToContext("./models/mug.obj", models::mugContext, false); + loadModelToContext("./models/car.obj", models::carContext, false); + loadModelToContext("./models/cactus.obj", models::cactusContext, false); + loadModelToContext("./models/books1.obj", models::books1Context, false); + loadModelToContext("./models/books2.obj", models::books2Context, false); + collisionSystem.calculateSceneBounding(); skyboxTexture = loadSkybox(faces); @@ -946,8 +1065,16 @@ void processInput(GLFWwindow* window) PlaySound(TEXT("sound/main.wav"), NULL, SND_ASYNC); } if (glfwGetKey(window, GLFW_KEY_J) == GLFW_PRESS) { + texture::screen = Core::LoadTexture("textures/heroes.jpg"); + PlaySound(TEXT("sound/grass.wav"), NULL, SND_ASYNC); + } + if (glfwGetKey(window, GLFW_KEY_K) == GLFW_PRESS) { + texture::screen = Core::LoadTexture("textures/necro.png"); + PlaySound(TEXT("sound/necro.wav"), NULL, SND_ASYNC); + } + if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS) { texture::screen = Core::LoadTexture("textures/visual.png"); - PlaySound(nullptr, nullptr, 0); + PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP); } cameraDir = spaceshipDir; diff --git a/cw 9/src/main.cpp b/cw 9/src/main.cpp index 0a6a4b3..ea11ebb 100644 --- a/cw 9/src/main.cpp +++ b/cw 9/src/main.cpp @@ -24,7 +24,7 @@ int main(int argc, char** argv) #endif // tworzenie okna za pomoca glfw - GLFWwindow* window = glfwCreateWindow(500, 500, "FirstWindow", NULL, NULL); + GLFWwindow* window = glfwCreateWindow(1000, 1000, "FirstWindow", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; @@ -35,7 +35,7 @@ int main(int argc, char** argv) // ladowanie OpenGL za pomoca glew glewInit(); - glViewport(0, 0, 500, 500); + glViewport(0, 0, 1000, 1000); init(window); diff --git a/cw 9/textures/books/albedo.png b/cw 9/textures/books/albedo.png new file mode 100644 index 0000000..440ad9f Binary files /dev/null and b/cw 9/textures/books/albedo.png differ diff --git a/cw 9/textures/books/ao.png b/cw 9/textures/books/ao.png new file mode 100644 index 0000000..12b06b5 Binary files /dev/null and b/cw 9/textures/books/ao.png differ diff --git a/cw 9/textures/books/metallic.png b/cw 9/textures/books/metallic.png new file mode 100644 index 0000000..e1c6989 Binary files /dev/null and b/cw 9/textures/books/metallic.png differ diff --git a/cw 9/textures/books/normal.png b/cw 9/textures/books/normal.png new file mode 100644 index 0000000..d1ab9f2 Binary files /dev/null and b/cw 9/textures/books/normal.png differ diff --git a/cw 9/textures/books/roughness.png b/cw 9/textures/books/roughness.png new file mode 100644 index 0000000..fb7ba35 Binary files /dev/null and b/cw 9/textures/books/roughness.png differ diff --git a/cw 9/textures/cactus/albedo.png b/cw 9/textures/cactus/albedo.png new file mode 100644 index 0000000..561a30c Binary files /dev/null and b/cw 9/textures/cactus/albedo.png differ diff --git a/cw 9/textures/cactus/ao.png b/cw 9/textures/cactus/ao.png new file mode 100644 index 0000000..f20e700 Binary files /dev/null and b/cw 9/textures/cactus/ao.png differ diff --git a/cw 9/textures/cactus/metallic.png b/cw 9/textures/cactus/metallic.png new file mode 100644 index 0000000..b126d24 Binary files /dev/null and b/cw 9/textures/cactus/metallic.png differ diff --git a/cw 9/textures/cactus/normal.png b/cw 9/textures/cactus/normal.png new file mode 100644 index 0000000..e04df76 Binary files /dev/null and b/cw 9/textures/cactus/normal.png differ diff --git a/cw 9/textures/cactus/roughness.png b/cw 9/textures/cactus/roughness.png new file mode 100644 index 0000000..f20e700 Binary files /dev/null and b/cw 9/textures/cactus/roughness.png differ diff --git a/cw 9/textures/car/albedo.jpg b/cw 9/textures/car/albedo.jpg new file mode 100644 index 0000000..c4c4a2f Binary files /dev/null and b/cw 9/textures/car/albedo.jpg differ diff --git a/cw 9/textures/car/ao.jpg b/cw 9/textures/car/ao.jpg new file mode 100644 index 0000000..8797740 Binary files /dev/null and b/cw 9/textures/car/ao.jpg differ diff --git a/cw 9/textures/car/metallic.jpg b/cw 9/textures/car/metallic.jpg new file mode 100644 index 0000000..b5deec6 Binary files /dev/null and b/cw 9/textures/car/metallic.jpg differ diff --git a/cw 9/textures/car/normal.jpg b/cw 9/textures/car/normal.jpg new file mode 100644 index 0000000..c0e1953 Binary files /dev/null and b/cw 9/textures/car/normal.jpg differ diff --git a/cw 9/textures/car/roughness.jpg b/cw 9/textures/car/roughness.jpg new file mode 100644 index 0000000..1341506 Binary files /dev/null and b/cw 9/textures/car/roughness.jpg differ diff --git a/cw 9/textures/car/wooden_car_toy_glossiness.jpg b/cw 9/textures/car/wooden_car_toy_glossiness.jpg new file mode 100644 index 0000000..3792561 Binary files /dev/null and b/cw 9/textures/car/wooden_car_toy_glossiness.jpg differ diff --git a/cw 9/textures/floor3/albedo.jpg b/cw 9/textures/floor3/albedo.jpg new file mode 100644 index 0000000..2071684 Binary files /dev/null and b/cw 9/textures/floor3/albedo.jpg differ diff --git a/cw 9/textures/floor3/ao.jpg b/cw 9/textures/floor3/ao.jpg new file mode 100644 index 0000000..0cce3ce Binary files /dev/null and b/cw 9/textures/floor3/ao.jpg differ diff --git a/cw 9/textures/floor3/metallic.jpg b/cw 9/textures/floor3/metallic.jpg new file mode 100644 index 0000000..a0337e3 Binary files /dev/null and b/cw 9/textures/floor3/metallic.jpg differ diff --git a/cw 9/textures/floor3/normal.jpg b/cw 9/textures/floor3/normal.jpg new file mode 100644 index 0000000..14f8104 Binary files /dev/null and b/cw 9/textures/floor3/normal.jpg differ diff --git a/cw 9/textures/floor3/roughness.jpg b/cw 9/textures/floor3/roughness.jpg new file mode 100644 index 0000000..2f71b37 Binary files /dev/null and b/cw 9/textures/floor3/roughness.jpg differ diff --git a/cw 9/textures/floor4/albedo.jpg b/cw 9/textures/floor4/albedo.jpg new file mode 100644 index 0000000..b8c2272 Binary files /dev/null and b/cw 9/textures/floor4/albedo.jpg differ diff --git a/cw 9/textures/floor4/ao.jpg b/cw 9/textures/floor4/ao.jpg new file mode 100644 index 0000000..52d37dd Binary files /dev/null and b/cw 9/textures/floor4/ao.jpg differ diff --git a/cw 9/textures/floor4/metallic.jpg b/cw 9/textures/floor4/metallic.jpg new file mode 100644 index 0000000..f30de47 Binary files /dev/null and b/cw 9/textures/floor4/metallic.jpg differ diff --git a/cw 9/textures/floor4/normal.jpg b/cw 9/textures/floor4/normal.jpg new file mode 100644 index 0000000..b7d2b7c Binary files /dev/null and b/cw 9/textures/floor4/normal.jpg differ diff --git a/cw 9/textures/floor4/roughness.jpg b/cw 9/textures/floor4/roughness.jpg new file mode 100644 index 0000000..91b6c61 Binary files /dev/null and b/cw 9/textures/floor4/roughness.jpg differ diff --git a/cw 9/textures/mug/albedo.png b/cw 9/textures/mug/albedo.png new file mode 100644 index 0000000..1326759 Binary files /dev/null and b/cw 9/textures/mug/albedo.png differ diff --git a/cw 9/textures/mug/ao.png b/cw 9/textures/mug/ao.png new file mode 100644 index 0000000..fc5e6e5 Binary files /dev/null and b/cw 9/textures/mug/ao.png differ diff --git a/cw 9/textures/mug/metallic.png b/cw 9/textures/mug/metallic.png new file mode 100644 index 0000000..aa28098 Binary files /dev/null and b/cw 9/textures/mug/metallic.png differ diff --git a/cw 9/textures/mug/normal.png b/cw 9/textures/mug/normal.png new file mode 100644 index 0000000..b74c694 Binary files /dev/null and b/cw 9/textures/mug/normal.png differ diff --git a/cw 9/textures/mug/roughness.png b/cw 9/textures/mug/roughness.png new file mode 100644 index 0000000..8dae02a Binary files /dev/null and b/cw 9/textures/mug/roughness.png differ diff --git a/models.txt b/models.txt new file mode 100644 index 0000000..e5268a3 --- /dev/null +++ b/models.txt @@ -0,0 +1 @@ +https://drive.google.com/drive/folders/1H9mCPv32GYCW7wTFX0St0C-mWTQPUpZ-?usp=sharing \ No newline at end of file