grk_5sem_labs/cw 2/shaders/shader_2_1.frag
2023-11-18 02:25:43 +01:00

30 lines
756 B
GLSL

#version 430 core
uniform float time;
uniform vec4 background_color;
flat in vec4 color;
out vec4 out_color;
in vec4 pos_local;
in vec4 pos_global;
void main()
{
// out_color = color;
// out_color = color / time;
// out_color = mix(color, background_color, abs(sin(time / 4.0)));
//zad 7
// out_color = pos_local;
// out_color = pos_global;
//zad 8*
vec4 final_color = color;
float stripe_width = 0.04;
float stripe_every = 0.1;
float stripe = mod(pos_local.x + time * 0.02, stripe_every);
//float stripe = mod(pos_local.x, stripe_every);
//final_color.rgb *= smoothstep(0.02, 0.2, stripe);
float jump_effect = step(stripe, stripe_every - stripe_width) * step(stripe_width, stripe);
final_color.rgb *= jump_effect;
out_color = final_color;
}