Refactoring: another huge number of changes, renamed methods to start with lower-case.
This commit is contained in:
@@ -58,8 +58,8 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
btVector3 linvelA,angvelA;
|
||||
btVector3 linvelB,angvelB;
|
||||
|
||||
btTransformUtil::CalculateVelocity(fromA,toA,1.f,linvelA,angvelA);
|
||||
btTransformUtil::CalculateVelocity(fromB,toB,1.f,linvelB,angvelB);
|
||||
btTransformUtil::calculateVelocity(fromA,toA,1.f,linvelA,angvelA);
|
||||
btTransformUtil::calculateVelocity(fromB,toB,1.f,linvelB,angvelB);
|
||||
|
||||
|
||||
btVector3 linearMotionA = toA.getOrigin() - fromA.getOrigin();
|
||||
@@ -85,11 +85,11 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
|
||||
/* debugging code
|
||||
{
|
||||
const int numvertsB = m_convexB->GetNumVertices();
|
||||
const int numvertsB = m_convexB->getNumVertices();
|
||||
for (int v=0;v<numvertsB;v++)
|
||||
{
|
||||
btPoint3 pt;
|
||||
m_convexB->GetVertex(v,pt);
|
||||
m_convexB->getVertex(v,pt);
|
||||
pt = b2w * pt;
|
||||
char buf[1000];
|
||||
|
||||
@@ -182,11 +182,11 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
//toi = 0;
|
||||
/*
|
||||
{
|
||||
const int numvertsB = m_convexB->GetNumVertices();
|
||||
const int numvertsB = m_convexB->getNumVertices();
|
||||
for (int v=0;v<numvertsB;v++)
|
||||
{
|
||||
btPoint3 pt;
|
||||
m_convexB->GetVertex(v,pt);
|
||||
m_convexB->getVertex(v,pt);
|
||||
pt = impactTransB * pt;
|
||||
char buf[1000];
|
||||
|
||||
@@ -215,11 +215,11 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
BU_EdgeEdge edgeEdge;
|
||||
|
||||
//for all edged in A check agains all edges in B
|
||||
for (int ea = 0;ea < m_convexA->GetNumEdges();ea++)
|
||||
for (int ea = 0;ea < m_convexA->getNumEdges();ea++)
|
||||
{
|
||||
btPoint3 pA0,pA1;
|
||||
|
||||
m_convexA->GetEdge(ea,pA0,pA1);
|
||||
m_convexA->getEdge(ea,pA0,pA1);
|
||||
|
||||
pA0= a2w * pA0;//in world space
|
||||
pA0 = w2s * pA0;//in screwing space
|
||||
@@ -227,12 +227,12 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
pA1= a2w * pA1;//in world space
|
||||
pA1 = w2s * pA1;//in screwing space
|
||||
|
||||
int numedgesB = m_convexB->GetNumEdges();
|
||||
int numedgesB = m_convexB->getNumEdges();
|
||||
for (int eb = 0; eb < numedgesB;eb++)
|
||||
{
|
||||
{
|
||||
btPoint3 pB0,pB1;
|
||||
m_convexB->GetEdge(eb,pB0,pB1);
|
||||
m_convexB->getEdge(eb,pB0,pB1);
|
||||
|
||||
pB0= b2w * pB0;//in world space
|
||||
pB0 = w2s * pB0;//in screwing space
|
||||
@@ -307,18 +307,18 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
|
||||
// for all vertices in A, for each face in B,do vertex-face
|
||||
{
|
||||
const int numvertsA = m_convexA->GetNumVertices();
|
||||
const int numvertsA = m_convexA->getNumVertices();
|
||||
for (int v=0;v<numvertsA;v++)
|
||||
//int v=3;
|
||||
|
||||
{
|
||||
btPoint3 vtx;
|
||||
m_convexA->GetVertex(v,vtx);
|
||||
m_convexA->getVertex(v,vtx);
|
||||
|
||||
vtx = a2w * vtx;//in world space
|
||||
vtx = w2s * vtx;//in screwing space
|
||||
|
||||
const int numplanesB = m_convexB->GetNumPlanes();
|
||||
const int numplanesB = m_convexB->getNumPlanes();
|
||||
|
||||
for (int p = 0 ; p < numplanesB; p++)
|
||||
//int p=2;
|
||||
@@ -329,7 +329,7 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
btVector3 planeNorm;
|
||||
btPoint3 planeSupport;
|
||||
|
||||
m_convexB->GetPlane(planeNorm,planeSupport,p);
|
||||
m_convexB->getPlane(planeNorm,planeSupport,p);
|
||||
|
||||
|
||||
planeSupport = b2w * planeSupport;//transform to world space
|
||||
@@ -377,7 +377,7 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
|
||||
hitpt = b2winv * hitptWorld;
|
||||
//vertex has to be 'within' the facet's boundary
|
||||
if (m_convexB->IsInside(hitpt,m_tolerance))
|
||||
if (m_convexB->isInside(hitpt,m_tolerance))
|
||||
{
|
||||
// m_manifold.SetContactPoint(BUM_FeatureVertexFace, index,v,p,hitptWorld,hitNormalWorld);
|
||||
|
||||
@@ -403,13 +403,13 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
//todo: make this into one method with a kind of 'swapped' logic
|
||||
//
|
||||
{
|
||||
const int numvertsB = m_convexB->GetNumVertices();
|
||||
const int numvertsB = m_convexB->getNumVertices();
|
||||
for (int v=0;v<numvertsB;v++)
|
||||
//int v=0;
|
||||
|
||||
{
|
||||
btPoint3 vtx;
|
||||
m_convexB->GetVertex(v,vtx);
|
||||
m_convexB->getVertex(v,vtx);
|
||||
|
||||
vtx = b2w * vtx;//in world space
|
||||
/*
|
||||
@@ -429,7 +429,7 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
*/
|
||||
vtx = w2s * vtx;//in screwing space
|
||||
|
||||
const int numplanesA = m_convexA->GetNumPlanes();
|
||||
const int numplanesA = m_convexA->getNumPlanes();
|
||||
|
||||
for (int p = 0 ; p < numplanesA; p++)
|
||||
//int p=2;
|
||||
@@ -439,7 +439,7 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
btVector3 planeNorm;
|
||||
btPoint3 planeSupport;
|
||||
|
||||
m_convexA->GetPlane(planeNorm,planeSupport,p);
|
||||
m_convexA->getPlane(planeNorm,planeSupport,p);
|
||||
|
||||
|
||||
planeSupport = a2w * planeSupport;//transform to world space
|
||||
@@ -477,7 +477,7 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
|
||||
|
||||
//vertex has to be 'within' the facet's boundary
|
||||
if (m_convexA->IsInside(hitpt,m_tolerance))
|
||||
if (m_convexA->isInside(hitpt,m_tolerance))
|
||||
{
|
||||
|
||||
// m_manifold.SetContactPoint(BUM_FeatureFaceVertex,index,p,v,hitptWorld,hitNormalWorld);
|
||||
@@ -552,11 +552,11 @@ bool BU_CollisionPair::calcTimeOfImpact(
|
||||
|
||||
/*
|
||||
{
|
||||
const int numvertsB = m_convexB->GetNumVertices();
|
||||
const int numvertsB = m_convexB->getNumVertices();
|
||||
for (int v=0;v<numvertsB;v++)
|
||||
{
|
||||
btPoint3 pt;
|
||||
m_convexB->GetVertex(v,pt);
|
||||
m_convexB->getVertex(v,pt);
|
||||
pt = impactTransB * pt;
|
||||
char buf[1000];
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ btSphereSphereCollisionAlgorithm::btSphereSphereCollisionAlgorithm(btPersistentM
|
||||
m_ownManifold(false),
|
||||
m_manifoldPtr(mf)
|
||||
{
|
||||
if (!m_manifoldPtr && m_dispatcher->NeedsCollision(*proxy0,*proxy1))
|
||||
if (!m_manifoldPtr && m_dispatcher->needsCollision(*proxy0,*proxy1))
|
||||
{
|
||||
m_manifoldPtr = m_dispatcher->GetNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_manifoldPtr = m_dispatcher->getNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_ownManifold = true;
|
||||
}
|
||||
}
|
||||
@@ -35,11 +35,11 @@ btSphereSphereCollisionAlgorithm::~btSphereSphereCollisionAlgorithm()
|
||||
if (m_ownManifold)
|
||||
{
|
||||
if (m_manifoldPtr)
|
||||
m_dispatcher->ReleaseManifold(m_manifoldPtr);
|
||||
m_dispatcher->releaseManifold(m_manifoldPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void btSphereSphereCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
void btSphereSphereCollisionAlgorithm::processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
if (!m_manifoldPtr)
|
||||
return;
|
||||
@@ -51,8 +51,8 @@ void btSphereSphereCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* prox
|
||||
|
||||
btVector3 diff = col0->m_worldTransform.getOrigin()- col1->m_worldTransform.getOrigin();
|
||||
float len = diff.length();
|
||||
btScalar radius0 = sphere0->GetRadius();
|
||||
btScalar radius1 = sphere1->GetRadius();
|
||||
btScalar radius0 = sphere0->getRadius();
|
||||
btScalar radius1 = sphere1->getRadius();
|
||||
|
||||
///iff distance positive, don't generate a new contact
|
||||
if ( len > (radius0+radius1))
|
||||
@@ -68,13 +68,13 @@ void btSphereSphereCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* prox
|
||||
btVector3 pos1 = col1->m_worldTransform.getOrigin() + radius1* normalOnSurfaceB;
|
||||
|
||||
/// report a contact. internally this will be kept persistent, and contact reduction is done
|
||||
btManifoldResult* resultOut = m_dispatcher->GetNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
resultOut->AddContactPoint(normalOnSurfaceB,pos1,dist);
|
||||
m_dispatcher->ReleaseManifoldResult(resultOut);
|
||||
btManifoldResult* resultOut = m_dispatcher->getNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
resultOut->addContactPoint(normalOnSurfaceB,pos1,dist);
|
||||
m_dispatcher->releaseManifoldResult(resultOut);
|
||||
|
||||
}
|
||||
|
||||
float btSphereSphereCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
float btSphereSphereCollisionAlgorithm::calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
//not yet
|
||||
return 1.f;
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
btSphereSphereCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
|
||||
: btCollisionAlgorithm(ci) {}
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
virtual float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
btSphereSphereCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
|
||||
|
||||
@@ -2916,7 +2916,7 @@ HullError HullLibrary::ReleaseResult(HullResult &result) // release memory alloc
|
||||
}
|
||||
|
||||
|
||||
static void AddPoint(unsigned int &vcount,float *p,float x,float y,float z)
|
||||
static void addPoint(unsigned int &vcount,float *p,float x,float y,float z)
|
||||
{
|
||||
float *dest = &p[vcount*3];
|
||||
dest[0] = x;
|
||||
@@ -3022,14 +3022,14 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
|
||||
float z1 = center[2] - dz;
|
||||
float z2 = center[2] + dz;
|
||||
|
||||
AddPoint(vcount,vertices,x1,y1,z1);
|
||||
AddPoint(vcount,vertices,x2,y1,z1);
|
||||
AddPoint(vcount,vertices,x2,y2,z1);
|
||||
AddPoint(vcount,vertices,x1,y2,z1);
|
||||
AddPoint(vcount,vertices,x1,y1,z2);
|
||||
AddPoint(vcount,vertices,x2,y1,z2);
|
||||
AddPoint(vcount,vertices,x2,y2,z2);
|
||||
AddPoint(vcount,vertices,x1,y2,z2);
|
||||
addPoint(vcount,vertices,x1,y1,z1);
|
||||
addPoint(vcount,vertices,x2,y1,z1);
|
||||
addPoint(vcount,vertices,x2,y2,z1);
|
||||
addPoint(vcount,vertices,x1,y2,z1);
|
||||
addPoint(vcount,vertices,x1,y1,z2);
|
||||
addPoint(vcount,vertices,x2,y1,z2);
|
||||
addPoint(vcount,vertices,x2,y2,z2);
|
||||
addPoint(vcount,vertices,x1,y2,z2);
|
||||
|
||||
return true; // return cube
|
||||
|
||||
@@ -3177,14 +3177,14 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
|
||||
|
||||
vcount = 0; // add box
|
||||
|
||||
AddPoint(vcount,vertices,x1,y1,z1);
|
||||
AddPoint(vcount,vertices,x2,y1,z1);
|
||||
AddPoint(vcount,vertices,x2,y2,z1);
|
||||
AddPoint(vcount,vertices,x1,y2,z1);
|
||||
AddPoint(vcount,vertices,x1,y1,z2);
|
||||
AddPoint(vcount,vertices,x2,y1,z2);
|
||||
AddPoint(vcount,vertices,x2,y2,z2);
|
||||
AddPoint(vcount,vertices,x1,y2,z2);
|
||||
addPoint(vcount,vertices,x1,y1,z1);
|
||||
addPoint(vcount,vertices,x2,y1,z1);
|
||||
addPoint(vcount,vertices,x2,y2,z1);
|
||||
addPoint(vcount,vertices,x1,y2,z1);
|
||||
addPoint(vcount,vertices,x1,y1,z2);
|
||||
addPoint(vcount,vertices,x2,y1,z2);
|
||||
addPoint(vcount,vertices,x2,y2,z2);
|
||||
addPoint(vcount,vertices,x1,y2,z2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ public:
|
||||
int ParseLine(int lineno,int argc,const char **argv); // return TRUE to continue parsing, return FALSE to abort parsing process
|
||||
private:
|
||||
|
||||
void GetVertex(GeometryVertex &v,const char *face) const;
|
||||
void getVertex(GeometryVertex &v,const char *face) const;
|
||||
|
||||
FloatVector mVerts;
|
||||
FloatVector mTexels;
|
||||
@@ -609,7 +609,7 @@ static const char * GetArg(const char **argv,int i,int argc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void OBJ::GetVertex(GeometryVertex &v,const char *face) const
|
||||
void OBJ::getVertex(GeometryVertex &v,const char *face) const
|
||||
{
|
||||
v.mPos[0] = 0;
|
||||
v.mPos[1] = 0;
|
||||
@@ -717,7 +717,7 @@ int OBJ::ParseLine(int lineno,int argc,const char **argv) // return TRUE to con
|
||||
|
||||
for (int i=1; i<argc; i++)
|
||||
{
|
||||
GetVertex(v[i-1],argv[i] );
|
||||
getVertex(v[i-1],argv[i] );
|
||||
}
|
||||
|
||||
// need to generate a normal!
|
||||
@@ -765,7 +765,7 @@ class BuildMesh : public GeometryInterface
|
||||
{
|
||||
public:
|
||||
|
||||
int GetIndex(const float *p)
|
||||
int getIndex(const float *p)
|
||||
{
|
||||
|
||||
int vcount = mVertices.size()/3;
|
||||
@@ -791,9 +791,9 @@ public:
|
||||
|
||||
virtual void NodeTriangle(const GeometryVertex *v1,const GeometryVertex *v2,const GeometryVertex *v3)
|
||||
{
|
||||
mIndices.push_back( GetIndex(v1->mPos) );
|
||||
mIndices.push_back( GetIndex(v2->mPos) );
|
||||
mIndices.push_back( GetIndex(v3->mPos) );
|
||||
mIndices.push_back( getIndex(v1->mPos) );
|
||||
mIndices.push_back( getIndex(v2->mPos) );
|
||||
mIndices.push_back( getIndex(v3->mPos) );
|
||||
}
|
||||
|
||||
const FloatVector& GetVertices(void) const { return mVertices; };
|
||||
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
typedef std::set<int, VertexLess > VertexSet;
|
||||
typedef std::vector< Type > VertexVector;
|
||||
|
||||
int GetVertex(const Type& vtx)
|
||||
int getVertex(const Type& vtx)
|
||||
{
|
||||
VertexLess::SetSearch(vtx,&mVtxs);
|
||||
VertexSet::iterator found;
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
Type * GetBuffer(void)
|
||||
Type * getBuffer(void)
|
||||
{
|
||||
return &mVtxs[0];
|
||||
};
|
||||
@@ -289,7 +289,7 @@ unsigned int Vl_getIndex(VertexLookup vlook,const float *pos) // get index.
|
||||
{
|
||||
VertexPool< VertexPosition > *vp = (VertexPool< VertexPosition > *) vlook;
|
||||
VertexPosition p(pos);
|
||||
return vp->GetVertex(p);
|
||||
return vp->getVertex(p);
|
||||
}
|
||||
|
||||
const float * Vl_getVertices(VertexLookup vlook)
|
||||
|
||||
@@ -73,8 +73,8 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
btVector3 seperatingAxisInA = -v * m_transformA.getBasis();
|
||||
btVector3 seperatingAxisInB = v * m_transformB.getBasis();
|
||||
|
||||
btVector3 pInA = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 qInB = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
btVector3 pInA = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 qInB = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
btPoint3 pWorld = m_transformA( pInA );
|
||||
btPoint3 qWorld = m_transformB( qInB );
|
||||
@@ -189,8 +189,8 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
btVector3 seperatingAxisInA = v1 * m_transformA.getBasis();
|
||||
btVector3 seperatingAxisInB = -v1 * m_transformB.getBasis();
|
||||
|
||||
btVector3 p = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 q = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
btVector3 p = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 q = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
btPoint3 pWorld = m_transformA( p );
|
||||
btPoint3 qWorld = m_transformB( q );
|
||||
@@ -202,8 +202,8 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
seperatingAxisInA = v2 * m_transformA.getBasis();
|
||||
seperatingAxisInB = -v2 * m_transformB.getBasis();
|
||||
|
||||
p = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
q = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
p = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
q = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
pWorld = m_transformA( p );
|
||||
qWorld = m_transformB( q );
|
||||
@@ -215,8 +215,8 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
seperatingAxisInA = v3 * m_transformA.getBasis();
|
||||
seperatingAxisInB = -v3 * m_transformB.getBasis();
|
||||
|
||||
p = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
q = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
p = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
q = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
pWorld = m_transformA( p );
|
||||
qWorld = m_transformB( q );
|
||||
@@ -265,8 +265,8 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
btVector3 seperatingAxisInA = triangleNormal * m_transformA.getBasis();
|
||||
btVector3 seperatingAxisInB = -triangleNormal * m_transformB.getBasis();
|
||||
|
||||
btVector3 p = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 q = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
btVector3 p = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 q = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
btPoint3 pWorld = m_transformA( p );
|
||||
btPoint3 qWorld = m_transformB( q );
|
||||
@@ -284,8 +284,8 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
seperatingAxisInA = -triangleNormal * m_transformA.getBasis();
|
||||
seperatingAxisInB = triangleNormal * m_transformB.getBasis();
|
||||
|
||||
p = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
q = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
p = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
q = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
pWorld = m_transformA( p );
|
||||
qWorld = m_transformB( q );
|
||||
@@ -398,7 +398,7 @@ bool Epa::Initialize( btSimplexSolverInterface& simplexSolver )
|
||||
return true;
|
||||
}
|
||||
|
||||
btScalar Epa::CalcPenDepth( btPoint3& wWitnessOnA, btPoint3& wWitnessOnB )
|
||||
btScalar Epa::calcPenDepth( btPoint3& wWitnessOnA, btPoint3& wWitnessOnB )
|
||||
{
|
||||
btVector3 v;
|
||||
|
||||
@@ -448,8 +448,8 @@ btScalar Epa::CalcPenDepth( btPoint3& wWitnessOnA, btPoint3& wWitnessOnB )
|
||||
btVector3 seperatingAxisInA = v * m_transformA.getBasis();
|
||||
btVector3 seperatingAxisInB = -v * m_transformB.getBasis();
|
||||
|
||||
btVector3 p = m_pConvexShapeA->LocalGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 q = m_pConvexShapeB->LocalGetSupportingVertex( seperatingAxisInB );
|
||||
btVector3 p = m_pConvexShapeA->localGetSupportingVertex( seperatingAxisInA );
|
||||
btVector3 q = m_pConvexShapeB->localGetSupportingVertex( seperatingAxisInB );
|
||||
|
||||
btPoint3 pWorld = m_transformA( p );
|
||||
btPoint3 qWorld = m_transformB( q );
|
||||
|
||||
@@ -40,7 +40,7 @@ class Epa
|
||||
|
||||
bool Initialize( btSimplexSolverInterface& simplexSolver );
|
||||
|
||||
btScalar CalcPenDepth( btPoint3& wWitnessOnA, btPoint3& wWitnessOnB );
|
||||
btScalar calcPenDepth( btPoint3& wWitnessOnA, btPoint3& wWitnessOnB );
|
||||
|
||||
private :
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ subject to the following restrictions:
|
||||
btScalar g_GJKMaxRelError = 1e-3f;
|
||||
btScalar g_GJKMaxRelErrorSqrd = g_GJKMaxRelError * g_GJKMaxRelError;
|
||||
|
||||
bool EpaPenetrationDepthSolver::CalcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
bool EpaPenetrationDepthSolver::calcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* pConvexA, btConvexShape* pConvexB,
|
||||
const btTransform& transformA, const btTransform& transformB,
|
||||
btVector3& v, btPoint3& wWitnessOnA, btPoint3& wWitnessOnB,
|
||||
@@ -79,7 +79,7 @@ bool EpaPenetrationDepthSolver::HybridPenDepth( btSimplexSolverInterface& simple
|
||||
btScalar squaredDistance = SIMD_INFINITY;
|
||||
btScalar delta = 0.f;
|
||||
|
||||
const btScalar margin = pConvexA->GetMargin() + pConvexB->GetMargin();
|
||||
const btScalar margin = pConvexA->getMargin() + pConvexB->getMargin();
|
||||
const btScalar marginSqrd = margin * margin;
|
||||
|
||||
simplexSolver.reset();
|
||||
@@ -93,8 +93,8 @@ bool EpaPenetrationDepthSolver::HybridPenDepth( btSimplexSolverInterface& simple
|
||||
btVector3 seperatingAxisInA = -v * transformA.getBasis();
|
||||
btVector3 seperatingAxisInB = v * transformB.getBasis();
|
||||
|
||||
btVector3 pInA = pConvexA->LocalGetSupportingVertexWithoutMargin( seperatingAxisInA );
|
||||
btVector3 qInB = pConvexB->LocalGetSupportingVertexWithoutMargin( seperatingAxisInB );
|
||||
btVector3 pInA = pConvexA->localGetSupportingVertexWithoutMargin( seperatingAxisInA );
|
||||
btVector3 qInB = pConvexB->localGetSupportingVertexWithoutMargin( seperatingAxisInB );
|
||||
|
||||
btPoint3 pWorld = transformA( pInA );
|
||||
btPoint3 qWorld = transformB( qInB );
|
||||
@@ -119,10 +119,10 @@ bool EpaPenetrationDepthSolver::HybridPenDepth( btSimplexSolverInterface& simple
|
||||
assert( ( squaredDistance > 0 ) && "squaredDistance is zero!" );
|
||||
btScalar vLength = sqrt( squaredDistance );
|
||||
|
||||
wWitnessOnA -= v * ( pConvexA->GetMargin() / vLength );
|
||||
wWitnessOnB += v * ( pConvexB->GetMargin() / vLength );
|
||||
wWitnessOnA -= v * ( pConvexA->getMargin() / vLength );
|
||||
wWitnessOnB += v * ( pConvexB->getMargin() / vLength );
|
||||
|
||||
penDepth = pConvexA->GetMargin() + pConvexB->GetMargin() - vLength;
|
||||
penDepth = pConvexA->getMargin() + pConvexB->getMargin() - vLength;
|
||||
|
||||
// Returning true means that Hybrid's result is ok and there's no need to run EPA
|
||||
return true;
|
||||
@@ -139,10 +139,10 @@ bool EpaPenetrationDepthSolver::HybridPenDepth( btSimplexSolverInterface& simple
|
||||
assert( ( squaredDistance > 0 ) && "squaredDistance is zero!" );
|
||||
btScalar vLength = sqrt( squaredDistance );
|
||||
|
||||
wWitnessOnA -= v * ( pConvexA->GetMargin() / vLength );
|
||||
wWitnessOnB += v * ( pConvexB->GetMargin() / vLength );
|
||||
wWitnessOnA -= v * ( pConvexA->getMargin() / vLength );
|
||||
wWitnessOnB += v * ( pConvexB->getMargin() / vLength );
|
||||
|
||||
penDepth = pConvexA->GetMargin() + pConvexB->GetMargin() - vLength;
|
||||
penDepth = pConvexA->getMargin() + pConvexB->getMargin() - vLength;
|
||||
|
||||
// Returning true means that Hybrid's result is ok and there's no need to run EPA
|
||||
return true;
|
||||
@@ -162,10 +162,10 @@ bool EpaPenetrationDepthSolver::HybridPenDepth( btSimplexSolverInterface& simple
|
||||
assert( ( squaredDistance > 0 ) && "squaredDistance is zero!" );
|
||||
btScalar vLength = sqrt( squaredDistance );
|
||||
|
||||
wWitnessOnA -= v * ( pConvexA->GetMargin() / vLength );
|
||||
wWitnessOnB += v * ( pConvexB->GetMargin() / vLength );
|
||||
wWitnessOnA -= v * ( pConvexA->getMargin() / vLength );
|
||||
wWitnessOnB += v * ( pConvexB->getMargin() / vLength );
|
||||
|
||||
penDepth = pConvexA->GetMargin() + pConvexB->GetMargin() - vLength;
|
||||
penDepth = pConvexA->getMargin() + pConvexB->getMargin() - vLength;
|
||||
|
||||
// Returning true means that Hybrid's result is ok and there's no need to run EPA
|
||||
return true;
|
||||
@@ -197,6 +197,6 @@ btScalar EpaPenetrationDepthSolver::EpaPenDepth( btSimplexSolverInterface& simpl
|
||||
return 0;
|
||||
}
|
||||
|
||||
return epa.CalcPenDepth( wWitnessOnA, wWitnessOnB );
|
||||
return epa.calcPenDepth( wWitnessOnA, wWitnessOnB );
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class EpaPenetrationDepthSolver : public btConvexPenetrationDepthSolver
|
||||
{
|
||||
public :
|
||||
|
||||
bool CalcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
bool calcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* pConvexA, btConvexShape* pConvexB,
|
||||
const btTransform& transformA, const btTransform& transformB,
|
||||
btVector3& v, btPoint3& wWitnessOnA, btPoint3& wWitnessOnB,
|
||||
|
||||
@@ -317,7 +317,7 @@ inline bool originInTetrahedron(const btVector3& p1, const btVector3& p2,
|
||||
|
||||
|
||||
|
||||
bool Solid3EpaPenetrationDepth::CalcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
bool Solid3EpaPenetrationDepth::calcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* convexA,btConvexShape* convexB,
|
||||
const btTransform& transformA,const btTransform& transformB,
|
||||
btVector3& v, btPoint3& pa, btPoint3& pb)
|
||||
@@ -348,16 +348,16 @@ bool Solid3EpaPenetrationDepth::CalcPenDepth( btSimplexSolverInterface& simplexS
|
||||
btVector3 aux2 = rot_mat * aux1;
|
||||
btVector3 aux3 = rot_mat * aux2;
|
||||
|
||||
pBuf[2] = transformA(convexA->LocalGetSupportingVertex(aux1*transformA.getBasis()));
|
||||
qBuf[2] = transformB(convexB->LocalGetSupportingVertex((-aux1)*transformB.getBasis()));
|
||||
pBuf[2] = transformA(convexA->localGetSupportingVertex(aux1*transformA.getBasis()));
|
||||
qBuf[2] = transformB(convexB->localGetSupportingVertex((-aux1)*transformB.getBasis()));
|
||||
yBuf[2] = pBuf[2] - qBuf[2];
|
||||
|
||||
pBuf[3] = transformA(convexA->LocalGetSupportingVertex(aux2*transformA.getBasis()));
|
||||
qBuf[3] = transformB(convexB->LocalGetSupportingVertex((-aux2)*transformB.getBasis()));
|
||||
pBuf[3] = transformA(convexA->localGetSupportingVertex(aux2*transformA.getBasis()));
|
||||
qBuf[3] = transformB(convexB->localGetSupportingVertex((-aux2)*transformB.getBasis()));
|
||||
yBuf[3] = pBuf[3] - qBuf[3];
|
||||
|
||||
pBuf[4] = transformA(convexA->LocalGetSupportingVertex(aux3*transformA.getBasis()));
|
||||
qBuf[4] = transformB(convexB->LocalGetSupportingVertex((-aux3)*transformB.getBasis()));
|
||||
pBuf[4] = transformA(convexA->localGetSupportingVertex(aux3*transformA.getBasis()));
|
||||
qBuf[4] = transformB(convexB->localGetSupportingVertex((-aux3)*transformB.getBasis()));
|
||||
yBuf[4] = pBuf[4] - qBuf[4];
|
||||
|
||||
if (originInTetrahedron(yBuf[0], yBuf[2], yBuf[3], yBuf[4]))
|
||||
@@ -391,11 +391,11 @@ bool Solid3EpaPenetrationDepth::CalcPenDepth( btSimplexSolverInterface& simplexS
|
||||
btVector3 v2 = yBuf[2] - yBuf[0];
|
||||
btVector3 vv = v1.cross(v2);
|
||||
|
||||
pBuf[3] = transformA(convexA->LocalGetSupportingVertex(vv*transformA.getBasis()));
|
||||
qBuf[3] = transformB(convexB->LocalGetSupportingVertex((-vv)*transformB.getBasis()));
|
||||
pBuf[3] = transformA(convexA->localGetSupportingVertex(vv*transformA.getBasis()));
|
||||
qBuf[3] = transformB(convexB->localGetSupportingVertex((-vv)*transformB.getBasis()));
|
||||
yBuf[3] = pBuf[3] - qBuf[3];
|
||||
pBuf[4] = transformA(convexA->LocalGetSupportingVertex((-vv)*transformA.getBasis()));
|
||||
qBuf[4] = transformB(convexB->LocalGetSupportingVertex(vv*transformB.getBasis()));
|
||||
pBuf[4] = transformA(convexA->localGetSupportingVertex((-vv)*transformA.getBasis()));
|
||||
qBuf[4] = transformB(convexB->localGetSupportingVertex(vv*transformB.getBasis()));
|
||||
yBuf[4] = pBuf[4] - qBuf[4];
|
||||
|
||||
|
||||
@@ -481,8 +481,8 @@ bool Solid3EpaPenetrationDepth::CalcPenDepth( btSimplexSolverInterface& simplexS
|
||||
break;
|
||||
}
|
||||
|
||||
pBuf[num_verts] = transformA(convexA->LocalGetSupportingVertex((facet->getClosest())*transformA.getBasis()));
|
||||
qBuf[num_verts] = transformB(convexB->LocalGetSupportingVertex((-facet->getClosest())*transformB.getBasis()));
|
||||
pBuf[num_verts] = transformA(convexA->localGetSupportingVertex((facet->getClosest())*transformA.getBasis()));
|
||||
qBuf[num_verts] = transformB(convexB->localGetSupportingVertex((-facet->getClosest())*transformB.getBasis()));
|
||||
yBuf[num_verts] = pBuf[num_verts] - qBuf[num_verts];
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class Solid3EpaPenetrationDepth : public btConvexPenetrationDepthSolver
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool CalcPenDepth(btSimplexSolverInterface& simplexSolver,
|
||||
virtual bool calcPenDepth(btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* convexA,btConvexShape* convexB,
|
||||
const btTransform& transformA,const btTransform& transformB,
|
||||
btVector3& v, btPoint3& pa, btPoint3& pb);
|
||||
|
||||
@@ -122,7 +122,7 @@ void initGLcontext ( int argc, char **argv,
|
||||
glutInit ( &argc, argv ) ;
|
||||
glutInitDisplayMode ( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ) ;
|
||||
glutInitWindowSize ( win_width, win_height ) ;
|
||||
glutCreateWindow ( "Shader Math Demo" ) ;
|
||||
glutCreateWindow ( "Bullet GPU Physics Demo. http://bullet.sf.net" ) ;
|
||||
glutDisplayFunc ( display ) ;
|
||||
glutKeyboardFunc ( keybd ) ;
|
||||
glutReshapeFunc ( reshape ) ;
|
||||
@@ -703,7 +703,7 @@ void help ()
|
||||
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
bool disableVertexTextureSupport = false ;
|
||||
bool disableVertexTextureSupport = true ;
|
||||
debugOpt = DRAW_ALL ;
|
||||
|
||||
for ( int i = 1 ; i < argc ; i++ )
|
||||
|
||||
@@ -131,7 +131,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time)
|
||||
float scale[3];
|
||||
m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]);
|
||||
btVector3 scaling(scale[0],scale[1],scale[2]);
|
||||
GetCollisionShape()->setLocalScaling(scaling);
|
||||
getCollisionShape()->setLocalScaling(scaling);
|
||||
} else
|
||||
{
|
||||
btVector3 worldPos;
|
||||
@@ -150,7 +150,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time)
|
||||
float scale[3];
|
||||
m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]);
|
||||
btVector3 scaling(scale[0],scale[1],scale[2]);
|
||||
GetCollisionShape()->setLocalScaling(scaling);
|
||||
getCollisionShape()->setLocalScaling(scaling);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -312,10 +312,10 @@ void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ)
|
||||
{
|
||||
m_cci.m_scaling = btVector3(scaleX,scaleY,scaleZ);
|
||||
|
||||
if (m_body && m_body->GetCollisionShape())
|
||||
if (m_body && m_body->getCollisionShape())
|
||||
{
|
||||
m_body->GetCollisionShape()->setLocalScaling(m_cci.m_scaling);
|
||||
m_body->GetCollisionShape()->CalculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor);
|
||||
m_body->getCollisionShape()->setLocalScaling(m_cci.m_scaling);
|
||||
m_body->getCollisionShape()->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor);
|
||||
m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor);
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ PHY_IPhysicsController* CcdPhysicsController::GetReplica()
|
||||
btCcdConstructionInfo cinfo = m_cci;
|
||||
if (cinfo.m_collisionShape)
|
||||
{
|
||||
switch (cinfo.m_collisionShape->GetShapeType())
|
||||
switch (cinfo.m_collisionShape->getShapeType())
|
||||
{
|
||||
case SPHERE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ struct btCcdConstructionInfo
|
||||
|
||||
///CollisionFilterGroups provides some optional usage of basic collision filtering
|
||||
///this is done during broadphase, so very early in the pipeline
|
||||
///more advanced collision filtering should be done in btCollisionDispatcher::NeedsCollision
|
||||
///more advanced collision filtering should be done in btCollisionDispatcher::needsCollision
|
||||
enum CollisionFilterGroups
|
||||
{
|
||||
DefaultFilter = 1,
|
||||
@@ -87,7 +87,7 @@ struct btCcdConstructionInfo
|
||||
///optional use of collision group/mask:
|
||||
///only collision with object goups that match the collision mask.
|
||||
///this is very basic early out. advanced collision filtering should be
|
||||
///done in the btCollisionDispatcher::NeedsCollision and NeedsResponse
|
||||
///done in the btCollisionDispatcher::needsCollision and needsResponse
|
||||
///both values default to 1
|
||||
short int m_collisionFilterGroup;
|
||||
short int m_collisionFilterMask;
|
||||
@@ -127,10 +127,10 @@ class CcdPhysicsController : public PHY_IPhysicsController
|
||||
virtual ~CcdPhysicsController();
|
||||
|
||||
|
||||
btRigidBody* GetRigidBody() { return m_body;}
|
||||
btRigidBody* getRigidBody() { return m_body;}
|
||||
|
||||
btCollisionShape* GetCollisionShape() {
|
||||
return m_body->GetCollisionShape();
|
||||
btCollisionShape* getCollisionShape() {
|
||||
return m_body->getCollisionShape();
|
||||
}
|
||||
////////////////////////////////////
|
||||
// PHY_IPhysicsController interface
|
||||
@@ -198,8 +198,8 @@ class CcdPhysicsController : public PHY_IPhysicsController
|
||||
|
||||
|
||||
virtual void calcXform() {} ;
|
||||
virtual void SetMargin(float margin) {};
|
||||
virtual float GetMargin() const {return 0.f;};
|
||||
virtual void setMargin(float margin) {};
|
||||
virtual float getMargin() const {return 0.f;};
|
||||
|
||||
|
||||
bool wantsSleeping();
|
||||
@@ -208,7 +208,7 @@ class CcdPhysicsController : public PHY_IPhysicsController
|
||||
|
||||
static btTransform GetTransformFromMotionState(PHY_IMotionState* motionState);
|
||||
|
||||
void SetAabb(const btVector3& aabbMin,const btVector3& aabbMax);
|
||||
void setAabb(const btVector3& aabbMin,const btVector3& aabbMax);
|
||||
|
||||
|
||||
class PHY_IMotionState* GetMotionState()
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
return m_chassis;
|
||||
}
|
||||
|
||||
virtual void AddWheel(
|
||||
virtual void addWheel(
|
||||
PHY_IMotionState* motionState,
|
||||
PHY__Vector3 connectionPoint,
|
||||
PHY__Vector3 downDirection,
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
btVector3 wheelAxle(axleDirection[0],axleDirection[1],axleDirection[2]);
|
||||
|
||||
|
||||
btWheelInfo& info = m_vehicle->AddWheel(connectionPointCS0,wheelDirectionCS0,wheelAxle,
|
||||
btWheelInfo& info = m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,wheelAxle,
|
||||
suspensionRestLength,wheelRadius,gTuning,hasSteering);
|
||||
info.m_clientInfo = motionState;
|
||||
|
||||
@@ -140,14 +140,14 @@ public:
|
||||
|
||||
void SyncWheels()
|
||||
{
|
||||
int numWheels = GetNumWheels();
|
||||
int numWheels = getNumWheels();
|
||||
int i;
|
||||
for (i=0;i<numWheels;i++)
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(i);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(i);
|
||||
PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo ;
|
||||
m_vehicle->UpdateWheelTransform(i);
|
||||
btTransform trans = m_vehicle->GetWheelTransformWS(i);
|
||||
m_vehicle->updateWheelTransform(i);
|
||||
btTransform trans = m_vehicle->getWheelTransformWS(i);
|
||||
btQuaternion orn = trans.getRotation();
|
||||
const btVector3& pos = trans.getOrigin();
|
||||
motionState->setWorldOrientation(orn.x(),orn.y(),orn.z(),orn[3]);
|
||||
@@ -156,21 +156,21 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual int GetNumWheels() const
|
||||
virtual int getNumWheels() const
|
||||
{
|
||||
return m_vehicle->GetNumWheels();
|
||||
return m_vehicle->getNumWheels();
|
||||
}
|
||||
|
||||
virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const
|
||||
{
|
||||
btTransform trans = m_vehicle->GetWheelTransformWS(wheelIndex);
|
||||
btTransform trans = m_vehicle->getWheelTransformWS(wheelIndex);
|
||||
posX = trans.getOrigin().x();
|
||||
posY = trans.getOrigin().y();
|
||||
posZ = trans.getOrigin().z();
|
||||
}
|
||||
virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const
|
||||
{
|
||||
btTransform trans = m_vehicle->GetWheelTransformWS(wheelIndex);
|
||||
btTransform trans = m_vehicle->getWheelTransformWS(wheelIndex);
|
||||
btQuaternion quat = trans.getRotation();
|
||||
btMatrix3x3 orn2(quat);
|
||||
|
||||
@@ -189,9 +189,9 @@ public:
|
||||
{
|
||||
float rotation = 0.f;
|
||||
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
rotation = info.m_rotation;
|
||||
}
|
||||
return rotation;
|
||||
@@ -200,40 +200,40 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual int GetUserConstraintId() const
|
||||
virtual int getUserConstraintId() const
|
||||
{
|
||||
return m_vehicle->GetUserConstraintId();
|
||||
return m_vehicle->getUserConstraintId();
|
||||
}
|
||||
|
||||
virtual int GetUserConstraintType() const
|
||||
virtual int getUserConstraintType() const
|
||||
{
|
||||
return m_vehicle->GetUserConstraintType();
|
||||
return m_vehicle->getUserConstraintType();
|
||||
}
|
||||
|
||||
virtual void SetSteeringValue(float steering,int wheelIndex)
|
||||
virtual void setSteeringValue(float steering,int wheelIndex)
|
||||
{
|
||||
m_vehicle->SetSteeringValue(steering,wheelIndex);
|
||||
m_vehicle->setSteeringValue(steering,wheelIndex);
|
||||
}
|
||||
|
||||
virtual void ApplyEngineForce(float force,int wheelIndex)
|
||||
virtual void applyEngineForce(float force,int wheelIndex)
|
||||
{
|
||||
m_vehicle->ApplyEngineForce(force,wheelIndex);
|
||||
m_vehicle->applyEngineForce(force,wheelIndex);
|
||||
}
|
||||
|
||||
virtual void ApplyBraking(float braking,int wheelIndex)
|
||||
{
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
info.m_brake = braking;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetWheelFriction(float friction,int wheelIndex)
|
||||
{
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
info.m_frictionSlip = friction;
|
||||
}
|
||||
|
||||
@@ -241,9 +241,9 @@ public:
|
||||
|
||||
virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex)
|
||||
{
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
info.m_suspensionStiffness = suspensionStiffness;
|
||||
|
||||
}
|
||||
@@ -251,18 +251,18 @@ public:
|
||||
|
||||
virtual void SetSuspensionDamping(float suspensionDamping,int wheelIndex)
|
||||
{
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
info.m_wheelsDampingRelaxation = suspensionDamping;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetSuspensionCompression(float suspensionCompression,int wheelIndex)
|
||||
{
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
info.m_wheelsDampingCompression = suspensionCompression;
|
||||
}
|
||||
}
|
||||
@@ -271,16 +271,16 @@ public:
|
||||
|
||||
virtual void SetRollInfluence(float rollInfluence,int wheelIndex)
|
||||
{
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels()))
|
||||
if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels()))
|
||||
{
|
||||
btWheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex);
|
||||
btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
|
||||
info.m_rollInfluence = rollInfluence;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex)
|
||||
virtual void setCoordinateSystem(int rightIndex,int upIndex,int forwardIndex)
|
||||
{
|
||||
m_vehicle->SetCoordinateSystem(rightIndex,upIndex,forwardIndex);
|
||||
m_vehicle->setCoordinateSystem(rightIndex,upIndex,forwardIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVec
|
||||
edgecoord[2]*halfExtents[2]);
|
||||
pb+=center;
|
||||
|
||||
debugDrawer->DrawLine(pa,pb,color);
|
||||
debugDrawer->drawLine(pa,pb,color);
|
||||
}
|
||||
edgecoord = btVector3(-1.f,-1.f,-1.f);
|
||||
if (i<3)
|
||||
@@ -371,7 +371,7 @@ m_scalingPropagated(false)
|
||||
|
||||
void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl)
|
||||
{
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
//this m_userPointer is just used for triggers, see CallbackTriggers
|
||||
body->m_internalOwner = ctrl;
|
||||
@@ -379,21 +379,21 @@ void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl)
|
||||
body->setGravity( m_gravity );
|
||||
m_controllers.push_back(ctrl);
|
||||
|
||||
m_collisionWorld->AddCollisionObject(body,ctrl->GetCollisionFilterGroup(),ctrl->GetCollisionFilterMask());
|
||||
m_collisionWorld->addCollisionObject(body,ctrl->GetCollisionFilterGroup(),ctrl->GetCollisionFilterMask());
|
||||
|
||||
assert(body->m_broadphaseHandle);
|
||||
|
||||
btCollisionShape* shapeinterface = ctrl->GetCollisionShape();
|
||||
btCollisionShape* shapeinterface = ctrl->getCollisionShape();
|
||||
|
||||
assert(shapeinterface);
|
||||
|
||||
const btTransform& t = ctrl->GetRigidBody()->getCenterOfMassTransform();
|
||||
const btTransform& t = ctrl->getRigidBody()->getCenterOfMassTransform();
|
||||
|
||||
body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse();
|
||||
|
||||
btPoint3 minAabb,maxAabb;
|
||||
|
||||
shapeinterface->GetAabb(t,minAabb,maxAabb);
|
||||
shapeinterface->getAabb(t,minAabb,maxAabb);
|
||||
|
||||
float timeStep = 0.02f;
|
||||
|
||||
@@ -443,10 +443,10 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
|
||||
!(i==m_constraints.end()); i++)
|
||||
{
|
||||
btTypedConstraint* constraint = (*i);
|
||||
if ((&constraint->GetRigidBodyA() == ctrl->GetRigidBody() ||
|
||||
(&constraint->GetRigidBodyB() == ctrl->GetRigidBody())))
|
||||
if ((&constraint->getRigidBodyA() == ctrl->getRigidBody() ||
|
||||
(&constraint->getRigidBodyB() == ctrl->getRigidBody())))
|
||||
{
|
||||
removeConstraint(constraint->GetUserConstraintId());
|
||||
removeConstraint(constraint->getUserConstraintId());
|
||||
//only 1 constraint per constroller
|
||||
break;
|
||||
}
|
||||
@@ -460,10 +460,10 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
|
||||
!(i==m_constraints.end()); i++)
|
||||
{
|
||||
btTypedConstraint* constraint = (*i);
|
||||
if ((&constraint->GetRigidBodyA() == ctrl->GetRigidBody() ||
|
||||
(&constraint->GetRigidBodyB() == ctrl->GetRigidBody())))
|
||||
if ((&constraint->getRigidBodyA() == ctrl->getRigidBody() ||
|
||||
(&constraint->getRigidBodyB() == ctrl->getRigidBody())))
|
||||
{
|
||||
removeConstraint(constraint->GetUserConstraintId());
|
||||
removeConstraint(constraint->getUserConstraintId());
|
||||
//only 1 constraint per constroller
|
||||
break;
|
||||
}
|
||||
@@ -471,7 +471,7 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
|
||||
}
|
||||
|
||||
|
||||
m_collisionWorld->RemoveCollisionObject(ctrl->GetRigidBody());
|
||||
m_collisionWorld->removeCollisionObject(ctrl->getRigidBody());
|
||||
|
||||
|
||||
{
|
||||
@@ -516,7 +516,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
//toggle btProfiler
|
||||
if ( m_debugDrawer && m_debugDrawer->GetDebugMode() & btIDebugDraw::DBG_ProfileTimings)
|
||||
if ( m_debugDrawer && m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_ProfileTimings)
|
||||
{
|
||||
if (!m_profileTimings)
|
||||
{
|
||||
@@ -554,7 +554,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
|
||||
CcdPhysicsController* ctrl = *i;
|
||||
|
||||
btTransform predictedTrans;
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
if (body->GetActivationState() != ISLAND_SLEEPING)
|
||||
{
|
||||
|
||||
@@ -607,7 +607,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
|
||||
if (m_debugDrawer)
|
||||
{
|
||||
gDisableDeactivation = (m_debugDrawer->GetDebugMode() & btIDebugDraw::DBG_NoDeactivation);
|
||||
gDisableDeactivation = (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation);
|
||||
}
|
||||
|
||||
|
||||
@@ -640,7 +640,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
{
|
||||
CcdPhysicsController* ctrl = m_controllers[k];
|
||||
// btTransform predictedTrans;
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse();
|
||||
|
||||
@@ -661,7 +661,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
btProfiler::endBlock("predictIntegratedTransform");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
btOverlappingPairCache* scene = m_collisionWorld->GetPairCache();
|
||||
btOverlappingPairCache* scene = m_collisionWorld->getPairCache();
|
||||
|
||||
|
||||
//
|
||||
@@ -670,7 +670,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::beginBlock("DispatchAllCollisionPairs");
|
||||
btProfiler::beginBlock("dispatchAllCollisionPairs");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
|
||||
@@ -683,16 +683,16 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
dispatchInfo.m_enableSatConvex = m_enableSatCollisionDetection;
|
||||
dispatchInfo.m_debugDraw = this->m_debugDrawer;
|
||||
|
||||
scene->RefreshOverlappingPairs();
|
||||
scene->refreshOverlappingPairs();
|
||||
|
||||
GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(scene,dispatchInfo);
|
||||
getCollisionWorld()->getDispatcher()->dispatchAllCollisionPairs(scene,dispatchInfo);
|
||||
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::endBlock("DispatchAllCollisionPairs");
|
||||
btProfiler::endBlock("dispatchAllCollisionPairs");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
m_islandManager->UpdateActivationState(GetCollisionWorld(),GetCollisionWorld()->GetDispatcher());
|
||||
m_islandManager->updateActivationState(getCollisionWorld(),getCollisionWorld()->getDispatcher());
|
||||
|
||||
{
|
||||
int i;
|
||||
@@ -701,8 +701,8 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
{
|
||||
btTypedConstraint* constraint = m_constraints[i];
|
||||
|
||||
const btRigidBody* colObj0 = &constraint->GetRigidBodyA();
|
||||
const btRigidBody* colObj1 = &constraint->GetRigidBodyB();
|
||||
const btRigidBody* colObj0 = &constraint->getRigidBodyA();
|
||||
const btRigidBody* colObj1 = &constraint->getRigidBodyB();
|
||||
|
||||
if (((colObj0) && ((colObj0)->mergesSimulationIslands())) &&
|
||||
((colObj1) && ((colObj1)->mergesSimulationIslands())))
|
||||
@@ -710,19 +710,19 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
if (colObj0->IsActive() || colObj1->IsActive())
|
||||
{
|
||||
|
||||
m_islandManager->GetUnionFind().unite((colObj0)->m_islandTag1,
|
||||
m_islandManager->getUnionFind().unite((colObj0)->m_islandTag1,
|
||||
(colObj1)->m_islandTag1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_islandManager->StoreIslandActivationState(GetCollisionWorld());
|
||||
m_islandManager->storeIslandActivationState(getCollisionWorld());
|
||||
|
||||
|
||||
//contacts
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::beginBlock("SolveConstraint");
|
||||
btProfiler::beginBlock("solveConstraint");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
|
||||
@@ -743,8 +743,8 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
{
|
||||
btTypedConstraint* constraint = m_constraints[i];
|
||||
|
||||
constraint->BuildJacobian();
|
||||
constraint->SolveConstraint( timeStep );
|
||||
constraint->buildJacobian();
|
||||
constraint->solveConstraint( timeStep );
|
||||
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
}
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::endBlock("SolveConstraint");
|
||||
btProfiler::endBlock("solveConstraint");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
//solve the vehicles
|
||||
@@ -764,7 +764,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
{
|
||||
WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i];
|
||||
btRaycastVehicle* vehicle = wrapperVehicle->GetVehicle();
|
||||
vehicle->UpdateVehicle( timeStep);
|
||||
vehicle->updateVehicle( timeStep);
|
||||
}
|
||||
#endif //NEW_BULLET_VEHICLE_SUPPORT
|
||||
|
||||
@@ -789,7 +789,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
|
||||
virtual void ProcessIsland(btPersistentManifold** manifolds,int numManifolds)
|
||||
{
|
||||
m_solver->SolveGroup( manifolds, numManifolds,m_solverInfo,m_debugDrawer);
|
||||
m_solver->solveGroup( manifolds, numManifolds,m_solverInfo,m_debugDrawer);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -806,14 +806,14 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
m_debugDrawer);
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::beginBlock("BuildAndProcessIslands");
|
||||
btProfiler::beginBlock("buildAndProcessIslands");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
/// solve all the contact points and contact friction
|
||||
m_islandManager->BuildAndProcessIslands(GetCollisionWorld()->GetDispatcher(),m_collisionWorld->GetCollisionObjectArray(),&solverCallback);
|
||||
m_islandManager->buildAndProcessIslands(getCollisionWorld()->getDispatcher(),m_collisionWorld->getCollisionObjectArray(),&solverCallback);
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::endBlock("BuildAndProcessIslands");
|
||||
btProfiler::endBlock("buildAndProcessIslands");
|
||||
|
||||
btProfiler::beginBlock("CallbackTriggers");
|
||||
#endif //USE_QUICKPROF
|
||||
@@ -849,8 +849,8 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
dispatchInfo.m_stepCount = 0;
|
||||
dispatchInfo.m_dispatchFunc = btDispatcherInfo::DISPATCH_CONTINUOUS;
|
||||
|
||||
//pairCache->RefreshOverlappingPairs();//??
|
||||
GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(scene,dispatchInfo);
|
||||
//pairCache->refreshOverlappingPairs();//??
|
||||
getCollisionWorld()->getDispatcher()->dispatchAllCollisionPairs(scene,dispatchInfo);
|
||||
|
||||
toi = dispatchInfo.m_timeOfImpact;
|
||||
|
||||
@@ -873,7 +873,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
CcdPhysicsController* ctrl = *i;
|
||||
|
||||
btTransform predictedTrans;
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
if (body->IsActive())
|
||||
{
|
||||
@@ -910,7 +910,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
!(i==m_controllers.end()); i++)
|
||||
{
|
||||
CcdPhysicsController* ctrl = (*i);
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
ctrl->UpdateDeactivation(timeStep);
|
||||
|
||||
@@ -979,7 +979,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
void CcdPhysicsEnvironment::setDebugMode(int debugMode)
|
||||
{
|
||||
if (m_debugDrawer){
|
||||
m_debugDrawer->SetDebugMode(debugMode);
|
||||
m_debugDrawer->setDebugMode(debugMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ void CcdPhysicsEnvironment::setGravity(float x,float y,float z)
|
||||
{
|
||||
|
||||
CcdPhysicsController* ctrl = (*i);
|
||||
ctrl->GetRigidBody()->setGravity(m_gravity);
|
||||
ctrl->getRigidBody()->setGravity(m_gravity);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ public:
|
||||
btScalar m_distFraction;
|
||||
};
|
||||
*/
|
||||
virtual void* CastRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result)
|
||||
virtual void* castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result)
|
||||
{
|
||||
|
||||
|
||||
@@ -1156,7 +1156,7 @@ public:
|
||||
//some safety for 'explosion' due to sudden penetration of the full 'ray'
|
||||
/* if (result.m_distFraction<0.1)
|
||||
{
|
||||
printf("Vehicle Raycast: avoided instability due to penetration. Consider moving the connection points deeper inside vehicle chassis");
|
||||
printf("Vehicle rayCast: avoided instability due to penetration. Consider moving the connection points deeper inside vehicle chassis");
|
||||
result.m_distFraction = 1.f;
|
||||
hitObject = 0;
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ public:
|
||||
|
||||
/* if (result.m_distFraction>1.)
|
||||
{
|
||||
printf("Vehicle Raycast: avoided instability 1Consider moving the connection points deeper inside vehicle chassis");
|
||||
printf("Vehicle rayCast: avoided instability 1Consider moving the connection points deeper inside vehicle chassis");
|
||||
result.m_distFraction = 1.f;
|
||||
hitObject = 0;
|
||||
}
|
||||
@@ -1190,8 +1190,8 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
|
||||
CcdPhysicsController* c0 = (CcdPhysicsController*)ctrl0;
|
||||
CcdPhysicsController* c1 = (CcdPhysicsController*)ctrl1;
|
||||
|
||||
btRigidBody* rb0 = c0 ? c0->GetRigidBody() : 0;
|
||||
btRigidBody* rb1 = c1 ? c1->GetRigidBody() : 0;
|
||||
btRigidBody* rb0 = c0 ? c0->getRigidBody() : 0;
|
||||
btRigidBody* rb1 = c1 ? c1->getRigidBody() : 0;
|
||||
|
||||
ASSERT(rb0);
|
||||
|
||||
@@ -1222,10 +1222,10 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
|
||||
}
|
||||
|
||||
m_constraints.push_back(p2p);
|
||||
p2p->SetUserConstraintId(gConstraintUid++);
|
||||
p2p->SetUserConstraintType(type);
|
||||
p2p->setUserConstraintId(gConstraintUid++);
|
||||
p2p->setUserConstraintType(type);
|
||||
//64 bit systems can't cast pointer to int. could use size_t instead.
|
||||
return p2p->GetUserConstraintId();
|
||||
return p2p->getUserConstraintId();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1268,10 +1268,10 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
|
||||
|
||||
|
||||
m_constraints.push_back(genericConstraint);
|
||||
genericConstraint->SetUserConstraintId(gConstraintUid++);
|
||||
genericConstraint->SetUserConstraintType(type);
|
||||
genericConstraint->setUserConstraintId(gConstraintUid++);
|
||||
genericConstraint->setUserConstraintType(type);
|
||||
//64 bit systems can't cast pointer to int. could use size_t instead.
|
||||
return genericConstraint->GetUserConstraintId();
|
||||
return genericConstraint->getUserConstraintId();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1299,10 +1299,10 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
|
||||
hinge->setAngularOnly(angularOnly);
|
||||
|
||||
m_constraints.push_back(hinge);
|
||||
hinge->SetUserConstraintId(gConstraintUid++);
|
||||
hinge->SetUserConstraintType(type);
|
||||
hinge->setUserConstraintId(gConstraintUid++);
|
||||
hinge->setUserConstraintType(type);
|
||||
//64 bit systems can't cast pointer to int. could use size_t instead.
|
||||
return hinge->GetUserConstraintId();
|
||||
return hinge->getUserConstraintId();
|
||||
break;
|
||||
}
|
||||
#ifdef NEW_BULLET_VEHICLE_SUPPORT
|
||||
@@ -1315,9 +1315,9 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
|
||||
btRaycastVehicle* vehicle = new btRaycastVehicle(*tuning,chassis,raycaster);
|
||||
WrapperVehicle* wrapperVehicle = new WrapperVehicle(vehicle,ctrl0);
|
||||
m_wrapperVehicles.push_back(wrapperVehicle);
|
||||
vehicle->SetUserConstraintId(gConstraintUid++);
|
||||
vehicle->SetUserConstraintType(type);
|
||||
return vehicle->GetUserConstraintId();
|
||||
vehicle->setUserConstraintId(gConstraintUid++);
|
||||
vehicle->setUserConstraintType(type);
|
||||
return vehicle->getUserConstraintId();
|
||||
|
||||
break;
|
||||
};
|
||||
@@ -1356,8 +1356,8 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint(
|
||||
CcdPhysicsController* ctrl0 = (CcdPhysicsController*) ctrlRef;
|
||||
CcdPhysicsController* ctrl1 = (CcdPhysicsController*) ctrlOther;
|
||||
|
||||
btRigidBody* rb0 = ctrl0->GetRigidBody();
|
||||
btRigidBody* rb1 = ctrl1->GetRigidBody();
|
||||
btRigidBody* rb0 = ctrl0->getRigidBody();
|
||||
btRigidBody* rb1 = ctrl1->getRigidBody();
|
||||
|
||||
if (rb1)
|
||||
{
|
||||
@@ -1380,10 +1380,10 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint(
|
||||
if (genericConstraint)
|
||||
{
|
||||
m_constraints.push_back(genericConstraint);
|
||||
genericConstraint->SetUserConstraintId(gConstraintUid++);
|
||||
genericConstraint->SetUserConstraintType(PHY_GENERIC_6DOF_CONSTRAINT);
|
||||
genericConstraint->setUserConstraintId(gConstraintUid++);
|
||||
genericConstraint->setUserConstraintType(PHY_GENERIC_6DOF_CONSTRAINT);
|
||||
//64 bit systems can't cast pointer to int. could use size_t instead.
|
||||
return genericConstraint->GetUserConstraintId();
|
||||
return genericConstraint->getUserConstraintId();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1398,7 +1398,7 @@ void CcdPhysicsEnvironment::removeConstraint(int constraintId)
|
||||
!(i==m_constraints.end()); i++)
|
||||
{
|
||||
btTypedConstraint* constraint = (*i);
|
||||
if (constraint->GetUserConstraintId() == constraintId)
|
||||
if (constraint->getUserConstraintId() == constraintId)
|
||||
{
|
||||
std::swap(*i, m_constraints.back());
|
||||
m_constraints.pop_back();
|
||||
@@ -1454,7 +1454,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* i
|
||||
|
||||
PHY_IPhysicsController* nearestHit = 0;
|
||||
|
||||
m_collisionWorld->RayTest(rayFrom,rayTo,rayCallback);
|
||||
m_collisionWorld->rayTest(rayFrom,rayTo,rayCallback);
|
||||
if (rayCallback.HasHit())
|
||||
{
|
||||
nearestHit = static_cast<CcdPhysicsController*>(rayCallback.m_collisionObject->m_internalOwner);
|
||||
@@ -1487,9 +1487,9 @@ void CcdPhysicsEnvironment::getContactPoint(int i,float& hitX,float& hitY,float&
|
||||
|
||||
|
||||
|
||||
btBroadphaseInterface* CcdPhysicsEnvironment::GetBroadphase()
|
||||
btBroadphaseInterface* CcdPhysicsEnvironment::getBroadphase()
|
||||
{
|
||||
return m_collisionWorld->GetBroadphase();
|
||||
return m_collisionWorld->getBroadphase();
|
||||
}
|
||||
|
||||
|
||||
@@ -1537,7 +1537,7 @@ btTypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId)
|
||||
for (i=0;i<numConstraint;i++)
|
||||
{
|
||||
btTypedConstraint* constraint = m_constraints[i];
|
||||
if (constraint->GetUserConstraintId()==constraintId)
|
||||
if (constraint->getUserConstraintId()==constraintId)
|
||||
{
|
||||
return constraint;
|
||||
}
|
||||
@@ -1621,28 +1621,28 @@ void CcdPhysicsEnvironment::requestCollisionCallback(PHY_IPhysicsController* ctr
|
||||
|
||||
void CcdPhysicsEnvironment::CallbackTriggers()
|
||||
{
|
||||
if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->GetDebugMode() & btIDebugDraw::DBG_DrawContactPoints)))
|
||||
if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)))
|
||||
{
|
||||
//walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback
|
||||
int numManifolds = m_collisionWorld->GetDispatcher()->GetNumManifolds();
|
||||
int numManifolds = m_collisionWorld->getDispatcher()->getNumManifolds();
|
||||
for (int i=0;i<numManifolds;i++)
|
||||
{
|
||||
btPersistentManifold* manifold = m_collisionWorld->GetDispatcher()->GetManifoldByIndexInternal(i);
|
||||
int numContacts = manifold->GetNumContacts();
|
||||
btPersistentManifold* manifold = m_collisionWorld->getDispatcher()->getManifoldByIndexInternal(i);
|
||||
int numContacts = manifold->getNumContacts();
|
||||
if (numContacts)
|
||||
{
|
||||
if (m_debugDrawer && (m_debugDrawer->GetDebugMode() & btIDebugDraw::DBG_DrawContactPoints))
|
||||
if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))
|
||||
{
|
||||
for (int j=0;j<numContacts;j++)
|
||||
{
|
||||
btVector3 color(1,0,0);
|
||||
const btManifoldPoint& cp = manifold->GetContactPoint(j);
|
||||
const btManifoldPoint& cp = manifold->getContactPoint(j);
|
||||
if (m_debugDrawer)
|
||||
m_debugDrawer->DrawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.GetDistance(),cp.GetLifeTime(),color);
|
||||
m_debugDrawer->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color);
|
||||
}
|
||||
}
|
||||
btRigidBody* obj0 = static_cast<btRigidBody* >(manifold->GetBody0());
|
||||
btRigidBody* obj1 = static_cast<btRigidBody* >(manifold->GetBody1());
|
||||
btRigidBody* obj0 = static_cast<btRigidBody* >(manifold->getBody0());
|
||||
btRigidBody* obj1 = static_cast<btRigidBody* >(manifold->getBody1());
|
||||
|
||||
//m_internalOwner is set in 'addPhysicsController'
|
||||
CcdPhysicsController* ctrl0 = static_cast<CcdPhysicsController*>(obj0->m_internalOwner);
|
||||
@@ -1686,7 +1686,7 @@ PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId)
|
||||
for (i=0;i<numVehicles;i++)
|
||||
{
|
||||
WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i];
|
||||
if (wrapperVehicle->GetVehicle()->GetUserConstraintId() == constraintId)
|
||||
if (wrapperVehicle->GetVehicle()->getUserConstraintId() == constraintId)
|
||||
return wrapperVehicle;
|
||||
}
|
||||
|
||||
@@ -1703,7 +1703,7 @@ int numController = 0;
|
||||
void CcdPhysicsEnvironment::UpdateAabbs(float timeStep)
|
||||
{
|
||||
std::vector<CcdPhysicsController*>::iterator i;
|
||||
btBroadphaseInterface* scene = GetBroadphase();
|
||||
btBroadphaseInterface* scene = getBroadphase();
|
||||
|
||||
numController = m_controllers.size();
|
||||
currentController = 0;
|
||||
@@ -1716,15 +1716,15 @@ void CcdPhysicsEnvironment::UpdateAabbs(float timeStep)
|
||||
{
|
||||
currentController++;
|
||||
CcdPhysicsController* ctrl = (*i);
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
|
||||
btPoint3 minAabb,maxAabb;
|
||||
btCollisionShape* shapeinterface = ctrl->GetCollisionShape();
|
||||
btCollisionShape* shapeinterface = ctrl->getCollisionShape();
|
||||
|
||||
|
||||
|
||||
shapeinterface->CalculateTemporalAabb(body->getCenterOfMassTransform(),
|
||||
shapeinterface->calculateTemporalAabb(body->getCenterOfMassTransform(),
|
||||
body->getLinearVelocity(),
|
||||
//body->getAngularVelocity(),
|
||||
btVector3(0.f,0.f,0.f),//no angular effect for now //body->getAngularVelocity(),
|
||||
@@ -1767,7 +1767,7 @@ void CcdPhysicsEnvironment::UpdateAabbs(float timeStep)
|
||||
|
||||
};
|
||||
|
||||
if (m_debugDrawer->GetDebugMode() & btIDebugDraw::DBG_DrawAabb)
|
||||
if (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawAabb)
|
||||
{
|
||||
DrawAabb(m_debugDrawer,minAabb,maxAabb,color);
|
||||
}
|
||||
@@ -1776,7 +1776,7 @@ void CcdPhysicsEnvironment::UpdateAabbs(float timeStep)
|
||||
|
||||
if ( (maxAabb-minAabb).length2() < 1e12f)
|
||||
{
|
||||
scene->SetAabb(bp,minAabb,maxAabb);
|
||||
scene->setAabb(bp,minAabb,maxAabb);
|
||||
} else
|
||||
{
|
||||
//something went wrong, investigate
|
||||
@@ -1844,9 +1844,9 @@ float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid)
|
||||
!(i==m_constraints.end()); i++)
|
||||
{
|
||||
btTypedConstraint* constraint = (*i);
|
||||
if (constraint->GetUserConstraintId() == constraintid)
|
||||
if (constraint->getUserConstraintId() == constraintid)
|
||||
{
|
||||
return constraint->GetAppliedImpulse();
|
||||
return constraint->getAppliedImpulse();
|
||||
}
|
||||
}
|
||||
return 0.f;
|
||||
|
||||
@@ -183,7 +183,7 @@ protected:
|
||||
|
||||
void removeCcdPhysicsController(CcdPhysicsController* ctrl);
|
||||
|
||||
btBroadphaseInterface* GetBroadphase();
|
||||
btBroadphaseInterface* getBroadphase();
|
||||
|
||||
|
||||
|
||||
@@ -207,29 +207,29 @@ protected:
|
||||
|
||||
|
||||
|
||||
const btPersistentManifold* GetManifold(int index) const;
|
||||
const btPersistentManifold* getManifold(int index) const;
|
||||
|
||||
std::vector<btTypedConstraint*> m_constraints;
|
||||
|
||||
void SyncMotionStates(float timeStep);
|
||||
|
||||
|
||||
class btCollisionWorld* GetCollisionWorld()
|
||||
class btCollisionWorld* getCollisionWorld()
|
||||
{
|
||||
return m_collisionWorld;
|
||||
}
|
||||
|
||||
const class btCollisionWorld* GetCollisionWorld() const
|
||||
const class btCollisionWorld* getCollisionWorld() const
|
||||
{
|
||||
return m_collisionWorld;
|
||||
}
|
||||
|
||||
btSimulationIslandManager* GetSimulationIslandManager()
|
||||
btSimulationIslandManager* getSimulationIslandManager()
|
||||
{
|
||||
return m_islandManager;
|
||||
}
|
||||
|
||||
const btSimulationIslandManager* GetSimulationIslandManager() const
|
||||
const btSimulationIslandManager* getSimulationIslandManager() const
|
||||
{
|
||||
return m_islandManager;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ ParallelIslandDispatcher::ParallelIslandDispatcher ():
|
||||
|
||||
};
|
||||
|
||||
btPersistentManifold* ParallelIslandDispatcher::GetNewManifold(void* b0,void* b1)
|
||||
btPersistentManifold* ParallelIslandDispatcher::getNewManifold(void* b0,void* b1)
|
||||
{
|
||||
gNumManifold2++;
|
||||
|
||||
@@ -67,20 +67,20 @@ btPersistentManifold* ParallelIslandDispatcher::GetNewManifold(void* b0,void* b1
|
||||
return manifold;
|
||||
}
|
||||
|
||||
void ParallelIslandDispatcher::ClearManifold(btPersistentManifold* manifold)
|
||||
void ParallelIslandDispatcher::clearManifold(btPersistentManifold* manifold)
|
||||
{
|
||||
manifold->ClearManifold();
|
||||
manifold->clearManifold();
|
||||
}
|
||||
|
||||
|
||||
void ParallelIslandDispatcher::ReleaseManifold(btPersistentManifold* manifold)
|
||||
void ParallelIslandDispatcher::releaseManifold(btPersistentManifold* manifold)
|
||||
{
|
||||
|
||||
gNumManifold2--;
|
||||
|
||||
//printf("ReleaseManifold: gNumManifold2 %d\n",gNumManifold2);
|
||||
//printf("releaseManifold: gNumManifold2 %d\n",gNumManifold2);
|
||||
|
||||
ClearManifold(manifold);
|
||||
clearManifold(manifold);
|
||||
|
||||
std::vector<btPersistentManifold*>::iterator i =
|
||||
std::find(m_manifoldsPtr.begin(), m_manifoldsPtr.end(), manifold);
|
||||
@@ -99,7 +99,7 @@ void ParallelIslandDispatcher::ReleaseManifold(btPersistentManifold* manifold)
|
||||
//
|
||||
// todo: this is random access, it can be walked 'cache friendly'!
|
||||
//
|
||||
void ParallelIslandDispatcher::BuildAndProcessIslands(btCollisionObjectArray& collisionObjects, IslandCallback* callback)
|
||||
void ParallelIslandDispatcher::buildAndProcessIslands(btCollisionObjectArray& collisionObjects, IslandCallback* callback)
|
||||
{
|
||||
int numBodies = collisionObjects.size();
|
||||
|
||||
@@ -130,20 +130,20 @@ void ParallelIslandDispatcher::BuildAndProcessIslands(btCollisionObjectArray& co
|
||||
}
|
||||
|
||||
|
||||
for (i=0;i<GetNumManifolds();i++)
|
||||
for (i=0;i<getNumManifolds();i++)
|
||||
{
|
||||
btPersistentManifold* manifold = this->GetManifoldByIndexInternal(i);
|
||||
btPersistentManifold* manifold = this->getManifoldByIndexInternal(i);
|
||||
|
||||
//filtering for response
|
||||
|
||||
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->GetBody0());
|
||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->GetBody1());
|
||||
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->getBody0());
|
||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
|
||||
{
|
||||
if (((colObj0) && (colObj0)->m_islandTag1 == (islandId)) ||
|
||||
((colObj1) && (colObj1)->m_islandTag1 == (islandId)))
|
||||
{
|
||||
|
||||
if (NeedsResponse(*colObj0,*colObj1))
|
||||
if (needsResponse(*colObj0,*colObj1))
|
||||
islandmanifold.push_back(manifold);
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void ParallelIslandDispatcher::BuildAndProcessIslands(btCollisionObjectArray& co
|
||||
|
||||
|
||||
|
||||
btCollisionAlgorithm* ParallelIslandDispatcher::InternalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
btCollisionAlgorithm* ParallelIslandDispatcher::internalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
m_count++;
|
||||
btCollisionObject* body0 = (btCollisionObject*)proxy0.m_clientObject;
|
||||
@@ -198,27 +198,27 @@ btCollisionAlgorithm* ParallelIslandDispatcher::InternalFindAlgorithm(btBroadpha
|
||||
btCollisionAlgorithmConstructionInfo ci;
|
||||
ci.m_dispatcher = this;
|
||||
|
||||
if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConvex() )
|
||||
if (body0->m_collisionShape->isConvex() && body1->m_collisionShape->isConvex() )
|
||||
{
|
||||
return new btConvexConvexAlgorithm(0,ci,&proxy0,&proxy1);
|
||||
}
|
||||
|
||||
if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConcave())
|
||||
if (body0->m_collisionShape->isConvex() && body1->m_collisionShape->isConcave())
|
||||
{
|
||||
return new btConvexConcaveCollisionAlgorithm(ci,&proxy0,&proxy1);
|
||||
}
|
||||
|
||||
if (body1->m_collisionShape->IsConvex() && body0->m_collisionShape->IsConcave())
|
||||
if (body1->m_collisionShape->isConvex() && body0->m_collisionShape->isConcave())
|
||||
{
|
||||
return new btConvexConcaveCollisionAlgorithm(ci,&proxy1,&proxy0);
|
||||
}
|
||||
|
||||
if (body0->m_collisionShape->IsCompound())
|
||||
if (body0->m_collisionShape->isCompound())
|
||||
{
|
||||
return new btCompoundCollisionAlgorithm(ci,&proxy0,&proxy1);
|
||||
} else
|
||||
{
|
||||
if (body1->m_collisionShape->IsCompound())
|
||||
if (body1->m_collisionShape->isCompound())
|
||||
{
|
||||
return new btCompoundCollisionAlgorithm(ci,&proxy1,&proxy0);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ btCollisionAlgorithm* ParallelIslandDispatcher::InternalFindAlgorithm(btBroadpha
|
||||
|
||||
}
|
||||
|
||||
bool ParallelIslandDispatcher::NeedsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)
|
||||
bool ParallelIslandDispatcher::needsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)
|
||||
{
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ bool ParallelIslandDispatcher::NeedsResponse(const btCollisionObject& colObj0,c
|
||||
return hasResponse;
|
||||
}
|
||||
|
||||
bool ParallelIslandDispatcher::NeedsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
bool ParallelIslandDispatcher::needsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
|
||||
btCollisionObject* body0 = (btCollisionObject*)proxy0.m_clientObject;
|
||||
@@ -266,7 +266,7 @@ bool ParallelIslandDispatcher::NeedsCollision(btBroadphaseProxy& proxy0,btBroadp
|
||||
}
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
btManifoldResult* ParallelIslandDispatcher::GetNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold)
|
||||
btManifoldResult* ParallelIslandDispatcher::getNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold)
|
||||
{
|
||||
|
||||
|
||||
@@ -276,13 +276,13 @@ btManifoldResult* ParallelIslandDispatcher::GetNewManifoldResult(btCollisionObje
|
||||
}
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
void ParallelIslandDispatcher::ReleaseManifoldResult(btManifoldResult*)
|
||||
void ParallelIslandDispatcher::releaseManifoldResult(btManifoldResult*)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ParallelIslandDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)
|
||||
void ParallelIslandDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
//m_blockedForChanges = true;
|
||||
|
||||
@@ -291,7 +291,7 @@ void ParallelIslandDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache*
|
||||
assert(0);
|
||||
|
||||
/*
|
||||
int dispatcherId = GetUniqueId();
|
||||
int dispatcherId = getUniqueId();
|
||||
int i;
|
||||
for (i=0;i<numPairs;i++)
|
||||
{
|
||||
@@ -303,7 +303,7 @@ void ParallelIslandDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache*
|
||||
//dispatcher will keep algorithms persistent in the collision pair
|
||||
if (!pair.m_algorithms[dispatcherId])
|
||||
{
|
||||
pair.m_algorithms[dispatcherId] = FindAlgorithm(
|
||||
pair.m_algorithms[dispatcherId] = findAlgorithm(
|
||||
*pair.m_pProxy0,
|
||||
*pair.m_pProxy1);
|
||||
}
|
||||
@@ -312,10 +312,10 @@ void ParallelIslandDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache*
|
||||
{
|
||||
if (dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE)
|
||||
{
|
||||
pair.m_algorithms[dispatcherId]->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
pair.m_algorithms[dispatcherId]->processCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
} else
|
||||
{
|
||||
float toi = pair.m_algorithms[dispatcherId]->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
float toi = pair.m_algorithms[dispatcherId]->calculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
if (dispatchInfo.m_timeOfImpact > toi)
|
||||
dispatchInfo.m_timeOfImpact = toi;
|
||||
|
||||
@@ -324,7 +324,7 @@ void ParallelIslandDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache*
|
||||
} else
|
||||
{
|
||||
//non-persistent algorithm dispatcher
|
||||
btCollisionAlgorithm* algo = FindAlgorithm(
|
||||
btCollisionAlgorithm* algo = findAlgorithm(
|
||||
*pair.m_pProxy0,
|
||||
*pair.m_pProxy1);
|
||||
|
||||
@@ -332,10 +332,10 @@ void ParallelIslandDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache*
|
||||
{
|
||||
if (dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE)
|
||||
{
|
||||
algo->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
algo->processCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
} else
|
||||
{
|
||||
float toi = algo->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
float toi = algo->calculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo);
|
||||
if (dispatchInfo.m_timeOfImpact > toi)
|
||||
dispatchInfo.m_timeOfImpact = toi;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class ParallelIslandDispatcher : public btDispatcher
|
||||
|
||||
public:
|
||||
|
||||
btUnionFind& GetUnionFind() { return m_unionFind;}
|
||||
btUnionFind& getUnionFind() { return m_unionFind;}
|
||||
|
||||
struct IslandCallback
|
||||
{
|
||||
@@ -60,65 +60,65 @@ public:
|
||||
};
|
||||
|
||||
|
||||
int GetNumManifolds() const
|
||||
int getNumManifolds() const
|
||||
{
|
||||
return m_manifoldsPtr.size();
|
||||
}
|
||||
|
||||
btPersistentManifold* GetManifoldByIndexInternal(int index)
|
||||
btPersistentManifold* getManifoldByIndexInternal(int index)
|
||||
{
|
||||
return m_manifoldsPtr[index];
|
||||
}
|
||||
|
||||
const btPersistentManifold* GetManifoldByIndexInternal(int index) const
|
||||
const btPersistentManifold* getManifoldByIndexInternal(int index) const
|
||||
{
|
||||
return m_manifoldsPtr[index];
|
||||
}
|
||||
|
||||
void InitUnionFind(int n)
|
||||
void initUnionFind(int n)
|
||||
{
|
||||
if (m_useIslands)
|
||||
m_unionFind.reset(n);
|
||||
}
|
||||
|
||||
void FindUnions();
|
||||
void findUnions();
|
||||
|
||||
int m_count;
|
||||
|
||||
ParallelIslandDispatcher ();
|
||||
virtual ~ParallelIslandDispatcher() {};
|
||||
|
||||
virtual btPersistentManifold* GetNewManifold(void* b0,void* b1);
|
||||
virtual btPersistentManifold* getNewManifold(void* b0,void* b1);
|
||||
|
||||
virtual void ReleaseManifold(btPersistentManifold* manifold);
|
||||
virtual void releaseManifold(btPersistentManifold* manifold);
|
||||
|
||||
|
||||
virtual void BuildAndProcessIslands(btCollisionObjectArray& collisionObjects, IslandCallback* callback);
|
||||
virtual void buildAndProcessIslands(btCollisionObjectArray& collisionObjects, IslandCallback* callback);
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
virtual btManifoldResult* GetNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold);
|
||||
virtual btManifoldResult* getNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold);
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
virtual void ReleaseManifoldResult(btManifoldResult*);
|
||||
virtual void releaseManifoldResult(btManifoldResult*);
|
||||
|
||||
virtual void ClearManifold(btPersistentManifold* manifold);
|
||||
virtual void clearManifold(btPersistentManifold* manifold);
|
||||
|
||||
|
||||
btCollisionAlgorithm* FindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
btCollisionAlgorithm* findAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
btCollisionAlgorithm* algo = InternalFindAlgorithm(proxy0,proxy1);
|
||||
btCollisionAlgorithm* algo = internalFindAlgorithm(proxy0,proxy1);
|
||||
return algo;
|
||||
}
|
||||
|
||||
btCollisionAlgorithm* InternalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
btCollisionAlgorithm* internalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
|
||||
virtual bool NeedsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
virtual bool needsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
|
||||
virtual bool NeedsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1);
|
||||
virtual bool needsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1);
|
||||
|
||||
virtual int GetUniqueId() { return RIGIDBODY_DISPATCHER;}
|
||||
virtual int getUniqueId() { return RIGIDBODY_DISPATCHER;}
|
||||
|
||||
virtual void DispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo);
|
||||
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ ParallelPhysicsEnvironment::~ParallelPhysicsEnvironment()
|
||||
bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
{
|
||||
// Make sure the broadphase / overlapping AABB paircache is up-to-date
|
||||
btOverlappingPairCache* scene = m_collisionWorld->GetPairCache();
|
||||
scene->RefreshOverlappingPairs();
|
||||
btOverlappingPairCache* scene = m_collisionWorld->getPairCache();
|
||||
scene->refreshOverlappingPairs();
|
||||
|
||||
// Find the connected sets that can be simulated in parallel
|
||||
// Using union find
|
||||
@@ -51,7 +51,7 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
btProfiler::beginBlock("IslandUnionFind");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
GetSimulationIslandManager()->UpdateActivationState(GetCollisionWorld(),GetCollisionWorld()->GetDispatcher());
|
||||
getSimulationIslandManager()->updateActivationState(getCollisionWorld(),getCollisionWorld()->getDispatcher());
|
||||
|
||||
{
|
||||
int i;
|
||||
@@ -60,8 +60,8 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
{
|
||||
btTypedConstraint* constraint = m_constraints[i];
|
||||
|
||||
const btRigidBody* colObj0 = &constraint->GetRigidBodyA();
|
||||
const btRigidBody* colObj1 = &constraint->GetRigidBodyB();
|
||||
const btRigidBody* colObj0 = &constraint->getRigidBodyA();
|
||||
const btRigidBody* colObj1 = &constraint->getRigidBodyB();
|
||||
|
||||
if (((colObj0) && ((colObj0)->mergesSimulationIslands())) &&
|
||||
((colObj1) && ((colObj1)->mergesSimulationIslands())))
|
||||
@@ -69,7 +69,7 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
if (colObj0->IsActive() || colObj1->IsActive())
|
||||
{
|
||||
|
||||
GetSimulationIslandManager()->GetUnionFind().unite((colObj0)->m_islandTag1,
|
||||
getSimulationIslandManager()->getUnionFind().unite((colObj0)->m_islandTag1,
|
||||
(colObj1)->m_islandTag1);
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
}
|
||||
|
||||
//Store the island id in each body
|
||||
GetSimulationIslandManager()->StoreIslandActivationState(GetCollisionWorld());
|
||||
getSimulationIslandManager()->storeIslandActivationState(getCollisionWorld());
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::endBlock("IslandUnionFind");
|
||||
@@ -98,14 +98,14 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
for (k=0;k<GetNumControllers();k++)
|
||||
{
|
||||
CcdPhysicsController* ctrl = m_controllers[k];
|
||||
int tag = ctrl->GetRigidBody()->m_islandTag1;
|
||||
int tag = ctrl->getRigidBody()->m_islandTag1;
|
||||
if (tag>=0)
|
||||
{
|
||||
simulationIslands[tag].m_controllers.push_back(ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
btDispatcher* dispatcher = GetCollisionWorld()->GetDispatcher();
|
||||
btDispatcher* dispatcher = getCollisionWorld()->getDispatcher();
|
||||
|
||||
|
||||
//this is a brute force approach, will rethink later about more subtle ways
|
||||
@@ -137,32 +137,32 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
for (unsigned int ui=0;ui<m_constraints.size();ui++)
|
||||
{
|
||||
btTypedConstraint& constraint = *m_constraints[ui];
|
||||
if (constraint.GetRigidBodyA().m_islandTag1 > constraint.GetRigidBodyB().m_islandTag1)
|
||||
if (constraint.getRigidBodyA().m_islandTag1 > constraint.getRigidBodyB().m_islandTag1)
|
||||
{
|
||||
simulationIslands[constraint.GetRigidBodyA().m_islandTag1].m_constraintIndices.push_back(ui);
|
||||
simulationIslands[constraint.getRigidBodyA().m_islandTag1].m_constraintIndices.push_back(ui);
|
||||
} else
|
||||
{
|
||||
simulationIslands[constraint.GetRigidBodyB().m_islandTag1].m_constraintIndices.push_back(ui);
|
||||
simulationIslands[constraint.getRigidBodyB().m_islandTag1].m_constraintIndices.push_back(ui);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//add all overlapping pairs for each island
|
||||
|
||||
for (i=0;i<dispatcher->GetNumManifolds();i++)
|
||||
for (i=0;i<dispatcher->getNumManifolds();i++)
|
||||
{
|
||||
btPersistentManifold* manifold = dispatcher->GetManifoldByIndexInternal(i);
|
||||
btPersistentManifold* manifold = dispatcher->getManifoldByIndexInternal(i);
|
||||
|
||||
//filtering for response
|
||||
|
||||
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->GetBody0());
|
||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->GetBody1());
|
||||
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->getBody0());
|
||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
|
||||
{
|
||||
int islandTag = colObj0->m_islandTag1;
|
||||
if (colObj1->m_islandTag1 > islandTag)
|
||||
islandTag = colObj1->m_islandTag1;
|
||||
|
||||
if (dispatcher->NeedsResponse(*colObj0,*colObj1))
|
||||
if (dispatcher->needsResponse(*colObj0,*colObj1))
|
||||
simulationIslands[islandTag].m_manifolds.push_back(manifold);
|
||||
|
||||
}
|
||||
@@ -191,7 +191,7 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
||||
if (simulationIslands[k].m_controllers.size())
|
||||
{
|
||||
assert(0);//seems to be wrong, passing ALL overlapping pairs
|
||||
simulationIslands[k].Simulate(m_debugDrawer,m_numIterations, constraintBase ,&scene->GetOverlappingPair(0),dispatcher,GetBroadphase(),m_solver,timeStep);
|
||||
simulationIslands[k].Simulate(m_debugDrawer,m_numIterations, constraintBase ,&scene->GetOverlappingPair(0),dispatcher,getBroadphase(),m_solver,timeStep);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
{
|
||||
CcdPhysicsController* ctrl = m_controllers[k];
|
||||
// btTransform predictedTrans;
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
//todo: only do this when necessary, it's used for contact points
|
||||
body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse();
|
||||
|
||||
@@ -66,7 +66,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
btProfiler::endBlock("predictIntegratedTransform");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
//BroadphaseInterface* scene = GetBroadphase();
|
||||
//BroadphaseInterface* scene = getBroadphase();
|
||||
|
||||
|
||||
//
|
||||
@@ -75,7 +75,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::beginBlock("DispatchAllCollisionPairs");
|
||||
btProfiler::beginBlock("dispatchAllCollisionPairs");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
|
||||
@@ -99,11 +99,11 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
}
|
||||
|
||||
|
||||
//pairCache->RefreshOverlappingPairs();
|
||||
//pairCache->refreshOverlappingPairs();
|
||||
if (overlappingPairs.size())
|
||||
{
|
||||
assert(0);
|
||||
//dispatcher->DispatchAllCollisionPairs(&overlappingPairs[0],overlappingPairs.size(),dispatchInfo);///numsubstep,g);
|
||||
//dispatcher->dispatchAllCollisionPairs(&overlappingPairs[0],overlappingPairs.size(),dispatchInfo);///numsubstep,g);
|
||||
}
|
||||
|
||||
//scatter overlapping pair info, mainly the created algorithms/contact caches
|
||||
@@ -115,13 +115,13 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::endBlock("DispatchAllCollisionPairs");
|
||||
btProfiler::endBlock("dispatchAllCollisionPairs");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
|
||||
//contacts
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::beginBlock("SolveConstraint");
|
||||
btProfiler::beginBlock("solveConstraint");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
for (i=0;i< numConstraints ; i++ )
|
||||
{
|
||||
btTypedConstraint* constraint = constraintsBaseAddress[m_constraintIndices[i]];
|
||||
constraint->BuildJacobian();
|
||||
constraint->SolveConstraint( timeStep );
|
||||
constraint->buildJacobian();
|
||||
constraint->solveConstraint( timeStep );
|
||||
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
}
|
||||
|
||||
#ifdef USE_QUICKPROF
|
||||
btProfiler::endBlock("SolveConstraint");
|
||||
btProfiler::endBlock("solveConstraint");
|
||||
#endif //USE_QUICKPROF
|
||||
|
||||
/*
|
||||
@@ -163,7 +163,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
{
|
||||
WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i];
|
||||
btRaycastVehicle* vehicle = wrapperVehicle->GetVehicle();
|
||||
vehicle->UpdateVehicle( timeStep);
|
||||
vehicle->updateVehicle( timeStep);
|
||||
}
|
||||
#endif //NEW_BULLET_VEHICLE_SUPPORT
|
||||
*/
|
||||
@@ -181,7 +181,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
}
|
||||
*/
|
||||
|
||||
//OverlappingPairCache* scene = GetCollisionWorld()->GetPairCache();
|
||||
//OverlappingPairCache* scene = getCollisionWorld()->getPairCache();
|
||||
|
||||
btContactSolverInfo solverInfo;
|
||||
|
||||
@@ -193,7 +193,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
|
||||
if (m_manifolds.size())
|
||||
{
|
||||
solver->SolveGroup( &m_manifolds[0],m_manifolds.size(),solverInfo,0);
|
||||
solver->solveGroup( &m_manifolds[0],m_manifolds.size(),solverInfo,0);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
dispatchInfo.m_stepCount = 0;
|
||||
dispatchInfo.m_dispatchFunc = btDispatcherInfo::DISPATCH_CONTINUOUS;
|
||||
|
||||
// GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(scene,dispatchInfo);
|
||||
// getCollisionWorld()->getDispatcher()->dispatchAllCollisionPairs(scene,dispatchInfo);
|
||||
toi = dispatchInfo.m_timeOfImpact;
|
||||
|
||||
}
|
||||
@@ -244,7 +244,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
CcdPhysicsController* ctrl = *i;
|
||||
|
||||
btTransform predictedTrans;
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
if (body->IsActive())
|
||||
{
|
||||
@@ -276,7 +276,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
||||
!(i==m_controllers.end()); i++)
|
||||
{
|
||||
CcdPhysicsController* ctrl = (*i);
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
ctrl->UpdateDeactivation(timeStep);
|
||||
|
||||
@@ -375,15 +375,15 @@ void SimulationIsland::UpdateAabbs(btIDebugDraw* debugDrawer,btBroadphaseInterfa
|
||||
!(i==m_controllers.end()); i++)
|
||||
{
|
||||
CcdPhysicsController* ctrl = (*i);
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
|
||||
btPoint3 minAabb,maxAabb;
|
||||
btCollisionShape* shapeinterface = ctrl->GetCollisionShape();
|
||||
btCollisionShape* shapeinterface = ctrl->getCollisionShape();
|
||||
|
||||
|
||||
|
||||
shapeinterface->CalculateTemporalAabb(body->getCenterOfMassTransform(),
|
||||
shapeinterface->calculateTemporalAabb(body->getCenterOfMassTransform(),
|
||||
body->getLinearVelocity(),
|
||||
//body->getAngularVelocity(),
|
||||
btVector3(0.f,0.f,0.f),//no angular effect for now //body->getAngularVelocity(),
|
||||
@@ -428,7 +428,7 @@ void SimulationIsland::UpdateAabbs(btIDebugDraw* debugDrawer,btBroadphaseInterfa
|
||||
|
||||
};
|
||||
|
||||
if (m_debugDrawer->GetDebugMode() & btIDebugDraw::DBG_DrawAabb)
|
||||
if (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawAabb)
|
||||
{
|
||||
DrawAabb(m_debugDrawer,minAabb,maxAabb,color);
|
||||
}
|
||||
@@ -438,7 +438,7 @@ void SimulationIsland::UpdateAabbs(btIDebugDraw* debugDrawer,btBroadphaseInterfa
|
||||
|
||||
if ( (maxAabb-minAabb).length2() < 1e12f)
|
||||
{
|
||||
scene->SetAabb(bp,minAabb,maxAabb);
|
||||
scene->setAabb(bp,minAabb,maxAabb);
|
||||
} else
|
||||
{
|
||||
//something went wrong, investigate
|
||||
|
||||
@@ -77,9 +77,9 @@ class PHY_IPhysicsController
|
||||
virtual PHY_IPhysicsController* GetReplica() {return 0;}
|
||||
|
||||
virtual void calcXform() =0;
|
||||
virtual void SetMargin(float margin) =0;
|
||||
virtual float GetMargin() const=0;
|
||||
virtual float GetRadius() const { return 0.f;}
|
||||
virtual void setMargin(float margin) =0;
|
||||
virtual float getMargin() const=0;
|
||||
virtual float getRadius() const { return 0.f;}
|
||||
PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos);
|
||||
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
virtual ~PHY_IVehicle();
|
||||
|
||||
virtual void AddWheel(
|
||||
virtual void addWheel(
|
||||
PHY_IMotionState* motionState,
|
||||
PHY__Vector3 connectionPoint,
|
||||
PHY__Vector3 downDirection,
|
||||
@@ -38,20 +38,20 @@ public:
|
||||
) = 0;
|
||||
|
||||
|
||||
virtual int GetNumWheels() const = 0;
|
||||
virtual int getNumWheels() const = 0;
|
||||
|
||||
virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0;
|
||||
virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0;
|
||||
virtual float GetWheelRotation(int wheelIndex) const = 0;
|
||||
|
||||
virtual int GetUserConstraintId() const =0;
|
||||
virtual int GetUserConstraintType() const =0;
|
||||
virtual int getUserConstraintId() const =0;
|
||||
virtual int getUserConstraintType() const =0;
|
||||
|
||||
//some basic steering/braking/tuning/balancing (bikes)
|
||||
|
||||
virtual void SetSteeringValue(float steering,int wheelIndex) = 0;
|
||||
virtual void setSteeringValue(float steering,int wheelIndex) = 0;
|
||||
|
||||
virtual void ApplyEngineForce(float force,int wheelIndex) = 0;
|
||||
virtual void applyEngineForce(float force,int wheelIndex) = 0;
|
||||
|
||||
virtual void ApplyBraking(float braking,int wheelIndex) = 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
virtual void SetRollInfluence(float rollInfluence,int wheelIndex) = 0;
|
||||
|
||||
virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0;
|
||||
virtual void setCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
// element access
|
||||
const Vector3 GetNormal() const;
|
||||
const Scalar GetDistance() const;
|
||||
const Scalar getDistance() const;
|
||||
|
||||
// transformations
|
||||
friend const Plane operator-(const Plane& p);
|
||||
|
||||
@@ -49,10 +49,10 @@ Point3 Hull::GetFaceCentroid(short face) const
|
||||
short edge;
|
||||
|
||||
edge = GetFaceFirstEdge(face);
|
||||
Vector3 c = Vector3(GetVertex(GetEdgeVertex0(face, edge)));
|
||||
Vector3 c = Vector3(getVertex(GetEdgeVertex0(face, edge)));
|
||||
|
||||
for (edge = GetFaceNextEdge(face, edge); edge >= 0; edge = GetFaceNextEdge(face, edge))
|
||||
c += Vector3(GetVertex(GetEdgeVertex0(face, edge)));
|
||||
c += Vector3(getVertex(GetEdgeVertex0(face, edge)));
|
||||
|
||||
c /= Scalar(GetFace(face).m_numEdges);
|
||||
|
||||
@@ -767,8 +767,8 @@ int Hull::AddContactsHullHull(btSeparation& sep, const Point3* pVertsA, const Po
|
||||
// edge->edge contact is always a single point
|
||||
if (sep.m_separator == btSeparation::kFeatureBoth)
|
||||
{
|
||||
const Hull::Edge& edgeA = hullA.GetEdge(sep.m_featureA);
|
||||
const Hull::Edge& edgeB = hullB.GetEdge(sep.m_featureB);
|
||||
const Hull::Edge& edgeA = hullA.getEdge(sep.m_featureA);
|
||||
const Hull::Edge& edgeB = hullB.getEdge(sep.m_featureB);
|
||||
|
||||
float ta, tb;
|
||||
Line la(pVertsA[edgeA.m_verts[0]], pVertsA[edgeA.m_verts[1]]);
|
||||
@@ -801,13 +801,13 @@ int Hull::AddContactsHullHull(btSeparation& sep, const Point3* pVertsA, const Po
|
||||
// TODO: avoid having to transform planes here
|
||||
if (sep.m_separator == btSeparation::kFeatureB)
|
||||
{
|
||||
const Hull::Edge& edgeB = hullB.GetEdge(hullB.GetFaceFirstEdge(faceB));
|
||||
const Hull::Edge& edgeB = hullB.getEdge(hullB.GetFaceFirstEdge(faceB));
|
||||
tangent = Normalize(pVertsB[edgeB.m_verts[1]] - pVertsB[edgeB.m_verts[0]]);
|
||||
|
||||
Scalar dmin = Scalar::Consts::MaxValue;
|
||||
for (short face = 0; face < hullA.m_numFaces; face++)
|
||||
{
|
||||
Vector3 normal = hullA.GetPlane(face).GetNormal() * trA;
|
||||
Vector3 normal = hullA.getPlane(face).GetNormal() * trA;
|
||||
Scalar d = Dot(normal, sep.m_axis);
|
||||
if (d < dmin)
|
||||
{
|
||||
@@ -818,13 +818,13 @@ int Hull::AddContactsHullHull(btSeparation& sep, const Point3* pVertsA, const Po
|
||||
}
|
||||
else
|
||||
{
|
||||
const Hull::Edge& edgeA = hullA.GetEdge(hullA.GetFaceFirstEdge(faceA));
|
||||
const Hull::Edge& edgeA = hullA.getEdge(hullA.GetFaceFirstEdge(faceA));
|
||||
tangent = Normalize(pVertsA[edgeA.m_verts[1]] - pVertsA[edgeA.m_verts[0]]);
|
||||
|
||||
Scalar dmin = Scalar::Consts::MaxValue;
|
||||
for (short face = 0; face < hullB.m_numFaces; face++)
|
||||
{
|
||||
Vector3 normal = hullB.GetPlane(face).GetNormal() * trB;
|
||||
Vector3 normal = hullB.getPlane(face).GetNormal() * trB;
|
||||
Scalar d = Dot(normal, -sep.m_axis);
|
||||
if (d < dmin)
|
||||
{
|
||||
@@ -848,19 +848,19 @@ int Hull::AddContactsHullHull(btSeparation& sep, const Point3* pVertsA, const Po
|
||||
#if 0
|
||||
for (short edge = hullA.GetFaceFirstEdge(faceA); edge != -1; edge = hullA.GetFaceNextEdge(faceA, edge))
|
||||
{
|
||||
Plane planeA = hullA.GetPlane( hullA.GetEdgeOtherFace(edge, faceA) ) * trA;
|
||||
Plane planeA = hullA.getPlane( hullA.GetEdgeOtherFace(edge, faceA) ) * trA;
|
||||
numContacts = ClipFace(numContacts, &pVtxIn, &pVtxOut, planeA);
|
||||
}
|
||||
#else
|
||||
for (short f = 0; f < hullA.GetNumFaces(); f++)
|
||||
{
|
||||
Plane planeA = hullA.GetPlane(f) * trA;
|
||||
Plane planeA = hullA.getPlane(f) * trA;
|
||||
numContacts = ClipFace(numContacts, &pVtxIn, &pVtxOut, planeA);
|
||||
}
|
||||
#endif
|
||||
|
||||
// only keep points that are behind the witness face
|
||||
Plane planeA = hullA.GetPlane(faceA) * trA;
|
||||
Plane planeA = hullA.getPlane(faceA) * trA;
|
||||
|
||||
float depths[Hull::kMaxVerts];
|
||||
int numPoints = 0;
|
||||
@@ -1002,11 +1002,11 @@ bool Hull::GetSeparationHullHull(btSeparation& sep, const Point3* pVertsA, const
|
||||
|
||||
for (short ea = hullA.GetFaceFirstEdge(faceA); ea != -1; ea = hullA.GetFaceNextEdge(faceA, ea))
|
||||
{
|
||||
const Hull::Edge& edgeA = hullA.GetEdge(ea);
|
||||
const Hull::Edge& edgeA = hullA.getEdge(ea);
|
||||
|
||||
for (short eb = hullB.GetFaceFirstEdge(faceB); eb != -1; eb = hullB.GetFaceNextEdge(faceB, eb))
|
||||
{
|
||||
const Hull::Edge& edgeB = hullB.GetEdge(eb);
|
||||
const Hull::Edge& edgeB = hullB.getEdge(eb);
|
||||
|
||||
Vector3 va = pVertsA[edgeA.m_verts[1]] - pVertsA[edgeA.m_verts[0]];
|
||||
Vector3 vb = pVertsB[edgeB.m_verts[1]] - pVertsB[edgeB.m_verts[0]];
|
||||
|
||||
@@ -119,14 +119,14 @@ public:
|
||||
|
||||
// ObjectType GetObjectType() const {return kTypeHull;}
|
||||
|
||||
short GetNumVertices() const;
|
||||
short getNumVertices() const;
|
||||
short GetNumFaces() const;
|
||||
short GetNumEdges() const;
|
||||
short getNumEdges() const;
|
||||
|
||||
const Point3& GetVertex(short index) const;
|
||||
const Point3& getVertex(short index) const;
|
||||
const Face& GetFace(short index) const;
|
||||
const Edge& GetEdge(short index) const;
|
||||
const Plane& GetPlane(short index) const;
|
||||
const Edge& getEdge(short index) const;
|
||||
const Plane& getPlane(short index) const;
|
||||
|
||||
short GetFaceFirstEdge(short face) const;
|
||||
short GetFaceNextEdge(short face, short prevEdge) const;
|
||||
|
||||
@@ -69,7 +69,7 @@ m_erp(0.4f)
|
||||
|
||||
|
||||
//iterative lcp and penalty method
|
||||
float OdeConstraintSolver::SolveGroup(btPersistentManifold** manifoldPtr, int numManifolds,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer)
|
||||
float OdeConstraintSolver::solveGroup(btPersistentManifold** manifoldPtr, int numManifolds,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer)
|
||||
{
|
||||
m_CurBody = 0;
|
||||
m_CurJoint = 0;
|
||||
@@ -87,10 +87,10 @@ float OdeConstraintSolver::SolveGroup(btPersistentManifold** manifoldPtr, int nu
|
||||
int body0=-1,body1=-1;
|
||||
|
||||
btPersistentManifold* manifold = manifoldPtr[j];
|
||||
if (manifold->GetNumContacts() > 0)
|
||||
if (manifold->getNumContacts() > 0)
|
||||
{
|
||||
body0 = ConvertBody((btRigidBody*)manifold->GetBody0(),bodies,numBodies);
|
||||
body1 = ConvertBody((btRigidBody*)manifold->GetBody1(),bodies,numBodies);
|
||||
body0 = ConvertBody((btRigidBody*)manifold->getBody0(),bodies,numBodies);
|
||||
body1 = ConvertBody((btRigidBody*)manifold->getBody1(),bodies,numBodies);
|
||||
ConvertConstraint(manifold,joints,numJoints,bodies,body0,body1,debugDrawer);
|
||||
}
|
||||
}
|
||||
@@ -199,12 +199,12 @@ void OdeConstraintSolver::ConvertConstraint(btPersistentManifold* manifold,BU_Jo
|
||||
{
|
||||
|
||||
|
||||
manifold->RefreshContactPoints(((btRigidBody*)manifold->GetBody0())->getCenterOfMassTransform(),
|
||||
((btRigidBody*)manifold->GetBody1())->getCenterOfMassTransform());
|
||||
manifold->refreshContactPoints(((btRigidBody*)manifold->getBody0())->getCenterOfMassTransform(),
|
||||
((btRigidBody*)manifold->getBody1())->getCenterOfMassTransform());
|
||||
|
||||
int bodyId0 = _bodyId0,bodyId1 = _bodyId1;
|
||||
|
||||
int i,numContacts = manifold->GetNumContacts();
|
||||
int i,numContacts = manifold->getNumContacts();
|
||||
|
||||
bool swapBodies = (bodyId0 < 0);
|
||||
|
||||
@@ -216,13 +216,13 @@ void OdeConstraintSolver::ConvertConstraint(btPersistentManifold* manifold,BU_Jo
|
||||
bodyId0 = _bodyId1;
|
||||
bodyId1 = _bodyId0;
|
||||
|
||||
body0 = (btRigidBody*)manifold->GetBody1();
|
||||
body1 = (btRigidBody*)manifold->GetBody0();
|
||||
body0 = (btRigidBody*)manifold->getBody1();
|
||||
body1 = (btRigidBody*)manifold->getBody0();
|
||||
|
||||
} else
|
||||
{
|
||||
body0 = (btRigidBody*)manifold->GetBody0();
|
||||
body1 = (btRigidBody*)manifold->GetBody1();
|
||||
body0 = (btRigidBody*)manifold->getBody0();
|
||||
body1 = (btRigidBody*)manifold->getBody1();
|
||||
}
|
||||
|
||||
assert(bodyId0 >= 0);
|
||||
@@ -233,19 +233,19 @@ void OdeConstraintSolver::ConvertConstraint(btPersistentManifold* manifold,BU_Jo
|
||||
|
||||
if (debugDrawer)
|
||||
{
|
||||
const btManifoldPoint& cp = manifold->GetContactPoint(i);
|
||||
const btManifoldPoint& cp = manifold->getContactPoint(i);
|
||||
|
||||
debugDrawer->DrawContactPoint(
|
||||
debugDrawer->drawContactPoint(
|
||||
cp.m_positionWorldOnB,
|
||||
cp.m_normalWorldOnB,
|
||||
cp.GetDistance(),
|
||||
cp.GetLifeTime(),
|
||||
cp.getDistance(),
|
||||
cp.getLifeTime(),
|
||||
color);
|
||||
|
||||
}
|
||||
assert (m_CurJoint < MAX_JOINTS_1);
|
||||
|
||||
// if (manifold->GetContactPoint(i).GetDistance() < 0.0f)
|
||||
// if (manifold->getContactPoint(i).getDistance() < 0.0f)
|
||||
{
|
||||
ContactJoint* cont = new (&gJointArray[m_CurJoint++]) ContactJoint( manifold ,i, swapBodies,body0,body1);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
virtual ~OdeConstraintSolver() {}
|
||||
|
||||
virtual float SolveGroup(btPersistentManifold** manifold,int numManifolds,const btContactSolverInfo& info,btIDebugDraw* debugDrawer = 0);
|
||||
virtual float solveGroup(btPersistentManifold** manifold,int numManifolds,const btContactSolverInfo& info,btIDebugDraw* debugDrawer = 0);
|
||||
|
||||
///setConstraintForceMixing, the cfm adds some positive value to the main diagonal
|
||||
///This can improve convergence (make matrix positive semidefinite), but it can make the simulation look more 'springy'
|
||||
|
||||
@@ -179,7 +179,7 @@ static void command (int cmd)
|
||||
|
||||
// destroy the body and geoms for slot i
|
||||
dBodyDestroy (obj[i].body);
|
||||
collisionWorld->RemoveCollisionObject(&obj[i].collider);
|
||||
collisionWorld->removeCollisionObject(&obj[i].collider);
|
||||
obj[i].collider.m_broadphaseHandle = (btBroadphaseProxy*)(-1);
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ static void command (int cmd)
|
||||
dMassSetBox (&m,DENSITY,sides[0],sides[1],sides[2]);
|
||||
obj[i].collider.m_collisionShape = new btBoxShape(btVector3(0.5*sides[0],0.5*sides[1],0.5*sides[2]));
|
||||
obj[i].collider.m_worldTransform = GetTransformFromOde(dBodyGetPosition(obj[i].body),dBodyGetRotation(obj[i].body));
|
||||
collisionWorld->AddCollisionObject(&obj[i].collider);
|
||||
collisionWorld->addCollisionObject(&obj[i].collider);
|
||||
obj[i].collider.m_userPointer = obj[i].body;
|
||||
|
||||
}
|
||||
@@ -223,7 +223,7 @@ static void command (int cmd)
|
||||
dMassSetCappedCylinder (&m,DENSITY,3,sides[0],sides[1]);
|
||||
obj[i].collider.m_collisionShape = new btCylinderShapeZ(btVector3(sides[0],sides[1],sides[1]));
|
||||
obj[i].collider.m_worldTransform = GetTransformFromOde(dBodyGetPosition(obj[i].body),dBodyGetRotation(obj[i].body));
|
||||
collisionWorld->AddCollisionObject(&obj[i].collider);
|
||||
collisionWorld->addCollisionObject(&obj[i].collider);
|
||||
obj[i].collider.m_userPointer = obj[i].body;
|
||||
//obj[i].geom[0] = dCreateCCylinder (space,sides[0],sides[1]);
|
||||
}
|
||||
@@ -242,7 +242,7 @@ static void command (int cmd)
|
||||
|
||||
|
||||
obj[i].collider.m_worldTransform = GetTransformFromOde(dBodyGetPosition(obj[i].body),dBodyGetRotation(obj[i].body));
|
||||
collisionWorld->AddCollisionObject(&obj[i].collider);
|
||||
collisionWorld->addCollisionObject(&obj[i].collider);
|
||||
obj[i].collider.m_userPointer = obj[i].body;
|
||||
|
||||
//obj[i].geom[0] = dCreateSphere (space,sides[0]);
|
||||
@@ -300,21 +300,21 @@ void drawGeom (btCollisionObject& collider)//, const dReal *pos, const dReal *R,
|
||||
|
||||
if (!collider.m_collisionShape) return;
|
||||
|
||||
int type = collider.m_collisionShape->GetShapeType();
|
||||
int type = collider.m_collisionShape->getShapeType();
|
||||
|
||||
if (type == BOX_SHAPE_PROXYTYPE) {
|
||||
dVector3 sides;
|
||||
btBoxShape* boxShape = static_cast<btBoxShape*>(collider.m_collisionShape);
|
||||
sides[0] = 2.f*boxShape->GetHalfExtents().x();
|
||||
sides[1] = 2.f*boxShape->GetHalfExtents().y();
|
||||
sides[2] = 2.f*boxShape->GetHalfExtents().z();
|
||||
sides[0] = 2.f*boxShape->getHalfExtents().x();
|
||||
sides[1] = 2.f*boxShape->getHalfExtents().y();
|
||||
sides[2] = 2.f*boxShape->getHalfExtents().z();
|
||||
///boxshape already has margins 'inside'
|
||||
dsDrawBox (pos,R,sides);
|
||||
|
||||
}
|
||||
else if (type == SPHERE_SHAPE_PROXYTYPE) {
|
||||
btSphereShape* sphereShape = static_cast<btSphereShape*>(collider.m_collisionShape);
|
||||
dReal radius = sphereShape->GetMargin();
|
||||
dReal radius = sphereShape->getMargin();
|
||||
|
||||
dsDrawSphere (pos,R,radius);
|
||||
|
||||
@@ -323,10 +323,10 @@ void drawGeom (btCollisionObject& collider)//, const dReal *pos, const dReal *R,
|
||||
else if (type == CYLINDER_SHAPE_PROXYTYPE) {
|
||||
|
||||
btCylinderShapeZ* cylinder = static_cast<btCylinderShapeZ*>(collider.m_collisionShape);
|
||||
dReal radius = cylinder->GetHalfExtents()[0];
|
||||
dReal length = 2.f*cylinder->GetHalfExtents()[1];
|
||||
radius += cylinder->GetMargin();
|
||||
length += 2.f*cylinder->GetMargin();
|
||||
dReal radius = cylinder->getHalfExtents()[0];
|
||||
dReal length = 2.f*cylinder->getHalfExtents()[1];
|
||||
radius += cylinder->getMargin();
|
||||
length += 2.f*cylinder->getMargin();
|
||||
|
||||
//dGeomCCylinderGetParams (g,&radius,&length);
|
||||
dsDrawCylinder (pos,R,length,radius);
|
||||
@@ -376,21 +376,21 @@ static void simLoop (int pause)
|
||||
{
|
||||
dsSetColor (0,0,2);
|
||||
//dSpaceCollide (space,0,&nearCallback);
|
||||
collisionWorld->PerformDiscreteCollisionDetection();
|
||||
collisionWorld->performDiscreteCollisionDetection();
|
||||
//now the collisionWorld contains all contact points... just copy them over to ODE and that's it
|
||||
|
||||
for (int i=0;i<collisionWorld->GetDispatcher()->GetNumManifolds();i++)
|
||||
for (int i=0;i<collisionWorld->getDispatcher()->getNumManifolds();i++)
|
||||
{
|
||||
btPersistentManifold* manifold = collisionWorld->GetDispatcher()->GetManifoldByIndexInternal(i);
|
||||
btCollisionObject* obj0 = static_cast<btCollisionObject*>(manifold->GetBody0());
|
||||
btCollisionObject* obj1 = static_cast<btCollisionObject*>(manifold->GetBody1());
|
||||
btPersistentManifold* manifold = collisionWorld->getDispatcher()->getManifoldByIndexInternal(i);
|
||||
btCollisionObject* obj0 = static_cast<btCollisionObject*>(manifold->getBody0());
|
||||
btCollisionObject* obj1 = static_cast<btCollisionObject*>(manifold->getBody1());
|
||||
|
||||
//RefreshContactPoints will update and/or remove existing contactpoints from previous frames
|
||||
manifold->RefreshContactPoints(obj0->m_worldTransform,obj1->m_worldTransform);
|
||||
for (int j=0;j<manifold->GetNumContacts();j++)
|
||||
//refreshContactPoints will update and/or remove existing contactpoints from previous frames
|
||||
manifold->refreshContactPoints(obj0->m_worldTransform,obj1->m_worldTransform);
|
||||
for (int j=0;j<manifold->getNumContacts();j++)
|
||||
{
|
||||
btManifoldPoint& pt = manifold->GetContactPoint(j);
|
||||
if (pt.GetDistance()<0.f)
|
||||
btManifoldPoint& pt = manifold->getContactPoint(j);
|
||||
if (pt.getDistance()<0.f)
|
||||
{
|
||||
//report point to ODE
|
||||
|
||||
@@ -401,7 +401,7 @@ static void simLoop (int pause)
|
||||
contact.surface.bounce = 0.1;
|
||||
contact.surface.bounce_vel = 0.1;
|
||||
contact.surface.soft_cfm = 0.01;
|
||||
contact.geom.depth = -pt.GetDistance();
|
||||
contact.geom.depth = -pt.getDistance();
|
||||
|
||||
|
||||
contact.geom.normal[0] = pt.m_normalWorldOnB.x();
|
||||
@@ -410,9 +410,9 @@ static void simLoop (int pause)
|
||||
//contact.geom.g1 does it really need this?
|
||||
contact.geom.g1 = 0;
|
||||
contact.geom.g2 = 0;
|
||||
contact.geom.pos[0] = pt.GetPositionWorldOnB().x();
|
||||
contact.geom.pos[1] = pt.GetPositionWorldOnB().y();
|
||||
contact.geom.pos[2] = pt.GetPositionWorldOnB().z();
|
||||
contact.geom.pos[0] = pt.getPositionWorldOnB().x();
|
||||
contact.geom.pos[1] = pt.getPositionWorldOnB().y();
|
||||
contact.geom.pos[2] = pt.getPositionWorldOnB().z();
|
||||
|
||||
contact.fdir1[0] = 0.f;
|
||||
contact.fdir1[1] = 0.f;
|
||||
@@ -513,8 +513,8 @@ int main (int argc, char **argv)
|
||||
btCollisionObject groundPlane;
|
||||
groundPlane.m_worldTransform.setIdentity();
|
||||
groundPlane.m_collisionShape = new btBoxShape(btVector3(50,50,0.04));
|
||||
groundPlane.m_collisionShape->SetMargin(0.005f);
|
||||
collisionWorld->AddCollisionObject(&groundPlane);
|
||||
groundPlane.m_collisionShape->setMargin(0.005f);
|
||||
collisionWorld->addCollisionObject(&groundPlane);
|
||||
groundPlane.m_userPointer = 0;
|
||||
|
||||
memset (obj,0,sizeof(obj));
|
||||
|
||||
Reference in New Issue
Block a user