updated demos -> ALT + mouse uses Maya-style controls, replaced BMF_Fonts by GLDebugFont

fix debug drawing of btMultiSphereShape
added box2d demo
added experimental gpu 2d demo
This commit is contained in:
erwin.coumans
2009-05-09 19:27:14 +00:00
parent 7a210546cf
commit 33029ad996
129 changed files with 8576 additions and 2184 deletions

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include <stdio.h>

View File

@@ -11,233 +11,233 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef __HFFLUID_H
#define __HFFLUID_H
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btTriangleCallback.h"
class btPersistentManifold;
class btManifoldResult;
// FIX AABB calculation for whole btHfFluid shape
// Fix flags and fill ratio
// -> Figure out the constants used in flags and fill ratio code
// Fix volume removal
// add buoyant convex vs. convex / concave
// add buoyant concave support (try bunny model)
///experimental buyancy fluid demo
class btHfFluid : public btCollisionObject
{
public:
btHfFluid (btScalar gridCellWidth, int numNodesWidth, int numNodesLength);
~btHfFluid ();
void predictMotion(btScalar dt);
/* Prep does some initial setup of the height field fluid.
* You should call this at initialization time.
*/
void prep ();
static const btHfFluid* upcast(const btCollisionObject* colObj)
{
if (colObj->getInternalType()==CO_HF_FLUID)
return (const btHfFluid*)colObj;
return 0;
}
static btHfFluid* upcast(btCollisionObject* colObj)
{
if (colObj->getInternalType()==CO_HF_FLUID)
return (btHfFluid*)colObj;
return 0;
}
//
// ::btCollisionObject
//
virtual void getAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin = m_aabbMin;
aabbMax = m_aabbMax;
}
int getNumNodesWidth () const { return m_numNodesWidth; }
int getNumNodesLength () const { return m_numNodesLength; }
btScalar getGridCellWidth () const { return m_gridCellWidth; }
btScalar widthPos (int i) const;
btScalar lengthPos (int j) const;
int arrayIndex (int i, int j) const;
int arrayIndex (btScalar i, btScalar j) const;
int arrayIndex (unsigned int i, unsigned int j) const;
const btScalar* getHeightArray () const;
const btScalar* getGroundArray () const;
const btScalar* getEtaArray () const;
const btScalar* getVelocityUArray () const;
const btScalar* getVelocityVArray () const;
const bool* getFlagsArray () const;
void setFluidHeight (int x, int y, btScalar height);
void setFluidHeight (int index, btScalar height);
void addFluidHeight (int x, int y, btScalar height);
void addDisplaced (int i, int j, btScalar r);
void getAabbForColumn (int x, int y, btVector3& aabbMin, btVector3& aabbMax);
btScalar* getHeightArray ();
btScalar* getGroundArray ();
btScalar* getEtaArray ();
btScalar* getVelocityUArray ();
btScalar* getVelocityVArray ();
bool* getFlagsArray ();
void foreachGroundTriangle(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax);
class btHfFluidColumnCallback
{
public:
btHfFluidColumnCallback () {}
virtual ~btHfFluidColumnCallback () {}
virtual bool processColumn (btHfFluid* fluid, int w, int l)
{
return true; // keep going
}
};
void foreachFluidColumn (btHfFluidColumnCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax);
void foreachSurfaceTriangle (btTriangleCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax);
protected:
int m_numNodesWidth;
int m_numNodesLength;
btScalar m_gridCellWidth;
btScalar m_gridWidth;
btScalar m_gridLength;
btScalar m_gridCellWidthInv;
btVector3 m_aabbMin;
btVector3 m_aabbMax;
void setGridDimensions (btScalar gridCellWidth,
int numNodesWidth, int numNodesLength);
btScalar bilinearInterpolate (const btScalar* array, btScalar i, btScalar j);
btScalar advect (const btScalar* array, btScalar i, btScalar j, btScalar di, btScalar dj, btScalar dt);
void advectEta (btScalar dt);
void updateHeight (btScalar dt);
void advectVelocityU (btScalar dt);
void advectVelocityV (btScalar dt);
void updateVelocity (btScalar dt);
void transferDisplaced (btScalar dt);
void setReflectBoundaryLeft ();
void setReflectBoundaryRight ();
void setReflectBoundaryTop ();
void setReflectBoundaryBottom ();
void setAbsorbBoundaryLeft (btScalar dt);
void setAbsorbBoundaryRight (btScalar dt);
void setAbsorbBoundaryTop (btScalar dt);
void setAbsorbBoundaryBottom (btScalar dt);
void computeFlagsAndFillRatio ();
btScalar computeHmin (int i, int j);
btScalar computeHmax (int i, int j);
btScalar computeEtaMax (int i, int j);
void allocateArrays ();
void debugTests ();
btScalar* m_temp; // temp
int m_heightIndex;
btScalar* m_height[2];
btScalar* m_ground;
btScalar* m_eta; // height - ground
btScalar* m_u[2];
btScalar* m_v[2];
int m_rIndex;
btScalar* m_r[2];
int m_velocityIndex;
bool* m_flags;
btScalar* m_fillRatio;
// tweakables
btScalar m_globalVelocityU;
btScalar m_globalVelocityV;
btScalar m_gravity;
btScalar m_volumeDisplacementScale;
btScalar m_horizontalVelocityScale;
btScalar m_epsHeight;
btScalar m_epsEta;
public:
// You can enforce a global velocity at the surface of the fluid
// default: 0.0 and 0.0
void setGlobaVelocity (btScalar globalVelocityU, btScalar globalVelocityV);
void getGlobalVelocity (btScalar& globalVelocityU, btScalar& globalVelocityV) const;
// Control force of gravity, should match physics world
// default: -10.0
void setGravity (btScalar gravity);
btScalar getGravity () const;
// When a body is submerged into the fluid, the displaced fluid
// is spread to adjacent cells. You can control the percentage of this
// by setting this value between 0.0 and 1.0
// default: 0.5
void setVolumeDisplacementScale (btScalar volumeDisplacementScale);
btScalar getVolumeDisplacementScale () const;
// The horizontal velocity of the fluid can influence bodies submerged
// in the fluid. You can control how much influence by setting this
// between 0.0 and 1.0
// default: 0.5
void setHorizontalVelocityScale (btScalar horizontalVelocityScale);
btScalar getHorizontalVelocityScale () const;
};
class btRigidBody;
class btIDebugDraw;
class btHfFluidBuoyantConvexShape;
class btHfFluidColumnRigidBodyCallback : public btHfFluid::btHfFluidColumnCallback
{
protected:
btRigidBody* m_rigidBody;
btHfFluidBuoyantConvexShape* m_buoyantShape;
btIDebugDraw* m_debugDraw;
int m_numVoxels;
btVector3* m_voxelPositionsXformed;
bool* m_voxelSubmerged;
btVector3 m_aabbMin;
btVector3 m_aabbMax;
btScalar m_volume;
btScalar m_density;
btScalar m_floatyness;
public:
btHfFluidColumnRigidBodyCallback (btRigidBody* rigidBody, btIDebugDraw* debugDraw, btScalar density, btScalar floatyness);
~btHfFluidColumnRigidBodyCallback ();
bool processColumn (btHfFluid* fluid, int w, int l);
btScalar getVolume () const { return m_volume; }
};
#endif
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef __HFFLUID_H
#define __HFFLUID_H
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btTriangleCallback.h"
class btPersistentManifold;
class btManifoldResult;
// FIX AABB calculation for whole btHfFluid shape
// Fix flags and fill ratio
// -> Figure out the constants used in flags and fill ratio code
// Fix volume removal
// add buoyant convex vs. convex / concave
// add buoyant concave support (try bunny model)
///experimental buyancy fluid demo
class btHfFluid : public btCollisionObject
{
public:
btHfFluid (btScalar gridCellWidth, int numNodesWidth, int numNodesLength);
~btHfFluid ();
void predictMotion(btScalar dt);
/* Prep does some initial setup of the height field fluid.
* You should call this at initialization time.
*/
void prep ();
static const btHfFluid* upcast(const btCollisionObject* colObj)
{
if (colObj->getInternalType()==CO_HF_FLUID)
return (const btHfFluid*)colObj;
return 0;
}
static btHfFluid* upcast(btCollisionObject* colObj)
{
if (colObj->getInternalType()==CO_HF_FLUID)
return (btHfFluid*)colObj;
return 0;
}
//
// ::btCollisionObject
//
virtual void getAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin = m_aabbMin;
aabbMax = m_aabbMax;
}
int getNumNodesWidth () const { return m_numNodesWidth; }
int getNumNodesLength () const { return m_numNodesLength; }
btScalar getGridCellWidth () const { return m_gridCellWidth; }
btScalar widthPos (int i) const;
btScalar lengthPos (int j) const;
int arrayIndex (int i, int j) const;
int arrayIndex (btScalar i, btScalar j) const;
int arrayIndex (unsigned int i, unsigned int j) const;
const btScalar* getHeightArray () const;
const btScalar* getGroundArray () const;
const btScalar* getEtaArray () const;
const btScalar* getVelocityUArray () const;
const btScalar* getVelocityVArray () const;
const bool* getFlagsArray () const;
void setFluidHeight (int x, int y, btScalar height);
void setFluidHeight (int index, btScalar height);
void addFluidHeight (int x, int y, btScalar height);
void addDisplaced (int i, int j, btScalar r);
void getAabbForColumn (int x, int y, btVector3& aabbMin, btVector3& aabbMax);
btScalar* getHeightArray ();
btScalar* getGroundArray ();
btScalar* getEtaArray ();
btScalar* getVelocityUArray ();
btScalar* getVelocityVArray ();
bool* getFlagsArray ();
void foreachGroundTriangle(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax);
class btHfFluidColumnCallback
{
public:
btHfFluidColumnCallback () {}
virtual ~btHfFluidColumnCallback () {}
virtual bool processColumn (btHfFluid* fluid, int w, int l)
{
return true; // keep going
}
};
void foreachFluidColumn (btHfFluidColumnCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax);
void foreachSurfaceTriangle (btTriangleCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax);
protected:
int m_numNodesWidth;
int m_numNodesLength;
btScalar m_gridCellWidth;
btScalar m_gridWidth;
btScalar m_gridLength;
btScalar m_gridCellWidthInv;
btVector3 m_aabbMin;
btVector3 m_aabbMax;
void setGridDimensions (btScalar gridCellWidth,
int numNodesWidth, int numNodesLength);
btScalar bilinearInterpolate (const btScalar* array, btScalar i, btScalar j);
btScalar advect (const btScalar* array, btScalar i, btScalar j, btScalar di, btScalar dj, btScalar dt);
void advectEta (btScalar dt);
void updateHeight (btScalar dt);
void advectVelocityU (btScalar dt);
void advectVelocityV (btScalar dt);
void updateVelocity (btScalar dt);
void transferDisplaced (btScalar dt);
void setReflectBoundaryLeft ();
void setReflectBoundaryRight ();
void setReflectBoundaryTop ();
void setReflectBoundaryBottom ();
void setAbsorbBoundaryLeft (btScalar dt);
void setAbsorbBoundaryRight (btScalar dt);
void setAbsorbBoundaryTop (btScalar dt);
void setAbsorbBoundaryBottom (btScalar dt);
void computeFlagsAndFillRatio ();
btScalar computeHmin (int i, int j);
btScalar computeHmax (int i, int j);
btScalar computeEtaMax (int i, int j);
void allocateArrays ();
void debugTests ();
btScalar* m_temp; // temp
int m_heightIndex;
btScalar* m_height[2];
btScalar* m_ground;
btScalar* m_eta; // height - ground
btScalar* m_u[2];
btScalar* m_v[2];
int m_rIndex;
btScalar* m_r[2];
int m_velocityIndex;
bool* m_flags;
btScalar* m_fillRatio;
// tweakables
btScalar m_globalVelocityU;
btScalar m_globalVelocityV;
btScalar m_gravity;
btScalar m_volumeDisplacementScale;
btScalar m_horizontalVelocityScale;
btScalar m_epsHeight;
btScalar m_epsEta;
public:
// You can enforce a global velocity at the surface of the fluid
// default: 0.0 and 0.0
void setGlobaVelocity (btScalar globalVelocityU, btScalar globalVelocityV);
void getGlobalVelocity (btScalar& globalVelocityU, btScalar& globalVelocityV) const;
// Control force of gravity, should match physics world
// default: -10.0
void setGravity (btScalar gravity);
btScalar getGravity () const;
// When a body is submerged into the fluid, the displaced fluid
// is spread to adjacent cells. You can control the percentage of this
// by setting this value between 0.0 and 1.0
// default: 0.5
void setVolumeDisplacementScale (btScalar volumeDisplacementScale);
btScalar getVolumeDisplacementScale () const;
// The horizontal velocity of the fluid can influence bodies submerged
// in the fluid. You can control how much influence by setting this
// between 0.0 and 1.0
// default: 0.5
void setHorizontalVelocityScale (btScalar horizontalVelocityScale);
btScalar getHorizontalVelocityScale () const;
};
class btRigidBody;
class btIDebugDraw;
class btHfFluidBuoyantConvexShape;
class btHfFluidColumnRigidBodyCallback : public btHfFluid::btHfFluidColumnCallback
{
protected:
btRigidBody* m_rigidBody;
btHfFluidBuoyantConvexShape* m_buoyantShape;
btIDebugDraw* m_debugDraw;
int m_numVoxels;
btVector3* m_voxelPositionsXformed;
bool* m_voxelSubmerged;
btVector3 m_aabbMin;
btVector3 m_aabbMax;
btScalar m_volume;
btScalar m_density;
btScalar m_floatyness;
public:
btHfFluidColumnRigidBodyCallback (btRigidBody* rigidBody, btIDebugDraw* debugDraw, btScalar density, btScalar floatyness);
~btHfFluidColumnRigidBodyCallback ();
bool processColumn (btHfFluid* fluid, int w, int l);
btScalar getVolume () const { return m_volume; }
};
#endif

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include <stdio.h>

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H
#define __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include <stdio.h>

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef HF_FLUID_BUOYANT_SHAPE_COLLISION_ALGORITHM_H

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include "btHfFluidCollisionShape.h"
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include "btHfFluidCollisionShape.h"

