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