Cleanup: use 'bmesh' prefix for BMesh tessellation utilities master
authorCampbell Barton <ideasman42@gmail.com>
Fri, 18 Jun 2021 06:37:43 +0000 (16:37 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 18 Jun 2021 06:37:43 +0000 (16:37 +1000)
source/blender/bmesh/intern/bmesh_mesh_tessellate.c

index 7ae0c3923fa8a65c263fce531632463c347bb5f6..7509f9eed7038c97b12b442741ece7df67d698f5 100644 (file)
 /**
  * \param face_normal: This will be optimized out as a constant.
  */
-BLI_INLINE void mesh_calc_tessellation_for_face_impl(BMLoop *(*looptris)[3],
-                                                     BMFace *efa,
-                                                     MemArena **pf_arena_p,
-                                                     const bool face_normal)
+BLI_INLINE void bmesh_calc_tessellation_for_face_impl(BMLoop *(*looptris)[3],
+                                                      BMFace *efa,
+                                                      MemArena **pf_arena_p,
+                                                      const bool face_normal)
 {
 #ifdef DEBUG
   /* The face normal is used for projecting faces into 2D space for tessellation.
@@ -153,18 +153,18 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(BMLoop *(*looptris)[3],
   }
 }
 
-static void mesh_calc_tessellation_for_face(BMLoop *(*looptris)[3],
-                                            BMFace *efa,
-                                            MemArena **pf_arena_p)
+static void bmesh_calc_tessellation_for_face(BMLoop *(*looptris)[3],
+                                             BMFace *efa,
+                                             MemArena **pf_arena_p)
 {
-  mesh_calc_tessellation_for_face_impl(looptris, efa, pf_arena_p, false);
+  bmesh_calc_tessellation_for_face_impl(looptris, efa, pf_arena_p, false);
 }
 
-static void mesh_calc_tessellation_for_face_with_normal(BMLoop *(*looptris)[3],
-                                                        BMFace *efa,
-                                                        MemArena **pf_arena_p)
+static void bmesh_calc_tessellation_for_face_with_normal(BMLoop *(*looptris)[3],
+                                                         BMFace *efa,
+                                                         MemArena **pf_arena_p)
 {
-  mesh_calc_tessellation_for_face_impl(looptris, efa, pf_arena_p, true);
+  bmesh_calc_tessellation_for_face_impl(looptris, efa, pf_arena_p, true);
 }
 
 /**
@@ -191,14 +191,14 @@ static void bm_mesh_calc_tessellation__single_threaded(BMesh *bm,
     BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
       BLI_assert(efa->len >= 3);
       BM_face_calc_normal(efa, efa->no);
-      mesh_calc_tessellation_for_face_with_normal(looptris + i, efa, &pf_arena);
+      bmesh_calc_tessellation_for_face_with_normal(looptris + i, efa, &pf_arena);
       i += efa->len - 2;
     }
   }
   else {
     BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
       BLI_assert(efa->len >= 3);
-      mesh_calc_tessellation_for_face(looptris + i, efa, &pf_arena);
+      bmesh_calc_tessellation_for_face(looptris + i, efa, &pf_arena);
       i += efa->len - 2;
     }
   }
@@ -215,32 +215,32 @@ struct TessellationUserTLS {
   MemArena *pf_arena;
 };
 
-static void mesh_calc_tessellation_for_face_fn(void *__restrict userdata,
-                                               MempoolIterData *mp_f,
-                                               const TaskParallelTLS *__restrict tls)
+static void bmesh_calc_tessellation_for_face_fn(void *__restrict userdata,
+                                                MempoolIterData *mp_f,
+                                                const TaskParallelTLS *__restrict tls)
 {
   struct TessellationUserTLS *tls_data = tls->userdata_chunk;
   BMLoop *(*looptris)[3] = userdata;
   BMFace *f = (BMFace *)mp_f;
   BMLoop *l = BM_FACE_FIRST_LOOP(f);
   const int offset = BM_elem_index_get(l) - (BM_elem_index_get(f) * 2);
-  mesh_calc_tessellation_for_face(looptris + offset, f, &tls_data->pf_arena);
+  bmesh_calc_tessellation_for_face(looptris + offset, f, &tls_data->pf_arena);
 }
 
-static void mesh_calc_tessellation_for_face_with_normals_fn(void *__restrict userdata,
-                                                            MempoolIterData *mp_f,
-                                                            const TaskParallelTLS *__restrict tls)
+static void bmesh_calc_tessellation_for_face_with_normals_fn(void *__restrict userdata,
+                                                             MempoolIterData *mp_f,
+                                                             const TaskParallelTLS *__restrict tls)
 {
   struct TessellationUserTLS *tls_data = tls->userdata_chunk;
   BMLoop *(*looptris)[3] = userdata;
   BMFace *f = (BMFace *)mp_f;
   BMLoop *l = BM_FACE_FIRST_LOOP(f);
   const int offset = BM_elem_index_get(l) - (BM_elem_index_get(f) * 2);
-  mesh_calc_tessellation_for_face_with_normal(looptris + offset, f, &tls_data->pf_arena);
+  bmesh_calc_tessellation_for_face_with_normal(looptris + offset, f, &tls_data->pf_arena);
 }
 
-static void mesh_calc_tessellation_for_face_free_fn(const void *__restrict UNUSED(userdata),
-                                                    void *__restrict tls_v)
+static void bmesh_calc_tessellation_for_face_free_fn(const void *__restrict UNUSED(userdata),
+                                                     void *__restrict tls_v)
 {
   struct TessellationUserTLS *tls_data = tls_v;
   if (tls_data->pf_arena) {
@@ -259,11 +259,11 @@ static void bm_mesh_calc_tessellation__multi_threaded(BMesh *bm,
   BLI_parallel_mempool_settings_defaults(&settings);
   settings.userdata_chunk = &tls_dummy;
   settings.userdata_chunk_size = sizeof(tls_dummy);
-  settings.func_free = mesh_calc_tessellation_for_face_free_fn;
+  settings.func_free = bmesh_calc_tessellation_for_face_free_fn;
   BM_iter_parallel(bm,
                    BM_FACES_OF_MESH,
-                   face_normals ? mesh_calc_tessellation_for_face_with_normals_fn :
-                                  mesh_calc_tessellation_for_face_fn,
+                   face_normals ? bmesh_calc_tessellation_for_face_with_normals_fn :
+                                  bmesh_calc_tessellation_for_face_fn,
                    looptris,
                    &settings);
 }
@@ -300,19 +300,19 @@ struct PartialTessellationUserTLS {
   MemArena *pf_arena;
 };
 
-static void mesh_calc_tessellation_for_face_partial_fn(void *__restrict userdata,
-                                                       const int index,
-                                                       const TaskParallelTLS *__restrict tls)
+static void bmesh_calc_tessellation_for_face_partial_fn(void *__restrict userdata,
+                                                        const int index,
+                                                        const TaskParallelTLS *__restrict tls)
 {
   struct PartialTessellationUserTLS *tls_data = tls->userdata_chunk;
   struct PartialTessellationUserData *data = userdata;
   BMFace *f = data->faces[index];
   BMLoop *l = BM_FACE_FIRST_LOOP(f);
   const int offset = BM_elem_index_get(l) - (BM_elem_index_get(f) * 2);
-  mesh_calc_tessellation_for_face(data->looptris + offset, f, &tls_data->pf_arena);
+  bmesh_calc_tessellation_for_face(data->looptris + offset, f, &tls_data->pf_arena);
 }
 
-static void mesh_calc_tessellation_for_face_partial_with_normals_fn(
+static void bmesh_calc_tessellation_for_face_partial_with_normals_fn(
     void *__restrict userdata, const int index, const TaskParallelTLS *__restrict tls)
 {
   struct PartialTessellationUserTLS *tls_data = tls->userdata_chunk;
@@ -320,10 +320,10 @@ static void mesh_calc_tessellation_for_face_partial_with_normals_fn(
   BMFace *f = data->faces[index];
   BMLoop *l = BM_FACE_FIRST_LOOP(f);
   const int offset = BM_elem_index_get(l) - (BM_elem_index_get(f) * 2);
-  mesh_calc_tessellation_for_face_with_normal(data->looptris + offset, f, &tls_data->pf_arena);
+  bmesh_calc_tessellation_for_face_with_normal(data->looptris + offset, f, &tls_data->pf_arena);
 }
 
-static void mesh_calc_tessellation_for_face_partial_free_fn(
+static void bmesh_calc_tessellation_for_face_partial_free_fn(
     const void *__restrict UNUSED(userdata), void *__restrict tls_v)
 {
   struct PartialTessellationUserTLS *tls_data = tls_v;
@@ -350,14 +350,14 @@ static void bm_mesh_calc_tessellation_with_partial__multi_threaded(
   settings.use_threading = true;
   settings.userdata_chunk = &tls_dummy;
   settings.userdata_chunk_size = sizeof(tls_dummy);
-  settings.func_free = mesh_calc_tessellation_for_face_partial_free_fn;
+  settings.func_free = bmesh_calc_tessellation_for_face_partial_free_fn;
 
   BLI_task_parallel_range(0,
                           faces_len,
                           &data,
                           params->face_normals ?
-                              mesh_calc_tessellation_for_face_partial_with_normals_fn :
-                              mesh_calc_tessellation_for_face_partial_fn,
+                              bmesh_calc_tessellation_for_face_partial_with_normals_fn :
+                              bmesh_calc_tessellation_for_face_partial_fn,
                           &settings);
 }
 
@@ -376,7 +376,7 @@ static void bm_mesh_calc_tessellation_with_partial__single_threaded(
       BMFace *f = faces[index];
       BMLoop *l = BM_FACE_FIRST_LOOP(f);
       const int offset = BM_elem_index_get(l) - (BM_elem_index_get(f) * 2);
-      mesh_calc_tessellation_for_face_with_normal(looptris + offset, f, &pf_arena);
+      bmesh_calc_tessellation_for_face_with_normal(looptris + offset, f, &pf_arena);
     }
   }
   else {
@@ -384,7 +384,7 @@ static void bm_mesh_calc_tessellation_with_partial__single_threaded(
       BMFace *f = faces[index];
       BMLoop *l = BM_FACE_FIRST_LOOP(f);
       const int offset = BM_elem_index_get(l) - (BM_elem_index_get(f) * 2);
-      mesh_calc_tessellation_for_face(looptris + offset, f, &pf_arena);
+      bmesh_calc_tessellation_for_face(looptris + offset, f, &pf_arena);
     }
   }
 
@@ -425,10 +425,10 @@ void BM_mesh_calc_tessellation_with_partial(BMesh *bm,
  * Avoid degenerate triangles.
  * \{ */
 
-static int mesh_calc_tessellation_for_face_beauty(BMLoop *(*looptris)[3],
-                                                  BMFace *efa,
-                                                  MemArena **pf_arena_p,
-                                                  Heap **pf_heap_p)
+static int bmesh_calc_tessellation_for_face_beauty(BMLoop *(*looptris)[3],
+                                                   BMFace *efa,
+                                                   MemArena **pf_arena_p,
+                                                   Heap **pf_heap_p)
 {
   switch (efa->len) {
     case 3: {
@@ -558,7 +558,7 @@ void BM_mesh_calc_tessellation_beauty(BMesh *bm, BMLoop *(*looptris)[3])
 
   BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
     BLI_assert(efa->len >= 3);
-    i += mesh_calc_tessellation_for_face_beauty(looptris + i, efa, &pf_arena, &pf_heap);
+    i += bmesh_calc_tessellation_for_face_beauty(looptris + i, efa, &pf_arena, &pf_heap);
   }
 
   if (pf_arena) {