00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
00018 #define DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
00019 #include "LinearMath/btTransform.h"
00020 #include "LinearMath/btVector3.h"
00021 class btStackAlloc;
00022
00028 struct btDiscreteCollisionDetectorInterface
00029 {
00030
00031 struct Result
00032 {
00033
00034 virtual ~Result(){}
00035
00037 virtual void setShapeIdentifiersA(int partId0,int index0)=0;
00038 virtual void setShapeIdentifiersB(int partId1,int index1)=0;
00039 virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)=0;
00040 };
00041
00042 struct ClosestPointInput
00043 {
00044 ClosestPointInput()
00045 :m_maximumDistanceSquared(btScalar(BT_LARGE_FLOAT)),
00046 m_stackAlloc(0)
00047 {
00048 }
00049
00050 btTransform m_transformA;
00051 btTransform m_transformB;
00052 btScalar m_maximumDistanceSquared;
00053 btStackAlloc* m_stackAlloc;
00054 };
00055
00056 virtual ~btDiscreteCollisionDetectorInterface() {};
00057
00058
00059
00060
00061
00062 virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false) = 0;
00063
00064 };
00065
00066 struct btStorageResult : public btDiscreteCollisionDetectorInterface::Result
00067 {
00068 btVector3 m_normalOnSurfaceB;
00069 btVector3 m_closestPointInB;
00070 btScalar m_distance;
00071
00072 btStorageResult() : m_distance(btScalar(BT_LARGE_FLOAT))
00073 {
00074
00075 }
00076 virtual ~btStorageResult() {};
00077
00078 virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
00079 {
00080 if (depth < m_distance)
00081 {
00082 m_normalOnSurfaceB = normalOnBInWorld;
00083 m_closestPointInB = pointInWorld;
00084 m_distance = depth;
00085 }
00086 }
00087 };
00088
00089 #endif //DISCRETE_COLLISION_DETECTOR_INTERFACE1_H