+ 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:
@@ -16,20 +16,20 @@ subject to the following restrictions:
|
||||
#include "btTetrahedronShape.h"
|
||||
#include "LinearMath/btMatrix3x3.h"
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4() : btPolyhedralConvexShape (),
|
||||
btBU_Simplex1to4::btBU_Simplex1to4() : btPolyhedralConvexAabbCachingShape (),
|
||||
m_numVertices(0)
|
||||
{
|
||||
m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0) : btPolyhedralConvexShape (),
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0) : btPolyhedralConvexAabbCachingShape (),
|
||||
m_numVertices(0)
|
||||
{
|
||||
m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
|
||||
addVertex(pt0);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1) : btPolyhedralConvexShape (),
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1) : btPolyhedralConvexAabbCachingShape (),
|
||||
m_numVertices(0)
|
||||
{
|
||||
m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
|
||||
@@ -37,7 +37,7 @@ m_numVertices(0)
|
||||
addVertex(pt1);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2) : btPolyhedralConvexShape (),
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2) : btPolyhedralConvexAabbCachingShape (),
|
||||
m_numVertices(0)
|
||||
{
|
||||
m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
|
||||
@@ -46,7 +46,7 @@ m_numVertices(0)
|
||||
addVertex(pt2);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2,const btVector3& pt3) : btPolyhedralConvexShape (),
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2,const btVector3& pt3) : btPolyhedralConvexAabbCachingShape (),
|
||||
m_numVertices(0)
|
||||
{
|
||||
m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
|
||||
@@ -57,13 +57,31 @@ m_numVertices(0)
|
||||
}
|
||||
|
||||
|
||||
void btBU_Simplex1to4::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
#if 1
|
||||
btPolyhedralConvexAabbCachingShape::getAabb(t,aabbMin,aabbMax);
|
||||
#else
|
||||
aabbMin.setValue(1e30f,1e30f,1e30f);
|
||||
aabbMax.setValue(-1e30f,-1e30f,-1e30f);
|
||||
|
||||
//just transform the vertices in worldspace, and take their AABB
|
||||
for (int i=0;i<m_numVertices;i++)
|
||||
{
|
||||
btVector3 worldVertex = t(m_vertices[i]);
|
||||
aabbMin.setMin(worldVertex);
|
||||
aabbMax.setMax(worldVertex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void btBU_Simplex1to4::addVertex(const btVector3& pt)
|
||||
{
|
||||
m_vertices[m_numVertices++] = pt;
|
||||
|
||||
recalcLocalAabb();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user