1 | /* |
---|
2 | Bullet Continuous Collision Detection and Physics Library |
---|
3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
4 | |
---|
5 | This software is provided 'as-is', without any express or implied warranty. |
---|
6 | In no event will the authors be held liable for any damages arising from the use of this software. |
---|
7 | Permission is granted to anyone to use this software for any purpose, |
---|
8 | including commercial applications, and to alter it and redistribute it freely, |
---|
9 | subject to the following restrictions: |
---|
10 | |
---|
11 | 1. 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. |
---|
12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
---|
13 | 3. This notice may not be removed or altered from any source distribution. |
---|
14 | */ |
---|
15 | |
---|
16 | #include "btSoftRigidCollisionAlgorithm.h" |
---|
17 | #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" |
---|
18 | #include "BulletCollision/CollisionShapes/btSphereShape.h" |
---|
19 | #include "BulletCollision/CollisionShapes/btBoxShape.h" |
---|
20 | #include "BulletCollision/CollisionDispatch/btCollisionObject.h" |
---|
21 | #include "btSoftBody.h" |
---|
22 | ///TODO: include all the shapes that the softbody can collide with |
---|
23 | ///alternatively, implement special case collision algorithms (just like for rigid collision shapes) |
---|
24 | |
---|
25 | //#include <stdio.h> |
---|
26 | |
---|
27 | btSoftRigidCollisionAlgorithm::btSoftRigidCollisionAlgorithm(btPersistentManifold* /*mf*/,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* /*col0*/,btCollisionObject* /*col1*/, bool isSwapped) |
---|
28 | : btCollisionAlgorithm(ci), |
---|
29 | //m_ownManifold(false), |
---|
30 | //m_manifoldPtr(mf), |
---|
31 | m_isSwapped(isSwapped) |
---|
32 | { |
---|
33 | } |
---|
34 | |
---|
35 | |
---|
36 | btSoftRigidCollisionAlgorithm::~btSoftRigidCollisionAlgorithm() |
---|
37 | { |
---|
38 | |
---|
39 | //m_softBody->m_overlappingRigidBodies.remove(m_rigidCollisionObject); |
---|
40 | |
---|
41 | /*if (m_ownManifold) |
---|
42 | { |
---|
43 | if (m_manifoldPtr) |
---|
44 | m_dispatcher->releaseManifold(m_manifoldPtr); |
---|
45 | } |
---|
46 | */ |
---|
47 | |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | #include <stdio.h> |
---|
52 | |
---|
53 | void btSoftRigidCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) |
---|
54 | { |
---|
55 | (void)dispatchInfo; |
---|
56 | (void)resultOut; |
---|
57 | //printf("btSoftRigidCollisionAlgorithm\n"); |
---|
58 | |
---|
59 | btSoftBody* softBody = m_isSwapped? (btSoftBody*)body1 : (btSoftBody*)body0; |
---|
60 | btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1; |
---|
61 | |
---|
62 | softBody->defaultCollisionHandler(rigidCollisionObject); |
---|
63 | |
---|
64 | |
---|
65 | } |
---|
66 | |
---|
67 | btScalar btSoftRigidCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btCollisionObject* col1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) |
---|
68 | { |
---|
69 | (void)resultOut; |
---|
70 | (void)dispatchInfo; |
---|
71 | (void)col0; |
---|
72 | (void)col1; |
---|
73 | |
---|
74 | //not yet |
---|
75 | return btScalar(1.); |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | |
---|