btHfFluidBuoyantShapeCollisionAlgorithm.h
Go to the documentation of this file.
00001 /*
00002  Bullet Continuous Collision Detection and Physics Library
00003  Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.com
00004 
00005  This software is provided 'as-is', without any express or implied warranty.
00006  In no event will the authors be held liable for any damages arising from the use of this software.
00007  Permission is granted to anyone to use this software for any purpose,
00008  including commercial applications, and to alter it and redistribute it freely,
00009  subject to the following restrictions:
00010 
00011  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013  3. This notice may not be removed or altered from any source distribution.
00014 
00015  Experimental Buoyancy fluid demo written by John McCutchan
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


uwsim
Author(s): Mario Prats
autogenerated on Mon Oct 6 2014 08:24:07