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-03 01:01:43 +0300
committerDaniel Genrich <daniel.genrich@gmx.net>2008-03-03 01:01:43 +0300
commit373f142530e288610ace4cf650ad7abb316f5586 (patch)
treed39cd9c7e051246e119caa8ee7386c9acfc6d6fd /source/blender/blenkernel/intern/cloth.c
parentbc764858406f38ad0855ac50bff2715dc2c182ea (diff)
Cloth: Bugfix for IRIX compile (hopefully), bugfix for multiple springs (appeared on triangles), _test_ for inlining on msvc
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 63982e4162a..d933dffad17 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1330,6 +1330,10 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// shear springs
for ( i = 0; i < numfaces; i++ )
{
+ // triangle faces already have shear springs due to structural geometry
+ if ( mface[i].v4 )
+ continue;
+
spring = ( ClothSpring *) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
if(!spring)
@@ -1351,29 +1355,28 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
BLI_linklist_prepend ( &cloth->springs, spring );
- if ( mface[i].v4 )
+
+ // if ( mface[i].v4 ) --> Quad face
+ spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
+
+ if(!spring)
{
- spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
-
- if(!spring)
- {
- cloth_free_errorsprings(cloth, edgehash, edgelist);
- return 0;
- }
+ cloth_free_errorsprings(cloth, edgehash, edgelist);
+ return 0;
+ }
- spring->ij = MIN2(mface[i].v2, mface[i].v4);
- spring->kl = MAX2(mface[i].v4, mface[i].v2);
- VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
- spring->restlen = sqrt ( INPR ( temp, temp ) );
- spring->type = CLOTH_SPRING_TYPE_SHEAR;
- spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
+ spring->ij = MIN2(mface[i].v2, mface[i].v4);
+ spring->kl = MAX2(mface[i].v4, mface[i].v2);
+ VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
+ spring->restlen = sqrt ( INPR ( temp, temp ) );
+ spring->type = CLOTH_SPRING_TYPE_SHEAR;
+ spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
- BLI_linklist_append ( &edgelist[spring->ij], spring );
- BLI_linklist_append ( &edgelist[spring->kl], spring );
- shear_springs++;
+ BLI_linklist_append ( &edgelist[spring->ij], spring );
+ BLI_linklist_append ( &edgelist[spring->kl], spring );
+ shear_springs++;
- BLI_linklist_prepend ( &cloth->springs, spring );
- }
+ BLI_linklist_prepend ( &cloth->springs, spring );
}
// bending springs