Pixel-Composer/shaders/sh_stripe/sh_stripe.fsh

27 lines
542 B
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 position;
2022-01-13 05:24:03 +01:00
uniform float angle;
uniform float amount;
uniform int blend;
void main() {
vec2 pos = v_vTexcoord - position;
float prog = pos.x * cos(angle) - pos.y * sin(angle);
2022-01-13 05:24:03 +01:00
float _a = 1. / amount;
float _s = mod(prog, _a);
if(blend == 0) {
if(_s > _a / 2.)
gl_FragColor = vec4(vec3(0.), 1.);
else
gl_FragColor = vec4(vec3(1.), 1.);
} else {
gl_FragColor = vec4(vec3(abs(_s / _a - 0.5) * 2.), 1.);
}
}