determine ambient color based on texture
This commit is contained in:
parent
45453d8ebc
commit
ccec3665c3
2
app.cc
2
app.cc
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user