2017-10-13 12:19:59 -04:00
|
|
|
uniform int flips;
|
|
|
|
|
|
|
|
#ifdef Explicit_Attrib_Location_Usable
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 Position;
|
2017-10-14 00:33:08 -04:00
|
|
|
layout(location = 1) in vec4 mixed_color;
|
|
|
|
layout(location = 2) in vec2 lifetime_and_size;
|
2017-10-13 12:19:59 -04:00
|
|
|
|
|
|
|
layout(location = 3) in vec2 Texcoord;
|
|
|
|
layout(location = 4) in vec2 quadcorner;
|
|
|
|
|
|
|
|
layout(location = 6) in float anglespeed;
|
|
|
|
#else
|
|
|
|
|
|
|
|
in vec3 Position;
|
2017-10-14 00:33:08 -04:00
|
|
|
in vec4 mixed_color;
|
|
|
|
in vec2 lifetime_and_size;
|
2017-10-13 12:19:59 -04:00
|
|
|
|
|
|
|
in vec2 Texcoord;
|
|
|
|
in vec2 quadcorner;
|
|
|
|
|
2017-10-14 02:42:24 -04:00
|
|
|
in float anglespeed;
|
2017-10-13 12:19:59 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
out vec2 tc;
|
|
|
|
out vec4 pc;
|
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2017-10-14 00:33:08 -04:00
|
|
|
if (lifetime_and_size.y == 0.0)
|
2017-10-13 12:19:59 -04:00
|
|
|
{
|
2017-10-13 21:47:13 -04:00
|
|
|
gl_Position = vec4(0.);
|
2017-10-13 12:19:59 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
tc = Texcoord;
|
2017-10-14 00:33:08 -04:00
|
|
|
pc = mixed_color.zyxw * smoothstep(1.0, 0.8, lifetime_and_size.x);
|
2017-10-13 12:19:59 -04:00
|
|
|
#if !defined(sRGB_Framebuffer_Usable) && !defined(Advanced_Lighting_Enabled)
|
2017-10-14 00:33:08 -04:00
|
|
|
pc.rgb = pow(pc.rgb, vec3(1.0 / 2.2));
|
2017-10-13 12:19:59 -04:00
|
|
|
#endif
|
|
|
|
vec4 viewpos = vec4(0.);
|
|
|
|
if (flips == 1)
|
|
|
|
{
|
2017-10-14 00:33:08 -04:00
|
|
|
float angle = lifetime_and_size.x * anglespeed;
|
2017-10-13 21:47:13 -04:00
|
|
|
float sin_a = sin(mod(angle / 2.0, 6.283185307179586));
|
|
|
|
float cos_a = cos(mod(angle / 2.0, 6.283185307179586));
|
|
|
|
vec4 quat = normalize(vec4(vec3(0.0, 1.0, 0.0) * sin_a, cos_a));
|
2017-10-14 00:33:08 -04:00
|
|
|
vec3 newquadcorner = lifetime_and_size.y * vec3(quadcorner, 0.);
|
2017-10-13 21:47:13 -04:00
|
|
|
newquadcorner = newquadcorner + 2.0 * cross(cross(newquadcorner,
|
|
|
|
quat.xyz) + quat.w * newquadcorner, quat.xyz);
|
2017-10-13 12:19:59 -04:00
|
|
|
viewpos = ViewMatrix * vec4(Position + newquadcorner, 1.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
viewpos = ViewMatrix * vec4(Position, 1.0);
|
2017-10-14 00:33:08 -04:00
|
|
|
viewpos += lifetime_and_size.y * vec4(quadcorner, 0., 0.);
|
2017-10-13 12:19:59 -04:00
|
|
|
}
|
|
|
|
gl_Position = ProjectionMatrix * viewpos;
|
|
|
|
}
|