Added Height Field Fluid Demo to Bullet. All code stored in the Demos/HeightFieldFluidDemo directory for now.

Please see HfFluidDemo.cpp for examples of how to use the height field fluid along with buoyant collision shapes.

The implementation is still lacking in my ways:
1) Need to complete more collision algorithms for buoyant collision shapes
2) Support compound buoyant shapes
3) The buoyancy model isn't that great
4) Fluid volume can be lost over time
This commit is contained in:
john.mccutchan
2009-01-08 22:53:23 +00:00
parent 9b57ba57f7
commit a8ec916af0
44 changed files with 5976 additions and 1183 deletions

View File

@@ -25,6 +25,7 @@ class btShapeHull;
/// OpenGL shape drawing
class GL_ShapeDrawer
{
protected:
struct ShapeCache
{
struct Edge { btVector3 n[2];int v[2]; };
@@ -38,17 +39,17 @@ class GL_ShapeDrawer
bool m_textureenabled;
bool m_textureinitialized;
private:
ShapeCache* cache(btConvexShape*);
public:
public:
GL_ShapeDrawer();
virtual ~GL_ShapeDrawer();
///drawOpenGL might allocate temporary memoty, stores pointer in shape userpointer
void drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
void drawShadow(btScalar* m, const btVector3& extrusion,const btCollisionShape* shape,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
virtual void drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color,int debugMode,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
virtual void drawShadow(btScalar* m, const btVector3& extrusion,const btCollisionShape* shape,const btVector3& worldBoundsMin,const btVector3& worldBoundsMax);
bool enableTexture(bool enable) { bool p=m_textureenabled;m_textureenabled=enable;return(p); }
bool hasTextureEnabled() const
@@ -64,4 +65,4 @@ class GL_ShapeDrawer
void OGL_displaylist_register_shape(btCollisionShape * shape);
void OGL_displaylist_clean();
#endif //GL_SHAPE_DRAWER_H
#endif //GL_SHAPE_DRAWER_H