zmiany na cw 22-01-2024
This commit is contained in:
parent
adec05f6f8
commit
5bbff74f8c
@ -17,5 +17,6 @@ void main()
|
|||||||
float exposure = 0.8f;
|
float exposure = 0.8f;
|
||||||
vec3 toneMapped = vec3(1.0f) - exp(-color * exposure);
|
vec3 toneMapped = vec3(1.0f) - exp(-color * exposure);
|
||||||
|
|
||||||
FragColor.rgb = pow(toneMapped, vec3(1.0f / gamma));
|
toneMapped = pow(toneMapped, vec3(1.0f / gamma));
|
||||||
|
FragColor = vec4(toneMapped, 1.0);
|
||||||
}
|
}
|
@ -53,5 +53,6 @@ void main()
|
|||||||
result += texture(screenTexture, texCoords - vec2(0.0, tex_offset.y * i)).rgb * weights[i];
|
result += texture(screenTexture, texCoords - vec2(0.0, tex_offset.y * i)).rgb * weights[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result = vec3(0, 1, 0);
|
||||||
FragColor = vec4(result, 1.0f);
|
FragColor = vec4(result, 1.0f);
|
||||||
}
|
}
|
@ -191,14 +191,7 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui
|
|||||||
glUniform3f(glGetUniformLocation(programTex, "lightPos"), sunPosition.x, sunPosition.y, sunPosition.z);
|
glUniform3f(glGetUniformLocation(programTex, "lightPos"), sunPosition.x, sunPosition.y, sunPosition.z);
|
||||||
glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z);
|
glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z);
|
||||||
|
|
||||||
/* glUseProgram(programFramebuffer);
|
|
||||||
glUniform1i(glGetUniformLocation(programFramebuffer, "screenTexture"), 0);
|
|
||||||
glUniform1i(glGetUniformLocation(programFramebuffer, "bloomTexture"), 1);
|
|
||||||
glUniform1f(glGetUniformLocation(programFramebuffer, "gamma"), gamma);
|
|
||||||
|
|
||||||
glUseProgram(programBlur);
|
|
||||||
glUniform1i(glGetUniformLocation(programBlur, "screenTexture"), 0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
Core::DrawContext(context);
|
Core::DrawContext(context);
|
||||||
|
|
||||||
@ -218,8 +211,10 @@ void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture
|
|||||||
}
|
}
|
||||||
|
|
||||||
void drawObjectBloom(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture, int amount, bool horizontal, bool first_iteration) {
|
void drawObjectBloom(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture, int amount, bool horizontal, bool first_iteration) {
|
||||||
|
|
||||||
|
|
||||||
glUseProgram(programBlur);
|
glUseProgram(programBlur);
|
||||||
Core::SetActiveTexture(texture, "colorTexture", programTex, 0);
|
glUniform1i(glGetUniformLocation(programBlur, "screenTexture"), 0);
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||||
|
|
||||||
@ -250,6 +245,11 @@ void drawObjectBloom(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint
|
|||||||
// Switch between vertical and horizontal blurring
|
// Switch between vertical and horizontal blurring
|
||||||
horizontal = !horizontal;
|
horizontal = !horizontal;
|
||||||
}
|
}
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
glUseProgram(programFramebuffer);
|
||||||
|
glUniform1i(glGetUniformLocation(programFramebuffer, "screenTexture"), 0);
|
||||||
|
glUniform1i(glGetUniformLocation(programFramebuffer, "bloomTexture"), 1);
|
||||||
|
glUniform1f(glGetUniformLocation(programFramebuffer, "gamma"), gamma);
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,11 +317,11 @@ void renderScene(GLFWwindow* window)
|
|||||||
glm::mat4 planetTranslate = glm::translate(glm::vec3(0, 0, 0)); // zostaje na domyślnej pozycji
|
glm::mat4 planetTranslate = glm::translate(glm::vec3(0, 0, 0)); // zostaje na domyślnej pozycji
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth);
|
drawObjectTexture(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth);
|
||||||
/*
|
|
||||||
glBindFramebuffer(hdrFBO, 0);
|
glBindFramebuffer(hdrFBO, 0);
|
||||||
glUseProgram(programBlur);
|
glUseProgram(programBlur);
|
||||||
drawObjectBloom(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth, 2, true, true);
|
drawObjectBloom(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth, 10, true, true);
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
|
Loading…
Reference in New Issue
Block a user