1
2#include "../lib/render_context.glslh"
3#include "../lib/util.glslh"
4#include "../interface/standard.glslh"
5
6UNIFORM(1) vec2 origin;
7UNIFORM(2) float timeshift;
8UNIFORM(3) float width;
9UNIFORM(4) float width_exponent;
10UNIFORM(5) int span;
11UNIFORM(6) vec2 args[4];
12
13vec2 pos_rule(float t);
14
15#include "vertex_pos.glslh"
16
17void main(void) {
18	vec2 p = pos_rule(gl_InstanceID * 0.5 + timeshift);
19	vec2 d = p - pos_rule(gl_InstanceID * 0.5 + timeshift - 0.1);
20
21	float t1 = gl_InstanceID - span / 2;
22	float tail = span / 1.9;
23	float s = -0.75 / pow(tail, 2) * (t1 - tail) * (t1 + tail);
24	s = pow(s, width_exponent);
25
26	vec2 pos     = laser_vertex_pos(p, d, s);
27	gl_Position  = r_projectionMatrix * r_modelViewMatrix * vec4(pos, 0.0, 1.0);
28	texCoord     = (r_textureMatrix * vec4(texCoordRawIn, 0.0, 1.0)).xy;
29	texCoordRaw  = texCoordRawIn;
30}
31