Added bullet back to branch, compiling works again
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 7 May 2008 20:22:28 +0000 (20:22 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 7 May 2008 20:22:28 +0000 (20:22 +0000)
195 files changed:
extern/bullet2/CMakeLists.txt [new file with mode: 0644]
extern/bullet2/Makefile [new file with mode: 0644]
extern/bullet2/make/msvc_7_0/Bullet_vc7.vcproj [new file with mode: 0644]
extern/bullet2/readme.txt [new file with mode: 0644]
extern/bullet2/src/Bullet-C-Api.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CMakeLists.txt [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btUnionFind.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionDispatch/btUnionFind.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btBoxShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btBoxShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCapsuleShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCollisionMargin.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCollisionShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCollisionShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConcaveShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConcaveShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConeShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConeShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCylinderShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btCylinderShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btEmptyShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btEmptyShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btSphereShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btStridingMeshInterface.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTetrahedronShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTetrahedronShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleCallback.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleCallback.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMeshShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleShape.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/Doxyfile [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btConvexCast.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btConvexCast.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkEpa.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkEpa.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPointCollector.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp [new file with mode: 0644]
extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/CMakeLists.txt [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btConstraintSolver.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btContactConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btContactConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btJacobianEntry.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btDynamicsWorld.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Vehicle/btRaycastVehicle.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Vehicle/btVehicleRaycaster.h [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Vehicle/btWheelInfo.cpp [new file with mode: 0644]
extern/bullet2/src/BulletDynamics/Vehicle/btWheelInfo.h [new file with mode: 0644]
extern/bullet2/src/CMakeLists.txt [new file with mode: 0644]
extern/bullet2/src/LinearMath/CMakeLists.txt [new file with mode: 0644]
extern/bullet2/src/LinearMath/btAabbUtil2.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btAlignedAllocator.cpp [new file with mode: 0644]
extern/bullet2/src/LinearMath/btAlignedAllocator.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btAlignedObjectArray.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btDefaultMotionState.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btGeometryUtil.cpp [new file with mode: 0644]
extern/bullet2/src/LinearMath/btGeometryUtil.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btIDebugDraw.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btList.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btMatrix3x3.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btMinMax.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btMotionState.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btPoint3.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btQuadWord.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btQuaternion.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btQuickprof.cpp [new file with mode: 0644]
extern/bullet2/src/LinearMath/btQuickprof.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btRandom.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btScalar.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btSimdMinMax.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btStackAlloc.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btTransform.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btTransformUtil.h [new file with mode: 0644]
extern/bullet2/src/LinearMath/btVector3.h [new file with mode: 0644]
extern/bullet2/src/Makefile [new file with mode: 0644]
extern/bullet2/src/SConscript [new file with mode: 0644]
extern/bullet2/src/btBulletCollisionCommon.h [new file with mode: 0644]
extern/bullet2/src/btBulletDynamicsCommon.h [new file with mode: 0644]

diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b5ae202
--- /dev/null
@@ -0,0 +1,43 @@
+# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Jacques Beaurai, Erwin Coumans
+#
+# ***** END GPL LICENSE BLOCK *****
+
+SET(INC . src)
+
+FILE(GLOB SRC   
+  src/LinearMath/*.cpp
+  src/BulletCollision/BroadphaseCollision/*.cpp
+  src/BulletCollision/CollisionShapes/*.cpp
+  src/BulletCollision/NarrowPhaseCollision/*.cpp
+  src/BulletCollision//CollisionDispatch/*.cpp
+  src/BulletDynamics/ConstraintSolver/*.cpp
+  src/BulletDynamics/Vehicle/*.cpp
+  src/BulletDynamics/Dynamics/*.cpp
+)
+
+ADD_DEFINITIONS(-D_LIB)
+
+BLENDERLIB(extern_bullet "${SRC}" "${INC}")
+#, libtype=['game2', 'player'], priority=[20, 170], compileflags=cflags )
diff --git a/extern/bullet2/Makefile b/extern/bullet2/Makefile
new file mode 100644 (file)
index 0000000..2da1a5b
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# $Id: Makefile 14444 2008-04-16 22:40:48Z hos $
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2002 by Hans Lambermont
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s):
+#
+# ***** END GPL LICENSE BLOCK *****
+LIBNAME = bullet2
+include nan_definitions.mk
+SOURCEDIR = extern/$(LIBNAME)
+DIR = $(OCGDIR)/extern/$(LIBNAME)
+DIRS = src
+DISTDIR = src
+
+BULLETDIRS = \
+LinearMath \
+BulletCollision/BroadphaseCollision \
+BulletCollision/CollisionShapes \
+BulletCollision/NarrowPhaseCollision \
+BulletCollision//CollisionDispatch \
+BulletDynamics/ConstraintSolver \
+BulletDynamics/Vehicle \
+BulletDynamics/Dynamics
+
+include nan_subdirs.mk
+
+CP = $(NANBLENDERHOME)/intern/tools/cpifdiff.sh
+
+install: all debug
+       @[ -d $(NAN_BULLET2) ] || mkdir -p $(NAN_BULLET2)
+       @[ -d $(NAN_BULLET2)/include ] || mkdir -p $(NAN_BULLET2)/include
+       @for i in $(BULLETDIRS); do \
+       [ -d $(NAN_BULLET2)/include/$$i ] || mkdir -p $(NAN_BULLET2)/include/$$i; \
+       $(CP) $(DISTDIR)/$$i/*.h $(NAN_BULLET2)/include/$$i; \
+       done
+       @[ -d $(NAN_BULLET2)/lib ] || mkdir -p $(NAN_BULLET2)/lib
+       @$(CP) $(DISTDIR)/*.h $(NAN_BULLET2)/include
+       @$(CP) $(OCGDIR)/extern/bullet2/libbullet2.a $(NAN_BULLET2)/lib
+ifeq ($(OS),darwin)
+       ranlib $(NAN_BULLET2)/lib/libbullet2.a
+endif
diff --git a/extern/bullet2/make/msvc_7_0/Bullet_vc7.vcproj b/extern/bullet2/make/msvc_7_0/Bullet_vc7.vcproj
new file mode 100644 (file)
index 0000000..6de2fd3
--- /dev/null
@@ -0,0 +1,927 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="bullet2"
+       ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}"
+       SccProjectName=""
+       SccLocalPath="">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Blender Debug|Win32"
+                       OutputDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\debug"
+                       IntermediateDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\debug"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="..\..\src"
+                               PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               ExceptionHandling="FALSE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\extern\bullet\debug\Bullet.pch"
+                               AssemblerListingLocation="..\..\..\..\..\build\msvc_7\extern\bullet\debug\"
+                               ObjectFile="..\..\..\..\..\build\msvc_7\extern\bullet\debug\"
+                               ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\extern\bullet\debug\"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="4"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="..\..\..\..\..\build\msvc_7\libs\extern\debug\Bullet.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                               CommandLine="ECHO Copying header files
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+
+XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
+XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+
+ECHO Done
+"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="Blender Release|Win32"
+                       OutputDirectory="..\..\..\..\..\build\msvc_7\extern\bullet"
+                       IntermediateDirectory="..\..\..\..\..\build\msvc_7\extern\bullet"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="1"
+                               AdditionalIncludeDirectories="..\..\src"
+                               PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               StringPooling="TRUE"
+                               ExceptionHandling="FALSE"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="TRUE"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\extern\bullet\Bullet.pch"
+                               AssemblerListingLocation="..\..\..\..\..\build\msvc_7\extern\bullet\"
+                               ObjectFile="..\..\..\..\..\build\msvc_7\extern\bullet\"
+                               ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\extern\bullet\"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="2"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="..\..\..\..\..\build\msvc_7\libs\extern\Bullet.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                               CommandLine="ECHO Copying header files
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+
+XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
+XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+
+ECHO Done
+"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="3D Plugin Debug|Win32"
+                       OutputDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug"
+                       IntermediateDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="..\..\src"
+                               PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               ExceptionHandling="FALSE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\Bullet.pch"
+                               AssemblerListingLocation="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\"
+                               ObjectFile="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\"
+                               ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="4"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="..\..\..\..\..\build\msvc_7\libs\extern\mtdll\debug\Bullet.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                               CommandLine="ECHO Copying header files
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+
+XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
+XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+
+ECHO Done
+"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="3D Plugin Release|Win32"
+                       OutputDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll"
+                       IntermediateDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="1"
+                               AdditionalIncludeDirectories="..\..\src"
+                               PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               StringPooling="TRUE"
+                               ExceptionHandling="FALSE"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="TRUE"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\Bullet.pch"
+                               AssemblerListingLocation="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\"
+                               ObjectFile="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\"
+                               ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="2"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="..\..\..\..\..\build\msvc_7\libs\extern\mtdll\Bullet.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                               CommandLine="ECHO Copying header files
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+
+XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
+XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
+XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
+XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
+XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
+XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
+XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
+XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
+
+ECHO Done
+"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="src"
+                       Filter="">
+                       <File
+                               RelativePath="..\..\src\btBulletCollisionCommon.h">
+                       </File>
+                       <File
+                               RelativePath="..\..\src\btBulletDynamicsCommon.h">
+                       </File>
+                       <File
+                               RelativePath="..\..\src\Bullet-C-Api.h">
+                       </File>
+                       <Filter
+                               Name="BulletDynamics"
+                               Filter="">
+                               <Filter
+                                       Name="ConstraintSolver"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btConeTwistConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btConeTwistConstraint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btConstraintSolver.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btContactConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btContactConstraint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btContactSolverInfo.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btGeneric6DofConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btGeneric6DofConstraint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btHingeConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btHingeConstraint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btJacobianEntry.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btPoint2PointConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btPoint2PointConstraint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSequentialImpulseConstraintSolver.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSequentialImpulseConstraintSolver.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSolve2LinearConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSolve2LinearConstraint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btTypedConstraint.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h">
+                                       </File>
+                               </Filter>
+                               <Filter
+                                       Name="Dynamics"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btDiscreteDynamicsWorld.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btDiscreteDynamicsWorld.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btDynamicsWorld.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btRigidBody.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btRigidBody.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btSimpleDynamicsWorld.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\btSimpleDynamicsWorld.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Dynamics\Bullet-C-API.cpp">
+                                       </File>
+                               </Filter>
+                               <Filter
+                                       Name="Vehicle"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Vehicle\btRaycastVehicle.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Vehicle\btRaycastVehicle.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Vehicle\btVehicleRaycaster.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Vehicle\btWheelInfo.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletDynamics\Vehicle\btWheelInfo.h">
+                                       </File>
+                               </Filter>
+                       </Filter>
+                       <Filter
+                               Name="BulletCollision"
+                               Filter="">
+                               <Filter
+                                       Name="BroadphaseCollision"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btAxisSweep3.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btAxisSweep3.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btBroadphaseInterface.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btBroadphaseProxy.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btBroadphaseProxy.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDispatcher.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDispatcher.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btOverlappingPairCache.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btOverlappingPairCache.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btSimpleBroadphase.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btSimpleBroadphase.h">
+                                       </File>
+                               </Filter>
+                               <Filter
+                                       Name="NarrowPhaseCollision"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btContinuousConvexCollision.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btContinuousConvexCollision.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btConvexCast.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btConvexCast.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btConvexPenetrationDepthSolver.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btDiscreteCollisionDetectorInterface.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkConvexCast.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkConvexCast.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpa.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpa.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpaPenetrationDepthSolver.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpaPenetrationDepthSolver.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkPairDetector.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkPairDetector.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btManifoldPoint.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btMinkowskiPenetrationDepthSolver.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btMinkowskiPenetrationDepthSolver.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btPersistentManifold.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btPersistentManifold.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btPointCollector.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btRaycastCallback.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btRaycastCallback.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btSimplexSolverInterface.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btSubSimplexConvexCast.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btSubSimplexConvexCast.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btVoronoiSimplexSolver.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btVoronoiSimplexSolver.h">
+                                       </File>
+                               </Filter>
+                               <Filter
+                                       Name="CollisionDispatch"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionCreateFunc.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionDispatcher.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionDispatcher.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionObject.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionObject.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionWorld.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionWorld.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCompoundCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCompoundCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexConcaveCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexConcaveCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexConvexAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexConvexAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btEmptyCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btEmptyCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btManifoldResult.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btManifoldResult.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSimulationIslandManager.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSimulationIslandManager.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSphereBoxCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSphereBoxCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSphereSphereCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSphereSphereCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSphereTriangleCollisionAlgorithm.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btSphereTriangleCollisionAlgorithm.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btUnionFind.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\btUnionFind.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\SphereTriangleDetector.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionDispatch\SphereTriangleDetector.h">
+                                       </File>
+                               </Filter>
+                               <Filter
+                                       Name="CollisionShapes"
+                                       Filter="">
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btBoxShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btBoxShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btBvhTriangleMeshShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btBvhTriangleMeshShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCapsuleShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCapsuleShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCollisionMargin.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCollisionShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCollisionShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCompoundShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCompoundShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConcaveShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConcaveShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConeShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConeShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexHullShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexHullShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexTriangleMeshShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexTriangleMeshShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCylinderShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btCylinderShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btEmptyShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btEmptyShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btHeightfieldTerrainShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btHeightfieldTerrainShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btMinkowskiSumShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btMinkowskiSumShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btMultiSphereShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btMultiSphereShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btOptimizedBvh.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btOptimizedBvh.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btPolyhedralConvexShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btPolyhedralConvexShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btSphereShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btSphereShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btStaticPlaneShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btStaticPlaneShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btStridingMeshInterface.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btStridingMeshInterface.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTetrahedronShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTetrahedronShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleBuffer.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleBuffer.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleCallback.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleCallback.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleIndexVertexArray.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleIndexVertexArray.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleMesh.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleMesh.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleMeshShape.cpp">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleMeshShape.h">
+                                       </File>
+                                       <File
+                                               RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleShape.h">
+                                       </File>
+                               </Filter>
+                       </Filter>
+                       <Filter
+                               Name="LinearMath"
+                               Filter="">
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btAabbUtil2.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btAlignedAllocator.cpp">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btAlignedAllocator.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btAlignedObjectArray.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btDefaultMotionState.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btGeometryUtil.cpp">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btGeometryUtil.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btIDebugDraw.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btList.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btMatrix3x3.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btMinMax.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btMotionState.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btPoint3.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btQuadWord.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btQuaternion.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btQuickprof.cpp">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btQuickprof.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btRandom.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btScalar.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btSimdMinMax.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btStackAlloc.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btTransform.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btTransformUtil.h">
+                               </File>
+                               <File
+                                       RelativePath="..\..\src\LinearMath\btVector3.h">
+                               </File>
+                       </Filter>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/extern/bullet2/readme.txt b/extern/bullet2/readme.txt
new file mode 100644 (file)
index 0000000..4d1a4c1
--- /dev/null
@@ -0,0 +1,12 @@
+
+*** These files in extern/bullet2 are NOT part of the Blender build yet ***
+
+This is the new refactored version of Bullet physics library version 2.x
+
+Soon this will replace the old Bullet version in extern/bullet.
+First the integration in Blender Game Engine needs to be updated.
+Once that is done all build systems can be updated to use/build extern/bullet2 files.
+
+Questions? mail blender at erwincoumans.com, or check the bf-blender mailing list.
+Thanks,
+Erwin
diff --git a/extern/bullet2/src/Bullet-C-Api.h b/extern/bullet2/src/Bullet-C-Api.h
new file mode 100644 (file)
index 0000000..078dcae
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+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.
+*/
+
+/*
+       Draft high-level generic physics C-API. For low-level access, use the physics SDK native API's.
+       Work in progress, functionality will be added on demand.
+
+       If possible, use the richer Bullet C++ API, by including "btBulletDynamicsCommon.h"
+*/
+
+#ifndef BULLET_C_API_H
+#define BULLET_C_API_H
+
+#ifdef __cplusplus
+extern "C" { 
+#endif
+
+double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //BULLET_C_API_H
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp
new file mode 100644 (file)
index 0000000..be4a115
--- /dev/null
@@ -0,0 +1,660 @@
+
+//Bullet Continuous Collision Detection and Physics Library
+//Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
+
+
+//
+// btAxisSweep3
+//
+// Copyright (c) 2006 Simon Hobbs
+//
+// 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 "btAxisSweep3.h"
+
+#include <assert.h>
+
+#ifdef DEBUG_BROADPHASE
+#include <stdio.h>
+void btAxisSweep3::debugPrintAxis(int axis, bool checkCardinality)
+{
+       int numEdges = m_pHandles[0].m_maxEdges[axis];
+       printf("SAP Axis %d, numEdges=%d\n",axis,numEdges);
+
+       int i;
+       for (i=0;i<numEdges+1;i++)
+       {
+               Edge* pEdge = m_pEdges[axis] + i;
+               Handle* pHandlePrev = getHandle(pEdge->m_handle);
+               int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis];
+               char beginOrEnd;
+               beginOrEnd=pEdge->IsMax()?'E':'B';
+               printf("        [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex);
+       }
+
+       if (checkCardinality)
+               assert(numEdges == m_numHandles*2+1);
+}
+#endif //DEBUG_BROADPHASE
+
+
+btBroadphaseProxy*     btAxisSweep3::createProxy(  const btVector3& min,  const btVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
+{
+               (void)shapeType;
+               BP_FP_INT_TYPE handleId = addHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask);
+               
+               Handle* handle = getHandle(handleId);
+                               
+               return handle;
+}
+
+void   btAxisSweep3::destroyProxy(btBroadphaseProxy* proxy)
+{
+       Handle* handle = static_cast<Handle*>(proxy);
+       removeHandle(handle->m_handleId);
+}
+
+void   btAxisSweep3::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
+{
+       Handle* handle = static_cast<Handle*>(proxy);
+       updateHandle(handle->m_handleId,aabbMin,aabbMax);
+
+}
+
+
+
+
+
+
+btAxisSweep3::btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, int maxHandles)
+:btOverlappingPairCache()
+{
+       m_invalidPair = 0;
+       //assert(bounds.HasVolume());
+
+       // 1 handle is reserved as sentinel
+       btAssert(maxHandles > 1 && maxHandles < BP_MAX_HANDLES);
+
+       // init bounds
+       m_worldAabbMin = worldAabbMin;
+       m_worldAabbMax = worldAabbMax;
+
+       btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin;
+
+       BP_FP_INT_TYPE  maxInt = BP_HANDLE_SENTINEL;
+
+       m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize;
+
+       // allocate handles buffer and put all handles on free list
+       m_pHandles = new Handle[maxHandles];
+       m_maxHandles = maxHandles;
+       m_numHandles = 0;
+
+       // handle 0 is reserved as the null index, and is also used as the sentinel
+       m_firstFreeHandle = 1;
+       {
+               for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++)
+                       m_pHandles[i].SetNextFree(i + 1);
+               m_pHandles[maxHandles - 1].SetNextFree(0);
+       }
+
+       {
+       // allocate edge buffers
+       for (int i = 0; i < 3; i++)
+               m_pEdges[i] = new Edge[maxHandles * 2];
+       }
+       //removed overlap management
+
+       // make boundary sentinels
+       
+       m_pHandles[0].m_clientObject = 0;
+
+       for (int axis = 0; axis < 3; axis++)
+       {
+               m_pHandles[0].m_minEdges[axis] = 0;
+               m_pHandles[0].m_maxEdges[axis] = 1;
+
+               m_pEdges[axis][0].m_pos = 0;
+               m_pEdges[axis][0].m_handle = 0;
+               m_pEdges[axis][1].m_pos = BP_HANDLE_SENTINEL;
+               m_pEdges[axis][1].m_handle = 0;
+#ifdef DEBUG_BROADPHASE
+               debugPrintAxis(axis);
+#endif //DEBUG_BROADPHASE
+
+       }
+
+}
+
+btAxisSweep3::~btAxisSweep3()
+{
+       
+       for (int i = 2; i >= 0; i--)
+               delete[] m_pEdges[i];
+       delete[] m_pHandles;
+}
+
+void btAxisSweep3::quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const
+{
+       btPoint3 clampedPoint(point);
+       
+
+
+       clampedPoint.setMax(m_worldAabbMin);
+       clampedPoint.setMin(m_worldAabbMax);
+
+       btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize;
+       out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & BP_HANDLE_MASK) | isMax);
+       out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & BP_HANDLE_MASK) | isMax);
+       out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & BP_HANDLE_MASK) | isMax);
+       
+}
+
+
+
+BP_FP_INT_TYPE btAxisSweep3::allocHandle()
+{
+       assert(m_firstFreeHandle);
+
+       BP_FP_INT_TYPE handle = m_firstFreeHandle;
+       m_firstFreeHandle = getHandle(handle)->GetNextFree();
+       m_numHandles++;
+
+       return handle;
+}
+
+void btAxisSweep3::freeHandle(BP_FP_INT_TYPE handle)
+{
+       assert(handle > 0 && handle < m_maxHandles);
+
+       getHandle(handle)->SetNextFree(m_firstFreeHandle);
+       m_firstFreeHandle = handle;
+
+       m_numHandles--;
+}
+
+
+
+BP_FP_INT_TYPE btAxisSweep3::addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask)
+{
+       // quantize the bounds
+       BP_FP_INT_TYPE min[3], max[3];
+       quantize(min, aabbMin, 0);
+       quantize(max, aabbMax, 1);
+
+       // allocate a handle
+       BP_FP_INT_TYPE handle = allocHandle();
+       assert(handle!= 0xcdcd);
+
+       Handle* pHandle = getHandle(handle);
+       
+       pHandle->m_handleId = handle;
+       //pHandle->m_pOverlaps = 0;
+       pHandle->m_clientObject = pOwner;
+       pHandle->m_collisionFilterGroup = collisionFilterGroup;
+       pHandle->m_collisionFilterMask = collisionFilterMask;
+
+       // compute current limit of edge arrays
+       BP_FP_INT_TYPE limit = m_numHandles * 2;
+
+       
+       // insert new edges just inside the max boundary edge
+       for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++)
+       {
+
+               m_pHandles[0].m_maxEdges[axis] += 2;
+
+               m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1];
+
+               m_pEdges[axis][limit - 1].m_pos = min[axis];
+               m_pEdges[axis][limit - 1].m_handle = handle;
+
+               m_pEdges[axis][limit].m_pos = max[axis];
+               m_pEdges[axis][limit].m_handle = handle;
+
+               pHandle->m_minEdges[axis] = limit - 1;
+               pHandle->m_maxEdges[axis] = limit;
+       }
+
+       // now sort the new edges to their correct position
+       sortMinDown(0, pHandle->m_minEdges[0], false);
+       sortMaxDown(0, pHandle->m_maxEdges[0], false);
+       sortMinDown(1, pHandle->m_minEdges[1], false);
+       sortMaxDown(1, pHandle->m_maxEdges[1], false);
+       sortMinDown(2, pHandle->m_minEdges[2], true);
+       sortMaxDown(2, pHandle->m_maxEdges[2], true);
+
+
+       return handle;
+}
+
+
+void btAxisSweep3::removeHandle(BP_FP_INT_TYPE handle)
+{
+       
+       Handle* pHandle = getHandle(handle);
+
+       //explicitly remove the pairs containing the proxy
+       //we could do it also in the sortMinUp (passing true)
+       //todo: compare performance
+       removeOverlappingPairsContainingProxy(pHandle);
+
+
+       // compute current limit of edge arrays
+       int limit = m_numHandles * 2;
+       
+       int axis;
+
+       for (axis = 0;axis<3;axis++)
+       {
+               m_pHandles[0].m_maxEdges[axis] -= 2;
+       }
+
+       // remove the edges by sorting them up to the end of the list
+       for ( axis = 0; axis < 3; axis++)
+       {
+               Edge* pEdges = m_pEdges[axis];
+               BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis];
+               pEdges[max].m_pos = BP_HANDLE_SENTINEL;
+
+               sortMaxUp(axis,max,false);
+
+
+               BP_FP_INT_TYPE i = pHandle->m_minEdges[axis];
+               pEdges[i].m_pos = BP_HANDLE_SENTINEL;
+
+
+               sortMinUp(axis,i,false);
+
+               pEdges[limit-1].m_handle = 0;
+               pEdges[limit-1].m_pos = BP_HANDLE_SENTINEL;
+               
+#ifdef DEBUG_BROADPHASE
+                       debugPrintAxis(axis,false);
+#endif //DEBUG_BROADPHASE
+
+
+       }
+
+
+       // free the handle
+       freeHandle(handle);
+
+       
+}
+
+extern int gOverlappingPairs;
+
+
+void   btAxisSweep3::refreshOverlappingPairs()
+{
+
+}
+void   btAxisSweep3::processAllOverlappingPairs(btOverlapCallback* callback)
+{
+
+       //perform a sort, to find duplicates and to sort 'invalid' pairs to the end
+       m_overlappingPairArray.heapSort(btBroadphasePairSortPredicate());
+
+       //remove the 'invalid' ones
+#ifdef USE_POPBACK_REMOVAL
+       while (m_invalidPair>0)
+       {
+               m_invalidPair--;
+               m_overlappingPairArray.pop_back();
+       }
+#else  
+       m_overlappingPairArray.resize(m_overlappingPairArray.size() - m_invalidPair);
+       m_invalidPair = 0;
+#endif
+
+       
+       int i;
+
+       btBroadphasePair previousPair;
+       previousPair.m_pProxy0 = 0;
+       previousPair.m_pProxy1 = 0;
+       previousPair.m_algorithm = 0;
+       
+       
+       for (i=0;i<m_overlappingPairArray.size();i++)
+       {
+       
+               btBroadphasePair& pair = m_overlappingPairArray[i];
+
+               bool isDuplicate = (pair == previousPair);
+
+               previousPair = pair;
+
+               bool needsRemoval = false;
+
+               if (!isDuplicate)
+               {
+                       bool hasOverlap = testOverlap(pair.m_pProxy0,pair.m_pProxy1);
+
+                       if (hasOverlap)
+                       {
+                               needsRemoval = callback->processOverlap(pair);
+                       } else
+                       {
+                               needsRemoval = true;
+                       }
+               } else
+               {
+                       //remove duplicate
+                       needsRemoval = true;
+                       //should have no algorithm
+                       btAssert(!pair.m_algorithm);
+               }
+               
+               if (needsRemoval)
+               {
+                       cleanOverlappingPair(pair);
+
+       //              m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
+       //              m_overlappingPairArray.pop_back();
+                       pair.m_pProxy0 = 0;
+                       pair.m_pProxy1 = 0;
+                       m_invalidPair++;
+                       gOverlappingPairs--;
+               } 
+               
+       }
+}
+
+
+bool btAxisSweep3::testOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
+{
+       const Handle* pHandleA = static_cast<Handle*>(proxy0);
+       const Handle* pHandleB = static_cast<Handle*>(proxy1);
+       
+       //optimization 1: check the array index (memory address), instead of the m_pos
+
+       for (int axis = 0; axis < 3; axis++)
+       { 
+               if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || 
+                       pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) 
+               { 
+                       return false; 
+               } 
+       } 
+       return true;
+}
+
+bool btAxisSweep3::testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB)
+{
+       //optimization 1: check the array index (memory address), instead of the m_pos
+
+       for (int axis = 0; axis < 3; axis++)
+       { 
+               if (axis != ignoreAxis)
+               {
+                       if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || 
+                               pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) 
+                       { 
+                               return false; 
+                       } 
+               }
+       } 
+
+       //optimization 2: only 2 axis need to be tested (conflicts with 'delayed removal' optimization)
+
+       /*for (int axis = 0; axis < 3; axis++)
+       {
+               if (m_pEdges[axis][pHandleA->m_maxEdges[axis]].m_pos < m_pEdges[axis][pHandleB->m_minEdges[axis]].m_pos ||
+                       m_pEdges[axis][pHandleB->m_maxEdges[axis]].m_pos < m_pEdges[axis][pHandleA->m_minEdges[axis]].m_pos)
+               {
+                       return false;
+               }
+       }
+       */
+
+       return true;
+}
+
+void btAxisSweep3::updateHandle(BP_FP_INT_TYPE handle, const btPoint3& aabbMin,const btPoint3& aabbMax)
+{
+//     assert(bounds.IsFinite());
+       //assert(bounds.HasVolume());
+
+       Handle* pHandle = getHandle(handle);
+
+       // quantize the new bounds
+       BP_FP_INT_TYPE min[3], max[3];
+       quantize(min, aabbMin, 0);
+       quantize(max, aabbMax, 1);
+
+       // update changed edges
+       for (int axis = 0; axis < 3; axis++)
+       {
+               BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis];
+               BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis];
+
+               int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos;
+               int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos;
+
+               m_pEdges[axis][emin].m_pos = min[axis];
+               m_pEdges[axis][emax].m_pos = max[axis];
+
+               // expand (only adds overlaps)
+               if (dmin < 0)
+                       sortMinDown(axis, emin);
+
+               if (dmax > 0)
+                       sortMaxUp(axis, emax);
+
+               // shrink (only removes overlaps)
+               if (dmin > 0)
+                       sortMinUp(axis, emin);
+
+               if (dmax < 0)
+                       sortMaxDown(axis, emax);
+
+#ifdef DEBUG_BROADPHASE
+       debugPrintAxis(axis);
+#endif //DEBUG_BROADPHASE
+       }
+
+       
+}
+
+
+
+
+// sorting a min edge downwards can only ever *add* overlaps
+void btAxisSweep3::sortMinDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
+{
+
+       Edge* pEdge = m_pEdges[axis] + edge;
+       Edge* pPrev = pEdge - 1;
+       Handle* pHandleEdge = getHandle(pEdge->m_handle);
+
+       while (pEdge->m_pos < pPrev->m_pos)
+       {
+               Handle* pHandlePrev = getHandle(pPrev->m_handle);
+
+               if (pPrev->IsMax())
+               {
+                       // if previous edge is a maximum check the bounds and add an overlap if necessary
+                       if (updateOverlaps && testOverlap(axis,pHandleEdge, pHandlePrev))
+                       {
+                               addOverlappingPair(pHandleEdge,pHandlePrev);
+
+                               //AddOverlap(pEdge->m_handle, pPrev->m_handle);
+
+                       }
+
+                       // update edge reference in other handle
+                       pHandlePrev->m_maxEdges[axis]++;
+               }
+               else
+                       pHandlePrev->m_minEdges[axis]++;
+
+               pHandleEdge->m_minEdges[axis]--;
+
+               // swap the edges
+               Edge swap = *pEdge;
+               *pEdge = *pPrev;
+               *pPrev = swap;
+
+               // decrement
+               pEdge--;
+               pPrev--;
+       }
+
+#ifdef DEBUG_BROADPHASE
+       debugPrintAxis(axis);
+#endif //DEBUG_BROADPHASE
+
+}
+
+// sorting a min edge upwards can only ever *remove* overlaps
+void btAxisSweep3::sortMinUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
+{
+       Edge* pEdge = m_pEdges[axis] + edge;
+       Edge* pNext = pEdge + 1;
+       Handle* pHandleEdge = getHandle(pEdge->m_handle);
+
+       while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
+       {
+               Handle* pHandleNext = getHandle(pNext->m_handle);
+
+               if (pNext->IsMax())
+               {
+                       // if next edge is maximum remove any overlap between the two handles
+                       if (updateOverlaps)
+                       {
+                               /*
+                               Handle* handle0 = getHandle(pEdge->m_handle);
+                               Handle* handle1 = getHandle(pNext->m_handle);
+                               btBroadphasePair tmpPair(*handle0,*handle1);
+                               removeOverlappingPair(tmpPair);
+                               */
+
+                       }
+
+                       // update edge reference in other handle
+                       pHandleNext->m_maxEdges[axis]--;
+               }
+               else
+                       pHandleNext->m_minEdges[axis]--;
+
+               pHandleEdge->m_minEdges[axis]++;
+
+               // swap the edges
+               Edge swap = *pEdge;
+               *pEdge = *pNext;
+               *pNext = swap;
+
+               // increment
+               pEdge++;
+               pNext++;
+       }
+
+
+}
+
+// sorting a max edge downwards can only ever *remove* overlaps
+void btAxisSweep3::sortMaxDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
+{
+
+       Edge* pEdge = m_pEdges[axis] + edge;
+       Edge* pPrev = pEdge - 1;
+       Handle* pHandleEdge = getHandle(pEdge->m_handle);
+
+       while (pEdge->m_pos < pPrev->m_pos)
+       {
+               Handle* pHandlePrev = getHandle(pPrev->m_handle);
+
+               if (!pPrev->IsMax())
+               {
+                       // if previous edge was a minimum remove any overlap between the two handles
+                       if (updateOverlaps)
+                       {
+                               //this is done during the overlappingpairarray iteration/narrowphase collision
+                               /*
+                               Handle* handle0 = getHandle(pEdge->m_handle);
+                               Handle* handle1 = getHandle(pPrev->m_handle);
+                               btBroadphasePair* pair = findPair(handle0,handle1);
+                               //assert(pair);
+
+                               if (pair)
+                               {
+                                       removeOverlappingPair(*pair);
+                               }
+                               */
+
+                       }
+
+                       // update edge reference in other handle
+                       pHandlePrev->m_minEdges[axis]++;;
+               }
+               else
+                       pHandlePrev->m_maxEdges[axis]++;
+
+               pHandleEdge->m_maxEdges[axis]--;
+
+               // swap the edges
+               Edge swap = *pEdge;
+               *pEdge = *pPrev;
+               *pPrev = swap;
+
+               // decrement
+               pEdge--;
+               pPrev--;
+       }
+
+       
+#ifdef DEBUG_BROADPHASE
+       debugPrintAxis(axis);
+#endif //DEBUG_BROADPHASE
+
+}
+
+// sorting a max edge upwards can only ever *add* overlaps
+void btAxisSweep3::sortMaxUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
+{
+       Edge* pEdge = m_pEdges[axis] + edge;
+       Edge* pNext = pEdge + 1;
+       Handle* pHandleEdge = getHandle(pEdge->m_handle);
+
+       while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
+       {
+               Handle* pHandleNext = getHandle(pNext->m_handle);
+
+               if (!pNext->IsMax())
+               {
+                       // if next edge is a minimum check the bounds and add an overlap if necessary
+                       if (updateOverlaps && testOverlap(axis, pHandleEdge, pHandleNext))
+                       {
+                               Handle* handle0 = getHandle(pEdge->m_handle);
+                               Handle* handle1 = getHandle(pNext->m_handle);
+                               addOverlappingPair(handle0,handle1);
+                       }
+
+                       // update edge reference in other handle
+                       pHandleNext->m_minEdges[axis]--;
+               }
+               else
+                       pHandleNext->m_maxEdges[axis]--;
+
+               pHandleEdge->m_maxEdges[axis]++;
+
+               // swap the edges
+               Edge swap = *pEdge;
+               *pEdge = *pNext;
+               *pNext = swap;
+
+               // increment
+               pEdge++;
+               pNext++;
+       }
+       
+}
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
new file mode 100644 (file)
index 0000000..57bbb36
--- /dev/null
@@ -0,0 +1,138 @@
+//Bullet Continuous Collision Detection and Physics Library
+//Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
+
+//
+// btAxisSweep3.h
+//
+// Copyright (c) 2006 Simon Hobbs
+//
+// 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 AXIS_SWEEP_3_H
+#define AXIS_SWEEP_3_H
+
+#include "../../LinearMath/btPoint3.h"
+#include "../../LinearMath/btVector3.h"
+#include "btOverlappingPairCache.h"
+#include "btBroadphaseProxy.h"
+
+
+//Enable BP_USE_FIXEDPOINT_INT_32 if you need more then 32767 objects
+//#define BP_USE_FIXEDPOINT_INT_32 1
+
+#ifdef BP_USE_FIXEDPOINT_INT_32
+       #define BP_FP_INT_TYPE unsigned int
+       #define BP_MAX_HANDLES 1500000 //arbitrary maximum number of handles
+       #define BP_HANDLE_SENTINEL 0x7fffffff
+       #define BP_HANDLE_MASK  0xfffffffe
+#else
+       #define BP_FP_INT_TYPE unsigned short int
+       #define BP_MAX_HANDLES 32767
+       #define BP_HANDLE_SENTINEL 0xffff
+       #define BP_HANDLE_MASK  0xfffe
+#endif //BP_USE_FIXEDPOINT_INT_32
+
+//#define DEBUG_BROADPHASE 1
+
+/// btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
+/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using integer coordinates instead of floats.
+/// The testOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos
+class btAxisSweep3 : public btOverlappingPairCache
+{
+
+public:
+       
+
+       class Edge
+       {
+       public:
+               BP_FP_INT_TYPE m_pos;                   // low bit is min/max
+               BP_FP_INT_TYPE m_handle;
+
+               BP_FP_INT_TYPE IsMax() const {return m_pos & 1;}
+       };
+
+public:
+       class Handle : public btBroadphaseProxy
+       {
+       public:
+               
+               // indexes into the edge arrays
+               BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3];            // 6 * 2 = 12
+               BP_FP_INT_TYPE m_handleId;
+               BP_FP_INT_TYPE m_pad;
+               
+               //void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject
+       
+               inline void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;}
+               inline BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];}
+       };              // 24 bytes + 24 for Edge structures = 44 bytes total per entry
+
+       
+private:
+       btPoint3 m_worldAabbMin;                                                // overall system bounds
+       btPoint3 m_worldAabbMax;                                                // overall system bounds
+
+       btVector3 m_quantize;                                           // scaling factor for quantization
+
+       BP_FP_INT_TYPE m_numHandles;                                            // number of active handles
+       int m_maxHandles;                                               // max number of handles
+       Handle* m_pHandles;                                             // handles pool
+       BP_FP_INT_TYPE m_firstFreeHandle;               // free handles list
+
+       Edge* m_pEdges[3];                                              // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries)
+
+       int m_invalidPair;
+
+       // allocation/deallocation
+       BP_FP_INT_TYPE allocHandle();
+       void freeHandle(BP_FP_INT_TYPE handle);
+       
+
+       bool testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB);
+
+#ifdef DEBUG_BROADPHASE
+       void debugPrintAxis(int axis,bool checkCardinality=true);
+#endif //DEBUG_BROADPHASE
+
+       //Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
+       //void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
+
+       void quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const;
+
+       void sortMinDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
+       void sortMinUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
+       void sortMaxDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
+       void sortMaxUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
+
+public:
+       btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, int maxHandles = 16384);
+       virtual ~btAxisSweep3();
+
+       virtual void    refreshOverlappingPairs();
+       
+       BP_FP_INT_TYPE addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask);
+       void removeHandle(BP_FP_INT_TYPE handle);
+       void updateHandle(BP_FP_INT_TYPE handle, const btPoint3& aabbMin,const btPoint3& aabbMax);
+       inline Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;}
+
+       void    processAllOverlappingPairs(btOverlapCallback* callback);
+
+       //Broadphase Interface
+       virtual btBroadphaseProxy*      createProxy(  const btVector3& min,  const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
+       virtual void    destroyProxy(btBroadphaseProxy* proxy);
+       virtual void    setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
+       bool testOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
+
+};
+
+#endif
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h
new file mode 100644 (file)
index 0000000..b6ace03
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+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                BROADPHASE_INTERFACE_H
+#define        BROADPHASE_INTERFACE_H
+
+
+
+struct btDispatcherInfo;
+class btDispatcher;
+struct btBroadphaseProxy;
+#include "../../LinearMath/btVector3.h"
+
+///BroadphaseInterface for aabb-overlapping object pairs
+class btBroadphaseInterface
+{
+public:
+       virtual ~btBroadphaseInterface() {}
+
+       virtual btBroadphaseProxy*      createProxy(  const btVector3& min,  const btVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0;
+       virtual void    destroyProxy(btBroadphaseProxy* proxy)=0;
+       virtual void    setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)=0;
+       virtual void    cleanProxyFromPairs(btBroadphaseProxy* proxy)=0;
+       
+
+};
+
+#endif //BROADPHASE_INTERFACE_H
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp
new file mode 100644 (file)
index 0000000..f4d7341
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+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 "btBroadphaseProxy.h"
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
new file mode 100644 (file)
index 0000000..40d9748
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+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 BROADPHASE_PROXY_H
+#define BROADPHASE_PROXY_H
+
+#include "../../LinearMath/btScalar.h" //for SIMD_FORCE_INLINE
+
+
+/// btDispatcher uses these types
+/// IMPORTANT NOTE:The types are ordered polyhedral, implicit convex and concave
+/// to facilitate type checking
+enum BroadphaseNativeTypes
+{
+// polyhedral convex shapes
+       BOX_SHAPE_PROXYTYPE,
+       TRIANGLE_SHAPE_PROXYTYPE,
+       TETRAHEDRAL_SHAPE_PROXYTYPE,
+       CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE,
+       CONVEX_HULL_SHAPE_PROXYTYPE,
+//implicit convex shapes
+IMPLICIT_CONVEX_SHAPES_START_HERE,
+       SPHERE_SHAPE_PROXYTYPE,
+       MULTI_SPHERE_SHAPE_PROXYTYPE,
+       CAPSULE_SHAPE_PROXYTYPE,
+       CONE_SHAPE_PROXYTYPE,
+       CONVEX_SHAPE_PROXYTYPE,
+       CYLINDER_SHAPE_PROXYTYPE,
+       MINKOWSKI_SUM_SHAPE_PROXYTYPE,
+       MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE,
+//concave shapes
+CONCAVE_SHAPES_START_HERE,
+       //keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy!
+       TRIANGLE_MESH_SHAPE_PROXYTYPE,
+       ///used for demo integration FAST/Swift collision library and Bullet
+       FAST_CONCAVE_MESH_PROXYTYPE,
+       //terrain
+       TERRAIN_SHAPE_PROXYTYPE,
+///Used for GIMPACT Trimesh integration
+       GIMPACT_SHAPE_PROXYTYPE,
+       
+       EMPTY_SHAPE_PROXYTYPE,
+       STATIC_PLANE_PROXYTYPE,
+CONCAVE_SHAPES_END_HERE,
+
+       COMPOUND_SHAPE_PROXYTYPE,
+
+       MAX_BROADPHASE_COLLISION_TYPES
+};
+
+
+///btBroadphaseProxy
+struct btBroadphaseProxy
+{
+       
+       ///optional filtering to cull potential collisions
+       enum CollisionFilterGroups
+       {
+               DefaultFilter = 1,
+               StaticFilter = 2,
+               KinematicFilter = 4,
+               DebrisFilter = 8,
+                       SensorTrigger = 16,
+               AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger
+       };
+
+       //Usually the client btCollisionObject or Rigidbody class
+       void*   m_clientObject;
+       short int m_collisionFilterGroup;
+       short int m_collisionFilterMask;
+
+       //used for memory pools
+       btBroadphaseProxy() :m_clientObject(0){}
+
+       btBroadphaseProxy(void* userPtr,short int collisionFilterGroup, short int collisionFilterMask)
+               :m_clientObject(userPtr),
+               m_collisionFilterGroup(collisionFilterGroup),
+               m_collisionFilterMask(collisionFilterMask)
+       {
+       }
+
+       static inline bool isPolyhedral(int proxyType)
+       {
+               return (proxyType  < IMPLICIT_CONVEX_SHAPES_START_HERE);
+       }
+
+       static inline bool      isConvex(int proxyType)
+       {
+               return (proxyType < CONCAVE_SHAPES_START_HERE);
+       }
+
+       static inline bool      isConcave(int proxyType)
+       {
+               return ((proxyType > CONCAVE_SHAPES_START_HERE) &&
+                       (proxyType < CONCAVE_SHAPES_END_HERE));
+       }
+       static inline bool      isCompound(int proxyType)
+       {
+               return (proxyType == COMPOUND_SHAPE_PROXYTYPE);
+       }
+       static inline bool isInfinite(int proxyType)
+       {
+               return (proxyType == STATIC_PLANE_PROXYTYPE);
+       }
+       
+}
+;
+
+class btCollisionAlgorithm;
+
+struct btBroadphaseProxy;
+
+
+
+/// contains a pair of aabb-overlapping objects
+struct btBroadphasePair
+{
+       btBroadphasePair ()
+               :
+       m_pProxy0(0),
+               m_pProxy1(0),
+               m_algorithm(0),
+               m_userInfo(0)
+       {
+       }
+
+       btBroadphasePair(const btBroadphasePair& other)
+               :               m_pProxy0(other.m_pProxy0),
+                               m_pProxy1(other.m_pProxy1),
+                               m_algorithm(other.m_algorithm),
+                               m_userInfo(other.m_userInfo)
+       {
+       }
+       btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
+       {
+
+               //keep them sorted, so the std::set operations work
+               if (&proxy0 < &proxy1)
+        { 
+            m_pProxy0 = &proxy0; 
+            m_pProxy1 = &proxy1; 
+        }
+        else 
+        { 
+                       m_pProxy0 = &proxy1; 
+            m_pProxy1 = &proxy0; 
+        }
+
+               m_algorithm = 0;
+               m_userInfo = 0;
+
+       }
+       
+       btBroadphaseProxy* m_pProxy0;
+       btBroadphaseProxy* m_pProxy1;
+       
+       mutable btCollisionAlgorithm* m_algorithm;
+       mutable void* m_userInfo;
+
+};
+
+/*
+//comparison for set operation, see Solid DT_Encounter
+SIMD_FORCE_INLINE bool operator<(const btBroadphasePair& a, const btBroadphasePair& b) 
+{ 
+    return a.m_pProxy0 < b.m_pProxy0 || 
+        (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 < b.m_pProxy1); 
+}
+*/
+
+
+class btBroadphasePairSortPredicate
+{
+       public:
+
+               bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b )
+               {
+                        return a.m_pProxy0 > b.m_pProxy0 || 
+                               (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 > b.m_pProxy1) ||
+                               (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 == b.m_pProxy1 && a.m_algorithm > b.m_algorithm); 
+               }
+};
+
+
+SIMD_FORCE_INLINE bool operator==(const btBroadphasePair& a, const btBroadphasePair& b) 
+{
+        return (a.m_pProxy0 == b.m_pProxy0) && (a.m_pProxy1 == b.m_pProxy1);
+}
+
+
+#endif //BROADPHASE_PROXY_H
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp
new file mode 100644 (file)
index 0000000..2ad0c86
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+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 "btCollisionAlgorithm.h"
+#include "btDispatcher.h"
+
+btCollisionAlgorithm::btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
+{
+       m_dispatcher = ci.m_dispatcher;
+}
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h
new file mode 100644 (file)
index 0000000..55cec38
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+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 COLLISION_ALGORITHM_H
+#define COLLISION_ALGORITHM_H
+
+#include "../../LinearMath/btScalar.h"
+
+struct btBroadphaseProxy;
+class btDispatcher;
+class btManifoldResult;
+class btCollisionObject;
+struct btDispatcherInfo;
+class  btPersistentManifold;
+
+
+struct btCollisionAlgorithmConstructionInfo
+{
+       btCollisionAlgorithmConstructionInfo()
+               :m_dispatcher(0),
+               m_manifold(0)
+       {
+       }
+       btCollisionAlgorithmConstructionInfo(btDispatcher* dispatcher,int temp)
+               :m_dispatcher(dispatcher)
+       {
+               (void)temp;
+       }
+
+       btDispatcher*   m_dispatcher;
+       btPersistentManifold*   m_manifold;
+
+       int     getDispatcherId();
+
+};
+
+
+///btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatcher.
+///It is persistent over frames
+class btCollisionAlgorithm
+{
+
+protected:
+
+       btDispatcher*   m_dispatcher;
+
+protected:
+       int     getDispatcherId();
+       
+public:
+
+       btCollisionAlgorithm() {};
+
+       btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci);
+
+       virtual ~btCollisionAlgorithm() {};
+
+       virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) = 0;
+
+       virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) = 0;
+
+};
+
+
+#endif //COLLISION_ALGORITHM_H
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.cpp
new file mode 100644 (file)
index 0000000..2076822
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+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 "btDispatcher.h"
+
+btDispatcher::~btDispatcher()
+{
+
+}
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.h
new file mode 100644 (file)
index 0000000..3d958cc
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+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 _DISPATCHER_H
+#define _DISPATCHER_H
+
+#include "../../LinearMath/btScalar.h"
+
+class btCollisionAlgorithm;
+struct btBroadphaseProxy;
+class btRigidBody;
+class  btCollisionObject;
+class btOverlappingPairCache;
+
+
+class btPersistentManifold;
+class btStackAlloc;
+
+struct btDispatcherInfo
+{
+       enum DispatchFunc
+       {
+               DISPATCH_DISCRETE = 1,
+               DISPATCH_CONTINUOUS
+       };
+       btDispatcherInfo()
+               :m_timeStep(btScalar(0.)),
+               m_stepCount(0),
+               m_dispatchFunc(DISPATCH_DISCRETE),
+               m_timeOfImpact(btScalar(1.)),
+               m_useContinuous(false),
+               m_debugDraw(0),
+               m_enableSatConvex(false),
+               m_enableSPU(false),
+               m_stackAllocator(0)
+       {
+
+       }
+       btScalar        m_timeStep;
+       int             m_stepCount;
+       int             m_dispatchFunc;
+       btScalar        m_timeOfImpact;
+       bool    m_useContinuous;
+       class btIDebugDraw*     m_debugDraw;
+       bool    m_enableSatConvex;
+       bool    m_enableSPU;
+       btStackAlloc*   m_stackAllocator;
+       
+};
+
+/// btDispatcher can be used in combination with broadphase to dispatch overlapping pairs.
+/// For example for pairwise collision detection or user callbacks (game logic).
+class btDispatcher
+{
+
+
+public:
+       virtual ~btDispatcher() ;
+
+       virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0;
+
+       virtual btPersistentManifold*   getNewManifold(void* body0,void* body1)=0;
+
+       virtual void releaseManifold(btPersistentManifold* manifold)=0;
+
+       virtual void clearManifold(btPersistentManifold* manifold)=0;
+
+       virtual bool    needsCollision(btCollisionObject* body0,btCollisionObject* body1) = 0;
+
+       virtual bool    needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0;
+
+       virtual void    dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)=0;
+
+       virtual int getNumManifolds() const = 0;
+
+       virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
+
+};
+
+
+#endif //_DISPATCHER_H
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp
new file mode 100644 (file)
index 0000000..60f0a41
--- /dev/null
@@ -0,0 +1,196 @@
+
+/*
+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 "btOverlappingPairCache.h"
+
+#include "btDispatcher.h"
+#include "btCollisionAlgorithm.h"
+
+int    gOverlappingPairs = 0;
+
+btOverlappingPairCache::btOverlappingPairCache():
+m_blockedForChanges(false),
+m_overlapFilterCallback(0)
+//m_NumOverlapBroadphasePair(0)
+{
+}
+
+
+btOverlappingPairCache::~btOverlappingPairCache()
+{
+       //todo/test: show we erase/delete data, or is it automatic
+}
+
+
+void   btOverlappingPairCache::removeOverlappingPair(btBroadphasePair& findPair)
+{
+       
+       int findIndex = m_overlappingPairArray.findLinearSearch(findPair);
+       if (findIndex < m_overlappingPairArray.size())
+       {
+               gOverlappingPairs--;
+               btBroadphasePair& pair = m_overlappingPairArray[findIndex];
+               cleanOverlappingPair(pair);
+               
+               m_overlappingPairArray.swap(findIndex,m_overlappingPairArray.size()-1);
+               m_overlappingPairArray.pop_back();
+       }
+}
+
+
+void   btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair)
+{
+       if (pair.m_algorithm)
+       {
+               {
+                       delete pair.m_algorithm;;
+                       pair.m_algorithm=0;
+               }
+       }
+}
+
+
+
+
+
+void   btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
+{
+       //don't add overlap with own
+       assert(proxy0 != proxy1);
+
+       if (!needsBroadphaseCollision(proxy0,proxy1))
+               return;
+
+
+       btBroadphasePair pair(*proxy0,*proxy1);
+       
+       m_overlappingPairArray.push_back(pair);
+       gOverlappingPairs++;
+       
+}
+
+///this findPair becomes really slow. Either sort the list to speedup the query, or
+///use a different solution. It is mainly used for Removing overlapping pairs. Removal could be delayed.
+///we could keep a linked list in each proxy, and store pair in one of the proxies (with lowest memory address)
+///Also we can use a 2D bitmap, which can be useful for a future GPU implementation
+ btBroadphasePair*     btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
+{
+       if (!needsBroadphaseCollision(proxy0,proxy1))
+               return 0;
+
+       btBroadphasePair tmpPair(*proxy0,*proxy1);
+       int findIndex = m_overlappingPairArray.findLinearSearch(tmpPair);
+
+       if (findIndex < m_overlappingPairArray.size())
+       {
+               //assert(it != m_overlappingPairSet.end());
+                btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
+               return pair;
+       }
+       return 0;
+}
+
+
+
+
+
+void   btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy)
+{
+
+       class   CleanPairCallback : public btOverlapCallback
+       {
+               btBroadphaseProxy* m_cleanProxy;
+               btOverlappingPairCache* m_pairCache;
+
+       public:
+               CleanPairCallback(btBroadphaseProxy* cleanProxy,btOverlappingPairCache* pairCache)
+                       :m_cleanProxy(cleanProxy),
+                       m_pairCache(pairCache)
+               {
+               }
+               virtual bool    processOverlap(btBroadphasePair& pair)
+               {
+                       if ((pair.m_pProxy0 == m_cleanProxy) ||
+                               (pair.m_pProxy1 == m_cleanProxy))
+                       {
+                               m_pairCache->cleanOverlappingPair(pair);
+                       }
+                       return false;
+               }
+               
+       };
+
+       CleanPairCallback cleanPairs(proxy,this);
+
+       processAllOverlappingPairs(&cleanPairs);
+
+}
+
+
+
+void   btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy)
+{
+
+       class   RemovePairCallback : public btOverlapCallback
+       {
+               btBroadphaseProxy* m_obsoleteProxy;
+
+       public:
+               RemovePairCallback(btBroadphaseProxy* obsoleteProxy)
+                       :m_obsoleteProxy(obsoleteProxy)
+               {
+               }
+               virtual bool    processOverlap(btBroadphasePair& pair)
+               {
+                       return ((pair.m_pProxy0 == m_obsoleteProxy) ||
+                               (pair.m_pProxy1 == m_obsoleteProxy));
+               }
+               
+       };
+
+
+       RemovePairCallback removeCallback(proxy);
+
+       processAllOverlappingPairs(&removeCallback);
+}
+
+
+
+void   btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback)
+{
+
+       int i;
+
+       for (i=0;i<m_overlappingPairArray.size();)
+       {
+       
+               btBroadphasePair* pair = &m_overlappingPairArray[i];
+               if (callback->processOverlap(*pair))
+               {
+                       cleanOverlappingPair(*pair);
+
+                       m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
+                       m_overlappingPairArray.pop_back();
+                       gOverlappingPairs--;
+               } else
+               {
+                       i++;
+               }
+       }
+}
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h
new file mode 100644 (file)
index 0000000..a81fe32
--- /dev/null
@@ -0,0 +1,120 @@
+
+/*
+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 OVERLAPPING_PAIR_CACHE_H
+#define OVERLAPPING_PAIR_CACHE_H
+
+
+#include "btBroadphaseInterface.h"
+#include "btBroadphaseProxy.h"
+#include "../../LinearMath/btPoint3.h"
+#include "../../LinearMath/btAlignedObjectArray.h"
+
+
+struct btOverlapCallback
+{
+       virtual ~btOverlapCallback()
+       {}
+       //return true for deletion of the pair
+       virtual bool    processOverlap(btBroadphasePair& pair) = 0;
+};
+
+struct btOverlapFilterCallback
+{
+       virtual ~btOverlapFilterCallback()
+       {}
+       // return true when pairs need collision
+       virtual bool    needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const = 0;
+};
+
+///btOverlappingPairCache maintains the objects with overlapping AABB
+///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
+class  btOverlappingPairCache : public btBroadphaseInterface
+{
+       protected:
+               //avoid brute-force finding all the time
+               btAlignedObjectArray<btBroadphasePair>  m_overlappingPairArray;
+               
+               //during the dispatch, check that user doesn't destroy/create proxy
+               bool            m_blockedForChanges;
+               
+               //if set, use the callback instead of the built in filter in needBroadphaseCollision
+               btOverlapFilterCallback* m_overlapFilterCallback;
+       public:
+                       
+               btOverlappingPairCache();       
+               virtual ~btOverlappingPairCache();
+
+               virtual void    processAllOverlappingPairs(btOverlapCallback*);
+
+               void    removeOverlappingPair(btBroadphasePair& pair);
+
+               void    cleanOverlappingPair(btBroadphasePair& pair);
+               
+               void    addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
+
+               btBroadphasePair*       findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
+                       
+               
+               void    cleanProxyFromPairs(btBroadphaseProxy* proxy);
+
+               void    removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy);
+
+
+               inline bool needsBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
+               {
+                       if (m_overlapFilterCallback)
+                               return m_overlapFilterCallback->needBroadphaseCollision(proxy0,proxy1);
+
+                       bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
+                       collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
+                       
+                       return collides;
+               }
+                       
+               
+
+               virtual void    refreshOverlappingPairs() =0;
+
+               btBroadphasePair*       getOverlappingPairArrayPtr()
+               {
+                       return &m_overlappingPairArray[0];
+               }
+
+               const btBroadphasePair* getOverlappingPairArrayPtr() const
+               {
+                       return &m_overlappingPairArray[0];
+               }
+
+               int     getNumOverlappingPairs() const
+               {
+                       return m_overlappingPairArray.size();
+               }
+               
+               btOverlapFilterCallback* getOverlapFilterCallback()
+               {
+                       return m_overlapFilterCallback;
+               }
+
+               void setOverlapFilterCallback(btOverlapFilterCallback* callback)
+               {
+                       m_overlapFilterCallback = callback;
+               }
+
+};
+#endif //OVERLAPPING_PAIR_CACHE_H
+
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp
new file mode 100644 (file)
index 0000000..30bcbe0
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+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 "btSimpleBroadphase.h"
+#include <BulletCollision/BroadphaseCollision/btDispatcher.h>
+#include <BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h>
+
+#include "LinearMath/btVector3.h"
+#include "LinearMath/btTransform.h"
+#include "LinearMath/btMatrix3x3.h"
+#include <new>
+
+
+void   btSimpleBroadphase::validate()
+{
+       for (int i=0;i<m_numProxies;i++)
+       {
+               for (int j=i+1;j<m_numProxies;j++)
+               {
+                       assert(m_pProxies[i] != m_pProxies[j]);
+               }
+       }
+       
+}
+
+btSimpleBroadphase::btSimpleBroadphase(int maxProxies)
+       :btOverlappingPairCache(),
+       m_firstFreeProxy(0),
+       m_numProxies(0),
+       m_maxProxies(maxProxies)
+{
+
+       m_proxies = new btSimpleBroadphaseProxy[maxProxies];
+       m_freeProxies = new int[maxProxies];
+       m_pProxies = new btSimpleBroadphaseProxy*[maxProxies];
+       
+
+       int i;
+       for (i=0;i<m_maxProxies;i++)
+       {
+               m_freeProxies[i] = i;
+       }
+}
+
+btSimpleBroadphase::~btSimpleBroadphase()
+{
+       delete[] m_proxies;
+       delete []m_freeProxies;
+       delete [] m_pProxies;
+
+       /*int i;
+       for (i=m_numProxies-1;i>=0;i--)
+       {
+               BP_Proxy* proxy = m_pProxies[i]; 
+               destroyProxy(proxy);
+       }
+       */
+}
+
+
+btBroadphaseProxy*     btSimpleBroadphase::createProxy(  const btVector3& min,  const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
+{
+       if (m_numProxies >= m_maxProxies)
+       {
+               assert(0);
+               return 0; //should never happen, but don't let the game crash ;-)
+       }
+       assert(min[0]<= max[0] && min[1]<= max[1] && min[2]<= max[2]);
+
+       int freeIndex= m_freeProxies[m_firstFreeProxy];
+       btSimpleBroadphaseProxy* proxy = new (&m_proxies[freeIndex])btSimpleBroadphaseProxy(min,max,shapeType,userPtr,collisionFilterGroup,collisionFilterMask);
+       m_firstFreeProxy++;
+
+       btSimpleBroadphaseProxy* proxy1 = &m_proxies[0];
+               
+       int     index = int(proxy - proxy1);
+       btAssert(index == freeIndex);
+
+       m_pProxies[m_numProxies] = proxy;
+       m_numProxies++;
+       //validate();
+
+       return proxy;
+}
+
+class  RemovingOverlapCallback : public btOverlapCallback
+{
+protected:
+       virtual bool    processOverlap(btBroadphasePair& pair)
+       {
+               (void)pair;
+               btAssert(0);
+               return false;
+       }
+};
+
+class RemovePairContainingProxy
+{
+
+       btBroadphaseProxy*      m_targetProxy;
+       public:
+       virtual ~RemovePairContainingProxy()
+       {
+       }
+protected:
+       virtual bool processOverlap(btBroadphasePair& pair)
+       {
+               btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0);
+               btSimpleBroadphaseProxy* proxy1 = static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1);
+
+               return ((m_targetProxy == proxy0 || m_targetProxy == proxy1));
+       };
+};
+
+void   btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg)
+{
+               
+               int i;
+               
+               btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxyOrg);
+               btSimpleBroadphaseProxy* proxy1 = &m_proxies[0];
+       
+               int index = int(proxy0 - proxy1);
+               btAssert (index < m_maxProxies);
+               m_freeProxies[--m_firstFreeProxy] = index;
+
+               removeOverlappingPairsContainingProxy(proxyOrg);
+               
+               for (i=0;i<m_numProxies;i++)
+               {
+                       if (m_pProxies[i] == proxyOrg)
+                       {
+                               m_pProxies[i] = m_pProxies[m_numProxies-1];
+                               break;
+                       }
+               }
+               m_numProxies--;
+               //validate();
+               
+}
+
+void   btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
+{
+       btSimpleBroadphaseProxy* sbp = getSimpleProxyFromProxy(proxy);
+       sbp->m_min = aabbMin;
+       sbp->m_max = aabbMax;
+}
+
+
+
+
+
+       
+
+
+
+bool   btSimpleBroadphase::aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1)
+{
+       return proxy0->m_min[0] <= proxy1->m_max[0] && proxy1->m_min[0] <= proxy0->m_max[0] && 
+                  proxy0->m_min[1] <= proxy1->m_max[1] && proxy1->m_min[1] <= proxy0->m_max[1] &&
+                  proxy0->m_min[2] <= proxy1->m_max[2] && proxy1->m_min[2] <= proxy0->m_max[2];
+
+}
+
+
+
+//then remove non-overlapping ones
+class CheckOverlapCallback : public btOverlapCallback
+{
+public:
+       virtual bool processOverlap(btBroadphasePair& pair)
+       {
+               return (!btSimpleBroadphase::aabbOverlap(static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0),static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1)));
+       }
+};
+
+void   btSimpleBroadphase::refreshOverlappingPairs()
+{
+       //first check for new overlapping pairs
+       int i,j;
+
+       for (i=0;i<m_numProxies;i++)
+       {
+               btBroadphaseProxy* proxy0 = m_pProxies[i];
+               for (j=i+1;j<m_numProxies;j++)
+               {
+                       btBroadphaseProxy* proxy1 = m_pProxies[j];
+                       btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
+                       btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
+
+                       if (aabbOverlap(p0,p1))
+                       {
+                               if ( !findPair(proxy0,proxy1))
+                               {
+                                       addOverlappingPair(proxy0,proxy1);
+                               }
+                       }
+
+               }
+       }
+
+
+       CheckOverlapCallback    checkOverlap;
+
+       processAllOverlappingPairs(&checkOverlap);
+
+
+}
+
+
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h
new file mode 100644 (file)
index 0000000..fb155e7
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+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 SIMPLE_BROADPHASE_H
+#define SIMPLE_BROADPHASE_H
+
+
+#include "btOverlappingPairCache.h"
+
+
+struct btSimpleBroadphaseProxy : public btBroadphaseProxy
+{
+       btVector3       m_min;
+       btVector3       m_max;
+       
+       btSimpleBroadphaseProxy() {};
+
+       btSimpleBroadphaseProxy(const btPoint3& minpt,const btPoint3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
+       :btBroadphaseProxy(userPtr,collisionFilterGroup,collisionFilterMask),
+       m_min(minpt),m_max(maxpt)               
+       {
+               (void)shapeType;
+       }
+       
+
+};
+
+///SimpleBroadphase is a brute force aabb culling broadphase based on O(n^2) aabb checks
+class btSimpleBroadphase : public btOverlappingPairCache
+{
+
+protected:
+
+       btSimpleBroadphaseProxy*        m_proxies;
+       int*                            m_freeProxies;
+       int                             m_firstFreeProxy;
+
+       btSimpleBroadphaseProxy** m_pProxies;
+       int                             m_numProxies;
+
+       
+
+       int m_maxProxies;
+       
+       
+       inline btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy)
+       {
+               btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxy);
+               return proxy0;
+       }
+
+
+       void    validate();
+
+protected:
+
+
+       virtual void    refreshOverlappingPairs();
+public:
+       btSimpleBroadphase(int maxProxies=16384);
+       virtual ~btSimpleBroadphase();
+
+
+               static bool     aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
+
+
+       virtual btBroadphaseProxy*      createProxy(  const btVector3& min,  const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
+
+
+       virtual void    destroyProxy(btBroadphaseProxy* proxy);
+       virtual void    setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
+               
+       
+       
+
+
+
+};
+
+
+
+#endif //SIMPLE_BROADPHASE_H
+
diff --git a/extern/bullet2/src/BulletCollision/CMakeLists.txt b/extern/bullet2/src/BulletCollision/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e565bf7
--- /dev/null
@@ -0,0 +1,60 @@
+                       
+INCLUDE_DIRECTORIES(
+${BULLET_PHYSICS_SOURCE_DIR}/src }
+)
+       
+ADD_LIBRARY(LibBulletCollision
+                               BroadphaseCollision/btAxisSweep3.cpp
+                               BroadphaseCollision/btBroadphaseProxy.cpp
+                               BroadphaseCollision/btCollisionAlgorithm.cpp
+                               BroadphaseCollision/btDispatcher.cpp
+                               BroadphaseCollision/btOverlappingPairCache.cpp
+                               BroadphaseCollision/btSimpleBroadphase.cpp
+                               CollisionDispatch/btCollisionDispatcher.cpp
+                               CollisionDispatch/btCollisionObject.cpp
+                               CollisionDispatch/btCollisionWorld.cpp
+                               CollisionDispatch/btCompoundCollisionAlgorithm.cpp
+                               CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
+                               CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
+                               CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
+                               CollisionDispatch/btConvexConvexAlgorithm.cpp
+                               CollisionDispatch/btEmptyCollisionAlgorithm.cpp
+                               CollisionDispatch/btManifoldResult.cpp
+                               CollisionDispatch/btSimulationIslandManager.cpp
+                               CollisionDispatch/btUnionFind.cpp
+                               CollisionShapes/btBoxShape.cpp
+                               CollisionShapes/btBvhTriangleMeshShape.cpp
+                               CollisionShapes/btCollisionShape.cpp
+                               CollisionShapes/btCompoundShape.cpp
+                               CollisionShapes/btConcaveShape.cpp
+                               CollisionShapes/btConeShape.cpp
+                               CollisionShapes/btConvexHullShape.cpp
+                               CollisionShapes/btConvexShape.cpp
+                               CollisionShapes/btConvexTriangleMeshShape.cpp
+                               CollisionShapes/btCylinderShape.cpp
+                               CollisionShapes/btEmptyShape.cpp
+                               CollisionShapes/btMinkowskiSumShape.cpp
+                               CollisionShapes/btMultiSphereShape.cpp
+                               CollisionShapes/btOptimizedBvh.cpp
+                               CollisionShapes/btPolyhedralConvexShape.cpp
+                               CollisionShapes/btTetrahedronShape.cpp
+                               CollisionShapes/btSphereShape.cpp
+                               CollisionShapes/btStaticPlaneShape.cpp
+                               CollisionShapes/btStridingMeshInterface.cpp
+                               CollisionShapes/btTriangleCallback.cpp
+                               CollisionShapes/btTriangleBuffer.cpp
+                               CollisionShapes/btTriangleIndexVertexArray.cpp
+                               CollisionShapes/btTriangleMesh.cpp
+                               CollisionShapes/btTriangleMeshShape.cpp
+                               NarrowPhaseCollision/btContinuousConvexCollision.cpp
+                               NarrowPhaseCollision/btGjkEpa.cpp
+                               NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp
+                               NarrowPhaseCollision/btConvexCast.cpp
+                               NarrowPhaseCollision/btGjkConvexCast.cpp
+                               NarrowPhaseCollision/btGjkPairDetector.cpp
+                               NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp
+                               NarrowPhaseCollision/btPersistentManifold.cpp
+                               NarrowPhaseCollision/btRaycastCallback.cpp
+                               NarrowPhaseCollision/btSubSimplexConvexCast.cpp
+                               NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
+)
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp
new file mode 100644 (file)
index 0000000..8113367
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+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 "LinearMath/btScalar.h"
+#include "SphereTriangleDetector.h"
+#include "BulletCollision/CollisionShapes/btTriangleShape.h"
+#include "BulletCollision/CollisionShapes/btSphereShape.h"
+
+
+SphereTriangleDetector::SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle)
+:m_sphere(sphere),
+m_triangle(triangle)
+{
+
+}
+
+void   SphereTriangleDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
+{
+
+       (void)debugDraw;
+       const btTransform& transformA = input.m_transformA;
+       const btTransform& transformB = input.m_transformB;
+
+       btVector3 point,normal;
+       btScalar timeOfImpact = btScalar(1.);
+       btScalar depth = btScalar(0.);
+//     output.m_distance = btScalar(1e30);
+       //move sphere into triangle space
+       btTransform     sphereInTr = transformB.inverseTimes(transformA);
+
+       if (collide(sphereInTr.getOrigin(),point,normal,depth,timeOfImpact))
+       {
+               output.addContactPoint(transformB.getBasis()*normal,transformB*point,depth);
+       }
+
+}
+
+#define MAX_OVERLAP btScalar(0.)
+
+
+
+// See also geometrictools.com
+// Basic idea: D = |p - (lo + t0*lv)| where t0 = lv . (p - lo) / lv . lv
+btScalar SegmentSqrDistance(const btVector3& from, const btVector3& to,const btVector3 &p, btVector3 &nearest) {
+       btVector3 diff = p - from;
+       btVector3 v = to - from;
+       btScalar t = v.dot(diff);
+       
+       if (t > 0) {
+               btScalar dotVV = v.dot(v);
+               if (t < dotVV) {
+                       t /= dotVV;
+                       diff -= t*v;
+               } else {
+                       t = 1;
+                       diff -= v;
+               }
+       } else
+               t = 0;
+
+       nearest = from + t*v;
+       return diff.dot(diff);  
+}
+
+bool SphereTriangleDetector::facecontains(const btVector3 &p,const btVector3* vertices,btVector3& normal)  {
+       btVector3 lp(p);
+       btVector3 lnormal(normal);
+       
+       return pointInTriangle(vertices, lnormal, &lp);
+}
+
+///combined discrete/continuous sphere-triangle
+bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact)
+{
+
+       const btVector3* vertices = &m_triangle->getVertexPtr(0);
+       const btVector3& c = sphereCenter;
+       btScalar r = m_sphere->getRadius();
+
+       btVector3 delta (0,0,0);
+
+       btVector3 normal = (vertices[1]-vertices[0]).cross(vertices[2]-vertices[0]);
+       normal.normalize();
+       btVector3 p1ToCentre = c - vertices[0];
+       btScalar distanceFromPlane = p1ToCentre.dot(normal);
+
+       if (distanceFromPlane < btScalar(0.))
+       {
+               //triangle facing the other way
+       
+               distanceFromPlane *= btScalar(-1.);
+               normal *= btScalar(-1.);
+       }
+
+       ///todo: move this gContactBreakingThreshold into a proper structure
+       extern btScalar gContactBreakingThreshold;
+
+       btScalar contactMargin = gContactBreakingThreshold;
+       bool isInsideContactPlane = distanceFromPlane < r + contactMargin;
+       bool isInsideShellPlane = distanceFromPlane < r;
+       
+       btScalar deltaDotNormal = delta.dot(normal);
+       if (!isInsideShellPlane && deltaDotNormal >= btScalar(0.0))
+               return false;
+
+       // Check for contact / intersection
+       bool hasContact = false;
+       btVector3 contactPoint;
+       if (isInsideContactPlane) {
+               if (facecontains(c,vertices,normal)) {
+                       // Inside the contact wedge - touches a point on the shell plane
+                       hasContact = true;
+                       contactPoint = c - normal*distanceFromPlane;
+               } else {
+                       // Could be inside one of the contact capsules
+                       btScalar contactCapsuleRadiusSqr = (r + contactMargin) * (r + contactMargin);
+                       btVector3 nearestOnEdge;
+                       for (int i = 0; i < m_triangle->getNumEdges(); i++) {
+                               
+                               btPoint3 pa;
+                               btPoint3 pb;
+                               
+                               m_triangle->getEdge(i,pa,pb);
+
+                               btScalar distanceSqr = SegmentSqrDistance(pa,pb,c, nearestOnEdge);
+                               if (distanceSqr < contactCapsuleRadiusSqr) {
+                                       // Yep, we're inside a capsule
+                                       hasContact = true;
+                                       contactPoint = nearestOnEdge;
+                               }
+                               
+                       }
+               }
+       }
+
+       if (hasContact) {
+               btVector3 contactToCentre = c - contactPoint;
+               btScalar distanceSqr = contactToCentre.length2();
+               if (distanceSqr < (r - MAX_OVERLAP)*(r - MAX_OVERLAP)) {
+                       btScalar distance = btSqrt(distanceSqr);
+                       resultNormal = contactToCentre;
+                       resultNormal.normalize();
+                       point = contactPoint;
+                       depth = -(r-distance);
+                       return true;
+               }
+
+               if (delta.dot(contactToCentre) >= btScalar(0.0)) 
+                       return false;
+               
+               // Moving towards the contact point -> collision
+               point = contactPoint;
+               timeOfImpact = btScalar(0.0);
+               return true;
+       }
+       
+       return false;
+}
+
+
+bool SphereTriangleDetector::pointInTriangle(const btVector3 vertices[], const btVector3 &normal, btVector3 *p )
+{
+       const btVector3* p1 = &vertices[0];
+       const btVector3* p2 = &vertices[1];
+       const btVector3* p3 = &vertices[2];
+
+       btVector3 edge1( *p2 - *p1 );
+       btVector3 edge2( *p3 - *p2 );
+       btVector3 edge3( *p1 - *p3 );
+
+       btVector3 p1_to_p( *p - *p1 );
+       btVector3 p2_to_p( *p - *p2 );
+       btVector3 p3_to_p( *p - *p3 );
+
+       btVector3 edge1_normal( edge1.cross(normal));
+       btVector3 edge2_normal( edge2.cross(normal));
+       btVector3 edge3_normal( edge3.cross(normal));
+       
+       btScalar r1, r2, r3;
+       r1 = edge1_normal.dot( p1_to_p );
+       r2 = edge2_normal.dot( p2_to_p );
+       r3 = edge3_normal.dot( p3_to_p );
+       if ( ( r1 > 0 && r2 > 0 && r3 > 0 ) ||
+            ( r1 <= 0 && r2 <= 0 && r3 <= 0 ) )
+               return true;
+       return false;
+
+}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.h
new file mode 100644 (file)
index 0000000..b32806a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+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 SPHERE_TRIANGLE_DETECTOR_H
+#define SPHERE_TRIANGLE_DETECTOR_H
+
+#include "../NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
+#include "../../LinearMath/btPoint3.h"
+
+
+class btSphereShape;
+class btTriangleShape;
+
+
+
+/// sphere-triangle to match the btDiscreteCollisionDetectorInterface
+struct SphereTriangleDetector : public btDiscreteCollisionDetectorInterface
+{
+       virtual void    getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
+
+       SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle);
+
+       virtual ~SphereTriangleDetector() {};
+
+private:
+
+       bool collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact);
+       bool pointInTriangle(const btVector3 vertices[], const btVector3 &normal, btVector3 *p );
+       bool facecontains(const btVector3 &p,const btVector3* vertices,btVector3& normal);
+
+       btSphereShape* m_sphere;
+       btTriangleShape* m_triangle;
+
+       
+};
+#endif //SPHERE_TRIANGLE_DETECTOR_H
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
new file mode 100644 (file)
index 0000000..d51a59a
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+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 COLLISION_CREATE_FUNC
+#define COLLISION_CREATE_FUNC
+
+#include "../../LinearMath/btAlignedObjectArray.h"
+typedef btAlignedObjectArray<class btCollisionObject*> btCollisionObjectArray;
+class btCollisionAlgorithm;
+class btCollisionObject;
+
+struct btCollisionAlgorithmConstructionInfo;
+
+///Used by the btCollisionDispatcher to register and create instances for btCollisionAlgorithm
+struct btCollisionAlgorithmCreateFunc
+{
+       bool m_swapped;
+       
+       btCollisionAlgorithmCreateFunc()
+               :m_swapped(false)
+       {
+       }
+       virtual ~btCollisionAlgorithmCreateFunc(){};
+
+       virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& , btCollisionObject* body0,btCollisionObject* body1)
+       {
+               
+               (void)body0;
+               (void)body1;
+               return 0;
+       }
+};
+#endif //COLLISION_CREATE_FUNC
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
new file mode 100644 (file)
index 0000000..b535fac
--- /dev/null
@@ -0,0 +1,367 @@
+/*
+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 "btCollisionDispatcher.h"
+
+
+#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
+#include "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h"
+#include "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h"
+#include "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h"
+#include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
+#include "BulletCollision/CollisionShapes/btCollisionShape.h"
+#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
+#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
+
+int gNumManifold = 0;
+
+#include <stdio.h>
+
+       
+btCollisionDispatcher::btCollisionDispatcher(bool noDefaultAlgorithms):
+m_count(0),
+m_useIslands(true),
+m_convexConvexCreateFunc(0),
+m_convexConcaveCreateFunc(0),
+m_swappedConvexConcaveCreateFunc(0),
+m_compoundCreateFunc(0),
+m_swappedCompoundCreateFunc(0),
+m_emptyCreateFunc(0)
+{
+       (void)noDefaultAlgorithms;
+       int i;
+
+       setNearCallback(defaultNearCallback);
+
+       m_emptyCreateFunc = new btEmptyAlgorithm::CreateFunc;
+       for (i=0;i<MAX_BROADPHASE_COLLISION_TYPES;i++)
+       {
+               for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
+               {
+                       m_doubleDispatch[i][j] = m_emptyCreateFunc;
+               }
+       }
+}
+//if you want to not link with the default collision algorithms, you can
+//define BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION 
+//in your Bullet library build system
+#ifndef BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
+
+btCollisionDispatcher::btCollisionDispatcher (): 
+       m_count(0),
+       m_useIslands(true)
+{
+       int i;
+
+       setNearCallback(defaultNearCallback);
+       
+       //default CreationFunctions, filling the m_doubleDispatch table
+       m_convexConvexCreateFunc = new btConvexConvexAlgorithm::CreateFunc;
+       m_convexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm::CreateFunc;
+       m_swappedConvexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm::SwappedCreateFunc;
+       m_compoundCreateFunc = new btCompoundCollisionAlgorithm::CreateFunc;
+       m_swappedCompoundCreateFunc = new btCompoundCollisionAlgorithm::SwappedCreateFunc;
+       m_emptyCreateFunc = new btEmptyAlgorithm::CreateFunc;
+
+       for (i=0;i<MAX_BROADPHASE_COLLISION_TYPES;i++)
+       {
+               for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
+               {
+                       m_doubleDispatch[i][j] = internalFindCreateFunc(i,j);
+                       assert(m_doubleDispatch[i][j]);
+               }
+       }
+       
+       
+};
+
+#endif //BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
+
+
+void btCollisionDispatcher::registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
+{
+       m_doubleDispatch[proxyType0][proxyType1] = createFunc;
+}
+
+btCollisionDispatcher::~btCollisionDispatcher()
+{
+       delete m_convexConvexCreateFunc;
+       delete m_convexConcaveCreateFunc;
+       delete m_swappedConvexConcaveCreateFunc;
+       delete m_compoundCreateFunc;
+       delete m_swappedCompoundCreateFunc;
+       delete m_emptyCreateFunc;
+}
+
+btPersistentManifold*  btCollisionDispatcher::getNewManifold(void* b0,void* b1) 
+{ 
+       gNumManifold++;
+       
+       //btAssert(gNumManifold < 65535);
+       
+
+       btCollisionObject* body0 = (btCollisionObject*)b0;
+       btCollisionObject* body1 = (btCollisionObject*)b1;
+       
+       btPersistentManifold* manifold = new btPersistentManifold (body0,body1);
+       m_manifoldsPtr.push_back(manifold);
+
+       return manifold;
+}
+
+void btCollisionDispatcher::clearManifold(btPersistentManifold* manifold)
+{
+       manifold->clearManifold();
+}
+
+       
+void btCollisionDispatcher::releaseManifold(btPersistentManifold* manifold)
+{
+       
+       gNumManifold--;
+
+       //printf("releaseManifold: gNumManifold %d\n",gNumManifold);
+       clearManifold(manifold);
+
+       ///todo: this can be improved a lot, linear search might be slow part!
+       int findIndex = m_manifoldsPtr.findLinearSearch(manifold);
+       if (findIndex < m_manifoldsPtr.size())
+       {
+               m_manifoldsPtr.swap(findIndex,m_manifoldsPtr.size()-1);
+               m_manifoldsPtr.pop_back();
+               delete manifold;
+       }
+       
+}
+
+       
+
+btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold)
+{
+
+#ifdef USE_DISPATCH_REGISTRY_ARRAY
+       
+       btCollisionAlgorithmConstructionInfo ci;
+       ci.m_dispatcher = this;
+       ci.m_manifold = sharedManifold;
+       btCollisionAlgorithm* algo = m_doubleDispatch[body0->getCollisionShape()->getShapeType()][body1->getCollisionShape()->getShapeType()]
+       ->CreateCollisionAlgorithm(ci,body0,body1);
+#else
+       btCollisionAlgorithm* algo = internalFindAlgorithm(body0,body1);
+#endif //USE_DISPATCH_REGISTRY_ARRAY
+       return algo;
+}
+
+
+#ifndef BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
+
+btCollisionAlgorithmCreateFunc* btCollisionDispatcher::internalFindCreateFunc(int proxyType0,int proxyType1)
+{
+       
+       if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConvex(proxyType1))
+       {
+               return m_convexConvexCreateFunc;
+       }
+
+       if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConcave(proxyType1))
+       {
+               return m_convexConcaveCreateFunc;
+       }
+
+       if (btBroadphaseProxy::isConvex(proxyType1) && btBroadphaseProxy::isConcave(proxyType0))
+       {
+               return m_swappedConvexConcaveCreateFunc;
+       }
+
+       if (btBroadphaseProxy::isCompound(proxyType0))
+       {
+               return m_compoundCreateFunc;
+       } else
+       {
+               if (btBroadphaseProxy::isCompound(proxyType1))
+               {
+                       return m_swappedCompoundCreateFunc;
+               }
+       }
+
+       //failed to find an algorithm
+       return m_emptyCreateFunc;
+}
+
+#endif //BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
+
+
+#ifndef USE_DISPATCH_REGISTRY_ARRAY
+
+btCollisionAlgorithm* btCollisionDispatcher::internalFindAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold)
+{
+       m_count++;
+       
+       btCollisionAlgorithmConstructionInfo ci;
+       ci.m_dispatcher = this;
+       
+       if (body0->getCollisionShape()->isConvex() && body1->getCollisionShape()->isConvex() )
+       {
+               return new btConvexConvexAlgorithm(sharedManifold,ci,body0,body1);
+       }
+
+       if (body0->getCollisionShape()->isConvex() && body1->getCollisionShape()->isConcave())
+       {
+               return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,false);
+       }
+
+       if (body1->getCollisionShape()->isConvex() && body0->getCollisionShape()->isConcave())
+       {
+               return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,true);
+       }
+
+       if (body0->getCollisionShape()->isCompound())
+       {
+               return new btCompoundCollisionAlgorithm(ci,body0,body1,false);
+       } else
+       {
+               if (body1->getCollisionShape()->isCompound())
+               {
+                       return new btCompoundCollisionAlgorithm(ci,body0,body1,true);
+               }
+       }
+
+       //failed to find an algorithm
+       return new btEmptyAlgorithm(ci);
+       
+}
+#endif //USE_DISPATCH_REGISTRY_ARRAY
+
+bool   btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionObject* body1)
+{
+       //here you can do filtering
+       bool hasResponse = 
+               (body0->hasContactResponse() && body1->hasContactResponse());
+       //no response between two static/kinematic bodies:
+       hasResponse = hasResponse &&
+               ((!body0->isStaticOrKinematicObject()) ||(! body1->isStaticOrKinematicObject()));
+       return hasResponse;
+}
+
+bool   btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionObject* body1)
+{
+       assert(body0);
+       assert(body1);
+
+       bool needsCollision = true;
+
+       //broadphase filtering already deals with this
+       if ((body0->isStaticObject() || body0->isKinematicObject()) &&
+               (body1->isStaticObject() || body1->isKinematicObject()))
+       {
+               printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
+       }
+               
+       if ((!body0->isActive()) && (!body1->isActive()))
+               needsCollision = false;
+       else if (!body0->checkCollideWith(body1))
+               needsCollision = false;
+       
+       return needsCollision ;
+
+}
+
+
+
+///interface for iterating all overlapping collision pairs, no matter how those pairs are stored (array, set, map etc)
+///this is useful for the collision dispatcher.
+class btCollisionPairCallback : public btOverlapCallback
+{
+       btDispatcherInfo& m_dispatchInfo;
+       btCollisionDispatcher*  m_dispatcher;
+
+public:
+
+       btCollisionPairCallback(btDispatcherInfo& dispatchInfo,btCollisionDispatcher*   dispatcher)
+       :m_dispatchInfo(dispatchInfo),
+       m_dispatcher(dispatcher)
+       {
+       }
+
+       btCollisionPairCallback& operator=(btCollisionPairCallback& other)
+       {
+               m_dispatchInfo = other.m_dispatchInfo;
+               m_dispatcher = other.m_dispatcher;
+               return *this;
+       }
+
+       virtual ~btCollisionPairCallback() {}
+
+
+       virtual bool    processOverlap(btBroadphasePair& pair)
+       {
+               (*m_dispatcher->getNearCallback())(pair,*m_dispatcher,m_dispatchInfo);
+
+               return false;
+       }
+};
+
+
+void   btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)
+{
+       //m_blockedForChanges = true;
+
+       btCollisionPairCallback collisionCallback(dispatchInfo,this);
+
+       pairCache->processAllOverlappingPairs(&collisionCallback);
+
+       //m_blockedForChanges = false;
+
+}
+
+
+
+
+//by default, Bullet will use this near callback
+void btCollisionDispatcher::defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, btDispatcherInfo& dispatchInfo)
+{
+               btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
+               btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject;
+
+               if (dispatcher.needsCollision(colObj0,colObj1))
+               {
+                       //dispatcher will keep algorithms persistent in the collision pair
+                       if (!collisionPair.m_algorithm)
+                       {
+                               collisionPair.m_algorithm = dispatcher.findAlgorithm(colObj0,colObj1);
+                       }
+
+                       if (collisionPair.m_algorithm)
+                       {
+                               btManifoldResult contactPointResult(colObj0,colObj1);
+                               
+                               if (dispatchInfo.m_dispatchFunc ==              btDispatcherInfo::DISPATCH_DISCRETE)
+                               {
+                                       //discrete collision detection query
+                                       collisionPair.m_algorithm->processCollision(colObj0,colObj1,dispatchInfo,&contactPointResult);
+                               } else
+                               {
+                                       //continuous collision detection query, time of impact (toi)
+                                       btScalar toi = collisionPair.m_algorithm->calculateTimeOfImpact(colObj0,colObj1,dispatchInfo,&contactPointResult);
+                                       if (dispatchInfo.m_timeOfImpact > toi)
+                                               dispatchInfo.m_timeOfImpact = toi;
+
+                               }
+                       }
+               }
+
+}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h
new file mode 100644 (file)
index 0000000..ca5aba8
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+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 COLLISION__DISPATCHER_H
+#define COLLISION__DISPATCHER_H
+
+#include "../BroadphaseCollision/btDispatcher.h"
+#include "../NarrowPhaseCollision/btPersistentManifold.h"
+
+#include "../CollisionDispatch/btManifoldResult.h"
+
+#include "../BroadphaseCollision/btBroadphaseProxy.h"
+#include "../../LinearMath/btAlignedObjectArray.h"
+
+class btIDebugDraw;
+class btOverlappingPairCache;
+
+
+#include "btCollisionCreateFunc.h"
+
+#define USE_DISPATCH_REGISTRY_ARRAY 1
+
+class btCollisionDispatcher;
+///user can override this nearcallback for collision filtering and more finegrained control over collision detection
+typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, btDispatcherInfo& dispatchInfo);
+
+
+///btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
+///Time of Impact, Closest Points and Penetration Depth.
+class btCollisionDispatcher : public btDispatcher
+{
+       int m_count;
+       
+       btAlignedObjectArray<btPersistentManifold*>     m_manifoldsPtr;
+
+       bool m_useIslands;
+       
+       btManifoldResult        m_defaultManifoldResult;
+
+       btNearCallback          m_nearCallback;
+       
+       btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLLISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES];
+       
+       btCollisionAlgorithmCreateFunc* internalFindCreateFunc(int proxyType0,int proxyType1);
+
+       //default CreationFunctions, filling the m_doubleDispatch table
+       btCollisionAlgorithmCreateFunc* m_convexConvexCreateFunc;
+       btCollisionAlgorithmCreateFunc* m_convexConcaveCreateFunc;
+       btCollisionAlgorithmCreateFunc* m_swappedConvexConcaveCreateFunc;
+       btCollisionAlgorithmCreateFunc* m_compoundCreateFunc;
+       btCollisionAlgorithmCreateFunc* m_swappedCompoundCreateFunc;
+       btCollisionAlgorithmCreateFunc*   m_emptyCreateFunc;
+
+#ifndef USE_DISPATCH_REGISTRY_ARRAY
+       btCollisionAlgorithm* internalFindAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold = 0);
+#endif //USE_DISPATCH_REGISTRY_ARRAY
+
+public:
+
+       ///registerCollisionCreateFunc allows registration of custom/alternative collision create functions
+       void    registerCollisionCreateFunc(int proxyType0,int proxyType1, btCollisionAlgorithmCreateFunc* createFunc);
+
+       int     getNumManifolds() const
+       { 
+               return int( m_manifoldsPtr.size());
+       }
+
+       btPersistentManifold**  getInternalManifoldPointer()
+       {
+               return &m_manifoldsPtr[0];
+       }
+
+        btPersistentManifold* getManifoldByIndexInternal(int index)
+       {
+               return m_manifoldsPtr[index];
+       }
+
+        const btPersistentManifold* getManifoldByIndexInternal(int index) const
+       {
+               return m_manifoldsPtr[index];
+       }
+
+       ///the default constructor creates/register default collision algorithms, for convex, compound and concave shape support
+       btCollisionDispatcher ();
+
+       ///a special constructor that doesn't create/register the default collision algorithms
+       btCollisionDispatcher(bool noDefaultAlgorithms);
+
+       virtual ~btCollisionDispatcher();
+
+       virtual btPersistentManifold*   getNewManifold(void* b0,void* b1);
+       
+       virtual void releaseManifold(btPersistentManifold* manifold);
+
+
+       virtual void clearManifold(btPersistentManifold* manifold);
+
+                       
+       btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold = 0);
+               
+       virtual bool    needsCollision(btCollisionObject* body0,btCollisionObject* body1);
+       
+       virtual bool    needsResponse(btCollisionObject* body0,btCollisionObject* body1);
+       
+       virtual void    dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo);
+
+       void    setNearCallback(btNearCallback  nearCallback)
+       {
+               m_nearCallback = nearCallback; 
+       }
+
+       btNearCallback  getNearCallback() const
+       {
+               return m_nearCallback;
+       }
+
+       //by default, Bullet will use this near callback
+       static void  defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, btDispatcherInfo& dispatchInfo);
+
+};
+
+#endif //COLLISION__DISPATCHER_H
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp
new file mode 100644 (file)
index 0000000..d4c0a4e
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+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 "btCollisionObject.h"
+
+btCollisionObject::btCollisionObject()
+       :       m_broadphaseHandle(0),
+               m_collisionShape(0),
+               m_collisionFlags(0),
+               m_activationState1(1),
+               m_deactivationTime(btScalar(0.)),
+               m_userObjectPointer(0),
+               m_hitFraction(btScalar(1.)),
+               m_ccdSweptSphereRadius(btScalar(0.)),
+               m_ccdSquareMotionThreshold(btScalar(0.)),
+               m_checkCollideWith(false)
+{
+       
+}
+
+btCollisionObject::~btCollisionObject()
+{
+}
+
+void btCollisionObject::setActivationState(int newState) 
+{ 
+       if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
+               m_activationState1 = newState;
+}
+
+void btCollisionObject::forceActivationState(int newState)
+{
+       m_activationState1 = newState;
+}
+
+void btCollisionObject::activate(bool forceActivation)
+{
+       if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
+       {
+               setActivationState(ACTIVE_TAG);
+               m_deactivationTime = btScalar(0.);
+       }
+}
+
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h
new file mode 100644 (file)
index 0000000..9fb6a67
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+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 COLLISION_OBJECT_H
+#define COLLISION_OBJECT_H
+
+#include "../../LinearMath/btTransform.h"
+
+//island management, m_activationState1
+#define ACTIVE_TAG 1
+#define ISLAND_SLEEPING 2
+#define WANTS_DEACTIVATION 3
+#define DISABLE_DEACTIVATION 4
+#define DISABLE_SIMULATION 5
+
+struct btBroadphaseProxy;
+class  btCollisionShape;
+#include "../../LinearMath/btMotionState.h"
+
+
+
+/// btCollisionObject can be used to manage collision detection objects. 
+/// btCollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy.
+/// They can be added to the btCollisionWorld.
+ATTRIBUTE_ALIGNED16(class)     btCollisionObject
+{
+
+protected:
+
+       btTransform     m_worldTransform;
+
+       ///m_interpolationWorldTransform is used for CCD and interpolation
+       ///it can be either previous or future (predicted) transform
+       btTransform     m_interpolationWorldTransform;
+       //those two are experimental: just added for bullet time effect, so you can still apply impulses (directly modifying velocities) 
+       //without destroying the continuous interpolated motion (which uses this interpolation velocities)
+       btVector3       m_interpolationLinearVelocity;
+       btVector3       m_interpolationAngularVelocity;
+       btBroadphaseProxy*              m_broadphaseHandle;
+       btCollisionShape*               m_collisionShape;
+
+       int                             m_collisionFlags;
+
+       int                             m_islandTag1;
+       int                             m_companionId;
+
+       int                             m_activationState1;
+       btScalar                        m_deactivationTime;
+
+       btScalar                m_friction;
+       btScalar                m_restitution;
+
+       ///users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
+       void*                   m_userObjectPointer;
+
+       ///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
+       void*                   m_internalOwner;
+
+       ///time of impact calculation
+       btScalar                m_hitFraction; 
+       
+       ///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
+       btScalar                m_ccdSweptSphereRadius;
+
+       /// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
+       btScalar                m_ccdSquareMotionThreshold;
+       
+       /// If some object should have elaborate collision filtering by sub-classes
+       bool                    m_checkCollideWith;
+
+       char    m_pad[7];
+
+       virtual bool    checkCollideWithOverride(btCollisionObject* co)
+       {
+               return true;
+       }
+
+public:
+
+       enum CollisionFlags
+       {
+               CF_STATIC_OBJECT= 1,
+               CF_KINEMATIC_OBJECT= 2,
+               CF_NO_CONTACT_RESPONSE = 4,
+               CF_CUSTOM_MATERIAL_CALLBACK = 8//this allows per-triangle material (friction/restitution)
+       };
+
+
+       inline bool mergesSimulationIslands() const
+       {
+               ///static objects, kinematic and object without contact response don't merge islands
+               return  ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
+       }
+
+
+       inline bool             isStaticObject() const {
+               return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
+       }
+
+       inline bool             isKinematicObject() const
+       {
+               return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
+       }
+
+       inline bool             isStaticOrKinematicObject() const
+       {
+               return (m_collisionFlags & (CF_KINEMATIC_OBJECT | CF_STATIC_OBJECT)) != 0 ;
+       }
+
+       inline bool             hasContactResponse() const {
+               return (m_collisionFlags & CF_NO_CONTACT_RESPONSE)==0;
+       }
+
+       
+       btCollisionObject();
+
+       virtual ~btCollisionObject();
+
+       void    setCollisionShape(btCollisionShape* collisionShape)
+       {
+               m_collisionShape = collisionShape;
+       }
+
+       const btCollisionShape* getCollisionShape() const
+       {
+               return m_collisionShape;
+       }
+
+       btCollisionShape*       getCollisionShape()
+       {
+               return m_collisionShape;
+       }
+
+       
+
+
+       int     getActivationState() const { return m_activationState1;}
+       
+       void setActivationState(int newState);
+
+       void    setDeactivationTime(btScalar time)
+       {
+               m_deactivationTime = time;
+       }
+       btScalar        getDeactivationTime() const
+       {
+               return m_deactivationTime;
+       }
+
+       void forceActivationState(int newState);
+
+       void    activate(bool forceActivation = false);
+
+       inline bool isActive() const
+       {
+               return ((getActivationState() != ISLAND_SLEEPING) && (getActivationState() != DISABLE_SIMULATION));
+       }
+
+       void    setRestitution(btScalar rest)
+       {
+               m_restitution = rest;
+       }
+       btScalar        getRestitution() const
+       {
+               return m_restitution;
+       }
+       void    setFriction(btScalar frict)
+       {
+               m_friction = frict;
+       }
+       btScalar        getFriction() const
+       {
+               return m_friction;
+       }
+
+       ///reserved for Bullet internal usage
+       void*   getInternalOwner()
+       {
+               return m_internalOwner;
+       }
+
+       const void*     getInternalOwner() const
+       {
+               return m_internalOwner;
+       }
+
+       btTransform&    getWorldTransform()
+       {
+               return m_worldTransform;
+       }
+
+       const btTransform&      getWorldTransform() const
+       {
+               return m_worldTransform;
+       }
+
+       void    setWorldTransform(const btTransform& worldTrans)
+       {
+               m_worldTransform = worldTrans;
+       }
+
+
+       btBroadphaseProxy*      getBroadphaseHandle()
+       {
+               return m_broadphaseHandle;
+       }
+
+       const btBroadphaseProxy*        getBroadphaseHandle() const
+       {
+               return m_broadphaseHandle;
+       }
+
+       void    setBroadphaseHandle(btBroadphaseProxy* handle)
+       {
+               m_broadphaseHandle = handle;
+       }
+
+
+       const btTransform&      getInterpolationWorldTransform() const
+       {
+               return m_interpolationWorldTransform;
+       }
+
+       btTransform&    getInterpolationWorldTransform()
+       {
+               return m_interpolationWorldTransform;
+       }
+
+       void    setInterpolationWorldTransform(const btTransform&       trans)
+       {
+               m_interpolationWorldTransform = trans;
+       }
+
+
+       const btVector3&        getInterpolationLinearVelocity() const
+       {
+               return m_interpolationLinearVelocity;
+       }
+
+       const btVector3&        getInterpolationAngularVelocity() const
+       {
+               return m_interpolationAngularVelocity;
+       }
+
+       const int getIslandTag() const
+       {
+               return  m_islandTag1;
+       }
+
+       void    setIslandTag(int tag)
+       {
+               m_islandTag1 = tag;
+       }
+
+       const int getCompanionId() const
+       {
+               return  m_companionId;
+       }
+
+       void    setCompanionId(int id)
+       {
+               m_companionId = id;
+       }
+
+       const btScalar                  getHitFraction() const
+       {
+               return m_hitFraction; 
+       }
+
+       void    setHitFraction(btScalar hitFraction)
+       {
+               m_hitFraction = hitFraction;
+       }
+
+       
+       const int       getCollisionFlags() const
+       {
+               return m_collisionFlags;
+       }
+
+       void    setCollisionFlags(int flags)
+       {
+               m_collisionFlags = flags;
+       }
+       
+       ///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
+       btScalar                        getCcdSweptSphereRadius() const
+       {
+               return m_ccdSweptSphereRadius;
+       }
+
+       ///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
+       void    setCcdSweptSphereRadius(btScalar radius)
+       {
+               m_ccdSweptSphereRadius = radius;
+       }
+
+       btScalar        getCcdSquareMotionThreshold() const
+       {
+               return m_ccdSquareMotionThreshold;
+       }
+
+
+       /// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
+       void    setCcdSquareMotionThreshold(btScalar ccdSquareMotionThreshold)
+       {
+               m_ccdSquareMotionThreshold = ccdSquareMotionThreshold;
+       }
+
+       ///users can point to their objects, userPointer is not used by Bullet
+       void*   getUserPointer() const
+       {
+               return m_userObjectPointer;
+       }
+       
+       ///users can point to their objects, userPointer is not used by Bullet
+       void    setUserPointer(void* userPointer)
+       {
+               m_userObjectPointer = userPointer;
+       }
+
+       inline bool checkCollideWith(btCollisionObject* co)
+       {
+               if (m_checkCollideWith)
+                       return checkCollideWithOverride(co);
+
+               return true;
+       }
+
+
+}
+;
+
+#endif //COLLISION_OBJECT_H
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
new file mode 100644 (file)
index 0000000..b49036a
--- /dev/null
@@ -0,0 +1,362 @@
+/*
+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 "btCollisionWorld.h"
+#include "btCollisionDispatcher.h"
+#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
+#include "BulletCollision/CollisionShapes/btCollisionShape.h"
+#include "BulletCollision/CollisionShapes/btConvexShape.h"
+
+#include "BulletCollision/CollisionShapes/btSphereShape.h" //for raycasting
+#include "BulletCollision/CollisionShapes/btTriangleMeshShape.h" //for raycasting
+#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
+#include "BulletCollision/CollisionShapes/btCompoundShape.h"
+#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
+#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
+#include "LinearMath/btAabbUtil2.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btStackAlloc.h"
+
+//When the user doesn't provide dispatcher or broadphase, create basic versions (and delete them in destructor)
+#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
+#include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h"
+
+
+btCollisionWorld::btCollisionWorld(btDispatcher* dispatcher,btOverlappingPairCache* pairCache, int stackSize)
+:m_dispatcher1(dispatcher),
+m_broadphasePairCache(pairCache),
+m_ownsDispatcher(false),
+m_ownsBroadphasePairCache(false)
+{
+       m_stackAlloc = new btStackAlloc(stackSize);
+       m_dispatchInfo.m_stackAllocator = m_stackAlloc;
+}
+
+
+btCollisionWorld::~btCollisionWorld()
+{
+       m_stackAlloc->destroy();
+       delete m_stackAlloc;
+
+       //clean up remaining objects
+       int i;
+       for (i=0;i<m_collisionObjects.size();i++)
+       {
+               btCollisionObject* collisionObject= m_collisionObjects[i];
+               
+               btBroadphaseProxy* bp = collisionObject->getBroadphaseHandle();
+               if (bp)
+               {
+                       //
+                       // only clear the cached algorithms
+                       //
+                       getBroadphase()->cleanProxyFromPairs(bp);
+                       getBroadphase()->destroyProxy(bp);
+               }
+       }
+
+       if (m_ownsDispatcher)
+               delete m_dispatcher1;
+       if (m_ownsBroadphasePairCache)
+               delete m_broadphasePairCache;
+
+}
+
+
+
+
+
+
+
+
+
+
+void   btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask)
+{
+
+       //check that the object isn't already added
+               btAssert( m_collisionObjects.findLinearSearch(collisionObject)  == m_collisionObjects.size());
+
+               m_collisionObjects.push_back(collisionObject);
+
+               //calculate new AABB
+               btTransform trans = collisionObject->getWorldTransform();
+
+               btVector3       minAabb;
+               btVector3       maxAabb;
+               collisionObject->getCollisionShape()->getAabb(trans,minAabb,maxAabb);
+
+               int type = collisionObject->getCollisionShape()->getShapeType();
+               collisionObject->setBroadphaseHandle( getBroadphase()->createProxy(
+                       minAabb,
+                       maxAabb,
+                       type,
+                       collisionObject,
+                       collisionFilterGroup,
+                       collisionFilterMask
+                       ))      ;
+
+               
+
+
+
+}
+
+
+
+
+void   btCollisionWorld::performDiscreteCollisionDetection()
+{
+       btDispatcherInfo& dispatchInfo = getDispatchInfo();
+
+       BEGIN_PROFILE("perform Broadphase Collision Detection");
+
+
+       //update aabb (of all moved objects)
+
+       btVector3 aabbMin,aabbMax;
+       for (int i=0;i<m_collisionObjects.size();i++)
+       {
+               m_collisionObjects[i]->getCollisionShape()->getAabb(m_collisionObjects[i]->getWorldTransform(),aabbMin,aabbMax);
+               m_broadphasePairCache->setAabb(m_collisionObjects[i]->getBroadphaseHandle(),aabbMin,aabbMax);
+       }
+
+       m_broadphasePairCache->refreshOverlappingPairs();
+
+       
+       END_PROFILE("perform Broadphase Collision Detection");
+
+       BEGIN_PROFILE("performDiscreteCollisionDetection");
+
+       btDispatcher* dispatcher = getDispatcher();
+       if (dispatcher)
+               dispatcher->dispatchAllCollisionPairs(m_broadphasePairCache,dispatchInfo);
+
+       END_PROFILE("performDiscreteCollisionDetection");
+
+}
+
+
+void   btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject)
+{
+       
+       
+       //bool removeFromBroadphase = false;
+       
+       {
+               
+               btBroadphaseProxy* bp = collisionObject->getBroadphaseHandle();
+               if (bp)
+               {
+                       //
+                       // only clear the cached algorithms
+                       //
+                       getBroadphase()->cleanProxyFromPairs(bp);
+                       getBroadphase()->destroyProxy(bp);
+                       collisionObject->setBroadphaseHandle(0);
+               }
+       }
+
+
+       //swapremove
+       m_collisionObjects.remove(collisionObject);
+
+}
+
+
+
+void   btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
+                                         btCollisionObject* collisionObject,
+                                         const btCollisionShape* collisionShape,
+                                         const btTransform& colObjWorldTransform,
+                                         RayResultCallback& resultCallback,short int collisionFilterMask)
+{
+       
+       btSphereShape pointShape(btScalar(0.0));
+       pointShape.setMargin(0.f);
+
+       objectQuerySingle(&pointShape,rayFromTrans,rayToTrans,
+                                         collisionObject,
+                                         collisionShape,
+                                         colObjWorldTransform,
+                                         resultCallback,collisionFilterMask);
+}
+
+void   btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const btTransform& rayFromTrans,const btTransform& rayToTrans,
+                                         btCollisionObject* collisionObject,
+                                         const btCollisionShape* collisionShape,
+                                         const btTransform& colObjWorldTransform,
+                                         RayResultCallback& resultCallback,short int collisionFilterMask)
+{
+       
+
+       if (collisionShape->isConvex())
+                       {
+                               btConvexCast::CastResult castResult;
+                               castResult.m_fraction = btScalar(1.);//??
+
+                               btConvexShape* convexShape = (btConvexShape*) collisionShape;
+                               btVoronoiSimplexSolver  simplexSolver;
+                               btSubsimplexConvexCast convexCaster(castShape,convexShape,&simplexSolver);
+                               //GjkConvexCast convexCaster(castShape,convexShape,&simplexSolver);
+                               //ContinuousConvexCollision convexCaster(castShape,convexShape,&simplexSolver,0);
+                               
+                               if (convexCaster.calcTimeOfImpact(rayFromTrans,rayToTrans,colObjWorldTransform,colObjWorldTransform,castResult))
+                               {
+                                       //add hit
+                                       if (castResult.m_normal.length2() > btScalar(0.0001))
+                                       {
+                                               castResult.m_normal.normalize();
+                                               if (castResult.m_fraction < resultCallback.m_closestHitFraction)
+                                               {
+
+                                                       btCollisionWorld::LocalRayResult localRayResult
+                                                               (
+                                                                       collisionObject, 
+                                                                       0,
+                                                                       castResult.m_normal,
+                                                                       castResult.m_fraction
+                                                               );
+
+                                                       resultCallback.AddSingleResult(localRayResult);
+
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               
+                               if (collisionShape->isConcave())
+                                       {
+
+                                               btTriangleMeshShape* triangleMesh = (btTriangleMeshShape*)collisionShape;
+                                               
+                                               btTransform worldTocollisionObject = colObjWorldTransform.inverse();
+
+                                               btVector3 rayFromLocal = worldTocollisionObject * rayFromTrans.getOrigin();
+                                               btVector3 rayToLocal = worldTocollisionObject * rayToTrans.getOrigin();
+
+                                               //ConvexCast::CastResult
+
+                                               struct BridgeTriangleRaycastCallback : public btTriangleRaycastCallback 
+                                               {
+                                                       btCollisionWorld::RayResultCallback* m_resultCallback;
+                                                       btCollisionObject*      m_collisionObject;
+                                                       btTriangleMeshShape*    m_triangleMesh;
+
+                                                       BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
+                                                               btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape*    triangleMesh):
+                                                               btTriangleRaycastCallback(from,to),
+                                                                       m_resultCallback(resultCallback),
+                                                                       m_collisionObject(collisionObject),
+                                                                       m_triangleMesh(triangleMesh)
+                                                               {
+                                                               }
+
+
+                                                       virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex )
+                                                       {
+                                                               btCollisionWorld::LocalShapeInfo        shapeInfo;
+                                                               shapeInfo.m_shapePart = partId;
+                                                               shapeInfo.m_triangleIndex = triangleIndex;
+                                                               
+                                                               btCollisionWorld::LocalRayResult rayResult
+                                                               (m_collisionObject, 
+                                                                       &shapeInfo,
+                                                                       hitNormalLocal,
+                                                                       hitFraction);
+                                                               
+                                                               return m_resultCallback->AddSingleResult(rayResult);
+                                                               
+                                                               
+                                                       }
+       
+                                               };
+
+
+                                               BridgeTriangleRaycastCallback   rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh);
+                                               rcb.m_hitFraction = resultCallback.m_closestHitFraction;
+
+                                               btVector3 rayAabbMinLocal = rayFromLocal;
+                                               rayAabbMinLocal.setMin(rayToLocal);
+                                               btVector3 rayAabbMaxLocal = rayFromLocal;
+                                               rayAabbMaxLocal.setMax(rayToLocal);
+
+                                               triangleMesh->processAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
+                                                                                       
+                                       } else
+                                       {
+                                               //todo: use AABB tree or other BVH acceleration structure!
+                                               if (collisionShape->isCompound())
+                                               {
+                                                       const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
+                                                       int i=0;
+                                                       for (i=0;i<compoundShape->getNumChildShapes();i++)
+                                                       {
+                                                               btTransform childTrans = compoundShape->getChildTransform(i);
+                                                               const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
+                                                               btTransform childWorldTrans = colObjWorldTransform * childTrans;
+                                                               objectQuerySingle(castShape, rayFromTrans,rayToTrans,
+                                                                       collisionObject,
+                                                                       childCollisionShape,
+                                                                       childWorldTrans,
+                                                                       resultCallback, collisionFilterMask);
+
+                                                       }
+
+
+                                               }
+                                       }
+                       }
+}
+
+void   btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback,short int collisionFilterMask)
+{
+
+       
+       btTransform     rayFromTrans,rayToTrans;
+       rayFromTrans.setIdentity();
+       rayFromTrans.setOrigin(rayFromWorld);
+       rayToTrans.setIdentity();
+       
+       rayToTrans.setOrigin(rayToWorld);
+
+       /// go over all objects, and if the ray intersects their aabb, do a ray-shape query using convexCaster (CCD)
+       
+       int i;
+       for (i=0;i<m_collisionObjects.size();i++)
+       {
+               btCollisionObject*      collisionObject= m_collisionObjects[i];
+               //only perform raycast if filterMask matches
+               if(collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & collisionFilterMask) { 
+                       //RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
+                       btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
+                       collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
+
+                       btScalar hitLambda = btScalar(1.); //could use resultCallback.m_closestHitFraction, but needs testing
+                       btVector3 hitNormal;
+                       if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
+                       {
+                               rayTestSingle(rayFromTrans,rayToTrans,
+                                       collisionObject,
+                                               collisionObject->getCollisionShape(),
+                                               collisionObject->getWorldTransform(),
+                                               resultCallback);
+                       }       
+               }
+       }
+
+}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
new file mode 100644 (file)
index 0000000..b6d8023
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+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.
+*/
+
+
+/**
+ * @mainpage Bullet Documentation
+ *
+ * @section intro_sec Introduction
+ * Bullet Collision Detection & Physics SDK
+ *
+ * Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
+ *
+ * There is the Physics Forum for Feedback and bteral Collision Detection and Physics discussions.
+ * Please visit http://www.continuousphysics.com/Bullet/phpBB2/index.php
+ *
+ * @section install_sec Installation
+ *
+ * @subsection step1 Step 1: Download
+ * You can download the Bullet Physics Library from our website: http://www.continuousphysics.com/Bullet/
+ * @subsection step2 Step 2: Building
+ * Bullet comes with autogenerated Project Files for Microsoft Visual Studio 6, 7, 7.1 and 8.
+ * The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (replace 8 with your version).
+ * 
+ * Under other platforms, like Linux or Mac OS-X, Bullet can be build using either using cmake, http://www.cmake.org, or jam, http://www.perforce.com/jam/jam.html . cmake can autogenerate Xcode, KDevelop, MSVC and other build systems. just run cmake . in the root of Bullet.
+ * Jam is a build system that can build the library, demos and also autogenerate the MSVC Project Files.
+ * So if you are not using MSVC, you can run configure and jam .
+ * If you don't have jam installed, you can make jam from the included jam-2.5 sources, or download jam from ftp://ftp.perforce.com/pub/jam/
+ * 
+ * @subsection step3 Step 3: Testing demos
+ * Try to run and experiment with CcdPhysicsDemo executable as a starting point.
+ * Bullet can be used in several ways, as Full Rigid Body simulation, as Collision Detector Library or Low Level / Snippets like the GJK Closest Point calculation.
+ * The Dependencies can be seen in this documentation under Directories
+ * 
+ * @subsection step4 Step 4: Integrating in your application, Full Rigid Body Simulation
+ * Check out CcdPhysicsDemo how to create a btDynamicsWorld, btRigidBody and btCollisionShape, Stepping the simulation and synchronizing your graphics object transform.
+ * PLEASE NOTE THE CcdPhysicsEnvironment and CcdPhysicsController is obsolete and will be removed. It has been replaced by classes derived frmo btDynamicsWorld and btRididBody
+ * @subsection step5 Step 5 : Integrate the Collision Detection Library (without Dynamics and other Extras)
+ * Bullet Collision Detection can also be used without the Dynamics/Extras.
+ * Check out btCollisionWorld and btCollisionObject, and the CollisionInterfaceDemo. Also in Extras/test_BulletOde.cpp there is a sample Collision Detection integration with Open Dynamics Engine, ODE, http://www.ode.org
+ * @subsection step6 Step 6 : Use Snippets like the GJK Closest Point calculation.
+ * Bullet has been designed in a modular way keeping dependencies to a minimum. The ConvexHullDistance demo demonstrates direct use of btGjkPairDetector.
+ *
+ * @section copyright Copyright
+ * Copyright (C) 2005-2007 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon
+ * Special thanks to all visitors of the Bullet Physics forum, and in particular above contributors, Dave Eberle, Dirk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky,
+ * Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul van Waveren, Marten Svanfeldt.
+ * 
+ */
+
+#ifndef COLLISION_WORLD_H
+#define COLLISION_WORLD_H
+
+class btStackAlloc;
+class btCollisionShape;
+class btConvexShape;
+class btBroadphaseInterface;
+#include "../../LinearMath/btVector3.h"
+#include "../../LinearMath/btTransform.h"
+#include "btCollisionObject.h"
+#include "btCollisionDispatcher.h" //for definition of btCollisionObjectArray
+#include "../BroadphaseCollision/btOverlappingPairCache.h"
+#include "../../LinearMath/btAlignedObjectArray.h"
+
+///CollisionWorld is interface and container for the collision detection
+class btCollisionWorld
+{
+
+       
+protected:
+
+       btAlignedObjectArray<btCollisionObject*>        m_collisionObjects;
+       
+       btDispatcher*   m_dispatcher1;
+
+       btDispatcherInfo        m_dispatchInfo;
+
+       btStackAlloc*   m_stackAlloc;
+
+       btOverlappingPairCache* m_broadphasePairCache;
+       
+       bool    m_ownsDispatcher;
+       bool    m_ownsBroadphasePairCache;
+
+public:
+
+       //this constructor doesn't own the dispatcher and paircache/broadphase
+       btCollisionWorld(btDispatcher* dispatcher,btOverlappingPairCache* pairCache, int stackSize = 2*1024*1024);
+
+       virtual ~btCollisionWorld();
+
+
+       btBroadphaseInterface*  getBroadphase()
+       {
+               return m_broadphasePairCache;
+       }
+
+       btOverlappingPairCache* getPairCache()
+       {
+               return m_broadphasePairCache;
+       }
+
+
+       btDispatcher*   getDispatcher()
+       {
+               return m_dispatcher1;
+       }
+
+       ///LocalShapeInfo gives extra information for complex shapes
+       ///Currently, only btTriangleMeshShape is available, so it just contains triangleIndex and subpart
+       struct  LocalShapeInfo
+       {
+               int     m_shapePart;
+               int     m_triangleIndex;
+               
+               //const btCollisionShape*       m_shapeTemp;
+               //const btTransform*    m_shapeLocalTransform;
+       };
+
+       struct  LocalRayResult
+       {
+               LocalRayResult(btCollisionObject*       collisionObject, 
+                       LocalShapeInfo* localShapeInfo,
+                       const btVector3&                hitNormalLocal,
+                       btScalar hitFraction)
+               :m_collisionObject(collisionObject),
+               m_localShapeInfo(localShapeInfo),
+               m_hitNormalLocal(hitNormalLocal),
+               m_hitFraction(hitFraction)
+               {
+               }
+
+               btCollisionObject*              m_collisionObject;
+               LocalShapeInfo*                 m_localShapeInfo;
+               btVector3                               m_hitNormalLocal;
+               btScalar                                m_hitFraction;
+
+       };
+
+       ///RayResultCallback is used to report new raycast results
+       struct  RayResultCallback
+       {
+               virtual ~RayResultCallback()
+               {
+               }
+               btScalar        m_closestHitFraction;
+               bool    HasHit()
+               {
+                       return (m_closestHitFraction < btScalar(1.));
+               }
+
+               RayResultCallback()
+                       :m_closestHitFraction(btScalar(1.))
+               {
+               }
+               virtual btScalar        AddSingleResult(LocalRayResult& rayResult) = 0;
+       };
+
+       struct  ClosestRayResultCallback : public RayResultCallback
+       {
+               ClosestRayResultCallback(const btVector3&       rayFromWorld,const btVector3&   rayToWorld)
+               :m_rayFromWorld(rayFromWorld),
+               m_rayToWorld(rayToWorld),
+               m_collisionObject(0)
+               {
+               }
+
+               btVector3       m_rayFromWorld;//used to calculate hitPointWorld from hitFraction
+               btVector3       m_rayToWorld;
+
+               btVector3       m_hitNormalWorld;
+               btVector3       m_hitPointWorld;
+               btCollisionObject*      m_collisionObject;
+               
+               virtual btScalar        AddSingleResult(LocalRayResult& rayResult)
+               {
+
+//caller already does the filter on the m_closestHitFraction
+                       assert(rayResult.m_hitFraction <= m_closestHitFraction);
+                       
+                       m_closestHitFraction = rayResult.m_hitFraction;
+                       m_collisionObject = rayResult.m_collisionObject;
+                       m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
+                       m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction);
+                       return rayResult.m_hitFraction;
+               }
+       };
+
+
+       
+
+       int     getNumCollisionObjects() const
+       {
+               return int(m_collisionObjects.size());
+       }
+
+       /// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
+       /// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
+       void    rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1);
+
+       /// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
+       /// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
+       /// This allows more customization.
+       static void     rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
+                                         btCollisionObject* collisionObject,
+                                         const btCollisionShape* collisionShape,
+                                         const btTransform& colObjWorldTransform,
+                                         RayResultCallback& resultCallback, short int collisionFilterMask=-1);
+
+       /// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.
+       static void     objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans,
+                                         btCollisionObject* collisionObject,
+                                         const btCollisionShape* collisionShape,
+                                         const btTransform& colObjWorldTransform,
+                                         RayResultCallback& resultCallback, short int collisionFilterMask=-1);
+
+       void    addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
+
+       btCollisionObjectArray& getCollisionObjectArray()
+       {
+               return m_collisionObjects;
+       }
+
+       const btCollisionObjectArray& getCollisionObjectArray() const
+       {
+               return m_collisionObjects;
+       }
+
+
+       void    removeCollisionObject(btCollisionObject* collisionObject);
+
+       virtual void    performDiscreteCollisionDetection();
+
+       btDispatcherInfo& getDispatchInfo()
+       {
+               return m_dispatchInfo;
+       }
+
+};
+
+
+#endif //COLLISION_WORLD_H
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
new file mode 100644 (file)
index 0000000..92f4c8b
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+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 "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
+#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
+#include "BulletCollision/CollisionShapes/btCompoundShape.h"
+
+
+btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
+:m_isSwapped(isSwapped)
+{
+       btCollisionObject* colObj = m_isSwapped? body1 : body0;
+       btCollisionObject* otherObj = m_isSwapped? body0 : body1;
+       assert (colObj->getCollisionShape()->isCompound());
+       
+       btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
+       int numChildren = compoundShape->getNumChildShapes();
+       int i;
+       
+       m_childCollisionAlgorithms.resize(numChildren);
+       for (i=0;i<numChildren;i++)
+       {
+               btCollisionShape* childShape = compoundShape->getChildShape(i);
+               btCollisionShape* orgShape = colObj->getCollisionShape();
+               colObj->setCollisionShape( childShape );
+               m_childCollisionAlgorithms[i] = ci.m_dispatcher->findAlgorithm(colObj,otherObj);
+               colObj->setCollisionShape( orgShape );
+       }
+}
+
+
+btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
+{
+       int numChildren = m_childCollisionAlgorithms.size();
+       int i;
+       for (i=0;i<numChildren;i++)
+       {
+               delete m_childCollisionAlgorithms[i];
+       }
+}
+
+void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+       btCollisionObject* colObj = m_isSwapped? body1 : body0;
+       btCollisionObject* otherObj = m_isSwapped? body0 : body1;
+
+       assert (colObj->getCollisionShape()->isCompound());
+       btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
+
+       //We will use the OptimizedBVH, AABB tree to cull potential child-overlaps
+       //If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals
+       //given Proxy0 and Proxy1, if both have a tree, Tree0 and Tree1, this means:
+       //determine overlapping nodes of Proxy1 using Proxy0 AABB against Tree1
+       //then use each overlapping node AABB against Tree0
+       //and vise versa.
+
+       int numChildren = m_childCollisionAlgorithms.size();
+       int i;
+       for (i=0;i<numChildren;i++)
+       {
+               //temporarily exchange parent btCollisionShape with childShape, and recurse
+               btCollisionShape* childShape = compoundShape->getChildShape(i);
+
+               //backup
+               btTransform     orgTrans = colObj->getWorldTransform();
+               btCollisionShape* orgShape = colObj->getCollisionShape();
+
+               const btTransform& childTrans = compoundShape->getChildTransform(i);
+               //btTransform   newChildWorldTrans = orgTrans*childTrans ;
+               colObj->setWorldTransform( orgTrans*childTrans );
+               //the contactpoint is still projected back using the original inverted worldtrans
+               colObj->setCollisionShape( childShape );
+               m_childCollisionAlgorithms[i]->processCollision(colObj,otherObj,dispatchInfo,resultOut);
+               //revert back
+               colObj->setCollisionShape( orgShape);
+               colObj->setWorldTransform(  orgTrans );
+       }
+}
+
+btScalar       btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+
+       btCollisionObject* colObj = m_isSwapped? body1 : body0;
+       btCollisionObject* otherObj = m_isSwapped? body0 : body1;
+
+       assert (colObj->getCollisionShape()->isCompound());
+       
+       btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
+
+       //We will use the OptimizedBVH, AABB tree to cull potential child-overlaps
+       //If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals
+       //given Proxy0 and Proxy1, if both have a tree, Tree0 and Tree1, this means:
+       //determine overlapping nodes of Proxy1 using Proxy0 AABB against Tree1
+       //then use each overlapping node AABB against Tree0
+       //and vise versa.
+
+       btScalar hitFraction = btScalar(1.);
+
+       int numChildren = m_childCollisionAlgorithms.size();
+       int i;
+       for (i=0;i<numChildren;i++)
+       {
+               //temporarily exchange parent btCollisionShape with childShape, and recurse
+               btCollisionShape* childShape = compoundShape->getChildShape(i);
+
+               //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 );
+               btScalar frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);
+               if (frac<hitFraction)
+               {
+                       hitFraction = frac;
+               }
+               //revert back
+               colObj->setCollisionShape( orgShape);
+               colObj->setWorldTransform( orgTrans);
+       }
+       return hitFraction;
+
+}
+
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h
new file mode 100644 (file)
index 0000000..7091b23
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+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 COMPOUND_COLLISION_ALGORITHM_H
+#define COMPOUND_COLLISION_ALGORITHM_H
+
+#include "../BroadphaseCollision/btCollisionAlgorithm.h"
+#include "../BroadphaseCollision/btDispatcher.h"
+#include "../BroadphaseCollision/btBroadphaseInterface.h"
+
+#include "../NarrowPhaseCollision/btPersistentManifold.h"
+class btDispatcher;
+#include "../BroadphaseCollision/btBroadphaseProxy.h"
+#include "btCollisionCreateFunc.h"
+#include "../../LinearMath/btAlignedObjectArray.h"
+
+/// btCompoundCollisionAlgorithm  supports collision between CompoundCollisionShapes and other collision shapes
+/// Place holder, not fully implemented yet
+class btCompoundCollisionAlgorithm  : public btCollisionAlgorithm
+{
+       btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorithms;
+       bool m_isSwapped;
+       
+public:
+
+       btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
+
+       virtual ~btCompoundCollisionAlgorithm();
+
+       virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       btScalar        calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       struct CreateFunc :public       btCollisionAlgorithmCreateFunc
+       {
+               virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
+               {
+                       return new btCompoundCollisionAlgorithm(ci,body0,body1,false);
+               }
+       };
+
+       struct SwappedCreateFunc :public        btCollisionAlgorithmCreateFunc
+       {
+               virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
+               {
+                       return new btCompoundCollisionAlgorithm(ci,body0,body1,true);
+               }
+       };
+
+};
+
+#endif //COMPOUND_COLLISION_ALGORITHM_H
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
new file mode 100644 (file)
index 0000000..24ceacf
--- /dev/null
@@ -0,0 +1,312 @@
+/*
+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 "btConvexConcaveCollisionAlgorithm.h"
+#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
+#include "BulletCollision/CollisionShapes/btMultiSphereShape.h"
+#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
+#include "BulletCollision/CollisionShapes/btConcaveShape.h"
+#include "BulletCollision/CollisionDispatch/btManifoldResult.h"
+#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
+#include "BulletCollision/CollisionShapes/btTriangleShape.h"
+#include "BulletCollision/CollisionShapes/btSphereShape.h"
+#include "LinearMath/btIDebugDraw.h"
+#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
+
+btConvexConcaveCollisionAlgorithm::btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
+: btCollisionAlgorithm(ci),
+m_isSwapped(isSwapped),
+m_btConvexTriangleCallback(ci.m_dispatcher,body0,body1,isSwapped)
+{
+}
+
+btConvexConcaveCollisionAlgorithm::~btConvexConcaveCollisionAlgorithm()
+{
+}
+
+
+
+btConvexTriangleCallback::btConvexTriangleCallback(btDispatcher*  dispatcher,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped):
+         m_dispatcher(dispatcher),
+       m_dispatchInfoPtr(0)
+{
+       m_convexBody = isSwapped? body1:body0;
+       m_triBody = isSwapped? body0:body1;
+       
+         //
+         // create the manifold from the dispatcher 'manifold pool'
+         //
+         m_manifoldPtr = m_dispatcher->getNewManifold(m_convexBody,m_triBody);
+
+         clearCache();
+}
+
+btConvexTriangleCallback::~btConvexTriangleCallback()
+{
+       clearCache();
+       m_dispatcher->releaseManifold( m_manifoldPtr );
+  
+}
+  
+
+void   btConvexTriangleCallback::clearCache()
+{
+       m_dispatcher->clearManifold(m_manifoldPtr);
+};
+
+
+
+void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, int triangleIndex)
+{
+       //just for debugging purposes
+       //printf("triangle %d",m_triangleCount++);
+
+
+       //aabb filter is already applied!       
+
+       btCollisionAlgorithmConstructionInfo ci;
+       ci.m_dispatcher = m_dispatcher;
+
+       btCollisionObject* ob = static_cast<btCollisionObject*>(m_triBody);
+
+
+       
+       ///debug drawing of the overlapping triangles
+       if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->getDebugMode() > 0)
+       {
+               btVector3 color(255,255,0);
+               btTransform& tr = ob->getWorldTransform();
+               m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(triangle[1]),color);
+               m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(triangle[2]),color);
+               m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(triangle[0]),color);
+
+               //btVector3 center = triangle[0] + triangle[1]+triangle[2];
+               //center *= btScalar(0.333333);
+               //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(center),color);
+               //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(center),color);
+               //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(center),color);
+
+       }
+
+
+       //btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
+       
+       if (m_convexBody->getCollisionShape()->isConvex())
+       {
+               btTriangleShape tm(triangle[0],triangle[1],triangle[2]);        
+               tm.setMargin(m_collisionMarginTriangle);
+       
+               
+               btCollisionShape* tmpShape = ob->getCollisionShape();
+               ob->setCollisionShape( &tm );
+               
+
+               btCollisionAlgorithm* colAlgo = ci.m_dispatcher->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
+               ///this should use the btDispatcher, so the actual registered algorithm is used
+               //              btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexBody,m_triBody);
+
+               m_resultOut->setShapeIdentifiers(-1,-1,partId,triangleIndex);
+       //      cvxcvxalgo.setShapeIdentifiers(-1,-1,partId,triangleIndex);
+//             cvxcvxalgo.processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
+               colAlgo->processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
+               delete colAlgo;
+               ob->setCollisionShape( tmpShape );
+
+       }
+
+       
+
+}
+
+
+
+void   btConvexTriangleCallback::setTimeStepAndCounters(btScalar collisionMarginTriangle,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+       m_dispatchInfoPtr = &dispatchInfo;
+       m_collisionMarginTriangle = collisionMarginTriangle;
+       m_resultOut = resultOut;
+
+       //recalc aabbs
+       btTransform convexInTriangleSpace;
+       convexInTriangleSpace = m_triBody->getWorldTransform().inverse() * m_convexBody->getWorldTransform();
+       btCollisionShape* convexShape = static_cast<btCollisionShape*>(m_convexBody->getCollisionShape());
+       //CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
+       convexShape->getAabb(convexInTriangleSpace,m_aabbMin,m_aabbMax);
+       btScalar extraMargin = collisionMarginTriangle;
+       btVector3 extra(extraMargin,extraMargin,extraMargin);
+
+       m_aabbMax += extra;
+       m_aabbMin -= extra;
+       
+}
+
+void btConvexConcaveCollisionAlgorithm::clearCache()
+{
+       m_btConvexTriangleCallback.clearCache();
+
+}
+
+void btConvexConcaveCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+       
+       
+       btCollisionObject* convexBody = m_isSwapped ? body1 : body0;
+       btCollisionObject* triBody = m_isSwapped ? body0 : body1;
+
+       if (triBody->getCollisionShape()->isConcave())
+       {
+
+
+               btCollisionObject*      triOb = triBody;
+               btConcaveShape* concaveShape = static_cast<btConcaveShape*>( triOb->getCollisionShape());
+               
+               if (convexBody->getCollisionShape()->isConvex())
+               {
+                       btScalar collisionMarginTriangle = concaveShape->getMargin();
+                                       
+                       resultOut->setPersistentManifold(m_btConvexTriangleCallback.m_manifoldPtr);
+                       m_btConvexTriangleCallback.setTimeStepAndCounters(collisionMarginTriangle,dispatchInfo,resultOut);
+
+                       //Disable persistency. previously, some older algorithm calculated all contacts in one go, so you can clear it here.
+                       //m_dispatcher->clearManifold(m_btConvexTriangleCallback.m_manifoldPtr);
+
+                       m_btConvexTriangleCallback.m_manifoldPtr->setBodies(convexBody,triBody);
+
+                       concaveShape->processAllTriangles( &m_btConvexTriangleCallback,m_btConvexTriangleCallback.getAabbMin(),m_btConvexTriangleCallback.getAabbMax());
+                       
+       
+               }
+
+       }
+
+}
+
+
+btScalar btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+       (void)resultOut;
+       (void)dispatchInfo;
+       btCollisionObject* convexbody = m_isSwapped ? body1 : body0;
+       btCollisionObject* triBody = m_isSwapped ? body0 : body1;
+
+
+       //quick approximation using raycast, todo: hook up to the continuous collision detection (one of the btConvexCast)
+
+       //only perform CCD above a certain threshold, this prevents blocking on the long run
+       //because object in a blocked ccd state (hitfraction<1) get their linear velocity halved each frame...
+       btScalar squareMot0 = (convexbody->getInterpolationWorldTransform().getOrigin() - convexbody->getWorldTransform().getOrigin()).length2();
+       if (squareMot0 < convexbody->getCcdSquareMotionThreshold())
+       {
+               return btScalar(1.);
+       }
+
+       //const btVector3& from = convexbody->m_worldTransform.getOrigin();
+       //btVector3 to = convexbody->m_interpolationWorldTransform.getOrigin();
+       //todo: only do if the motion exceeds the 'radius'
+
+       btTransform triInv = triBody->getWorldTransform().inverse();
+       btTransform convexFromLocal = triInv * convexbody->getWorldTransform();
+       btTransform convexToLocal = triInv * convexbody->getInterpolationWorldTransform();
+
+       struct LocalTriangleSphereCastCallback  : public btTriangleCallback
+       {
+               btTransform m_ccdSphereFromTrans;
+               btTransform m_ccdSphereToTrans;
+               btTransform     m_meshTransform;
+
+               btScalar        m_ccdSphereRadius;
+               btScalar        m_hitFraction;
+       
+
+               LocalTriangleSphereCastCallback(const btTransform& from,const btTransform& to,btScalar ccdSphereRadius,btScalar hitFraction)
+                       :m_ccdSphereFromTrans(from),
+                       m_ccdSphereToTrans(to),
+                       m_ccdSphereRadius(ccdSphereRadius),
+                       m_hitFraction(hitFraction)
+               {                       
+               }
+               
+               
+               virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex)
+               {
+                       (void)partId;
+                       (void)triangleIndex;
+                       //do a swept sphere for now
+                       btTransform ident;
+                       ident.setIdentity();
+                       btConvexCast::CastResult castResult;
+                       castResult.m_fraction = m_hitFraction;
+                       btSphereShape   pointShape(m_ccdSphereRadius);
+                       btTriangleShape triShape(triangle[0],triangle[1],triangle[2]);
+                       btVoronoiSimplexSolver  simplexSolver;
+                       btSubsimplexConvexCast convexCaster(&pointShape,&triShape,&simplexSolver);
+                       //GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver);
+                       //ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0);
+                       //local space?
+
+                       if (convexCaster.calcTimeOfImpact(m_ccdSphereFromTrans,m_ccdSphereToTrans,
+                               ident,ident,castResult))
+                       {
+                               if (m_hitFraction > castResult.m_fraction)
+                                       m_hitFraction = castResult.m_fraction;
+                       }
+
+               }
+
+       };
+
+
+       
+
+       
+       if (triBody->getCollisionShape()->isConcave())
+       {
+               btVector3 rayAabbMin = convexFromLocal.getOrigin();
+               rayAabbMin.setMin(convexToLocal.getOrigin());
+               btVector3 rayAabbMax = convexFromLocal.getOrigin();
+               rayAabbMax.setMax(convexToLocal.getOrigin());
+               btScalar ccdRadius0 = convexbody->getCcdSweptSphereRadius();
+               rayAabbMin -= btVector3(ccdRadius0,ccdRadius0,ccdRadius0);
+               rayAabbMax += btVector3(ccdRadius0,ccdRadius0,ccdRadius0);
+
+               btScalar curHitFraction = btScalar(1.); //is this available?
+               LocalTriangleSphereCastCallback raycastCallback(convexFromLocal,convexToLocal,
+                       convexbody->getCcdSweptSphereRadius(),curHitFraction);
+
+               raycastCallback.m_hitFraction = convexbody->getHitFraction();
+
+               btCollisionObject* concavebody = triBody;
+
+               btConcaveShape* triangleMesh = (btConcaveShape*) concavebody->getCollisionShape();
+               
+               if (triangleMesh)
+               {
+                       triangleMesh->processAllTriangles(&raycastCallback,rayAabbMin,rayAabbMax);
+               }
+       
+
+
+               if (raycastCallback.m_hitFraction < convexbody->getHitFraction())
+               {
+                       convexbody->setHitFraction( raycastCallback.m_hitFraction);
+                       return raycastCallback.m_hitFraction;
+               }
+       }
+
+       return btScalar(1.);
+
+}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
new file mode 100644 (file)
index 0000000..4915b6c
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+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 CONVEX_CONCAVE_COLLISION_ALGORITHM_H
+#define CONVEX_CONCAVE_COLLISION_ALGORITHM_H
+
+#include "../BroadphaseCollision/btCollisionAlgorithm.h"
+#include "../BroadphaseCollision/btDispatcher.h"
+#include "../BroadphaseCollision/btBroadphaseInterface.h"
+#include "../CollisionShapes/btTriangleCallback.h"
+#include "../NarrowPhaseCollision/btPersistentManifold.h"
+class btDispatcher;
+#include "../BroadphaseCollision/btBroadphaseProxy.h"
+#include "btCollisionCreateFunc.h"
+
+///For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), processTriangle is called.
+class btConvexTriangleCallback : public btTriangleCallback
+{
+       btCollisionObject* m_convexBody;
+       btCollisionObject* m_triBody;
+
+       btVector3       m_aabbMin;
+       btVector3       m_aabbMax ;
+
+       btManifoldResult* m_resultOut;
+
+       btDispatcher*   m_dispatcher;
+       const btDispatcherInfo* m_dispatchInfoPtr;
+       btScalar m_collisionMarginTriangle;
+       
+public:
+int    m_triangleCount;
+       
+       btPersistentManifold*   m_manifoldPtr;
+
+       btConvexTriangleCallback(btDispatcher* dispatcher,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
+
+       void    setTimeStepAndCounters(btScalar collisionMarginTriangle,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       virtual ~btConvexTriangleCallback();
+
+       virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
+       
+       void clearCache();
+
+       inline const btVector3& getAabbMin() const
+       {
+               return m_aabbMin;
+       }
+       inline const btVector3& getAabbMax() const
+       {
+               return m_aabbMax;
+       }
+
+};
+
+
+
+
+/// btConvexConcaveCollisionAlgorithm  supports collision between convex shapes and (concave) trianges meshes.
+class btConvexConcaveCollisionAlgorithm  : public btCollisionAlgorithm
+{
+
+       bool    m_isSwapped;
+
+       btConvexTriangleCallback m_btConvexTriangleCallback;
+
+
+public:
+
+       btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
+
+       virtual ~btConvexConcaveCollisionAlgorithm();
+
+       virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       btScalar        calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       void    clearCache();
+
+       struct CreateFunc :public       btCollisionAlgorithmCreateFunc
+       {
+               virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
+               {
+                       return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,false);
+               }
+       };
+
+       struct SwappedCreateFunc :public        btCollisionAlgorithmCreateFunc
+       {
+               virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
+               {
+                       return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,true);
+               }
+       };
+
+};
+
+#endif //CONVEX_CONCAVE_COLLISION_ALGORITHM_H
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
new file mode 100644 (file)
index 0000000..9105fe2
--- /dev/null
@@ -0,0 +1,254 @@
+/*
+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 "btConvexConvexAlgorithm.h"
+
+#include <stdio.h>
+#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
+#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
+#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
+#include "BulletCollision/CollisionShapes/btConvexShape.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
+#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
+#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
+#include "BulletCollision/CollisionShapes/btBoxShape.h"
+#include "BulletCollision/CollisionDispatch/btManifoldResult.h"
+
+#include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h"
+#include "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h"
+#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h"
+
+
+
+#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
+#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
+#include "BulletCollision/CollisionShapes/btSphereShape.h"
+
+#include "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h"
+
+#include "BulletCollision/NarrowPhaseCollision/btGjkEpa.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
+
+
+
+
+
+
+
+btConvexConvexAlgorithm::CreateFunc::CreateFunc()
+{
+       m_ownsSolvers = true;
+       m_simplexSolver = new btVoronoiSimplexSolver();
+       m_pdSolver = new btGjkEpaPenetrationDepthSolver;
+}
+
+btConvexConvexAlgorithm::CreateFunc::CreateFunc(btSimplexSolverInterface*                      simplexSolver, btConvexPenetrationDepthSolver* pdSolver)
+{
+       m_ownsSolvers = false;
+       m_simplexSolver = simplexSolver;
+       m_pdSolver = pdSolver;
+}
+
+btConvexConvexAlgorithm::CreateFunc::~CreateFunc() 
+{ 
+   if (m_ownsSolvers){ 
+      delete m_simplexSolver; 
+      delete m_pdSolver; 
+   } 
+}
+
+btConvexConvexAlgorithm::btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver)
+: btCollisionAlgorithm(ci),
+m_gjkPairDetector(0,0,simplexSolver,pdSolver),
+m_ownManifold (false),
+m_manifoldPtr(mf),
+m_lowLevelOfDetail(false)
+{
+       (void)body0;
+       (void)body1;
+
+
+}
+
+
+
+
+btConvexConvexAlgorithm::~btConvexConvexAlgorithm()
+{
+       if (m_ownManifold)
+       {
+               if (m_manifoldPtr)
+                       m_dispatcher->releaseManifold(m_manifoldPtr);
+       }
+}
+
+void   btConvexConvexAlgorithm ::setLowLevelOfDetail(bool useLowLevel)
+{
+       m_lowLevelOfDetail = useLowLevel;
+}
+
+
+
+
+
+//
+// Convex-Convex collision algorithm
+//
+void btConvexConvexAlgorithm ::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+
+       if (!m_manifoldPtr)
+       {
+               //swapped?
+               m_manifoldPtr = m_dispatcher->getNewManifold(body0,body1);
+               m_ownManifold = true;
+       }
+       resultOut->setPersistentManifold(m_manifoldPtr);
+
+#ifdef USE_BT_GJKEPA
+       btConvexShape*                          shape0(static_cast<btConvexShape*>(body0->getCollisionShape()));
+       btConvexShape*                          shape1(static_cast<btConvexShape*>(body1->getCollisionShape()));
+       const btScalar                          radialmargin(0/*shape0->getMargin()+shape1->getMargin()*/);
+       btGjkEpaSolver::sResults        results;
+       if(btGjkEpaSolver::Collide(     shape0,body0->getWorldTransform(),
+                                                               shape1,body1->getWorldTransform(),
+                                                               radialmargin,results))
+               {
+               dispatchInfo.m_debugDraw->drawLine(results.witnesses[1],results.witnesses[1]+results.normal,btVector3(255,0,0));
+               resultOut->addContactPoint(results.normal,results.witnesses[1],-results.depth);
+               }
+#else
+
+       btConvexShape* min0 = static_cast<btConvexShape*>(body0->getCollisionShape());
+       btConvexShape* min1 = static_cast<btConvexShape*>(body1->getCollisionShape());
+       
+       btGjkPairDetector::ClosestPointInput input;
+
+       //TODO: if (dispatchInfo.m_useContinuous)
+       m_gjkPairDetector.setMinkowskiA(min0);
+       m_gjkPairDetector.setMinkowskiB(min1);
+       input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
+       input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
+       input.m_stackAlloc = dispatchInfo.m_stackAllocator;
+
+//     input.m_maximumDistanceSquared = btScalar(1e30);
+       
+       input.m_transformA = body0->getWorldTransform();
+       input.m_transformB = body1->getWorldTransform();
+       
+       m_gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
+#endif
+
+}
+
+
+
+bool disableCcd = false;
+btScalar       btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btCollisionObject* col1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+{
+       (void)resultOut;
+       (void)dispatchInfo;
+       ///Rather then checking ALL pairs, only calculate TOI when motion exceeds threshold
+    
+       ///Linear motion for one of objects needs to exceed m_ccdSquareMotionThreshold
+       ///col0->m_worldTransform,
+       btScalar resultFraction = btScalar(1.);
+
+
+       btScalar squareMot0 = (col0->getInterpolationWorldTransform().getOrigin() - col0->getWorldTransform().getOrigin()).length2();
+       btScalar squareMot1 = (col1->getInterpolationWorldTransform().getOrigin() - col1->getWorldTransform().getOrigin()).length2();
+    
+       if (squareMot0 < col0->getCcdSquareMotionThreshold() &&
+               squareMot1 < col1->getCcdSquareMotionThreshold())
+               return resultFraction;
+
+       if (disableCcd)
+               return btScalar(1.);
+
+
+       //An adhoc way of testing the Continuous Collision Detection algorithms
+       //One object is approximated as a sphere, to simplify things
+       //Starting in penetration should report no time of impact
+       //For proper CCD, better accuracy and handling of 'allowed' penetration should be added
+       //also the mainloop of the physics should have a kind of toi queue (something like Brian Mirtich's application of Timewarp for Rigidbodies)
+
+               
+       /// Convex0 against sphere for Convex1
+       {
+               btConvexShape* convex0 = static_cast<btConvexShape*>(col0->getCollisionShape());
+
+               btSphereShape   sphere1(col1->getCcdSweptSphereRadius()); //todo: allow non-zero sphere sizes, for better approximation
+               btConvexCast::CastResult result;
+               btVoronoiSimplexSolver voronoiSimplex;
+               //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
+               ///Simplification, one object is simplified as a sphere
+               btGjkConvexCast ccd1( convex0 ,&sphere1,&voronoiSimplex);
+               //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0);
+               if (ccd1.calcTimeOfImpact(col0->getWorldTransform(),col0->getInterpolationWorldTransform(),
+                       col1->getWorldTransform(),col1->getInterpolationWorldTransform(),result))
+               {
+               
+                       //store result.m_fraction in both bodies
+               
+                       if (col0->getHitFraction()> result.m_fraction)
+                               col0->setHitFraction( result.m_fraction );
+
+                       if (col1->getHitFraction() > result.m_fraction)
+                               col1->setHitFraction( result.m_fraction);
+
+                       if (resultFraction > result.m_fraction)
+                               resultFraction = result.m_fraction;
+
+               }
+               
+               
+
+
+       }
+
+       /// Sphere (for convex0) against Convex1
+       {
+               btConvexShape* convex1 = static_cast<btConvexShape*>(col1->getCollisionShape());
+
+               btSphereShape   sphere0(col0->getCcdSweptSphereRadius()); //todo: allow non-zero sphere sizes, for better approximation
+               btConvexCast::CastResult result;
+               btVoronoiSimplexSolver voronoiSimplex;
+               //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
+               ///Simplification, one object is simplified as a sphere
+               btGjkConvexCast ccd1(&sphere0,convex1,&voronoiSimplex);
+               //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0);
+               if (ccd1.calcTimeOfImpact(col0->getWorldTransform(),col0->getInterpolationWorldTransform(),
+                       col1->getWorldTransform(),col1->getInterpolationWorldTransform(),result))
+               {
+               
+                       //store result.m_fraction in both bodies
+               
+                       if (col0->getHitFraction()      > result.m_fraction)
+                               col0->setHitFraction( result.m_fraction);
+
+                       if (col1->getHitFraction() > result.m_fraction)
+                               col1->setHitFraction( result.m_fraction);
+
+                       if (resultFraction > result.m_fraction)
+                               resultFraction = result.m_fraction;
+
+               }
+       }
+       
+       return resultFraction;
+
+}
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
new file mode 100644 (file)
index 0000000..cbea9a9
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+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 CONVEX_CONVEX_ALGORITHM_H
+#define CONVEX_CONVEX_ALGORITHM_H
+
+#include "../BroadphaseCollision/btCollisionAlgorithm.h"
+#include "../NarrowPhaseCollision/btGjkPairDetector.h"
+#include "../NarrowPhaseCollision/btPersistentManifold.h"
+#include "../BroadphaseCollision/btBroadphaseProxy.h"
+#include "../NarrowPhaseCollision/btVoronoiSimplexSolver.h"
+#include "btCollisionCreateFunc.h"
+
+class btConvexPenetrationDepthSolver;
+
+///ConvexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations.
+class btConvexConvexAlgorithm : public btCollisionAlgorithm
+{
+       btGjkPairDetector m_gjkPairDetector;
+public:
+
+       bool    m_ownManifold;
+       btPersistentManifold*   m_manifoldPtr;
+       bool                    m_lowLevelOfDetail;
+       
+
+public:
+
+       btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
+
+       virtual ~btConvexConvexAlgorithm();
+
+       virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+
+       void    setLowLevelOfDetail(bool useLowLevel);
+
+
+       const btPersistentManifold*     getManifold()
+       {
+               return m_manifoldPtr;
+       }
+
+       struct CreateFunc :public       btCollisionAlgorithmCreateFunc
+       {
+               btConvexPenetrationDepthSolver*         m_pdSolver;
+               btSimplexSolverInterface*                       m_simplexSolver;
+               bool    m_ownsSolvers;
+               
+               CreateFunc(btSimplexSolverInterface*                    simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
+               CreateFunc();
+               virtual ~CreateFunc();
+
+               virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
+               {
+                       return new btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver);
+               }
+       };
+
+
+};
+
+#endif //CONVEX_CONVEX_ALGORITHM_H
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp
new file mode 100644 (file)
index 0000000..9360543
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+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 "btEmptyCollisionAlgorithm.h"
+
+
+
+btEmptyAlgorithm::btEmptyAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
+       : btCollisionAlgorithm(ci)
+{
+}
+
+void btEmptyAlgorithm::processCollision (btCollisionObject* ,btCollisionObject* ,const btDispatcherInfo& ,btManifoldResult* )
+{
+}
+
+btScalar btEmptyAlgorithm::calculateTimeOfImpact(btCollisionObject* ,btCollisionObject* ,const btDispatcherInfo& ,btManifoldResult* )
+{
+       return btScalar(1.);
+}
+
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h
new file mode 100644 (file)
index 0000000..b1a193d
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+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 EMPTY_ALGORITH
+#define EMPTY_ALGORITH
+#include "../BroadphaseCollision/btCollisionAlgorithm.h"
+#include "btCollisionCreateFunc.h"
+
+#define ATTRIBUTE_ALIGNED(a)
+
+///EmptyAlgorithm is a stub for unsupported collision pairs.
+///The dispatcher can dispatch a persistent btEmptyAlgorithm to avoid a search every frame.
+class btEmptyAlgorithm : public btCollisionAlgorithm
+{
+
+public:
+       
+       btEmptyAlgorithm(const btCollisionAlgorithmConstructionInfo& 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);
+
+       struct CreateFunc :public       btCollisionAlgorithmCreateFunc
+       {
+               virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
+               {
+                       (void)body0;
+                       (void)body1;
+                       return new btEmptyAlgorithm(ci);
+               }
+       };
+
+} ATTRIBUTE_ALIGNED(16);
+
+#endif //EMPTY_ALGORITH
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp
new file mode 100644 (file)
index 0000000..490acc0
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+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 "btManifoldResult.h"
+#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
+#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
+
+
+///This is to allow MaterialCombiner/Custom Friction/Restitution values
+ContactAddedCallback           gContactAddedCallback=0;
+
+///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= btCollisionObject::customMaterialCallback;
+inline btScalar        calculateCombinedFriction(const btCollisionObject* body0,const btCollisionObject* body1)
+{
+       btScalar friction = body0->getFriction() * body1->getFriction();
+
+       const btScalar MAX_FRICTION  = btScalar(10.);
+       if (friction < -MAX_FRICTION)
+               friction = -MAX_FRICTION;
+       if (friction > MAX_FRICTION)
+               friction = MAX_FRICTION;
+       return friction;
+
+}
+
+inline btScalar        calculateCombinedRestitution(const btCollisionObject* body0,const btCollisionObject* body1)
+{
+       return body0->getRestitution() * body1->getRestitution();
+}
+
+
+
+btManifoldResult::btManifoldResult(btCollisionObject* body0,btCollisionObject* body1)
+               :m_manifoldPtr(0),
+               m_body0(body0),
+               m_body1(body1)
+{
+       m_rootTransA = body0->getWorldTransform();
+       m_rootTransB = body1->getWorldTransform();
+}
+
+
+void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
+{
+       assert(m_manifoldPtr);
+       //order in manifold needs to match
+       
+       if (depth > m_manifoldPtr->getContactBreakingThreshold())
+               return;
+
+       bool isSwapped = m_manifoldPtr->getBody0() != m_body0;
+
+       btVector3 pointA = pointInWorld + normalOnBInWorld * depth;
+
+       btVector3 localA;
+       btVector3 localB;
+       
+       if (isSwapped)
+       {
+               localA = m_rootTransB.invXform(pointA );
+               localB = m_rootTransA.invXform(pointInWorld);
+       } else
+       {
+               localA = m_rootTransA.invXform(pointA );
+               localB = m_rootTransB.invXform(pointInWorld);
+       }
+
+       btManifoldPoint newPt(localA,localB,normalOnBInWorld,depth);
+
+       int insertIndex = m_manifoldPtr->getCacheEntry(newPt);
+
+       newPt.m_combinedFriction = calculateCombinedFriction(m_body0,m_body1);
+       newPt.m_combinedRestitution = calculateCombinedRestitution(m_body0,m_body1);
+
+       //User can override friction and/or restitution
+       if (gContactAddedCallback &&
+               //and if either of the two bodies requires custom material
+                ((m_body0->getCollisionFlags() & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK) ||
+                  (m_body1->getCollisionFlags() & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK)))
+       {
+               //experimental feature info, for per-triangle material etc.
+               btCollisionObject* obj0 = isSwapped? m_body1 : m_body0;
+               btCollisionObject* obj1 = isSwapped? m_body0 : m_body1;
+               (*gContactAddedCallback)(newPt,obj0,m_partId0,m_index0,obj1,m_partId1,m_index1);
+       }
+
+       if (insertIndex >= 0)
+       {
+               //const btManifoldPoint& oldPoint = m_manifoldPtr->getContactPoint(insertIndex);
+               m_manifoldPtr->replaceContactPoint(newPt,insertIndex);
+       } else
+       {
+               m_manifoldPtr->AddManifoldPoint(newPt);
+       }
+}
+
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h
new file mode 100644 (file)
index 0000000..7719262
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+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 MANIFOLD_RESULT_H
+#define MANIFOLD_RESULT_H
+
+class btCollisionObject;
+class btPersistentManifold;
+class btManifoldPoint;
+
+#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
+
+#include "../../LinearMath/btTransform.h"
+
+typedef bool (*ContactAddedCallback)(btManifoldPoint& cp,      const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1);
+extern ContactAddedCallback            gContactAddedCallback;
+
+
+
+///btManifoldResult is a helper class to manage  contact results.
+class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result
+{
+       btPersistentManifold* m_manifoldPtr;
+
+       //we need this for compounds
+       btTransform     m_rootTransA;
+       btTransform     m_rootTransB;
+
+       btCollisionObject* m_body0;
+       btCollisionObject* m_body1;
+       int     m_partId0;
+       int m_partId1;
+       int m_index0;
+       int m_index1;
+public:
+
+       btManifoldResult()
+       {
+       }
+
+       btManifoldResult(btCollisionObject* body0,btCollisionObject* body1);
+
+       virtual ~btManifoldResult() {};
+