removed files (are now in BulletSoftBody lib)
This commit is contained in:
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
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.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "btSoftBodyRigidBodyCollisionConfiguration.h"
|
|
||||||
#include "btSoftRigidCollisionAlgorithm.h"
|
|
||||||
#include "btSoftSoftCollisionAlgorithm.h"
|
|
||||||
|
|
||||||
|
|
||||||
btSoftBodyRigidBodyCollisionConfiguration::btSoftBodyRigidBodyCollisionConfiguration(btStackAlloc* stackAlloc,btPoolAllocator* persistentManifoldPool,btPoolAllocator* collisionAlgorithmPool)
|
|
||||||
:btDefaultCollisionConfiguration(stackAlloc,persistentManifoldPool,collisionAlgorithmPool)
|
|
||||||
{
|
|
||||||
void* mem;
|
|
||||||
|
|
||||||
mem = btAlignedAlloc(sizeof(btSoftSoftCollisionAlgorithm::CreateFunc),16);
|
|
||||||
m_softSoftCreateFunc = new(mem) btSoftSoftCollisionAlgorithm::CreateFunc;
|
|
||||||
|
|
||||||
mem = btAlignedAlloc(sizeof(btSoftRigidCollisionAlgorithm::CreateFunc),16);
|
|
||||||
m_softRigidCreateFunc = new(mem) btSoftRigidCollisionAlgorithm::CreateFunc;
|
|
||||||
|
|
||||||
mem = btAlignedAlloc(sizeof(btSoftRigidCollisionAlgorithm::CreateFunc),16);
|
|
||||||
m_swappedSoftRigidCreateFunc = new(mem) btSoftRigidCollisionAlgorithm::CreateFunc;
|
|
||||||
m_swappedSoftRigidCreateFunc->m_swapped=true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
btSoftBodyRigidBodyCollisionConfiguration::~btSoftBodyRigidBodyCollisionConfiguration()
|
|
||||||
{
|
|
||||||
m_softSoftCreateFunc->~btCollisionAlgorithmCreateFunc();
|
|
||||||
btAlignedFree( m_softSoftCreateFunc);
|
|
||||||
|
|
||||||
m_softRigidCreateFunc->~btCollisionAlgorithmCreateFunc();
|
|
||||||
btAlignedFree( m_softRigidCreateFunc);
|
|
||||||
|
|
||||||
m_swappedSoftRigidCreateFunc->~btCollisionAlgorithmCreateFunc();
|
|
||||||
btAlignedFree( m_swappedSoftRigidCreateFunc);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
///creation of soft-soft and soft-rigid, and otherwise fallback to base class implementation
|
|
||||||
btCollisionAlgorithmCreateFunc* btSoftBodyRigidBodyCollisionConfiguration::getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1)
|
|
||||||
{
|
|
||||||
|
|
||||||
///try to handle the softbody interactions first
|
|
||||||
|
|
||||||
if ((proxyType0 == SOFTBODY_SHAPE_PROXYTYPE ) && (proxyType1==SOFTBODY_SHAPE_PROXYTYPE))
|
|
||||||
{
|
|
||||||
return m_softSoftCreateFunc;
|
|
||||||
}
|
|
||||||
|
|
||||||
///other can't be also softbody, so assume rigid for now
|
|
||||||
if (proxyType0 == SOFTBODY_SHAPE_PROXYTYPE )
|
|
||||||
{
|
|
||||||
return m_softRigidCreateFunc;
|
|
||||||
}
|
|
||||||
|
|
||||||
///other can't be also softbody, so assume rigid for now
|
|
||||||
if (proxyType1 == SOFTBODY_SHAPE_PROXYTYPE )
|
|
||||||
{
|
|
||||||
return m_swappedSoftRigidCreateFunc;
|
|
||||||
}
|
|
||||||
|
|
||||||
///fallback to the regular rigid collision shape
|
|
||||||
return btDefaultCollisionConfiguration::getCollisionAlgorithmCreateFunc(proxyType0,proxyType1);
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
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.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BT_SOFTBODY_RIGIDBODY_COLLISION_CONFIGURATION
|
|
||||||
#define BT_SOFTBODY_RIGIDBODY_COLLISION_CONFIGURATION
|
|
||||||
|
|
||||||
#include "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h"
|
|
||||||
|
|
||||||
class btVoronoiSimplexSolver;
|
|
||||||
class btGjkEpaPenetrationDepthSolver;
|
|
||||||
|
|
||||||
|
|
||||||
///btSoftBodyRigidBodyCollisionConfiguration add softbody interaction on top of btDefaultCollisionConfiguration
|
|
||||||
class btSoftBodyRigidBodyCollisionConfiguration : public btDefaultCollisionConfiguration
|
|
||||||
{
|
|
||||||
|
|
||||||
//default CreationFunctions, filling the m_doubleDispatch table
|
|
||||||
btCollisionAlgorithmCreateFunc* m_softSoftCreateFunc;
|
|
||||||
btCollisionAlgorithmCreateFunc* m_softRigidCreateFunc;
|
|
||||||
btCollisionAlgorithmCreateFunc* m_swappedSoftRigidCreateFunc;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
btSoftBodyRigidBodyCollisionConfiguration(btStackAlloc* stackAlloc=0,btPoolAllocator* persistentManifoldPool=0,btPoolAllocator* collisionAlgorithmPool=0);
|
|
||||||
|
|
||||||
virtual ~btSoftBodyRigidBodyCollisionConfiguration();
|
|
||||||
|
|
||||||
///creation of soft-soft and soft-rigid, and otherwise fallback to base class implementation
|
|
||||||
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //BT_SOFTBODY_RIGIDBODY_COLLISION_CONFIGURATION
|
|
||||||
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
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.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "btSoftRigidCollisionAlgorithm.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
|
|
||||||
#include "BulletCollision/CollisionShapes/btSphereShape.h"
|
|
||||||
#include "BulletCollision/CollisionShapes/btBoxShape.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
|
||||||
#include "BulletDynamics/SoftBody/btSoftBody.h"
|
|
||||||
///TODO: include all the shapes that the softbody can collide with
|
|
||||||
///alternatively, implement special case collision algorithms (just like for rigid collision shapes)
|
|
||||||
|
|
||||||
//#include <stdio.h>
|
|
||||||
|
|
||||||
btSoftRigidCollisionAlgorithm::btSoftRigidCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped)
|
|
||||||
: btCollisionAlgorithm(ci),
|
|
||||||
//m_ownManifold(false),
|
|
||||||
//m_manifoldPtr(mf),
|
|
||||||
m_isSwapped(isSwapped)
|
|
||||||
{
|
|
||||||
|
|
||||||
//m_softBody = m_isSwapped? (btSoftBody*)col1 : (btSoftBody*)col0;
|
|
||||||
//m_rigidCollisionObject = m_isSwapped? col0 : col1;
|
|
||||||
|
|
||||||
//quick fix, add overlapping rigidbody to softbody, so it can be handled within btSoftBody::Step method
|
|
||||||
//m_softBody->m_overlappingRigidBodies.push_back(m_rigidCollisionObject);
|
|
||||||
|
|
||||||
///store the contacts straight into the btSoftBody for now?
|
|
||||||
|
|
||||||
/*if (!m_manifoldPtr && m_dispatcher->needsCollision(sphereObj,boxObj))
|
|
||||||
{
|
|
||||||
m_manifoldPtr = m_dispatcher->getNewManifold(sphereObj,boxObj);
|
|
||||||
m_ownManifold = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
btSoftRigidCollisionAlgorithm::~btSoftRigidCollisionAlgorithm()
|
|
||||||
{
|
|
||||||
|
|
||||||
//m_softBody->m_overlappingRigidBodies.remove(m_rigidCollisionObject);
|
|
||||||
|
|
||||||
/*if (m_ownManifold)
|
|
||||||
{
|
|
||||||
if (m_manifoldPtr)
|
|
||||||
m_dispatcher->releaseManifold(m_manifoldPtr);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void btSoftRigidCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
|
|
||||||
{
|
|
||||||
(void)dispatchInfo;
|
|
||||||
(void)resultOut;
|
|
||||||
//printf("btSoftRigidCollisionAlgorithm\n");
|
|
||||||
|
|
||||||
btSoftBody* softBody = m_isSwapped? (btSoftBody*)body1 : (btSoftBody*)body0;
|
|
||||||
btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1;
|
|
||||||
|
|
||||||
softBody->defaultCollisionHandler(rigidCollisionObject);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
btScalar btSoftRigidCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btCollisionObject* col1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
|
|
||||||
{
|
|
||||||
(void)resultOut;
|
|
||||||
(void)dispatchInfo;
|
|
||||||
(void)col0;
|
|
||||||
(void)col1;
|
|
||||||
|
|
||||||
//not yet
|
|
||||||
return btScalar(1.);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
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.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SOFT_RIGID_COLLISION_ALGORITHM_H
|
|
||||||
#define SOFT_RIGID_COLLISION_ALGORITHM_H
|
|
||||||
|
|
||||||
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
|
|
||||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
|
|
||||||
class btPersistentManifold;
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
|
|
||||||
|
|
||||||
#include "LinearMath/btVector3.h"
|
|
||||||
class btSoftBody;
|
|
||||||
|
|
||||||
/// btSoftRigidCollisionAlgorithm provides collision detection between btSoftBody and btRigidBody
|
|
||||||
class btSoftRigidCollisionAlgorithm : public btCollisionAlgorithm
|
|
||||||
{
|
|
||||||
// bool m_ownManifold;
|
|
||||||
// btPersistentManifold* m_manifoldPtr;
|
|
||||||
|
|
||||||
btSoftBody* m_softBody;
|
|
||||||
btCollisionObject* m_rigidCollisionObject;
|
|
||||||
|
|
||||||
///for rigid versus soft (instead of soft versus rigid), we use this swapped boolean
|
|
||||||
bool m_isSwapped;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
btSoftRigidCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped);
|
|
||||||
|
|
||||||
virtual ~btSoftRigidCollisionAlgorithm();
|
|
||||||
|
|
||||||
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
|
|
||||||
|
|
||||||
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
|
|
||||||
|
|
||||||
|
|
||||||
struct CreateFunc :public btCollisionAlgorithmCreateFunc
|
|
||||||
{
|
|
||||||
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
|
|
||||||
{
|
|
||||||
void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btSoftRigidCollisionAlgorithm));
|
|
||||||
if (!m_swapped)
|
|
||||||
{
|
|
||||||
return new(mem) btSoftRigidCollisionAlgorithm(0,ci,body0,body1,false);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return new(mem) btSoftRigidCollisionAlgorithm(0,ci,body0,body1,true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //SOFT_RIGID_COLLISION_ALGORITHM_H
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
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.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "btSoftSoftCollisionAlgorithm.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
|
|
||||||
#include "BulletCollision/CollisionShapes/btBoxShape.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
|
||||||
#include "BulletDynamics/SoftBody/btSoftBody.h"
|
|
||||||
|
|
||||||
#define USE_PERSISTENT_CONTACTS 1
|
|
||||||
|
|
||||||
btSoftSoftCollisionAlgorithm::btSoftSoftCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* obj0,btCollisionObject* obj1)
|
|
||||||
: btCollisionAlgorithm(ci)
|
|
||||||
//m_ownManifold(false),
|
|
||||||
//m_manifoldPtr(mf)
|
|
||||||
{
|
|
||||||
/*m_softBody0 = (btSoftBody*) obj0;
|
|
||||||
m_softBody1 = (btSoftBody*) obj1;
|
|
||||||
|
|
||||||
m_softBody0->m_overlappingSoftBodies.push_back(m_softBody1);
|
|
||||||
m_softBody1->m_overlappingSoftBodies.push_back(m_softBody0);*/
|
|
||||||
|
|
||||||
/*if (!m_manifoldPtr && m_dispatcher->needsCollision(obj0,obj1))
|
|
||||||
{
|
|
||||||
m_manifoldPtr = m_dispatcher->getNewManifold(obj0,obj1);
|
|
||||||
m_ownManifold = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
btSoftSoftCollisionAlgorithm::~btSoftSoftCollisionAlgorithm()
|
|
||||||
{
|
|
||||||
//m_softBody0->m_overlappingSoftBodies.remove(m_softBody1);
|
|
||||||
//m_softBody1->m_overlappingSoftBodies.remove(m_softBody0);
|
|
||||||
|
|
||||||
//this gets called when the overlap stops.
|
|
||||||
|
|
||||||
//here is where contacts (manifolds) should be removed
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (m_ownManifold)
|
|
||||||
{
|
|
||||||
if (m_manifoldPtr)
|
|
||||||
m_dispatcher->releaseManifold(m_manifoldPtr);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void btSoftSoftCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
|
|
||||||
{
|
|
||||||
|
|
||||||
btSoftBody* soft0 = (btSoftBody*)body0;
|
|
||||||
btSoftBody* soft1 = (btSoftBody*)body1;
|
|
||||||
|
|
||||||
soft0->defaultCollisionHandler(soft1);
|
|
||||||
/*
|
|
||||||
btBoxShape* box0 = (btBoxShape*)col0->getCollisionShape();
|
|
||||||
btBoxShape* box1 = (btBoxShape*)col1->getCollisionShape();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// report a contact. internally this will be kept persistent, and contact reduction is done
|
|
||||||
resultOut->setPersistentManifold(m_manifoldPtr);
|
|
||||||
#ifndef USE_PERSISTENT_CONTACTS
|
|
||||||
m_manifoldPtr->clearManifold();
|
|
||||||
#endif //USE_PERSISTENT_CONTACTS
|
|
||||||
|
|
||||||
btDiscreteCollisionDetectorInterface::ClosestPointInput input;
|
|
||||||
input.m_maximumDistanceSquared = 1e30f;
|
|
||||||
input.m_transformA = body0->getWorldTransform();
|
|
||||||
input.m_transformB = body1->getWorldTransform();
|
|
||||||
|
|
||||||
btBoxBoxDetector detector(box0,box1);
|
|
||||||
detector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
|
|
||||||
|
|
||||||
#ifdef USE_PERSISTENT_CONTACTS
|
|
||||||
// refreshContactPoints is only necessary when using persistent contact points. otherwise all points are newly added
|
|
||||||
if (m_ownManifold)
|
|
||||||
{
|
|
||||||
resultOut->refreshContactPoints();
|
|
||||||
}
|
|
||||||
#endif //USE_PERSISTENT_CONTACTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
btScalar btSoftSoftCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
|
|
||||||
{
|
|
||||||
//not yet
|
|
||||||
return 1.f;
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
subject to the following restrictions:
|
|
||||||
|
|
||||||
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.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SOFT_SOFT_COLLISION_ALGORITHM_H
|
|
||||||
#define SOFT_SOFT_COLLISION_ALGORITHM_H
|
|
||||||
|
|
||||||
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
|
|
||||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
|
||||||
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
|
|
||||||
|
|
||||||
class btPersistentManifold;
|
|
||||||
class btSoftBody;
|
|
||||||
|
|
||||||
///collision detection between two btSoftBody shapes
|
|
||||||
class btSoftSoftCollisionAlgorithm : public btCollisionAlgorithm
|
|
||||||
{
|
|
||||||
bool m_ownManifold;
|
|
||||||
btPersistentManifold* m_manifoldPtr;
|
|
||||||
|
|
||||||
btSoftBody* m_softBody0;
|
|
||||||
btSoftBody* m_softBody1;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
btSoftSoftCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
|
|
||||||
: btCollisionAlgorithm(ci) {}
|
|
||||||
|
|
||||||
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
|
|
||||||
|
|
||||||
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
|
|
||||||
|
|
||||||
btSoftSoftCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1);
|
|
||||||
|
|
||||||
virtual ~btSoftSoftCollisionAlgorithm();
|
|
||||||
|
|
||||||
struct CreateFunc :public btCollisionAlgorithmCreateFunc
|
|
||||||
{
|
|
||||||
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
|
|
||||||
{
|
|
||||||
int bbsize = sizeof(btSoftSoftCollisionAlgorithm);
|
|
||||||
void* ptr = ci.m_dispatcher1->allocateCollisionAlgorithm(bbsize);
|
|
||||||
return new(ptr) btSoftSoftCollisionAlgorithm(0,ci,body0,body1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //SOFT_SOFT_COLLISION_ALGORITHM_H
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user