Back to index

supertuxkart  0.5+dfsg1
btConvexConvexAlgorithm.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
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 
00016 #ifndef CONVEX_CONVEX_ALGORITHM_H
00017 #define CONVEX_CONVEX_ALGORITHM_H
00018 
00019 #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.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 
00027 class btConvexPenetrationDepthSolver;
00028 
00030 class btConvexConvexAlgorithm : public btCollisionAlgorithm
00031 {
00032        btGjkPairDetector m_gjkPairDetector;
00033 public:
00034 
00035        bool   m_ownManifold;
00036        btPersistentManifold*       m_manifoldPtr;
00037        bool                 m_lowLevelOfDetail;
00038        
00039 
00040 public:
00041 
00042        btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
00043 
00044        virtual ~btConvexConvexAlgorithm();
00045 
00046        virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
00047 
00048        virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
00049 
00050        void   setLowLevelOfDetail(bool useLowLevel);
00051 
00052 
00053        const btPersistentManifold* getManifold()
00054        {
00055               return m_manifoldPtr;
00056        }
00057 
00058        struct CreateFunc :public   btCollisionAlgorithmCreateFunc
00059        {
00060               btConvexPenetrationDepthSolver*           m_pdSolver;
00061               btSimplexSolverInterface*                 m_simplexSolver;
00062               
00063               CreateFunc(btSimplexSolverInterface*                    simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
00064               
00065               virtual ~CreateFunc();
00066 
00067               virtual       btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
00068               {
00069                      void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConvexAlgorithm));
00070                      return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver);
00071               }
00072        };
00073 
00074 
00075 };
00076 
00077 #endif //CONVEX_CONVEX_ALGORITHM_H