|
Bullet Collision Detection & Physics Library
|
00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com 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 "SpuContactManifoldCollisionAlgorithm.h" 00017 #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" 00018 #include "BulletCollision/CollisionDispatch/btCollisionObject.h" 00019 #include "BulletCollision/CollisionShapes/btCollisionShape.h" 00020 #include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h" 00021 00022 00023 00024 00025 void SpuContactManifoldCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) 00026 { 00027 btAssert(0); 00028 } 00029 00030 btScalar SpuContactManifoldCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) 00031 { 00032 btAssert(0); 00033 return 1.f; 00034 } 00035 00036 #ifndef __SPU__ 00037 SpuContactManifoldCollisionAlgorithm::SpuContactManifoldCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1) 00038 :btCollisionAlgorithm(ci) 00039 #ifdef USE_SEPDISTANCE_UTIL 00040 ,m_sepDistance(body0->getCollisionShape()->getAngularMotionDisc(),body1->getCollisionShape()->getAngularMotionDisc()) 00041 #endif //USE_SEPDISTANCE_UTIL 00042 { 00043 m_manifoldPtr = m_dispatcher->getNewManifold(body0,body1); 00044 m_shapeType0 = body0->getCollisionShape()->getShapeType(); 00045 m_shapeType1 = body1->getCollisionShape()->getShapeType(); 00046 m_collisionMargin0 = body0->getCollisionShape()->getMargin(); 00047 m_collisionMargin1 = body1->getCollisionShape()->getMargin(); 00048 m_collisionObject0 = body0; 00049 m_collisionObject1 = body1; 00050 00051 if (body0->getCollisionShape()->isPolyhedral()) 00052 { 00053 btPolyhedralConvexShape* convex0 = (btPolyhedralConvexShape*)body0->getCollisionShape(); 00054 m_shapeDimensions0 = convex0->getImplicitShapeDimensions(); 00055 } 00056 if (body1->getCollisionShape()->isPolyhedral()) 00057 { 00058 btPolyhedralConvexShape* convex1 = (btPolyhedralConvexShape*)body1->getCollisionShape(); 00059 m_shapeDimensions1 = convex1->getImplicitShapeDimensions(); 00060 } 00061 } 00062 #endif //__SPU__ 00063 00064 00065 SpuContactManifoldCollisionAlgorithm::~SpuContactManifoldCollisionAlgorithm() 00066 { 00067 if (m_manifoldPtr) 00068 m_dispatcher->releaseManifold(m_manifoldPtr); 00069 }