Files
bullet3/ObsoleteDemos/FractureDemo/btFractureDynamicsWorld.h
erwin coumans 69e5454d18 Add the old Bullet 2.x obsolete demos, and CMake buildsystem files, and gradually move them to newer Bullet 3.x structure
Use statically linked freeglut, instead of dynamic glut for the obsolete Bullet 2.x demos
Add the 'reset' method to b3GpuDynamicsWorld, and use it in the BasicGpuDemo (pretty slow in debug mode, use release mode)
Don't crash in btCollisionWorld, if there is no collision dispatcher
2013-12-19 12:40:59 -08:00

52 lines
1.5 KiB
C++

#ifndef _BT_FRACTURE_DYNAMICS_WORLD_H
#define _BT_FRACTURE_DYNAMICS_WORLD_H
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#include "LinearMath/btAlignedObjectArray.h"
class btFractureBody;
class btCompoundShape;
class btTransform;
///The btFractureDynamicsWorld class enabled basic glue and fracture of objects.
///If/once this implementation is stablized/tested we might merge it into btDiscreteDynamicsWorld and remove the class.
class btFractureDynamicsWorld : public btDiscreteDynamicsWorld
{
btAlignedObjectArray<btFractureBody*> m_fractureBodies;
bool m_fracturingMode;
btFractureBody* addNewBody(const btTransform& oldTransform,btScalar* masses, btCompoundShape* oldCompound);
void breakDisconnectedParts( btFractureBody* fracObj);
public:
btFractureDynamicsWorld ( btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration);
virtual void addRigidBody(btRigidBody* body);
virtual void removeRigidBody(btRigidBody* body);
void solveConstraints(btContactSolverInfo& solverInfo);
///either fracture or glue (!fracture)
void setFractureMode(bool fracture)
{
m_fracturingMode = fracture;
}
bool getFractureMode() const { return m_fracturingMode;}
///normally those callbacks are called internally by the 'solveConstraints'
void glueCallback();
///normally those callbacks are called internally by the 'solveConstraints'
void fractureCallback();
};
#endif //_BT_FRACTURE_DYNAMICS_WORLD_H