Refactoring: another huge number of changes, renamed methods to start with lower-case.
This commit is contained in:
@@ -15,23 +15,23 @@ subject to the following restrictions:
|
||||
|
||||
#include "btBoxShape.h"
|
||||
|
||||
btVector3 btBoxShape::GetHalfExtents() const
|
||||
btVector3 btBoxShape::getHalfExtents() const
|
||||
{
|
||||
return m_boxHalfExtents1 * m_localScaling;
|
||||
}
|
||||
//{
|
||||
|
||||
|
||||
void btBoxShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btBoxShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
btMatrix3x3 abs_b = t.getBasis().absolute();
|
||||
btPoint3 center = t.getOrigin();
|
||||
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
|
||||
abs_b[1].dot(halfExtents),
|
||||
abs_b[2].dot(halfExtents));
|
||||
extent += btVector3(GetMargin(),GetMargin(),GetMargin());
|
||||
extent += btVector3(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
@@ -40,10 +40,10 @@ void btBoxShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabb
|
||||
}
|
||||
|
||||
|
||||
void btBoxShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btBoxShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//float margin = 0.f;
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
btScalar lx=2.f*(halfExtents.x());
|
||||
btScalar ly=2.f*(halfExtents.y());
|
||||
|
||||
@@ -31,18 +31,18 @@ class btBoxShape: public btPolyhedralConvexShape
|
||||
|
||||
public:
|
||||
|
||||
btVector3 GetHalfExtents() const;
|
||||
btVector3 getHalfExtents() const;
|
||||
//{ return m_boxHalfExtents1 * m_localScaling;}
|
||||
//const btVector3& GetHalfExtents() const{ return m_boxHalfExtents1;}
|
||||
//const btVector3& getHalfExtents() const{ return m_boxHalfExtents1;}
|
||||
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return BOX_SHAPE_PROXYTYPE;}
|
||||
virtual int getShapeType() const { return BOX_SHAPE_PROXYTYPE;}
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
btVector3 supVertex;
|
||||
supVertex = btPoint3(vec.x() < btScalar(0.0f) ? -halfExtents.x() : halfExtents.x(),
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
virtual inline btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
virtual inline btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 margin(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents -= margin;
|
||||
|
||||
return btVector3(vec.x() < btScalar(0.0f) ? -halfExtents.x() : halfExtents.x(),
|
||||
@@ -63,10 +63,10 @@ public:
|
||||
vec.z() < btScalar(0.0f) ? -halfExtents.z() : halfExtents.z());
|
||||
}
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 margin(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents -= margin;
|
||||
|
||||
|
||||
@@ -83,41 +83,41 @@ public:
|
||||
|
||||
btBoxShape( const btVector3& boxHalfExtents) : m_boxHalfExtents1(boxHalfExtents){};
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
{
|
||||
//this plane might not be aligned...
|
||||
btVector4 plane ;
|
||||
GetPlaneEquation(plane,i);
|
||||
getPlaneEquation(plane,i);
|
||||
planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
|
||||
planeSupport = LocalGetSupportingVertex(-planeNormal);
|
||||
planeSupport = localGetSupportingVertex(-planeNormal);
|
||||
}
|
||||
|
||||
|
||||
virtual int GetNumPlanes() const
|
||||
virtual int getNumPlanes() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
virtual int GetNumVertices() const
|
||||
virtual int getNumVertices() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
virtual int GetNumEdges() const
|
||||
virtual int getNumEdges() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
|
||||
virtual void GetVertex(int i,btVector3& vtx) const
|
||||
virtual void getVertex(int i,btVector3& vtx) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
vtx = btVector3(
|
||||
halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
|
||||
@@ -126,9 +126,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void GetPlaneEquation(btVector4& plane,int i) const
|
||||
virtual void getPlaneEquation(btVector4& plane,int i) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@@ -162,8 +162,8 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
//virtual void GetEdge(int i,Edge& edge) const
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
//virtual void getEdge(int i,Edge& edge) const
|
||||
{
|
||||
int edgeVert0 = 0;
|
||||
int edgeVert1 = 0;
|
||||
@@ -225,17 +225,17 @@ public:
|
||||
|
||||
}
|
||||
|
||||
GetVertex(edgeVert0,pa );
|
||||
GetVertex(edgeVert1,pb );
|
||||
getVertex(edgeVert0,pa );
|
||||
getVertex(edgeVert1,pb );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
//btScalar minDist = 2*tolerance;
|
||||
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Box";
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInte
|
||||
#ifndef DISABLE_BVH
|
||||
|
||||
m_bvh = new btOptimizedBvh();
|
||||
m_bvh->Build(meshInterface);
|
||||
m_bvh->build(meshInterface);
|
||||
|
||||
#endif //DISABLE_BVH
|
||||
|
||||
@@ -40,12 +40,12 @@ btBvhTriangleMeshShape::~btBvhTriangleMeshShape()
|
||||
}
|
||||
|
||||
//perform bvh tree traversal and report overlapping triangles to 'callback'
|
||||
void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
#ifdef DISABLE_BVH
|
||||
//brute force traverse all triangles
|
||||
btTriangleMeshShape::ProcessAllTriangles(callback,aabbMin,aabbMax);
|
||||
btTriangleMeshShape::processAllTriangles(callback,aabbMin,aabbMax);
|
||||
#else
|
||||
|
||||
//first get all the nodes
|
||||
@@ -64,7 +64,7 @@ void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,co
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ProcessNode(const btOptimizedBvhNode* node)
|
||||
virtual void processNode(const btOptimizedBvhNode* node)
|
||||
{
|
||||
const unsigned char *vertexbase;
|
||||
int numverts;
|
||||
@@ -108,7 +108,7 @@ void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,co
|
||||
#endif //DEBUG_TRIANGLE_MESH
|
||||
}
|
||||
|
||||
m_callback->ProcessTriangle(m_triangle,node->m_subPart,node->m_triangleIndex);
|
||||
m_callback->processTriangle(m_triangle,node->m_subPart,node->m_triangleIndex);
|
||||
m_meshInterface->unLockReadOnlyVertexBase(node->m_subPart);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,co
|
||||
|
||||
MyNodeOverlapCallback myNodeCallback(callback,m_meshInterface);
|
||||
|
||||
m_bvh->ReportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
|
||||
m_bvh->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
|
||||
|
||||
|
||||
#endif//DISABLE_BVH
|
||||
@@ -132,7 +132,7 @@ void btBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling)
|
||||
btTriangleMeshShape::setLocalScaling(scaling);
|
||||
delete m_bvh;
|
||||
m_bvh = new btOptimizedBvh();
|
||||
m_bvh->Build(m_meshInterface);
|
||||
m_bvh->build(m_meshInterface);
|
||||
//rebuild the bvh...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
|
||||
/*
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return TRIANGLE_MESH_SHAPE_PROXYTYPE;
|
||||
}
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "BVHTRIANGLEMESH";}
|
||||
virtual char* getName()const {return "BVHTRIANGLEMESH";}
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
@@ -15,31 +15,31 @@ subject to the following restrictions:
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||
|
||||
void btCollisionShape::GetBoundingSphere(btVector3& center,btScalar& radius) const
|
||||
void btCollisionShape::getBoundingSphere(btVector3& center,btScalar& radius) const
|
||||
{
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
|
||||
GetAabb(tr,aabbMin,aabbMax);
|
||||
getAabb(tr,aabbMin,aabbMax);
|
||||
|
||||
radius = (aabbMax-aabbMin).length()*0.5f;
|
||||
center = (aabbMin+aabbMax)*0.5f;
|
||||
}
|
||||
|
||||
float btCollisionShape::GetAngularMotionDisc() const
|
||||
float btCollisionShape::getAngularMotionDisc() const
|
||||
{
|
||||
btVector3 center;
|
||||
float disc;
|
||||
GetBoundingSphere(center,disc);
|
||||
getBoundingSphere(center,disc);
|
||||
disc += (center).length();
|
||||
return disc;
|
||||
}
|
||||
|
||||
void btCollisionShape::CalculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax)
|
||||
void btCollisionShape::calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax)
|
||||
{
|
||||
//start with static aabb
|
||||
GetAabb(curTrans,temporalAabbMin,temporalAabbMax);
|
||||
getAabb(curTrans,temporalAabbMin,temporalAabbMax);
|
||||
|
||||
float temporalAabbMaxx = temporalAabbMax.getX();
|
||||
float temporalAabbMaxy = temporalAabbMax.getY();
|
||||
@@ -65,7 +65,7 @@ void btCollisionShape::CalculateTemporalAabb(const btTransform& curTrans,const b
|
||||
temporalAabbMinz += linMotion.z();
|
||||
|
||||
//add conservative angular motion
|
||||
btScalar angularMotion = angvel.length() * GetAngularMotionDisc() * timeStep;
|
||||
btScalar angularMotion = angvel.length() * getAngularMotionDisc() * timeStep;
|
||||
btVector3 angularMotion3d(angularMotion,angularMotion,angularMotion);
|
||||
temporalAabbMin = btVector3(temporalAabbMinx,temporalAabbMiny,temporalAabbMinz);
|
||||
temporalAabbMax = btVector3(temporalAabbMaxx,temporalAabbMaxy,temporalAabbMaxz);
|
||||
|
||||
@@ -34,50 +34,50 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
|
||||
|
||||
virtual void GetBoundingSphere(btVector3& center,btScalar& radius) const;
|
||||
virtual void getBoundingSphere(btVector3& center,btScalar& radius) const;
|
||||
|
||||
virtual float GetAngularMotionDisc() const;
|
||||
virtual float getAngularMotionDisc() const;
|
||||
|
||||
virtual int GetShapeType() const=0;
|
||||
virtual int getShapeType() const=0;
|
||||
|
||||
///CalculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
|
||||
///calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
|
||||
///result is conservative
|
||||
void CalculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax);
|
||||
void calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax);
|
||||
|
||||
inline bool IsPolyhedral() const
|
||||
inline bool isPolyhedral() const
|
||||
{
|
||||
return btBroadphaseProxy::IsPolyhedral(GetShapeType());
|
||||
return btBroadphaseProxy::isPolyhedral(getShapeType());
|
||||
}
|
||||
|
||||
inline bool IsConvex() const
|
||||
inline bool isConvex() const
|
||||
{
|
||||
return btBroadphaseProxy::IsConvex(GetShapeType());
|
||||
return btBroadphaseProxy::isConvex(getShapeType());
|
||||
}
|
||||
inline bool IsConcave() const
|
||||
inline bool isConcave() const
|
||||
{
|
||||
return btBroadphaseProxy::IsConcave(GetShapeType());
|
||||
return btBroadphaseProxy::isConcave(getShapeType());
|
||||
}
|
||||
inline bool IsCompound() const
|
||||
inline bool isCompound() const
|
||||
{
|
||||
return btBroadphaseProxy::IsCompound(GetShapeType());
|
||||
return btBroadphaseProxy::isCompound(getShapeType());
|
||||
}
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling) =0;
|
||||
virtual const btVector3& getLocalScaling() const =0;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia) = 0;
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) = 0;
|
||||
|
||||
//debugging support
|
||||
virtual char* GetName()const =0 ;
|
||||
const char* GetExtraDebugInfo() const { return m_tempDebug;}
|
||||
void SetExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;}
|
||||
virtual char* getName()const =0 ;
|
||||
const char* getExtraDebugInfo() const { return m_tempDebug;}
|
||||
void setExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;}
|
||||
const char * m_tempDebug;
|
||||
//endif debugging support
|
||||
|
||||
virtual void SetMargin(float margin) = 0;
|
||||
virtual float GetMargin() const = 0;
|
||||
virtual void setMargin(float margin) = 0;
|
||||
virtual float getMargin() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@ btCompoundShape::~btCompoundShape()
|
||||
{
|
||||
}
|
||||
|
||||
void btCompoundShape::AddChildShape(const btTransform& localTransform,btCollisionShape* shape)
|
||||
void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisionShape* shape)
|
||||
{
|
||||
m_childTransforms.push_back(localTransform);
|
||||
m_childShapes.push_back(shape);
|
||||
|
||||
//extend the local aabbMin/aabbMax
|
||||
btVector3 localAabbMin,localAabbMax;
|
||||
shape->GetAabb(localTransform,localAabbMin,localAabbMax);
|
||||
shape->getAabb(localTransform,localAabbMin,localAabbMax);
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
if (m_localAabbMin[i] > localAabbMin[i])
|
||||
@@ -57,8 +57,8 @@ void btCompoundShape::AddChildShape(const btTransform& localTransform,btCollisio
|
||||
|
||||
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btCompoundShape::GetAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 localHalfExtents = 0.5f*(m_localAabbMax-m_localAabbMin);
|
||||
btVector3 localCenter = 0.5f*(m_localAabbMax+m_localAabbMin);
|
||||
@@ -70,19 +70,19 @@ void btCompoundShape::GetAabb(const btTransform& trans,btVector3& aabbMin,btVect
|
||||
btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
|
||||
abs_b[1].dot(localHalfExtents),
|
||||
abs_b[2].dot(localHalfExtents));
|
||||
extent += btVector3(GetMargin(),GetMargin(),GetMargin());
|
||||
extent += btVector3(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
}
|
||||
|
||||
void btCompoundShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//approximation: take the inertia from the aabb for now
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(ident,aabbMin,aabbMax);
|
||||
getAabb(ident,aabbMin,aabbMax);
|
||||
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
|
||||
@@ -42,33 +42,33 @@ public:
|
||||
|
||||
virtual ~btCompoundShape();
|
||||
|
||||
void AddChildShape(const btTransform& localTransform,btCollisionShape* shape);
|
||||
void addChildShape(const btTransform& localTransform,btCollisionShape* shape);
|
||||
|
||||
int GetNumChildShapes() const
|
||||
int getNumChildShapes() const
|
||||
{
|
||||
return m_childShapes.size();
|
||||
}
|
||||
|
||||
btCollisionShape* GetChildShape(int index)
|
||||
btCollisionShape* getChildShape(int index)
|
||||
{
|
||||
return m_childShapes[index];
|
||||
}
|
||||
const btCollisionShape* GetChildShape(int index) const
|
||||
const btCollisionShape* getChildShape(int index) const
|
||||
{
|
||||
return m_childShapes[index];
|
||||
}
|
||||
|
||||
btTransform GetChildTransform(int index)
|
||||
btTransform getChildTransform(int index)
|
||||
{
|
||||
return m_childTransforms[index];
|
||||
}
|
||||
const btTransform GetChildTransform(int index) const
|
||||
const btTransform getChildTransform(int index) const
|
||||
{
|
||||
return m_childTransforms[index];
|
||||
}
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling)
|
||||
@@ -80,27 +80,27 @@ public:
|
||||
return m_localScaling;
|
||||
}
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual int GetShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
|
||||
virtual int getShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
|
||||
|
||||
virtual void SetMargin(float margin)
|
||||
virtual void setMargin(float margin)
|
||||
{
|
||||
m_collisionMargin = margin;
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
virtual float getMargin() const
|
||||
{
|
||||
return m_collisionMargin;
|
||||
}
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Compound";
|
||||
}
|
||||
|
||||
//this is optional, but should make collision queries faster, by culling non-overlapping nodes
|
||||
void CreateAabbTreeFromChildren();
|
||||
void createAabbTreeFromChildren();
|
||||
|
||||
const btOptimizedBvh* GetAabbTree() const
|
||||
const btOptimizedBvh* getAabbTree() const
|
||||
{
|
||||
return m_aabbTree;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ public:
|
||||
|
||||
virtual ~ConcaveShape();
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const = 0;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const = 0;
|
||||
|
||||
virtual float GetMargin() const {
|
||||
virtual float getMargin() const {
|
||||
return m_collisionMargin;
|
||||
}
|
||||
virtual void SetMargin(float collisionMargin)
|
||||
virtual void setMargin(float collisionMargin)
|
||||
{
|
||||
m_collisionMargin = collisionMargin;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ m_height(height)
|
||||
}
|
||||
|
||||
|
||||
btVector3 btConeShape::ConeLocalSupport(const btVector3& v) const
|
||||
btVector3 btConeShape::coneLocalSupport(const btVector3& v) const
|
||||
{
|
||||
|
||||
float halfHeight = m_height * 0.5f;
|
||||
@@ -66,25 +66,25 @@ btVector3 btConeShape::ConeLocalSupport(const btVector3& v) const
|
||||
|
||||
}
|
||||
|
||||
btVector3 btConeShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec) const
|
||||
btVector3 btConeShape::localGetSupportingVertexWithoutMargin(const btVector3& vec) const
|
||||
{
|
||||
return ConeLocalSupport(vec);
|
||||
return coneLocalSupport(vec);
|
||||
}
|
||||
|
||||
void btConeShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btConeShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
const btVector3& vec = vectors[i];
|
||||
supportVerticesOut[i] = ConeLocalSupport(vec);
|
||||
supportVerticesOut[i] = coneLocalSupport(vec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
btVector3 btConeShape::LocalGetSupportingVertex(const btVector3& vec) const
|
||||
btVector3 btConeShape::localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
btVector3 supVertex = ConeLocalSupport(vec);
|
||||
if ( GetMargin()!=0.f )
|
||||
btVector3 supVertex = coneLocalSupport(vec);
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -92,7 +92,7 @@ btVector3 btConeShape::LocalGetSupportingVertex(const btVector3& vec) const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
@@ -28,30 +28,30 @@ class btConeShape : public btConvexShape
|
||||
float m_radius;
|
||||
float m_height;
|
||||
|
||||
btVector3 ConeLocalSupport(const btVector3& v) const;
|
||||
btVector3 coneLocalSupport(const btVector3& v) const;
|
||||
|
||||
|
||||
public:
|
||||
btConeShape (btScalar radius,btScalar height);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec) const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
float GetRadius() const { return m_radius;}
|
||||
float GetHeight() const { return m_height;}
|
||||
float getRadius() const { return m_radius;}
|
||||
float getHeight() const { return m_height;}
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
btTransform identity;
|
||||
identity.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(identity,aabbMin,aabbMax);
|
||||
getAabb(identity,aabbMin,aabbMax);
|
||||
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
float margin = GetMargin();
|
||||
float margin = getMargin();
|
||||
|
||||
btScalar lx=2.f*(halfExtents.x()+margin);
|
||||
btScalar ly=2.f*(halfExtents.y()+margin);
|
||||
@@ -70,9 +70,9 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return CONE_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return CONE_SHAPE_PROXYTYPE; }
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Cone";
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ btConvexHullShape ::btConvexHullShape (btPoint3* points,int numPoints,int stride
|
||||
}
|
||||
}
|
||||
|
||||
btVector3 btConvexHullShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btConvexHullShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
btVector3 supVec(0.f,0.f,0.f);
|
||||
btScalar newDot,maxDot = -1e30f;
|
||||
@@ -61,7 +61,7 @@ btVector3 btConvexHullShape::LocalGetSupportingVertexWithoutMargin(const btVecto
|
||||
return supVec;
|
||||
}
|
||||
|
||||
void btConvexHullShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btConvexHullShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
btScalar newDot;
|
||||
//use 'w' component of supportVerticesOut?
|
||||
@@ -95,11 +95,11 @@ void btConvexHullShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const
|
||||
|
||||
|
||||
|
||||
btVector3 btConvexHullShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btConvexHullShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -107,7 +107,7 @@ btVector3 btConvexHullShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
@@ -122,17 +122,17 @@ btVector3 btConvexHullShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
|
||||
//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
|
||||
//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
|
||||
int btConvexHullShape::GetNumVertices() const
|
||||
int btConvexHullShape::getNumVertices() const
|
||||
{
|
||||
return m_points.size();
|
||||
}
|
||||
|
||||
int btConvexHullShape::GetNumEdges() const
|
||||
int btConvexHullShape::getNumEdges() const
|
||||
{
|
||||
return m_points.size()*m_points.size();
|
||||
}
|
||||
|
||||
void btConvexHullShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
void btConvexHullShape::getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
|
||||
int index0 = i%m_points.size();
|
||||
@@ -141,23 +141,23 @@ void btConvexHullShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
pb = m_points[index1]*m_localScaling;
|
||||
}
|
||||
|
||||
void btConvexHullShape::GetVertex(int i,btPoint3& vtx) const
|
||||
void btConvexHullShape::getVertex(int i,btPoint3& vtx) const
|
||||
{
|
||||
vtx = m_points[i]*m_localScaling;
|
||||
}
|
||||
|
||||
int btConvexHullShape::GetNumPlanes() const
|
||||
int btConvexHullShape::getNumPlanes() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btConvexHullShape::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
void btConvexHullShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
//not yet
|
||||
bool btConvexHullShape::IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
bool btConvexHullShape::isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
|
||||
@@ -22,7 +22,7 @@ subject to the following restrictions:
|
||||
#include <vector>
|
||||
|
||||
///ConvexHullShape implements an implicit (getSupportingVertex) Convex Hull of a Point Cloud (vertices)
|
||||
///No connectivity is needed. LocalGetSupportingVertex iterates linearly though all vertices.
|
||||
///No connectivity is needed. localGetSupportingVertex iterates linearly though all vertices.
|
||||
///on modern hardware, due to cache coherency this isn't that bad. Complex algorithms tend to trash the cash.
|
||||
///(memory is much slower then the cpu)
|
||||
class btConvexHullShape : public btPolyhedralConvexShape
|
||||
@@ -32,28 +32,28 @@ class btConvexHullShape : public btPolyhedralConvexShape
|
||||
public:
|
||||
btConvexHullShape(btPoint3* points,int numPoints, int stride=sizeof(btPoint3));
|
||||
|
||||
void AddPoint(const btPoint3& point)
|
||||
void addPoint(const btPoint3& point)
|
||||
{
|
||||
m_points.push_back(point);
|
||||
}
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual int GetShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "Convex";}
|
||||
virtual char* getName()const {return "Convex";}
|
||||
|
||||
|
||||
virtual int GetNumVertices() const;
|
||||
virtual int GetNumEdges() const;
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const;
|
||||
virtual int GetNumPlanes() const;
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
virtual int getNumVertices() const;
|
||||
virtual int getNumEdges() const;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const;
|
||||
virtual int getNumPlanes() const;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,30 +29,30 @@ void btConvexShape::setLocalScaling(const btVector3& scaling)
|
||||
|
||||
|
||||
|
||||
void btConvexShape::GetAabbSlow(const btTransform& trans,btVector3&minAabb,btVector3&maxAabb) const
|
||||
void btConvexShape::getAabbSlow(const btTransform& trans,btVector3&minAabb,btVector3&maxAabb) const
|
||||
{
|
||||
|
||||
btScalar margin = GetMargin();
|
||||
btScalar margin = getMargin();
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
btVector3 vec(0.f,0.f,0.f);
|
||||
vec[i] = 1.f;
|
||||
|
||||
btVector3 sv = LocalGetSupportingVertex(vec*trans.getBasis());
|
||||
btVector3 sv = localGetSupportingVertex(vec*trans.getBasis());
|
||||
|
||||
btVector3 tmp = trans(sv);
|
||||
maxAabb[i] = tmp[i]+margin;
|
||||
vec[i] = -1.f;
|
||||
tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis()));
|
||||
tmp = trans(localGetSupportingVertex(vec*trans.getBasis()));
|
||||
minAabb[i] = tmp[i]-margin;
|
||||
}
|
||||
};
|
||||
|
||||
btVector3 btConvexShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btConvexShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -60,7 +60,7 @@ btVector3 btConvexShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
|
||||
|
||||
@@ -36,23 +36,23 @@ class btConvexShape : public btCollisionShape
|
||||
public:
|
||||
btConvexShape();
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0;
|
||||
|
||||
//notice that the vectors should be unit length
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
|
||||
|
||||
// testing for hullnode code
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
GetAabbSlow(t,aabbMin,aabbMax);
|
||||
getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void GetAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
@@ -62,11 +62,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void SetMargin(float margin)
|
||||
virtual void setMargin(float margin)
|
||||
{
|
||||
m_collisionMargin = margin;
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
virtual float getMargin() const
|
||||
{
|
||||
return m_collisionMargin;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
|
||||
|
||||
btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btConvexTriangleMeshShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
btVector3 supVec(0.f,0.f,0.f);
|
||||
|
||||
@@ -92,7 +92,7 @@ btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const
|
||||
return supVec;
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btConvexTriangleMeshShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
//use 'w' component of supportVerticesOut?
|
||||
{
|
||||
@@ -118,11 +118,11 @@ void btConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargi
|
||||
|
||||
|
||||
|
||||
btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btConvexTriangleMeshShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -130,7 +130,7 @@ btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& v
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& v
|
||||
|
||||
//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
|
||||
//Please note that you can debug-draw btConvexTriangleMeshShape with the Raytracer Demo
|
||||
int btConvexTriangleMeshShape::GetNumVertices() const
|
||||
int btConvexTriangleMeshShape::getNumVertices() const
|
||||
{
|
||||
//cache this?
|
||||
assert(0);
|
||||
@@ -153,34 +153,34 @@ int btConvexTriangleMeshShape::GetNumVertices() const
|
||||
|
||||
}
|
||||
|
||||
int btConvexTriangleMeshShape::GetNumEdges() const
|
||||
int btConvexTriangleMeshShape::getNumEdges() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
void btConvexTriangleMeshShape::getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::GetVertex(int i,btPoint3& vtx) const
|
||||
void btConvexTriangleMeshShape::getVertex(int i,btPoint3& vtx) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
int btConvexTriangleMeshShape::GetNumPlanes() const
|
||||
int btConvexTriangleMeshShape::getNumPlanes() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
void btConvexTriangleMeshShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
//not yet
|
||||
bool btConvexTriangleMeshShape::IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
bool btConvexTriangleMeshShape::isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
|
||||
@@ -17,27 +17,27 @@ class btConvexTriangleMeshShape : public btPolyhedralConvexShape
|
||||
public:
|
||||
btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface);
|
||||
|
||||
class btStridingMeshInterface* GetStridingMesh()
|
||||
class btStridingMeshInterface* getStridingMesh()
|
||||
{
|
||||
return m_stridingMesh;
|
||||
}
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual int GetShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "ConvexTrimesh";}
|
||||
virtual char* getName()const {return "ConvexTrimesh";}
|
||||
|
||||
virtual int GetNumVertices() const;
|
||||
virtual int GetNumEdges() const;
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const;
|
||||
virtual int GetNumPlanes() const;
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
virtual int getNumVertices() const;
|
||||
virtual int getNumEdges() const;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const;
|
||||
virtual int getNumPlanes() const;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
|
||||
|
||||
void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
@@ -151,45 +151,45 @@ const int ZZ = 1;
|
||||
|
||||
}
|
||||
|
||||
btVector3 btCylinderShapeX::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btCylinderShapeX::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return CylinderLocalSupportX(GetHalfExtents(),vec);
|
||||
return CylinderLocalSupportX(getHalfExtents(),vec);
|
||||
}
|
||||
|
||||
|
||||
btVector3 btCylinderShapeZ::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btCylinderShapeZ::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return CylinderLocalSupportZ(GetHalfExtents(),vec);
|
||||
return CylinderLocalSupportZ(getHalfExtents(),vec);
|
||||
}
|
||||
btVector3 btCylinderShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btCylinderShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return CylinderLocalSupportY(GetHalfExtents(),vec);
|
||||
return CylinderLocalSupportY(getHalfExtents(),vec);
|
||||
}
|
||||
|
||||
void btCylinderShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btCylinderShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = CylinderLocalSupportY(GetHalfExtents(),vectors[i]);
|
||||
supportVerticesOut[i] = CylinderLocalSupportY(getHalfExtents(),vectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void btCylinderShapeZ::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btCylinderShapeZ::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = CylinderLocalSupportZ(GetHalfExtents(),vectors[i]);
|
||||
supportVerticesOut[i] = CylinderLocalSupportZ(getHalfExtents(),vectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void btCylinderShapeX::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btCylinderShapeX::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = CylinderLocalSupportX(GetHalfExtents(),vectors[i]);
|
||||
supportVerticesOut[i] = CylinderLocalSupportX(getHalfExtents(),vectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,23 +28,23 @@ class btCylinderShape : public btBoxShape
|
||||
public:
|
||||
btCylinderShape (const btVector3& halfExtents);
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
GetAabbSlow(t,aabbMin,aabbMax);
|
||||
getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
|
||||
btVector3 supVertex;
|
||||
supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -52,32 +52,32 @@ public:
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
|
||||
//use box inertia
|
||||
// virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
// virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return CYLINDER_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual int GetUpAxis() const
|
||||
virtual int getUpAxis() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual float GetRadius() const
|
||||
virtual float getRadius() const
|
||||
{
|
||||
return GetHalfExtents().getX();
|
||||
return getHalfExtents().getX();
|
||||
}
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "CylinderY";
|
||||
}
|
||||
@@ -91,21 +91,21 @@ class btCylinderShapeX : public btCylinderShape
|
||||
public:
|
||||
btCylinderShapeX (const btVector3& halfExtents);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual int GetUpAxis() const
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual int getUpAxis() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "CylinderX";
|
||||
}
|
||||
|
||||
virtual float GetRadius() const
|
||||
virtual float getRadius() const
|
||||
{
|
||||
return GetHalfExtents().getY();
|
||||
return getHalfExtents().getY();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -115,22 +115,22 @@ class btCylinderShapeZ : public btCylinderShape
|
||||
public:
|
||||
btCylinderShapeZ (const btVector3& halfExtents);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual int GetUpAxis() const
|
||||
virtual int getUpAxis() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "CylinderZ";
|
||||
}
|
||||
|
||||
virtual float GetRadius() const
|
||||
virtual float getRadius() const
|
||||
{
|
||||
return GetHalfExtents().getX();
|
||||
return getHalfExtents().getX();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -29,10 +29,10 @@ btEmptyShape::~btEmptyShape()
|
||||
}
|
||||
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btEmptyShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 margin(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = t.getOrigin() - margin;
|
||||
|
||||
@@ -40,7 +40,7 @@ void btEmptyShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aa
|
||||
|
||||
}
|
||||
|
||||
void btEmptyShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btEmptyShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
virtual ~btEmptyShape();
|
||||
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling)
|
||||
@@ -50,12 +50,12 @@ public:
|
||||
return m_localScaling;
|
||||
}
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual int GetShapeType() const { return EMPTY_SHAPE_PROXYTYPE;}
|
||||
virtual int getShapeType() const { return EMPTY_SHAPE_PROXYTYPE;}
|
||||
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
@@ -24,32 +24,32 @@ m_shapeB(shapeB)
|
||||
m_transB.setIdentity();
|
||||
}
|
||||
|
||||
btVector3 btMinkowskiSumShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btMinkowskiSumShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertexA = m_transA(m_shapeA->LocalGetSupportingVertexWithoutMargin(vec*m_transA.getBasis()));
|
||||
btVector3 supVertexB = m_transB(m_shapeB->LocalGetSupportingVertexWithoutMargin(vec*m_transB.getBasis()));
|
||||
btVector3 supVertexA = m_transA(m_shapeA->localGetSupportingVertexWithoutMargin(vec*m_transA.getBasis()));
|
||||
btVector3 supVertexB = m_transB(m_shapeB->localGetSupportingVertexWithoutMargin(vec*m_transB.getBasis()));
|
||||
return supVertexA + supVertexB;
|
||||
}
|
||||
|
||||
void btMinkowskiSumShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btMinkowskiSumShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
//todo: could make recursive use of batching. probably this shape is not used frequently.
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = LocalGetSupportingVertexWithoutMargin(vectors[i]);
|
||||
supportVerticesOut[i] = localGetSupportingVertexWithoutMargin(vectors[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
float btMinkowskiSumShape::GetMargin() const
|
||||
float btMinkowskiSumShape::getMargin() const
|
||||
{
|
||||
return m_shapeA->GetMargin() + m_shapeB->GetMargin();
|
||||
return m_shapeA->getMargin() + m_shapeB->getMargin();
|
||||
}
|
||||
|
||||
|
||||
void btMinkowskiSumShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
assert(0);
|
||||
inertia.setValue(0,0,0);
|
||||
|
||||
@@ -32,28 +32,28 @@ public:
|
||||
|
||||
btMinkowskiSumShape(btConvexShape* shapeA,btConvexShape* shapeB);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
void SetTransformA(const btTransform& transA) { m_transA = transA;}
|
||||
void SetTransformB(const btTransform& transB) { m_transB = transB;}
|
||||
void setTransformA(const btTransform& transA) { m_transA = transA;}
|
||||
void setTransformB(const btTransform& transB) { m_transB = transB;}
|
||||
|
||||
const btTransform& GetTransformA()const { return m_transA;}
|
||||
const btTransform& getTransformA()const { return m_transA;}
|
||||
const btTransform& GetTransformB()const { return m_transB;}
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return MINKOWSKI_SUM_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return MINKOWSKI_SUM_SHAPE_PROXYTYPE; }
|
||||
|
||||
virtual float GetMargin() const;
|
||||
virtual float getMargin() const;
|
||||
|
||||
const btConvexShape* GetShapeA() const { return m_shapeA;}
|
||||
const btConvexShape* GetShapeB() const { return m_shapeB;}
|
||||
const btConvexShape* getShapeA() const { return m_shapeA;}
|
||||
const btConvexShape* getShapeB() const { return m_shapeB;}
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "MinkowskiSum";
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
||||
if (radi[i] < m_minRadius)
|
||||
m_minRadius = radi[i];
|
||||
}
|
||||
SetMargin(m_minRadius);
|
||||
setMargin(m_minRadius);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
btVector3 btMultiSphereShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btMultiSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
int i;
|
||||
btVector3 supVec(0,0,0);
|
||||
@@ -79,7 +79,7 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
||||
|
||||
}
|
||||
|
||||
void btMultiSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btMultiSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
|
||||
for (int j=0;j<numVectors;j++)
|
||||
@@ -116,7 +116,7 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
||||
|
||||
|
||||
|
||||
void btMultiSphereShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btMultiSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//as an approximation, take the inertia of the box that bounds the spheres
|
||||
|
||||
@@ -124,7 +124,7 @@ void btMultiSphereShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
ident.setIdentity();
|
||||
// btVector3 aabbMin,aabbMax;
|
||||
|
||||
// GetAabb(ident,aabbMin,aabbMax);
|
||||
// getAabb(ident,aabbMin,aabbMax);
|
||||
|
||||
btVector3 halfExtents = m_inertiaHalfExtents;//(aabbMax - aabbMin)* 0.5f;
|
||||
|
||||
|
||||
@@ -41,17 +41,17 @@ public:
|
||||
btMultiSphereShape (const btVector3& inertiaHalfExtents,const btVector3* positions,const btScalar* radi,int numSpheres);
|
||||
|
||||
///CollisionShape Interface
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
/// btConvexShape Interface
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "MultiSphere";
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
|
||||
void btOptimizedBvh::Build(btStridingMeshInterface* triangles)
|
||||
void btOptimizedBvh::build(btStridingMeshInterface* triangles)
|
||||
{
|
||||
//int countTriangles = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ void btOptimizedBvh::Build(btStridingMeshInterface* triangles)
|
||||
|
||||
}
|
||||
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
|
||||
btOptimizedBvhNode node;
|
||||
@@ -78,7 +78,7 @@ void btOptimizedBvh::Build(btStridingMeshInterface* triangles)
|
||||
m_contiguousNodes = new btOptimizedBvhNode[2*m_leafNodes.size()];
|
||||
m_curNodeIndex = 0;
|
||||
|
||||
m_rootNode1 = BuildTree(m_leafNodes,0,m_leafNodes.size());
|
||||
m_rootNode1 = buildTree(m_leafNodes,0,m_leafNodes.size());
|
||||
|
||||
|
||||
///create the leafnodes first
|
||||
@@ -91,7 +91,7 @@ btOptimizedBvh::~btOptimizedBvh()
|
||||
delete m_contiguousNodes;
|
||||
}
|
||||
|
||||
btOptimizedBvhNode* btOptimizedBvh::BuildTree (NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
btOptimizedBvhNode* btOptimizedBvh::buildTree (NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
{
|
||||
btOptimizedBvhNode* internalNode;
|
||||
|
||||
@@ -107,9 +107,9 @@ btOptimizedBvhNode* btOptimizedBvh::BuildTree (NodeArray& leafNodes,int startInd
|
||||
}
|
||||
//calculate Best Splitting Axis and where to split it. Sort the incoming 'leafNodes' array within range 'startIndex/endIndex'.
|
||||
|
||||
splitAxis = CalcSplittingAxis(leafNodes,startIndex,endIndex);
|
||||
splitAxis = calcSplittingAxis(leafNodes,startIndex,endIndex);
|
||||
|
||||
splitIndex = SortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis);
|
||||
splitIndex = sortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis);
|
||||
|
||||
internalNode = &m_contiguousNodes[m_curNodeIndex++];
|
||||
|
||||
@@ -125,14 +125,14 @@ btOptimizedBvhNode* btOptimizedBvh::BuildTree (NodeArray& leafNodes,int startInd
|
||||
|
||||
|
||||
//internalNode->m_escapeIndex;
|
||||
internalNode->m_leftChild = BuildTree(leafNodes,startIndex,splitIndex);
|
||||
internalNode->m_rightChild = BuildTree(leafNodes,splitIndex,endIndex);
|
||||
internalNode->m_leftChild = buildTree(leafNodes,startIndex,splitIndex);
|
||||
internalNode->m_rightChild = buildTree(leafNodes,splitIndex,endIndex);
|
||||
|
||||
internalNode->m_escapeIndex = m_curNodeIndex - curIndex;
|
||||
return internalNode;
|
||||
}
|
||||
|
||||
int btOptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis)
|
||||
int btOptimizedBvh::sortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis)
|
||||
{
|
||||
int i;
|
||||
int splitIndex =startIndex;
|
||||
@@ -170,7 +170,7 @@ int btOptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startInde
|
||||
}
|
||||
|
||||
|
||||
int btOptimizedBvh::CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
int btOptimizedBvh::calcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -199,16 +199,16 @@ int btOptimizedBvh::CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int en
|
||||
|
||||
|
||||
|
||||
void btOptimizedBvh::ReportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
//either choose recursive traversal (WalkTree) or stackless (WalkStacklessTree)
|
||||
//either choose recursive traversal (walkTree) or stackless (walkStacklessTree)
|
||||
|
||||
//WalkTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
//walkTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
|
||||
WalkStacklessTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
walkStacklessTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
void btOptimizedBvh::WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::walkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
bool isLeafNode, aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax);
|
||||
if (aabbOverlap)
|
||||
@@ -216,11 +216,11 @@ void btOptimizedBvh::WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback
|
||||
isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild);
|
||||
if (isLeafNode)
|
||||
{
|
||||
nodeCallback->ProcessNode(rootNode);
|
||||
nodeCallback->processNode(rootNode);
|
||||
} else
|
||||
{
|
||||
WalkTree(rootNode->m_leftChild,nodeCallback,aabbMin,aabbMax);
|
||||
WalkTree(rootNode->m_rightChild,nodeCallback,aabbMin,aabbMax);
|
||||
walkTree(rootNode->m_leftChild,nodeCallback,aabbMin,aabbMax);
|
||||
walkTree(rootNode->m_rightChild,nodeCallback,aabbMin,aabbMax);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void btOptimizedBvh::WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback
|
||||
|
||||
int maxIterations = 0;
|
||||
|
||||
void btOptimizedBvh::WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::walkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
int escapeIndex, curIndex = 0;
|
||||
int walkIterations = 0;
|
||||
@@ -245,7 +245,7 @@ void btOptimizedBvh::WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverla
|
||||
|
||||
if (isLeafNode && aabbOverlap)
|
||||
{
|
||||
nodeCallback->ProcessNode(rootNode);
|
||||
nodeCallback->processNode(rootNode);
|
||||
}
|
||||
|
||||
if (aabbOverlap || isLeafNode)
|
||||
@@ -267,7 +267,7 @@ void btOptimizedBvh::WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverla
|
||||
}
|
||||
|
||||
|
||||
void btOptimizedBvh::ReportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::reportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class btNodeOverlapCallback
|
||||
public:
|
||||
virtual ~btNodeOverlapCallback() {};
|
||||
|
||||
virtual void ProcessNode(const btOptimizedBvhNode* node) = 0;
|
||||
virtual void processNode(const btOptimizedBvhNode* node) = 0;
|
||||
};
|
||||
|
||||
typedef std::vector<btOptimizedBvhNode> NodeArray;
|
||||
@@ -71,26 +71,26 @@ public:
|
||||
btOptimizedBvh() :m_rootNode1(0), m_numNodes(0) { }
|
||||
virtual ~btOptimizedBvh();
|
||||
|
||||
void Build(btStridingMeshInterface* triangles);
|
||||
void build(btStridingMeshInterface* triangles);
|
||||
|
||||
btOptimizedBvhNode* BuildTree (NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
btOptimizedBvhNode* buildTree (NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
|
||||
int CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
int calcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
|
||||
int SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis);
|
||||
int sortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis);
|
||||
|
||||
void WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void walkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
void WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void walkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
|
||||
//OptimizedBvhNode* GetRootNode() { return m_rootNode1;}
|
||||
|
||||
int GetNumNodes() { return m_numNodes;}
|
||||
int getNumNodes() { return m_numNodes;}
|
||||
|
||||
void ReportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
void ReportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void reportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ btPolyhedralConvexShape::btPolyhedralConvexShape()
|
||||
|
||||
|
||||
|
||||
btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btPolyhedralConvexShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
int i;
|
||||
btVector3 supVec(0,0,0);
|
||||
@@ -44,9 +44,9 @@ btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const b
|
||||
btVector3 vtx;
|
||||
btScalar newDot;
|
||||
|
||||
for (i=0;i<GetNumVertices();i++)
|
||||
for (i=0;i<getNumVertices();i++)
|
||||
{
|
||||
GetVertex(i,vtx);
|
||||
getVertex(i,vtx);
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const b
|
||||
|
||||
}
|
||||
|
||||
void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btPolyhedralConvexShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -76,9 +76,9 @@ void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(
|
||||
|
||||
const btVector3& vec = vectors[j];
|
||||
|
||||
for (i=0;i<GetNumVertices();i++)
|
||||
for (i=0;i<getNumVertices();i++)
|
||||
{
|
||||
GetVertex(i,vtx);
|
||||
getVertex(i,vtx);
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > supportVerticesOut[j][3])
|
||||
{
|
||||
@@ -92,16 +92,16 @@ void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(
|
||||
|
||||
|
||||
|
||||
void btPolyhedralConvexShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//not yet, return box inertia
|
||||
|
||||
float margin = GetMargin();
|
||||
float margin = getMargin();
|
||||
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(ident,aabbMin,aabbMax);
|
||||
getAabb(ident,aabbMin,aabbMax);
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
btScalar lx=2.f*(halfExtents.x()+margin);
|
||||
|
||||
@@ -30,22 +30,22 @@ public:
|
||||
btPolyhedralConvexShape();
|
||||
|
||||
//brute force implementations
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
|
||||
|
||||
virtual int GetNumVertices() const = 0 ;
|
||||
virtual int GetNumEdges() const = 0;
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const = 0;
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const = 0;
|
||||
virtual int GetNumPlanes() const = 0;
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const = 0;
|
||||
// virtual int GetIndex(int i) const = 0 ;
|
||||
virtual int getNumVertices() const = 0 ;
|
||||
virtual int getNumEdges() const = 0;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const = 0;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const = 0;
|
||||
virtual int getNumPlanes() const = 0;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const = 0;
|
||||
// virtual int getIndex(int i) const = 0 ;
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const = 0;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const = 0;
|
||||
|
||||
/// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp
|
||||
class Hull* m_optionalHull;
|
||||
|
||||
@@ -24,12 +24,12 @@ btSphereShape ::btSphereShape (btScalar radius)
|
||||
{
|
||||
}
|
||||
|
||||
btVector3 btSphereShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return btVector3(0.f,0.f,0.f);
|
||||
}
|
||||
|
||||
void btSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
@@ -38,10 +38,10 @@ void btSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVe
|
||||
}
|
||||
|
||||
|
||||
btVector3 btSphereShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btSphereShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex;
|
||||
supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -49,25 +49,25 @@ btVector3 btSphereShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
|
||||
//broken due to scaling
|
||||
void btSphereShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
const btVector3& center = t.getOrigin();
|
||||
btVector3 extent(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 extent(getMargin(),getMargin(),getMargin());
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btSphereShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
btScalar elem = 0.4f * mass * GetMargin()*GetMargin();
|
||||
btScalar elem = 0.4f * mass * getMargin()*getMargin();
|
||||
inertia[0] = inertia[1] = inertia[2] = elem;
|
||||
|
||||
}
|
||||
|
||||
@@ -29,32 +29,32 @@ public:
|
||||
btSphereShape (btScalar radius);
|
||||
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
//notice that the vectors should be unit length
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual int GetShapeType() const { return SPHERE_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return SPHERE_SHAPE_PROXYTYPE; }
|
||||
|
||||
btScalar GetRadius() const { return m_radius;}
|
||||
btScalar getRadius() const { return m_radius;}
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "SPHERE";}
|
||||
virtual char* getName()const {return "SPHERE";}
|
||||
|
||||
virtual void SetMargin(float margin)
|
||||
virtual void setMargin(float margin)
|
||||
{
|
||||
btConvexShape::SetMargin(margin);
|
||||
btConvexShape::setMargin(margin);
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
virtual float getMargin() const
|
||||
{
|
||||
//to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case
|
||||
//this means, non-uniform scaling is not supported anymore
|
||||
return m_localScaling[0] * m_radius + btConvexShape::GetMargin();
|
||||
return m_localScaling[0] * m_radius + btConvexShape::getMargin();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ btStaticPlaneShape::~btStaticPlaneShape()
|
||||
|
||||
|
||||
|
||||
void btStaticPlaneShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btStaticPlaneShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 infvec (1e30f,1e30f,1e30f);
|
||||
|
||||
@@ -50,7 +50,7 @@ void btStaticPlaneShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVecto
|
||||
|
||||
|
||||
|
||||
void btStaticPlaneShape::ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btStaticPlaneShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
btVector3 halfExtents = (aabbMax - aabbMin) * 0.5f;
|
||||
@@ -73,17 +73,17 @@ void btStaticPlaneShape::ProcessAllTriangles(btTriangleCallback* callback,const
|
||||
triangle[1] = projectedCenter + tangentDir0*radius - tangentDir1*radius;
|
||||
triangle[2] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
|
||||
|
||||
callback->ProcessTriangle(triangle,0,0);
|
||||
callback->processTriangle(triangle,0,0);
|
||||
|
||||
triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
|
||||
triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius;
|
||||
triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius;
|
||||
|
||||
callback->ProcessTriangle(triangle,0,1);
|
||||
callback->processTriangle(triangle,0,1);
|
||||
|
||||
}
|
||||
|
||||
void btStaticPlaneShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btStaticPlaneShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//moving concave objects not supported
|
||||
|
||||
|
||||
@@ -37,23 +37,23 @@ public:
|
||||
virtual ~btStaticPlaneShape();
|
||||
|
||||
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return STATIC_PLANE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
virtual const btVector3& getLocalScaling() const;
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "STATICPLANE";}
|
||||
virtual char* getName()const {return "STATICPLANE";}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde
|
||||
triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
|
||||
triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
callback->InternalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
callback->internalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde
|
||||
triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
|
||||
triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
callback->InternalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
callback->internalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,49 +24,49 @@ btBU_Simplex1to4::btBU_Simplex1to4()
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
addVertex(pt0);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
AddVertex(pt1);
|
||||
addVertex(pt0);
|
||||
addVertex(pt1);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1,const btPoint3& pt2)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
AddVertex(pt1);
|
||||
AddVertex(pt2);
|
||||
addVertex(pt0);
|
||||
addVertex(pt1);
|
||||
addVertex(pt2);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1,const btPoint3& pt2,const btPoint3& pt3)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
AddVertex(pt1);
|
||||
AddVertex(pt2);
|
||||
AddVertex(pt3);
|
||||
addVertex(pt0);
|
||||
addVertex(pt1);
|
||||
addVertex(pt2);
|
||||
addVertex(pt3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void btBU_Simplex1to4::AddVertex(const btPoint3& pt)
|
||||
void btBU_Simplex1to4::addVertex(const btPoint3& pt)
|
||||
{
|
||||
m_vertices[m_numVertices++] = pt;
|
||||
}
|
||||
|
||||
|
||||
int btBU_Simplex1to4::GetNumVertices() const
|
||||
int btBU_Simplex1to4::getNumVertices() const
|
||||
{
|
||||
return m_numVertices;
|
||||
}
|
||||
|
||||
int btBU_Simplex1to4::GetNumEdges() const
|
||||
int btBU_Simplex1to4::getNumEdges() const
|
||||
{
|
||||
//euler formula, F-E+V = 2, so E = F+V-2
|
||||
|
||||
@@ -85,7 +85,7 @@ int btBU_Simplex1to4::GetNumEdges() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btBU_Simplex1to4::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
void btBU_Simplex1to4::getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
|
||||
switch (m_numVertices)
|
||||
@@ -149,12 +149,12 @@ void btBU_Simplex1to4::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
|
||||
}
|
||||
|
||||
void btBU_Simplex1to4::GetVertex(int i,btPoint3& vtx) const
|
||||
void btBU_Simplex1to4::getVertex(int i,btPoint3& vtx) const
|
||||
{
|
||||
vtx = m_vertices[i];
|
||||
}
|
||||
|
||||
int btBU_Simplex1to4::GetNumPlanes() const
|
||||
int btBU_Simplex1to4::getNumPlanes() const
|
||||
{
|
||||
switch (m_numVertices)
|
||||
{
|
||||
@@ -176,17 +176,17 @@ int btBU_Simplex1to4::GetNumPlanes() const
|
||||
}
|
||||
|
||||
|
||||
void btBU_Simplex1to4::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
void btBU_Simplex1to4::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int btBU_Simplex1to4::GetIndex(int i) const
|
||||
int btBU_Simplex1to4::getIndex(int i) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool btBU_Simplex1to4::IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
bool btBU_Simplex1to4::isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,37 +38,37 @@ public:
|
||||
btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1,const btPoint3& pt2,const btPoint3& pt3);
|
||||
|
||||
|
||||
void Reset()
|
||||
void reset()
|
||||
{
|
||||
m_numVertices = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual int GetShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; }
|
||||
|
||||
void AddVertex(const btPoint3& pt);
|
||||
void addVertex(const btPoint3& pt);
|
||||
|
||||
//PolyhedralConvexShape interface
|
||||
|
||||
virtual int GetNumVertices() const;
|
||||
virtual int getNumVertices() const;
|
||||
|
||||
virtual int GetNumEdges() const;
|
||||
virtual int getNumEdges() const;
|
||||
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const;
|
||||
|
||||
virtual int GetNumPlanes() const;
|
||||
virtual int getNumPlanes() const;
|
||||
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const;
|
||||
|
||||
virtual int GetIndex(int i) const;
|
||||
virtual int getIndex(int i) const;
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
|
||||
|
||||
///GetName is for debugging
|
||||
virtual char* GetName()const { return "btBU_Simplex1to4";}
|
||||
///getName is for debugging
|
||||
virtual char* getName()const { return "btBU_Simplex1to4";}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class btTriangleCallback
|
||||
public:
|
||||
|
||||
virtual ~btTriangleCallback();
|
||||
virtual void ProcessTriangle(btVector3* triangle, int partId, int triangleIndex) = 0;
|
||||
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) = 0;
|
||||
};
|
||||
|
||||
class btInternalTriangleIndexCallback
|
||||
@@ -32,7 +32,7 @@ class btInternalTriangleIndexCallback
|
||||
public:
|
||||
|
||||
virtual ~btInternalTriangleIndexCallback();
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0;
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* tri
|
||||
mesh.m_vertexBase = vertexBase;
|
||||
mesh.m_vertexStride = vertexStride;
|
||||
|
||||
AddIndexedMesh(mesh);
|
||||
addIndexedMesh(mesh);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct btIndexedMesh
|
||||
};
|
||||
|
||||
///TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays.
|
||||
///Additional meshes can be added using AddIndexedMesh
|
||||
///Additional meshes can be added using addIndexedMesh
|
||||
///No duplcate is made of the vertex/index data, it only indexes into external vertex/index arrays.
|
||||
///So keep those arrays around during the lifetime of this btTriangleIndexVertexArray.
|
||||
class btTriangleIndexVertexArray : public btStridingMeshInterface
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
//just to be backwards compatible
|
||||
btTriangleIndexVertexArray(int numTriangleIndices,int* triangleIndexBase,int triangleIndexStride,int numVertices,float* vertexBase,int vertexStride);
|
||||
|
||||
void AddIndexedMesh(const btIndexedMesh& mesh)
|
||||
void addIndexedMesh(const btIndexedMesh& mesh)
|
||||
{
|
||||
m_indexedMeshes.push_back(mesh);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class btTriangleMesh : public btStridingMeshInterface
|
||||
public:
|
||||
btTriangleMesh ();
|
||||
|
||||
void AddTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2)
|
||||
void addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2)
|
||||
{
|
||||
btMyTriangle tri;
|
||||
tri.m_vert0 = vertex0;
|
||||
|
||||
@@ -25,7 +25,7 @@ subject to the following restrictions:
|
||||
btTriangleMeshShape::btTriangleMeshShape(btStridingMeshInterface* meshInterface)
|
||||
: m_meshInterface(meshInterface)
|
||||
{
|
||||
RecalcLocalAabb();
|
||||
recalcLocalAabb();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ btTriangleMeshShape::~btTriangleMeshShape()
|
||||
|
||||
|
||||
|
||||
void btTriangleMeshShape::GetAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btTriangleMeshShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
btVector3 localHalfExtents = 0.5f*(m_localAabbMax-m_localAabbMin);
|
||||
@@ -50,7 +50,7 @@ void btTriangleMeshShape::GetAabb(const btTransform& trans,btVector3& aabbMin,bt
|
||||
btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
|
||||
abs_b[1].dot(localHalfExtents),
|
||||
abs_b[2].dot(localHalfExtents));
|
||||
extent += btVector3(GetMargin(),GetMargin(),GetMargin());
|
||||
extent += btVector3(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
@@ -58,16 +58,16 @@ void btTriangleMeshShape::GetAabb(const btTransform& trans,btVector3& aabbMin,bt
|
||||
|
||||
}
|
||||
|
||||
void btTriangleMeshShape::RecalcLocalAabb()
|
||||
void btTriangleMeshShape::recalcLocalAabb()
|
||||
{
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
btVector3 vec(0.f,0.f,0.f);
|
||||
vec[i] = 1.f;
|
||||
btVector3 tmp = LocalGetSupportingVertex(vec);
|
||||
btVector3 tmp = localGetSupportingVertex(vec);
|
||||
m_localAabbMax[i] = tmp[i]+m_collisionMargin;
|
||||
vec[i] = -1.f;
|
||||
tmp = LocalGetSupportingVertex(vec);
|
||||
tmp = localGetSupportingVertex(vec);
|
||||
m_localAabbMin[i] = tmp[i]-m_collisionMargin;
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
m_supportVecLocal = supportVecWorld * m_worldTrans.getBasis();
|
||||
}
|
||||
|
||||
virtual void ProcessTriangle( btVector3* triangle,int partId, int triangleIndex)
|
||||
virtual void processTriangle( btVector3* triangle,int partId, int triangleIndex)
|
||||
{
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
void btTriangleMeshShape::setLocalScaling(const btVector3& scaling)
|
||||
{
|
||||
m_meshInterface->setScaling(scaling);
|
||||
RecalcLocalAabb();
|
||||
recalcLocalAabb();
|
||||
}
|
||||
|
||||
const btVector3& btTriangleMeshShape::getLocalScaling() const
|
||||
@@ -136,7 +136,7 @@ const btVector3& btTriangleMeshShape::getLocalScaling() const
|
||||
//#define DEBUG_TRIANGLE_MESH
|
||||
|
||||
|
||||
void btTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
struct FilteredCallback : public btInternalTriangleIndexCallback
|
||||
@@ -152,12 +152,12 @@ void btTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const
|
||||
{
|
||||
}
|
||||
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
if (TestTriangleAgainstAabb2(&triangle[0],m_aabbMin,m_aabbMax))
|
||||
{
|
||||
//check aabb in triangle-space, before doing this
|
||||
m_callback->ProcessTriangle(triangle,partId,triangleIndex);
|
||||
m_callback->processTriangle(triangle,partId,triangleIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void btTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const
|
||||
|
||||
|
||||
|
||||
void btTriangleMeshShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//moving concave objects not supported
|
||||
assert(0);
|
||||
@@ -182,7 +182,7 @@ void btTriangleMeshShape::CalculateLocalInertia(btScalar mass,btVector3& inertia
|
||||
}
|
||||
|
||||
|
||||
btVector3 btTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec) const
|
||||
btVector3 btTriangleMeshShape::localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
btVector3 supportVertex;
|
||||
|
||||
@@ -193,7 +193,7 @@ btVector3 btTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec) co
|
||||
|
||||
btVector3 aabbMax(1e30f,1e30f,1e30f);
|
||||
|
||||
ProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
|
||||
processAllTriangles(&supportCallback,-aabbMax,aabbMax);
|
||||
|
||||
supportVertex = supportCallback.GetSupportVertexLocal();
|
||||
|
||||
|
||||
@@ -34,33 +34,33 @@ public:
|
||||
|
||||
virtual ~btTriangleMeshShape();
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const;
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
assert(0);
|
||||
return LocalGetSupportingVertex(vec);
|
||||
return localGetSupportingVertex(vec);
|
||||
}
|
||||
|
||||
void RecalcLocalAabb();
|
||||
void recalcLocalAabb();
|
||||
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return TRIANGLE_MESH_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
virtual const btVector3& getLocalScaling() const;
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "TRIANGLEMESH";}
|
||||
virtual char* getName()const {return "TRIANGLEMESH";}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -28,49 +28,49 @@ public:
|
||||
btVector3 m_vertices1[3];
|
||||
|
||||
|
||||
virtual int GetNumVertices() const
|
||||
virtual int getNumVertices() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
const btVector3& GetVertexPtr(int index) const
|
||||
const btVector3& getVertexPtr(int index) const
|
||||
{
|
||||
return m_vertices1[index];
|
||||
}
|
||||
virtual void GetVertex(int index,btVector3& vert) const
|
||||
virtual void getVertex(int index,btVector3& vert) const
|
||||
{
|
||||
vert = m_vertices1[index];
|
||||
}
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return TRIANGLE_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual int GetNumEdges() const
|
||||
virtual int getNumEdges() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
GetVertex(i,pa);
|
||||
GetVertex((i+1)%3,pb);
|
||||
getVertex(i,pa);
|
||||
getVertex((i+1)%3,pb);
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax)const
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax)const
|
||||
{
|
||||
// ASSERT(0);
|
||||
GetAabbSlow(t,aabbMin,aabbMax);
|
||||
getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& dir)const
|
||||
btVector3 localGetSupportingVertexWithoutMargin(const btVector3& dir)const
|
||||
{
|
||||
btVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
|
||||
return m_vertices1[dots.maxAxis()];
|
||||
|
||||
}
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
@@ -92,38 +92,38 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
{
|
||||
GetPlaneEquation(i,planeNormal,planeSupport);
|
||||
getPlaneEquation(i,planeNormal,planeSupport);
|
||||
}
|
||||
|
||||
virtual int GetNumPlanes() const
|
||||
virtual int getNumPlanes() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CalcNormal(btVector3& normal) const
|
||||
void calcNormal(btVector3& normal) const
|
||||
{
|
||||
normal = (m_vertices1[1]-m_vertices1[0]).cross(m_vertices1[2]-m_vertices1[0]);
|
||||
normal.normalize();
|
||||
}
|
||||
|
||||
virtual void GetPlaneEquation(int i, btVector3& planeNormal,btPoint3& planeSupport) const
|
||||
virtual void getPlaneEquation(int i, btVector3& planeNormal,btPoint3& planeSupport) const
|
||||
{
|
||||
CalcNormal(planeNormal);
|
||||
calcNormal(planeNormal);
|
||||
planeSupport = m_vertices1[0];
|
||||
}
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
ASSERT(0);
|
||||
inertia.setValue(0.f,0.f,0.f);
|
||||
}
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
btVector3 normal;
|
||||
CalcNormal(normal);
|
||||
calcNormal(normal);
|
||||
//distance to plane
|
||||
btScalar dist = pt.dot(normal);
|
||||
btScalar planeconst = m_vertices1[0].dot(normal);
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
btPoint3 pa,pb;
|
||||
GetEdge(i,pa,pb);
|
||||
getEdge(i,pa,pb);
|
||||
btVector3 edge = pb-pa;
|
||||
btVector3 edgeNormal = edge.cross(normal);
|
||||
edgeNormal.normalize();
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Triangle";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user