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>2010-02-26 12:02:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-26 12:02:52 +0300
commit9352c9f0c14aff78ad7c9eba980528bcb1be1575 (patch)
treeaee48e0e5fb34b2b5de31d2c1e327ad383d39ef6 /source/blender
parent2cf6141e7ca40daeaae845246ffa22258eefc579 (diff)
use negate_v3 rather then multiplying a vector by -1.0 (no functional changes)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/boids.c12
-rw-r--r--source/blender/blenkernel/intern/particle_system.c3
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c21
-rw-r--r--source/blender/editors/transform/transform.c6
-rw-r--r--source/blender/editors/transform/transform_orientations.c5
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/render/intern/source/volumetric.c2
9 files changed, 25 insertions, 33 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 */
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 54f0148646c..9b1d48ac8c3 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1822,8 +1822,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
project_v3_v3v3(dvec, r_vel, pa->state.ave);
sub_v3_v3v3(mat[0], pa->state.ave, dvec);
normalize_v3(mat[0]);
- VECCOPY(mat[2], r_vel);
- mul_v3_fl(mat[2], -1.0f);
+ negate_v3_v3(mat[2], r_vel);
normalize_v3(mat[2]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index a9be4b346f0..b3960c3cfd5 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -186,12 +186,12 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4],
if (dot_v3v3(new_up_axis, x_axis) < 0)
{
- mul_v3_fl(x_axis, -1);
+ negate_v3(x_axis);
}
if (dot_v3v3(new_up_axis, z_axis) < 0)
{
- mul_v3_fl(z_axis, -1);
+ negate_v3(z_axis);
}
if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis))
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index c07d457f164..f09b127bfdd 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -334,8 +334,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
VECCOPY(vod->ofs, rv3d->ofs);
/* If there's no selection, lastofs is unmodified and last value since static */
calculateTransformCenter(C, V3D_CENTROID, lastofs);
- VECCOPY(vod->dyn_ofs, lastofs);
- mul_v3_fl(vod->dyn_ofs, -1.0f);
+ negate_v3_v3(vod->dyn_ofs, lastofs);
}
else if (U.uiflag & USER_ORBIT_ZBUF) {
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index cbebbd5cc91..1674c135008 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -161,11 +161,9 @@ static void view_settings_from_ob(Object *ob, float *ofs, float *quat, float *di
if (!ob) return;
/* Offset */
- if (ofs) {
- VECCOPY(ofs, ob->obmat[3]);
- mul_v3_fl(ofs, -1.0f); /*flip the vector*/
- }
-
+ if (ofs)
+ negate_v3_v3(ofs, ob->obmat[3]);
+
/* Quat */
if (quat) {
copy_m4_m4(bmat, ob->obmat);
@@ -2053,8 +2051,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->obtfm= object_tfm_backup(ob_back);
where_is_object(fly->scene, fly->v3d->camera);
- copy_v3_v3(fly->rv3d->ofs, fly->v3d->camera->obmat[3]);
- mul_v3_fl(fly->rv3d->ofs, -1.0f); /*flip the vector*/
+ negate_v3_v3(fly->rv3d->ofs, fly->v3d->camera->obmat[3]);
fly->rv3d->dist=0.0;
} else {
@@ -2527,6 +2524,8 @@ static int flyApply(FlyInfo *fly)
ID *id_key;
/* transform the parent or the camera? */
if(fly->root_parent) {
+ Object *ob_update;
+
float view_mat[4][4];
float prev_view_imat[4][4];
float diff_mat[4][4];
@@ -2540,10 +2539,10 @@ static int flyApply(FlyInfo *fly)
// where_is_object(scene, fly->root_parent);
- Object *up= v3d->camera->parent;
- while(up) {
- DAG_id_flush_update(&up->id, OB_RECALC_OB);
- up= up->parent;
+ ob_update= v3d->camera->parent;
+ while(ob_update) {
+ DAG_id_flush_update(&ob_update->id, OB_RECALC_OB);
+ ob_update= ob_update->parent;
}
copy_m4_m4(prev_view_mat, view_mat);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 6013ff5f105..f19265679f9 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2718,8 +2718,7 @@ void initRotation(TransInfo *t)
if (t->flag & T_2D_EDIT)
t->flag |= T_NO_CONSTRAINT;
- VECCOPY(t->axis, t->viewinv[2]);
- mul_v3_fl(t->axis, -1.0f);
+ negate_v3_v3(t->axis, t->viewinv[2]);
normalize_v3(t->axis);
}
@@ -2977,8 +2976,7 @@ int Rotation(TransInfo *t, short mval[2])
t->con.applyRot(t, NULL, t->axis, &final);
} else {
/* reset axis if constraint is not set */
- VECCOPY(t->axis, t->viewinv[2]);
- mul_v3_fl(t->axis, -1.0f);
+ negate_v3_v3(t->axis, t->viewinv[2]);
normalize_v3(t->axis);
}
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 76df012565e..db7d31bae56 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -818,9 +818,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
quat_to_mat4( mat,ml_sel->quat);
VECCOPY(normal, mat[2]);
- VECCOPY(plane, mat[1]);
- mul_v3_fl(plane, -1.0);
+ negate_v3_v3(plane, mat[1]);
result = ORIENTATION_NORMAL;
}
@@ -888,7 +887,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
add_v3_v3v3(plane, plane, pchan->pose_mat[1]);
}
}
- mul_v3_fl(plane, -1.0);
+ negate_v3(plane);
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index c44d83f4f06..0a292c7acd5 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -2405,7 +2405,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
ver->n[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
ver->n[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
normalize_v3(ver->n);
- //if(ob->transflag & OB_NEG_SCALE) mul_v3_fl(ver->n. -1.0);
+ //if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n);
if(need_orco) ver->orco= orco;
}
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 1622ee2bf4c..70e0fd41b7d 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -488,7 +488,7 @@ void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, float *
if (ELEM(lar->type, LA_SUN, LA_HEMI))
VECCOPY(lv, lar->vec);
- mul_v3_fl(lv, -1.0f);
+ negate_v3(lv);
if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) {
mul_v3_fl(lacol, vol_get_shadow(shi, lar, co));