View File

@@ -11,84 +11,84 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef BT_HF_FLUID_COLLISION_SHAPE_H
#define BT_HF_FLUID_COLLISION_SHAPE_H
#include "btHfFluid.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btConvexInternalShape.h"
#include "BulletCollision/CollisionShapes/btConcaveShape.h"
class btHfFluidCollisionShape : public btConcaveShape
{
public:
btHfFluid* m_fluid;
btHfFluidCollisionShape(btHfFluid* backptr) : btConcaveShape ()
{
m_shapeType = HFFLUID_SHAPE_PROXYTYPE;
m_fluid=backptr;
}
virtual ~btHfFluidCollisionShape()
{
}
void processAllTriangles(btTriangleCallback* /*callback*/,const btVector3& /*aabbMin*/,const btVector3& /*aabbMax*/) const
{
//not yet
btAssert(0);
}
///getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{
/* t should be identity, but better be safe than...fast? */
btVector3 mins;
btVector3 maxs;
m_fluid->getAabb (mins, maxs);
const btVector3 crns[]={t*btVector3(mins.x(),mins.y(),mins.z()),
t*btVector3(maxs.x(),mins.y(),mins.z()),
t*btVector3(maxs.x(),maxs.y(),mins.z()),
t*btVector3(mins.x(),maxs.y(),mins.z()),
t*btVector3(mins.x(),mins.y(),maxs.z()),
t*btVector3(maxs.x(),mins.y(),maxs.z()),
t*btVector3(maxs.x(),maxs.y(),maxs.z()),
t*btVector3(mins.x(),maxs.y(),maxs.z())};
aabbMin=aabbMax=crns[0];
for(int i=1;i<8;++i)
{
aabbMin.setMin(crns[i]);
aabbMax.setMax(crns[i]);
}
}
virtual void setLocalScaling(const btVector3& /*scaling*/)
{
///na
btAssert(0);
}
virtual const btVector3& getLocalScaling() const
{
static const btVector3 dummy(1,1,1);
return dummy;
}
virtual void calculateLocalInertia(btScalar /*mass*/,btVector3& /*inertia*/) const
{
///not yet
btAssert(0);
}
virtual const char* getName()const
{
return "HfFluid";
}
};
#endif
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef BT_HF_FLUID_COLLISION_SHAPE_H
#define BT_HF_FLUID_COLLISION_SHAPE_H
#include "btHfFluid.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btConvexInternalShape.h"
#include "BulletCollision/CollisionShapes/btConcaveShape.h"
class btHfFluidCollisionShape : public btConcaveShape
{
public:
btHfFluid* m_fluid;
btHfFluidCollisionShape(btHfFluid* backptr) : btConcaveShape ()
{
m_shapeType = HFFLUID_SHAPE_PROXYTYPE;
m_fluid=backptr;
}
virtual ~btHfFluidCollisionShape()
{
}
void processAllTriangles(btTriangleCallback* /*callback*/,const btVector3& /*aabbMin*/,const btVector3& /*aabbMax*/) const
{
//not yet
btAssert(0);
}
///getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{
/* t should be identity, but better be safe than...fast? */
btVector3 mins;
btVector3 maxs;
m_fluid->getAabb (mins, maxs);
const btVector3 crns[]={t*btVector3(mins.x(),mins.y(),mins.z()),
t*btVector3(maxs.x(),mins.y(),mins.z()),
t*btVector3(maxs.x(),maxs.y(),mins.z()),
t*btVector3(mins.x(),maxs.y(),mins.z()),
t*btVector3(mins.x(),mins.y(),maxs.z()),
t*btVector3(maxs.x(),mins.y(),maxs.z()),
t*btVector3(maxs.x(),maxs.y(),maxs.z()),
t*btVector3(mins.x(),maxs.y(),maxs.z())};
aabbMin=aabbMax=crns[0];
for(int i=1;i<8;++i)
{
aabbMin.setMin(crns[i]);
aabbMax.setMax(crns[i]);
}
}
virtual void setLocalScaling(const btVector3& /*scaling*/)
{
///na
btAssert(0);
}
virtual const btVector3& getLocalScaling() const
{
static const btVector3 dummy(1,1,1);
return dummy;
}
virtual void calculateLocalInertia(btScalar /*mass*/,btVector3& /*inertia*/) const
{
///not yet
btAssert(0);
}
virtual const char* getName()const
{
return "HfFluid";
}
};
#endif

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include <stdio.h>

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef HF_FLUID_RIGID_COLLISION_ALGORITHM_H

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include "btHfFluidRigidCollisionConfiguration.h"

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef BT_HFFLUID_RIGID_COLLISION_CONFIGURATION

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include <stdio.h>

