Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2008-09-03 06:27:16 +0400
committerErwin Coumans <blender@erwincoumans.com>2008-09-03 06:27:16 +0400
commit1926e846500212d11061c23cacdbd08d88e375da (patch)
treead72fe64632cfc22a4878e065578b66d52de218d /extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
parent33ac84e888ee3e3217f15f955e1b389a9c4bb230 (diff)
Finally upgraded to latest Bullet subversion, about to release 2.71. Some recent changes in extern/bullet2 need to be re-applied, will check with Benoit. Ray tests in 0_FPS_Template.blend is broken, didn't figure out why yet.
HELP BUILD SYSTEM MAINTAINERS: Please help with updating all build systems: the newly added files need to be added. Note that the src/SoftBody has been added for future extension of real-time soft bodies.
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp')
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
index 92f4c8b28a6..a29a6d624e5 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
@@ -19,7 +19,8 @@ subject to the following restrictions:
btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
-:m_isSwapped(isSwapped)
+:btCollisionAlgorithm(ci),
+m_isSwapped(isSwapped)
{
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
@@ -32,11 +33,11 @@ btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlg
m_childCollisionAlgorithms.resize(numChildren);
for (i=0;i<numChildren;i++)
{
+ btCollisionShape* tmpShape = colObj->getCollisionShape();
btCollisionShape* childShape = compoundShape->getChildShape(i);
- btCollisionShape* orgShape = colObj->getCollisionShape();
- colObj->setCollisionShape( childShape );
- m_childCollisionAlgorithms[i] = ci.m_dispatcher->findAlgorithm(colObj,otherObj);
- colObj->setCollisionShape( orgShape );
+ colObj->internalSetTemporaryCollisionShape( childShape );
+ m_childCollisionAlgorithms[i] = ci.m_dispatcher1->findAlgorithm(colObj,otherObj);
+ colObj->internalSetTemporaryCollisionShape( tmpShape );
}
}
@@ -47,7 +48,8 @@ btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
int i;
for (i=0;i<numChildren;i++)
{
- delete m_childCollisionAlgorithms[i];
+ m_childCollisionAlgorithms[i]->~btCollisionAlgorithm();
+ m_dispatcher->freeCollisionAlgorithm(m_childCollisionAlgorithms[i]);
}
}
@@ -75,17 +77,21 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
//backup
btTransform orgTrans = colObj->getWorldTransform();
- btCollisionShape* orgShape = colObj->getCollisionShape();
+ btTransform orgInterpolationTrans = colObj->getInterpolationWorldTransform();
const btTransform& childTrans = compoundShape->getChildTransform(i);
- //btTransform newChildWorldTrans = orgTrans*childTrans ;
- colObj->setWorldTransform( orgTrans*childTrans );
+ btTransform newChildWorldTrans = orgTrans*childTrans ;
+ colObj->setWorldTransform( newChildWorldTrans);
+ colObj->setInterpolationWorldTransform(newChildWorldTrans);
+
//the contactpoint is still projected back using the original inverted worldtrans
- colObj->setCollisionShape( childShape );
+ btCollisionShape* tmpShape = colObj->getCollisionShape();
+ colObj->internalSetTemporaryCollisionShape( childShape );
m_childCollisionAlgorithms[i]->processCollision(colObj,otherObj,dispatchInfo,resultOut);
//revert back
- colObj->setCollisionShape( orgShape);
+ colObj->internalSetTemporaryCollisionShape( tmpShape);
colObj->setWorldTransform( orgTrans );
+ colObj->setInterpolationWorldTransform(orgInterpolationTrans);
}
}
@@ -117,20 +123,20 @@ btScalar btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject*
//backup
btTransform orgTrans = colObj->getWorldTransform();
- btCollisionShape* orgShape = colObj->getCollisionShape();
-
+
const btTransform& childTrans = compoundShape->getChildTransform(i);
//btTransform newChildWorldTrans = orgTrans*childTrans ;
colObj->setWorldTransform( orgTrans*childTrans );
- colObj->setCollisionShape( childShape );
+ btCollisionShape* tmpShape = colObj->getCollisionShape();
+ colObj->internalSetTemporaryCollisionShape( childShape );
btScalar frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);
if (frac<hitFraction)
{
hitFraction = frac;
}
//revert back
- colObj->setCollisionShape( orgShape);
+ colObj->internalSetTemporaryCollisionShape( tmpShape);
colObj->setWorldTransform( orgTrans);
}
return hitFraction;