From 9a50f454697e5dea6e8603aa90fadaa6156657d6 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 19 Jan 2013 16:10:21 +0000 Subject: Skip hidden faces in PBVH BMesh ray intersection test Moved the GPU function gpu_bmesh_face_visible() to BKE_paint and inverted the test to match equivalent tests for other mesh types: paint_is_bmesh_face_hidden(). Changed BKE_pbvh_bmesh_node_save_orig() to not save hidden faces into the triangle array. Modified the non-use-original branch of pbvh_bmesh_node_raycast() to skip hidden faces. Fixes bug #33914: projects.blender.org/tracker/index.php?func=detail&aid=33914&group_id=9&atid=498 --- source/blender/gpu/intern/gpu_buffers.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'source/blender/gpu/intern') diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index c1eb7bdbbac..fedcb58e1a3 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1922,22 +1922,6 @@ static int gpu_bmesh_vert_visible_count(GHash *bm_unique_verts, return totvert; } -/* Return TRUE if all vertices in the face are visible, FALSE otherwise */ -static int gpu_bmesh_face_visible(BMFace *f) -{ - BMLoop *l_iter; - BMLoop *l_first; - - l_iter = l_first = BM_FACE_FIRST_LOOP(f); - do { - if (BM_elem_flag_test(l_iter->v, BM_ELEM_HIDDEN)) { - return false; - } - } while ((l_iter = l_iter->next) != l_first); - - return true; -} - /* Return the total number of visible faces */ static int gpu_bmesh_face_visible_count(GHash *bm_faces) { @@ -1947,7 +1931,7 @@ static int gpu_bmesh_face_visible_count(GHash *bm_faces) GHASH_ITER (gh_iter, bm_faces) { BMFace *f = BLI_ghashIterator_getKey(&gh_iter); - if (gpu_bmesh_face_visible(f)) + if (!paint_is_bmesh_face_hidden(f)) totface++; } @@ -2014,7 +1998,7 @@ void GPU_update_bmesh_buffers(GPU_Buffers *buffers, BLI_assert(f->len == 3); - if (gpu_bmesh_face_visible(f)) { + if (!paint_is_bmesh_face_hidden(f)) { BMVert *v[3]; float fmask = 0; int i; @@ -2068,7 +2052,7 @@ void GPU_update_bmesh_buffers(GPU_Buffers *buffers, GHASH_ITER (gh_iter, bm_faces) { BMFace *f = BLI_ghashIterator_getKey(&gh_iter); - if (gpu_bmesh_face_visible(f)) { + if (!paint_is_bmesh_face_hidden(f)) { BMLoop *l_iter; BMLoop *l_first; -- cgit v1.2.3