File: btFractureDynamicsWorld.h

package info (click to toggle)
bullet 2.82-r2704%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 24,124 kB
  • ctags: 47,244
  • sloc: cpp: 212,321; ansic: 54,690; xml: 25,012; lisp: 1,460; makefile: 896; objc: 798; sh: 242; python: 204
file content (51 lines) | stat: -rw-r--r-- 1,580 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#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