[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12502] branches/cloth/blender/source: updated bullet to version 2.64 and hopefully didn' t break too much things in CcdPhysicsEnvironment.cpp, but it compiles and works for me

Daniel Genrich daniel.genrich at gmx.net
Tue Nov 6 15:27:07 CET 2007


Revision: 12502
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12502
Author:   genscher
Date:     2007-11-06 15:27:06 +0100 (Tue, 06 Nov 2007)

Log Message:
-----------
updated bullet to version 2.64 and hopefully didn't break too much things in CcdPhysicsEnvironment.cpp, but it compiles and works for me

Modified Paths:
--------------
    branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
    branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
    branches/cloth/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
    branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
    branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h

Modified: branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/cloth.c	2007-11-06 14:26:08 UTC (rev 12501)
+++ branches/cloth/blender/source/blender/blenkernel/intern/cloth.c	2007-11-06 14:27:06 UTC (rev 12502)
@@ -171,7 +171,7 @@
 	// also from softbodies
 	clmd->sim_parms.maxgoal = 1.0;
 	clmd->sim_parms.mingoal = 0.0;
-	clmd->sim_parms.defgoal = 0.7;
+	clmd->sim_parms.defgoal = 0.0;
 	clmd->sim_parms.goalspring = 100.0;
 	clmd->sim_parms.goalfrict = 0.0;
 

Modified: branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-11-06 14:26:08 UTC (rev 12501)
+++ branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-11-06 14:27:06 UTC (rev 12502)
@@ -2165,55 +2165,6 @@
 	*/
 }
 
-
-// move collision objects forward in time and update static bounding boxes
-void collisions_update_collision_objects(float step)
-{
-	Base *base=NULL;
-	ClothModifierData *coll_clmd=NULL;
-	Object *coll_ob=NULL;
-	unsigned int i=0;
-	/*
-	// search all objects for collision object
-	for (base = G.scene->base.first; base; base = base->next)
-	{
-
-		coll_ob = base->object;
-		coll_clmd = (ClothModifierData *) modifiers_findByType (coll_ob, eModifierType_Cloth);
-		if (!coll_clmd)
-			continue;
-
-		// if collision object go on
-		if (coll_clmd->sim_parms.flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ)
-		{
-			if (coll_clmd->clothObject && coll_clmd->clothObject->tree) 
-			{
-				Cloth *coll_cloth = coll_clmd->clothObject;
-				BVH *coll_bvh = coll_clmd->clothObject->tree;
-				unsigned int coll_numverts = coll_cloth->numverts;
-
-				// update position of collision object
-				for(i = 0; i < coll_numverts; i++)
-				{
-					VECCOPY(coll_cloth->verts[i].txold, coll_cloth->verts[i].tx);
-
-					VECADDS(coll_cloth->verts[i].tx, coll_cloth->verts[i].xold, coll_cloth->verts[i].v, step);
-					
-					// no dt here because of float rounding errors
-					VECSUB(coll_cloth->verts[i].tv, coll_cloth->verts[i].tx, coll_cloth->verts[i].txold);
-				}
-				
-				// update BVH of collision object
-				// bvh_update(coll_clmd, coll_bvh, 0); // 0 means STATIC, 1 means MOVING 
-			}
-			else
-				printf ("collisions_bvh_objcollision: found a collision object with clothObject or collData NULL.\n");
-		}
-	}
-	*/
-}
-
-
 void collisions_collision_moving(ClothModifierData *clmd, ClothModifierData *coll_clmd, CollisionTree *tree1, CollisionTree *tree2)
 {
 	/*
@@ -2251,7 +2202,7 @@
 	////////////////////////////////////////////////////////////
 	// static collisions
 	////////////////////////////////////////////////////////////
-	/*
+	
 	// update cloth bvh
 	bvh_update_from_float3(bvh1, cloth->current_xold, cloth->numverts, cloth->current_x, 0); // 0 means STATIC, 1 means MOVING (see later in this function)
 	
@@ -2276,6 +2227,8 @@
 			// fill collision list 
 			collisions += bvh_traverse(bvh1->root, bvh2->root, &collision_list);
 			
+			// call static collision response
+			
 			// free collision list
 			if(collision_list)
 			{
@@ -2303,7 +2256,7 @@
 		VECADD(cloth->current_x[i], cloth->current_xold[i], cloth->current_v[i]);
 	}
 	//////////////////////////////////////////////
-	*/
+	
 	// Test on *simple* selfcollisions
 	collisions = 1;
 	count = 0;

Modified: branches/cloth/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
===================================================================
--- branches/cloth/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp	2007-11-06 14:26:08 UTC (rev 12501)
+++ branches/cloth/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp	2007-11-06 14:27:06 UTC (rev 12502)
@@ -307,7 +307,7 @@
 		case UseBullet:
 			{
 				CcdPhysicsEnvironment* ccdPhysEnv = new CcdPhysicsEnvironment();
-				ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
+				// ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
 				ccdPhysEnv->setDeactivationLinearTreshold(0.8f); // default, can be overridden by Python
 				ccdPhysEnv->setDeactivationAngularTreshold(1.0f); // default, can be overridden by Python
 

Modified: branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp	2007-11-06 14:26:08 UTC (rev 12501)
+++ branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp	2007-11-06 14:27:06 UTC (rev 12502)
@@ -295,7 +295,7 @@
 
 
 
-CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher* dispatcher,btOverlappingPairCache* pairCache)
+CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher* dispatcher,btBroadphaseInterface* broadphase)
 :m_scalingPropagated(false),
 m_numIterations(10),
 m_numTimeSubSteps(1),
@@ -303,32 +303,31 @@
 m_solverType(-1),
 m_profileTimings(0),
 m_enableSatCollisionDetection(false)
-{
-
+{	
 	for (int i=0;i<PHY_NUM_RESPONSE;i++)
 	{
 		m_triggerCallbacks[i] = 0;
 	}
 	if (!dispatcher)
-		dispatcher = new btCollisionDispatcher();
+		dispatcher = new btCollisionDispatcher(new btDefaultCollisionConfiguration());
 
 
-	if(!pairCache)
+	if(!broadphase)
 	{
 
 		//todo: calculate/let user specify this world sizes
 		btVector3 worldMin(-10000,-10000,-10000);
 		btVector3 worldMax(10000,10000,10000);
-
-		pairCache = new btAxisSweep3(worldMin,worldMax);
-
+		
+		broadphase = new btAxisSweep3(worldMin,worldMax);
+		
 		//broadphase = new btSimpleBroadphase();
 	}
 
 
 	setSolverType(1);//issues with quickstep and memory allocations
 
-	m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,pairCache,new btSequentialImpulseConstraintSolver());
+	m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,new btSequentialImpulseConstraintSolver(),new btDefaultCollisionConfiguration());
 	m_debugDrawer = 0;
 	m_gravity = btVector3(0.f,-10.f,0.f);
 	m_dynamicsWorld->setGravity(m_gravity);
@@ -620,7 +619,7 @@
 
 		genericConstraint = new btGeneric6DofConstraint(
 			*rb0,*rb1,
-			frameInA,frameInB);
+			frameInA,frameInB, 1);
 		genericConstraint->setLinearLowerLimit(linearMinLimits);
 		genericConstraint->setLinearUpperLimit(linearMaxLimits);
 		genericConstraint->setAngularLowerLimit(angularMinLimits);
@@ -687,8 +686,8 @@
 		//ignore client...
 		if (curHit != m_ignoreClient)
 		{		
-			//if valid
-			return ClosestRayResultCallback::AddSingleResult(rayResult);
+			//if valid; also return normal in world space
+			return ClosestRayResultCallback::AddSingleResult(rayResult, 1);
 		}
 		return m_closestHitFraction;
 	}
@@ -805,7 +804,7 @@
 		{
 			//param = 1..12, min0,max0,min1,max1...min6,max6
 			btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint;
-			genCons->SetLimit(param,value0,value1);
+			genCons->setLimit(param,value0,value1);
 			break;
 		};
 	default:
@@ -1099,7 +1098,7 @@
 				
 				genericConstraint = new btGeneric6DofConstraint(
 					*rb0,*rb1,
-					frameInA,frameInB);
+					frameInA,frameInB, 1);
 
 
 			} else
@@ -1122,7 +1121,7 @@
 
 				genericConstraint = new btGeneric6DofConstraint(
 					*rb0,s_fixedObject2,
-					frameInA,frameInB);
+					frameInA,frameInB, 1);
 			}
 			
 			if (genericConstraint)

Modified: branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
===================================================================
--- branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h	2007-11-06 14:26:08 UTC (rev 12501)
+++ branches/cloth/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h	2007-11-06 14:27:06 UTC (rev 12502)
@@ -71,7 +71,7 @@
 	
 
 	public:
-		CcdPhysicsEnvironment(btDispatcher* dispatcher=0, btOverlappingPairCache* pairCache=0);
+		CcdPhysicsEnvironment(btDispatcher* dispatcher=0, btBroadphaseInterface* broadphase=0);
 
 		virtual		~CcdPhysicsEnvironment();
 





More information about the Bf-blender-cvs mailing list