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

@@ -18,7 +18,7 @@ subject to the following restrictions:
#include "DemoApplication.h"
///ContinuousConvexCollisionDemo shows the working of the continuous collision detection, including linear and angular motion
class ContinuousConvexCollisionDemo : public DemoApplication
class btContinuousConvexCollisionDemo : public DemoApplication
{
public:

View File

@@ -20,8 +20,8 @@
///This low level demo need internal access, and intentionally doesn't include the btBulletCollisionCommon.h headerfile
#include "LinearMath/SimdQuaternion.h"
#include "LinearMath/SimdTransform.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btTransform.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
@@ -31,7 +31,7 @@
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h"
#include "LinearMath/SimdTransformUtil.h"
#include "LinearMath/btTransformUtil.h"
#include "DebugCastResult.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
@@ -50,14 +50,14 @@ float yaw=0.f,pitch=0.f,roll=0.f;
const int maxNumObjects = 4;
const int numObjects = 2;
SimdVector3 angVels[numObjects];
SimdVector3 linVels[numObjects];
btVector3 angVels[numObjects];
btVector3 linVels[numObjects];
PolyhedralConvexShape* shapePtr[maxNumObjects];
btPolyhedralConvexShape* shapePtr[maxNumObjects];
SimdTransform fromTrans[maxNumObjects];
SimdTransform toTrans[maxNumObjects];
btTransform fromTrans[maxNumObjects];
btTransform toTrans[maxNumObjects];
int screenWidth = 640;
@@ -66,7 +66,7 @@ int screenHeight = 480;
int main(int argc,char** argv)
{
ContinuousConvexCollisionDemo* ccdDemo = new ContinuousConvexCollisionDemo();
btContinuousConvexCollisionDemo* ccdDemo = new btContinuousConvexCollisionDemo();
ccdDemo->setCameraDistance(40.f);
@@ -75,17 +75,17 @@ int main(int argc,char** argv)
return glutmain(argc, argv,screenWidth,screenHeight,"Continuous Convex Collision Demo",ccdDemo);
}
void ContinuousConvexCollisionDemo::initPhysics()
void btContinuousConvexCollisionDemo::initPhysics()
{
fromTrans[0].setOrigin(SimdVector3(0,10,20));
toTrans[0].setOrigin(SimdVector3(0,10,-20));
fromTrans[1].setOrigin(SimdVector3(-2,7,0));
toTrans[1].setOrigin(SimdVector3(-2,10,0));
fromTrans[0].setOrigin(btVector3(0,10,20));
toTrans[0].setOrigin(btVector3(0,10,-20));
fromTrans[1].setOrigin(btVector3(-2,7,0));
toTrans[1].setOrigin(btVector3(-2,10,0));
SimdMatrix3x3 identBasis;
btMatrix3x3 identBasis;
identBasis.setIdentity();
SimdMatrix3x3 basisA;
btMatrix3x3 basisA;
basisA.setIdentity();
basisA.setEulerZYX(0.f,-SIMD_HALF_PI,0.f);
@@ -96,15 +96,15 @@ void ContinuousConvexCollisionDemo::initPhysics()
toTrans[1].setBasis(identBasis);
toTrans[1].setBasis(identBasis);
SimdVector3 boxHalfExtentsA(10,1,1);
SimdVector3 boxHalfExtentsB(1.1f,1.1f,1.1f);
BoxShape* boxA = new BoxShape(boxHalfExtentsA);
// BU_Simplex1to4* boxA = new BU_Simplex1to4(SimdPoint3(-2,0,-2),SimdPoint3(2,0,-2),SimdPoint3(0,0,2),SimdPoint3(0,2,0));
// BU_Simplex1to4* boxA = new BU_Simplex1to4(SimdPoint3(-12,0,0),SimdPoint3(12,0,0));
btVector3 boxHalfExtentsA(10,1,1);
btVector3 boxHalfExtentsB(1.1f,1.1f,1.1f);
btBoxShape* boxA = new btBoxShape(boxHalfExtentsA);
// btBU_Simplex1to4* boxA = new btBU_Simplex1to4(btPoint3(-2,0,-2),btPoint3(2,0,-2),btPoint3(0,0,2),btPoint3(0,2,0));
// btBU_Simplex1to4* boxA = new btBU_Simplex1to4(btPoint3(-12,0,0),btPoint3(12,0,0));
BoxShape* boxB = new BoxShape(boxHalfExtentsB);
// BU_Simplex1to4 boxB(SimdPoint3(0,10,0),SimdPoint3(0,-10,0));
btBoxShape* boxB = new btBoxShape(boxHalfExtentsB);
// btBU_Simplex1to4 boxB(btPoint3(0,10,0),btPoint3(0,-10,0));
shapePtr[0] = boxA;
@@ -115,22 +115,22 @@ void ContinuousConvexCollisionDemo::initPhysics()
for (int i=0;i<numObjects;i++)
{
SimdTransformUtil::CalculateVelocity(fromTrans[i],toTrans[i],1.f,linVels[i],angVels[i]);
btTransformUtil::CalculateVelocity(fromTrans[i],toTrans[i],1.f,linVels[i],angVels[i]);
}
}
//to be implemented by the demo
void ContinuousConvexCollisionDemo::clientMoveAndDisplay()
void btContinuousConvexCollisionDemo::clientMoveAndDisplay()
{
displayCallback();
}
static VoronoiSimplexSolver sVoronoiSimplexSolver;
static btVoronoiSimplexSolver sVoronoiSimplexSolver;
SimplexSolverInterface& gGjkSimplexSolver = sVoronoiSimplexSolver;
btSimplexSolverInterface& gGjkSimplexSolver = sVoronoiSimplexSolver;
bool drawLine= false;
@@ -139,7 +139,7 @@ int minlines = 0;
int maxlines = 512;
void ContinuousConvexCollisionDemo::displayCallback(void) {
void btContinuousConvexCollisionDemo::displayCallback(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
@@ -156,7 +156,7 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
}
*/
if (getDebugMode()==IDebugDraw::DBG_DrawAabb)
if (getDebugMode()==btIDebugDraw::DBG_DrawAabb)
{
i=0;//for (i=1;i<numObjects;i++)
{
@@ -165,10 +165,10 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
int numSubSteps = 10;
for (int s=0;s<10;s++)
{
SimdScalar subStep = s * 1.f/(float)numSubSteps;
SimdTransform interpolatedTrans;
btScalar subStep = s * 1.f/(float)numSubSteps;
btTransform interpolatedTrans;
SimdTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],subStep,interpolatedTrans);
btTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],subStep,interpolatedTrans);
//fromTrans[i].getOpenGLMatrix(m);
//GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i]);
@@ -177,15 +177,15 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
//GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i]);
interpolatedTrans.getOpenGLMatrix( m );
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,0,1),getDebugMode());
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,0,1),getDebugMode());
}
}
}
SimdMatrix3x3 mat;
btMatrix3x3 mat;
mat.setEulerZYX(yaw,pitch,roll);
SimdQuaternion orn;
btQuaternion orn;
mat.getRotation(orn);
orn.setEuler(yaw,pitch,roll);
fromTrans[1].setRotation(orn);
@@ -198,17 +198,17 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
pitch += 0.005f;
// yaw += 0.01f;
}
// SimdVector3 fromA(-25,11,0);
// SimdVector3 toA(-15,11,0);
// btVector3 fromA(-25,11,0);
// btVector3 toA(-15,11,0);
// SimdQuaternion ornFromA(0.f,0.f,0.f,1.f);
// SimdQuaternion ornToA(0.f,0.f,0.f,1.f);
// btQuaternion ornFromA(0.f,0.f,0.f,1.f);
// btQuaternion ornToA(0.f,0.f,0.f,1.f);
// SimdTransform rayFromWorld(ornFromA,fromA);
// SimdTransform rayToWorld(ornToA,toA);
// btTransform rayFromWorld(ornFromA,fromA);
// btTransform rayToWorld(ornToA,toA);
SimdTransform rayFromWorld = fromTrans[0];
SimdTransform rayToWorld = toTrans[0];
btTransform rayFromWorld = fromTrans[0];
btTransform rayToWorld = toTrans[0];
if (drawLine)
@@ -229,17 +229,17 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
for (i=0;i<numObjects;i++)
{
fromTrans[i].getOpenGLMatrix(m);
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1),getDebugMode());
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1),getDebugMode());
}
DebugCastResult rayResult1(fromTrans[0],shapePtr[0],linVels[0],angVels[0]);
btDebugCastResult rayResult1(fromTrans[0],shapePtr[0],linVels[0],angVels[0]);
for (i=1;i<numObjects;i++)
{
ConvexCast::CastResult rayResult2;
ConvexCast::CastResult* rayResultPtr;
if (IDebugDraw::DBG_DrawAabb)
btConvexCast::CastResult rayResult2;
btConvexCast::CastResult* rayResultPtr;
if (btIDebugDraw::DBG_DrawAabb)
{
rayResultPtr = &rayResult1;
} else
@@ -251,8 +251,8 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
//SubsimplexConvexCast convexCaster(&gGjkSimplexSolver);
//optional
ConvexPenetrationDepthSolver* penetrationDepthSolver = 0;
ContinuousConvexCollision convexCaster(shapePtr[0],shapePtr[i],&gGjkSimplexSolver,penetrationDepthSolver );
btConvexPenetrationDepthSolver* penetrationDepthSolver = 0;
btContinuousConvexCollision convexCaster(shapePtr[0],shapePtr[i],&gGjkSimplexSolver,penetrationDepthSolver );
gGjkSimplexSolver.reset();
@@ -263,16 +263,16 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
glDisable(GL_DEPTH_TEST);
SimdTransform hitTrans;
SimdTransformUtil::IntegrateTransform(fromTrans[0],linVels[0],angVels[0],rayResultPtr->m_fraction,hitTrans);
btTransform hitTrans;
btTransformUtil::IntegrateTransform(fromTrans[0],linVels[0],angVels[0],rayResultPtr->m_fraction,hitTrans);
hitTrans.getOpenGLMatrix(m);
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[0],SimdVector3(0,1,0),getDebugMode());
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[0],btVector3(0,1,0),getDebugMode());
SimdTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],rayResultPtr->m_fraction,hitTrans);
btTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],rayResultPtr->m_fraction,hitTrans);
hitTrans.getOpenGLMatrix(m);
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(0,1,1),getDebugMode());
GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(0,1,1),getDebugMode());
}