particle.vert 744 B

1234567891011121314151617181920212223242526272829303132333435
  1. uniform vec3 color_from;
  2. uniform vec3 color_to;
  3. #if __VERSION__ >= 330
  4. layout(location=0) in vec3 Position;
  5. layout(location = 1) in float lifetime;
  6. layout(location = 2) in float size;
  7. layout(location=3) in vec2 Texcoord;
  8. layout(location = 4) in vec2 quadcorner;
  9. #else
  10. in vec3 Position;
  11. in float lifetime;
  12. in float size;
  13. in vec2 Texcoord;
  14. in vec2 quadcorner;
  15. #endif
  16. out float lf;
  17. out vec2 tc;
  18. out vec3 pc;
  19. void main(void)
  20. {
  21. tc = Texcoord;
  22. lf = lifetime;
  23. pc = color_from + (color_to - color_from) * lifetime;
  24. vec3 newposition = Position;
  25. vec4 viewpos = ViewMatrix * vec4(newposition, 1.0);
  26. viewpos += size * vec4(quadcorner, 0., 0.);
  27. gl_Position = ProjectionMatrix * viewpos;
  28. }