merged most of the changes from the branch into trunk, except for COLLADA, libxml and glut glitches.

Still need to verify to make sure no unwanted renaming is introduced.
This commit is contained in:
ejcoumans
2006-09-27 20:43:51 +00:00
parent d1e9a885f3
commit eb23bb5c0c
263 changed files with 7528 additions and 6714 deletions

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
#include "btBulletDynamicsCommon.h"
#include "LinearMath/GenIDebugDraw.h"
#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
#include "PHY_Pro.h"
#include "UserCollisionAlgorithm.h"
@@ -31,17 +31,17 @@ GLDebugDrawer debugDrawer;
static const int NUM_VERTICES = 5;
static const int NUM_TRIANGLES=4;
SimdVector3 gVertices[NUM_VERTICES];
btVector3 gVertices[NUM_VERTICES];
int gIndices[NUM_TRIANGLES*3];
const float TRIANGLE_SIZE=80.f;
///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= CollisionObject::customMaterialCallback;
inline SimdScalar calculateCombinedFriction(float friction0,float friction1)
///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= btCollisionObject::customMaterialCallback;
inline btScalar calculateCombinedFriction(float friction0,float friction1)
{
SimdScalar friction = friction0 * friction1;
btScalar friction = friction0 * friction1;
const SimdScalar MAX_FRICTION = 10.f;
const btScalar MAX_FRICTION = 10.f;
if (friction < -MAX_FRICTION)
friction = -MAX_FRICTION;
if (friction > MAX_FRICTION)
@@ -50,7 +50,7 @@ inline SimdScalar calculateCombinedFriction(float friction0,float friction1)
}
inline SimdScalar calculateCombinedRestitution(float restitution0,float restitution1)
inline btScalar calculateCombinedRestitution(float restitution0,float restitution1)
{
return restitution0 * restitution1;
}
@@ -74,7 +74,7 @@ void UserCollisionAlgorithm::initPhysics()
{
#define TRISIZE 10.f
int vertStride = sizeof(SimdVector3);
int vertStride = sizeof(btVector3);
int indexStride = 3*sizeof(int);
const int NUM_VERTS_X = 50;
@@ -83,7 +83,7 @@ void UserCollisionAlgorithm::initPhysics()
const int totalTriangles = 2*(NUM_VERTS_X-1)*(NUM_VERTS_Y-1);
SimdVector3* gVertices = new SimdVector3[totalVerts];
btVector3* gVertices = new btVector3[totalVerts];
int* gIndices = new int[totalTriangles*3];
int i;
@@ -111,41 +111,41 @@ void UserCollisionAlgorithm::initPhysics()
}
}
TriangleIndexVertexArray* indexVertexArrays = new TriangleIndexVertexArray(totalTriangles,
btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
gIndices,
indexStride,
totalVerts,(float*) &gVertices[0].x(),vertStride);
CollisionShape* trimeshShape = new BvhTriangleMeshShape(indexVertexArrays);
btCollisionShape* trimeshShape = new btBvhTriangleMeshShape(indexVertexArrays);
//ConstraintSolver* solver = new SequentialImpulseConstraintSolver;
//ConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
CollisionDispatcher* dispatcher = new CollisionDispatcher();
btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
SimdVector3 maxAabb(10000,10000,10000);
OverlappingPairCache* broadphase = new AxisSweep3(-maxAabb,maxAabb);//SimpleBroadphase();
dispatcher->RegisterCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new SphereSphereCollisionAlgorithm::CreateFunc);
btVector3 maxAabb(10000,10000,10000);
btOverlappingPairCache* broadphase = new btAxisSweep3(-maxAabb,maxAabb);//SimpleBroadphase();
dispatcher->RegisterCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new btSphereSphereCollisionAlgorithm::CreateFunc);
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
bool isDynamic = false;
float mass = 0.f;
SimdTransform startTransform;
btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin(SimdVector3(0,-2,0));
startTransform.setOrigin(btVector3(0,-2,0));
CcdPhysicsController* staticTrimesh = LocalCreatePhysicsObject(isDynamic, mass, startTransform,trimeshShape);
//enable custom material callback
staticTrimesh->GetRigidBody()->m_collisionFlags |= CollisionObject::customMaterialCallback;
staticTrimesh->GetRigidBody()->m_collisionFlags |= btCollisionObject::customMaterialCallback;
{
for (int i=0;i<10;i++)
{
CollisionShape* sphereShape = new SphereShape(1);
startTransform.setOrigin(SimdVector3(1,2*i,1));
btCollisionShape* sphereShape = new btSphereShape(1);
startTransform.setOrigin(btVector3(1,2*i,1));
LocalCreatePhysicsObject(true, 1, startTransform,sphereShape);
}
}