diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-26 12:02:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-26 12:02:52 +0300 |
commit | 9352c9f0c14aff78ad7c9eba980528bcb1be1575 (patch) | |
tree | aee48e0e5fb34b2b5de31d2c1e327ad383d39ef6 /source/blender/blenkernel/intern/boids.c | |
parent | 2cf6141e7ca40daeaae845246ffa22258eefc579 (diff) |
use negate_v3 rather then multiplying a vector by -1.0 (no functional changes)
Diffstat (limited to 'source/blender/blenkernel/intern/boids.c')
-rw-r--r-- | source/blender/blenkernel/intern/boids.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 89c3da9b3e9..b521ec41cba 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -162,8 +162,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, else if(rule->type == eBoidRuleType_Avoid && bpa->data.mode == eBoidMode_Climbing && priority > 2.0f * gabr->fear_factor) { /* detach from surface and try to fly away from danger */ - VECCOPY(efd.vec_to_point, bpa->gravity); - mul_v3_fl(efd.vec_to_point, -1.0f); + negate_v3_v3(efd.vec_to_point, bpa->gravity); } VECCOPY(bbd->wanted_co, efd.vec_to_point); @@ -689,7 +688,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti if(bpa->data.health/bbd->part->boids->health * bbd->part->boids->aggression < e_strength / f_strength) { /* decide to flee */ if(closest_dist < fbr->flee_distance * fbr->distance) { - mul_v3_fl(bbd->wanted_co, -1.0f); + negate_v3(bbd->wanted_co); bbd->wanted_speed = val->max_speed; } else { /* wait for better odds */ @@ -1342,9 +1341,8 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) float grav[3]; /* Don't take gravity's strength in to account, */ /* otherwise amount of banking is hard to control. */ - VECCOPY(grav, ground_nor); - mul_v3_fl(grav, -1.0f); - + negate_v3_v3(grav, ground_nor); + project_v3_v3v3(dvec, bpa->data.acc, pa->state.vel); sub_v3_v3v3(dvec, bpa->data.acc, dvec); @@ -1387,7 +1385,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) VECCOPY(mat[2], bpa->gravity); } - mul_v3_fl(mat[2], -1.0f); + negate_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); /* apply rotation */ |