Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h @ 12261

Last change on this file since 12261 was 10726, checked in by landauf, 9 years ago

fixed alignment warnings in MSVC14 (caused by SSE instructions in bullet)

  • Property svn:eol-style set to native
File size: 3.2 KB
RevLine 
[1963]1/*
2Bullet Continuous Collision Detection and Physics Library
[8351]3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
[1963]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
[8393]16#ifndef BT_STATIC_PLANE_SHAPE_H
17#define BT_STATIC_PLANE_SHAPE_H
[1963]18
19#include "btConcaveShape.h"
20
21
22///The btStaticPlaneShape simulates an infinite non-moving (static) collision plane.
[8351]23ATTRIBUTE_ALIGNED16(class) btStaticPlaneShape : public btConcaveShape
[1963]24{
25protected:
26        btVector3       m_localAabbMin;
27        btVector3       m_localAabbMax;
28       
29        btVector3       m_planeNormal;
30        btScalar      m_planeConstant;
31        btVector3       m_localScaling;
32
33public:
[10726]34        BT_DECLARE_ALIGNED_ALLOCATOR();
35
[1963]36        btStaticPlaneShape(const btVector3& planeNormal,btScalar planeConstant);
37
38        virtual ~btStaticPlaneShape();
39
40
41        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
42
43        virtual void    processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
44
45        virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
46
47        virtual void    setLocalScaling(const btVector3& scaling);
48        virtual const btVector3& getLocalScaling() const;
49       
50        const btVector3&        getPlaneNormal() const
51        {
52                return  m_planeNormal;
53        }
54
55        const btScalar& getPlaneConstant() const
56        {
57                return  m_planeConstant;
58        }
59
60        //debugging
61        virtual const char*     getName()const {return "STATICPLANE";}
62
[8351]63        virtual int     calculateSerializeBufferSize() const;
[1963]64
[8351]65        ///fills the dataBuffer and returns the struct name (and 0 on failure)
66        virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
67
68
[1963]69};
70
[8351]71///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
72struct  btStaticPlaneShapeData
73{
74        btCollisionShapeData    m_collisionShapeData;
75
76        btVector3FloatData      m_localScaling;
77        btVector3FloatData      m_planeNormal;
78        float                   m_planeConstant;
79        char    m_pad[4];
80};
81
82
83SIMD_FORCE_INLINE       int     btStaticPlaneShape::calculateSerializeBufferSize() const
84{
85        return sizeof(btStaticPlaneShapeData);
86}
87
88///fills the dataBuffer and returns the struct name (and 0 on failure)
89SIMD_FORCE_INLINE       const char*     btStaticPlaneShape::serialize(void* dataBuffer, btSerializer* serializer) const
90{
91        btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) dataBuffer;
92        btCollisionShape::serialize(&planeData->m_collisionShapeData,serializer);
93
94        m_localScaling.serializeFloat(planeData->m_localScaling);
95        m_planeNormal.serializeFloat(planeData->m_planeNormal);
96        planeData->m_planeConstant = float(m_planeConstant);
97               
98        return "btStaticPlaneShapeData";
99}
100
101
[8393]102#endif //BT_STATIC_PLANE_SHAPE_H
[8351]103
104
105
Note: See TracBrowser for help on using the repository browser.