Blender V2.61 - r43446
|
00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 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. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #include "btSoftRigidCollisionAlgorithm.h" 00017 #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" 00018 #include "BulletCollision/CollisionShapes/btSphereShape.h" 00019 #include "BulletCollision/CollisionShapes/btBoxShape.h" 00020 #include "BulletCollision/CollisionDispatch/btCollisionObject.h" 00021 #include "btSoftBody.h" 00022 #include "BulletSoftBody/btSoftBodySolvers.h" 00023 00026 00027 //#include <stdio.h> 00028 00029 btSoftRigidCollisionAlgorithm::btSoftRigidCollisionAlgorithm(btPersistentManifold* /*mf*/,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* /*col0*/,btCollisionObject* /*col1*/, bool isSwapped) 00030 : btCollisionAlgorithm(ci), 00031 //m_ownManifold(false), 00032 //m_manifoldPtr(mf), 00033 m_isSwapped(isSwapped) 00034 { 00035 } 00036 00037 00038 btSoftRigidCollisionAlgorithm::~btSoftRigidCollisionAlgorithm() 00039 { 00040 00041 //m_softBody->m_overlappingRigidBodies.remove(m_rigidCollisionObject); 00042 00043 /*if (m_ownManifold) 00044 { 00045 if (m_manifoldPtr) 00046 m_dispatcher->releaseManifold(m_manifoldPtr); 00047 } 00048 */ 00049 00050 } 00051 00052 00053 #include <stdio.h> 00054 00055 void btSoftRigidCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) 00056 { 00057 (void)dispatchInfo; 00058 (void)resultOut; 00059 //printf("btSoftRigidCollisionAlgorithm\n"); 00060 00061 btSoftBody* softBody = m_isSwapped? (btSoftBody*)body1 : (btSoftBody*)body0; 00062 btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1; 00063 00064 if (softBody->m_collisionDisabledObjects.findLinearSearch(rigidCollisionObject)==softBody->m_collisionDisabledObjects.size()) 00065 { 00066 softBody->getSoftBodySolver()->processCollision(softBody, rigidCollisionObject); 00067 } 00068 00069 00070 } 00071 00072 btScalar btSoftRigidCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btCollisionObject* col1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) 00073 { 00074 (void)resultOut; 00075 (void)dispatchInfo; 00076 (void)col0; 00077 (void)col1; 00078 00079 //not yet 00080 return btScalar(1.); 00081 } 00082 00083 00084