ParticlePixelShader.vsh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. uniform sampler2D Texture;
  2. // Camera parameters.
  3. uniform mat4 View;
  4. uniform mat4 Projection;
  5. uniform vec2 ViewportScale;
  6. // The current time, in seconds.
  7. uniform float CurrentTime;
  8. // Parameters describing how the particles animate.
  9. uniform float Duration;
  10. uniform float DurationRandomness;
  11. uniform vec3 Gravity;
  12. uniform float EndVelocity;
  13. uniform vec4 MinColor;
  14. uniform vec4 MaxColor;
  15. // These float2 parameters describe the min and max of a range.
  16. // The actual value is chosen differently for each particle,
  17. // interpolating between x and y by some random amount.
  18. uniform vec2 RotateSpeed;
  19. uniform vec2 StartSize;
  20. uniform vec2 EndSize;
  21. void main()
  22. {
  23. mat4 view = View;
  24. mat4 projection = Projection;
  25. vec2 viewportScale = ViewportScale;
  26. float currentTime = CurrentTime;
  27. float duration = Duration;
  28. float durationRandomness = DurationRandomness;
  29. vec3 gravity = Gravity;
  30. float endVelocity = EndVelocity;
  31. vec4 minColor = MinColor;
  32. vec4 maxColor = MaxColor;
  33. vec2 rotateSpeed = RotateSpeed;
  34. vec2 startSize = StartSize;
  35. vec2 endSize = EndSize;
  36. gl_FrontColor = gl_Color;
  37. gl_TexCoord[0] = gl_MultiTexCoord0;
  38. gl_Position = ftransform();
  39. }