Advertisement
Guest User

shader of assimp loader

a guest
Nov 14th, 2013
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #version 330
  2.  
  3. layout (std140) uniform Material {
  4. vec4 diffuse;
  5. vec4 ambient;
  6. vec4 specular;
  7. vec4 emissive;
  8. float shininess;
  9. int texCount;
  10. };
  11.  
  12. uniform sampler2D texUnit;
  13.  
  14. in vec3 Normal;
  15. in vec2 TexCoord;
  16. out vec4 output;
  17.  
  18. void main()
  19. {
  20. vec4 color;
  21. vec4 amb;
  22. float intensity;
  23. vec3 lightDir;
  24. vec3 n;
  25.  
  26. lightDir = normalize(vec3(1.0,1.0,1.0));
  27. n = normalize(Normal);
  28. intensity = max(dot(lightDir,n),0.0);
  29.  
  30. if (texCount == 0) {
  31. color = diffuse;
  32. amb = ambient;
  33. }
  34. else {
  35. color = texture(texUnit, TexCoord);
  36. amb = color * 0.33;
  37. }
  38. output = (color * intensity) + amb;
  39. //output = vec4(texCount,0.0,0.0,1.0);
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement