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:
authorCampbell Barton <ideasman42@gmail.com>2021-06-15 07:51:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-15 07:54:34 +0300
commit819152527fd425fef54107bd6841887ace51e66e (patch)
tree017fa67552d75e36e48a4cd4d8b474f8ca8994c2 /source/blender/bmesh
parent89e2b441ede8b4ef1412ad548d4df689d82f6d1c (diff)
BMesh: assert that face normals have been updated for tessellation
This catches missing normal updates that may cause invalid tessellation.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_tessellate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c
index ca1218c97f6..2f9d5758385 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c
@@ -58,6 +58,13 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(BMLoop *(*looptris)[3],
MemArena **pf_arena_p,
const bool face_normal)
{
+#ifdef DEBUG
+ /* The face normal is used for projecting faces into 2D space for tessellation.
+ * Invalid normals may result in invalid tessellation.
+ * Either `face_normal` should be true or normals should be updated first. */
+ BLI_assert(face_normal || BM_face_is_normal_valid(efa));
+#endif
+
switch (efa->len) {
case 3: {
/* `0 1 2` -> `0 1 2` */