forked from bartvdbraak/blender
use negate_v3 rather then multiplying a vector by -1.0 (no functional changes)
This commit is contained in:
parent
2cf6141e7c
commit
9352c9f0c1
@ -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 */
|
||||
|
@ -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]);
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -654,8 +654,7 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
|
||||
}
|
||||
// compute rotation matrix between local coord and mirror coord
|
||||
// to match camera orientation, we select mirror z = -normal, y = up, x = y x z
|
||||
copy_v3_v3(mirrorMat[2], mirrorNormal);
|
||||
mul_v3_fl(mirrorMat[2], -1.0f);
|
||||
negate_v3_v3(mirrorMat[2], mirrorNormal);
|
||||
copy_v3_v3(mirrorMat[1], mirrorUp);
|
||||
cross_v3_v3v3(mirrorMat[0], mirrorMat[1], mirrorMat[2]);
|
||||
// transpose to make it a orientation matrix from local space to mirror space
|
||||
|
Loading…
Reference in New Issue
Block a user