btFractureDynamicsWorld.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _BT_FRACTURE_DYNAMICS_WORLD_H
  2. #define _BT_FRACTURE_DYNAMICS_WORLD_H
  3. #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
  4. #include "LinearMath/btAlignedObjectArray.h"
  5. class btFractureBody;
  6. class btCompoundShape;
  7. class btTransform;
  8. ///The btFractureDynamicsWorld class enabled basic glue and fracture of objects.
  9. ///If/once this implementation is stablized/tested we might merge it into btDiscreteDynamicsWorld and remove the class.
  10. class btFractureDynamicsWorld : public btDiscreteDynamicsWorld
  11. {
  12. btAlignedObjectArray<btFractureBody*> m_fractureBodies;
  13. bool m_fracturingMode;
  14. btFractureBody* addNewBody(const btTransform& oldTransform,btScalar* masses, btCompoundShape* oldCompound);
  15. void breakDisconnectedParts( btFractureBody* fracObj);
  16. public:
  17. btFractureDynamicsWorld ( btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration);
  18. virtual void addRigidBody(btRigidBody* body);
  19. virtual void removeRigidBody(btRigidBody* body);
  20. void solveConstraints(btContactSolverInfo& solverInfo);
  21. ///either fracture or glue (!fracture)
  22. void setFractureMode(bool fracture)
  23. {
  24. m_fracturingMode = fracture;
  25. }
  26. bool getFractureMode() const { return m_fracturingMode;}
  27. ///normally those callbacks are called internally by the 'solveConstraints'
  28. void glueCallback();
  29. ///normally those callbacks are called internally by the 'solveConstraints'
  30. void fractureCallback();
  31. };
  32. #endif //_BT_FRACTURE_DYNAMICS_WORLD_H