View File

@@ -11,82 +11,82 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#ifndef BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
#define BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
class btHfFluid;
typedef btAlignedObjectArray<btHfFluid*> btHfFluidArray;
#define DRAWMODE_NORMAL 0
#define DRAWMODE_VELOCITY 1
#define DRAWMODE_MAX 2
#define BODY_DRAWMODE_NORMAL 0
#define BODY_DRAWMODE_VOXEL 1
#define BODY_DRAWMODE_MAX 2
class btHfFluidBuoyantConvexShape;
///experimental buyancy fluid demo
class btHfFluidRigidDynamicsWorld : public btDiscreteDynamicsWorld
{
btHfFluidArray m_hfFluids;
int m_drawMode;
int m_bodyDrawMode;
protected:
virtual void predictUnconstraintMotion(btScalar timeStep);
virtual void internalSingleStepSimulation( btScalar timeStep);
void updateFluids(btScalar timeStep);
void solveFluidConstraints(btScalar timeStep);
virtual void debugDrawWorld();
void drawHfFluidGround (btIDebugDraw* debugDraw, btHfFluid* fluid);
void drawHfFluidVelocity (btIDebugDraw* debugDraw, btHfFluid* fluid);
void drawHfFluidBuoyantConvexShape (btIDebugDraw* debugDrawer, btCollisionObject* object, btHfFluidBuoyantConvexShape* buoyantShape, int voxelDraw);
void drawHfFluidNormal (btIDebugDraw* debugDraw, btHfFluid* fluid);
public:
btHfFluidRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration);
virtual ~btHfFluidRigidDynamicsWorld();
void addHfFluid(btHfFluid* fluid);
void removeHfFluid(btHfFluid* fluid);
void setDrawMode (int drawMode)
{
m_drawMode = drawMode;
}
void setBodyDrawMode (int bodyDrawMode)
{
m_bodyDrawMode = bodyDrawMode;
}
btHfFluidArray& getHfFluidArray()
{
return m_hfFluids;
}
const btHfFluidArray& getHfFluidArray() const
{
return m_hfFluids;
}
};
#endif //BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#ifndef BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
#define BT_HFFLUID_RIGID_DYNAMICS_WORLD_H
class btHfFluid;
typedef btAlignedObjectArray<btHfFluid*> btHfFluidArray;
#define DRAWMODE_NORMAL 0
#define DRAWMODE_VELOCITY 1
#define DRAWMODE_MAX 2
#define BODY_DRAWMODE_NORMAL 0
#define BODY_DRAWMODE_VOXEL 1
#define BODY_DRAWMODE_MAX 2
class btHfFluidBuoyantConvexShape;
///experimental buyancy fluid demo
class btHfFluidRigidDynamicsWorld : public btDiscreteDynamicsWorld
{
btHfFluidArray m_hfFluids;
int m_drawMode;
int m_bodyDrawMode;
protected:
virtual void predictUnconstraintMotion(btScalar timeStep);
virtual void internalSingleStepSimulation( btScalar timeStep);
void updateFluids(btScalar timeStep);
void solveFluidConstraints(btScalar timeStep);
virtual void debugDrawWorld();
void drawHfFluidGround (btIDebugDraw* debugDraw, btHfFluid* fluid);
void drawHfFluidVelocity (btIDebugDraw* debugDraw, btHfFluid* fluid);
void drawHfFluidBuoyantConvexShape (btIDebugDraw* debugDrawer, btCollisionObject* object, btHfFluidBuoyantConvexShape* buoyantShape, int voxelDraw);
void drawHfFluidNormal (btIDebugDraw* debugDraw, btHfFluid* fluid);
public:
btHfFluidRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration);
virtual ~btHfFluidRigidDynamicsWorld();
void addHfFluid(btHfFluid* fluid);
void removeHfFluid(btHfFluid* fluid);
void setDrawMode (int drawMode)
{
m_drawMode = drawMode;
}
void setBodyDrawMode (int bodyDrawMode)
{
m_bodyDrawMode = bodyDrawMode;
}
btHfFluidArray& getHfFluidArray()
{
return m_hfFluids;
}
const btHfFluidArray& getHfFluidArray() const
{
return m_hfFluids;
}
};
#endif //BT_HFFLUID_RIGID_DYNAMICS_WORLD_H

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#include "btBulletDynamicsCommon.h"
@@ -26,7 +26,6 @@ Experimental Buoyancy fluid demo written by John McCutchan
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btRandom.h"
#include "BMF_Api.h"
#include <stdio.h> //printf debugging
#include "LinearMath/btConvexHull.h"

