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-06 04:21:40 +0300
committerDaniel Genrich <daniel.genrich@gmx.net>2008-03-06 04:21:40 +0300
commit3ebcb390906a2d0e4685d3fbf374c7a5eb740874 (patch)
tree3ad40256809d27ad4dc361c3efb7e99cff0fe6dc /source/blender/blenkernel/intern
parent18fc43950d84995c7433295e8dfce065dc08ae67 (diff)
Cloth bugfix for jumpy cloth (users were complaining), so the mass can be changed on GUI now (reference: in old blendfiles, mass=1.0 was used)
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/cloth.c8
-rw-r--r--source/blender/blenkernel/intern/collision.c12
-rw-r--r--source/blender/blenkernel/intern/implicit.c1
3 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index ee857805fb5..f312a331975 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -970,9 +970,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
(clmd->sim_parms->vgroup_bend>0)))
{
for ( i = 0; i < numverts; i++, verts++ )
- {
- verts->mass = 1.0; // standard mass
-
+ {
dvert = dm->getVertData ( dm, i, CD_MDEFORMVERT );
if ( dvert )
{
@@ -1029,6 +1027,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
float tnull[3] = {0,0,0};
int cache_there = 0;
Cloth *cloth = NULL;
+ MFace *mfaces = NULL;
// If we have a clothObject, free it.
if ( clmd->clothObject != NULL )
@@ -1091,7 +1090,8 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
}
/* no GUI interface yet */
- verts->mass = clmd->sim_parms->mass = 1.0f;
+ verts->mass = clmd->sim_parms->mass;
+ verts->impulse_count = 0;
if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
verts->goal= clmd->sim_parms->defgoal;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 65583a6c9c4..f9391a0adb8 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -399,7 +399,7 @@ int cloth_get_collision_time(float a[3], float b[3], float c[3], float d[3], flo
}
// w3 is not perfect
-void cloth_compute_barycentric (float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3)
+void collision_compute_barycentric (float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3)
{
double tempV1[3], tempV2[3], tempV4[3];
double a,b,c,d,e,f;
@@ -434,7 +434,7 @@ void cloth_compute_barycentric (float pv[3], float p1[3], float p2[3], float p3[
w3[0] = 1.0f - w1[0] - w2[0];
}
-DO_INLINE void interpolateOnTriangle(float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3)
+DO_INLINE void collision_interpolateOnTriangle(float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3)
{
to[0] = to[1] = to[2] = 0;
VECADDMUL(to, v1, w1);
@@ -461,23 +461,23 @@ int cloth_collision_response_static(ClothModifierData *clmd, CollisionModifierDa
collpair = search->link;
// compute barycentric coordinates for both collision points
- cloth_compute_barycentric(collpair->pa,
+ collision_compute_barycentric(collpair->pa,
cloth1->verts[collpair->ap1].txold,
cloth1->verts[collpair->ap2].txold,
cloth1->verts[collpair->ap3].txold,
&w1, &w2, &w3);
// was: txold
- cloth_compute_barycentric(collpair->pb,
+ collision_compute_barycentric(collpair->pb,
collmd->current_x[collpair->bp1].co,
collmd->current_x[collpair->bp2].co,
collmd->current_x[collpair->bp3].co,
&u1, &u2, &u3);
// Calculate relative "velocity".
- interpolateOnTriangle(v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, cloth1->verts[collpair->ap3].tv, w1, w2, w3);
+ collision_interpolateOnTriangle(v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, cloth1->verts[collpair->ap3].tv, w1, w2, w3);
- interpolateOnTriangle(v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3);
+ collision_interpolateOnTriangle(v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3);
VECSUB(relativeVelocity, v2, v1);
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 96c3c33afb8..cd4c4ca1d5b 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -1669,6 +1669,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
VECCOPY(verts[i].v, id->V[i]);
}
}
+
return 1;
}