You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
657 B

  1. #version 100
  2. // Input vertex attributes
  3. attribute vec3 vertexPosition;
  4. // Input uniform values
  5. uniform mat4 mvp;
  6. uniform float currentTime;
  7. // NOTE: Add here your custom variables
  8. void main()
  9. {
  10. // Unpack data from vertexPosition
  11. vec2 pos = vertexPosition.xy;
  12. float period = vertexPosition.z;
  13. // Calculate final vertex position (jiggle it around a bit horizontally)
  14. pos += vec2(100.0, 0.0) * sin(period * currentTime);
  15. gl_Position = mvp * vec4(pos.x, pos.y, 0.0, 1.0);
  16. // Calculate the screen space size of this particle (also vary it over time)
  17. gl_PointSize = 10.0 - 5.0 * abs(sin(period * currentTime));
  18. }