diff --git a/.vs/grk-cw/FileContentIndex/33dec586-b596-4bff-8b97-4ceb45eee4f0.vsidx b/.vs/grk-cw/FileContentIndex/33dec586-b596-4bff-8b97-4ceb45eee4f0.vsidx new file mode 100644 index 0000000..cc515cf Binary files /dev/null and b/.vs/grk-cw/FileContentIndex/33dec586-b596-4bff-8b97-4ceb45eee4f0.vsidx differ diff --git a/.vs/grk-cw/FileContentIndex/a8e0e7a1-a2d9-4f77-9358-eae2fe036a2b.vsidx b/.vs/grk-cw/FileContentIndex/a8e0e7a1-a2d9-4f77-9358-eae2fe036a2b.vsidx deleted file mode 100644 index c27015f..0000000 Binary files a/.vs/grk-cw/FileContentIndex/a8e0e7a1-a2d9-4f77-9358-eae2fe036a2b.vsidx and /dev/null differ diff --git a/.vs/grk-cw/FileContentIndex/adec5729-ecde-487a-b919-1629bf1dfed2.vsidx b/.vs/grk-cw/FileContentIndex/adec5729-ecde-487a-b919-1629bf1dfed2.vsidx new file mode 100644 index 0000000..fb72663 Binary files /dev/null and b/.vs/grk-cw/FileContentIndex/adec5729-ecde-487a-b919-1629bf1dfed2.vsidx differ diff --git a/.vs/grk-cw/v17/.suo b/.vs/grk-cw/v17/.suo index 1a7f886..830bb54 100644 Binary files a/.vs/grk-cw/v17/.suo and b/.vs/grk-cw/v17/.suo differ diff --git a/.vs/grk-cw/v17/Browse.VC.db b/.vs/grk-cw/v17/Browse.VC.db index f4297ea..9a9f378 100644 Binary files a/.vs/grk-cw/v17/Browse.VC.db and b/.vs/grk-cw/v17/Browse.VC.db differ diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/1f76c8efe8cdcf39/IMAGE_DXT.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/1f76c8efe8cdcf39/IMAGE_DXT.ipch new file mode 100644 index 0000000..b28d0b6 Binary files /dev/null and b/.vs/grk-cw/v17/ipch/AutoPCH/1f76c8efe8cdcf39/IMAGE_DXT.ipch differ diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/3799beb8db5993d8/VCTMP5316_104353.EX_7_1.00000000.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/3799beb8db5993d8/VCTMP5316_104353.EX_7_1.00000000.ipch new file mode 100644 index 0000000..1381c29 Binary files /dev/null and b/.vs/grk-cw/v17/ipch/AutoPCH/3799beb8db5993d8/VCTMP5316_104353.EX_7_1.00000000.ipch differ diff --git a/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch b/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch new file mode 100644 index 0000000..c86e2a7 Binary files /dev/null and b/.vs/grk-cw/v17/ipch/AutoPCH/3af4a585019c4035/MAIN.ipch differ diff --git a/Debug/projekt_grk.exe b/Debug/projekt_grk.exe index 903d3ea..fec5acf 100644 Binary files a/Debug/projekt_grk.exe and b/Debug/projekt_grk.exe differ diff --git a/Debug/projekt_grk.pdb b/Debug/projekt_grk.pdb index d76aae3..cfd31c5 100644 Binary files a/Debug/projekt_grk.pdb and b/Debug/projekt_grk.pdb differ diff --git a/projekt_grk/Debug/grk-cw7.log b/projekt_grk/Debug/grk-cw7.log index 31dee32..bf8aeb3 100644 --- a/projekt_grk/Debug/grk-cw7.log +++ b/projekt_grk/Debug/grk-cw7.log @@ -1,44 +1,9 @@ C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(531,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj, grk-cw6.vcxproj, grk-cw7.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji. - Box.cpp - Camera.cpp main.cpp C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY” -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(72,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(119,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych - Render_Utils.cpp - Shader_Loader.cpp - Texture.cpp - Generowanie kodu... - image_DXT.c -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_DXT.c(92,9): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. - image_helper.c -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_helper.c(325,17): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_helper.c(366,13): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_helper.c(373,20): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_helper.c(415,13): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\image_helper.c(422,20): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych - SOIL.c -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\SOIL.c(1719,36): warning C4018: "<=": niezgodność typu ze znakiem/bez znaku -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\SOIL.c(1729,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\SOIL.c(1841,6): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. - stb_image_aug.c -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(177,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(251,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(303,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(1557,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(2394,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(2709,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(2995,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(3209,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(3548,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stb_image_aug.c(3644,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stbi_DDS_aug_c.h(362,19): warning C4018: ">": niezgodność typu ze znakiem/bez znaku -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stbi_DDS_aug_c.h(366,19): warning C4018: ">": niezgodność typu ze znakiem/bez znaku -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stbi_DDS_aug_c.h(390,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stbi_DDS_aug_c.h(427,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku -D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\SOIL\stbi_DDS_aug_c.h(498,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. - Generowanie kodu... +D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(76,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" +D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(147,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych 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-cw7.vcxproj -> D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\Debug\projekt_grk.exe diff --git a/projekt_grk/Debug/main.obj b/projekt_grk/Debug/main.obj index 5236fd2..ff592fe 100644 Binary files a/projekt_grk/Debug/main.obj and b/projekt_grk/Debug/main.obj differ diff --git a/projekt_grk/Debug/projekt_grk.tlog/CL.command.1.tlog b/projekt_grk/Debug/projekt_grk.tlog/CL.command.1.tlog index 1f64c66..5b21e6e 100644 Binary files a/projekt_grk/Debug/projekt_grk.tlog/CL.command.1.tlog and b/projekt_grk/Debug/projekt_grk.tlog/CL.command.1.tlog differ diff --git a/projekt_grk/Debug/projekt_grk.tlog/CL.read.1.tlog b/projekt_grk/Debug/projekt_grk.tlog/CL.read.1.tlog index aac1ccd..f9607f9 100644 Binary files a/projekt_grk/Debug/projekt_grk.tlog/CL.read.1.tlog and b/projekt_grk/Debug/projekt_grk.tlog/CL.read.1.tlog differ diff --git a/projekt_grk/Debug/projekt_grk.tlog/CL.write.1.tlog b/projekt_grk/Debug/projekt_grk.tlog/CL.write.1.tlog index ab1d0af..4aefcc0 100644 Binary files a/projekt_grk/Debug/projekt_grk.tlog/CL.write.1.tlog and b/projekt_grk/Debug/projekt_grk.tlog/CL.write.1.tlog differ diff --git a/projekt_grk/Debug/vc143.idb b/projekt_grk/Debug/vc143.idb index 65397f2..5dbebfc 100644 Binary files a/projekt_grk/Debug/vc143.idb and b/projekt_grk/Debug/vc143.idb differ diff --git a/projekt_grk/Debug/vc143.pdb b/projekt_grk/Debug/vc143.pdb index a07ea3d..f6a35ed 100644 Binary files a/projekt_grk/Debug/vc143.pdb and b/projekt_grk/Debug/vc143.pdb differ diff --git a/projekt_grk/shaders/shader_5_sun.frag b/projekt_grk/shaders/shader_5_sun.frag index 5cf78d5..e571a5d 100644 --- a/projekt_grk/shaders/shader_5_sun.frag +++ b/projekt_grk/shaders/shader_5_sun.frag @@ -1,10 +1,15 @@ #version 430 core -uniform vec3 objectColor; +uniform float exposition; +uniform sampler2D sunTexture; -in vec3 interpNormal; +in vec2 TexCoords; +out vec4 outColor; void main() { - gl_FragColor = vec4(objectColor, 1.0); + vec3 textureColor = texture(sunTexture, TexCoords).xyz; + vec3 adjustedColor = textureColor * exposition; + + outColor = vec4(clamp(adjustedColor, 0.0, 1.0), 1.0); } diff --git a/projekt_grk/shaders/shader_5_sun.vert b/projekt_grk/shaders/shader_5_sun.vert index 7d84d62..93bb30b 100644 --- a/projekt_grk/shaders/shader_5_sun.vert +++ b/projekt_grk/shaders/shader_5_sun.vert @@ -1,15 +1,15 @@ #version 430 core layout(location = 0) in vec3 vertexPosition; -layout(location = 1) in vec2 vertexTexCoord; -layout(location = 2) in vec3 vertexNormal; +layout(location = 1) in vec3 vertexNormal; +layout(location = 2) in vec2 vertexTexCoord; uniform mat4 transformation; -out vec3 interpNormal; +out vec2 TexCoords; void main() { - gl_Position = transformation * vec4(vertexPosition, 1.0); - interpNormal = vertexNormal; + gl_Position = transformation * vec4(vertexPosition, 1.0); + TexCoords = vertexTexCoord; } diff --git a/projekt_grk/src/ex_7_1.hpp b/projekt_grk/src/ex_7_1.hpp index 31b6183..4f84917 100644 --- a/projekt_grk/src/ex_7_1.hpp +++ b/projekt_grk/src/ex_7_1.hpp @@ -17,10 +17,13 @@ namespace texture { + //GLuint clouds; GLuint earth; - GLuint clouds; GLuint moon; GLuint ship; + GLuint sun; + + GLuint grid; @@ -49,6 +52,7 @@ GLuint VAO,VBO; float aspectRatio = 1.f; + glm::mat4 createCameraMatrix() { glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f))); @@ -111,6 +115,22 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui Core::DrawContext(context); } + + +void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID) +{ + GLuint prog = programSun; + glUseProgram(prog); + glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); + glm::mat4 transformation = viewProjectionMatrix * modelMatrix; + glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation); + glUniform1f(glGetUniformLocation(prog, "exposition"), 1.f); + Core::SetActiveTexture(textureID, "sunTexture", prog, 0); + Core::DrawContext(context); +} + + + void renderScene(GLFWwindow* window) { glClearColor(0.0f, 0.3f, 0.3f, 1.0f); @@ -118,14 +138,15 @@ void renderScene(GLFWwindow* window) glm::mat4 transformation; float time = glfwGetTime(); - + drawSun(sphereContext, glm::mat4(), texture::sun); drawObjectTexture(sphereContext, glm::mat4(), texture::ship, texture::asteroidNormal); drawObjectTexture(sphereContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), texture::earth, texture::earthNormal); - drawObjectTexture(sphereContext, - 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)), texture::moon, texture::asteroidNormal); + drawObjectTexture(sphereContext, 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)), texture::moon, texture::asteroidNormal); + + 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)); @@ -173,15 +194,17 @@ void init(GLFWwindow* window) programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex_copy.vert", "shaders/shader_5_1_tex_copy.frag"); programEarth = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); programProcTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); + programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag"); loadModelToContext("./models/sphere.obj", sphereContext); loadModelToContext("./models/spaceship.obj", shipContext); - texture::earth = Core::LoadTexture("textures/earth.png"); + texture::earth = Core::LoadTexture("textures/earth2.png"); texture::ship = Core::LoadTexture("textures/spaceship.jpg"); texture::moon = Core::LoadTexture("textures/moon.jpg"); + texture::sun = Core::LoadTexture("textures/sun.jpg"); - texture::earthNormal = Core::LoadTexture("textures/earth_normalmap.png"); + texture::earthNormal = Core::LoadTexture("textures/earth2_normals.png"); texture::shipNormal = Core::LoadTexture("textures/spaceship_normal.jpg"); texture::asteroidNormal = Core::LoadTexture("textures/moon_normal.jpg"); diff --git a/projekt_grk/textures/sun.jpg b/projekt_grk/textures/sun.jpg new file mode 100644 index 0000000..9d787d8 Binary files /dev/null and b/projekt_grk/textures/sun.jpg differ