skybox exposure

This commit is contained in:
Anna Śmigiel 2023-02-07 20:29:53 +01:00
parent 564b7c4e74
commit 27e912bcbd
27 changed files with 53 additions and 30 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,41 +1,41 @@
 main.cpp  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 C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
C:\Users\Genos\Source\Repos\GRK_Room22\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY” C:\Users\annas\Desktop\graf\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY”
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(107,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(107,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(122,38): warning C4305: "=": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(122,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(145,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(145,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(166,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(166,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(185,15): warning C4101: "textureID": lokalna zmienna, do której nie istnieje odwołanie C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(185,15): warning C4101: "textureID": lokalna zmienna, do której nie istnieje odwołanie
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(268,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(287,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(279,96): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(298,96): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(283,59): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(302,59): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(441,29): warning C4018: "<": niezgodność typu ze znakiem/bez znaku C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(460,29): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(482,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(501,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(495,108): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(514,108): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(506,59): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(525,59): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(507,37): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(526,37): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(540,2): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(559,2): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(664,21): warning C4305: "-=": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(684,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\Genos\source\repos\GRK_Room22\cw 9\src\room.hpp(666,21): warning C4305: "+=": obcięcie z "double" do "float" C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(686,21): warning C4305: "+=": obcięcie z "double" do "float"
Trwa generowanie kodu Trwa generowanie kodu
1 of 595 functions ( 0.2%) were compiled, the rest were copied from previous compilation. 3 of 595 functions ( 0.5%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation 0 functions were new in current compilation
10 functions had inline decision re-evaluated but remain unchanged 7 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\Genos\Source\Repos\GRK_Room22\Release\room.exe grk-cw9.vcxproj -> C:\Users\annas\Desktop\graf\Release\room.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project> <Project>
<ProjectOutputs> <ProjectOutputs>
<ProjectOutput> <ProjectOutput>
<FullPath>C:\Users\Genos\Source\Repos\GRK_Room22\Release\room.exe</FullPath> <FullPath>C:\Users\annas\Desktop\graf\Release\room.exe</FullPath>
</ProjectOutput> </ProjectOutput>
</ProjectOutputs> </ProjectOutputs>
<ContentFiles /> <ContentFiles />

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0: PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
Release|Win32|C:\Users\Genos\Source\Repos\GRK_Room22\| Release|Win32|C:\Users\annas\Desktop\graf\|

Binary file not shown.

Binary file not shown.

View File

@ -1,16 +1,18 @@
#version 430 core #version 430 core
uniform samplerCube skybox; uniform samplerCube skybox;
uniform float exposition;
in vec3 texCoord; in vec3 texCoord;
out vec4 outColor;
layout (location = 0) out vec4 FragColor; layout (location = 0) out vec4 FragColor;
layout (location = 1) out vec4 BloomColor; layout (location = 1) out vec4 BloomColor;
void main() void main()
{ {
FragColor = texture(skybox,texCoord); outColor = vec4(vec3(1.0) - exp(-texture(skybox,texCoord).rgb*exposition),1);
FragColor = outColor;
float brightness = dot(FragColor.rgb, vec3(0.2126, 0.7152, 0.0722)); float brightness = dot(FragColor.rgb, vec3(0.2126, 0.7152, 0.0722));
if(brightness > 1.0) if(brightness > 1.0)
BloomColor = vec4(FragColor.rgb, 1.0); BloomColor = vec4(FragColor.rgb, 1.0);

View File

@ -213,14 +213,33 @@ void drawObjectDepth(Core::RenderContext& context, glm::mat4 viewProjection, glm
} }
//void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
// glDisable(GL_DEPTH_TEST);
// glUseProgram(programSkybox);
// glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
// glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
// glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation);
// glUniform1i(glGetUniformLocation(programSkybox, "skybox"), 10);
// //Core::SetActiveTexture(texture::cubemapTexture, "skybox", programSkybox, 10);
// glUniform1f(glGetUniformLocation(programSkybox, "exposition"), exposition);
// Core::DrawContext(context);
// glEnable(GL_DEPTH_TEST);
//}
void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) { void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glUseProgram(programSkybox); glUseProgram(programSkybox);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix; glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation); glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), 0); Core::SetActiveTexture(texture::cubemapTexture, "skybox", programSkybox, 0);
glUniform1f(glGetUniformLocation(programSkybox, "exposition"), exposition);
Core::DrawContext(context); Core::DrawContext(context);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
} }
@ -550,12 +569,12 @@ void renderScene(GLFWwindow* window)
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
//test depth buffer //test depth buffer
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(programTest); glUseProgram(programTest);
Core::SetActiveTexture(colorBuffers[0], "color", programTest, 0); Core::SetActiveTexture(colorBuffers[0], "color", programTest, 0);
Core::SetActiveTexture(pingpongBuffer[1], "highlight", programTest, 1); Core::SetActiveTexture(pingpongBuffer[1], "highlight", programTest, 1);
//Core::SetActiveTexture(colorBuffers[0],prog) //Core::SetActiveTexture(colorBuffers[0],prog)
//Core::DrawContext(models::testContext); Core::DrawContext(models::testContext);
glUseProgram(0); glUseProgram(0);
glfwSwapBuffers(window); glfwSwapBuffers(window);
@ -567,6 +586,7 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
WIDTH = width; WIDTH = width;
HEIGHT = height; HEIGHT = height;
} }
void loadModelToContext(std::string path, Core::RenderContext& context) void loadModelToContext(std::string path, Core::RenderContext& context)
{ {
Assimp::Importer import; Assimp::Importer import;
@ -674,13 +694,14 @@ void processInput(GLFWwindow* window)
} }
// funkcja jest glowna petla // funkcja jest glowna petla
void renderLoop(GLFWwindow* window) { void renderLoop(GLFWwindow* window) {
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
{ {
processInput(window); processInput(window);
renderScene(window); renderScene(window);
//glfwSwapBuffers(window);
glfwPollEvents(); glfwPollEvents();
} }
} }