Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-08-02 20:47:32 +0300
committerHans Goudey <h.goudey@me.com>2021-08-02 20:47:32 +0300
commit8b93265c19feeed2b758046359ac102a1f21278a (patch)
tree326627b050801dbda6994957c62c49c9b4518006 /source/blender/editors/object/object_remesh.cc
parenta2203a27d9298f7e51948e825e6aea992b3ac5b2 (diff)
Mesh: Tag normals dirty instead of calculating
Because mesh vertex and face normals are just derived data, they can be calculated lazily instead of eagerly. Often normal calculation is a relatively expensive task, and the calculation is often redundant if the mesh is deformed afterwards anyway. Instead, normals should be calculated only when they are needed. This commit moves in that direction by adding a new function to tag a mesh's normals dirty and replacing normal calculation with it in some places. Differential Revision: https://developer.blender.org/D12107
Diffstat (limited to 'source/blender/editors/object/object_remesh.cc')
-rw-r--r--source/blender/editors/object/object_remesh.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc
index 82dbc9aaf38..d56cb3c7548 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -166,9 +166,10 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
Mesh *mesh_fixed_poles = BKE_mesh_remesh_voxel_fix_poles(new_mesh);
BKE_id_free(nullptr, new_mesh);
new_mesh = mesh_fixed_poles;
- BKE_mesh_calc_normals(new_mesh);
}
+ BKE_mesh_calc_normals(new_mesh);
+
if (mesh->flag & ME_REMESH_REPROJECT_VOLUME || mesh->flag & ME_REMESH_REPROJECT_PAINT_MASK ||
mesh->flag & ME_REMESH_REPROJECT_SCULPT_FACE_SETS) {
BKE_mesh_runtime_clear_geometry(mesh);