Pixel-Composer/shaders/sh_node_circle/sh_node_circle.fsh

28 lines
524 B
Plaintext
Raw Normal View History

2024-04-22 08:08:37 +02:00
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec4 color;
2024-06-03 05:44:08 +02:00
uniform int fill;
2024-05-31 09:18:09 +02:00
uniform float thickness;
uniform float antialias;
2024-04-22 08:08:37 +02:00
void main() {
2024-05-31 09:18:09 +02:00
float th = thickness == 0.? 0.05 : thickness;
float aa = antialias == 0.? 0.05 : antialias;
2024-04-22 08:08:37 +02:00
2024-06-03 05:44:08 +02:00
float dist = length(v_vTexcoord - .5) * 2. - (1. - th - aa);
float a;
if(fill == 0) {
dist = abs(dist);
a = smoothstep(th + aa, th, dist);
} else if(fill == 1) {
a = smoothstep(aa, 0., dist);
}
vec4 c = mix(vec4(0.), color, a);
2024-04-22 08:08:37 +02:00
gl_FragColor = c;
}