diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-28 20:15:06 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 17:22:09 +0300 |
commit | 0ffb96f701176fe5b3eb03bd90414ed7fd4502cf (patch) | |
tree | d835a45e1d34f1af3cea9898f508ba3691f61ab2 /source/blender/blenkernel/intern/pbvh.c | |
parent | 9b0fd5ef2ae0b2748e505b8bef29c6e25f58efe2 (diff) |
Sculpt: minor optimizations for GPU draw buffer filling
Ref T70295
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 781e7b712d6..c920b80d818 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -2260,19 +2260,21 @@ void BKE_pbvh_update_normals(PBVH *bvh, struct SubdivCCG *subdiv_ccg) BKE_pbvh_search_gather( bvh, update_search_cb, POINTER_FROM_INT(PBVH_UpdateNormals), &nodes, &totnode); - if (bvh->type == PBVH_BMESH) { - pbvh_bmesh_normals_update(nodes, totnode); - } - else if (bvh->type == PBVH_FACES) { - pbvh_faces_update_normals(bvh, nodes, totnode); - } - else if (bvh->type == PBVH_GRIDS) { - struct CCGFace **faces; - int num_faces; - BKE_pbvh_get_grid_updates(bvh, true, (void ***)&faces, &num_faces); - if (num_faces > 0) { - BKE_subdiv_ccg_update_normals(subdiv_ccg, faces, num_faces); - MEM_freeN(faces); + if (totnode > 0) { + if (bvh->type == PBVH_BMESH) { + pbvh_bmesh_normals_update(nodes, totnode); + } + else if (bvh->type == PBVH_FACES) { + pbvh_faces_update_normals(bvh, nodes, totnode); + } + else if (bvh->type == PBVH_GRIDS) { + struct CCGFace **faces; + int num_faces; + BKE_pbvh_get_grid_updates(bvh, true, (void ***)&faces, &num_faces); + if (num_faces > 0) { + BKE_subdiv_ccg_update_normals(subdiv_ccg, faces, num_faces); + MEM_freeN(faces); + } } } |