[Bf-blender-cvs] [92a494ed51e] blender2.8: DRW: remove redundant editmode mesh tessellation
Campbell Barton
noreply at git.blender.org
Thu Oct 11 02:45:15 CEST 2018
Commit: 92a494ed51ec6301cb9ba07a8c4f8f59db8ab33e
Author: Campbell Barton
Date: Thu Oct 11 11:41:24 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB92a494ed51ec6301cb9ba07a8c4f8f59db8ab33e
DRW: remove redundant editmode mesh tessellation
Also re-order logic so loop indices are ensured to be valid.
===================================================================
M source/blender/draw/intern/draw_cache_impl_mesh.c
===================================================================
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index bcdf3a3cf08..aa96984f5d3 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -421,17 +421,7 @@ static MeshRenderData *mesh_render_data_create_ex(
bm_ensure_types |= BM_EDGE;
}
if (types & MR_DATATYPE_LOOPTRI) {
- BKE_editmesh_tessface_calc(embm);
- int tottri = embm->tottri;
- rdata->mlooptri = MEM_mallocN(sizeof(*rdata->mlooptri) * embm->tottri, __func__);
- for (int index = 0; index < tottri ; index ++ ) {
- BMLoop **bmtri = embm->looptris[index];
- MLoopTri *mtri = &rdata->mlooptri[index];
- mtri->tri[0] = BM_elem_index_get(bmtri[0]);
- mtri->tri[1] = BM_elem_index_get(bmtri[1]);
- mtri->tri[2] = BM_elem_index_get(bmtri[2]);
- }
- rdata->tri_len = tottri;
+ bm_ensure_types |= BM_LOOP;
}
if (types & MR_DATATYPE_LOOP) {
int totloop = bm->totloop;
@@ -465,6 +455,22 @@ static MeshRenderData *mesh_render_data_create_ex(
BM_mesh_elem_index_ensure(bm, bm_ensure_types);
BM_mesh_elem_table_ensure(bm, bm_ensure_types & ~BM_LOOP);
+
+ if (types & MR_DATATYPE_LOOPTRI) {
+ /* Edit mode ensures this is valid, no need to calculate. */
+ BLI_assert((bm->totloop == 0) || (embm->looptris != NULL));
+ int tottri = embm->tottri;
+ rdata->mlooptri = MEM_mallocN(sizeof(*rdata->mlooptri) * embm->tottri, __func__);
+ for (int index = 0; index < tottri ; index ++ ) {
+ BMLoop **bmtri = embm->looptris[index];
+ MLoopTri *mtri = &rdata->mlooptri[index];
+ mtri->tri[0] = BM_elem_index_get(bmtri[0]);
+ mtri->tri[1] = BM_elem_index_get(bmtri[1]);
+ mtri->tri[2] = BM_elem_index_get(bmtri[2]);
+ }
+ rdata->tri_len = tottri;
+ }
+
if (types & MR_DATATYPE_OVERLAY) {
rdata->loose_vert_len = rdata->loose_edge_len = 0;
More information about the Bf-blender-cvs
mailing list