Gizmo: support for filled circle with inner non-zero radius
authorCampbell Barton <ideasman42@gmail.com>
Mon, 1 Jul 2019 15:47:51 +0000 (01:47 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 1 Jul 2019 15:48:58 +0000 (01:48 +1000)
Needed for changes to the scale gizmo.

source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c

index 31e30a0dd1a119241eb148041738800d5bb3c384..6d8ab096a26b9c4824f6f61825e1fd6a9de26425 100644 (file)
@@ -129,7 +129,26 @@ static void dial_geom_draw(const float color[4],
   immUniformColor4fv(color);
 
   if (filled) {
-    imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
+    if (arc_partial_angle == 0.0f) {
+      if (arc_inner_factor == 0.0f) {
+        imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
+      }
+      else {
+        imm_draw_disk_partial_fill_2d(
+            pos, 0, 0, arc_inner_factor, 1.0f, DIAL_RESOLUTION, 0, RAD2DEGF(M_PI * 2));
+      }
+    }
+    else {
+      float arc_partial_deg = RAD2DEGF((M_PI * 2) - arc_partial_angle);
+      imm_draw_disk_partial_fill_2d(pos,
+                                    0,
+                                    0,
+                                    arc_inner_factor,
+                                    1.0f,
+                                    DIAL_RESOLUTION,
+                                    -arc_partial_deg / 2,
+                                    arc_partial_deg);
+    }
   }
   else {
     if (arc_partial_angle == 0.0f) {