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/BKE_mesh.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/BKE_mesh.h') diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index e3be9cd8ef8..ef1384c804b 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -280,6 +280,7 @@ void BKE_mesh_recalc_looptri_with_normals(const struct MLoop *mloop, /* *** mesh_normals.cc *** */ +void BKE_mesh_normals_tag_dirty(struct Mesh *mesh); void BKE_mesh_calc_normals_mapping_simple(struct Mesh *me); void BKE_mesh_calc_normals_mapping(struct MVert *mverts, int numVerts, -- cgit v1.2.3