[Bf-blender-cvs] [8f283d50d7a] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: compute info separate functions for each type

ishbosamiya noreply at git.blender.org
Mon Aug 30 09:15:08 CEST 2021


Commit: 8f283d50d7a9a4b38554bc917bdbf58a8b34e1a7
Author: ishbosamiya
Date:   Sat Aug 28 16:02:05 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB8f283d50d7a9a4b38554bc917bdbf58a8b34e1a7

adaptive_cloth: Mesh: compute info separate functions for each type

`compute_info()` now calls separate functions for each element type
instead of computing it within that function. This allows other parts
of the code to compute info of the element when it is easier to do
over creating a mesh diff.

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

M	source/blender/blenkernel/BKE_cloth_remesh.hh

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

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 9b5a4a14c76..cf58d8970c8 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2888,31 +2888,60 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
     return edge_indices;
   }
 
+  /**
+   * Computes extra data information for given node
+   */
+  void compute_info_node(Node<END> &UNUSED(node))
+  {
+  }
+
+  /**
+   * Computes extra data information for given vert
+   */
+  void compute_info_vert(Vert<EVD> &UNUSED(vert))
+  {
+  }
+
+  /**
+   * Computes extra data information for given edge
+   */
+  void compute_info_edge(Edge<EED> &UNUSED(edge))
+  {
+  }
+
+  /**
+   * Computes extra data information for given face
+   */
+  void compute_info_face(Face<EFD> &face)
+  {
+    this->compute_face_normal(face);
+  }
+
   /**
    * For all added elements within mesh_diff, compute information
    * needed by the mesh. For example, face normals, etc.
    */
   void compute_info(const MeshDiff<END, EVD, EED, EFD> &mesh_diff)
   {
-/* Not using setting anything in these as of right now */
-#  if 0
     for (const auto &node_index : mesh_diff.get_added_nodes()) {
-      const auto &node = this->get_checked_node(node_index);
+      auto &node = this->get_checked_node(node_index);
+      this->compute_info_node(node);
     }
 
     for (const auto &vert_index : mesh_diff.get_added_verts()) {
-      const auto &vert = this->get_checked_vert(vert_index);
+      auto &vert = this->get_checked_vert(vert_index);
+      this->compute_info_vert(vert);
     }
 
     for (const auto &edge_index : mesh_diff.get_added_edges()) {
-      const auto &edge = this->get_checked_edge(edge_index);
+      auto &edge = this->get_checked_edge(edge_index);
+      this->compute_info_edge(edge);
     }
-#  endif
 
     for (const auto &face_index : mesh_diff.get_added_faces()) {
       auto &face = this->get_checked_face(face_index);
 
-      this->compute_face_normal(face);
+      this->compute_info_face(face);
     }
   }



More information about the Bf-blender-cvs mailing list