[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12180] branches/cloth/blender: Bullet is back, but now generalized enough to allow own distance/ calculation.

Daniel Genrich daniel.genrich at gmx.net
Mon Oct 1 22:19:23 CEST 2007


Revision: 12180
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12180
Author:   genscher
Date:     2007-10-01 22:19:22 +0200 (Mon, 01 Oct 2007)

Log Message:
-----------
Bullet is back, but now generalized enough to allow own distance/calculation. Some bullet makefile-fix by 'gsr b3d'- please test it. Also fixed some crasher with cache. Also implemented moving-collisions enabled kdop (response missing in the moment)

Modified Paths:
--------------
    branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h
    branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp
    branches/cloth/blender/source/Makefile
    branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
    branches/cloth/blender/source/blender/blenkernel/intern/Makefile
    branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
    branches/cloth/blender/source/blender/blenkernel/intern/collision.c
    branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
    branches/cloth/blender/source/blender/blenkernel/intern/kdop.c
    branches/cloth/blender/source/blender/makesdna/DNA_cloth_types.h

Modified: branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h
===================================================================
--- branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h	2007-10-01 09:51:45 UTC (rev 12179)
+++ branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h	2007-10-01 20:19:22 UTC (rev 12180)
@@ -5,7 +5,7 @@
 extern "C"  {
 #endif // __cplusplus
 
-double plNearestPoints(float p[3][3], float q[3][3], float *pa, float *pb, float normal[3]);
+double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
 
 #ifdef __cplusplus
 }

Modified: branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp
===================================================================
--- branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp	2007-10-01 09:51:45 UTC (rev 12179)
+++ branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp	2007-10-01 20:19:22 UTC (rev 12180)
@@ -25,13 +25,13 @@
 
 
 extern "C"
-double plNearestPoints(float p[3][3], float q[3][3], float *pa, float *pb, float normal[3])
+double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3])
 {
-	btTriangleShape trishapeA(btVector3(p[0][0], p[0][1], p[0][2]), btVector3(p[1][0], p[1][1], p[1][2]), btVector3(p[2][0], p[2][1], p[2][2]));
-	trishapeA.setMargin(0.001f);
+	btTriangleShape trishapeA(btVector3(p1[0], p1[1], p1[2]), btVector3(p2[0], p2[1], p2[2]), btVector3(p3[0], p3[1], p3[2]));
+	trishapeA.setMargin(0.000001f);
 	
-	btTriangleShape trishapeB(btVector3(q[0][0], q[0][1], q[0][2]), btVector3(q[1][0], q[1][1], q[1][2]), btVector3(q[2][0], q[2][1], q[2][2]));
-	trishapeB.setMargin(0.001f);
+	btTriangleShape trishapeB(btVector3(q1[0], q1[1], q1[2]), btVector3(q2[0], q2[1], q2[2]), btVector3(q3[0], q3[1], q3[2]));
+	trishapeB.setMargin(0.000001f);
 	
 	// btVoronoiSimplexSolver sGjkSimplexSolver;
 	// btGjkEpaPenetrationDepthSolver penSolverPtr;	
@@ -44,7 +44,7 @@
 		
 	btConvexPenetrationDepthSolver* Solver = NULL;
 	
-	Solver = &Solver0;	
+	Solver = &Solver1;	
 		
 	btGjkPairDetector convexConvex(&trishapeA ,&trishapeB,&sGjkSimplexSolver,Solver);
 	

Modified: branches/cloth/blender/source/Makefile
===================================================================
--- branches/cloth/blender/source/Makefile	2007-10-01 09:51:45 UTC (rev 12179)
+++ branches/cloth/blender/source/Makefile	2007-10-01 20:19:22 UTC (rev 12180)
@@ -149,9 +149,11 @@
     COMLIB += $(OCGDIR)/gameengine/ketsji/KXNetwork/$(DEBUG_DIR)libKXNetwork.a
     COMLIB += $(OCGDIR)/gameengine/Network/$(DEBUG_DIR)libNetwork.a
     COMLIB += $(OCGDIR)/gameengine/Network/LoopBackNetwork/$(DEBUG_DIR)libLoopBackNetwork.a
-    COMLIB += $(NAN_BULLET2)/lib/libbullet2.a
 endif
 
+# Required by cloth, not gameengine only anymore
+COMLIB += $(NAN_BULLET2)/lib/$(DEBUG_DIR)libbullet2.a
+
 COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
 COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a
 COMLIB += $(NAN_BMFONT)/lib/$(DEBUG_DIR)libbmfont.a

Modified: branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h	2007-10-01 09:51:45 UTC (rev 12179)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h	2007-10-01 20:19:22 UTC (rev 12180)
@@ -1,36 +1,36 @@
 /**
-* BKE_cloth.h 
-*	
-* $Id: BKE_cloth.h,v 1.1 2007/08/01 02:07:27 daniel Exp $
-*
-* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version. The Blender
-* Foundation also sells licenses for use in proprietary software under
-* the Blender License.  See http://www.blender.org/BL/ for information
-* about this.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software Foundation,
-* Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-* The Original Code is Copyright (C) Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): none yet.
-*
-* ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
+ * BKE_cloth.h 
+ *	
+ * $Id: BKE_cloth.h,v 1.1 2007/08/01 02:07:27 daniel Exp $
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
 #ifndef BKE_CLOTH_H
 #define BKE_CLOTH_H
 
@@ -46,10 +46,10 @@
 
 // this is needed for inlining behaviour
 #ifndef _WIN32
-	#define LINUX 
-	#define DO_INLINE inline
+#define LINUX 
+#define DO_INLINE inline
 #else
-	#define DO_INLINE
+#define DO_INLINE
 #endif
 
 #define CLOTH_MAX_THREAD 2
@@ -86,27 +86,27 @@
 typedef enum 
 {
 	CSIMSETT_FLAG_RESET = (1 << 1),		// The CM object requires a reinitializaiton.
-	CSIMSETT_FLAG_COLLOBJ = (1 << 2), 	// object is only collision object, no cloth simulation is done
-	CSIMSETT_FLAG_GOAL = (1 << 3), 		// we have goals enabled
-	CSIMSETT_FLAG_CCACHE_FREE_ALL = (1 << 4),  // delete all from cache
-	CSIMSETT_FLAG_CCACHE_FREE_PART = (1 << 5), // delete some part of cache
-	CSIMSETT_FLAG_TEARING_ENABLED = (1 << 6), // true if tearing is enabled
-	CSIMSETT_FLAG_CCACHE_PROTECT = (1 << 7), // true if tearing is enabled
+			       CSIMSETT_FLAG_COLLOBJ = (1 << 2), 	// object is only collision object, no cloth simulation is done
+					       CSIMSETT_FLAG_GOAL = (1 << 3), 		// we have goals enabled
+							       CSIMSETT_FLAG_CCACHE_FREE_ALL = (1 << 4),  // delete all from cache
+									       CSIMSETT_FLAG_CCACHE_FREE_PART = (1 << 5), // delete some part of cache
+										CSIMSETT_FLAG_TEARING_ENABLED = (1 << 6), // true if tearing is enabled
+										CSIMSETT_FLAG_CCACHE_PROTECT = (1 << 7), // true if tearing is enabled
 } CSIMSETT_FLAGS;
 
 /* Spring types as defined in the paper.*/
 typedef enum 
 {
 	STRUCTURAL = 0,
-	SHEAR,
-	BENDING,
+ SHEAR,
+ BENDING,
 } springType;
 
 /* SPRING FLAGS */
 typedef enum 
 {
 	CSPRING_FLAG_DEACTIVATE = (1 << 1),
-	CSPRING_FLAG_NEEDED = (1 << 2), // springs has values to be applied
+				   CSPRING_FLAG_NEEDED = (1 << 2), // springs has values to be applied
 } CSPRINGS_FLAGS;
 
 // needed for buttons_object.c
@@ -156,7 +156,7 @@
 
 // needed for implicit.c
 void bvh_collision_response(ClothModifierData *clmd, ClothModifierData *coll_clmd, Tree * tree1, Tree * tree2);
-int cloth_bvh_objcollision(ClothModifierData * clmd, float step, CM_COLLISION_RESPONSE collision_response, float dt);
+int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float dt);
 
 ////////////////////////////////////////////////
 
