Cloth: changes in editmode will influence the velocity by 10% now, changed/add some update calls for the implicit function

This commit is contained in:
Daniel Genrich 2008-02-13 10:44:36 +00:00
parent 5c7f41118c
commit 3192263367
3 changed files with 9 additions and 9 deletions

@ -1112,6 +1112,9 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
// init our solver
if ( solvers [clmd->sim_parms->solver_type].init )
solvers [clmd->sim_parms->solver_type].init ( ob, clmd );
if(cache_there)
implicit_set_positions(clmd);
clmd->clothObject->tree = bvh_build_from_cloth ( clmd, clmd->coll_parms->epsilon );

@ -979,7 +979,7 @@ int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float dt)
Cloth *cloth=NULL;
Object *coll_ob=NULL;
BVH *cloth_bvh=NULL;
long i=0, j = 0, numfaces = 0, numverts = 0, k = 0;
long i=0, j = 0, numfaces = 0, numverts = 0;
unsigned int result = 0, ic = 0, rounds = 0; // result counts applied collisions; ic is for debug output;
ClothVertex *verts = NULL;
float tnull[3] = {0,0,0};

@ -1122,12 +1122,12 @@ void load_editMesh(void)
VECCOPY(cloth->verts[i].x, eve->co);
Mat4MulVecfl ( G.obedit->obmat, cloth->verts[i].x );
/*
// not physical correct but gives nicer results when commented
VECSUB(temp, cloth->verts[i].x, temp);
VecMulf(temp, 1.0f / dt);
VecMulf(temp, 1.0f / (dt*10.0));
VECADD(cloth->verts[i].v, cloth->verts[i].v, temp);
*/
if(oldverts) {
VECCOPY(mvert->co, oldverts[i].co);
if(G.rt > 0)
@ -1171,12 +1171,9 @@ void load_editMesh(void)
if(G.rt > 0)
printf("loadmesh --> cloth_enabled cloth_write_cache\n");
cloth_write_cache(G.obedit, clmd, clmd->sim_parms->editedframe);
cloth_read_cache(G.obedit, clmd, G.scene->r.cfra);
implicit_set_positions(clmd);
/* in this case we have to get the data for the requested frame */
if(clmd->sim_parms->editedframe != G.scene->r.cfra)
{
cloth_read_cache(G.obedit, clmd, G.scene->r.cfra);
}
clmd->sim_parms->flags &= ~CLOTH_SIMSETTINGS_FLAG_EDITMODE;
}
else