bullet3/examples/FractureDemo/btFractureDynamicsWorld.h
erwincoumans ab8f16961e Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
2018-09-23 14:17:31 -07:00

48 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