hair was running collision functions (copy to/from collision arrays), even when collision could not be done.

This commit is contained in:
Campbell Barton
2010-02-24 18:06:51 +00:00
parent b888a32eee
commit aebe86bef1
2 changed files with 9 additions and 13 deletions

View File

@@ -1550,8 +1550,8 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
// cloth - object collisions
int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, float dt )
{
Cloth *cloth=NULL;
BVHTree *cloth_bvh=NULL;
Cloth *cloth= clmd->clothObject;
BVHTree *cloth_bvh= cloth->bvhtree;
int i=0, numfaces = 0, numverts = 0, k, l, j;
int rounds = 0; // result counts applied collisions; ic is for debug output;
ClothVertex *verts = NULL;
@@ -1559,16 +1559,12 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
Object **collobjs = NULL;
int numcollobj = 0;
if ( ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ ) || ! ( ( ( Cloth * ) clmd->clothObject )->bvhtree ) )
{
if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || cloth_bvh==NULL)
return 0;
}
cloth = clmd->clothObject;
verts = cloth->verts;
cloth_bvh = ( BVHTree * ) cloth->bvhtree;
numfaces = clmd->clothObject->numfaces;
numverts = clmd->clothObject->numverts;
numfaces = cloth->numfaces;
numverts = cloth->numverts;
////////////////////////////////////////////////////////////
// static collisions
@@ -1672,8 +1668,8 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
// collisions = 1;
verts = cloth->verts; // needed for openMP
numfaces = clmd->clothObject->numfaces;
numverts = clmd->clothObject->numverts;
numfaces = cloth->numfaces;
numverts = cloth->numverts;
verts = cloth->verts;

View File

@@ -1689,8 +1689,8 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
VECCOPY(verts[i].txold, id->X[i]);
}
if(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED)
if(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree)
{
float temp = clmd->sim_parms->stepsPerFrame;
/* not too nice hack, but collisions need this correction -jahka */