some minor comment-renames, and moved some data from box/sphere into common convex.
This commit is contained in:
@@ -181,7 +181,7 @@ bool SimulationIsland::Simulate(btIDebugDraw* debugDrawer,int numSolverIteration
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//OverlappingPairCache* scene = getCollisionWorld()->getPairCache();
|
//btOverlappingPairCache* scene = getCollisionWorld()->getPairCache();
|
||||||
|
|
||||||
btContactSolverInfo solverInfo;
|
btContactSolverInfo solverInfo;
|
||||||
|
|
||||||
@@ -449,10 +449,13 @@ void SimulationIsland::UpdateAabbs(btIDebugDraw* debugDrawer,btBroadphaseInterfa
|
|||||||
if (reportMe)
|
if (reportMe)
|
||||||
{
|
{
|
||||||
reportMe = false;
|
reportMe = false;
|
||||||
|
assert(0);
|
||||||
|
/*
|
||||||
printf("Overflow in AABB, object removed from simulation \n");
|
printf("Overflow in AABB, object removed from simulation \n");
|
||||||
printf("If you can reproduce this, please email bugs@continuousphysics.com\n");
|
printf("If you can reproduce this, please email bugs@continuousphysics.com\n");
|
||||||
printf("Please include above information, your Platform, version of OS.\n");
|
printf("Please include above information, your Platform, version of OS.\n");
|
||||||
printf("Thanks.\n");
|
printf("Thanks.\n");
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ CONCAVE_SHAPES_END_HERE,
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///BroadphaseProxy
|
///btBroadphaseProxy
|
||||||
struct btBroadphaseProxy
|
struct btBroadphaseProxy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ struct btCollisionAlgorithmConstructionInfo
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///CollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatcher.
|
///btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatcher.
|
||||||
///It is persistent over frames
|
///It is persistent over frames
|
||||||
class btCollisionAlgorithm
|
class btCollisionAlgorithm
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ virtual ~btOverlapCallback()
|
|||||||
virtual bool processOverlap(btBroadphasePair& pair) = 0;
|
virtual bool processOverlap(btBroadphasePair& pair) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
///OverlappingPairCache maintains the objects with overlapping AABB
|
///btOverlappingPairCache maintains the objects with overlapping AABB
|
||||||
///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
|
///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
|
||||||
class btOverlappingPairCache : public btBroadphaseInterface
|
class btOverlappingPairCache : public btBroadphaseInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class btOverlappingPairCache;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///CollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
|
///btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
|
||||||
///Time of Impact, Closest Points and Penetration Depth.
|
///Time of Impact, Closest Points and Penetration Depth.
|
||||||
class btCollisionDispatcher : public btDispatcher
|
class btCollisionDispatcher : public btDispatcher
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ extern ContactAddedCallback gContactAddedCallback;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///ManifoldResult is a helper class to manage contact results.
|
///btManifoldResult is a helper class to manage contact results.
|
||||||
class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result
|
class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result
|
||||||
{
|
{
|
||||||
btPersistentManifold* m_manifoldPtr;
|
btPersistentManifold* m_manifoldPtr;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
btVector3 btBoxShape::getHalfExtents() const
|
btVector3 btBoxShape::getHalfExtents() const
|
||||||
{
|
{
|
||||||
return m_boxHalfExtents1 * m_localScaling;
|
return m_implicitShapeDimensions * m_localScaling;
|
||||||
}
|
}
|
||||||
//{
|
//{
|
||||||
|
|
||||||
|
|||||||
@@ -22,21 +22,17 @@ subject to the following restrictions:
|
|||||||
#include "LinearMath/btPoint3.h"
|
#include "LinearMath/btPoint3.h"
|
||||||
#include "LinearMath/btSimdMinMax.h"
|
#include "LinearMath/btSimdMinMax.h"
|
||||||
|
|
||||||
///BoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box
|
///btBoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box
|
||||||
class btBoxShape: public btPolyhedralConvexShape
|
class btBoxShape: public btPolyhedralConvexShape
|
||||||
{
|
{
|
||||||
|
|
||||||
btVector3 m_boxHalfExtents1;
|
//btVector3 m_boxHalfExtents1; //use m_implicitShapeDimensions instead
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
btVector3 getHalfExtents() const;
|
btVector3 getHalfExtents() const;
|
||||||
//{ return m_boxHalfExtents1 * m_localScaling;}
|
|
||||||
//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
|
||||||
@@ -81,7 +77,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
btBoxShape( const btVector3& boxHalfExtents) : m_boxHalfExtents1(boxHalfExtents){};
|
btBoxShape( const btVector3& boxHalfExtents)
|
||||||
|
{
|
||||||
|
m_implicitShapeDimensions = boxHalfExtents;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,16 @@ struct btConvexCastResult;
|
|||||||
/// used in combination with GJK or btConvexCast
|
/// used in combination with GJK or btConvexCast
|
||||||
class btConvexShape : public btCollisionShape
|
class btConvexShape : public btCollisionShape
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//local scaling. collisionMargin is not scaled !
|
||||||
|
btVector3 m_localScaling;
|
||||||
|
|
||||||
|
btVector3 m_implicitShapeDimensions;
|
||||||
|
|
||||||
|
btScalar m_collisionMargin;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
btConvexShape();
|
btConvexShape();
|
||||||
|
|
||||||
@@ -42,7 +52,10 @@ public:
|
|||||||
//notice that the vectors should be unit length
|
//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
|
const btVector3& getImplicitShapeDimensions() const
|
||||||
|
{
|
||||||
|
return m_implicitShapeDimensions;
|
||||||
|
}
|
||||||
|
|
||||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
///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
|
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||||
@@ -70,11 +83,7 @@ public:
|
|||||||
{
|
{
|
||||||
return m_collisionMargin;
|
return m_collisionMargin;
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
btScalar m_collisionMargin;
|
|
||||||
//local scaling. collisionMargin is not scaled !
|
|
||||||
protected:
|
|
||||||
btVector3 m_localScaling;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
#define MAX_NUM_SPHERES 5
|
#define MAX_NUM_SPHERES 5
|
||||||
|
|
||||||
///MultiSphereShape represents implicit convex hull of a collection of spheres (using getSupportingVertex)
|
///btMultiSphereShape represents implicit convex hull of a collection of spheres (using getSupportingVertex)
|
||||||
class btMultiSphereShape : public btConvexShape
|
class btMultiSphereShape : public btConvexShape
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
btSphereShape ::btSphereShape (btScalar radius)
|
btSphereShape ::btSphereShape (btScalar radius)
|
||||||
: m_radius(radius)
|
{
|
||||||
{
|
m_implicitShapeDimensions.setX(radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||||
|
|||||||
@@ -19,11 +19,10 @@ subject to the following restrictions:
|
|||||||
#include "btConvexShape.h"
|
#include "btConvexShape.h"
|
||||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
|
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
|
||||||
|
|
||||||
///SphereShape implements an implicit (getSupportingVertex) Sphere
|
///btSphereShape implements an implicit (getSupportingVertex) Sphere
|
||||||
class btSphereShape : public btConvexShape
|
class btSphereShape : public btConvexShape
|
||||||
|
|
||||||
{
|
{
|
||||||
btScalar m_radius;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
btSphereShape (btScalar radius);
|
btSphereShape (btScalar radius);
|
||||||
@@ -41,7 +40,7 @@ public:
|
|||||||
|
|
||||||
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_implicitShapeDimensions.getX();}
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "SPHERE";}
|
virtual char* getName()const {return "SPHERE";}
|
||||||
@@ -54,7 +53,7 @@ public:
|
|||||||
{
|
{
|
||||||
//to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case
|
//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
|
//this means, non-uniform scaling is not supported anymore
|
||||||
return m_localScaling[0] * m_radius + btConvexShape::getMargin();
|
return m_localScaling.getX() * getRadius() + btConvexShape::getMargin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ extern ContactDestroyedCallback gContactDestroyedCallback;
|
|||||||
|
|
||||||
#define MANIFOLD_CACHE_SIZE 4
|
#define MANIFOLD_CACHE_SIZE 4
|
||||||
|
|
||||||
///PersistentManifold maintains contact points, and reduces them to 4.
|
///btPersistentManifold maintains contact points, and reduces them to 4.
|
||||||
///It does contact filtering/contact reduction.
|
///It does contact filtering/contact reduction.
|
||||||
class btPersistentManifold
|
class btPersistentManifold
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user