+ Internal improvements for collision shapes
1) add AabbCaching versions of btPolyhedralConvexShape and btMultiSphereShape (this speeds up btMultiSphereShape 'getAabb', and reduces size of btBoxShape) 2) btCylinderShape doesn't derive from btBoxShape anymore + Minor fixes in drawing for btMultiSphereShape, btBoxShape. + Don't re-generate btDebugFont every frame + Disabled velocity prediction for btDbvtBroadphase. Previous default can be restored using btDbvtBroadphase->setVelocityPrediction(1./2.);
This commit is contained in:
@@ -17,7 +17,6 @@ subject to the following restrictions:
|
||||
#define BU_SHAPE
|
||||
|
||||
#include "LinearMath/btMatrix3x3.h"
|
||||
#include "LinearMath/btAabbUtil2.h"
|
||||
#include "btConvexInternalShape.h"
|
||||
|
||||
|
||||
@@ -26,10 +25,7 @@ class btPolyhedralConvexShape : public btConvexInternalShape
|
||||
{
|
||||
|
||||
protected:
|
||||
btVector3 m_localAabbMin;
|
||||
btVector3 m_localAabbMax;
|
||||
bool m_isLocalAabbValid;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
btPolyhedralConvexShape();
|
||||
@@ -38,10 +34,32 @@ public:
|
||||
|
||||
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) const;
|
||||
|
||||
|
||||
virtual int getNumVertices() const = 0 ;
|
||||
virtual int getNumEdges() const = 0;
|
||||
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0;
|
||||
virtual void getVertex(int i,btVector3& vtx) const = 0;
|
||||
virtual int getNumPlanes() const = 0;
|
||||
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const = 0;
|
||||
// virtual int getIndex(int i) const = 0 ;
|
||||
|
||||
virtual bool isInside(const btVector3& pt,btScalar tolerance) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
///The btPolyhedralConvexAabbCachingShape adds aabb caching to the btPolyhedralConvexShape
|
||||
class btPolyhedralConvexAabbCachingShape : public btPolyhedralConvexShape
|
||||
{
|
||||
|
||||
btVector3 m_localAabbMin;
|
||||
btVector3 m_localAabbMax;
|
||||
bool m_isLocalAabbValid;
|
||||
|
||||
protected:
|
||||
|
||||
void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
|
||||
{
|
||||
@@ -57,6 +75,10 @@ public:
|
||||
aabbMax = m_localAabbMax;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
btPolyhedralConvexAabbCachingShape();
|
||||
|
||||
inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
|
||||
{
|
||||
|
||||
@@ -65,26 +87,12 @@ public:
|
||||
btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
void recalcLocalAabb();
|
||||
|
||||
virtual int getNumVertices() const = 0 ;
|
||||
virtual int getNumEdges() const = 0;
|
||||
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0;
|
||||
virtual void getVertex(int i,btVector3& vtx) const = 0;
|
||||
virtual int getNumPlanes() const = 0;
|
||||
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const = 0;
|
||||
// virtual int getIndex(int i) const = 0 ;
|
||||
|
||||
virtual bool isInside(const btVector3& pt,btScalar tolerance) const = 0;
|
||||
|
||||
/// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp
|
||||
class Hull* m_optionalHull;
|
||||
|
||||
};
|
||||
|
||||
#endif //BU_SHAPE
|
||||
|
||||
Reference in New Issue
Block a user