Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BT_COLLISION_SHAPE_H
00017 #define BT_COLLISION_SHAPE_H
00018
00019 #include "LinearMath/btTransform.h"
00020 #include "LinearMath/btVector3.h"
00021 #include "LinearMath/btMatrix3x3.h"
00022 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00023 class btSerializer;
00024
00025
00027 class btCollisionShape
00028 {
00029 protected:
00030 int m_shapeType;
00031 void* m_userPointer;
00032
00033 public:
00034
00035 btCollisionShape() : m_shapeType (INVALID_SHAPE_PROXYTYPE), m_userPointer(0)
00036 {
00037 }
00038
00039 virtual ~btCollisionShape()
00040 {
00041 }
00042
00044 virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
00045
00046 virtual void getBoundingSphere(btVector3& center,btScalar& radius) const;
00047
00049 virtual btScalar getAngularMotionDisc() const;
00050
00051 virtual btScalar getContactBreakingThreshold(btScalar defaultContactThresholdFactor) const;
00052
00053
00056 void calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax) const;
00057
00058
00059
00060 SIMD_FORCE_INLINE bool isPolyhedral() const
00061 {
00062 return btBroadphaseProxy::isPolyhedral(getShapeType());
00063 }
00064
00065 SIMD_FORCE_INLINE bool isConvex2d() const
00066 {
00067 return btBroadphaseProxy::isConvex2d(getShapeType());
00068 }
00069
00070 SIMD_FORCE_INLINE bool isConvex() const
00071 {
00072 return btBroadphaseProxy::isConvex(getShapeType());
00073 }
00074 SIMD_FORCE_INLINE bool isNonMoving() const
00075 {
00076 return btBroadphaseProxy::isNonMoving(getShapeType());
00077 }
00078 SIMD_FORCE_INLINE bool isConcave() const
00079 {
00080 return btBroadphaseProxy::isConcave(getShapeType());
00081 }
00082 SIMD_FORCE_INLINE bool isCompound() const
00083 {
00084 return btBroadphaseProxy::isCompound(getShapeType());
00085 }
00086
00087 SIMD_FORCE_INLINE bool isSoftBody() const
00088 {
00089 return btBroadphaseProxy::isSoftBody(getShapeType());
00090 }
00091
00093 SIMD_FORCE_INLINE bool isInfinite() const
00094 {
00095 return btBroadphaseProxy::isInfinite(getShapeType());
00096 }
00097
00098 #ifndef __SPU__
00099 virtual void setLocalScaling(const btVector3& scaling) =0;
00100 virtual const btVector3& getLocalScaling() const =0;
00101 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const = 0;
00102
00103
00104
00105 virtual const char* getName()const =0 ;
00106 #endif //__SPU__
00107
00108
00109 int getShapeType() const { return m_shapeType; }
00110 virtual void setMargin(btScalar margin) = 0;
00111 virtual btScalar getMargin() const = 0;
00112
00113
00115 void setUserPointer(void* userPtr)
00116 {
00117 m_userPointer = userPtr;
00118 }
00119
00120 void* getUserPointer() const
00121 {
00122 return m_userPointer;
00123 }
00124
00125 virtual int calculateSerializeBufferSize() const;
00126
00128 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
00129
00130 virtual void serializeSingleShape(btSerializer* serializer) const;
00131
00132 };
00133
00135 struct btCollisionShapeData
00136 {
00137 char *m_name;
00138 int m_shapeType;
00139 char m_padding[4];
00140 };
00141
00142 SIMD_FORCE_INLINE int btCollisionShape::calculateSerializeBufferSize() const
00143 {
00144 return sizeof(btCollisionShapeData);
00145 }
00146
00147
00148
00149 #endif //BT_COLLISION_SHAPE_H
00150