worldVertex.vs 702 B

1234567891011121314151617181920212223242526272829303132
  1. #version 430
  2. layout (location = 0) in vec3 position;
  3. layout (location = 1) in vec2 tex;
  4. layout (location = 2) in vec3 normal;
  5. uniform mat4 proj;
  6. uniform mat4 view;
  7. uniform mat4 model;
  8. uniform mat4 projViewShadow;
  9. out vec3 varPosition;
  10. out vec2 varTex;
  11. out vec3 varNormal;
  12. out vec4 varShadow;
  13. void main(void) {
  14. // transforming normals must not use the fourth dimension
  15. // should be the inverse transposed matrix
  16. varNormal = (model * vec4(normal, 0.0)).xyz;
  17. varTex = tex;
  18. vec4 modelPos = model * vec4(position, 1.0);
  19. vec4 worldPos = view * modelPos;
  20. varPosition = worldPos.xyz;
  21. gl_Position = proj * worldPos;
  22. varShadow = projViewShadow * modelPos;
  23. }