btHfFluidBuoyantConvexShape.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.com
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  Experimental Buoyancy fluid demo written by John McCutchan
00016  */
00017 #ifndef __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H
00018 #define __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H
00019 
00020 #include "LinearMath/btVector3.h"
00021 #include "BulletCollision/CollisionShapes/btCollisionShape.h"
00022 
00023 #define MAX_VOXEL_DIMENSION 32
00024 
00025 class btConvexShape;
00027 class btHfFluidBuoyantConvexShape : public btCollisionShape
00028 {
00029 public:
00030   btHfFluidBuoyantConvexShape(btConvexShape* convexShape);
00031   ~btHfFluidBuoyantConvexShape();
00032   void generateShape(btScalar radius, btScalar gap);
00033 
00034   btConvexShape* getConvexShape()
00035   {
00036     return m_convexShape;
00037   }
00038 
00039   virtual void getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const;
00040   virtual void setMargin(btScalar margin);
00041   virtual btScalar getMargin() const;
00042   virtual void setLocalScaling(const btVector3& scaling);
00043   virtual const btVector3& getLocalScaling() const;
00044   virtual void calculateLocalInertia(btScalar mass, btVector3& inertia) const;
00045   virtual const char* getName() const;
00046 
00047   btScalar getVoxelRadius() const
00048   {
00049     return m_radius;
00050   }
00051   btScalar getTotalVolume() const
00052   {
00053     return m_totalVolume;
00054   }
00055   btScalar getVolumePerVoxel() const
00056   {
00057     return m_volumePerVoxel;
00058   }
00059   btScalar getFloatyness() const
00060   {
00061     return m_floatyness;
00062   }
00063   void setFloatyness(btScalar floatyness)
00064   {
00065     m_floatyness = floatyness;
00066   }
00067   int getNumVoxels() const
00068   {
00069     return m_numVoxels;
00070   }
00071   const btVector3* getVoxelPositionsArray()
00072   {
00073     return m_voxelPositions;
00074   }
00075 
00076 protected:
00077   btScalar m_floatyness;
00078   btScalar m_radius;
00079   btScalar m_totalVolume;
00080   btScalar m_volumePerVoxel;
00081   int m_numVoxels;
00082   btVector3* m_voxelPositions;
00083   btConvexShape* m_convexShape;
00084 };
00085 
00086 #endif


uwsim
Author(s): Mario Prats
autogenerated on Mon Oct 6 2014 08:24:07