diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-12 11:37:56 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-12 12:09:00 +0300 |
commit | c6c223ade6470e7a9b61ea4a4a3ab6ed62abe79d (patch) | |
tree | fb9323466d1c45ff6a99db96fc649fe3e6374249 /source/blender/editors/space_view3d | |
parent | 90250f856817b68f29924be8a60152ec3a2486a8 (diff) |
Fix T47164: [Scene.raycast] - True result when it should be False.
We cannot use FLT_MAX as initi distance for raycast...
Renamed TRANSFORM_DIST_MAX_RAY to BVH_RAYCAST_DIST_MAX, moved it into BLI_kdopbvh,
and use in RNA raycast callbacks (and all other places using that API).
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 6b98d2b9784..0f407658228 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -41,6 +41,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" +#include "BLI_kdopbvh.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -5183,7 +5184,7 @@ bool ED_view3d_snap_from_ray( float r_co[3]) { float r_no_dummy[3]; - float ray_dist = TRANSFORM_DIST_MAX_RAY; + float ray_dist = BVH_RAYCAST_DIST_MAX; bool ret; struct Object *obedit = scene->obedit; @@ -5223,7 +5224,7 @@ bool ED_view3d_snap_from_region( float r_co[3], float r_no[3]) { float r_no_dummy[3]; - float ray_dist = TRANSFORM_DIST_MAX_RAY; + float ray_dist = BVH_RAYCAST_DIST_MAX; bool is_hit = false; float *r_no_ptr = r_no ? r_no : r_no_dummy; @@ -5236,7 +5237,7 @@ bool ED_view3d_snap_from_region( for (int i = 0; i < 3; i++) { if (elem_test[i] && (is_hit == false || use_depth)) { if (use_depth == false) { - ray_dist = TRANSFORM_DIST_MAX_RAY; + ray_dist = BVH_RAYCAST_DIST_MAX; } if (snapObjectsEx( scene, v3d, ar, NULL, obedit, diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 8b3ea2a1fee..022b305e5ac 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -33,6 +33,7 @@ #include "BLI_math.h" #include "BLI_blenlib.h" +#include "BLI_kdopbvh.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -410,7 +411,7 @@ static bool walk_floor_distance_get(bContext *C, RegionView3D *rv3d, WalkInfo *w float dvec_tmp[3]; bool ret; - *r_distance = TRANSFORM_DIST_MAX_RAY; + *r_distance = BVH_RAYCAST_DIST_MAX; copy_v3_v3(ray_start, rv3d->viewinv[3]); @@ -441,7 +442,7 @@ static bool walk_ray_cast(bContext *C, RegionView3D *rv3d, WalkInfo *walk, float float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */ bool ret; - *ray_distance = TRANSFORM_DIST_MAX_RAY; + *ray_distance = BVH_RAYCAST_DIST_MAX; copy_v3_v3(ray_start, rv3d->viewinv[3]); copy_m3_m4(mat, rv3d->viewinv); |