From 8f283d50d7a9a4b38554bc917bdbf58a8b34e1a7 Mon Sep 17 00:00:00 2001 From: ishbosamiya Date: Sat, 28 Aug 2021 16:02:05 +0530 Subject: 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. --- source/blender/blenkernel/BKE_cloth_remesh.hh | 43 ++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'source/blender') 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 class Mesh { return edge_indices; } + /** + * Computes extra data information for given node + */ + void compute_info_node(Node &UNUSED(node)) + { + } + + /** + * Computes extra data information for given vert + */ + void compute_info_vert(Vert &UNUSED(vert)) + { + } + + /** + * Computes extra data information for given edge + */ + void compute_info_edge(Edge &UNUSED(edge)) + { + } + + /** + * Computes extra data information for given face + */ + void compute_info_face(Face &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 &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); } } -- cgit v1.2.3