taisei/shader/circleclipped_indicator.sha
2017-03-25 00:05:05 +02:00

31 lines
632 B
Text

#version 110
varying vec4 TexCoord0;
void main(void) {
gl_Position = ftransform();
gl_FrontColor = gl_Color;
TexCoord0 = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
%% -- FRAG
#version 110
#define PI 3.1415926535897932384626433832795
uniform sampler2D tex;
uniform float fill;
uniform float tcfactor;
uniform vec4 fill_color;
uniform vec4 back_color;
varying vec4 TexCoord0;
void main(void) {
vec2 tc = TexCoord0.xy;
vec4 texel = texture2D(tex, tc);
tc *= tcfactor;
tc -= vec2(0.5);
texel *= mix(back_color, fill_color, float(atan(tc.x,-tc.y) < PI*(2.0*fill-1.0)));
gl_FragColor = texel;
}