2013-12-29 13:23:36 -05:00
|
|
|
#version 130
|
|
|
|
uniform int dt;
|
2013-12-30 08:57:55 -05:00
|
|
|
uniform mat4 sourcematrix;
|
2014-01-01 14:13:57 -05:00
|
|
|
uniform mat4 tinvsourcematrix;
|
2013-12-29 13:23:36 -05:00
|
|
|
|
2013-12-31 12:25:10 -05:00
|
|
|
in vec3 particle_position_initial;
|
|
|
|
in float lifetime_initial;
|
2013-12-31 20:11:44 -05:00
|
|
|
in vec3 particle_velocity_initial;
|
|
|
|
in float size_initial;
|
2013-12-31 12:25:10 -05:00
|
|
|
|
2013-12-29 13:23:36 -05:00
|
|
|
in vec3 particle_position;
|
|
|
|
in float lifetime;
|
2013-12-31 20:11:44 -05:00
|
|
|
in vec3 particle_velocity;
|
|
|
|
in float size;
|
2013-12-29 13:23:36 -05:00
|
|
|
|
|
|
|
out vec3 new_particle_position;
|
|
|
|
out float new_lifetime;
|
2013-12-31 20:11:44 -05:00
|
|
|
out vec3 new_particle_velocity;
|
|
|
|
out float new_size;
|
2013-12-29 13:23:36 -05:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2013-12-31 12:25:10 -05:00
|
|
|
vec4 initialposition = sourcematrix * vec4(particle_position_initial, 1.0);
|
2014-01-01 14:13:57 -05:00
|
|
|
vec4 adjusted_initial_velocity = tinvsourcematrix * vec4(particle_velocity_initial, 1.0);
|
|
|
|
adjusted_initial_velocity /= adjusted_initial_velocity.w;
|
2013-12-31 12:25:10 -05:00
|
|
|
new_particle_position = (lifetime < 1.) ? particle_position + particle_velocity.xyz * float(dt) : initialposition.xyz;
|
|
|
|
new_lifetime = (lifetime < 1.) ? lifetime + (float(dt)/lifetime_initial) : 0.;
|
2014-01-01 14:13:57 -05:00
|
|
|
new_particle_velocity = (lifetime < 1.) ? particle_velocity : adjusted_initial_velocity.xyz;
|
2013-12-31 20:11:44 -05:00
|
|
|
new_size = size_initial;
|
2013-12-29 13:23:36 -05:00
|
|
|
gl_Position = vec4(0.);
|
|
|
|
}
|