diff --git a/grk/Debug/grk-cw6.exe b/grk/Debug/grk-cw6.exe index fdacd83..7ac3e4e 100644 Binary files a/grk/Debug/grk-cw6.exe and b/grk/Debug/grk-cw6.exe differ diff --git a/grk/Debug/grk-cw6.pdb b/grk/Debug/grk-cw6.pdb index a1b8dec..652bd52 100644 Binary files a/grk/Debug/grk-cw6.pdb and b/grk/Debug/grk-cw6.pdb differ diff --git a/grk/cw 6/Debug/Box.obj b/grk/cw 6/Debug/Box.obj index d11384e..b5a0c20 100644 Binary files a/grk/cw 6/Debug/Box.obj and b/grk/cw 6/Debug/Box.obj differ diff --git a/grk/cw 6/Debug/Camera.obj b/grk/cw 6/Debug/Camera.obj index 186c80f..3b7bbf7 100644 Binary files a/grk/cw 6/Debug/Camera.obj and b/grk/cw 6/Debug/Camera.obj differ diff --git a/grk/cw 6/Debug/Render_Utils.obj b/grk/cw 6/Debug/Render_Utils.obj index 7e23df3..b7ffde8 100644 Binary files a/grk/cw 6/Debug/Render_Utils.obj and b/grk/cw 6/Debug/Render_Utils.obj differ diff --git a/grk/cw 6/Debug/SOIL.obj b/grk/cw 6/Debug/SOIL.obj index 12432f4..275d496 100644 Binary files a/grk/cw 6/Debug/SOIL.obj and b/grk/cw 6/Debug/SOIL.obj differ diff --git a/grk/cw 6/Debug/Shader_Loader.obj b/grk/cw 6/Debug/Shader_Loader.obj index ffeb32f..5b9a22e 100644 Binary files a/grk/cw 6/Debug/Shader_Loader.obj and b/grk/cw 6/Debug/Shader_Loader.obj differ diff --git a/grk/cw 6/Debug/Texture.obj b/grk/cw 6/Debug/Texture.obj index f41f455..1d26929 100644 Binary files a/grk/cw 6/Debug/Texture.obj and b/grk/cw 6/Debug/Texture.obj differ diff --git a/grk/cw 6/Debug/grk-cw6.exe.recipe b/grk/cw 6/Debug/grk-cw6.exe.recipe index 0f6b7cf..3a2fd02 100644 --- a/grk/cw 6/Debug/grk-cw6.exe.recipe +++ b/grk/cw 6/Debug/grk-cw6.exe.recipe @@ -2,11 +2,7 @@ -<<<<<<< HEAD D:\grk2024\dgrk-2023-planeta\grk\Debug\grk-cw6.exe -======= - E:\micha\studia\grafika_komputerowa\grk\grk\Debug\grk-cw6.exe ->>>>>>> master diff --git a/grk/cw 6/Debug/grk-cw6.log b/grk/cw 6/Debug/grk-cw6.log index 9ed431a..4a0954e 100644 --- a/grk/cw 6/Debug/grk-cw6.log +++ b/grk/cw 6/Debug/grk-cw6.log @@ -1,77 +1,41 @@ -<<<<<<< HEAD C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji. main.cpp C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra D:\grk2024\dgrk-2023-planeta\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY” -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(72,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(124,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(159,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(261,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(267,52): warning C4305: "argument": obcięcie z "double" do "T" -======= -C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(513,5): warning MSB8028: The intermediate directory (Debug\) contains files shared from another project (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj). This can lead to incorrect clean and rebuild behavior. - main.cpp -C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition -E:\micha\studia\grafika_komputerowa\grk\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY' -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(96,16): warning C4305: 'initializing': truncation from 'double' to 'float' -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(152,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(156,52): warning C4305: 'argument': truncation from 'double' to 'T' ->>>>>>> master +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(73,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(125,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(161,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(266,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(273,52): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -<<<<<<< HEAD -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(271,50): warning C4305: "argument": obcięcie z "double" do "T" -======= -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(160,50): warning C4305: 'argument': truncation from 'double' to 'T' ->>>>>>> master +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(277,50): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -<<<<<<< HEAD -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(275,49): warning C4305: "argument": obcięcie z "double" do "T" -======= -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(164,49): warning C4305: 'argument': truncation from 'double' to 'T' ->>>>>>> master +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(281,49): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -<<<<<<< HEAD -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(279,48): warning C4305: "argument": obcięcie z "double" do "T" -======= -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(168,48): warning C4305: 'argument': truncation from 'double' to 'T' ->>>>>>> master +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(285,48): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -<<<<<<< HEAD -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(283,48): warning C4305: "argument": obcięcie z "double" do "T" -======= -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(172,48): warning C4305: 'argument': truncation from 'double' to 'T' ->>>>>>> master +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(289,48): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -<<<<<<< HEAD -D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(287,48): warning C4305: "argument": obcięcie z "double" do "T" -======= -E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(176,48): warning C4305: 'argument': truncation from 'double' to 'T' ->>>>>>> master +D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(293,48): warning C4305: "argument": obcięcie z "double" do "T" with [ T=float ] -<<<<<<< HEAD Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO” LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka grk-cw6.vcxproj -> D:\grk2024\dgrk-2023-planeta\grk\Debug\grk-cw6.exe -======= -Box.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification -LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library - grk-cw6.vcxproj -> E:\micha\studia\grafika_komputerowa\grk\grk\Debug\grk-cw6.exe ->>>>>>> master diff --git a/grk/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog b/grk/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog index d0e4c7d..2ad6daf 100644 Binary files a/grk/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog and b/grk/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog differ diff --git a/grk/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog b/grk/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog index ac9433d..21b7e5e 100644 Binary files a/grk/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog and b/grk/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog differ diff --git a/grk/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog b/grk/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog index 4a66007..8d96e29 100644 Binary files a/grk/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog and b/grk/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog differ diff --git a/grk/cw 6/Debug/grk-cw6.tlog/link.read.1.tlog b/grk/cw 6/Debug/grk-cw6.tlog/link.read.1.tlog index 8cc9f2d..775c568 100644 Binary files a/grk/cw 6/Debug/grk-cw6.tlog/link.read.1.tlog and b/grk/cw 6/Debug/grk-cw6.tlog/link.read.1.tlog differ diff --git a/grk/cw 6/Debug/image_DXT.obj b/grk/cw 6/Debug/image_DXT.obj index 9abe294..fa55447 100644 Binary files a/grk/cw 6/Debug/image_DXT.obj and b/grk/cw 6/Debug/image_DXT.obj differ diff --git a/grk/cw 6/Debug/image_helper.obj b/grk/cw 6/Debug/image_helper.obj index 7aeb7f2..6d2d12e 100644 Binary files a/grk/cw 6/Debug/image_helper.obj and b/grk/cw 6/Debug/image_helper.obj differ diff --git a/grk/cw 6/Debug/main.obj b/grk/cw 6/Debug/main.obj index d832cc1..cca91c2 100644 Binary files a/grk/cw 6/Debug/main.obj and b/grk/cw 6/Debug/main.obj differ diff --git a/grk/cw 6/Debug/stb_image_aug.obj b/grk/cw 6/Debug/stb_image_aug.obj index 0471812..41171b3 100644 Binary files a/grk/cw 6/Debug/stb_image_aug.obj and b/grk/cw 6/Debug/stb_image_aug.obj differ diff --git a/grk/cw 6/Debug/vc142.idb b/grk/cw 6/Debug/vc142.idb index 2b99e8e..4a77603 100644 Binary files a/grk/cw 6/Debug/vc142.idb and b/grk/cw 6/Debug/vc142.idb differ diff --git a/grk/cw 6/Debug/vc142.pdb b/grk/cw 6/Debug/vc142.pdb index d388414..c4e04fd 100644 Binary files a/grk/cw 6/Debug/vc142.pdb and b/grk/cw 6/Debug/vc142.pdb differ diff --git a/grk/cw 6/grk-cw6.vcxproj b/grk/cw 6/grk-cw6.vcxproj index 23af5e3..19b5192 100644 --- a/grk/cw 6/grk-cw6.vcxproj +++ b/grk/cw 6/grk-cw6.vcxproj @@ -41,6 +41,8 @@ + + diff --git a/grk/cw 6/grk-cw6.vcxproj.filters b/grk/cw 6/grk-cw6.vcxproj.filters index 4b2a24e..5c80d8d 100644 --- a/grk/cw 6/grk-cw6.vcxproj.filters +++ b/grk/cw 6/grk-cw6.vcxproj.filters @@ -121,5 +121,11 @@ Shader Files + + Shader Files + + + Shader Files + \ No newline at end of file diff --git a/grk/cw 6/shaders/shader_5_1_tex.frag b/grk/cw 6/shaders/shader_5_1_tex.frag index deb0bdc..c49b5ec 100644 --- a/grk/cw 6/shaders/shader_5_1_tex.frag +++ b/grk/cw 6/shaders/shader_5_1_tex.frag @@ -4,21 +4,35 @@ float AMBIENT = 0.1; uniform vec3 color; uniform vec3 lightPos; +uniform vec3 lightColor; in vec3 vecNormal; in vec3 worldPos; in vec2 vtc; - +vec4 textureColor; out vec4 outColor; +vec3 outputColor; uniform sampler2D colorTexture; +vec3 toneMapping(vec3 color){ + float exposure = 0.06; + vec3 mapped = 1 - exp(-color*exposure); + return mapped; +} + + void main() { vec3 lightDir = normalize(lightPos - worldPos); vec3 normal = normalize(vecNormal); float diffuse = max(0, dot(normal, lightDir)); + textureColor = texture2D(colorTexture, vtc); + vec3 distance = lightColor/(lightPos - worldPos)*(lightPos - worldPos); + outputColor = vec3(textureColor) * min(1, AMBIENT + diffuse)* distance; + //gamma correction + //outputColor = pow(outputColor, vec3(1.0/2.2)); - vec4 textureColor = texture2D(colorTexture, vtc); - outColor = vec4(vec3(textureColor) * min(1, AMBIENT + diffuse), 1.0); + outputColor = toneMapping(outputColor); + outColor = vec4(outputColor , 1.0); } diff --git a/grk/cw 6/src/ex_6_1.hpp b/grk/cw 6/src/ex_6_1.hpp index c8deceb..70a0c13 100644 --- a/grk/cw 6/src/ex_6_1.hpp +++ b/grk/cw 6/src/ex_6_1.hpp @@ -72,13 +72,13 @@ glm::vec3 spotlightConeDir = glm::vec3(0, 0, 0); glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9) * 3; float spotlightPhi = 3.14 / 4; -glm::vec3 lightColor = glm::vec3(0.9, 0.7, 0.8); +glm::vec3 lightColor = glm::vec3(20.f, 20.f, 20.f); unsigned int depthMapFBO; unsigned int depthMap; const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024; -int WIDTH = 500, HEIGHT = 500; + @@ -157,6 +157,7 @@ void initDepthMap() { } void renderShadowapSun() { + int WIDTH = 500, HEIGHT = 500; float time = glfwGetTime(); glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); //uzupelnij o renderowanie glebokosci do tekstury @@ -173,18 +174,7 @@ void renderShadowapSun() { glBindFramebuffer(GL_FRAMEBUFFER, 0); - glViewport(0, 0, WIDTH, HEIGHT); -} - -void drawObjectSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture) { - glUseProgram(programSun); - Core::SetActiveTexture(texture, "colorTexture", programTex, 0); - glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); - glm::mat4 transformation = viewProjectionMatrix * modelMatrix; - glUniformMatrix4fv(glGetUniformLocation(programTex, "transformation"), 1, GL_FALSE, (float*)&transformation); - glUniformMatrix4fv(glGetUniformLocation(programTex, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); - Core::DrawContext(context); - glUseProgram(0); + //glViewport(0, 0, WIDTH, HEIGHT); } @@ -195,7 +185,8 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui glm::mat4 transformation = viewProjectionMatrix * modelMatrix; glUniformMatrix4fv(glGetUniformLocation(programTex, "transformation"), 1, GL_FALSE, (float*)&transformation); glUniformMatrix4fv(glGetUniformLocation(programTex, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); - glUniform3f(glGetUniformLocation(program, "lightPos"), 0.0, 0.0, 0.0); + glUniform3f(glGetUniformLocation(programTex, "lightPos"), 0.0, 0.0, 0.0); + glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z); Core::DrawContext(context); glUseProgram(0); } @@ -274,7 +265,8 @@ void renderScene(GLFWwindow* window) glm::mat4 transformation; float time = glfwGetTime(); - renderShadowapSun(); + //shadowmap, poki co nie pozwala na skalowanie okna dlatego zakomentowane + //renderShadowapSun(); glm::mat4 sunScale = glm::scale(glm::vec3(1.75)); @@ -371,7 +363,7 @@ void init(GLFWwindow* window) initDepthMap(); program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag"); programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); - programSun = shaderLoader.CreateProgram("shaders/shader_sun.vert", "shaders/shader_sun.frag"); + programDepth = shaderLoader.CreateProgram("shaders/shader_smap.vert", "shaders/shader_smap.frag"); //programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag"); programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag");