Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BT_CONVEX_CONVEX_ALGORITHM_H
00017 #define BT_CONVEX_CONVEX_ALGORITHM_H
00018
00019 #include "btActivatingCollisionAlgorithm.h"
00020 #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
00021 #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
00022 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00023 #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
00024 #include "btCollisionCreateFunc.h"
00025 #include "btCollisionDispatcher.h"
00026 #include "LinearMath/btTransformUtil.h"
00027
00028 class btConvexPenetrationDepthSolver;
00029
00034
00035
00036
00040 class btConvexConvexAlgorithm : public btActivatingCollisionAlgorithm
00041 {
00042 #ifdef USE_SEPDISTANCE_UTIL2
00043 btConvexSeparatingDistanceUtil m_sepDistance;
00044 #endif
00045 btSimplexSolverInterface* m_simplexSolver;
00046 btConvexPenetrationDepthSolver* m_pdSolver;
00047
00048
00049 bool m_ownManifold;
00050 btPersistentManifold* m_manifoldPtr;
00051 bool m_lowLevelOfDetail;
00052
00053 int m_numPerturbationIterations;
00054 int m_minimumPointsPerturbationThreshold;
00055
00056
00058
00059
00060 public:
00061
00062 btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold);
00063
00064
00065 virtual ~btConvexConvexAlgorithm();
00066
00067 virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
00068
00069 virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
00070
00071 virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
00072 {
00074 if (m_manifoldPtr && m_ownManifold)
00075 manifoldArray.push_back(m_manifoldPtr);
00076 }
00077
00078
00079 void setLowLevelOfDetail(bool useLowLevel);
00080
00081
00082 const btPersistentManifold* getManifold()
00083 {
00084 return m_manifoldPtr;
00085 }
00086
00087 struct CreateFunc :public btCollisionAlgorithmCreateFunc
00088 {
00089
00090 btConvexPenetrationDepthSolver* m_pdSolver;
00091 btSimplexSolverInterface* m_simplexSolver;
00092 int m_numPerturbationIterations;
00093 int m_minimumPointsPerturbationThreshold;
00094
00095 CreateFunc(btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
00096
00097 virtual ~CreateFunc();
00098
00099 virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
00100 {
00101 void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConvexAlgorithm));
00102 return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
00103 }
00104 };
00105
00106
00107 };
00108
00109 #endif //BT_CONVEX_CONVEX_ALGORITHM_H