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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-12-16 15:32:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2008-12-16 15:32:10 +0300
commit882d85a96827cb50d1fc4a2ac1d63b902aab8f86 (patch)
treed9c779a282ac712ed4a522ad2380c72c1668fa04 /source
parent4da3c4b9d5ede4369467165cb9f31eee4385a353 (diff)
Patch from Banlu Kemiyatorn
replace VecMulf(var,-1) with new VecNegf(var) function.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c14
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/particle_system.c8
-rw-r--r--source/blender/blenlib/BLI_arithb.h1
-rw-r--r--source/blender/blenlib/intern/arithb.c11
-rw-r--r--source/blender/blenlib/intern/graph.c6
-rw-r--r--source/blender/gpu/intern/gpu_material.c2
-rw-r--r--source/blender/radiosity/intern/source/radfactors.c4
-rw-r--r--source/blender/radiosity/intern/source/radrender.c4
-rw-r--r--source/blender/render/intern/source/occlusion.c10
-rw-r--r--source/blender/render/intern/source/rendercore.c4
-rw-r--r--source/blender/render/intern/source/shadeinput.c2
13 files changed, 39 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 775f1dee241..0b5465ea25d 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1236,7 +1236,7 @@ int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModifierDat
if(out_normalVelocity < 0.0)
{
out_normalVelocity*= -1.0;
- VecMulf(out_normal, -1.0);
+ VecNegf(out_normal);
}
*/
/* Inelastic repulsion impulse. */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 5639f00ee39..b668a1f214d 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1044,7 +1044,7 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh
n[2] = 1.0;
}
if (axis > 2) axis -= 3;
- else VecMulf(n,-1);
+ else VecNegf(n);
/* n specifies the transformation of the track axis */
if (flags & TARGET_Z_UP) {
@@ -2182,7 +2182,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[0]);
VecSubf(totmat[1], vec, vec2);
Normalize(totmat[1]);
- VecMulf(totmat[1],-1);
+ VecNegf(totmat[1]);
/* the x axis is fixed */
totmat[0][0] = cob->matrix[0][0];
@@ -2200,7 +2200,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[0]);
VecSubf(totmat[2], vec, vec2);
Normalize(totmat[2]);
- VecMulf(totmat[2],-1);
+ VecNegf(totmat[2]);
/* the x axis is fixed */
totmat[0][0] = cob->matrix[0][0];
@@ -2265,7 +2265,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[1]);
VecSubf(totmat[0], vec, vec2);
Normalize(totmat[0]);
- VecMulf(totmat[0],-1);
+ VecNegf(totmat[0]);
/* the y axis is fixed */
totmat[1][0] = cob->matrix[1][0];
@@ -2283,7 +2283,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[1]);
VecSubf(totmat[2], vec, vec2);
Normalize(totmat[2]);
- VecMulf(totmat[2],-1);
+ VecNegf(totmat[2]);
/* the y axis is fixed */
totmat[1][0] = cob->matrix[1][0];
@@ -2348,7 +2348,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[2]);
VecSubf(totmat[0], vec, vec2);
Normalize(totmat[0]);
- VecMulf(totmat[0],-1);
+ VecNegf(totmat[0]);
/* the z axis is fixed */
totmat[2][0] = cob->matrix[2][0];
@@ -2366,7 +2366,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[2]);
VecSubf(totmat[1], vec, vec2);
Normalize(totmat[1]);
- VecMulf(totmat[1],-1);
+ VecNegf(totmat[1]);
/* the z axis is fixed */
totmat[2][0] = cob->matrix[2][0];
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 122c6c71a6c..0338ec92414 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -251,7 +251,7 @@ static float eff_calc_visibility(Object *ob, float *co, float *dir)
return 0;
VECCOPY(norm, dir);
- VecMulf(norm, -1.0);
+ VecNegf(norm);
len = Normalize(norm);
// check all collision objects
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 39226faff1e..8a964c5b32e 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -831,7 +831,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
VecCopyf(tan,seam->tan);
VecSubf(temp2,co1,temp);
if(Inpf(tan,temp2)<0.0f)
- VecMulf(tan,-1.0f);
+ VecNegf(tan);
}
for(w=0; w<maxw; w++){
VecSubf(temp2,ptn[w].co,temp);
@@ -1877,7 +1877,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
}
/* create rotation quat */
- VecMulf(rot_vec,-1.0);
+ VecNegf(rot_vec);
vectoquat(rot_vec, OB_POSX, OB_POSZ, q2);
/* randomize rotation quat */
@@ -3022,7 +3022,7 @@ static void particle_intersect_face(void *userdata, int index, const BVHTreeRay
CalcNormFloat(t0, t1, t2, col->nor);
VECSUB(temp, co2, co1);
if(Inpf(col->nor, temp) > 0.0f)
- VecMulf(col->nor, -1.0f);
+ VecNegf(col->nor);
VECCOPY(col->vel,vel);
@@ -3802,7 +3802,7 @@ static void boid_body(BoidVecFunc *bvf, ParticleData *pa, ParticleSystem *psys,
VecRotToQuat(pa->state.vel,bank,q);
VECCOPY(dvec,pa->state.vel);
- VecMulf(dvec,-1.0f);
+ VecNegf(dvec);
vectoquat(dvec, OB_POSX, OB_POSZ, q2);
QuatMul(pa->state.rot,q,q2);
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h
index e4b983d9ba3..fd58aa318da 100644
--- a/source/blender/blenlib/BLI_arithb.h
+++ b/source/blender/blenlib/BLI_arithb.h
@@ -241,6 +241,7 @@ int VecLen(int *v1, int *v2);
float VecLenf(float *v1, float *v2);
float VecLength(float *v);
void VecMulf(float *v1, float f);
+void VecNegf(float *v1);
int VecLenCompare(float *v1, float *v2, float limit);
int VecCompare(float *v1, float *v2, float limit);
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index e606092f72d..61cbf791bf1 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -2183,6 +2183,13 @@ void VecMulf(float *v1, float f)
v1[2]*= f;
}
+void VecNegf(float *v1)
+{
+ v1[0] = -v1[0];
+ v1[1] = -v1[1];
+ v1[2] = -v1[2];
+}
+
void VecOrthoBasisf(float *v, float *v1, float *v2)
{
float f = sqrt(v[0]*v[0] + v[1]*v[1]);
@@ -3945,7 +3952,7 @@ int SweepingSphereIntersectsTriangleUV(float p1[3], float p2[3], float radius, f
Normalize(nor);
/* flip normal */
- if(Inpf(nor,vel)>0.0f) VecMulf(nor,-1.0f);
+ if(Inpf(nor,vel)>0.0f) VecNegf(nor);
a=Inpf(p1,nor)-Inpf(v0,nor);
nordotv=Inpf(nor,vel);
@@ -4616,7 +4623,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2,
/* check flip */
if ((ct[0]*n[0] + ct[1]*n[1] + ct[2]*n[2]) < 0.0f)
- VecMulf(tang, -1.0f);
+ VecNegf(tang);
}
/* used for zoom values*/
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 8f35b38379e..bcd8a2ce7cd 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -809,15 +809,15 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0)
{
- VecMulf(nor, -1);
+ VecNegf(nor);
}
else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0)
{
- VecMulf(nor, -1);
+ VecNegf(nor);
}
else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0)
{
- VecMulf(nor, -1);
+ VecNegf(nor);
}
/* mirror node2 along axis */
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 46df003cbbc..87703bc73bf 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -306,7 +306,7 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v
if(material->dynproperty & DYN_LAMP_VEC) {
VECCOPY(lamp->dynvec, lamp->vec);
Normalize(lamp->dynvec);
- VecMulf(lamp->dynvec, -1.0f);
+ VecNegf(lamp->dynvec);
Mat4Mul3Vecfl(viewmat, lamp->dynvec);
}
diff --git a/source/blender/radiosity/intern/source/radfactors.c b/source/blender/radiosity/intern/source/radfactors.c
index ba4dbf1b793..d5b7c1caef3 100644
--- a/source/blender/radiosity/intern/source/radfactors.c
+++ b/source/blender/radiosity/intern/source/radfactors.c
@@ -535,10 +535,10 @@ void progressiverad()
if(shoot->first->f & RAD_TWOSIDED) {
VECCOPY(unshot, shoot->unshot);
- VecMulf(shoot->norm, -1.0);
+ VecNegf(shoot->norm);
if(makeformfactors(shoot))
applyformfactors(shoot);
- VecMulf(shoot->norm, -1.0);
+ VecNegf(shoot->norm);
VECCOPY(shoot->unshot, unshot);
}
diff --git a/source/blender/radiosity/intern/source/radrender.c b/source/blender/radiosity/intern/source/radrender.c
index 68b5fa81f43..454a7d01688 100644
--- a/source/blender/radiosity/intern/source/radrender.c
+++ b/source/blender/radiosity/intern/source/radrender.c
@@ -299,10 +299,10 @@ static void progressiverad_rr(Render *re)
/* ...unless it's two sided */
if(shootrf->flag & RAD_TWOSIDED) {
VECCOPY(unshot, shootrf->unshot);
- VecMulf(shootrf->norm, -1.0);
+ VecNegf(shootrf->norm);
makeformfactors_rr(re, shoot, shootrf);
applyformfactors_rr(re, shoot, shootrf);
- VecMulf(shootrf->norm, -1.0);
+ VecNegf(shootrf->norm);
VECCOPY(shootrf->unshot, unshot);
}
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index d2d2cf3fb77..494feb96c18 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -181,8 +181,8 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
/* not a pretty solution, but fixes common cases */
if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
- VecMulf(shi->vn, -1.0f);
- VecMulf(shi->vno, -1.0f);
+ VecNegf(shi->vn);
+ VecNegf(shi->vno);
}
/* init material vars */
@@ -1288,7 +1288,7 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass)
for(pass=0; pass<totpass; pass++) {
for(i=0; i<tree->totface; i++) {
occ_face(&tree->face[i], co, n, NULL);
- VecMulf(n, -1.0f);
+ VecNegf(n);
VECADDFAC(co, co, n, 1e-8f);
occ_lookup(tree, 0, &tree->face[i], co, n, &occ[i], NULL);
@@ -1321,7 +1321,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
aocolor= WO_AOPLAIN;
VECCOPY(nn, n);
- VecMulf(nn, -1.0f);
+ VecNegf(nn);
occ_lookup(tree, thread, exclude, co, nn, &occ, (aocolor)? bn: NULL);
@@ -1525,7 +1525,7 @@ static void *exec_strandsurface_sample(void *data)
CalcCent3f(co, co1, co2, co3);
CalcNormFloat(co1, co2, co3, n);
}
- VecMulf(n, -1.0f);
+ VecNegf(n);
sample_occ_tree(re, re->occlusiontree, NULL, co, n, othread->thread, 0, col);
VECCOPY(othread->facecol[a], col);
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index c3b281f2a23..5dfb509939b 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -1505,8 +1505,8 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
/* not a pretty solution, but fixes common cases */
if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
- VecMulf(shi->vn, -1.0f);
- VecMulf(shi->vno, -1.0f);
+ VecNegf(shi->vn);
+ VecNegf(shi->vno);
}
/* if nodetree, use the material that we are currently preprocessing
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 476330152ec..1cd8ec110f9 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -354,7 +354,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
Normalize(shi->vn);
if(INPR(shi->vn, shi->view) < 0.0f)
- VecMulf(shi->vn, -1.0f);
+ VecNegf(shi->vn);
}
VECCOPY(shi->vno, shi->vn);