instancingPS.glsl 606 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #version 330
  2. precision highp float;
  3. in Fragment
  4. {
  5. vec4 color;
  6. } fragment;
  7. in Vert
  8. {
  9. vec2 texcoord;
  10. } vert;
  11. uniform sampler2D Diffuse;
  12. in vec3 lightDir,normal,ambient;
  13. out vec4 color;
  14. void main_textured(void)
  15. {
  16. color = vec4(0.1,0.2,0.3,0.3);
  17. }
  18. void main(void)
  19. {
  20. vec4 texel = fragment.color*texture(Diffuse,vert.texcoord);//fragment.color;
  21. vec3 ct,cf;
  22. float intensity,at,af;
  23. intensity = 0.5+0.5*clamp( dot( normalize(normal),lightDir ), -1,1 );
  24. cf = intensity*(vec3(1.0,1.0,1.0)-ambient)+ambient;
  25. af = 1.0;
  26. ct = texel.rgb;
  27. at = texel.a;
  28. color = vec4(ct * cf, at * af);
  29. }