cleaning #11

Merged
s473581 merged 2 commits from cleaning into master 2024-02-08 11:16:28 +01:00
7 changed files with 9 additions and 40 deletions
Showing only changes of commit c1bba47358 - Show all commits

View File

@ -15,9 +15,11 @@ void main()
vec3 bloomColor = texture(bloomBlur, TexCoords).rgb; vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;
if(bloom) if(bloom)
hdrColor += bloomColor; // additive blending hdrColor += bloomColor; // additive blending
// tone mapping // tone mapping
vec3 result = vec3(1.0) - exp(-hdrColor * exposure); vec3 result = vec3(1.0) - exp(-hdrColor * exposure);
// also gamma correct while we're at it
// gamma correction
result = pow(result, vec3(1.0 / gamma)); result = pow(result, vec3(1.0 / gamma));
FragColor = vec4(result, 1.0); FragColor = vec4(result, 1.0);
} }

View File

@ -34,8 +34,6 @@ in vec3 vecNormal;
in vec3 worldPos; in vec3 worldPos;
in vec2 vtc; in vec2 vtc;
//out vec4 outColor;
in vec3 viewDirTS; in vec3 viewDirTS;
in vec3 lightDirTS; in vec3 lightDirTS;
in vec3 sunDirTS; in vec3 sunDirTS;
@ -126,7 +124,6 @@ float noise (in vec2 st)
vec2 i = floor(st); vec2 i = floor(st);
vec2 f = fract(st); vec2 f = fract(st);
// Four corners in 2D of a tile
float a = random(i); float a = random(i);
float b = random(i + vec2(1.0, 0.0)); float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0)); float c = random(i + vec2(0.0, 1.0));
@ -146,7 +143,7 @@ float fbm (in vec2 st)
float value = 0.0; float value = 0.0;
float amplitude = .5; float amplitude = .5;
float frequency = 0.; float frequency = 0.;
//
// Loop of octaves // Loop of octaves
for (int i = 0; i < OCTAVES; i++) { for (int i = 0; i < OCTAVES; i++) {
value += amplitude * noise(st); value += amplitude * noise(st);

View File

@ -7,8 +7,6 @@ uniform vec3 lightColor;
in vec3 texCoord; in vec3 texCoord;
//out vec4 out_color;
void main() void main()
{ {
vec4 textureColor = texture(skybox, texCoord); vec4 textureColor = texture(skybox, texCoord);

View File

@ -16,8 +16,6 @@ in vec3 vecNormal;
in vec3 worldPos; in vec3 worldPos;
in vec2 vtc; in vec2 vtc;
//out vec4 outColor;
uniform sampler2D colorTexture; uniform sampler2D colorTexture;
vec3 toneMapping(vec3 color) vec3 toneMapping(vec3 color)
@ -127,6 +125,7 @@ void main()
{ {
vec3 distance = lightColor / pow(length(lightPos - worldPos), 2.0) * 100; vec3 distance = lightColor / pow(length(lightPos - worldPos), 2.0) * 100;
toneMappedColor = toneMapping(mixedColor * distance); toneMappedColor = toneMapping(mixedColor * distance);
//gamma correction //gamma correction
toneMappedColor = pow(toneMappedColor, vec3(1.0/2.2)); toneMappedColor = pow(toneMappedColor, vec3(1.0/2.2));
} }

View File

@ -32,8 +32,6 @@ in vec3 viewDirTS;
in vec3 lightDirTS; in vec3 lightDirTS;
in vec3 sunDirTS; in vec3 sunDirTS;
//out vec4 outColor;
vec3 toneMapping(vec3 color) vec3 toneMapping(vec3 color)
{ {
float exposure = 0.06; float exposure = 0.06;
@ -70,7 +68,7 @@ float fbm (in vec2 st) {
float value = 0.0; float value = 0.0;
float amplitude = .5; float amplitude = .5;
float frequency = 0.; float frequency = 0.;
//
// Loop of octaves // Loop of octaves
for (int i = 0; i < OCTAVES; i++) { for (int i = 0; i < OCTAVES; i++) {
value += amplitude * noise(st); value += amplitude * noise(st);
@ -130,6 +128,7 @@ void main()
{ {
vec3 distance = lightColor / pow(length(lightPos - worldPos), 2.0) * 1000; vec3 distance = lightColor / pow(length(lightPos - worldPos), 2.0) * 1000;
toneMappedColor = toneMapping(diffuseColor * distance); toneMappedColor = toneMapping(diffuseColor * distance);
//gamma correction //gamma correction
toneMappedColor = pow(toneMappedColor, vec3(1.0/2.2)); toneMappedColor = pow(toneMappedColor, vec3(1.0/2.2));
} }

View File

@ -41,7 +41,7 @@ Core::RenderContext cubeContext;
const char* const planetTexPaths[] = { "./textures/planets/ceres.jpg", "./textures/planets/desert.png", "./textures/planets/dirty.png", "./textures/planets/earth.jpg", "./textures/planets/eris.jpg", const char* const planetTexPaths[] = { "./textures/planets/ceres.jpg", "./textures/planets/desert.png", "./textures/planets/dirty.png", "./textures/planets/earth.jpg", "./textures/planets/eris.jpg",
"./textures/planets/haumea.jpg", "./textures/planets/Icy.png", "./textures/planets/jupiter.jpg", "./textures/planets/kora.png", "./textures/planets/makemake.jpg", "./textures/planets/mars.jpg", "./textures/planets/haumea.jpg", "./textures/planets/Icy.png", "./textures/planets/jupiter.jpg", "./textures/planets/kora.png", "./textures/planets/makemake.jpg", "./textures/planets/mars.jpg",
"./textures/planets/mchowa.png", "./textures/planets/mercury.png", "./textures/planets/neptune.jpg", "./textures/planets/saturn.jpg", "./textures/planets/Savannah.png", "./textures/planets/mchowa.png", "./textures/planets/mercury.png", "./textures/planets/saturn.jpg", "./textures/planets/Savannah.png",
"./textures/planets/snow-foot.png", "./textures/planets/Swamp.png", "./textures/planets/Tropical.png", "./textures/planets/uranus.jpg", "./textures/planets/snow-foot.png", "./textures/planets/Swamp.png", "./textures/planets/Tropical.png", "./textures/planets/uranus.jpg",
"./textures/planets/venus.jpg", "./textures/planets/Volcanic.png", "./textures/planets/watermelon.png", "./textures/planets/wood.png" }; "./textures/planets/venus.jpg", "./textures/planets/Volcanic.png", "./textures/planets/watermelon.png", "./textures/planets/wood.png" };
int planetTexIndex = 0; int planetTexIndex = 0;
@ -50,7 +50,7 @@ GLuint planetTex;
const char* const normalTexPaths[] = { "./textures/planets/normalne/ceres.png", "./textures/planets/normalne/desert.png", "./textures/planets/normalne/dirty.png", "./textures/planets/normalne/earth_normalmap.png", const char* const normalTexPaths[] = { "./textures/planets/normalne/ceres.png", "./textures/planets/normalne/desert.png", "./textures/planets/normalne/dirty.png", "./textures/planets/normalne/earth_normalmap.png",
"./textures/planets/normalne/eris.png", "./textures/planets/normalne/haumea.png", "./textures/planets/normalne/icy.png", "./textures/planets/normalne/jupiter.png", "./textures/planets/normalne/eris.png", "./textures/planets/normalne/haumea.png", "./textures/planets/normalne/icy.png", "./textures/planets/normalne/jupiter.png",
"./textures/planets/normalne/kora.png", "./textures/planets/normalne/makemake.png", "./textures/planets/normalne/mars.png", "./textures/planets/normalne/mchowa.png", "./textures/planets/normalne/kora.png", "./textures/planets/normalne/makemake.png", "./textures/planets/normalne/mars.png", "./textures/planets/normalne/mchowa.png",
"./textures/planets/normalne/mercury.png", "./textures/planets/normalne/neptune.jpg", "./textures/planets/normalne/saturn.png", "./textures/planets/normalne/savannah.png", "./textures/planets/normalne/mercury.png", "./textures/planets/normalne/saturn.png", "./textures/planets/normalne/savannah.png",
"./textures/planets/normalne/snow-foot.png", "./textures/planets/normalne/swamp.png", "./textures/planets/normalne/tropical.png", "./textures/planets/normalne/uranus.png", "./textures/planets/normalne/snow-foot.png", "./textures/planets/normalne/swamp.png", "./textures/planets/normalne/tropical.png", "./textures/planets/normalne/uranus.png",
"./textures/planets/normalne/venus.png", "./textures/planets/normalne/volcanic.png", "./textures/planets/normalne/watermelon.png", "./textures/planets/normalne/wood.png" }; "./textures/planets/normalne/venus.png", "./textures/planets/normalne/volcanic.png", "./textures/planets/normalne/watermelon.png", "./textures/planets/normalne/wood.png" };
GLuint normalTex; GLuint normalTex;
@ -751,7 +751,6 @@ void init(GLFWwindow* window) {
initHDR(window); initHDR(window);
initRBO(window); initRBO(window);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
//glDisable(GL_DEPTH_TEST);
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();
ImGui::CreateContext(); ImGui::CreateContext();

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Planeta", "cw 6\grk-cw6.vcxproj", "{3952C396-B1C6-44CD-96DD-C1AC15D32978}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Debug|x86.ActiveCfg = Debug|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Debug|x86.Build.0 = Debug|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Release|x86.ActiveCfg = Release|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AED787C0-0952-4701-A56F-36AB5A5F246A}
EndGlobalSection
EndGlobal