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>2012-03-24 10:18:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 10:18:31 +0400
commit69e6894b15271884623ea6f56ead06db83acbe99 (patch)
treeb68200606afaca06cf7552f6b12fc20ebd30d487 /source/blender/blenkernel/intern/implicit.c
parent7b99ae0ad3017e373be2a344e30d190b70ca66b4 (diff)
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/blenkernel/intern/implicit.c')
-rw-r--r--source/blender/blenkernel/intern/implicit.c203
1 files changed, 102 insertions, 101 deletions
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index a271513afc0..2787674036b 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -57,7 +57,7 @@ static LARGE_INTEGER ifreq;
static void itstart(void)
{
static int first = 1;
- if(first) {
+ if (first) {
QueryPerformanceFrequency(&ifreq);
first = 0;
}
@@ -178,7 +178,7 @@ static void print_fvector(float m3[3])
DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
print_fvector(fLongVector[i]);
}
@@ -208,7 +208,7 @@ DO_INLINE void cp_lfvector(float (*to)[3], float (*from)[3], unsigned int verts)
DO_INLINE void init_lfvector(float (*fLongVector)[3], float vector[3], unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
copy_v3_v3(fLongVector[i], vector);
}
@@ -223,7 +223,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
mul_fvector_S(to[i], fLongVector[i], scalar);
}
@@ -233,7 +233,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
DO_INLINE void submul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECSUBMUL(to[i], fLongVector[i], scalar);
}
@@ -248,7 +248,7 @@ DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], float (*fLongVectorB)[3],
// different results each time you run it!
// schedule(guided, 2)
//#pragma omp parallel for reduction(+: temp) if(verts > CLOTH_OPENMP_LIMIT)
- for(i = 0; i < (long)verts; i++) {
+ for (i = 0; i < (long)verts; i++) {
temp += dot_v3v3(fLongVectorA[i], fLongVectorB[i]);
}
return temp;
@@ -258,7 +258,7 @@ DO_INLINE void add_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECADD(to[i], fLongVectorA[i], fLongVectorB[i]);
}
@@ -269,7 +269,7 @@ DO_INLINE void add_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECADDS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
@@ -280,7 +280,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECADDSS(to[i], fLongVectorA[i], aS, fLongVectorB[i], bS);
}
@@ -289,7 +289,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
DO_INLINE void sub_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], float bS, unsigned int verts)
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
VECSUBS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
}
@@ -300,7 +300,7 @@ DO_INLINE void sub_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
{
unsigned int i = 0;
- for(i = 0; i < verts; i++)
+ for (i = 0; i < verts; i++)
{
sub_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]);
}
@@ -350,14 +350,14 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
unsigned int i, j;
float d;
- if((d=det_fmatrix(from))==0)
+ if ((d=det_fmatrix(from))==0)
{
printf("can't build inverse");
exit(0);
}
- for(i=0;i<3;i++)
+ for (i=0;i<3;i++)
{
- for(j=0;j<3;j++)
+ for (j=0;j<3;j++)
{
int i1=(i+1)%3;
int i2=(i+2)%3;
@@ -366,7 +366,7 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
// reverse indexs i&j to take transpose
to[j][i] = (from[i1][j1]*from[i2][j2]-from[i1][j2]*from[i2][j1])/d;
/*
- if(i==j)
+ if (i==j)
to[i][j] = 1.0f / from[i][j];
else
to[i][j] = 0;
@@ -516,7 +516,7 @@ static void print_bfmatrix(fmatrix3x3 *m3)
{
unsigned int i = 0;
- for(i = 0; i < m3[0].vcount + m3[0].scount; i++)
+ for (i = 0; i < m3[0].vcount + m3[0].scount; i++)
{
print_fmatrix(m3[i].m);
}
@@ -554,7 +554,7 @@ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
{
unsigned int i;
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
cp_fmatrix(matrix[i].m, m3);
}
@@ -567,11 +567,11 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
unsigned int i,j;
float tmatrix[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
- for(i = 0; i < matrix[0].vcount; i++)
+ for (i = 0; i < matrix[0].vcount; i++)
{
cp_fmatrix(matrix[i].m, m3);
}
- for(j = matrix[0].vcount; j < matrix[0].vcount+matrix[0].scount; j++)
+ for (j = matrix[0].vcount; j < matrix[0].vcount+matrix[0].scount; j++)
{
cp_fmatrix(matrix[j].m, tmatrix);
}
@@ -581,7 +581,7 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
DO_INLINE void mul_bfmatrix_S(fmatrix3x3 *matrix, float scalar)
{
unsigned int i = 0;
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
mul_fmatrix_S(matrix[i].m, scalar);
}
@@ -601,14 +601,14 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector
{
#pragma omp section
{
- for(i = from[0].vcount; i < from[0].vcount+from[0].scount; i++)
+ for (i = from[0].vcount; i < from[0].vcount+from[0].scount; i++)
{
muladd_fmatrix_fvector(to[from[i].c], from[i].m, fLongVector[from[i].r]);
}
}
#pragma omp section
{
- for(i = 0; i < from[0].vcount+from[0].scount; i++)
+ for (i = 0; i < from[0].vcount+from[0].scount; i++)
{
muladd_fmatrix_fvector(temp[from[i].r], from[i].m, fLongVector[from[i].c]);
}
@@ -627,7 +627,7 @@ DO_INLINE void mul_prevfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVec
{
unsigned int i = 0;
- for(i = 0; i < from[0].vcount; i++)
+ for (i = 0; i < from[0].vcount; i++)
{
mul_fmatrix_fvector(to[from[i].r], from[i].m, fLongVector[from[i].c]);
}
@@ -639,7 +639,7 @@ DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -651,7 +651,7 @@ DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -663,7 +663,7 @@ DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -675,7 +675,7 @@ DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -687,7 +687,7 @@ DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix3
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount; i++)
+ for (i = 0; i < matrix[0].vcount; i++)
{
sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);
}
@@ -699,7 +699,7 @@ DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -713,7 +713,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo
unsigned int i = 0;
/* process diagonal elements */
- for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
{
subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS);
}
@@ -739,7 +739,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
Implicit_Data *id = NULL;
LinkNode *search = NULL;
- if(G.rt > 0)
+ if (G.rt > 0)
printf("implicit_init\n");
// init memory guard
@@ -772,11 +772,11 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
id->dV = create_lfvector(cloth->numverts);
id->z = create_lfvector(cloth->numverts);
- for(i=0;i<cloth->numverts;i++)
+ for (i=0;i<cloth->numverts;i++)
{
id->A[i].r = id->A[i].c = id->dFdV[i].r = id->dFdV[i].c = id->dFdX[i].r = id->dFdX[i].c = id->P[i].c = id->P[i].r = id->Pinv[i].c = id->Pinv[i].r = id->bigI[i].c = id->bigI[i].r = id->M[i].r = id->M[i].c = i;
- if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+ if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
{
id->S[pinned].pinned = 1;
id->S[pinned].c = id->S[pinned].r = i;
@@ -791,7 +791,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
// init springs
search = cloth->springs;
- for(i=0;i<cloth->numsprings;i++)
+ for (i=0;i<cloth->numsprings;i++)
{
spring = search->link;
@@ -810,7 +810,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
initdiag_bfmatrix(id->bigI, I);
- for(i = 0; i < cloth->numverts; i++)
+ for (i = 0; i < cloth->numverts; i++)
{
copy_v3_v3(id->X[i], verts[i].x);
}
@@ -823,11 +823,11 @@ int implicit_free (ClothModifierData *clmd)
Cloth *cloth;
cloth = (Cloth *)clmd->clothObject;
- if(cloth)
+ if (cloth)
{
id = cloth->implicit;
- if(id)
+ if (id)
{
del_bfmatrix(id->A);
del_bfmatrix(id->dFdV);
@@ -874,7 +874,7 @@ DO_INLINE float fbstar(float length, float L, float kb, float cb)
float fbstar = cb * (length - L);
- if(tempfb < fbstar)
+ if (tempfb < fbstar)
return fbstar;
else
return tempfb;
@@ -886,7 +886,7 @@ DO_INLINE float fbstar_jacobi(float length, float L, float kb, float cb)
float tempfb = kb * fb(length, L);
float fbstar = cb * (length - L);
- if(tempfb < fbstar)
+ if (tempfb < fbstar)
{
return cb;
}
@@ -900,7 +900,7 @@ DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
{
unsigned int i=0;
- for(i=0;i<S[0].vcount;i++)
+ for (i=0;i<S[0].vcount;i++)
{
mul_fvector_fmatrix(V[S[i].r], V[S[i].r], S[i].m);
}
@@ -936,7 +936,7 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
s = dot_lfvector(r, r, numverts);
starget = s * sqrt(conjgrad_epsilon);
- while(s>starget && conjgrad_loopcount < conjgrad_looplimit)
+ while (s>starget && conjgrad_loopcount < conjgrad_looplimit)
{
// Mul(q,A,d); // q = A*d;
mul_bfmatrix_lfvector(q, lA, d);
@@ -979,7 +979,7 @@ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv)
// Take only the diagonal blocks of A
// #pragma omp parallel for private(i) if(lA[0].vcount > CLOTH_OPENMP_LIMIT)
- for(i = 0; i<lA[0].vcount; i++)
+ for (i = 0; i<lA[0].vcount; i++)
{
// block diagonalizer
cp_fmatrix(P[i].m, lA[i].m);
@@ -1255,12 +1255,12 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
s->flags &= ~CLOTH_SPRING_FLAG_NEEDED;
- if(length > ALMOST_ZERO)
+ if (length > ALMOST_ZERO)
{
/*
- if(length>L)
+ if (length>L)
{
- if((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)
+ if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)
&& ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
{
s->flags |= CSPRING_FLAG_DEACTIVATE;
@@ -1276,9 +1276,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
}
// calculate force of structural + shear springs
- if((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
+ if ((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
{
- if(length > L || no_compress)
+ if (length > L || no_compress)
{
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
@@ -1339,7 +1339,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
}
else // calculate force of bending springs
{
- if(length < L)
+ if (length < L)
{
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
@@ -1358,9 +1358,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSpring *s, lfVector *lF, lfVector *UNUSED(X), lfVector *UNUSED(V), fmatrix3x3 *dFdV, fmatrix3x3 *dFdX)
{
- if(s->flags & CLOTH_SPRING_FLAG_NEEDED)
+ if (s->flags & CLOTH_SPRING_FLAG_NEEDED)
{
- if(!(s->type & CLOTH_SPRING_TYPE_BENDING))
+ if (!(s->type & CLOTH_SPRING_TYPE_BENDING))
{
sub_fmatrix_fmatrix(dFdV[s->ij].m, dFdV[s->ij].m, s->dfdv);
sub_fmatrix_fmatrix(dFdV[s->kl].m, dFdV[s->kl].m, s->dfdv);
@@ -1369,7 +1369,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp
VECADD(lF[s->ij], lF[s->ij], s->f);
- if(!(s->type & CLOTH_SPRING_TYPE_GOAL))
+ if (!(s->type & CLOTH_SPRING_TYPE_GOAL))
sub_v3_v3v3(lF[s->kl], lF[s->kl], s->f);
sub_fmatrix_fmatrix(dFdX[s->kl].m, dFdX[s->kl].m, s->dfdx);
@@ -1451,13 +1451,13 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
INIT_MINMAX(gmin, gmax);
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
DO_MINMAX(lX[i], gmin, gmax);
/* initialize grid */
- for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
- for(k = 0; k < 10; k++) {
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 10; j++) {
+ for (k = 0; k < 10; k++) {
grid[i][j][k].velocity[0] = 0.0f;
grid[i][j][k].velocity[1] = 0.0f;
grid[i][j][k].velocity[2] = 0.0f;
@@ -1472,7 +1472,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
}
/* gather velocities & density */
- if(smoothfac > 0.0f) for(v = 0; v < numverts; v++) {
+ if (smoothfac > 0.0f) for(v = 0; v < numverts; v++) {
i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
@@ -1486,22 +1486,22 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
}
/* gather colliders */
- if(colliders && collfac > 0.0f) for(col = colliders->first; col; col = col->next)
+ if (colliders && collfac > 0.0f) for(col = colliders->first; col; col = col->next)
{
MVert *loc0 = col->collmd->x;
MVert *loc1 = col->collmd->xnew;
float vel[3];
- for(v=0; v<col->collmd->numverts; v++, loc0++, loc1++) {
+ for (v=0; v<col->collmd->numverts; v++, loc0++, loc1++) {
i = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 0);
- if(i>=0 && i<10) {
+ if (i>=0 && i<10) {
j = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 1);
- if(j>=0 && j<10) {
+ if (j>=0 && j<10) {
k = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 2);
- if(k>=0 && k<10) {
+ if (k>=0 && k<10) {
sub_v3_v3v3(vel, loc1->co, loc0->co);
colg[i][j][k].velocity[0] += vel[0];
@@ -1516,18 +1516,18 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
/* divide velocity with density */
- for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
- for(k = 0; k < 10; k++) {
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 10; j++) {
+ for (k = 0; k < 10; k++) {
density = grid[i][j][k].density;
- if(density > 0.0f) {
+ if (density > 0.0f) {
grid[i][j][k].velocity[0] /= density;
grid[i][j][k].velocity[1] /= density;
grid[i][j][k].velocity[2] /= density;
}
density = colg[i][j][k].density;
- if(density > 0.0f) {
+ if (density > 0.0f) {
colg[i][j][k].velocity[0] /= density;
colg[i][j][k].velocity[1] /= density;
colg[i][j][k].velocity[2] /= density;
@@ -1537,7 +1537,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
}
/* calculate forces */
- for(v = 0; v < numverts; v++) {
+ for (v = 0; v < numverts; v++) {
i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
@@ -1548,7 +1548,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
lF[v][1] += smoothfac * (grid[i][j][k].velocity[1] - lV[v][1]);
lF[v][2] += smoothfac * (grid[i][j][k].velocity[2] - lV[v][2]);
- if(colg[i][j][k].density > 0.0f) {
+ if (colg[i][j][k].density > 0.0f) {
lF[v][0] += collfac * (colg[i][j][k].velocity[0] - lV[v][0]);
lF[v][1] += collfac * (colg[i][j][k].velocity[1] - lV[v][1]);
lF[v][2] += collfac * (colg[i][j][k].velocity[2] - lV[v][2]);
@@ -1575,7 +1575,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
tm2[0][0]= tm2[1][1]= tm2[2][2]= -spring_air;
/* global acceleration (gravitation) */
- if(clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
+ if (clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
copy_v3_v3(gravity, clmd->scene->physics_settings.gravity);
mul_fvector_S(gravity, gravity, 0.001f * clmd->sim_parms->effector_weights->global_gravity); /* scale gravity force */
}
@@ -1587,13 +1587,13 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
init_lfvector(lF, gravity, numverts);
- if(clmd->sim_parms->velocity_smooth > 0.0f || clmd->sim_parms->collider_friction > 0.0f)
+ if (clmd->sim_parms->velocity_smooth > 0.0f || clmd->sim_parms->collider_friction > 0.0f)
hair_velocity_smoothing(clmd, lF, lX, lV, numverts);
/* multiply lF with mass matrix
// force = mass * acceleration (in this case: gravity)
*/
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
float temp[3];
copy_v3_v3(temp, lF[i]);
@@ -1603,22 +1603,22 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
submul_lfvectorS(lF, lV, spring_air, numverts);
/* handle external forces like wind */
- if(effectors)
+ if (effectors)
{
// 0 = force, 1 = normalized force
winvec = create_lfvector(cloth->numverts);
- if(!winvec)
+ if (!winvec)
printf("winvec: out of memory in implicit.c\n");
// precalculate wind forces
- for(i = 0; i < cloth->numverts; i++)
+ for (i = 0; i < cloth->numverts; i++)
{
pd_point_from_loc(clmd->scene, (float*)lX[i], (float*)lV[i], i, &epoint);
pdDoEffectors(effectors, NULL, clmd->sim_parms->effector_weights, &epoint, winvec[i], NULL);
}
- for(i = 0; i < cloth->numfaces; i++)
+ for (i = 0; i < cloth->numfaces; i++)
{
float trinormal[3]={0,0,0}; // normalized triangle normal
float triunnormal[3]={0,0,0}; // not-normalized-triangle normal
@@ -1627,7 +1627,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
factor *= 0.02;
// calculate face normal
- if(mfaces[i].v4)
+ if (mfaces[i].v4)
CalcFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],triunnormal);
else
CalcFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],triunnormal);
@@ -1650,7 +1650,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
// add wind from v4
- if(mfaces[i].v4)
+ if (mfaces[i].v4)
{
copy_v3_v3(tmp, trinormal);
mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
@@ -1659,7 +1659,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
}
/* Hair has only edges */
- if(cloth->numfaces == 0) {
+ if (cloth->numfaces == 0) {
ClothSpring *spring;
float edgevec[3]={0,0,0}; //edge vector
float edgeunnormal[3]={0,0,0}; // not-normalized-edge normal
@@ -1667,10 +1667,10 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
float factor = 0.01;
search = cloth->springs;
- while(search) {
+ while (search) {
spring = search->link;
- if(spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
+ if (spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
sub_v3_v3v3(edgevec, (float*)lX[spring->ij], (float*)lX[spring->kl]);
project_v3_v3v3(tmp, winvec[spring->ij], edgevec);
@@ -1692,7 +1692,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
// calculate spring forces
search = cloth->springs;
- while(search)
+ while (search)
{
// only handle active springs
// if(((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)) {}
@@ -1703,7 +1703,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
// apply spring forces
search = cloth->springs;
- while(search)
+ while (search)
{
// only handle active springs
// if(((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED))
@@ -1765,7 +1765,8 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float
if (cv->goal == 1.0f || len_v3v3(initial_cos[i], cv->tx) != 0.0) {
masses[i] = 1e+10;
- } else {
+ }
+ else {
masses[i] = cv->mass;
}
}
@@ -1835,12 +1836,12 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
Implicit_Data *id = cloth->implicit;
int do_extra_solve;
- if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) /* do goal stuff */
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) /* do goal stuff */
{
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
// update velocities with constrained velocities from pinned verts
- if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+ if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
{
sub_v3_v3v3(id->V[i], verts[i].xconst, verts[i].xold);
// mul_v3_fl(id->V[i], clmd->sim_parms->stepsPerFrame);
@@ -1848,7 +1849,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
}
}
- while(step < tf)
+ while (step < tf)
{
// damping velocity for artistic reasons
mul_lfvectorS(id->V, id->V, clmd->sim_parms->vel_damping, numverts);
@@ -1863,11 +1864,11 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
add_lfvector_lfvectorS(id->Xnew, id->X, id->Vnew, dt, numverts);
/* move pinned verts to correct position */
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
- if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
{
- if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+ if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
{
float tvect[3] = {.0,.0,.0};
sub_v3_v3v3(tvect, verts[i].xconst, verts[i].xold);
@@ -1880,13 +1881,13 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
copy_v3_v3(verts[i].txold, id->X[i]);
}
- if(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree)
+ if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree)
{
// collisions
// itstart();
// update verts to current positions
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
copy_v3_v3(verts[i].tx, id->Xnew[i]);
@@ -1903,7 +1904,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
do_extra_solve = cloth_bvh_objcollision(ob, clmd, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
// copy corrected positions back to simulation
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
// correct velocity again, just to be sure we had to change it due to adaptive collisions
sub_v3_v3v3(verts[i].tv, verts[i].tx, id->X[i]);
@@ -1912,13 +1913,13 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
//if (do_extra_solve)
// cloth_calc_helper_forces(ob, clmd, initial_cos, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
- if(do_extra_solve)
+ if (do_extra_solve)
{
- if((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
+ if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
continue;
copy_v3_v3(id->Xnew[i], verts[i].tx);
@@ -1932,7 +1933,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
// if there were collisions, advance the velocity from v_n+1/2 to v_n+1
- if(do_extra_solve)
+ if (do_extra_solve)
{
// V = Vnew;
cp_lfvector(id->V, id->Vnew, numverts);
@@ -1958,9 +1959,9 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
step += dt;
}
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
- if((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
+ if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
{
copy_v3_v3(verts[i].txold, verts[i].xconst); // TODO: test --> should be .x
copy_v3_v3(verts[i].x, verts[i].xconst);
@@ -1986,12 +1987,12 @@ void implicit_set_positions (ClothModifierData *clmd)
unsigned int numverts = cloth->numverts, i;
Implicit_Data *id = cloth->implicit;
- for(i = 0; i < numverts; i++)
+ for (i = 0; i < numverts; i++)
{
copy_v3_v3(id->X[i], verts[i].x);
copy_v3_v3(id->V[i], verts[i].v);
}
- if(G.rt > 0)
+ if (G.rt > 0)
printf("implicit_set_positions\n");
}