Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/SuperOrxoBros_HS18/src/external/bullet/BulletCollision/CollisionShapes/btCollisionShape.h @ 12175

Last change on this file since 12175 was 12175, checked in by siramesh, 5 years ago

Super Orxo Bros (Sidharth Ramesh, Nisa Balta, Jeff Ren)

File size: 4.4 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_COLLISION_SHAPE_H
17#define BT_COLLISION_SHAPE_H
18
19#include "LinearMath/btTransform.h"
20#include "LinearMath/btVector3.h"
21#include "LinearMath/btMatrix3x3.h"
22#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" //for the shape types
23class btSerializer;
24
25
26///The btCollisionShape class provides an interface for collision shapes that can be shared among btCollisionObjects.
27class btCollisionShape
28{
29protected:
30        int m_shapeType;
31        void* m_userPointer;
32
33public:
34
35        btCollisionShape() : m_shapeType (INVALID_SHAPE_PROXYTYPE), m_userPointer(0)
36        {
37        }
38
39        virtual ~btCollisionShape()
40        {
41        }
42
43        ///getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
44        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
45
46        virtual void    getBoundingSphere(btVector3& center,btScalar& radius) const;
47
48        ///getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of-impact with rotations.
49        virtual btScalar        getAngularMotionDisc() const;
50
51        virtual btScalar        getContactBreakingThreshold(btScalar defaultContactThresholdFactor) const;
52
53
54        ///calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
55        ///result is conservative
56        void calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax) const;
57
58
59
60        SIMD_FORCE_INLINE bool  isPolyhedral() const
61        {
62                return btBroadphaseProxy::isPolyhedral(getShapeType());
63        }
64
65        SIMD_FORCE_INLINE bool  isConvex2d() const
66        {
67                return btBroadphaseProxy::isConvex2d(getShapeType());
68        }
69
70        SIMD_FORCE_INLINE bool  isConvex() const
71        {
72                return btBroadphaseProxy::isConvex(getShapeType());
73        }
74        SIMD_FORCE_INLINE bool  isNonMoving() const
75        {
76                return btBroadphaseProxy::isNonMoving(getShapeType());
77        }
78        SIMD_FORCE_INLINE bool  isConcave() const
79        {
80                return btBroadphaseProxy::isConcave(getShapeType());
81        }
82        SIMD_FORCE_INLINE bool  isCompound() const
83        {
84                return btBroadphaseProxy::isCompound(getShapeType());
85        }
86
87        SIMD_FORCE_INLINE bool  isSoftBody() const
88        {
89                return btBroadphaseProxy::isSoftBody(getShapeType());
90        }
91
92        ///isInfinite is used to catch simulation error (aabb check)
93        SIMD_FORCE_INLINE bool isInfinite() const
94        {
95                return btBroadphaseProxy::isInfinite(getShapeType());
96        }
97
98#ifndef __SPU__
99        virtual void    setLocalScaling(const btVector3& scaling) =0;
100        virtual const btVector3& getLocalScaling() const =0;
101        virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const = 0;
102
103
104//debugging support
105        virtual const char*     getName()const =0 ;
106#endif //__SPU__
107
108       
109        int             getShapeType() const { return m_shapeType; }
110        virtual void    setMargin(btScalar margin) = 0;
111        virtual btScalar        getMargin() const = 0;
112
113       
114        ///optional user data pointer
115        void    setUserPointer(void*  userPtr)
116        {
117                m_userPointer = userPtr;
118        }
119
120        void*   getUserPointer() const
121        {
122                return m_userPointer;
123        }
124
125        virtual int     calculateSerializeBufferSize() const;
126
127        ///fills the dataBuffer and returns the struct name (and 0 on failure)
128        virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
129
130        virtual void    serializeSingleShape(btSerializer* serializer) const;
131
132};     
133
134///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
135struct  btCollisionShapeData
136{
137        char    *m_name;
138        int             m_shapeType;
139        char    m_padding[4];
140};
141
142SIMD_FORCE_INLINE       int     btCollisionShape::calculateSerializeBufferSize() const
143{
144        return sizeof(btCollisionShapeData);
145}
146
147
148
149#endif //BT_COLLISION_SHAPE_H
150
Note: See TracBrowser for help on using the repository browser.