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:
Diffstat (limited to 'source/blender/physics/intern/BPH_mass_spring.cpp')
-rw-r--r--source/blender/physics/intern/BPH_mass_spring.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 451959766cb..1b8b05ac752 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -149,7 +149,7 @@ static bool collision_response(ClothModifierData *clmd, CollisionModifierData *c
return false; /* XXX tested before already? */
/* only handle static collisions here */
- if ( collpair->flag & COLLISION_IN_FUTURE )
+ if (collpair->flag & COLLISION_IN_FUTURE)
return false;
/* velocity */
@@ -260,8 +260,8 @@ static void cloth_setup_constraints(ClothModifierData *clmd, ColliderContacts *c
* collisions*/
static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothModifierData *clmd, float (*initial_cos)[3], float UNUSED(step), float dt)
{
- Cloth *cloth= clmd->clothObject;
- float (*cos)[3] = (float (*)[3])MEM_callocN(sizeof(float[3]) * cloth->mvert_num, "cos cloth_calc_helper_forces");
+ Cloth *cloth = clmd->clothObject;
+ float(*cos)[3] = (float(*)[3])MEM_callocN(sizeof(float[3]) * cloth->mvert_num, "cos cloth_calc_helper_forces");
float *masses = (float *)MEM_callocN(sizeof(float) * cloth->mvert_num, "cos cloth_calc_helper_forces");
LinkNode *node;
ClothSpring *spring;
@@ -281,8 +281,8 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothMo
}
steps = 55;
- for (i=0; i<steps; i++) {
- for (node=cloth->springs; node; node=node->next) {
+ for (i = 0; i < steps; i++) {
+ for (node = cloth->springs; node; node = node->next) {
/* ClothVertex *cv1, *cv2; */ /* UNUSED */
int v1, v2;
float len, c, l, vec[3];
@@ -322,7 +322,7 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothMo
/*compute forces*/
sub_v3_v3v3(vec, cos[i], cv->tx);
- mul_v3_fl(vec, cv->mass*dt*20.0f);
+ mul_v3_fl(vec, cv->mass * dt * 20.0f);
add_v3_v3(cv->tv, vec);
//copy_v3_v3(cv->tx, cos[i]);
}
@@ -438,10 +438,10 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), ListB
/* Collect forces and derivatives: F, dFdX, dFdV */
Cloth *cloth = clmd->clothObject;
Implicit_Data *data = cloth->implicit;
- unsigned int i = 0;
- float drag = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */
- float gravity[3] = {0.0f, 0.0f, 0.0f};
- const MVertTri *tri = cloth->tri;
+ unsigned int i = 0;
+ float drag = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */
+ float gravity[3] = {0.0f, 0.0f, 0.0f};
+ const MVertTri *tri = cloth->tri;
unsigned int mvert_num = cloth->mvert_num;
ClothVertex *vert;
@@ -481,7 +481,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), ListB
/* handle external forces like wind */
if (effectors) {
/* cache per-vertex forces to avoid redundant calculation */
- float (*winvec)[3] = (float (*)[3])MEM_callocN(sizeof(float[3]) * mvert_num, "effector forces");
+ float(*winvec)[3] = (float(*)[3])MEM_callocN(sizeof(float[3]) * mvert_num, "effector forces");
for (i = 0; i < cloth->mvert_num; i++) {
float x[3], v[3];
EffectedPoint epoint;
@@ -526,8 +526,8 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), ListB
else
BPH_mass_spring_force_vertex_wind(data, i, 1.0f, winvec);
}
- }
#endif
+ }
MEM_freeN(winvec);
}
@@ -576,7 +576,7 @@ BLI_INLINE LinkNode *hair_spring_next(LinkNode *spring_link)
static LinkNode *cloth_continuum_add_hair_segments(HairGrid *grid, const float cell_scale, const float cell_offset[3], Cloth *cloth, LinkNode *spring_link)
{
Implicit_Data *data = cloth->implicit;
- LinkNode *next_spring_link = NULL; /* return value */
+ LinkNode *next_spring_link = NULL; /* return value */
ClothSpring *spring1, *spring2, *spring3;
// ClothVertex *verts = cloth->verts;
// ClothVertex *vert3, *vert4;
@@ -686,7 +686,7 @@ static void cloth_continuum_step(ClothModifierData *clmd, float dt)
int mvert_num = cloth->mvert_num;
ClothVertex *vert;
- const float fluid_factor = 0.95f; /* blend between PIC and FLIP methods */
+ const float fluid_factor = 0.95f; /* blend between PIC and FLIP methods */
float smoothfac = parms->velocity_smooth;
/* XXX FIXME arbitrary factor!!! this should be based on some intuitive value instead,
* like number of hairs per cell and time decay instead of "strength"
@@ -744,16 +744,16 @@ static void cloth_continuum_step(ClothModifierData *clmd, float dt)
zero_v3(b);
offset[axis] = shift * clmd->hair_grid_cellsize;
- a[(axis+1) % 3] = clmd->hair_grid_max[(axis+1) % 3] - clmd->hair_grid_min[(axis+1) % 3];
- b[(axis+2) % 3] = clmd->hair_grid_max[(axis+2) % 3] - clmd->hair_grid_min[(axis+2) % 3];
+ a[(axis + 1) % 3] = clmd->hair_grid_max[(axis + 1) % 3] - clmd->hair_grid_min[(axis + 1) % 3];
+ b[(axis + 2) % 3] = clmd->hair_grid_max[(axis + 2) % 3] - clmd->hair_grid_min[(axis + 2) % 3];
BKE_sim_debug_data_clear_category(clmd->debug_data, "grid velocity");
for (j = 0; j < size; ++j) {
for (i = 0; i < size; ++i) {
float x[3], v[3], gvel[3], gvel_smooth[3], gdensity;
- madd_v3_v3v3fl(x, offset, a, (float)i / (float)(size-1));
- madd_v3_v3fl(x, b, (float)j / (float)(size-1));
+ madd_v3_v3v3fl(x, offset, a, (float)i / (float)(size - 1));
+ madd_v3_v3fl(x, b, (float)j / (float)(size - 1));
zero_v3(v);
BPH_hair_volume_grid_interpolate(grid, x, &gdensity, gvel, gvel_smooth, NULL, NULL);
@@ -872,7 +872,7 @@ static void cloth_collision_solve_extra(Object *ob, ClothModifierData *clmd, Lis
}
#if 0 /* unused */
- for (i=0, cv=cloth->verts; i<cloth->mvert_num; i++, cv++) {
+ for (i = 0, cv = cloth->verts; i < cloth->mvert_num; i++, cv++) {
copy_v3_v3(initial_cos[i], cv->tx);
}
#endif
@@ -896,7 +896,7 @@ static void cloth_collision_solve_extra(Object *ob, ClothModifierData *clmd, Lis
float newv[3];
- 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;
BPH_mass_spring_set_new_position(id, i, verts[i].tx);
@@ -941,7 +941,7 @@ static void cloth_record_result(ClothModifierData *clmd, ImplicitSolverResult *r
{
ClothSolverResult *sres = clmd->solver_result;
- if (sres->status) { /* already initialized ? */
+ if (sres->status) { /* already initialized ? */
/* error only makes sense for successful iterations */
if (result->status == BPH_SOLVER_SUCCESS) {
sres->min_error = min_ff(sres->min_error, result->error);
@@ -975,10 +975,10 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
*/
const bool is_hair = (clmd->hairdata != NULL);
- unsigned int i=0;
- float step=0.0f, tf=clmd->sim_parms->timescale;
+ unsigned int i = 0;
+ float step = 0.0f, tf = clmd->sim_parms->timescale;
Cloth *cloth = clmd->clothObject;
- ClothVertex *verts = cloth->verts/*, *cv*/;
+ ClothVertex *verts = cloth->verts /*, *cv*/;
unsigned int mvert_num = cloth->mvert_num;
float dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
Implicit_Data *id = cloth->implicit;
@@ -991,7 +991,7 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
clmd->solver_result = (ClothSolverResult *)MEM_callocN(sizeof(ClothSolverResult), "cloth solver result");
cloth_clear_result(clmd);
- 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 < mvert_num; i++) {
// update velocities with constrained velocities from pinned verts
if (verts[i].flags & CLOTH_VERT_FLAG_PINNED) {