Back to index

supertuxkart  0.5+dfsg1
btCollisionShape.h
Go to the documentation of this file.
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_SHAPE_H
00017 #define COLLISION_SHAPE_H
00018 
00019 #include "LinearMath/btTransform.h"
00020 #include "LinearMath/btVector3.h"
00021 #include "LinearMath/btMatrix3x3.h"
00022 #include "LinearMath/btPoint3.h"
00023 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" //for the shape types
00024 
00026 class btCollisionShape
00027 {
00028 
00029        void* m_userPointer;
00030 
00031 public:
00032 
00033        btCollisionShape() : m_userPointer(0)
00034        {
00035        }
00036        virtual ~btCollisionShape()
00037        {
00038        }
00039 
00041        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
00042 
00043        virtual void  getBoundingSphere(btVector3& center,btScalar& radius) const;
00044 
00046        virtual btScalar     getAngularMotionDisc() const;
00047 
00048 
00051        void calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax) const;
00052 
00053 #ifndef __SPU__
00054 
00055        SIMD_FORCE_INLINE bool      isPolyhedral() const
00056        {
00057               return btBroadphaseProxy::isPolyhedral(getShapeType());
00058        }
00059 
00060        SIMD_FORCE_INLINE bool      isConvex() const
00061        {
00062               return btBroadphaseProxy::isConvex(getShapeType());
00063        }
00064        SIMD_FORCE_INLINE bool      isConcave() const
00065        {
00066               return btBroadphaseProxy::isConcave(getShapeType());
00067        }
00068        SIMD_FORCE_INLINE bool      isCompound() const
00069        {
00070               return btBroadphaseProxy::isCompound(getShapeType());
00071        }
00072 
00074        SIMD_FORCE_INLINE bool isInfinite() const
00075        {
00076               return btBroadphaseProxy::isInfinite(getShapeType());
00077        }
00078 
00079        virtual int          getShapeType() const=0;
00080        virtual void  setLocalScaling(const btVector3& scaling) =0;
00081        virtual const btVector3& getLocalScaling() const =0;
00082        virtual void  calculateLocalInertia(btScalar mass,btVector3& inertia) const = 0;
00083 
00084 
00085 //debugging support
00086        virtual const char*  getName()const =0 ;
00087 #endif //__SPU__
00088 
00089        
00090 
00091        virtual void  setMargin(btScalar margin) = 0;
00092        virtual btScalar     getMargin() const = 0;
00093 
00094        
00096        void   setUserPointer(void* userPtr)
00097        {
00098               m_userPointer = userPtr;
00099        }
00100 
00101        void*  getUserPointer() const
00102        {
00103               return m_userPointer;
00104        }
00105 
00106 };     
00107 
00108 #endif //COLLISION_SHAPE_H
00109