[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13944] trunk/blender/source/blender/ blenkernel: Cloth: Bugfix for IRIX compile (hopefully), bugfix for multiple springs (appeared on triangles), _test_ for inlining on msvc
Daniel Genrich
daniel.genrich at gmx.net
Sun Mar 2 23:01:46 CET 2008
Revision: 13944
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13944
Author: genscher
Date: 2008-03-02 23:01:43 +0100 (Sun, 02 Mar 2008)
Log Message:
-----------
Cloth: Bugfix for IRIX compile (hopefully), bugfix for multiple springs (appeared on triangles), _test_ for inlining on msvc
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_cloth.h
trunk/blender/source/blender/blenkernel/intern/cloth.c
Modified: trunk/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_cloth.h 2008-03-02 20:12:06 UTC (rev 13943)
+++ trunk/blender/source/blender/blenkernel/BKE_cloth.h 2008-03-02 22:01:43 UTC (rev 13944)
@@ -58,9 +58,11 @@
// this is needed for inlining behaviour
#ifndef _WIN32
#define LINUX
+#ifndef __sgi
#define DO_INLINE inline
+#endif
#else
-#define DO_INLINE
+#define DO_INLINE __inline
#endif
#define CLOTH_MAX_THREAD 2
Modified: trunk/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cloth.c 2008-03-02 20:12:06 UTC (rev 13943)
+++ trunk/blender/source/blender/blenkernel/intern/cloth.c 2008-03-02 22:01:43 UTC (rev 13944)
@@ -1330,6 +1330,10 @@
// 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 @@
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
More information about the Bf-blender-cvs
mailing list