btHfFluidRigidDynamicsWorld.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 
00018 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
00019 
00020 #ifndef BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
00021 #define BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
00022 
00023 class btHfFluid;
00024 typedef btAlignedObjectArray<btHfFluid*> btHfFluidArray;
00025 
00026 #define DRAWMODE_NORMAL 0
00027 #define DRAWMODE_VELOCITY 1
00028 #define DRAWMODE_MAX 2
00029 
00030 #define BODY_DRAWMODE_NORMAL 0
00031 #define BODY_DRAWMODE_VOXEL 1
00032 #define BODY_DRAWMODE_MAX 2
00033 
00034 class btHfFluidBuoyantConvexShape;
00035 
00037 class btHfFluidRigidDynamicsWorld : public btDiscreteDynamicsWorld
00038 {
00039 
00040   btHfFluidArray m_hfFluids;
00041   int m_drawMode;
00042   int m_bodyDrawMode;
00043 protected:
00044 
00045   virtual void predictUnconstraintMotion(btScalar timeStep);
00046 
00047   virtual void internalSingleStepSimulation(btScalar timeStep);
00048 
00049   void updateFluids(btScalar timeStep);
00050 
00051   void solveFluidConstraints(btScalar timeStep);
00052 
00053   virtual void debugDrawWorld();
00054 
00055   void drawHfFluidGround(btIDebugDraw* debugDraw, btHfFluid* fluid);
00056   void drawHfFluidVelocity(btIDebugDraw* debugDraw, btHfFluid* fluid);
00057   void drawHfFluidBuoyantConvexShape(btIDebugDraw* debugDrawer, btCollisionObject* object,
00058                                      btHfFluidBuoyantConvexShape* buoyantShape, int voxelDraw);
00059   void drawHfFluidNormal(btIDebugDraw* debugDraw, btHfFluid* fluid);
00060 public:
00061   void debugDraw()
00062   {
00063     debugDrawWorld();
00064   }
00065   btHfFluidRigidDynamicsWorld(btDispatcher* dispatcher, btBroadphaseInterface* pairCache,
00066                               btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration);
00067 
00068   virtual ~btHfFluidRigidDynamicsWorld();
00069 
00070   void addHfFluid(btHfFluid* fluid);
00071 
00072   void removeHfFluid(btHfFluid* fluid);
00073 
00074   void setDrawMode(int drawMode)
00075   {
00076     m_drawMode = drawMode;
00077   }
00078 
00079   void setBodyDrawMode(int bodyDrawMode)
00080   {
00081     m_bodyDrawMode = bodyDrawMode;
00082   }
00083 
00084   btHfFluidArray& getHfFluidArray()
00085   {
00086     return m_hfFluids;
00087   }
00088 
00089   const btHfFluidArray& getHfFluidArray() const
00090   {
00091     return m_hfFluids;
00092   }
00093 
00094 };
00095 
00096 #endif //BT_HFFLUID_RIGID_DYNAMICS_WORLD_H


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