bullet3/examples/FractureDemo/btFractureDynamicsWorld.h

48 lines
1.5 KiB
C
Raw Normal View History

2015-05-03 17:01:30 +00:00
#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.
2015-05-03 17:01:30 +00:00
///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;
2015-05-03 17:01:30 +00:00
btFractureBody* addNewBody(const btTransform& oldTransform, btScalar* masses, btCompoundShape* oldCompound);
2015-05-03 17:01:30 +00:00
void breakDisconnectedParts(btFractureBody* fracObj);
2015-05-03 17:01:30 +00:00
public:
btFractureDynamicsWorld(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration);
2015-05-03 17:01:30 +00:00
virtual void addRigidBody(btRigidBody* body);
2015-05-03 17:01:30 +00:00
virtual void removeRigidBody(btRigidBody* body);
2015-05-03 17:01:30 +00:00
void solveConstraints(btContactSolverInfo& solverInfo);
2015-05-03 17:01:30 +00:00
///either fracture or glue (!fracture)
void setFractureMode(bool fracture)
2015-05-03 17:01:30 +00:00
{
m_fracturingMode = fracture;
}
bool getFractureMode() const { return m_fracturingMode; }
2015-05-03 17:01:30 +00:00
///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