rsm.vert 947 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. uniform mat4 ModelMatrix;
  2. uniform mat4 RSMMatrix;
  3. uniform mat4 TextureMatrix =
  4. mat4(1., 0., 0., 0.,
  5. 0., 1., 0., 0.,
  6. 0., 0., 1., 0.,
  7. 0., 0., 0., 1.);
  8. #if __VERSION__ >= 330
  9. layout(location = 0) in vec3 Position;
  10. layout(location = 1) in vec3 Normal;
  11. layout(location = 2) in vec4 Color;
  12. layout(location = 3) in vec2 Texcoord;
  13. layout(location = 4) in vec2 SecondTexcoord;
  14. #else
  15. in vec3 Position;
  16. in vec3 Normal;
  17. in vec4 Color;
  18. in vec2 Texcoord;
  19. in vec2 SecondTexcoord;
  20. #endif
  21. out vec3 nor;
  22. out vec2 uv;
  23. out vec2 uv_bis;
  24. out vec4 color;
  25. void main(void)
  26. {
  27. mat4 ModelViewProjectionMatrix = RSMMatrix * ModelMatrix;
  28. mat4 TransposeInverseModel = transpose(inverse(ModelMatrix));
  29. gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
  30. nor = (TransposeInverseModel * vec4(Normal, 0.)).xyz;
  31. uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
  32. uv_bis = SecondTexcoord;
  33. color = Color.zyxw;
  34. }