Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h1
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c8
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 0c359c7f090..d91992fff99 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -77,6 +77,7 @@ enum {
BVH_RAYCAST_WATERTIGHT = (1 << 0),
};
#define BVH_RAYCAST_DEFAULT (BVH_RAYCAST_WATERTIGHT)
+#define BVH_RAYCAST_DIST_MAX (FLT_MAX / 2.0f)
/* callback must update nearest in case it finds a nearest result */
typedef void (*BVHTree_NearestPointCallback)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest);
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 3752751085f..f1ed49f74e0 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1611,7 +1611,7 @@ static void dfs_raycast_all(BVHRayCastData *data, BVHNode *node)
if (node->totnode == 0) {
if (data->callback) {
data->hit.index = -1;
- data->hit.dist = FLT_MAX;
+ data->hit.dist = BVH_RAYCAST_DIST_MAX;
data->callback(data->userdata, node->index, &data->ray, &data->hit);
}
else {
@@ -1720,7 +1720,7 @@ int BLI_bvhtree_ray_cast_ex(
}
else {
data.hit.index = -1;
- data.hit.dist = FLT_MAX;
+ data.hit.dist = BVH_RAYCAST_DIST_MAX;
}
if (root) {
@@ -1747,7 +1747,7 @@ float BLI_bvhtree_bb_raycast(const float bv[6], const float light_start[3], cons
BVHRayCastData data;
float dist;
- data.hit.dist = FLT_MAX;
+ data.hit.dist = BVH_RAYCAST_DIST_MAX;
/* get light direction */
sub_v3_v3v3(data.ray.direction, light_end, light_start);
@@ -1792,7 +1792,7 @@ int BLI_bvhtree_ray_cast_all_ex(
bvhtree_ray_cast_data_precalc(&data, flag);
data.hit.index = -1;
- data.hit.dist = FLT_MAX;
+ data.hit.dist = BVH_RAYCAST_DIST_MAX;
if (root) {
dfs_raycast_all(&data, root);