[Bf-blender-cvs] [1717a4d55c8] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: compute info for newly added elements

ishbosamiya noreply at git.blender.org
Sun Aug 22 17:23:37 CEST 2021


Commit: 1717a4d55c8ede0ef93abe07198901de0fa86b5e
Author: ishbosamiya
Date:   Wed Aug 11 00:05:50 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB1717a4d55c8ede0ef93abe07198901de0fa86b5e

adaptive_cloth: Mesh: compute info for newly added elements

Using MeshDiff which provides the newly added elements, iterate over
these elements and calculate certain required information. This makes
it easier to take care of things. If there is a MeshDiff produced,
always call compute_info() with it. This ensures all required
information is always available.

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

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 9a28f039608..ab661ac484e 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2791,6 +2791,34 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
     return edge_indices;
   }
 
+  /**
+   * 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);
+    }
+
+    for (const auto &vert_index : mesh_diff.get_added_verts()) {
+      const auto &vert = this->get_checked_vert(vert_index);
+    }
+
+    for (const auto &edge_index : mesh_diff.get_added_edges()) {
+      const auto &edge = this->get_checked_edge(edge_index);
+    }
+#  endif
+
+    for (const auto &face_index : mesh_diff.get_added_faces()) {
+      auto &face = this->get_checked_face(face_index);
+
+      this->compute_face_normal(face);
+    }
+  }
+
  private:
   /* all private static methods */
   /* all private non-static methods */



More information about the Bf-blender-cvs mailing list