Skip to content

Commit

Permalink
add a small gap between sectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharpm committed Aug 9, 2019
1 parent 3082f41 commit 564180a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backend/glsl_shaders/pie_gs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout(triangle_strip, max_vertices = 64) out;
const float Pi = 3.1415926535;
const float radius = 0.75;
const int PointsOnCircle = 42;
const vec4 center = vec4(0.0, 0.0, 0.0, 1.0);
const vec4 origin = vec4(0.0, 0.0, 0.0, 1.0);

uniform mat4 viewMat;

Expand All @@ -25,13 +25,16 @@ void main()
int Points = max(int(PointsOnCircle * pos.y), 1);
float stepAngle = 2 * Pi * pos.y / Points;

float midAngle = 2 * Pi * (pos.x + pos.y / 2);
vec4 center = vec4(origin.xy + 0.01 * vec2(cos(midAngle), sin(midAngle)), origin.zw);

for (int i = 0; i <= Points; ++i) {
if ((i & 1) == 0) {
gl_Position = viewMat * center;
EmitVertex();
}

gl_Position = viewMat * vec4(center.xy + radius * vec2(cos(currAngle), sin(currAngle)), 0.0, 1.0);
gl_Position = viewMat * vec4(center.xy + radius * vec2(cos(currAngle), sin(currAngle)), center.zw);
EmitVertex();
currAngle += stepAngle;
}
Expand Down

0 comments on commit 564180a

Please sign in to comment.