diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-02-05 17:11:48 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-02-05 17:11:48 +0300 |
commit | 7a70e5c0c0eacda814ffc32035a649a88b5326d0 (patch) | |
tree | a0de6960cc50e901299bb754c294433ca4f526ad /source/blender/blenkernel | |
parent | 790d4927bdbdacbdd89ffa28ebd99a8678dfac7e (diff) |
Cloth: 1. Fix for deflection being enabled thourgh softbody interface, 2. Fix for wrong calculated friction, 3. Fix for some header which was accitently blown up by my editor
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_cloth.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collision.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 430a8fd50a6..bf0ecd21397 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -35,10 +35,13 @@ #define BKE_CLOTH_H #include "float.h" +#include "BLI_editVert.h" #include "BLI_linklist.h" + #include "BKE_collision.h" #include "BKE_customdata.h" #include "BKE_DerivedMesh.h" + #include "DNA_cloth_types.h" #include "DNA_customdata_types.h" #include "DNA_meshdata_types.h" @@ -101,6 +104,7 @@ typedef struct ClothSpring float dfdv[3][3]; float f[3]; float stiffness; /* stiffness factor from the vertex groups */ + float editrestlen; } ClothSpring; @@ -165,6 +169,7 @@ typedef enum /* Bits to or into the ClothVertex.flags. */ #define CLOTH_VERT_FLAG_PINNED 1 #define CLOTH_VERT_FLAG_COLLISION 2 +#define CLOTH_VERT_FLAG_PINNED_EM 3 typedef void ( *CM_COLLISION_RESPONSE ) ( ClothModifierData *clmd, CollisionModifierData *collmd, CollisionTree *tree1, CollisionTree *tree2 ); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 7304ae09ef8..788f5adc922 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -496,24 +496,25 @@ int cloth_collision_response_static(ClothModifierData *clmd, CollisionModifierDa float vrel_t_pre[3]; float vrel_t[3], temp[3]; + // calculate tangential velocity VECCOPY(temp, collpair->normal); VecMulf(temp, magrelVel); VECSUB(vrel_t_pre, relativeVelocity, temp); VECCOPY(vrel_t, vrel_t_pre); - VecMulf(vrel_t, MAX2(1.0 - (clmd->coll_parms->friction * magrelVel / sqrt(INPR(vrel_t_pre,vrel_t_pre))), 0)); + VecMulf(vrel_t, MAX2(1.0 - (clmd->coll_parms->friction * magrelVel / sqrt(INPR(vrel_t_pre,vrel_t_pre))), 0.0)); VECSUB(tangential, vrel_t_pre, vrel_t); VecMulf(tangential, 0.5); - // i_tangential = tangential magtangent = INPR(tangential, tangential); // Apply friction impulse. if (magtangent > ALMOST_ZERO) { impulse = magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3); + magtangent = sqrt(magtangent); VECADDMUL(cloth1->verts[collpair->ap1].impulse, tangential, w1 * impulse/magtangent); VECADDMUL(cloth1->verts[collpair->ap2].impulse, tangential, w2 * impulse/magtangent); VECADDMUL(cloth1->verts[collpair->ap3].impulse, tangential, w3 * impulse/magtangent); |