[Bf-blender-cvs] [c73bc92e06b] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: collapse edges: run flip edges

ishbosamiya noreply at git.blender.org
Mon Aug 9 11:13:29 CEST 2021


Commit: c73bc92e06ba25bea1f2b35392e9c78b3417b9c4
Author: ishbosamiya
Date:   Sun Aug 8 18:28:04 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBc73bc92e06ba25bea1f2b35392e9c78b3417b9c4

adaptive_cloth: AdaptiveMesh: collapse edges: run flip edges

It is important that the total update to faces of the mesh (collapse
followed by flip edges) is added to the new_active_faces.

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

M	source/blender/blenkernel/intern/cloth_remesh.cc

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

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 5faf2e92193..12b77a40198 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -346,9 +346,9 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
   /**
    * Flip edges of the `active_faces` if needed.
    *
-   * Might make sense to take `active_faces` by move semantics later.
+   * Updates the active_faces in place
    */
-  void flip_edges(blender::Vector<FaceIndex> active_faces)
+  void flip_edges(blender::Vector<FaceIndex> &active_faces)
   {
     auto max_loop_cycles = active_faces.size() * 3;
     auto loop_cycles_until_now = 0;
@@ -433,7 +433,8 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
 
         /* Flip edges of those faces that were created during the
          * split edge operation */
-        this->flip_edges(mesh_diff.get_added_faces());
+        auto added_faces = mesh_diff.get_added_faces();
+        this->flip_edges(added_faces);
       }
 
       splittable_edges_set = this->get_splittable_edge_indices_set();
@@ -494,9 +495,17 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
             dump_file(after_flip_filename, after_flip_msgpack);
 #endif
             const auto mesh_diff = op_mesh_diff.value();
-            /* TODO(ish): flip edges on newly added faces */
-            for (const auto &added_face : mesh_diff.get_added_faces()) {
-              new_active_faces.add_new(added_face);
+
+            /* Must run flip edges on the newly added faces and
+             * together the newly added faces must be added to
+             * new_active_faces */
+            {
+              auto active_faces_from_flip_edges = mesh_diff.get_added_faces();
+              this->flip_edges(active_faces_from_flip_edges);
+
+              for (const auto &added_face : active_faces_from_flip_edges) {
+                new_active_faces.add_new(added_face);
+              }
             }
           }
         }



More information about the Bf-blender-cvs mailing list