diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-14 15:56:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-14 16:01:19 +0300 |
commit | 8a1860bd9aecddf611b64e3e842bdc8c76f15cc6 (patch) | |
tree | 52afad79ca08551fa22bb35d082719299f0476ef /source/blender/editors/object | |
parent | 6bef2559047461794eb3ff27de15f4caf5ddcf1e (diff) |
BMesh: support face-normal calculation in normal & looptri functions
Support calculating face normals when tessellating. When this is done
before updating vertex normals it gives ~20% performance improvement.
Now vertex normal calculation only needs to perform a single pass on the
mesh vertices when called after tessellation.
Extended versions of normal & looptri update functions have been added:
- BM_mesh_calc_tessellation_ex
- BM_mesh_normals_update_ex
Most callers don't need to be aware of this detail by using:
- BKE_editmesh_looptri_and_normals_calc
- BKE_editmesh_looptri_and_normals_calc_with_partial
- EDBM_update also takes advantage of this,
where calling EDBM_update with calc_looptri & calc_normals
enabled uses the faster normal updating logic.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 3 |
3 files changed, 3 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5be572baec5..c8923bb55c1 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -794,9 +794,7 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag BMEditMesh *em = BKE_editmesh_from_object(ob); if (LIKELY(em)) { - /* order doesn't matter */ - EDBM_mesh_normals_update(em); - BKE_editmesh_looptri_calc(em); + BKE_editmesh_looptri_and_normals_calc(em); } WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_MESH, NULL); diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index d56ee17a73f..7122fd09892 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -350,8 +350,7 @@ static bool object_hook_index_array(Main *bmain, em = me->edit_mesh; - EDBM_mesh_normals_update(em); - BKE_editmesh_looptri_calc(em); + BKE_editmesh_looptri_and_normals_calc(em); /* check selected vertices first */ if (return_editmesh_indexar(em, r_tot, r_indexar, r_cent) == 0) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f3433833b5f..cdf12bcb5df 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -153,8 +153,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) em = me->edit_mesh; - EDBM_mesh_normals_update(em); - BKE_editmesh_looptri_calc(em); + BKE_editmesh_looptri_and_normals_calc(em); /* Make sure the evaluated mesh is updated. * |