00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SPHERE_MINKOWSKI_H
00016 #define SPHERE_MINKOWSKI_H
00017
00018 #include "btConvexInternalShape.h"
00019 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00020
00022 ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexInternalShape
00023
00024 {
00025
00026 public:
00027 BT_DECLARE_ALIGNED_ALLOCATOR();
00028
00029 btSphereShape (btScalar radius) : btConvexInternalShape ()
00030 {
00031 m_shapeType = SPHERE_SHAPE_PROXYTYPE;
00032 m_implicitShapeDimensions.setX(radius);
00033 m_collisionMargin = radius;
00034 }
00035
00036 virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
00037 virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
00038
00039 virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
00040
00041
00042 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
00043
00044 virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
00045
00046
00047 btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();}
00048
00049 void setUnscaledRadius(btScalar radius)
00050 {
00051 m_implicitShapeDimensions.setX(radius);
00052 btConvexInternalShape::setMargin(radius);
00053 }
00054
00055
00056 virtual const char* getName()const {return "SPHERE";}
00057
00058 virtual void setMargin(btScalar margin)
00059 {
00060 btConvexInternalShape::setMargin(margin);
00061 }
00062 virtual btScalar getMargin() const
00063 {
00064
00065
00066 return getRadius();
00067 }
00068
00069
00070 };
00071
00072
00073 #endif //SPHERE_MINKOWSKI_H