diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-12 08:58:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-12 09:00:10 +0300 |
commit | 5400d6a8fa467a79c5c022d423da247d583ae9f6 (patch) | |
tree | be8c59846891ec91d90851b9158f016369e2f356 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | db91414d7b574ff9369d94ea50bf77f1478891d0 (diff) |
DRW: correct loose edge hidden face check
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 8021efcec83..3bcf5dd756a 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -447,11 +447,21 @@ static MeshRenderData *mesh_render_data_create_ex( Mesh *me_cage = embm->mesh_eval_cage; rdata->mapped.me_cage = me_cage; - rdata->mapped.vert_len = me_cage->totvert; - rdata->mapped.edge_len = me_cage->totedge; - rdata->mapped.loop_len = me_cage->totloop; - rdata->mapped.poly_len = me_cage->totpoly; - rdata->mapped.tri_len = poly_to_tri_count(me_cage->totpoly, me_cage->totloop); + if (types & MR_DATATYPE_VERT) { + rdata->mapped.vert_len = me_cage->totvert; + } + if (types & MR_DATATYPE_EDGE) { + rdata->mapped.edge_len = me_cage->totedge; + } + if (types & MR_DATATYPE_LOOP) { + rdata->mapped.loop_len = me_cage->totloop; + } + if (types & MR_DATATYPE_POLY) { + rdata->mapped.poly_len = me_cage->totpoly; + } + if (types & MR_DATATYPE_LOOPTRI) { + rdata->mapped.tri_len = poly_to_tri_count(me_cage->totpoly, me_cage->totloop); + } rdata->mapped.v_origindex = CustomData_get_layer(&me_cage->vdata, CD_ORIGINDEX); rdata->mapped.e_origindex = CustomData_get_layer(&me_cage->edata, CD_ORIGINDEX); @@ -4278,7 +4288,7 @@ static GPUIndexBuf *mesh_batch_cache_get_loose_edges(MeshRenderData *rdata, Mesh BMIter eiter; BMEdge *eed; BM_ITER_MESH(eed, &eiter, bm, BM_EDGES_OF_MESH) { - if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_edge_is_wire(eed)) { + if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && !bm_edge_has_visible_face(eed)) { GPU_indexbuf_add_line_verts(&elb, BM_elem_index_get(eed->v1), BM_elem_index_get(eed->v2)); } } @@ -4293,6 +4303,7 @@ static GPUIndexBuf *mesh_batch_cache_get_loose_edges(MeshRenderData *rdata, Mesh } } else { + /* Hidden checks are already done when creating the loose edge list. */ Mesh *me_cage = rdata->mapped.me_cage; for (int i_iter = 0; i_iter < rdata->mapped.loose_edge_len; i_iter++) { const int i = rdata->mapped.loose_edges[i_iter]; |