cleaned up FractureDemo, still need to apply the velocity/impulses after the fracture took place
This commit is contained in:
48
Demos/FractureDemo/btFractureDynamicsWorld.h
Normal file
48
Demos/FractureDemo/btFractureDynamicsWorld.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#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;
|
||||
|
||||
void glueCallback(btScalar timeStep);
|
||||
|
||||
void fractureCallback( btScalar timeStep);
|
||||
|
||||
void 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;}
|
||||
};
|
||||
|
||||
#endif //_BT_FRACTURE_DYNAMICS_WORLD_H
|
||||
|
||||
Reference in New Issue
Block a user