[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12484] branches/cloth/blender/source/ blender/blenkernel: Fun commit: I put some 3-liner verlet integrator in, to activate it, set clmd->sim_parms. solver_type in cloth_init to 1 - bugs in there

Daniel Genrich daniel.genrich at gmx.net
Mon Nov 5 20:28:38 CET 2007


Revision: 12484
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12484
Author:   genscher
Date:     2007-11-05 20:28:38 +0100 (Mon, 05 Nov 2007)

Log Message:
-----------
Fun commit: I put some 3-liner verlet integrator in, to activate it, set clmd->sim_parms.solver_type in cloth_init to 1 -  bugs in there

Modified Paths:
--------------
    branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
    branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
    branches/cloth/blender/source/blender/blenkernel/intern/implicit.c

Modified: branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h	2007-11-05 18:44:42 UTC (rev 12483)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h	2007-11-05 19:28:38 UTC (rev 12484)
@@ -171,6 +171,11 @@
 int implicit_free ( ClothModifierData *clmd );
 int implicit_solver ( Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors );
 
+/* explicit verlet simulator */
+int verlet_init ( Object *ob, ClothModifierData *clmd );
+int verlet_free ( ClothModifierData *clmd );
+int verlet_solver ( Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors );
+
 /* used for caching in implicit.c */
 typedef struct Frame
 {
@@ -227,5 +232,8 @@
 }
 FaceCollPair;
 
+// function definitions from implicit.c
+DO_INLINE void mul_fvector_S(float to[3], float from[3], float scalar);
+
 #endif
 

Modified: branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/cloth.c	2007-11-05 18:44:42 UTC (rev 12483)
+++ branches/cloth/blender/source/blender/blenkernel/intern/cloth.c	2007-11-05 19:28:38 UTC (rev 12484)
@@ -114,7 +114,7 @@
 static CM_SOLVER_DEF solvers [] =
 {
 	{ "Implicit", CM_IMPLICIT, implicit_init, implicit_solver, implicit_free },
-	// { "Implicit", CM_VERLET, verlet_init, verlet_solver, verlet_free },
+	{ "Verlet", CM_VERLET, verlet_init, verlet_solver, verlet_free },
 };
 
 /* ********** cloth engine ******* */
@@ -504,7 +504,7 @@
 			// if(!cloth_cache_search_frame(clmd, framenr))
 			{
 				verts = cloth->verts;
-				
+				/*
 				// Force any pinned verts to their constrained location.
 				for ( i = 0; i < clmd->clothObject->numverts; i++, verts++ )
 				{
@@ -515,7 +515,7 @@
 					VECCOPY ( verts->xconst, mvert[i].co );
 					Mat4MulVecfl ( ob->obmat, verts->xconst );
 				}
-				
+				*/
 				tstart();
 				
 				/* Call the solver. */

Modified: branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-11-05 18:44:42 UTC (rev 12483)
+++ branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-11-05 19:28:38 UTC (rev 12484)
@@ -87,10 +87,6 @@
 }
 #else
 #include <sys/time.h>
-// intrinsics need better compile flag checking
-// #include <xmmintrin.h>
-// #include <pmmintrin.h>
-// #include <pthread.h>
 
 static struct timeval _itstart, _itend;
 static struct timezone itz;
@@ -110,14 +106,7 @@
 	return t2-t1;
 }
 #endif
-/*
-#define C99
-#ifdef C99
-#defineDO_INLINE inline 
-#else 
-#defineDO_INLINE static 
-#endif
-*/
+
 struct Cloth;
 
 //////////////////////////////////////////
@@ -1502,11 +1491,9 @@
 			// call collision function
 			result = cloth_bvh_objcollision(clmd, step + dt, step, dt);
 			
-			// copy corrected positions back to simulation			
+			// copy corrected positions back to simulation
 			if(result)
 			{
-				printf("result: %d\n", result);
-				
 				memcpy(cloth->current_xold, cloth->current_x, sizeof(lfVector) * numverts);
 				memcpy(id->Xnew, cloth->current_x, sizeof(lfVector) * numverts);
 				
@@ -2284,12 +2271,12 @@
 				{
 					float correction = mindistance - length;
 						
-					if(cloth->verts [i].goal >= SOFTGOALSNAP)
+					if((clmd->sim_parms.flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (cloth->verts [i].goal >= SOFTGOALSNAP))
 					{
 						VecMulf(temp, -correction);
 						VECADD(current_x[j], current_x[j], temp);
 					}
-					else if(cloth->verts [j].goal >= SOFTGOALSNAP)
+					else if((clmd->sim_parms.flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (cloth->verts [j].goal >= SOFTGOALSNAP))
 					{
 						VecMulf(temp, correction);
 						VECADD(current_x[i], current_x[i], temp);





More information about the Bf-blender-cvs mailing list