Fix the example lighting shaders to use both frag and diffuse colors so they work with shapes and meshes. (#4482)

This commit is contained in:
Jeffery Myers
2024-11-11 10:55:33 -08:00
committed by GitHub
parent 5cc06f4ba4
commit 10fd4de258
3 changed files with 11 additions and 5 deletions

View File

@ -40,6 +40,8 @@ void main()
vec3 viewD = normalize(viewPos - fragPosition);
vec3 specular = vec3(0.0);
vec4 tint = colDiffuse * fragColor;
// NOTE: Implement here your fragment shader code
for (int i = 0; i < MAX_LIGHTS; i++)
@ -67,7 +69,7 @@ void main()
}
}
vec4 finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
vec4 finalColor = (texelColor*((tint + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
finalColor += texelColor*(ambient/10.0);
// Gamma correction