prosperon/source/shaders/line.sglsl

63 lines
911 B
Plaintext
Raw Permalink Normal View History

@vs lvs
in vec2 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, 0.0, 1.0);
fcolor = acolor;
dist = adist;
seg_len = aseglen;
seg_speed = asegspeed;
}
@end
@fs lfs
2022-06-21 23:16:14 -05:00
out vec4 color;
2023-05-16 13:31:19 -05:00
in float dist;
in vec4 fcolor;
in float seg_len;
2023-05-25 21:55:55 -05:00
in float seg_speed;
2023-05-16 13:31:19 -05:00
float pat = 0.5;
int pp = 0x0C24;
2023-01-16 02:16:39 -06:00
uniform lfs_params { uniform float time; };
2023-05-24 20:45:50 -05:00
2022-06-21 23:16:14 -05:00
void main()
{
2023-05-16 13:31:19 -05:00
color = fcolor;
2023-05-24 20:45:50 -05:00
if (seg_len == 0) return;
2023-05-25 21:55:55 -05:00
if (mod(dist+(time*seg_speed)*seg_len,seg_len)/seg_len < 0.5)
2023-05-16 13:31:19 -05:00
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;
*/
2023-05-12 13:22:05 -05:00
}
@end
@program line lvs lfs