Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef BUOYANTSHAPECONVEXCOLLISIONALGORITHM_H
00006 #define BUOYANTSHAPECONVEXCOLLISIONALGORITHM_H
00007
00008 #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
00009 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00010 #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
00011 #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
00012 #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
00013 #include "BulletCollision/CollisionShapes/btTriangleCallback.h"
00014 #include "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h"
00015 #include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
00016
00017 #include "LinearMath/btVector3.h"
00018 class btHfFluid;
00019
00020 class btConvexConvexAlgorithm;
00021 class btConvexPenetrationDepthSolver;
00022 class btSimplexSolverInterface;
00023
00026 class BuoyantShapeConvexCollisionAlgorithm : public btCollisionAlgorithm
00027 {
00028 btCollisionObject* m_collisionObject0;
00029 btCollisionObject* m_collisionObject1;
00030
00032 bool m_isSwapped;
00033 int m_proxyType;
00034
00035 btCollisionAlgorithm * m_collisionAlgorithm;
00036 public:
00037
00038 BuoyantShapeConvexCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* col0,
00039 btCollisionObject* col1, btSimplexSolverInterface* simplexSolver,
00040 btConvexPenetrationDepthSolver* pdSolver, bool isSwapped, int proxyType);
00041
00042 virtual ~BuoyantShapeConvexCollisionAlgorithm();
00043
00044 virtual void processCollision(btCollisionObject* body0, btCollisionObject* body1,
00045 const btDispatcherInfo& dispatchInfo, btManifoldResult* resultOut);
00046
00047 virtual btScalar calculateTimeOfImpact(btCollisionObject* body0, btCollisionObject* body1,
00048 const btDispatcherInfo& dispatchInfo, btManifoldResult* resultOut);
00049
00050 virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
00051 {
00052 m_collisionAlgorithm->getAllContactManifolds(manifoldArray);
00053 }
00054
00055 struct CreateFunc : public btCollisionAlgorithmCreateFunc
00056 {
00057 btConvexPenetrationDepthSolver* m_pdSolver;
00058 btSimplexSolverInterface* m_simplexSolver;
00059 int m_proxyType;
00060
00061 CreateFunc(btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver, int proxyType)
00062 {
00063 m_simplexSolver = simplexSolver;
00064 m_pdSolver = pdSolver;
00065 m_proxyType = proxyType;
00066 }
00067
00068 virtual ~CreateFunc()
00069 {
00070 }
00071 virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci,
00072 btCollisionObject* body0, btCollisionObject* body1)
00073 {
00074 void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(BuoyantShapeConvexCollisionAlgorithm));
00075 if (!m_swapped)
00076 {
00077 return new (mem) BuoyantShapeConvexCollisionAlgorithm(ci, body0, body1, m_simplexSolver, m_pdSolver, false,
00078 m_proxyType);
00079 }
00080 else
00081 {
00082 return new (mem) BuoyantShapeConvexCollisionAlgorithm(ci, body0, body1, m_simplexSolver, m_pdSolver, true,
00083 m_proxyType);
00084 }
00085 }
00086 };
00087 };
00088
00089 #endif //BUOYANTSHAPECONVEXCOLLISIONALGORITHM_H