Advertisement
Guest User

Untitled

a guest
Dec 26th, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #version 400 core
  2.  
  3. in vec2 texturePosition;
  4. in vec3 surfaceNormal;
  5. in vec3 toPointLight[19];
  6.  
  7. out vec4 out_Color;
  8.  
  9. uniform sampler2D texture;
  10. uniform vec4 ambientLight;
  11. uniform vec4 pointLightData[19];
  12. uniform float pointLightCount;
  13. uniform float useFakelighting;
  14.  
  15. //********************************
  16. in vec3 toCamera;
  17.  
  18. uniform float reflectivity;
  19. uniform float shineDamper;
  20. //********************************
  21.  
  22. void main(void){
  23. //Texture
  24. out_Color=texture(texture, texturePosition);
  25.  
  26. //Ambient light 00
  27. vec4 textureColourAmbient=out_Color*ambientLight;;
  28.  
  29. //Point light
  30. vec4 totalDiffuse=vec4(0.0);
  31.  
  32. if(useFakelighting<0.5){
  33. for(int i=0;i<pointLightCount;i++){
  34. float dp=dot(normalize(surfaceNormal), normalize(toPointLight[i]));
  35. float brightness=max(dp, 0.0);
  36. totalDiffuse=totalDiffuse+(brightness*pointLightData[i]);
  37. }
  38. }else{
  39. for(int i=0;i<pointLightCount;i++){
  40. totalDiffuse=totalDiffuse+pointLightData[i];
  41. }
  42. }
  43.  
  44. out_Color=totalDiffuse*out_Color;
  45.  
  46. //Ambient light 01
  47. out_Color=out_Color+textureColourAmbient;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement