Игра Маджонг | Mahjong game
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

29 lignes
666B

  1. #ifdef GL_ES
  2. precision highp float;
  3. #endif
  4. varying vec3 position;
  5. varying vec3 normal;
  6. const vec3 lightPosition = vec3(10, 20, 10);
  7. varying vec2 texCoord;
  8. uniform sampler2D image;
  9. float lambertianReflectanceStrength(vec3 position, vec3 lightPosition)
  10. {
  11. vec3 lightDirection = normalize(lightPosition - position);
  12. // Light flux direction.
  13. float strength = dot(normal, lightDirection);
  14. float diffuse = max(strength, 0.2);
  15. return diffuse;
  16. }
  17. void main()
  18. {
  19. vec3 texColor = texture2D(image, texCoord).rgb;
  20. vec3 finalColor = texColor * lambertianReflectanceStrength(position, lightPosition);
  21. gl_FragColor = vec4(finalColor, 1.0);
  22. }