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/blenkernel/intern/paint.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/blender/blenkernel/intern/paint.c') diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 5847e7508f0..dc8aed91c00 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -47,6 +47,8 @@ #include "BKE_paint.h" #include "BKE_subsurf.h" +#include "bmesh.h" + #include #include @@ -224,6 +226,22 @@ int paint_is_grid_face_hidden(const unsigned int *grid_hidden, BLI_BITMAP_GET(grid_hidden, (y + 1) * gridsize + x)); } +/* Return TRUE if all vertices in the face are visible, FALSE otherwise */ +int paint_is_bmesh_face_hidden(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 true; + } + } while ((l_iter = l_iter->next) != l_first); + + return false; +} + float paint_grid_paint_mask(const GridPaintMask *gpm, unsigned level, unsigned x, unsigned y) { -- cgit v1.2.3