@@ -165,16 +165,13 @@
 // kdop.c
 ////////////////////////////////////////////////
 
-// needed for implicit.c
-void bvh_update_static(ClothModifierData * clmd, BVH * bvh);
-void bvh_update_moving(ClothModifierData * clmd, BVH * bvh);
-
 // needed for cloth.c
 void bvh_free(BVH * bvh);
 BVH *bvh_build (ClothModifierData *clmd, float epsilon);
 
 // needed for collision.c
 int bvh_traverse(ClothModifierData * clmd, ClothModifierData * coll_clmd, Tree * tree1, Tree * tree2, float step, CM_COLLISION_RESPONSE collision_response);
+void bvh_update(ClothModifierData * clmd, BVH * bvh, int moving);
 
 ////////////////////////////////////////////////
 
@@ -209,8 +206,7 @@
 	char		*name;
 	CM_SOLVER_ID	id;
 	int		(*init) (Object *ob, ClothModifierData *clmd);
-	int		(*solver) (Object *ob, float framenr, ClothModifierData *clmd, ListBase *effectors,
-	CM_COLLISION_SELF self_collision, CM_COLLISION_OBJ obj_collision);
+	int		(*solver) (Object *ob, float framenr, ClothModifierData *clmd, ListBase *effectors);
 	int		(*free) (ClothModifierData *clmd);
 } CM_SOLVER_DEF;
 
@@ -218,8 +214,7 @@
 /* new C implicit simulator */
 int implicit_init (Object *ob, ClothModifierData *clmd);
 int implicit_free (ClothModifierData *clmd);
-int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors,
-						CM_COLLISION_SELF self_collision, CM_COLLISION_OBJ obj_collision);
+int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors);
 
 /* used for caching in implicit.c */
 typedef struct Frame
@@ -237,10 +232,10 @@
 	double distance; // magnitude of vector
 	float normal[3]; 
 	float vector[3]; // unnormalized collision vector: p2-p1
-	float p1[3], p2[3]; // collision point p1 on face1, p2 on face2
+	float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
 	int lastsign; // indicates if the distance sign has changed, unused itm
 	float time; // collision time, from 0 up to 1
-	unsigned int Aindex1, Aindex2, Aindex3, Aindex4, Bindex1, Bindex2, Bindex3, Bindex4;
+	unsigned int ap1, ap2, ap3, bp1, bp2, bp3;
 } CollPair;
 
 

Modified: branches/cloth/blender/source/blender/blenkernel/intern/Makefile
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list