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.

22 lines
551 B

5 years ago
5 years ago
  1. varying vec3 V_Normal;
  2. void main() {
  3. vec3 lightPos = vec3(0.0, 10.0, 0.0);
  4. vec3 L=lightPos;
  5. L = normalize(L);
  6. vec3 n = normalize(V_Normal);
  7. //ambient
  8. vec4 AmbientLightColor = vec4(0.2, 0.2, 0.2, 1.0);
  9. vec4 AmbientMaterial = vec4(0.2, 0.2, 0.2, 1.0);
  10. vec4 AmbientColor = AmbientLightColor*AmbientMaterial;
  11. //diffuse
  12. vec4 DiffuseLightColor = vec4(1.0,1.0,1.0,1.0);
  13. vec4 DiffuseMaterial = vec4(0.2, 0.2, 0.2, 1.0);
  14. vec4 diffuseColor = DiffuseLightColor*DiffuseMaterial*max(0.0, dot(L,n));
  15. gl_FragColor = AmbientColor + diffuseColor;
  16. }