btHeightfieldTerrainShape.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 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.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef BT_HEIGHTFIELD_TERRAIN_SHAPE_H
00017 #define BT_HEIGHTFIELD_TERRAIN_SHAPE_H
00018 
00019 #include "btConcaveShape.h"
00020 
00022 
00071 class btHeightfieldTerrainShape : public btConcaveShape
00072 {
00073 protected:
00074         btVector3       m_localAabbMin;
00075         btVector3       m_localAabbMax;
00076         btVector3       m_localOrigin;
00077 
00079         int     m_heightStickWidth;
00080         int m_heightStickLength;
00081         btScalar        m_minHeight;
00082         btScalar        m_maxHeight;
00083         btScalar m_width;
00084         btScalar m_length;
00085         btScalar m_heightScale;
00086         union
00087         {
00088                 unsigned char*  m_heightfieldDataUnsignedChar;
00089                 short*          m_heightfieldDataShort;
00090                 btScalar*                       m_heightfieldDataFloat;
00091                 void*                   m_heightfieldDataUnknown;
00092         };
00093 
00094         PHY_ScalarType  m_heightDataType;       
00095         bool    m_flipQuadEdges;
00096   bool  m_useDiamondSubdivision;
00097 
00098         int     m_upAxis;
00099         
00100         btVector3       m_localScaling;
00101 
00102         virtual btScalar        getRawHeightFieldValue(int x,int y) const;
00103         void            quantizeWithClamp(int* out, const btVector3& point,int isMax) const;
00104         void            getVertex(int x,int y,btVector3& vertex) const;
00105 
00106 
00107 
00109 
00113         void initialize(int heightStickWidth, int heightStickLength,
00114                         void* heightfieldData, btScalar heightScale,
00115                         btScalar minHeight, btScalar maxHeight, int upAxis,
00116                         PHY_ScalarType heightDataType, bool flipQuadEdges);
00117 
00118 public:
00120 
00125         btHeightfieldTerrainShape(int heightStickWidth,int heightStickLength,
00126                                   void* heightfieldData, btScalar heightScale,
00127                                   btScalar minHeight, btScalar maxHeight,
00128                                   int upAxis, PHY_ScalarType heightDataType,
00129                                   bool flipQuadEdges);
00130 
00132 
00138         btHeightfieldTerrainShape(int heightStickWidth,int heightStickLength,void* heightfieldData, btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges);
00139 
00140         virtual ~btHeightfieldTerrainShape();
00141 
00142 
00143         void setUseDiamondSubdivision(bool useDiamondSubdivision=true) { m_useDiamondSubdivision = useDiamondSubdivision;}
00144 
00145 
00146         virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
00147 
00148         virtual void    processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
00149 
00150         virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
00151 
00152         virtual void    setLocalScaling(const btVector3& scaling);
00153         
00154         virtual const btVector3& getLocalScaling() const;
00155         
00156         //debugging
00157         virtual const char*     getName()const {return "HEIGHTFIELD";}
00158 
00159 };
00160 
00161 #endif //BT_HEIGHTFIELD_TERRAIN_SHAPE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


bullet
Author(s): Erwin Coumans, ROS package maintained by Tully Foote
autogenerated on Wed Oct 31 2012 07:54:31