You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
551 B

varying vec3 V_Normal;
void main() {
vec3 lightPos = vec3(0.0, 10.0, 0.0);
vec3 L=lightPos;
L = normalize(L);
vec3 n = normalize(V_Normal);
//ambient
vec4 AmbientLightColor = vec4(0.2, 0.2, 0.2, 1.0);
vec4 AmbientMaterial = vec4(0.2, 0.2, 0.2, 1.0);
vec4 AmbientColor = AmbientLightColor*AmbientMaterial;
//diffuse
vec4 DiffuseLightColor = vec4(1.0,1.0,1.0,1.0);
vec4 DiffuseMaterial = vec4(0.2, 0.2, 0.2, 1.0);
vec4 diffuseColor = DiffuseLightColor*DiffuseMaterial*max(0.0, dot(L,n));
gl_FragColor = AmbientColor + diffuseColor;
}