KlassischeKeplerKriege/data/shader/particle.vert

26 lines
549 B
GLSL
Raw Normal View History

2016-09-29 02:24:14 +00:00
#version 120
attribute vec2 in_vertex;
attribute vec2 in_position;
attribute vec2 in_velocity;
2016-09-30 18:19:10 +00:00
uniform float maxAge;
varying float decay;
2016-09-29 07:05:35 +00:00
varying vec2 velocity;
2016-09-29 02:24:14 +00:00
varying vec2 vertex;
uniform float time;
uniform float size;
void main()
{
2016-09-30 18:19:10 +00:00
//decay = min(1.0, time+5.0*length(velocity)) / maxAge;
//decay = max(decay*decay, sqrt(decay));
decay = time / maxAge;
vec2 base = in_vertex;
vec2 p = size*base;
2016-09-29 07:05:35 +00:00
p += log(1.0+time) * in_velocity;
2016-09-29 02:24:14 +00:00
p += in_position;
gl_Position = vec4(p, 0.0, 1.0);
2016-09-29 07:05:35 +00:00
2016-09-30 18:19:10 +00:00
vertex = base;
2016-09-29 07:05:35 +00:00
velocity = in_velocity;
2016-09-29 10:28:35 +00:00
}