From 8b93265c19feeed2b758046359ac102a1f21278a Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 2 Aug 2021 13:47:32 -0400 Subject: 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 --- source/blender/blenkernel/intern/volume_to_mesh.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/volume_to_mesh.cc') diff --git a/source/blender/blenkernel/intern/volume_to_mesh.cc b/source/blender/blenkernel/intern/volume_to_mesh.cc index 7ab67516242..e9d6eea4614 100644 --- a/source/blender/blenkernel/intern/volume_to_mesh.cc +++ b/source/blender/blenkernel/intern/volume_to_mesh.cc @@ -159,7 +159,7 @@ static Mesh *new_mesh_from_openvdb_data(Span verts, } BKE_mesh_calc_edges(mesh, false, false); - BKE_mesh_calc_normals(mesh); + BKE_mesh_normals_tag_dirty(mesh); return mesh; } -- cgit v1.2.3