//--------------------------------------------------------------
attribute vec2 in_Position; //[0 = back, 1 = front], bullet index
//--------------------------------------------------------------
varying vec4 v_vColour;
//--------------------------------------------------------------
uniform float time;
uniform vec2 bullet_position[64]; // <---- line 7
uniform vec2 bullet_speed[64];
uniform vec2 bullet_lifetime[64];
uniform vec3 bullet_colour[64];
//--------------------------------------------------------------
uniform mat4 current_matrix;
uniform mat4 previous_matrix;
//--------------------------------------------------------------
void main() {
int _index = int(in_Position.y);
//--------------------------------------------------------------
vec2 _initial_position = bullet_position[ _index ];
//--------------------------------------------------------------
vec2 _speed = bullet_speed[ _index ];
//--------------------------------------------------------------
float _time_alive = time - bullet_lifetime[ _index ].x;
//--------------------------------------------------------------
vec4 _front_position = current_matrix * vec4( _initial_position + _speed * _time_alive, 0.0, 1.0 );
vec4 _back_position = previous_matrix * vec4( _initial_position + _speed * (_time_alive - 1.0), 0.0, 1.0);
gl_Position = mix( _back_position, _front_position, in_Position.x );
//--------------------------------------------------------------
v_vColour = vec4( bullet_colour[ _index ], 1.0 );
}
//--------------------------------------------------------------