Changeset 8284 for code/branches/kicklib2/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.h
- Timestamp:
- Apr 21, 2011, 6:58:23 PM (13 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
- Property svn:mergeinfo changed
-
code/branches/kicklib2/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.h
r5781 r8284 1 1 /* 2 2 Bullet Continuous Collision Detection and Physics Library 3 Copyright (c) 2003-200 6 Erwin Coumans http://continuousphysics.com/Bullet/3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 4 5 5 This software is provided 'as-is', without any express or implied warranty. … … 22 22 23 23 /// The btCylinderShape class implements a cylinder shape primitive, centered around the origin. Its central axis aligned with the Y axis. btCylinderShapeX is aligned with the X axis and btCylinderShapeZ around the Z axis. 24 class btCylinderShape : public bt BoxShape24 class btCylinderShape : public btConvexInternalShape 25 25 26 26 { … … 31 31 32 32 public: 33 34 btVector3 getHalfExtentsWithMargin() const 35 { 36 btVector3 halfExtents = getHalfExtentsWithoutMargin(); 37 btVector3 margin(getMargin(),getMargin(),getMargin()); 38 halfExtents += margin; 39 return halfExtents; 40 } 41 42 const btVector3& getHalfExtentsWithoutMargin() const 43 { 44 return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included 45 } 46 33 47 btCylinderShape (const btVector3& halfExtents); 34 48 35 ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version36 49 void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const; 37 50 51 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const; 52 38 53 virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; 39 54 40 55 virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; 56 57 virtual void setMargin(btScalar collisionMargin) 58 { 59 //correct the m_implicitShapeDimensions for the margin 60 btVector3 oldMargin(getMargin(),getMargin(),getMargin()); 61 btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin; 62 63 btConvexInternalShape::setMargin(collisionMargin); 64 btVector3 newMargin(getMargin(),getMargin(),getMargin()); 65 m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin; 66 67 } 41 68 42 69 virtual btVector3 localGetSupportingVertex(const btVector3& vec) const … … 74 101 } 75 102 103 virtual void setLocalScaling(const btVector3& scaling) 104 { 105 btVector3 oldMargin(getMargin(),getMargin(),getMargin()); 106 btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin; 107 btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling; 108 109 btConvexInternalShape::setLocalScaling(scaling); 110 111 m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin; 112 113 } 114 76 115 //debugging 77 116 virtual const char* getName()const … … 80 119 } 81 120 82 121 virtual int calculateSerializeBufferSize() const; 122 123 ///fills the dataBuffer and returns the struct name (and 0 on failure) 124 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; 83 125 84 126 }; … … 113 155 virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; 114 156 115 virtual int getUpAxis() const116 {117 return 2;118 }119 157 //debugging 120 158 virtual const char* getName()const … … 130 168 }; 131 169 170 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 171 struct btCylinderShapeData 172 { 173 btConvexInternalShapeData m_convexInternalShapeData; 174 175 int m_upAxis; 176 177 char m_padding[4]; 178 }; 179 180 SIMD_FORCE_INLINE int btCylinderShape::calculateSerializeBufferSize() const 181 { 182 return sizeof(btCylinderShapeData); 183 } 184 185 ///fills the dataBuffer and returns the struct name (and 0 on failure) 186 SIMD_FORCE_INLINE const char* btCylinderShape::serialize(void* dataBuffer, btSerializer* serializer) const 187 { 188 btCylinderShapeData* shapeData = (btCylinderShapeData*) dataBuffer; 189 190 btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); 191 192 shapeData->m_upAxis = m_upAxis; 193 194 return "btCylinderShapeData"; 195 } 196 197 132 198 133 199 #endif //CYLINDER_MINKOWSKI_H
Note: See TracChangeset
for help on using the changeset viewer.