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:
authorCampbell Barton <campbell@blender.org>2022-05-11 09:34:31 +0300
committerCampbell Barton <campbell@blender.org>2022-05-11 09:34:31 +0300
commit0c5a7ca1177ab5f508df3a1456c6243e9f5949bc (patch)
treeabf4ac89e53b211fd34a4ddfac72accbd337993d /source/blender/render
parentec53e9fa697f39435480e174345368ee6b980120 (diff)
parent74228e2cd253c66a9204cc3926243dd8e07edd53 (diff)
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/bake.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c
index 5953c0f0f8f..bf876163013 100644
--- a/source/blender/render/intern/bake.c
+++ b/source/blender/render/intern/bake.c
@@ -330,10 +330,10 @@ static bool cast_ray_highpoly(BVHTreeFromMesh *treeData,
{
int i;
int hit_mesh = -1;
- float hit_distance = max_ray_distance;
- if (hit_distance == 0.0f) {
+ float hit_distance_squared = max_ray_distance * max_ray_distance;
+ if (hit_distance_squared == 0.0f) {
/* No ray distance set, use maximum. */
- hit_distance = FLT_MAX;
+ hit_distance_squared = FLT_MAX;
}
BVHTreeRayHit *hits;
@@ -365,16 +365,14 @@ static bool cast_ray_highpoly(BVHTreeFromMesh *treeData,
}
if (hits[i].index != -1) {
- float distance;
- float hit_world[3];
-
/* distance comparison in world space */
+ float hit_world[3];
mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co);
- distance = len_squared_v3v3(hit_world, co);
+ float distance_squared = len_squared_v3v3(hit_world, co);
- if (distance < hit_distance) {
+ if (distance_squared < hit_distance_squared) {
hit_mesh = i;
- hit_distance = distance;
+ hit_distance_squared = distance_squared;
}
}
}