Differential D8762 Diff 28333 extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.h
| Show All 11 Lines | |||||
| 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. | ||||
| 3. This notice may not be removed or altered from any source distribution. | 3. This notice may not be removed or altered from any source distribution. | ||||
| */ | */ | ||||
| #ifndef BT_MULTI_SPHERE_MINKOWSKI_H | #ifndef BT_MULTI_SPHERE_MINKOWSKI_H | ||||
| #define BT_MULTI_SPHERE_MINKOWSKI_H | #define BT_MULTI_SPHERE_MINKOWSKI_H | ||||
| #include "btConvexInternalShape.h" | #include "btConvexInternalShape.h" | ||||
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types | ||||
| #include "LinearMath/btAlignedObjectArray.h" | #include "LinearMath/btAlignedObjectArray.h" | ||||
| #include "LinearMath/btAabbUtil2.h" | #include "LinearMath/btAabbUtil2.h" | ||||
| ///The btMultiSphereShape represents the convex hull of a collection of spheres. You can create special capsules or other smooth volumes. | ///The btMultiSphereShape represents the convex hull of a collection of spheres. You can create special capsules or other smooth volumes. | ||||
| ///It is possible to animate the spheres for deformation, but call 'recalcLocalAabb' after changing any sphere position/radius | ///It is possible to animate the spheres for deformation, but call 'recalcLocalAabb' after changing any sphere position/radius | ||||
| ATTRIBUTE_ALIGNED16(class) btMultiSphereShape : public btConvexInternalAabbCachingShape | ATTRIBUTE_ALIGNED16(class) | ||||
| btMultiSphereShape : public btConvexInternalAabbCachingShape | |||||
| { | { | ||||
| btAlignedObjectArray<btVector3> m_localPositionArray; | btAlignedObjectArray<btVector3> m_localPositionArray; | ||||
| btAlignedObjectArray<btScalar> m_radiArray; | btAlignedObjectArray<btScalar> m_radiArray; | ||||
| public: | public: | ||||
| BT_DECLARE_ALIGNED_ALLOCATOR(); | BT_DECLARE_ALIGNED_ALLOCATOR(); | ||||
| btMultiSphereShape (const btVector3* positions,const btScalar* radi,int numSpheres); | btMultiSphereShape(const btVector3* positions, const btScalar* radi, int numSpheres); | ||||
| ///CollisionShape Interface | ///CollisionShape Interface | ||||
| virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const; | virtual void calculateLocalInertia(btScalar mass, btVector3 & inertia) const; | ||||
| /// btConvexShape Interface | /// btConvexShape Interface | ||||
| virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; | virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const; | ||||
| virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; | virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors, btVector3* supportVerticesOut, int numVectors) const; | ||||
| int getSphereCount() const | int getSphereCount() const | ||||
| { | { | ||||
| return m_localPositionArray.size(); | return m_localPositionArray.size(); | ||||
| } | } | ||||
| const btVector3& getSpherePosition(int index) const | const btVector3& getSpherePosition(int index) const | ||||
| { | { | ||||
| return m_localPositionArray[index]; | return m_localPositionArray[index]; | ||||
| } | } | ||||
| btScalar getSphereRadius(int index) const | btScalar getSphereRadius(int index) const | ||||
| { | { | ||||
| return m_radiArray[index]; | return m_radiArray[index]; | ||||
| } | } | ||||
| virtual const char* getName()const | virtual const char* getName() const | ||||
| { | { | ||||
| return "MultiSphere"; | return "MultiSphere"; | ||||
| } | } | ||||
| virtual int calculateSerializeBufferSize() const; | virtual int calculateSerializeBufferSize() const; | ||||
| ///fills the dataBuffer and returns the struct name (and 0 on failure) | ///fills the dataBuffer and returns the struct name (and 0 on failure) | ||||
| virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | ||||
| }; | }; | ||||
| struct btPositionAndRadius | struct btPositionAndRadius | ||||
| { | { | ||||
| btVector3FloatData m_pos; | btVector3FloatData m_pos; | ||||
| float m_radius; | float m_radius; | ||||
| }; | }; | ||||
| // clang-format off | |||||
| struct btMultiSphereShapeData | struct btMultiSphereShapeData | ||||
| { | { | ||||
| btConvexInternalShapeData m_convexInternalShapeData; | btConvexInternalShapeData m_convexInternalShapeData; | ||||
| btPositionAndRadius *m_localPositionArrayPtr; | btPositionAndRadius *m_localPositionArrayPtr; | ||||
| int m_localPositionArraySize; | int m_localPositionArraySize; | ||||
| char m_padding[4]; | char m_padding[4]; | ||||
| }; | }; | ||||
| // clang-format on | |||||
| SIMD_FORCE_INLINE int btMultiSphereShape::calculateSerializeBufferSize() const | SIMD_FORCE_INLINE int btMultiSphereShape::calculateSerializeBufferSize() const | ||||
| { | { | ||||
| return sizeof(btMultiSphereShapeData); | return sizeof(btMultiSphereShapeData); | ||||
| } | } | ||||
| #endif //BT_MULTI_SPHERE_MINKOWSKI_H | #endif //BT_MULTI_SPHERE_MINKOWSKI_H | ||||