diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-10-04 18:53:05 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-10-04 18:53:05 +0300 |
commit | 4933dd716c10e899257ea025e9dadf4967e68671 (patch) | |
tree | 4e107a5f89fe41abbc8c0dac38e86eef90eedb28 /source | |
parent | 43885491241cf44fdab1dee8ebb24c1df17d5e47 (diff) |
Gizmo: Fix artifacts when having large angles
Reviewer: brecht
Differential Revision: https://developer.blender.org/D3765
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate_util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index 93695e0fbab..d0f0c3aacce 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -230,6 +230,10 @@ static void imm_draw_disk_partial( GPUPrimType prim_type, uint pos, float x, float y, float rad_inner, float rad_outer, int nsegments, float start, float sweep) { + /* to avoid artifacts */ + const float max_angle = 3 * 360; + CLAMP(sweep, -max_angle, max_angle); + /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ const float angle_start = -(DEG2RADF(start)) + (float)(M_PI / 2); const float angle_end = -(DEG2RADF(sweep) - angle_start); |