[Bf-blender-cvs] [43a273616b1] blender2.8: No need for while-loop counting curve-normals

Campbell Barton noreply at git.blender.org
Wed Apr 19 18:58:54 CEST 2017


Commit: 43a273616b1965dd6a6e1466f28cfb999b2744e3
Author: Campbell Barton
Date:   Thu Apr 20 02:51:03 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB43a273616b1965dd6a6e1466f28cfb999b2744e3

No need for while-loop counting curve-normals

===================================================================

M	source/blender/editors/space_view3d/drawobject.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 2c02de222d2..b80167ce676 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7345,14 +7345,20 @@ static void draw_editnurb(
 		glLineWidth(1.0f);
 
 		int count = 0;
+		int count_used = 0;
 		for (bl = ob->curve_cache->bev.first, nu = nurb; nu && bl; bl = bl->next, nu = nu->next) {
 			int nr = bl->nr;
 			int skip = nu->resolu / 16;
-			
+
+#if 0
 			while (nr-- > 0) { /* accounts for empty bevel lists */
 				count += 4;
 				nr -= skip;
 			}
+#else
+			/* Same as loop above */
+			count += 4 * max_ii((nr + max_ii(skip - 1, 0)) / (skip + 1), 0);
+#endif
 		}
 
 		if (count > 2) {
@@ -7361,7 +7367,7 @@ static void draw_editnurb(
 				BevPoint *bevp = bl->bevpoints;
 				int nr = bl->nr;
 				int skip = nu->resolu / 16;
-				
+
 				while (nr-- > 0) { /* accounts for empty bevel lists */
 					const float fac = bevp->radius * ts->normalsize;
 					float vec_a[3]; /* Offset perpendicular to the curve */
@@ -7390,8 +7396,12 @@ static void draw_editnurb(
 
 					bevp += skip + 1;
 					nr -= skip;
+					count_used += 4;
 				}
 			}
+			BLI_assert(count == count_used);
+			UNUSED_VARS_NDEBUG(count_used);
+
 			immEnd();
 		}
 		immUnbindProgram();




More information about the Bf-blender-cvs mailing list