determine ambient color based on texture

This commit is contained in:
josh committed 2015-10-13 23:08:15 -04:00
1 parent 45453d8ebc
commit ccec3665c3
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -126,7 +126,7 @@ static void draw_cube()
program->use();
cube_array->bind();
glUniform4f(uniforms.ambient, 1.0, 1.0, 1.0, 1.0);
glUniform4f(uniforms.ambient, 0.2, 0.2, 0.2, 0.2);
glUniform4f(uniforms.specular, 1.0, 1.0, 1.0, 1.0);
glUniform1f(uniforms.shininess, 150.0);
glUniform1i(uniforms.tex, 0);
+1 -1
View File
@@ -15,7 +15,7 @@ void main(void)
lightDir = normalize(vec3(-0.1, 0, -0.9));
vec4 texture_color = texture2D(tex, tex_coord_i);
color = vec4(0.2, 0.2, 0.2, texture_color.a) * ambient; /* ambient light */
color = texture_color * ambient; /* ambient light */
n = normalize(normal_i);
NdotL = dot(n, -lightDir);