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:
authorDaniel Genrich <daniel.genrich@gmx.net>2008-03-20 21:28:40 +0300
committerDaniel Genrich <daniel.genrich@gmx.net>2008-03-20 21:28:40 +0300
commitaf8c68ddc4a67b9c329d15b540a1bc0f07d98838 (patch)
treed75f48c789b39b3feb9b8fa3b2fb56109dabb6dd /source/blender/blenkernel/intern/collision.c
parent9362772ffda053186780e5f976d43a99f7cfd699 (diff)
Cloth structure names update: Sorry about this commit, it will kill all your cloth settings in old files but I had to do it before release because naming convention was really bad in cloth (e.g. using SimulationSettings instead of ClothSimSettings in DNA). Same for some structure in CollisionModifier but with no sideeffects.
Diffstat (limited to 'source/blender/blenkernel/intern/collision.c')
-rw-r--r--source/blender/blenkernel/intern/collision.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index ef69da0ed86..403762e36bf 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -427,6 +427,7 @@ int cloth_collision_response_static(ClothModifierData *clmd, CollisionModifierDa
float w1, w2, w3, u1, u2, u3;
float v1[3], v2[3], relativeVelocity[3];
float magrelVel;
+ float epsilon2 = collmd->bvh->epsilon;
cloth1 = clmd->clothObject;
@@ -510,7 +511,7 @@ int cloth_collision_response_static(ClothModifierData *clmd, CollisionModifierDa
// Apply repulse impulse if distance too short
// I_r = -min(dt*kd, m(0,1d/dt - v_n))
- d = clmd->coll_parms->epsilon*8.0/9.0 - collpair->distance;
+ d = clmd->coll_parms->epsilon*8.0/9.0 + epsilon2*8.0/9.0 - collpair->distance;
if((magrelVel < 0.1*d*clmd->sim_parms->stepsPerFrame) && (d > ALMOST_ZERO))
{
repulse = MIN2(d*1.0/clmd->sim_parms->stepsPerFrame, 0.1*d*clmd->sim_parms->stepsPerFrame - magrelVel);
@@ -557,6 +558,7 @@ void cloth_collision_static(ModifierData *md1, ModifierData *md2, CollisionTree
ClothVertex *verts1=NULL;
double distance = 0;
float epsilon = clmd->coll_parms->epsilon;
+ float epsilon2 = ((CollisionModifierData *)md2)->bvh->epsilon;
unsigned int i = 0;
for(i = 0; i < 4; i++)
@@ -641,9 +643,9 @@ void cloth_collision_static(ModifierData *md1, ModifierData *md2, CollisionTree
verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector);
#else
// just be sure that we don't add anything
- distance = 2.0 * (epsilon + ALMOST_ZERO);
+ distance = 2.0 * (epsilon + epsilon2 + ALMOST_ZERO);
#endif
- if (distance <= (epsilon + ALMOST_ZERO))
+ if (distance <= (epsilon + epsilon2 + ALMOST_ZERO))
{
// printf("dist: %f\n", (float)distance);
@@ -968,10 +970,10 @@ int cloth_bvh_objcollisions_do(ClothModifierData * clmd, CollisionModifierData *
verts = cloth->verts;
- if (collmd->tree)
+ if (collmd->bvh)
{
/* get pointer to bounding volume hierarchy */
- BVH *coll_bvh = collmd->tree;
+ BVH *coll_bvh = collmd->bvh;
/* move object to position (step) in time */
collision_move_object(collmd, step + dt, step);
@@ -991,7 +993,7 @@ int cloth_bvh_objcollisions_do(ClothModifierData * clmd, CollisionModifierData *
{
result = 0;
- if (collmd->tree)
+ if (collmd->bvh)
result += cloth_collision_response_static(clmd, collmd);
// apply impulses in parallel