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