prosperon/source/shaders/line.sglsl
2024-04-20 12:55:20 -05:00

63 lines
906 B
Plaintext

@vs lvs
in vec3 apos;
in float adist;
in vec4 acolor;
in float aseglen;
in float asegspeed;
out float dist;
out vec4 fcolor;
out float seg_len;
out float seg_speed;
uniform lvs_params { mat4 proj; };
void main()
{
gl_Position = proj * vec4(apos, 1.0);
fcolor = acolor;
dist = adist;
seg_len = aseglen;
seg_speed = asegspeed;
}
@end
@fs lfs
out vec4 color;
in float dist;
in vec4 fcolor;
in float seg_len;
in float seg_speed;
float pat = 0.5;
int pp = 0x0C24;
uniform lfs_params { uniform float time; };
void main()
{
color = fcolor;
if (seg_len == 0) return;
if (mod(dist+(time*seg_speed)*seg_len,seg_len)/seg_len < 0.5)
discard;
/*
int d = int(dist);
if (pp * mod((d / 20), 16) == 0)
discard;
*/
/*
float patrn = 16 * mod(dist,seg_len)/seg_len;
if (patrn < 8)
discard;
*/
}
@end
@program line lvs lfs