mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Corrected ambient lighting calculation
This commit is contained in:
@@ -41,7 +41,7 @@ void main()
|
||||
vec3 normal = normalize(fs_in.Normal);
|
||||
vec3 lightColor = vec3(0.3);
|
||||
// ambient
|
||||
vec3 ambient = 0.3 * color;
|
||||
vec3 ambient = 0.3 * lightColor;
|
||||
// diffuse
|
||||
vec3 lightDir = normalize(lightPos - fs_in.FragPos);
|
||||
float diff = max(dot(lightDir, normal), 0.0);
|
||||
|
||||
Reference in New Issue
Block a user