+ 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,6 +17,7 @@ subject to the following restrictions:
|
||||
#define BT_CONVEX_INTERNAL_SHAPE_H
|
||||
|
||||
#include "btConvexShape.h"
|
||||
#include "LinearMath/btAabbUtil2.h"
|
||||
|
||||
///The btConvexInternalShape is an internal base class, shared by most convex shape implementations.
|
||||
class btConvexInternalShape : public btConvexShape
|
||||
@@ -104,4 +105,47 @@ public:
|
||||
};
|
||||
|
||||
|
||||
///btConvexInternalAabbCachingShape adds local aabb caching for convex shapes, to avoid expensive bounding box calculations
|
||||
class btConvexInternalAabbCachingShape : public btConvexInternalShape
|
||||
{
|
||||
btVector3 m_localAabbMin;
|
||||
btVector3 m_localAabbMax;
|
||||
bool m_isLocalAabbValid;
|
||||
|
||||
protected:
|
||||
|
||||
btConvexInternalAabbCachingShape();
|
||||
|
||||
void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
|
||||
{
|
||||
m_isLocalAabbValid = true;
|
||||
m_localAabbMin = aabbMin;
|
||||
m_localAabbMax = aabbMax;
|
||||
}
|
||||
|
||||
inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
|
||||
{
|
||||
btAssert(m_isLocalAabbValid);
|
||||
aabbMin = m_localAabbMin;
|
||||
aabbMax = m_localAabbMax;
|
||||
}
|
||||
|
||||
inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
|
||||
{
|
||||
|
||||
//lazy evaluation of local aabb
|
||||
btAssert(m_isLocalAabbValid);
|
||||
btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
void recalcLocalAabb();
|
||||
|
||||
};
|
||||
|
||||
#endif //BT_CONVEX_INTERNAL_SHAPE_H
|
||||
|
||||
Reference in New Issue
Block a user