Monster0FS.glsl 660 B

12345678910111213141516171819202122232425
  1. precision highp float;
  2. varying vec3 v_normal;
  3. uniform vec4 u_ambient;
  4. varying vec2 v_texcoord0;
  5. uniform sampler2D u_diffuse;
  6. uniform vec4 u_emission;
  7. uniform vec4 u_specular;
  8. uniform float u_shininess;
  9. void main(void) {
  10. vec3 normal = normalize(v_normal);
  11. vec4 color = vec4(0., 0., 0., 0.);
  12. vec4 diffuse = vec4(0., 0., 0., 1.);
  13. vec4 emission;
  14. vec4 ambient;
  15. vec4 specular;
  16. ambient = u_ambient;
  17. diffuse = texture2D(u_diffuse, v_texcoord0);
  18. emission = u_emission;
  19. specular = u_specular;
  20. diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
  21. color.xyz += diffuse.xyz;
  22. color.xyz += emission.xyz;
  23. color = vec4(color.rgb * diffuse.a, diffuse.a);
  24. gl_FragColor = color;
  25. }