Blender  V3.3
btCollisionShape.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. 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
23 class btSerializer;
24 
28 {
29 protected:
30  int m_shapeType;
33 
34 public:
36 
38  {
39  }
40 
42  {
43  }
44 
46  virtual void getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const = 0;
47 
48  virtual void getBoundingSphere(btVector3 & center, btScalar & radius) const;
49 
51  virtual btScalar getAngularMotionDisc() const;
52 
53  virtual btScalar getContactBreakingThreshold(btScalar defaultContactThresholdFactor) const;
54 
57  void calculateTemporalAabb(const btTransform& curTrans, const btVector3& linvel, const btVector3& angvel, btScalar timeStep, btVector3& temporalAabbMin, btVector3& temporalAabbMax) const;
58 
60  {
62  }
63 
65  {
67  }
68 
70  {
72  }
74  {
76  }
78  {
80  }
82  {
84  }
85 
87  {
89  }
90 
93  {
95  }
96 
97 #ifndef __SPU__
98  virtual void setLocalScaling(const btVector3& scaling) = 0;
99  virtual const btVector3& getLocalScaling() const = 0;
100  virtual void calculateLocalInertia(btScalar mass, btVector3 & inertia) const = 0;
101 
102  //debugging support
103  virtual const char* getName() const = 0;
104 #endif //__SPU__
105 
106  int getShapeType() const
107  {
108  return m_shapeType;
109  }
110 
114  {
115  return btVector3(1, 1, 1);
116  }
117  virtual void setMargin(btScalar margin) = 0;
118  virtual btScalar getMargin() const = 0;
119 
121  void setUserPointer(void* userPtr)
122  {
123  m_userPointer = userPtr;
124  }
125 
126  void* getUserPointer() const
127  {
128  return m_userPointer;
129  }
130  void setUserIndex(int index)
131  {
132  m_userIndex = index;
133  }
134 
135  int getUserIndex() const
136  {
137  return m_userIndex;
138  }
139 
140  virtual int calculateSerializeBufferSize() const;
141 
143  virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
144 
145  virtual void serializeSingleShape(btSerializer * serializer) const;
146 };
147 
148 // clang-format off
149 // parser needs * with the name
152 {
153  char *m_name;
155  char m_padding[4];
156 };
157 // clang-format on
159 {
160  return sizeof(btCollisionShapeData);
161 }
162 
163 #endif //BT_COLLISION_SHAPE_H
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
@ INVALID_SHAPE_PROXYTYPE
BT_DECLARE_ALIGNED_ALLOCATOR()
SIMD_FORCE_INLINE bool isSoftBody() const
virtual void getBoundingSphere(btVector3 &center, btScalar &radius) const
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const =0
CollisionShape Interface.
Definition: btConeShape.h:54
virtual const char * getName() const =0
getName is for debugging
Definition: btBox2dShape.h:301
void setUserPointer(void *userPtr)
optional user data pointer
SIMD_FORCE_INLINE bool isConcave() const
virtual int calculateSerializeBufferSize() const
virtual btVector3 getAnisotropicRollingFrictionDirection() const
void calculateTemporalAabb(const btTransform &curTrans, const btVector3 &linvel, const btVector3 &angvel, btScalar timeStep, btVector3 &temporalAabbMin, btVector3 &temporalAabbMax) const
virtual ~btCollisionShape()
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
SIMD_FORCE_INLINE bool isNonMoving() const
int m_userIndex
SIMD_FORCE_INLINE bool isConvex() const
int getUserIndex() const
void setUserIndex(int index)
virtual const btVector3 & getLocalScaling() const =0
SIMD_FORCE_INLINE bool isConvex2d() const
int getShapeType() const
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
void * getUserPointer() const
SIMD_FORCE_INLINE bool isPolyhedral() const
virtual void setMargin(btScalar margin)=0
Definition: btBox2dShape.h:110
virtual btScalar getAngularMotionDisc() const
getAngularMotionDisc returns the maximum radius needed for Conservative Advancement to handle time-of...
virtual btScalar getMargin() const =0
virtual void setLocalScaling(const btVector3 &scaling)=0
Definition: btBox2dShape.h:120
SIMD_FORCE_INLINE bool isInfinite() const
isInfinite is used to catch simulation error (aabb check)
virtual btScalar getContactBreakingThreshold(btScalar defaultContactThresholdFactor) const
virtual void serializeSingleShape(btSerializer *serializer) const
SIMD_FORCE_INLINE bool isCompound() const
void * m_userPointer
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:285
#define SIMD_FORCE_INLINE
Definition: btScalar.h:280
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64