View File

@@ -11,14 +11,14 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef HFFLUID_DEMO_H
#define HFFLUID_DEMO_H
#include "DemoApplication.h"
#include "GlutDemoApplication.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "BulletHfFluid/btHfFluid.h"
@@ -36,7 +36,7 @@ class btFluidRididCollisionAlgorithm;
///experimental buyancy fluid demo
///CcdPhysicsDemo shows basic stacking using Bullet physics, and allows toggle of Ccd (using key '1')
class HfFluidDemo : public DemoApplication
class HfFluidDemo : public GlutDemoApplication
{
public:
btAlignedObjectArray<btFluidRididCollisionAlgorithm*> m_FluidRigidCollisionAlgorithms;

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifdef WIN32 //needed for glut.h
@@ -54,7 +54,6 @@ Experimental Buoyancy fluid demo written by John McCutchan
#include "LinearMath/btIDebugDraw.h"
//for debugmodes
#include "BMF_Api.h"
#include <stdio.h> //printf debugging
#include <map>
@@ -422,7 +421,7 @@ void HfFluidDemo_GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape*
glRasterPos3f(vtx.x(), vtx.y(), vtx.z());
char buf[12];
sprintf(buf," %d",i);
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
// BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
}
for (i=0;i<polyshape->getNumPlanes();i++)
@@ -435,7 +434,7 @@ void HfFluidDemo_GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape*
glRasterPos3f(normal.x()*d, normal.y()*d, normal.z()*d);
char buf[12];
sprintf(buf," plane %d",i);
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
// BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
}
}
@@ -502,7 +501,7 @@ glDisable(GL_DEPTH_TEST);
glRasterPos3f(0,0,0);//mvtx.x(), vtx.y(), vtx.z());
if (debugMode&btIDebugDraw::DBG_DrawText)
{
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->getName());
// BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->getName());
}
if (debugMode& btIDebugDraw::DBG_DrawFeaturesText)

View File

@@ -11,8 +11,8 @@ subject to the following restrictions:
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.
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.
Experimental Buoyancy fluid demo written by John McCutchan
Experimental Buoyancy fluid demo written by John McCutchan
*/
#ifndef HFFLUID_GL_SHAPE_DRAWER_H