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 COLLISION_ALGORITHM_H 00017 #define COLLISION_ALGORITHM_H 00018 00019 #include "LinearMath/btScalar.h" 00020 #include "LinearMath/btAlignedObjectArray.h" 00021 00022 struct btBroadphaseProxy; 00023 class btDispatcher; 00024 class btManifoldResult; 00025 class btCollisionObject; 00026 struct btDispatcherInfo; 00027 class btPersistentManifold; 00028 00029 typedef btAlignedObjectArray<btPersistentManifold*> btManifoldArray; 00030 00031 struct btCollisionAlgorithmConstructionInfo 00032 { 00033 btCollisionAlgorithmConstructionInfo() 00034 :m_dispatcher1(0), 00035 m_manifold(0) 00036 { 00037 } 00038 btCollisionAlgorithmConstructionInfo(btDispatcher* dispatcher,int temp) 00039 :m_dispatcher1(dispatcher) 00040 { 00041 (void)temp; 00042 } 00043 00044 btDispatcher* m_dispatcher1; 00045 btPersistentManifold* m_manifold; 00046 00047 int getDispatcherId(); 00048 00049 }; 00050 00051 00054 class btCollisionAlgorithm 00055 { 00056 00057 protected: 00058 00059 btDispatcher* m_dispatcher; 00060 00061 protected: 00062 int getDispatcherId(); 00063 00064 public: 00065 00066 btCollisionAlgorithm() {}; 00067 00068 btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci); 00069 00070 virtual ~btCollisionAlgorithm() {}; 00071 00072 virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) = 0; 00073 00074 virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) = 0; 00075 00076 virtual void getAllContactManifolds(btManifoldArray& manifoldArray) = 0; 00077 }; 00078 00079 00080 #endif //COLLISION_ALGORITHM_H