Bullet Collision Detection & Physics Library: btSoftRigidDynamicsWorld.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btSoftRigidDynamicsWorld.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans https://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H
17#define BT_SOFT_RIGID_DYNAMICS_WORLD_H
18
19#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
20#include "btSoftBody.h"
21
22 typedef btAlignedObjectArray<btSoftBody*> btSoftBodyArray;
23
24class btSoftBodySolver;
25
26 class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld
27{
28 btSoftBodyArray m_softBodies;
29 int m_drawFlags;
30 bool m_drawNodeTree;
31 bool m_drawFaceTree;
32 bool m_drawClusterTree;
33 btSoftBodyWorldInfo m_sbi;
35 btSoftBodySolver* m_softBodySolver;
36 bool m_ownsSolver;
37
38protected:
39 virtual void predictUnconstraintMotion(btScalar timeStep);
40
41 virtual void internalSingleStepSimulation(btScalar timeStep);
42
43 void solveSoftBodiesConstraints(btScalar timeStep);
44
45 void serializeSoftBodies(btSerializer* serializer);
46
47public:
48 btSoftRigidDynamicsWorld(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration, btSoftBodySolver* softBodySolver = 0);
49
50 virtual ~btSoftRigidDynamicsWorld();
51
52 virtual void debugDrawWorld();
53
54 void addSoftBody(btSoftBody* body, int collisionFilterGroup = btBroadphaseProxy::DefaultFilter, int collisionFilterMask = btBroadphaseProxy::AllFilter);
55
56 void removeSoftBody(btSoftBody* body);
57
59 virtual void removeCollisionObject(btCollisionObject* collisionObject);
60
61 int getDrawFlags() const { return (m_drawFlags); }
62 void setDrawFlags(int f) { m_drawFlags = f; }
63
64 btSoftBodyWorldInfo& getWorldInfo()
65 {
66 return m_sbi;
67 }
68 const btSoftBodyWorldInfo& getWorldInfo() const
69 {
70 return m_sbi;
71 }
72
73 virtual btDynamicsWorldType getWorldType() const
74 {
75 return BT_SOFT_RIGID_DYNAMICS_WORLD;
76 }
77
78 btSoftBodyArray& getSoftBodyArray()
79 {
80 return m_softBodies;
81 }
82
83 const btSoftBodyArray& getSoftBodyArray() const
84 {
85 return m_softBodies;
86 }
87
88 virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
89
93 static void rayTestSingle(const btTransform& rayFromTrans, const btTransform& rayToTrans,
94 btCollisionObject* collisionObject,
95 const btCollisionShape* collisionShape,
96 const btTransform& colObjWorldTransform,
97 RayResultCallback& resultCallback);
98
99 virtual void serialize(btSerializer* serializer);
100};
101
102#endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H
btDiscreteDynamicsWorld.h
btDynamicsWorldType
btDynamicsWorldType
Definition: btDynamicsWorld.h:31
BT_SOFT_RIGID_DYNAMICS_WORLD
@ BT_SOFT_RIGID_DYNAMICS_WORLD
Definition: btDynamicsWorld.h:35
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btSoftBody.h
btSoftBodyArray
btAlignedObjectArray< btSoftBody * > btSoftBodyArray
Definition: btSoftRigidDynamicsWorld.h:22
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition: btAlignedObjectArray.h:46
btBroadphaseInterface
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
Definition: btBroadphaseInterface.h:50
btCollisionConfiguration
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size,...
Definition: btCollisionConfiguration.h:27
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:51
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:28
btConstraintSolver
Definition: btConstraintSolver.h:42
btDiscreteDynamicsWorld
btDiscreteDynamicsWorld provides discrete rigid body simulation those classes replace the obsolete Cc...
Definition: btDiscreteDynamicsWorld.h:38
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:77
btSerializer
Definition: btSerializer.h:66
btSoftBodySolver
Definition: btSoftBodySolvers.h:29
btSoftBody
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
Definition: btSoftBody.h:75
btSoftRigidDynamicsWorld
Definition: btSoftRigidDynamicsWorld.h:27
btSoftRigidDynamicsWorld::m_sbi
btSoftBodyWorldInfo m_sbi
Definition: btSoftRigidDynamicsWorld.h:33
btSoftRigidDynamicsWorld::m_softBodies
btSoftBodyArray m_softBodies
Definition: btSoftRigidDynamicsWorld.h:28
btSoftRigidDynamicsWorld::getWorldType
virtual btDynamicsWorldType getWorldType() const
Definition: btSoftRigidDynamicsWorld.h:73
btSoftRigidDynamicsWorld::m_drawNodeTree
bool m_drawNodeTree
Definition: btSoftRigidDynamicsWorld.h:30
btSoftRigidDynamicsWorld::serializeSoftBodies
void serializeSoftBodies(btSerializer *serializer)
Definition: btSoftRigidDynamicsWorld.cpp:316
btSoftRigidDynamicsWorld::removeSoftBody
void removeSoftBody(btSoftBody *body)
Definition: btSoftRigidDynamicsWorld.cpp:133
btSoftRigidDynamicsWorld::m_softBodySolver
btSoftBodySolver * m_softBodySolver
Solver classes that encapsulate multiple soft bodies for solving.
Definition: btSoftRigidDynamicsWorld.h:35
btSoftRigidDynamicsWorld::debugDrawWorld
virtual void debugDrawWorld()
Definition: btSoftRigidDynamicsWorld.cpp:149
btSoftRigidDynamicsWorld::~btSoftRigidDynamicsWorld
virtual ~btSoftRigidDynamicsWorld()
Definition: btSoftRigidDynamicsWorld.cpp:60
btSoftRigidDynamicsWorld::getSoftBodyArray
btSoftBodyArray & getSoftBodyArray()
Definition: btSoftRigidDynamicsWorld.h:78
btSoftRigidDynamicsWorld::addSoftBody
void addSoftBody(btSoftBody *body, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
Definition: btSoftRigidDynamicsWorld.cpp:120
btSoftRigidDynamicsWorld::rayTest
virtual void rayTest(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, RayResultCallback &resultCallback) const
rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback This ...
Definition: btSoftRigidDynamicsWorld.cpp:249
btSoftRigidDynamicsWorld::rayTestSingle
static void rayTestSingle(const btTransform &rayFromTrans, const btTransform &rayToTrans, btCollisionObject *collisionObject, const btCollisionShape *collisionShape, const btTransform &colObjWorldTransform, RayResultCallback &resultCallback)
rayTestSingle performs a raycast call and calls the resultCallback.
Definition: btSoftRigidDynamicsWorld.cpp:266
btSoftRigidDynamicsWorld::predictUnconstraintMotion
virtual void predictUnconstraintMotion(btScalar timeStep)
Definition: btSoftRigidDynamicsWorld.cpp:69
btSoftRigidDynamicsWorld::m_ownsSolver
bool m_ownsSolver
Definition: btSoftRigidDynamicsWorld.h:36
btSoftRigidDynamicsWorld::getDrawFlags
int getDrawFlags() const
Definition: btSoftRigidDynamicsWorld.h:61
btSoftRigidDynamicsWorld::m_drawClusterTree
bool m_drawClusterTree
Definition: btSoftRigidDynamicsWorld.h:32
btSoftRigidDynamicsWorld::m_drawFlags
int m_drawFlags
Definition: btSoftRigidDynamicsWorld.h:29
btSoftRigidDynamicsWorld::getWorldInfo
const btSoftBodyWorldInfo & getWorldInfo() const
Definition: btSoftRigidDynamicsWorld.h:68
btSoftRigidDynamicsWorld::serialize
virtual void serialize(btSerializer *serializer)
Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (see B...
Definition: btSoftRigidDynamicsWorld.cpp:333
btSoftRigidDynamicsWorld::internalSingleStepSimulation
virtual void internalSingleStepSimulation(btScalar timeStep)
Definition: btSoftRigidDynamicsWorld.cpp:78
btSoftRigidDynamicsWorld::m_drawFaceTree
bool m_drawFaceTree
Definition: btSoftRigidDynamicsWorld.h:31
btSoftRigidDynamicsWorld::setDrawFlags
void setDrawFlags(int f)
Definition: btSoftRigidDynamicsWorld.h:62
btSoftRigidDynamicsWorld::getWorldInfo
btSoftBodyWorldInfo & getWorldInfo()
Definition: btSoftRigidDynamicsWorld.h:64
btSoftRigidDynamicsWorld::getSoftBodyArray
const btSoftBodyArray & getSoftBodyArray() const
Definition: btSoftRigidDynamicsWorld.h:83
btSoftRigidDynamicsWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise ca...
Definition: btSoftRigidDynamicsWorld.cpp:140
btSoftRigidDynamicsWorld::solveSoftBodiesConstraints
void solveSoftBodiesConstraints(btScalar timeStep)
Definition: btSoftRigidDynamicsWorld.cpp:107
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82
btBroadphaseProxy::AllFilter
@ AllFilter
Definition: btBroadphaseProxy.h:98
btBroadphaseProxy::DefaultFilter
@ DefaultFilter
Definition: btBroadphaseProxy.h:92
btSoftBodyWorldInfo
Definition: btSoftBody.h:48