Back to index

supertuxkart  0.5+dfsg1
btDispatcher.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 _DISPATCHER_H
00017 #define _DISPATCHER_H
00018 
00019 #include "LinearMath/btScalar.h"
00020 
00021 class btCollisionAlgorithm;
00022 struct btBroadphaseProxy;
00023 class btRigidBody;
00024 class  btCollisionObject;
00025 class btOverlappingPairCache;
00026 
00027 
00028 class btPersistentManifold;
00029 class btStackAlloc;
00030 
00031 struct btDispatcherInfo
00032 {
00033        enum DispatchFunc
00034        {
00035               DISPATCH_DISCRETE = 1,
00036               DISPATCH_CONTINUOUS
00037        };
00038        btDispatcherInfo()
00039               :m_timeStep(btScalar(0.)),
00040               m_stepCount(0),
00041               m_dispatchFunc(DISPATCH_DISCRETE),
00042               m_timeOfImpact(btScalar(1.)),
00043               m_useContinuous(false),
00044               m_debugDraw(0),
00045               m_enableSatConvex(false),
00046               m_enableSPU(true),
00047               m_stackAllocator(0)
00048        {
00049 
00050        }
00051        btScalar      m_timeStep;
00052        int           m_stepCount;
00053        int           m_dispatchFunc;
00054        btScalar      m_timeOfImpact;
00055        bool   m_useContinuous;
00056        class btIDebugDraw*  m_debugDraw;
00057        bool   m_enableSatConvex;
00058        bool   m_enableSPU;
00059        btStackAlloc* m_stackAllocator;
00060        
00061 };
00062 
00065 class btDispatcher
00066 {
00067 
00068 
00069 public:
00070        virtual ~btDispatcher() ;
00071 
00072        virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0;
00073 
00074        virtual btPersistentManifold*      getNewManifold(void* body0,void* body1)=0;
00075 
00076        virtual void releaseManifold(btPersistentManifold* manifold)=0;
00077 
00078        virtual void clearManifold(btPersistentManifold* manifold)=0;
00079 
00080        virtual bool  needsCollision(btCollisionObject* body0,btCollisionObject* body1) = 0;
00081 
00082        virtual bool  needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0;
00083 
00084        virtual void  dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher)=0;
00085 
00086        virtual int getNumManifolds() const = 0;
00087 
00088        virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
00089 
00090        virtual       btPersistentManifold**      getInternalManifoldPointer() = 0;
00091 
00092        virtual       void* allocateCollisionAlgorithm(int size) = 0;
00093 
00094        virtual       void freeCollisionAlgorithm(void* ptr) = 0;
00095 
00096 };
00097 
00098 
00099 #endif //_DISPATCHER_H