Bullet Collision Detection & Physics Library
btSoftBodyConcaveCollisionAlgorithm.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
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_BODY_CONCAVE_COLLISION_ALGORITHM_H
17#define BT_SOFT_BODY_CONCAVE_COLLISION_ALGORITHM_H
18
24class btDispatcher;
27class btSoftBody;
29
31
32#include "BulletCollision/BroadphaseCollision/btQuantizedBvh.h" //for definition of MAX_NUM_PARTS_IN_BITS
33
35{
38
39 btTriIndex(int partId,int triangleIndex,btCollisionShape* shape)
40 {
41 m_PartIdTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | triangleIndex;
42 m_childShape = shape;
43 }
44
45 int getTriangleIndex() const
46 {
47 // Get only the lower bits where the triangle index is stored
48 unsigned int x = 0;
49 unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
50 return (m_PartIdTriangleIndex&~(y));
51 }
52 int getPartId() const
53 {
54 // Get only the highest bits where the part index is stored
56 }
57 int getUid() const
58 {
60 }
61};
62
63
66{
69
72
74
78
80
81public:
83
84 // btPersistentManifold* m_manifoldPtr;
85
86 btSoftBodyTriangleCallback(btDispatcher* dispatcher,const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,bool isSwapped);
87
88 void setTimeStepAndCounters(btScalar collisionMarginTriangle,const btCollisionObjectWrapper* triObjWrap,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
89
91
92 virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
93
94 void clearCache();
95
97 {
98 return m_aabbMin;
99 }
101 {
102 return m_aabbMax;
103 }
104
105};
106
107
108
109
112{
113
115
117
118public:
119
121
123
124 virtual void processCollision (const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
125
127
128 virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
129 {
130 //we don't add any manifolds
131 }
132
133 void clearCache();
134
136 {
138 {
140 return new(mem) btSoftBodyConcaveCollisionAlgorithm(ci,body0Wrap,body1Wrap,false);
141 }
142 };
143
145 {
147 {
149 return new(mem) btSoftBodyConcaveCollisionAlgorithm(ci,body0Wrap,body1Wrap,true);
150 }
151 };
152
153};
154
155#endif //BT_SOFT_BODY_CONCAVE_COLLISION_ALGORITHM_H
#define MAX_NUM_PARTS_IN_BITS
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
#define SIMD_FORCE_INLINE
Definition: btScalar.h:81
btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatche...
btCollisionObject can be used to manage collision detection objects.
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:76
virtual void * allocateCollisionAlgorithm(int size)=0
The btHashMap template class implements a generic and lightweight hashmap.
Definition: btHashMap.h:226
btManifoldResult is a helper class to manage contact results.
btSoftBodyConcaveCollisionAlgorithm supports collision between soft body shapes and (concave) triange...
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btSoftBodyConcaveCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)
btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
For each triangle in the concave mesh that overlaps with the AABB of a soft body (m_softBody),...
virtual void processTriangle(btVector3 *triangle, int partId, int triangleIndex)
btSoftBodyTriangleCallback(btDispatcher *dispatcher, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
btHashMap< btHashKey< btTriIndex >, btTriIndex > m_shapeCache
void setTimeStepAndCounters(btScalar collisionMarginTriangle, const btCollisionObjectWrapper *triObjWrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
Definition: btSoftBody.h:72
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:84
Used by the btCollisionDispatcher to register and create instances for btCollisionAlgorithm.
virtual btCollisionAlgorithm * CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
virtual btCollisionAlgorithm * CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
class btCollisionShape * m_childShape
btTriIndex(int partId, int triangleIndex, btCollisionShape *shape)