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>2015-08-21 10:05:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-08-21 10:09:18 +0300
commitc727fc59abe2b7e525bdc6594bbd7ec3285936e0 (patch)
treedfcadf23e28c2464655f4c06a5f94621721fe0c2 /source/blender/blenkernel/intern/boids.c
parenta98b02ff941edb1d92892f520641433582754f0d (diff)
BVH-raycast: ensure input direction is unit-length
This was already the case for most users of ray-cast. Doing this avoids 2x normalize calls per ray-cast in many places.
Diffstat (limited to 'source/blender/blenkernel/intern/boids.c')
-rw-r--r--source/blender/blenkernel/intern/boids.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 11879c7973c..fdc5524e84c 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -214,7 +214,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
mul_v3_fl(ray_dir, acbr->look_ahead);
col.f = 0.0f;
hit.index = -1;
- hit.dist = col.original_ray_length = len_v3(ray_dir);
+ hit.dist = col.original_ray_length = normalize_v3(ray_dir);
/* find out closest deflector object */
for (coll = bbd->sim->colliders->first; coll; coll=coll->next) {
@@ -794,7 +794,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
sub_v3_v3v3(ray_dir, col.co2, col.co1);
col.f = 0.0f;
hit.index = -1;
- hit.dist = col.original_ray_length = len_v3(ray_dir);
+ hit.dist = col.original_ray_length = normalize_v3(ray_dir);
col.pce.inside = 0;
for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
@@ -820,7 +820,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
sub_v3_v3v3(ray_dir, col.co2, col.co1);
col.f = 0.0f;
hit.index = -1;
- hit.dist = col.original_ray_length = len_v3(ray_dir);
+ hit.dist = col.original_ray_length = normalize_v3(ray_dir);
for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
col.current = coll->ob;