Skip to content

Commit

Permalink
Step 3 - Drawing an arc
Browse files Browse the repository at this point in the history
  • Loading branch information
PixelsCommander committed Oct 21, 2017
1 parent d41af0d commit d9ca15e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fragment-shader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,17 @@ float sector(vec2 coord, vec2 center, float startAngle, float endAngle) {
}
}

float arc(vec2 uv, vec2 center, float startAngle, float endAngle, float innerRadius, float outerRadius) {
float result = 0.0;
result = sector(uv, center, startAngle, endAngle) * circle(uv, center, outerRadius) * (1.0 - circle(uv, center, innerRadius));
return result;
}

void main() {
vec2 coord = vec2(gl_FragCoord);
float isFilled = circle(coord, center, radius) * sector(coord, center, 0., 75.);
float width = 7.;
float outerRadius = min(u_resolution.x, u_resolution.y) * .5;
float innerRadius = outerRadius - width;
float isFilled = arc(coord, center, 0., 75., innerRadius, outerRadius);
gl_FragColor = vec4(1. - isFilled);
}

0 comments on commit d9ca15e

Please sign in to comment.