[Bf-blender-cvs] [3a18e304be5] master: Cleanup: remove disabled face tessellation logic

Campbell Barton noreply at git.blender.org
Tue Jun 1 06:04:34 CEST 2021


Commit: 3a18e304be5ce6f800b997879a3c5c0fe357b330
Author: Campbell Barton
Date:   Tue Jun 1 12:49:22 2021 +1000
Branches: master
https://developer.blender.org/rB3a18e304be5ce6f800b997879a3c5c0fe357b330

Cleanup: remove disabled face tessellation logic

This was kept since these blocks are easier to follow.
Remove as the overall result wasn't so readable
(especially with nested ifdef's).

Replace disabled code with comment on the indices used for quads/tris.

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

M	source/blender/bmesh/intern/bmesh_polygon.c

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

diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 5e6635cc929..f1e6da9b746 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -1547,51 +1547,17 @@ void BM_mesh_calc_tessellation(BMesh *bm, BMLoop *(*looptris)[3])
 
   BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
     BLI_assert(efa->len >= 3);
-    /* don't consider two-edged faces */
-    if (0) {
-      /* do nothing (needed for else statements below) */
-    }
-
 #ifdef USE_TESSFACE_SPEEDUP
-
-    /* no need to ensure the loop order, we know its ok */
-
-    else if (efa->len == 3) {
-#  if 0
-      int j;
-      BM_ITER_ELEM_INDEX(l, &liter, efa, BM_LOOPS_OF_FACE, j) {
-        looptris[i][j] = l;
-      }
-      i += 1;
-#  else
-      /* more cryptic but faster */
+    if (efa->len == 3) {
+      /* `0 1 2` -> `0 1 2` */
       BMLoop *l;
       BMLoop **l_ptr = looptris[i++];
       l_ptr[0] = l = BM_FACE_FIRST_LOOP(efa);
       l_ptr[1] = l = l->next;
       l_ptr[2] = l->next;
-#  endif
     }
     else if (efa->len == 4) {
-#  if 0
-      BMLoop *ltmp[4];
-      int j;
-      BLI_array_grow_items(looptris, 2);
-      BM_ITER_ELEM_INDEX(l, &liter, efa, BM_LOOPS_OF_FACE, j) {
-        ltmp[j] = l;
-      }
-
-      looptris[i][0] = ltmp[0];
-      looptris[i][1] = ltmp[1];
-      looptris[i][2] = ltmp[2];
-      i += 1;
-
-      looptris[i][0] = ltmp[0];
-      looptris[i][1] = ltmp[2];
-      looptris[i][2] = ltmp[3];
-      i += 1;
-#  else
-      /* more cryptic but faster */
+      /* `0 1 2 3` -> (`0 1 2`, `0 2 3`) */
       BMLoop *l;
       BMLoop **l_ptr_a = looptris[i++];
       BMLoop **l_ptr_b = looptris[i++];
@@ -1599,7 +1565,6 @@ void BM_mesh_calc_tessellation(BMesh *bm, BMLoop *(*looptris)[3])
       (l_ptr_a[1] = l = l->next);
       (l_ptr_a[2] = l_ptr_b[1] = l = l->next);
       (l_ptr_b[2] = l->next);
-#  endif
 
       if (UNLIKELY(is_quad_flip_v3_first_third_fast(
               l_ptr_a[0]->v->co, l_ptr_a[1]->v->co, l_ptr_a[2]->v->co, l_ptr_b[2]->v->co))) {
@@ -1608,10 +1573,9 @@ void BM_mesh_calc_tessellation(BMesh *bm, BMLoop *(*looptris)[3])
         l_ptr_b[0] = l_ptr_a[1];
       }
     }
-
+    else
 #endif /* USE_TESSFACE_SPEEDUP */
-
-    else {
+    {
       int j;
 
       BMLoop *l_iter;



More information about the Bf-blender-cvs mailing list