From 9efef3c2515bef9cd2928834ab7e29cf32c20593 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 18 Dec 2013 18:34:02 +0200 Subject: Fix T37177, sculpting can act on opposite side of mesh in orthographic camera. Summary: Issue here most probably is that the start point in ray-casting is too far away from the mesh. As a result the triangle intersection code can sometimes miss the ray intersection. To solve this, we project the ray segment to the boundary of the root node. Reviewers: brecht, sergey, campbellbarton Reviewed By: brecht Maniphest Tasks: T37177 Differential Revision: http://developer.blender.org/D115 --- source/blender/blenkernel/BKE_pbvh.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenkernel/BKE_pbvh.h') diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index f8c21a1fa16..7ef120e26af 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -97,6 +97,12 @@ int BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use const float ray_start[3], const float ray_normal[3], float *dist); +/* for orthographic cameras, project the far away ray segment points to the root node so + * we can have better precision. Warning, this function assumes that ray begins and ends outside + * bounding box! */ +void BKE_pbvh_raycast_project_ray_root(PBVH *bvh, bool original, float ray_start[3], + float ray_end[3], float ray_normal[3]); + /* Drawing */ void BKE_pbvh_node_draw(PBVHNode *node, void *data); -- cgit v1.2.3