daily pastebin goal
68%
SHARE
TWEET

Vertex shd

a guest Jan 14th, 2018 50 in 4 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 130
  2.  
  3. in vec3 normal;
  4. in vec3 position;
  5. in vec2 textureCoords;
  6.  
  7. out vec2 pass_textureCoords;   
  8. out vec3 surfaceNormal;
  9. out vec3 toLightVec;
  10.  
  11. uniform mat4 transformationMatrix;
  12. uniform mat4 projectionMatrix;
  13. uniform mat4 viewMatrix;
  14. uniform vec3 lightPos;
  15.  
  16. void main(void) {
  17.     vec4 worldPos = transformationMatrix * vec4(position, 1.0);
  18.     gl_Position = projectionMatrix * viewMatrix * worldPos;
  19.     pass_textureCoords = textureCoords;
  20.    
  21.     surfaceNormal = (transformationMatrix * vec4(normal, 0.0)).xyz;
  22.     toLightVec = lightPos - worldPos.xyz;
  23. }
RAW Paste Data
Top