small light fix

This commit is contained in:
K4RP4T 2024-02-08 16:06:08 +01:00
parent 5463da325d
commit a19e75e99e
3 changed files with 14 additions and 12 deletions

View File

@ -3,14 +3,14 @@ Pos=60,60
Size=400,400
[Window][Planet]
Pos=1,257
Pos=-1,255
Size=327,229
[Window][Sun]
Pos=1,487
Pos=-1,483
Size=327,120
[Window][General]
Pos=1,0
Pos=-1,0
Size=327,256

View File

@ -121,7 +121,7 @@ void main()
textureColor = mix(textureColor, atmosphereColor, pow(1 - atmosphereDot, 3));
}
vec3 diffuseColor = textureColor * min(1, AMBIENT + diffuse) * min(1, AMBIENT + diffuseNormal);
vec3 diffuseColor = textureColor * min(1, AMBIENT + diffuse) * min(1, AMBIENT + diffuseNormal) * lightColor;
vec3 toneMappedColor;
if (toneMappingCheck)

View File

@ -39,19 +39,18 @@ Core::Shader_Loader shaderLoader;
Core::RenderContext sphereContext;
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",
"./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/saturn.jpg", "./textures/planets/Savannah.png",
"./textures/planets/snow-foot.png", "./textures/planets/Swamp.png", "./textures/planets/Tropical.png", "./textures/planets/uranus.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/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/venus.jpg", "./textures/planets/Volcanic.png", "./textures/planets/watermelon.png", "./textures/planets/wood.png" };
int planetTexIndex = 0;
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",
"./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/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/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/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/venus.png", "./textures/planets/normalne/volcanic.png", "./textures/planets/normalne/watermelon.png", "./textures/planets/normalne/wood.png" };
GLuint normalTex;
@ -399,6 +398,7 @@ void drawPlanetPbr(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint t
glUseProgram(programPbr);
Core::SetActiveTexture(texture, "colorTexture", programPbr, 0);
Core::SetActiveTexture(textureNormal, "textureNormal", programPbr, 1);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programPbr, "transformation"), 1, GL_FALSE, (float*)&transformation);
@ -432,6 +432,7 @@ void drawPlanetPbr(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint t
void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture) {
glUseProgram(programSun);
Core::SetActiveTexture(texture, "colorTexture", programSun, 0);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation);
@ -454,6 +455,7 @@ void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture
void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture) {
glUseProgram(programSkyBox);
Core::SetActiveSkyBox(texture, "skybox", programSkyBox, 0);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programSkyBox, "transformation"), 1, GL_FALSE, (float*)&transformation);