grass_pass.vert 718 B

12345678910111213141516171819202122232425262728
  1. uniform vec3 windDir;
  2. uniform mat4 ModelMatrix;
  3. uniform mat4 InverseModelMatrix;
  4. #if __VERSION__ >= 330
  5. layout(location = 0) in vec3 Position;
  6. layout(location = 1) in vec3 Normal;
  7. layout(location = 2) in vec4 Color;
  8. layout(location = 3) in vec2 Texcoord;
  9. #else
  10. in vec3 Position;
  11. in vec3 Normal;
  12. in vec4 Color;
  13. in vec2 Texcoord;
  14. #endif
  15. out vec3 nor;
  16. out vec2 uv;
  17. void main()
  18. {
  19. uv = Texcoord;
  20. mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
  21. mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
  22. nor = (TransposeInverseModelView * vec4(Normal, 1.)).xyz;
  23. gl_Position = ModelViewProjectionMatrix * vec4(Position + windDir * Color.r, 1.);
  24. }