diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2013-01-19 20:10:21 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2013-01-19 20:10:21 +0400 |
commit | 9a50f454697e5dea6e8603aa90fadaa6156657d6 (patch) | |
tree | 150f678940c8bb280697a0fde95e203c1fc3f7f4 /source/blender/blenkernel/intern/pbvh_bmesh.c | |
parent | 399763015769ca8e35a5639748c9bb08fbfd984b (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh_bmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 7b6ad622deb..f3ac22f0df7 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -28,6 +28,7 @@ #include "BKE_ccg.h" #include "BKE_DerivedMesh.h" #include "BKE_global.h" +#include "BKE_paint.h" #include "BKE_pbvh.h" #include "GPU_buffers.h" @@ -936,10 +937,9 @@ int pbvh_bmesh_node_raycast(PBVHNode *node, const float ray_start[3], BMFace *f = BLI_ghashIterator_getKey(&gh_iter); BLI_assert(f->len == 3); - if (f->len == 3) { + if (f->len == 3 && !paint_is_bmesh_face_hidden(f)) { BMVert *v_tri[3]; - // BM_iter_as_array(NULL, BM_VERTS_OF_FACE, f, (void **)v_tri, 3); BM_face_as_array_vert_tri(f, v_tri); hit |= ray_face_intersection(ray_start, ray_normal, v_tri[0]->co, @@ -1071,7 +1071,9 @@ BLI_INLINE void bm_face_as_array_index_tri(BMFace *f, int r_index[3]) } /* In order to perform operations on the original node coordinates - * (such as raycast), store the node's triangles and vertices.*/ + * (currently just raycast), store the node's triangles and vertices. + * + * Skips triangles that are hidden. */ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node) { GHashIterator gh_iter; @@ -1109,6 +1111,9 @@ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node) GHASH_ITER (gh_iter, node->bm_faces) { BMFace *f = BLI_ghashIterator_getKey(&gh_iter); + if (paint_is_bmesh_face_hidden(f)) + continue; + #if 0 BMIter bm_iter; BMVert *v; |