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 <ideasman42@gmail.com>2014-03-12 08:50:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-03-12 11:30:37 +0400
commit921c829bcf51c6cf55456f4983a3647569592ba4 (patch)
tree69ef129b8180c697b8544ce22350c4b40a9a6a1d /source/blender
parent2d4de2742c47256ae0b9ce298b5cf3cefe62daee (diff)
Code cleanup: redundant normalize in bmbvh ray cast
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/editmesh_bvh.c12
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c12
2 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c
index 018a9198f34..943469eb4f0 100644
--- a/source/blender/blenkernel/intern/editmesh_bvh.c
+++ b/source/blender/blenkernel/intern/editmesh_bvh.c
@@ -217,11 +217,8 @@ static void bmbvh_ray_cast_cb(void *userdata, int index, const BVHTreeRay *ray,
copy_v3_v3(hit->no, ltri[0]->f->no);
- copy_v3_v3(hit->co, ray->direction);
- normalize_v3(hit->co);
- mul_v3_fl(hit->co, dist);
- add_v3_v3(hit->co, ray->origin);
-
+ madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
+
copy_v2_v2(bmcb_data->uv, uv);
}
}
@@ -310,10 +307,7 @@ static void bmbvh_find_face_segment_cb(void *userdata, int index, const BVHTreeR
copy_v3_v3(hit->no, ltri[0]->f->no);
- copy_v3_v3(hit->co, ray->direction);
- normalize_v3(hit->co);
- mul_v3_fl(hit->co, dist);
- add_v3_v3(hit->co, ray->origin);
+ madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
copy_v2_v2(bmcb_data->uv, uv);
}
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 5d97c1c22d2..41c5707cf4c 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1440,7 +1440,7 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
}
else {
/* pick loop direction to dive into the tree (based on ray direction and split axis) */
- if (data->ray_dot_axis[(int)node->main_axis] > 0.0f) {
+ if (data->ray_dot_axis[node->main_axis] > 0.0f) {
for (i = 0; i != node->totnode; i++) {
dfs_raycast(data, node->children[i]);
}
@@ -1541,16 +1541,12 @@ float BLI_bvhtree_bb_raycast(const float bv[6], const float light_start[3], cons
data.hit.dist = FLT_MAX;
/* get light direction */
- data.ray.direction[0] = light_end[0] - light_start[0];
- data.ray.direction[1] = light_end[1] - light_start[1];
- data.ray.direction[2] = light_end[2] - light_start[2];
+ sub_v3_v3v3(data.ray.direction, light_end, light_start);
data.ray.radius = 0.0;
- data.ray.origin[0] = light_start[0];
- data.ray.origin[1] = light_start[1];
- data.ray.origin[2] = light_start[2];
-
+ copy_v3_v3(data.ray.origin, light_start);
+
normalize_v3(data.ray.direction);
copy_v3_v3(data.ray_dot_axis, data.ray.direction);