From a2a7260915633eda8a3d26aa678baba49b2429ce Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jan 2015 23:54:14 +1100 Subject: BMesh: option to filter out faces during raycast This allows us to more easily cast from the surface of a mesh without normal offsets (Which can give precision issues). --- source/blender/blenkernel/BKE_editmesh_bvh.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/BKE_editmesh_bvh.h') diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h index 168f700d132..3ee7dcd94b8 100644 --- a/source/blender/blenkernel/BKE_editmesh_bvh.h +++ b/source/blender/blenkernel/BKE_editmesh_bvh.h @@ -43,6 +43,8 @@ struct Scene; typedef struct BMBVHTree BMBVHTree; +typedef bool (*BMBVHTree_FaceFilter)(struct BMFace *f, void *userdata); + BMBVHTree *BKE_bmbvh_new_from_editmesh( struct BMEditMesh *em, int flag, const float (*cos_cage)[3], const bool cos_cage_free); @@ -55,8 +57,16 @@ BMBVHTree *BKE_bmbvh_new( const float (*cos_cage)[3], const bool cos_cage_free); void BKE_bmbvh_free(BMBVHTree *tree); struct BVHTree *BKE_bmbvh_tree_get(BMBVHTree *tree); -struct BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3], const float radius, - float *r_dist, float r_hitout[3], float r_cagehit[3]); + +struct BMFace *BKE_bmbvh_ray_cast( + BMBVHTree *tree, const float co[3], const float dir[3], const float radius, + float *r_dist, float r_hitout[3], float r_cagehit[3]); + +struct BMFace *BKE_bmbvh_ray_cast_filter( + BMBVHTree *tree, const float co[3], const float dir[3], const float radius, + float *r_dist, float r_hitout[3], float r_cagehit[3], + BMBVHTree_FaceFilter filter, void *filter_cb); + /* find a face intersecting a segment (but not apart of the segment) */ struct BMFace *BKE_bmbvh_find_face_segment(BMBVHTree *tree, const float co_a[3], const float co_b[3], float *r_fac, float r_hitout[3], float r_cagehit[3]); -- cgit v1.2.3