Guest User

Untitled

a guest
Jan 27th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. /////////////////////////////////////////////////////////////////////////
  2. // Vertex shader for the final pass
  3. //
  4. // Copyright 2013 DigiPen Institute of Technology
  5. ////////////////////////////////////////////////////////////////////////
  6. #version 330
  7.  
  8. void PhongVS();
  9.  
  10. uniform mat4 ModelMatrix;
  11. uniform mat4 ViewMatrix, ViewInverse;
  12. uniform mat4 ProjectionMatrix;
  13. uniform mat4 NormalMatrix;
  14.  
  15. uniform vec3 lightPos;
  16.  
  17. in vec4 vertex;
  18. in vec3 vertexNormal;
  19. in vec2 vertexTexture;
  20. in vec3 vertexTangent;
  21.  
  22. out vec3 tangent;
  23. out vec2 texCoord;
  24.  
  25. out vec3 normalVec, lightVec, eyeVec;
  26. out vec4 pos;
  27.  
  28. void main()
  29. {  
  30.     tangent = vertexTangent;
  31.     texCoord = vertexTexture;
  32.  
  33.     normalVec = normalize(mat3(NormalMatrix)*vertexNormal);    
  34.    
  35.     vec3 worldVertex = vec3(ModelMatrix * vertex);
  36.     eyeVec = (ViewInverse*vec4(0,0,0,1)).xyz - worldVertex;
  37.     lightVec = lightPos - worldVertex;
  38.  
  39.     gl_Position = ProjectionMatrix*ViewMatrix*ModelMatrix*vertex;
  40.     pos = ModelMatrix*vertex;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment