Advertisement
Guest User

Untitled

a guest
Mar 17th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. .vert
  2.  
  3. #version 150
  4.  
  5. uniform mat4 MVPMatrix;
  6. uniform mat3 normalMatrix;
  7.  
  8. in vec3 position;
  9. in vec3 normal;
  10.  
  11. out Data {
  12.     vec3 normal;
  13. } DataOut;
  14.  
  15. void main()
  16. {
  17.     DataOut.normal = normalize(normalMatrix * normal);
  18.  
  19.     gl_Position = MVPMatrix * vec4(position, 1.0);
  20. }
  21.  
  22. .frag
  23.  
  24. #version 150
  25.  
  26. uniform vec3 diffuse = vec3(0.72265625, 0.4765625, 0.33984375);
  27. uniform vec3 l_dir;
  28.  
  29. in Data {
  30.     vec3 normal;
  31. } DataIn;
  32.  
  33. out vec4 outputColor;
  34.  
  35. void main()
  36. {
  37.  
  38.     vec3 n = normalize(DataIn.normal);
  39.  
  40.     float intensity = max(dot(n, l_dir), 0.0);
  41.  
  42.     outputColor = vec4(intensity * diffuse, 1.0);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement