diff --git a/cw 6/shaders/shader_skybox.frag b/cw 6/shaders/shader_skybox.frag index 7480b37..2819139 100644 --- a/cw 6/shaders/shader_skybox.frag +++ b/cw 6/shaders/shader_skybox.frag @@ -1,11 +1,12 @@ -#version 330 core - +#version 410 core in vec3 texCoords; +uniform vec3 skyColor; uniform samplerCube skybox; void main() -{ +{ gl_FragColor = texture(skybox, texCoords); -} \ No newline at end of file + gl_FragColor = mix(vec4(skyColor, 1.0), gl_FragColor, 0.37); +} diff --git a/cw 6/shaders/shader_skybox.vert b/cw 6/shaders/shader_skybox.vert index 646b5e7..8075041 100644 --- a/cw 6/shaders/shader_skybox.vert +++ b/cw 6/shaders/shader_skybox.vert @@ -1,4 +1,4 @@ -#version 330 core +#version 410 core layout (location = 0) in vec3 aPos; out vec3 texCoords; @@ -10,4 +10,4 @@ void main() vec4 pos = modelViewProjectionMatrix * vec4(aPos, 1.0f); gl_Position = vec4(pos.x, pos.y, pos.w, pos.w); texCoords = vec3(aPos.x, aPos.y, -aPos.z); -} \ No newline at end of file +} diff --git a/cw 6/src/main_6_1.cpp b/cw 6/src/main_6_1.cpp index 6611ebb..38e97ef 100644 --- a/cw 6/src/main_6_1.cpp +++ b/cw 6/src/main_6_1.cpp @@ -76,7 +76,7 @@ glm::vec2 cameraDelta = glm::vec2(0, 0); glm::quat rotationY = glm::normalize(glm::angleAxis(209 * 0.03f, glm::vec3(1, 0, 0))); glm::quat rotationX = glm::normalize(glm::angleAxis(307 * 0.03f, glm::vec3(0, 1, 0))); -glm::vec3 cameraPos = glm::vec3(0, 15, 0); +glm::vec3 cameraPos = glm::vec3(0, -2, 0); glm::vec3 cameraDir; // Wektor "do przodu" kamery glm::vec3 cameraSide; // Wektor "w bok" kamery float cameraAngle = 0; @@ -303,6 +303,7 @@ void drawSkybox() { glDepthFunc(GL_LEQUAL); glUseProgram(programSkybox); glUniform1i(glGetUniformLocation(programSkybox, "skybox"), 0); + glUniform3f(glGetUniformLocation(programSkybox, "skyColor"), skyColor.x, skyColor.y, skyColor.z); glm::mat4 skyboxModelMatrix = glm::translate(cameraPos) * glm::scale(glm::vec3(30)); glm::mat4 transformationMatrix = perspectiveMatrix * cameraMatrix * skyboxModelMatrix; @@ -807,6 +808,9 @@ void shutdown() { shaderLoader.DeleteProgram(programColor); shaderLoader.DeleteProgram(programTexture); + shaderLoader.DeleteProgram(programCaustics); + shaderLoader.DeleteProgram(programFinalBlending); + shaderLoader.DeleteProgram(programSkybox); } void idle()