Gizmo: Fix artifacts when having large angles

Reviewer: brecht

Differential Revision: https://developer.blender.org/D3765
This commit is contained in:
2018-10-04 17:53:05 +02:00
parent 4388549124
commit 4933dd716c

View File

@@ -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);