Added Bullet library.
authorErwin Coumans <blender@erwincoumans.com>
Sat, 16 Jul 2005 09:58:01 +0000 (09:58 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Sat, 16 Jul 2005 09:58:01 +0000 (09:58 +0000)
Only windows projectfiles for now.
Will ask Hans to get unix makefiles done.

156 files changed:
extern/bullet/Bullet/BroadphaseCollision/BroadphaseInterface.h [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.cpp [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.h [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.h [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/CollisionDispatcher.cpp [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/CollisionDispatcher.h [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.cpp [new file with mode: 0644]
extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.h [new file with mode: 0644]
extern/bullet/Bullet/Bullet3.dsp [new file with mode: 0644]
extern/bullet/Bullet/Bullet3_vc7.vcproj [new file with mode: 0644]
extern/bullet/Bullet/Bullet3_vc8.sln [new file with mode: 0644]
extern/bullet/Bullet/Bullet3_vc8.vcproj [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/BoxShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/BoxShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/CollisionShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/CollisionShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/ConeShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/ConeShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/ConvexHullShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/ConvexHullShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/ConvexShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/ConvexShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/CylinderShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/CylinderShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/MultiSphereShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/MultiSphereShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/SphereShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/SphereShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/TriangleCallback.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/TriangleMesh.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/TriangleMesh.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.cpp [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.h [new file with mode: 0644]
extern/bullet/Bullet/CollisionShapes/TriangleShape.h [new file with mode: 0644]
extern/bullet/Bullet/Doxyfile [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_MotionStateInterface.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_PolynomialSolverInterface.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_StaticMotionState.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/CollisionMargin.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/ConvexPenetrationDepthSolver.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/ManifoldPoint.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/PointCollector.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/SimplexSolverInterface.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.h [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.cpp [new file with mode: 0644]
extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.h [new file with mode: 0644]
extern/bullet/BulletDynamics/BulletDynamics.dsp [new file with mode: 0644]
extern/bullet/BulletDynamics/BulletDynamics_vc7.vcproj [new file with mode: 0644]
extern/bullet/BulletDynamics/BulletDynamics_vc8.vcproj [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ConvexConvexAlgorithm.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ConvexConvexAlgorithm.h [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/EmptyCollisionAlgorithm.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/EmptyCollisionAlgorithm.h [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ManifoldResult.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ManifoldResult.h [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ToiContactDispatcher.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/ToiContactDispatcher.h [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/UnionFind.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/CollisionDispatch/UnionFind.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/ConstraintSolver.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/ContactSolverInfo.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/JacobianEntry.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/OdeConstraintSolver.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/OdeConstraintSolver.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/OdeConstraintSolver2.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/OdeConstraintSolver2.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/SimpleConstraintSolver.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/SimpleConstraintSolver.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.h [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/SorLcp.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/ConstraintSolver/SorLcp.h [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/BU_Joint.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/BU_Joint.h [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/ContactJoint.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/ContactJoint.h [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/MassProps.h [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/RigidBody.cpp [new file with mode: 0644]
extern/bullet/BulletDynamics/Dynamics/RigidBody.h [new file with mode: 0644]
extern/bullet/BulletLicense.txt [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics.dsp [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc7.vcproj [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc8.vcproj [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_DynamicTypes.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.cpp [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.cpp [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.cpp [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PHY_Pro.h [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterface.dsp [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc7.vcproj [new file with mode: 0644]
extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc8.vcproj [new file with mode: 0644]
extern/bullet/LinearMath/AabbUtil2.h [new file with mode: 0644]
extern/bullet/LinearMath/GEN_List.h [new file with mode: 0644]
extern/bullet/LinearMath/GEN_MinMax.h [new file with mode: 0644]
extern/bullet/LinearMath/GEN_random.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdMatrix3x3.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdMinMax.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdPoint3.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdQuadWord.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdQuaternion.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdScalar.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdTransform.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdTransformUtil.h [new file with mode: 0644]
extern/bullet/LinearMath/SimdVector3.h [new file with mode: 0644]
extern/bullet/continuous.dsw [new file with mode: 0644]
extern/bullet/continuous_vc7.sln [new file with mode: 0644]
extern/bullet/continuous_vc8.sln [new file with mode: 0644]

diff --git a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseInterface.h b/extern/bullet/Bullet/BroadphaseCollision/BroadphaseInterface.h
new file mode 100644 (file)
index 0000000..29c6a64
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef                BROADPHASE_INTERFACE_H
+#define        BROADPHASE_INTERFACE_H
+
+
+struct DispatcherInfo;
+class Dispatcher;
+struct BroadphaseProxy;
+#include "SimdVector3.h"
+
+///BroadphaseInterface for aabb-overlapping object pairs
+class BroadphaseInterface
+{
+public:
+       virtual BroadphaseProxy*        CreateProxy(  void *object,int type, const SimdVector3& min,  const SimdVector3& max) =0;
+       virtual void    DestroyProxy(BroadphaseProxy* proxy)=0;
+       virtual void    SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax)=0;
+       virtual void    CleanProxyFromPairs(BroadphaseProxy* proxy)=0;
+       virtual void    DispatchAllCollisionPairs(Dispatcher&   dispatcher,DispatcherInfo& dispatchInfo)=0;
+
+};
+
+#endif //BROADPHASE_INTERFACE_H
diff --git a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.cpp b/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.cpp
new file mode 100644 (file)
index 0000000..b7c6c72
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "BroadphaseProxy.h"
+
diff --git a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.h b/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.h
new file mode 100644 (file)
index 0000000..9dfeb37
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef BROADPHASE_PROXY_H
+#define BROADPHASE_PROXY_H
+
+
+
+/// Dispatcher 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_HULL_SHAPE_PROXYTYPE,
+//implicit convex shapes
+IMPLICIT_CONVEX_SHAPES_START_HERE,
+       SPHERE_SHAPE_PROXYTYPE,
+       MULTI_SPHERE_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,
+
+       MAX_BROADPHASE_COLLISION_TYPES
+};
+
+
+///BroadphaseProxy
+struct BroadphaseProxy
+{
+       BroadphaseProxy() :m_clientObject(0),m_clientObjectType(-1){}
+       BroadphaseProxy(void* object,int type)
+               :m_clientObject(object),
+               m_clientObjectType(type)
+       {
+       }
+
+       void        *m_clientObject;
+
+       int GetClientObjectType ( ) const { return m_clientObjectType;}
+
+       
+       void    SetClientObjectType( int type ) { 
+               m_clientObjectType = type; 
+       }
+
+       bool IsConvexShape()
+       {
+               return (GetClientObjectType () < TRIANGLE_MESH_SHAPE_PROXYTYPE);
+       }
+       bool IsConcaveShape()
+       {
+               return (GetClientObjectType() > CONCAVE_SHAPES_START_HERE);
+       }
+
+protected:
+       int                      m_clientObjectType;
+};
+
+class CollisionAlgorithm;
+
+struct BroadphaseProxy;
+
+#define SIMPLE_MAX_ALGORITHMS 2
+
+/// contains a pair of aabb-overlapping objects
+struct BroadphasePair
+{
+       BroadphasePair ()
+               :
+       m_pProxy0(0),
+               m_pProxy1(0)
+       {
+               for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
+               {
+                       m_algorithms[i] = 0;
+               }
+       }
+
+       BroadphasePair(const BroadphasePair& other)
+               :               m_pProxy0(other.m_pProxy0),
+                               m_pProxy1(other.m_pProxy1)
+       {
+               for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
+               {
+                       m_algorithms[i] = other.m_algorithms[i];
+               }
+       }
+       BroadphasePair(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1)
+               :
+               m_pProxy0(&proxy0),
+               m_pProxy1(&proxy1)
+       {
+               for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
+       {
+                       m_algorithms[i] = 0;
+               }
+
+       }
+
+       
+       BroadphaseProxy* m_pProxy0;
+       BroadphaseProxy* m_pProxy1;
+       
+       mutable CollisionAlgorithm* m_algorithms[SIMPLE_MAX_ALGORITHMS];
+};
+
+#endif //BROADPHASE_PROXY_H
+
diff --git a/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.cpp b/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.cpp
new file mode 100644 (file)
index 0000000..a4e2035
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "CollisionAlgorithm.h"
+#include "CollisionDispatcher.h"
+
+CollisionAlgorithm::CollisionAlgorithm(const CollisionAlgorithmConstructionInfo& ci)
+{
+       m_dispatcher = ci.m_dispatcher;
+}
+
diff --git a/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.h b/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.h
new file mode 100644 (file)
index 0000000..5699f10
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef COLLISION_ALGORITHM_H
+#define COLLISION_ALGORITHM_H
+
+struct BroadphaseProxy;
+class Dispatcher;
+
+struct CollisionAlgorithmConstructionInfo
+{
+       CollisionAlgorithmConstructionInfo()
+               :m_dispatcher(0)
+       {
+       }
+       CollisionAlgorithmConstructionInfo(Dispatcher* dispatcher,int temp)
+               :m_dispatcher(dispatcher)
+       {
+       }
+
+       Dispatcher*     m_dispatcher;
+
+       int     GetDispatcherId();
+
+};
+
+
+///CollisionAlgorithm is an collision interface that is compatible with the Broadphase and Dispatcher.
+///It is persistent over frames
+class CollisionAlgorithm
+{
+
+protected:
+
+       Dispatcher*     m_dispatcher;
+
+protected:
+       int     GetDispatcherId();
+       
+public:
+
+       CollisionAlgorithm() {};
+
+       CollisionAlgorithm(const CollisionAlgorithmConstructionInfo& ci);
+
+       virtual ~CollisionAlgorithm() {};
+
+       virtual void ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,float timeStep,int stepCount, bool useContinuous) = 0;
+
+       virtual float CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,float timeStep,int stepCount) = 0;
+
+};
+
+
+#endif //COLLISION_ALGORITHM_H
diff --git a/extern/bullet/Bullet/BroadphaseCollision/CollisionDispatcher.cpp b/extern/bullet/Bullet/BroadphaseCollision/CollisionDispatcher.cpp
new file mode 100644 (file)
index 0000000..65a7b61
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "CollisionDispatcher.h"
+
+Dispatcher::~Dispatcher()
+{
+
+}
+
diff --git a/extern/bullet/Bullet/BroadphaseCollision/CollisionDispatcher.h b/extern/bullet/Bullet/BroadphaseCollision/CollisionDispatcher.h
new file mode 100644 (file)
index 0000000..7787ed4
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef COLLISION_DISPATCHER_H
+#define COLLISION_DISPATCHER_H
+
+class CollisionAlgorithm;
+struct BroadphaseProxy;
+class RigidBody;
+
+enum CollisionDispatcherId
+{
+       RIGIDBODY_DISPATCHER = 0,
+       RAGDOLL_DISPATCHER
+};
+
+class PersistentManifold;
+
+struct DispatcherInfo
+{
+       enum DispatchFunc
+       {
+               DISPATCH_DISCRETE = 1,
+               DISPATCH_CONTINUOUS
+       };
+       DispatcherInfo()
+               :m_dispatchFunc(DISPATCH_DISCRETE),
+               m_timeOfImpact(1.f),
+               m_useContinuous(false)
+       {
+
+       }
+       float   m_timeStep;
+       int             m_stepCount;
+       int             m_dispatchFunc;
+       float   m_timeOfImpact;
+       bool    m_useContinuous;
+       
+};
+
+/// Collision Dispatcher can be used in combination with broadphase and collision algorithms.
+class Dispatcher
+{
+
+
+public:
+       virtual ~Dispatcher() ;
+
+       virtual CollisionAlgorithm* FindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) = 0;
+
+       //
+       // asume dispatchers to have unique id's in the range [0..max dispacher]
+       //
+       virtual int GetUniqueId() = 0;
+
+       virtual PersistentManifold*     GetNewManifold(void* body0,void* body1)=0;
+
+       virtual void ReleaseManifold(PersistentManifold* manifold)=0;
+
+
+};
+
+
+#endif //COLLISION_DISPATCHER_H
diff --git a/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.cpp b/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.cpp
new file mode 100644 (file)
index 0000000..5d72376
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "SimpleBroadphase.h"
+#include "BroadphaseCollision/CollisionDispatcher.h"
+#include "BroadphaseCollision/CollisionAlgorithm.h"
+
+#include "SimdVector3.h"
+#include "SimdTransform.h"
+#include "SimdMatrix3x3.h"
+#include <vector>
+#include "NarrowPhaseCollision/CollisionMargin.h"
+
+SimpleBroadphase::SimpleBroadphase()
+:  m_firstFreeProxy(0),
+  m_numProxies(0),
+ m_blockedForChanges(false),
+ m_NumOverlapBroadphasePair(0)
+{
+       int i;
+       for (i=0;i<SIMPLE_MAX_PROXIES;i++)
+       {
+               m_freeProxies[i] = i;
+       }
+}
+
+SimpleBroadphase::~SimpleBroadphase()
+{
+       /*int i;
+       for (i=m_numProxies-1;i>=0;i--)
+       {
+               BP_Proxy* proxy = m_pProxies[i]; 
+               destroyProxy(proxy);
+       }
+       */
+}
+
+
+BroadphaseProxy*       SimpleBroadphase::CreateProxy( void *object, int type, const SimdVector3& min,  const SimdVector3& max) 
+{
+       if (m_numProxies >= SIMPLE_MAX_PROXIES)
+       {
+               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];
+       BroadphaseProxy* proxy = new (&m_proxies[freeIndex])SimpleBroadphaseProxy(object,type,min,max);
+       m_firstFreeProxy++;
+
+       m_pProxies[m_numProxies] = proxy;
+       m_numProxies++;
+
+       return proxy;
+}
+void   SimpleBroadphase::DestroyProxy(BroadphaseProxy* proxy)
+{
+               m_numProxies--;
+               BroadphaseProxy* proxy1 = &m_proxies[0];
+       
+               int index = proxy - proxy1;
+               m_freeProxies[--m_firstFreeProxy] = index;
+
+}
+
+SimpleBroadphaseProxy* SimpleBroadphase::GetSimpleProxyFromProxy(BroadphaseProxy* proxy)
+{
+       SimpleBroadphaseProxy* proxy0 = static_cast<SimpleBroadphaseProxy*>(proxy);
+
+       int index = proxy0 - &m_proxies[0];
+       assert(index < m_numProxies);
+
+       SimpleBroadphaseProxy* sbp = &m_proxies[index];
+       return sbp;
+}
+void   SimpleBroadphase::SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax)
+{
+       SimpleBroadphaseProxy* sbp = GetSimpleProxyFromProxy(proxy);
+       sbp->m_min = aabbMin;
+       sbp->m_max = aabbMax;
+}
+
+void   SimpleBroadphase::CleanOverlappingPair(BroadphasePair& pair)
+{
+       for (int dispatcherId=0;dispatcherId<SIMPLE_MAX_ALGORITHMS;dispatcherId++)
+       {
+               if (pair.m_algorithms[dispatcherId])
+               {
+                       {
+                               delete pair.m_algorithms[dispatcherId];
+                               pair.m_algorithms[dispatcherId]=0;
+                       }
+               }
+       }
+}
+
+
+void   SimpleBroadphase::CleanProxyFromPairs(BroadphaseProxy* proxy)
+{
+       for (int i=0;i<m_NumOverlapBroadphasePair;i++)
+       {
+               BroadphasePair& pair = m_OverlappingPairs[i];
+               if (pair.m_pProxy0 == proxy ||
+                               pair.m_pProxy1 == proxy)
+               {
+                       CleanOverlappingPair(pair);
+               }
+       }
+}
+
+void   SimpleBroadphase::AddOverlappingPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1)
+{
+       BroadphasePair pair(*proxy0,*proxy1);
+       m_OverlappingPairs[m_NumOverlapBroadphasePair] = pair;
+
+       int i;
+       for (i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
+       {
+               assert(!m_OverlappingPairs[m_NumOverlapBroadphasePair].m_algorithms[i]);
+               m_OverlappingPairs[m_NumOverlapBroadphasePair].m_algorithms[i] = 0;
+       }
+       m_NumOverlapBroadphasePair++;
+}
+       
+bool   SimpleBroadphase::FindPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1)
+{
+       bool found = false;
+       int i;
+       for (i=m_NumOverlapBroadphasePair-1;i>=0;i--)
+       {
+               BroadphasePair& pair = m_OverlappingPairs[i];
+               if (((pair.m_pProxy0 == proxy0) && (pair.m_pProxy1 == proxy1)) ||
+                       ((pair.m_pProxy0 == proxy1) && (pair.m_pProxy1 == proxy0)))
+               {
+                       found = true;
+                       break;
+               }
+       }       
+
+       return found;
+}
+void   SimpleBroadphase::RemoveOverlappingPair(BroadphasePair& pair)
+{
+    CleanOverlappingPair(pair);
+       int     index = &pair - &m_OverlappingPairs[0];
+       //remove efficiently, swap with the last
+       m_OverlappingPairs[index] = m_OverlappingPairs[m_NumOverlapBroadphasePair-1];
+       m_NumOverlapBroadphasePair--;
+}
+
+bool   SimpleBroadphase::AabbOverlap(SimpleBroadphaseProxy* proxy0,SimpleBroadphaseProxy* 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];
+
+}
+void   SimpleBroadphase::RefreshOverlappingPairs()
+{
+       //first check for new overlapping pairs
+       int i,j;
+
+       for (i=0;i<m_numProxies;i++)
+       {
+               BroadphaseProxy* proxy0 = m_pProxies[i];
+               for (j=i+1;j<m_numProxies;j++)
+               {
+                       BroadphaseProxy* proxy1 = m_pProxies[j];
+                       SimpleBroadphaseProxy* p0 = GetSimpleProxyFromProxy(proxy0);
+                       SimpleBroadphaseProxy* p1 = GetSimpleProxyFromProxy(proxy1);
+
+                       if (AabbOverlap(p0,p1))
+                       {
+                               if ( !FindPair(proxy0,proxy1))
+                               {
+                                       AddOverlappingPair(proxy0,proxy1);
+                               }
+                       }
+
+               }
+       }
+
+       //then remove non-overlapping ones
+       for (i=0;i<m_NumOverlapBroadphasePair;i++)
+       {
+               BroadphasePair& pair = m_OverlappingPairs[i];
+               SimpleBroadphaseProxy* proxy0 = GetSimpleProxyFromProxy(pair.m_pProxy0);
+               SimpleBroadphaseProxy* proxy1 = GetSimpleProxyFromProxy(pair.m_pProxy1);
+               if (!AabbOverlap(proxy0,proxy1))
+               {
+            RemoveOverlappingPair(pair);
+               }
+       }
+
+       //BroadphasePair        m_OverlappingPairs[SIMPLE_MAX_OVERLAP];
+       //int   m_NumOverlapBroadphasePair;
+
+}
+
+void   SimpleBroadphase::DispatchAllCollisionPairs(Dispatcher& dispatcher,DispatcherInfo& dispatchInfo)
+{
+       m_blockedForChanges = true;
+
+       int i;
+       
+       int dispatcherId = dispatcher.GetUniqueId();
+
+       RefreshOverlappingPairs();
+
+       for (i=0;i<m_NumOverlapBroadphasePair;i++)
+       {
+               
+               BroadphasePair& pair = m_OverlappingPairs[i];
+               
+               if (dispatcherId>= 0)
+               {
+                       //dispatcher will keep algorithms persistent in the collision pair
+                       if (!pair.m_algorithms[dispatcherId])
+                       {
+                               pair.m_algorithms[dispatcherId] = dispatcher.FindAlgorithm(
+                                       *pair.m_pProxy0,
+                                       *pair.m_pProxy1);
+                       }
+
+                       if (pair.m_algorithms[dispatcherId])
+                       {
+                               if (dispatchInfo.m_dispatchFunc ==              DispatcherInfo::DISPATCH_DISCRETE)
+                               {
+                                       pair.m_algorithms[dispatcherId]->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo.m_timeStep,dispatchInfo.m_stepCount,dispatchInfo.m_useContinuous);
+                               } else
+                               {
+                                       float toi = pair.m_algorithms[dispatcherId]->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo.m_timeStep,dispatchInfo.m_stepCount);
+                                       if (dispatchInfo.m_timeOfImpact > toi)
+                                               dispatchInfo.m_timeOfImpact = toi;
+
+                               }
+                       }
+               } else
+               {
+                       //non-persistent algorithm dispatcher
+                               CollisionAlgorithm* algo = dispatcher.FindAlgorithm(
+                                       *pair.m_pProxy0,
+                                       *pair.m_pProxy1);
+
+                               if (algo)
+                               {
+                                       if (dispatchInfo.m_dispatchFunc ==              DispatcherInfo::DISPATCH_DISCRETE)
+                                       {
+                                               algo->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo.m_timeStep,dispatchInfo.m_stepCount,dispatchInfo.m_useContinuous);
+                                       } else
+                                       {
+                                               float toi = algo->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo.m_timeStep,dispatchInfo.m_stepCount);
+                                               if (dispatchInfo.m_timeOfImpact > toi)
+                                                       dispatchInfo.m_timeOfImpact = toi;
+                                       }
+                               }
+               }
+
+       }
+
+       m_blockedForChanges = false;
+
+}
+
+
diff --git a/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.h b/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.h
new file mode 100644 (file)
index 0000000..754d004
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef SIMPLE_BROADPHASE_H
+#define SIMPLE_BROADPHASE_H
+
+#define SIMPLE_MAX_PROXIES 8192
+#define SIMPLE_MAX_OVERLAP 4096
+
+#include "BroadphaseInterface.h"
+#include "BroadphaseProxy.h"
+#include "SimdPoint3.h"
+
+struct SimpleBroadphaseProxy : public BroadphaseProxy
+{
+       SimdVector3     m_min;
+       SimdVector3     m_max;
+       
+       SimpleBroadphaseProxy() {};
+
+       SimpleBroadphaseProxy(void* object,int type,const SimdPoint3& minpt,const SimdPoint3& maxpt)
+       :BroadphaseProxy(object,type),
+       m_min(minpt),m_max(maxpt)               
+       {
+       }
+       
+
+};
+
+///SimpleBroadphase is a brute force aabb culling broadphase based on O(n^2) aabb checks
+class SimpleBroadphase : public BroadphaseInterface
+{
+
+       SimpleBroadphaseProxy   m_proxies[SIMPLE_MAX_PROXIES];
+       int                             m_freeProxies[SIMPLE_MAX_PROXIES];
+       int                             m_firstFreeProxy;
+
+       BroadphaseProxy* m_pProxies[SIMPLE_MAX_PROXIES];
+       int                             m_numProxies;
+
+       //during the dispatch, check that user doesn't destroy/create proxy
+       bool            m_blockedForChanges;
+
+       BroadphasePair  m_OverlappingPairs[SIMPLE_MAX_OVERLAP];
+       int     m_NumOverlapBroadphasePair;
+
+       
+       SimpleBroadphaseProxy*  GetSimpleProxyFromProxy(BroadphaseProxy* proxy);
+
+       bool    AabbOverlap(SimpleBroadphaseProxy* proxy0,SimpleBroadphaseProxy* proxy1);
+       void    RemoveOverlappingPair(BroadphasePair& pair);
+       void    CleanOverlappingPair(BroadphasePair& pair);
+       void    AddOverlappingPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1);
+       bool    FindPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1);
+       void    RefreshOverlappingPairs();
+public:
+       SimpleBroadphase();
+       virtual ~SimpleBroadphase();
+
+       virtual BroadphaseProxy*        CreateProxy(  void *object,int type, const SimdVector3& min,  const SimdVector3& max) ;
+       virtual void    DestroyProxy(BroadphaseProxy* proxy);
+       virtual void    SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax);
+       virtual void    CleanProxyFromPairs(BroadphaseProxy* proxy);
+       virtual void    DispatchAllCollisionPairs(Dispatcher&   dispatcher,DispatcherInfo& dispatchInfo);
+
+};
+
+
+
+#endif //SIMPLE_BROADPHASE_H
+
diff --git a/extern/bullet/Bullet/Bullet3.dsp b/extern/bullet/Bullet/Bullet3.dsp
new file mode 100644 (file)
index 0000000..2e4ffaf
--- /dev/null
@@ -0,0 +1,412 @@
+# Microsoft Developer Studio Project File - Name="Bullet" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=Bullet - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "Bullet3.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "Bullet3.mak" CFG="Bullet - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Bullet - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "Bullet - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Bullet - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /Zd /O2 /I "../LinearMath" /I "." /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "BUM_INLINED" /D "USE_ALGEBRAIC" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "Bullet - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../LinearMath" /I "." /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "BUM_INLINED" /D "USE_ALGEBRAIC" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "Bullet - Win32 Release"
+# Name "Bullet - Win32 Debug"
+# Begin Group "NarrowPhaseCollision"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_Collidable.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_Collidable.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_CollisionPair.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_CollisionPair.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_EdgeEdge.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_EdgeEdge.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_MotionStateInterface.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_PolynomialSolverInterface.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_Screwing.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_Screwing.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_StaticMotionState.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_VertexPoly.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\BU_VertexPoly.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\CollisionMargin.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\ContinuousConvexCollision.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\ContinuousConvexCollision.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\ConvexCast.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\ConvexCast.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\GjkConvexCast.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\GjkConvexCast.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\GjkPairDetector.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\GjkPairDetector.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\ManifoldPoint.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\PersistentManifold.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\PersistentManifold.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\PointCollector.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\RaycastCallback.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\RaycastCallback.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\SimplexSolverInterface.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\SubSimplexConvexCast.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\SubSimplexConvexCast.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\VoronoiSimplexSolver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NarrowPhaseCollision\VoronoiSimplexSolver.h
+# End Source File
+# End Group
+# Begin Group "BroadphaseCollision"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\BroadPhaseInterface.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\BroadphaseProxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\BroadphaseProxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\CollisionAlgorithm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\CollisionAlgorithm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\CollisionDispatcher.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\CollisionDispatcher.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\SimpleBroadphase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BroadphaseCollision\SimpleBroadphase.h
+# End Source File
+# End Group
+# Begin Group "CollisionShapes"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\CollisionShapes\BoxShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\BoxShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\CollisionShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\CollisionShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\ConeShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\ConeShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\ConvexHullShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\ConvexHullShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\ConvexShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\ConvexShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\CylinderShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\CylinderShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\MinkowskiSumShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\MinkowskiSumShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\MultiSphereShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\MultiSphereShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\PolyhedralConvexShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\PolyhedralConvexShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\Simplex1to4Shape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\Simplex1to4Shape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\SphereShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\SphereShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\StridingMeshInterface.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\StridingMeshInterface.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\TriangleCallback.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\TriangleMesh.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\TriangleMesh.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\TriangleMeshShape.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\TriangleMeshShape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CollisionShapes\TriangleShape.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/extern/bullet/Bullet/Bullet3_vc7.vcproj b/extern/bullet/Bullet/Bullet3_vc7.vcproj
new file mode 100644 (file)
index 0000000..dab7458
--- /dev/null
@@ -0,0 +1,427 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="Bullet3ContinuousCollision"
+       ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}"
+       SccProjectName=""
+       SccLocalPath="">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\Debug"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories=".;..\LinearMath"
+                               PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile=".\Debug/Bullet.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="4"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile=".\Debug\Bullet.lib"
+                               SuppressStartupBanner="TRUE"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <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="Release|Win32"
+                       OutputDirectory=".\Release"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="1"
+                               AdditionalIncludeDirectories=".;..\LinearMath"
+                               PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               StringPooling="TRUE"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="TRUE"
+                               UsePrecompiledHeader="2"
+                               PrecompiledHeaderFile=".\Release/Bullet.pch"
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               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\bullet\include MKDIR ..\..\..\..\build\msvc_7\extern\bullet\include
+IF NOT EXIST ..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision MKDIR ..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision
+IF NOT EXIST ..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes MKDIR ..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes
+IF NOT EXIST ..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision MKDIR ..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision
+
+XCOPY /Y ..\LinearMath\*.h ..\..\..\..\build\msvc_7\extern\bullet\include
+XCOPY /Y ..\Bullet\BroadphaseCollision\*.h ..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision
+XCOPY /Y ..\Bullet\CollisionShapes\*.h ..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes
+XCOPY /Y ..\Bullet\NarrowPhaseCollision\*.h ..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision
+
+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="NarrowPhaseCollision"
+                       Filter="">
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Collidable.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Collidable.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_MotionStateInterface.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_PolynomialSolverInterface.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Screwing.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Screwing.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_StaticMotionState.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\CollisionMargin.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ConvexCast.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkConvexCast.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkConvexCast.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkPairDetector.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkPairDetector.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ManifoldPoint.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\PersistentManifold.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\PersistentManifold.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\PointCollector.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\RaycastCallback.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\RaycastCallback.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\SimplexSolverInterface.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.h">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.h">
+                       </File>
+               </Filter>
+               <Filter
+                       Name="CollisionShapes"
+                       Filter="">
+                       <File
+                               RelativePath=".\CollisionShapes\BoxShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\BoxShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CollisionShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CollisionShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConeShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConeShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexHullShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexHullShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CylinderShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CylinderShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MinkowskiSumShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MinkowskiSumShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MultiSphereShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MultiSphereShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\PolyhedralConvexShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\PolyhedralConvexShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\Simplex1to4Shape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\Simplex1to4Shape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\SphereShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\SphereShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\StridingMeshInterface.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\StridingMeshInterface.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleCallback.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleMesh.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleMesh.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleMeshShape.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleMeshShape.h">
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleShape.h">
+                       </File>
+               </Filter>
+               <Filter
+                       Name="BroadphaseCollision"
+                       Filter="">
+                       <File
+                               RelativePath=".\BroadphaseCollision\BroadPhaseInterface.h">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\BroadphaseProxy.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\BroadphaseProxy.h">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionAlgorithm.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionAlgorithm.h">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionDispatcher.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionDispatcher.h">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\SimpleBroadphase.cpp">
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\SimpleBroadphase.h">
+                       </File>
+               </Filter>
+               <Filter
+                       Name="LinearAlgebra"
+                       Filter="">
+                       <File
+                               RelativePath="..\LinearMath\AabbUtil2.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\GEN_List.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\GEN_MinMax.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\GEN_random.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdMatrix3x3.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdMinMax.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdPoint3.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdQuadword.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdQuaternion.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdScalar.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdTransform.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdTransformUtil.h">
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdVector3.h">
+                       </File>
+               </Filter>
+               <File
+                       RelativePath=".\NarrowPhaseCollision\ConvexCast.cpp">
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/extern/bullet/Bullet/Bullet3_vc8.sln b/extern/bullet/Bullet/Bullet3_vc8.sln
new file mode 100644 (file)
index 0000000..d95ceb0
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3ContinuousCollision", "Bullet3_vc8.vcproj", "{FFD3C64A-30E2-4BC7-BC8F-51818C320400}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug|Win32.ActiveCfg = Debug|Win32
+               {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug|Win32.Build.0 = Debug|Win32
+               {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release|Win32.ActiveCfg = Release|Win32
+               {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/extern/bullet/Bullet/Bullet3_vc8.vcproj b/extern/bullet/Bullet/Bullet3_vc8.vcproj
new file mode 100644 (file)
index 0000000..c2f3e70
--- /dev/null
@@ -0,0 +1,552 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="Bullet3ContinuousCollision"
+       ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}"
+       SignManifests="true"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\Debug"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories=".;..\LinearMath"
+                               PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="0"
+                               PrecompiledHeaderFile=""
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="4"
+                               CompileAs="0"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile=".\Debug\Bullet.lib"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory=".\Release"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="4"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="1"
+                               AdditionalIncludeDirectories=".;..\LinearMath"
+                               PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+                               StringPooling="true"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               PrecompiledHeaderFile=""
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="3"
+                               CompileAs="0"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile=".\Release\Bullet.lib"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="NarrowPhaseCollision"
+                       >
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Collidable.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Collidable.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_MotionStateInterface.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_PolynomialSolverInterface.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Screwing.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_Screwing.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_StaticMotionState.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\CollisionMargin.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ConvexCast.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ConvexCast.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkConvexCast.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkConvexCast.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkPairDetector.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\GjkPairDetector.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ManifoldPoint.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ManifoldPointCollector.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\ManifoldPointCollector.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\PersistentManifold.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\PersistentManifold.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\PointCollector.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\RaycastCallback.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\RaycastCallback.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\SimplexSolverInterface.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="CollisionShapes"
+                       >
+                       <File
+                               RelativePath=".\CollisionShapes\BoxShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\BoxShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CollisionShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CollisionShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConeShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConeShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexHullShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexHullShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\ConvexShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CylinderShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\CylinderShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MinkowskiSumShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MinkowskiSumShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MultiSphereShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\MultiSphereShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\PolyhedralConvexShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\PolyhedralConvexShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\Simplex1to4Shape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\Simplex1to4Shape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\SphereShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\SphereShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\StridingMeshInterface.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\StridingMeshInterface.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleCallback.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleMeshShape.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleMeshShape.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\CollisionShapes\TriangleShape.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="BroadphaseCollision"
+                       >
+                       <File
+                               RelativePath=".\BroadphaseCollision\BroadPhaseInterface.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\BroadphaseProxy.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\BroadphaseProxy.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionAlgorithm.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionAlgorithm.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionDispatcher.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\CollisionDispatcher.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\SimpleBroadphase.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\BroadphaseCollision\SimpleBroadphase.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="LinearAlgebra"
+                       >
+                       <File
+                               RelativePath="..\LinearMath\AabbUtil2.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\GEN_List.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\GEN_MinMax.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\GEN_random.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdMatrix3x3.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdMinMax.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdPoint3.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdQuadword.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdQuaternion.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdScalar.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdTransform.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdTransformUtil.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LinearMath\SimdVector3.h"
+                               >
+                       </File>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/extern/bullet/Bullet/CollisionShapes/BoxShape.cpp b/extern/bullet/Bullet/CollisionShapes/BoxShape.cpp
new file mode 100644 (file)
index 0000000..4edd8cf
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#include "BoxShape.h"
+
+
+void BoxShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const
+{
+       SimdVector3 halfExtents = GetHalfExtents();
+
+       SimdMatrix3x3 abs_b = t.getBasis().absolute();  
+       SimdPoint3 center = t.getOrigin();
+       SimdVector3 extent = SimdVector3(abs_b[0].dot(halfExtents),
+                  abs_b[1].dot(halfExtents),
+                 abs_b[2].dot(halfExtents));
+       extent += SimdVector3(GetMargin(),GetMargin(),GetMargin());
+
+
+       //todo: this is a quick fix, we need to enlarge the aabb dependent on several criteria
+       //extent += SimdVector3(.2f,.2f,.2f);
+
+       aabbMin = center - extent;
+       aabbMax = center + extent;
+
+
+}
diff --git a/extern/bullet/Bullet/CollisionShapes/BoxShape.h b/extern/bullet/Bullet/CollisionShapes/BoxShape.h
new file mode 100644 (file)
index 0000000..620ddd7
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef OBB_BOX_MINKOWSKI_H
+#define OBB_BOX_MINKOWSKI_H
+
+#include "PolyhedralConvexShape.h"
+#include "NarrowPhaseCollision/CollisionMargin.h"
+#include "BroadphaseCollision/BroadphaseProxy.h"
+#include "SimdPoint3.h"
+#include "SimdMinMax.h"
+
+///BoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box
+class BoxShape: public PolyhedralConvexShape
+{
+
+       SimdVector3     m_boxHalfExtents1;
+
+
+public:
+
+       virtual ~BoxShape()
+       {
+
+       }
+
+       SimdVector3 GetHalfExtents() const{ return m_boxHalfExtents1 * m_localScaling;}
+       //const SimdVector3& GetHalfExtents() const{ return m_boxHalfExtents1;}
+
+
+       
+       virtual int     GetShapeType() const { return BOX_SHAPE_PROXYTYPE;}
+
+       virtual SimdVector3     LocalGetSupportingVertex(const SimdVector3& vec) const
+       {
+               
+               SimdVector3 halfExtents = GetHalfExtents();
+
+               SimdVector3 supVertex;
+               supVertex = SimdPoint3(vec.x() < SimdScalar(0.0f) ? -halfExtents.x() : halfExtents.x(),
+                     vec.y() < SimdScalar(0.0f) ? -halfExtents.y() : halfExtents.y(),
+                     vec.z() < SimdScalar(0.0f) ? -halfExtents.z() : halfExtents.z()); 
+  
+
+               if ( GetMargin()!=0.f )
+               {
+                       SimdVector3 vecnorm = vec;
+                       if (vecnorm .length2() == 0.f)
+                       {
+                               vecnorm.setValue(-1.f,-1.f,-1.f);
+                       } 
+                       vecnorm.normalize();
+                       supVertex+= GetMargin() * vecnorm;
+               }
+               return supVertex;
+       }
+
+
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+       {
+               SimdVector3 halfExtents = GetHalfExtents();
+
+               return SimdVector3(vec.x() < SimdScalar(0.0f) ? -halfExtents.x() : halfExtents.x(),
+                    vec.y() < SimdScalar(0.0f) ? -halfExtents.y() : halfExtents.y(),
+                    vec.z() < SimdScalar(0.0f) ? -halfExtents.z() : halfExtents.z()); 
+       }
+
+
+       BoxShape( const SimdVector3& boxHalfExtents) :  m_boxHalfExtents1(boxHalfExtents){};
+       
+       virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
+
+       
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+       {
+               float margin = GetMargin();
+               SimdVector3 halfExtents = GetHalfExtents();
+
+               SimdScalar lx=2.f*(halfExtents.x()+margin);
+               SimdScalar ly=2.f*(halfExtents.y()+margin);
+               SimdScalar lz=2.f*(halfExtents.z()+margin);
+               const SimdScalar x2 = lx*lx;
+               const SimdScalar y2 = ly*ly;
+               const SimdScalar z2 = lz*lz;
+               const SimdScalar scaledmass = mass * 0.08333333f;
+
+               inertia = scaledmass * (SimdVector3(y2+z2,x2+z2,x2+y2));
+
+//             inertia.x() = scaledmass * (y2+z2);
+//             inertia.y() = scaledmass * (x2+z2);
+//             inertia.z() = scaledmass * (x2+y2);
+       }
+
+
+       virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const
+       {
+               //this plane might not be aligned...
+               SimdVector4 plane ;
+               GetPlaneEquation(plane,i);
+               planeNormal = SimdVector3(plane.getX(),plane.getY(),plane.getZ());
+               planeSupport = LocalGetSupportingVertex(-planeNormal);
+       }
+
+       
+       virtual int GetNumPlanes() const
+       {
+               return 6;
+       }       
+       
+       virtual int     GetNumVertices() const 
+       {
+               return 8;
+       }
+
+       virtual int GetNumEdges() const
+       {
+               return 12;
+       }
+
+
+       virtual void GetVertex(int i,SimdVector3& vtx) const
+       {
+               SimdVector3 halfExtents = GetHalfExtents();
+
+               vtx = SimdVector3(
+                               halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
+                               halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1),
+                               halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2));
+       }
+       
+
+       virtual void    GetPlaneEquation(SimdVector4& plane,int i) const
+       {
+               SimdVector3 halfExtents = GetHalfExtents();
+
+               switch (i)
+               {
+               case 0:
+                       plane.setValue(1.f,0.f,0.f);
+                       plane[3] = -halfExtents.x();
+                       break;
+               case 1:
+                       plane.setValue(-1.f,0.f,0.f);
+                       plane[3] = -halfExtents.x();
+                       break;
+               case 2:
+                       plane.setValue(0.f,1.f,0.f);
+                       plane[3] = -halfExtents.y();
+                       break;
+               case 3:
+                       plane.setValue(0.f,-1.f,0.f);
+                       plane[3] = -halfExtents.y();
+                       break;
+               case 4:
+                       plane.setValue(0.f,0.f,1.f);
+                       plane[3] = -halfExtents.z();
+                       break;
+               case 5:
+                       plane.setValue(0.f,0.f,-1.f);
+                       plane[3] = -halfExtents.z();
+                       break;
+               default:
+                       assert(0);
+               }
+       }
+
+       
+       virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const
+       //virtual void GetEdge(int i,Edge& edge) const
+       {
+               int edgeVert0 = 0;
+               int edgeVert1 = 0;
+
+               switch (i)
+               {
+               case 0:
+                               edgeVert0 = 0;
+                               edgeVert1 = 1;
+                       break;
+               case 1:
+                               edgeVert0 = 0;
+                               edgeVert1 = 2;
+                       break;
+               case 2:
+                       edgeVert0 = 1;
+                       edgeVert1 = 3;
+
+                       break;
+               case 3:
+                       edgeVert0 = 2;
+                       edgeVert1 = 3;
+                       break;
+               case 4:
+                       edgeVert0 = 0;
+                       edgeVert1 = 4;
+                       break;
+               case 5:
+                       edgeVert0 = 1;
+                       edgeVert1 = 5;
+
+                       break;
+               case 6:
+                       edgeVert0 = 2;
+                       edgeVert1 = 6;
+                       break;
+               case 7:
+                       edgeVert0 = 3;
+                       edgeVert1 = 7;
+                       break;
+               case 8:
+                       edgeVert0 = 4;
+                       edgeVert1 = 5;
+                       break;
+               case 9:
+                       edgeVert0 = 4;
+                       edgeVert1 = 6;
+                       break;
+               case 10:
+                       edgeVert0 = 5;
+                       edgeVert1 = 7;
+                       break;
+               case 11:
+                       edgeVert0 = 6;
+                       edgeVert1 = 7;
+                       break;
+               default:
+                       ASSERT(0);
+
+               }
+
+               GetVertex(edgeVert0,pa );
+               GetVertex(edgeVert1,pb );
+       }
+
+
+
+
+       
+       virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const
+       {
+               SimdVector3 halfExtents = GetHalfExtents();
+
+               //SimdScalar minDist = 2*tolerance;
+               
+               bool result =   (pt.x() <= (halfExtents.x()+tolerance)) &&
+                                               (pt.x() >= (-halfExtents.x()-tolerance)) &&
+                                               (pt.y() <= (halfExtents.y()+tolerance)) &&
+                                               (pt.y() >= (-halfExtents.y()-tolerance)) &&
+                                               (pt.z() <= (halfExtents.z()+tolerance)) &&
+                                               (pt.z() >= (-halfExtents.z()-tolerance));
+               
+               return result;
+       }
+
+
+       //debugging
+       virtual char*   GetName()const
+       {
+               return "Box";
+       }
+
+
+};
+
+#endif //OBB_BOX_MINKOWSKI_H
diff --git a/extern/bullet/Bullet/CollisionShapes/CollisionShape.cpp b/extern/bullet/Bullet/CollisionShapes/CollisionShape.cpp
new file mode 100644 (file)
index 0000000..4bd1619
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "CollisionShapes/CollisionShape.h"
+
+void   CollisionShape::GetBoundingSphere(SimdVector3& center,SimdScalar& radius) const
+{
+       SimdTransform tr;
+       tr.setIdentity();
+       SimdVector3 aabbMin,aabbMax;
+
+       GetAabb(tr,aabbMin,aabbMax);
+
+       radius = (aabbMax-aabbMin).length()*0.5f;
+       center = (aabbMin+aabbMax)*0.5f;
+}
+
+float  CollisionShape::GetAngularMotionDisc() const
+{
+       SimdVector3     center;
+       float disc;
+       GetBoundingSphere(center,disc);
+       disc += (center).length();
+       return disc;
+}
+
+void CollisionShape::CalculateTemporalAabb(const SimdTransform& curTrans,const SimdVector3& linvel,const SimdVector3& angvel,SimdScalar timeStep, SimdVector3& temporalAabbMin,SimdVector3& temporalAabbMax)
+{
+       //start with static aabb
+       GetAabb(curTrans,temporalAabbMin,temporalAabbMax);
+
+       float temporalAabbMaxx = temporalAabbMax.getX();
+       float temporalAabbMaxy = temporalAabbMax.getY();
+       float temporalAabbMaxz = temporalAabbMax.getZ();
+       float temporalAabbMinx = temporalAabbMin.getX();
+       float temporalAabbMiny = temporalAabbMin.getY();
+       float temporalAabbMinz = temporalAabbMin.getZ();
+
+       // add linear motion
+       SimdVector3 linMotion = linvel*timeStep;
+       //todo: simd would have a vector max/min operation, instead of per-element access
+       if (linMotion.x() > 0.f)
+               temporalAabbMaxx += linMotion.x(); 
+       else
+               temporalAabbMinx += linMotion.x();
+       if (linMotion.y() > 0.f)
+               temporalAabbMaxy += linMotion.y(); 
+       else
+               temporalAabbMiny += linMotion.y();
+       if (linMotion.z() > 0.f)
+               temporalAabbMaxz += linMotion.z(); 
+       else
+               temporalAabbMinz += linMotion.z();
+
+       //add conservative angular motion
+       SimdScalar angularMotion = angvel.length() * GetAngularMotionDisc() * timeStep;
+       SimdVector3 angularMotion3d(angularMotion,angularMotion,angularMotion);
+       temporalAabbMin = SimdVector3(temporalAabbMinx,temporalAabbMiny,temporalAabbMinz);
+       temporalAabbMax = SimdVector3(temporalAabbMaxx,temporalAabbMaxy,temporalAabbMaxz);
+
+       temporalAabbMin -= angularMotion3d;
+       temporalAabbMax += angularMotion3d;
+}
diff --git a/extern/bullet/Bullet/CollisionShapes/CollisionShape.h b/extern/bullet/Bullet/CollisionShapes/CollisionShape.h
new file mode 100644 (file)
index 0000000..6969075
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef COLLISION_SHAPE_H
+#define COLLISION_SHAPE_H
+
+#include "SimdTransform.h"
+#include "SimdVector3.h"
+#include <SimdMatrix3x3.h>
+#include "SimdPoint3.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" //for the shape types
+
+///CollisionShape provides generic interface for collidable objects
+class CollisionShape
+{
+
+public:
+
+       CollisionShape()
+       :m_tempDebug(0)
+       {
+       }
+       virtual ~CollisionShape()
+       {
+       }
+
+       virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const =0;
+
+       virtual void    GetBoundingSphere(SimdVector3& center,SimdScalar& radius) const;
+
+       virtual float   GetAngularMotionDisc() const;
+
+       virtual int             GetShapeType() const=0;
+
+       ///CalculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
+       ///result is conservative
+       void CalculateTemporalAabb(const SimdTransform& curTrans,const SimdVector3& linvel,const SimdVector3& angvel,SimdScalar timeStep, SimdVector3& temporalAabbMin,SimdVector3& temporalAabbMax);
+
+       bool    IsPolyhedral() const
+       {
+               return (GetShapeType() < IMPLICIT_CONVEX_SHAPES_START_HERE);
+       }
+
+       bool    IsConvex() const
+       {
+               return (GetShapeType() < CONCAVE_SHAPES_START_HERE);
+       }
+       bool    IsConcave() const
+       {
+               return (GetShapeType() > CONCAVE_SHAPES_START_HERE);
+       }
+
+
+       virtual void    setLocalScaling(const SimdVector3& scaling) =0;
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) = 0;
+
+//debugging support
+       virtual char*   GetName()const =0 ;
+       const char* GetExtraDebugInfo() const { return m_tempDebug;}
+       void  SetExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;}
+       const char * m_tempDebug;
+//endif debugging support
+
+
+};     
+
+#endif //COLLISION_SHAPE_H
+
diff --git a/extern/bullet/Bullet/CollisionShapes/ConeShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConeShape.cpp
new file mode 100644 (file)
index 0000000..40e7621
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "ConeShape.h"
+#include "SimdPoint3.h"
+
+#ifdef WIN32
+static int coneindices[3] = {1,2,0};
+#else
+static int coneindices[3] = {2,1,0};
+#endif
+
+ConeShape::ConeShape (SimdScalar radius,SimdScalar height):
+m_radius (radius),
+m_height(height)
+{
+       SimdVector3 halfExtents;
+       m_sinAngle = (m_radius / sqrt(m_radius * m_radius + m_height * m_height));
+}
+
+
+SimdVector3 ConeShape::ConeLocalSupport(const SimdVector3& v) const
+{
+       
+       float halfHeight = m_height * 0.5f;
+
+ if (v[coneindices[1]] > v.length() * m_sinAngle)
+ {
+       SimdVector3 tmp;
+
+       tmp[coneindices[0]] = 0.f;
+       tmp[coneindices[1]] = halfHeight;
+       tmp[coneindices[2]] = 0.f;
+       return tmp;
+ }
+  else {
+    SimdScalar s = sqrtf(v[coneindices[0]] * v[coneindices[0]] + v[coneindices[2]] * v[coneindices[2]]);
+    if (s > SIMD_EPSILON) {
+      SimdScalar d = m_radius / s;
+         SimdVector3 tmp;
+         tmp[coneindices[0]] = v[coneindices[0]] * d;
+         tmp[coneindices[1]] = -halfHeight;
+         tmp[coneindices[2]] = v[coneindices[2]] * d;
+         return tmp;
+    }
+    else  {
+               SimdVector3 tmp;
+               tmp[coneindices[0]] = 0.f;
+               tmp[coneindices[1]] = -halfHeight;
+               tmp[coneindices[2]] = 0.f;
+               return tmp;
+       }
+  }
+
+}
+
+SimdVector3    ConeShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec) const
+{
+               return ConeLocalSupport(vec);
+}
+
+SimdVector3    ConeShape::LocalGetSupportingVertex(const SimdVector3& vec)  const
+{
+       SimdVector3 supVertex = ConeLocalSupport(vec);
+       if ( GetMargin()!=0.f )
+       {
+               SimdVector3 vecnorm = vec;
+               if (vecnorm .length2() == 0.f)
+               {
+                       vecnorm.setValue(-1.f,-1.f,-1.f);
+               } 
+               vecnorm.normalize();
+               supVertex+= GetMargin() * vecnorm;
+       }
+       return supVertex;
+}
+
+
diff --git a/extern/bullet/Bullet/CollisionShapes/ConeShape.h b/extern/bullet/Bullet/CollisionShapes/ConeShape.h
new file mode 100644 (file)
index 0000000..88117e1
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef CONE_MINKOWSKI_H
+#define CONE_MINKOWSKI_H
+
+#include "ConvexShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+
+/// implements cone shape interface
+class ConeShape : public ConvexShape
+
+{
+
+       float m_sinAngle;
+       float m_radius;
+       float m_height;
+       
+       SimdVector3 ConeLocalSupport(const SimdVector3& v) const;
+
+
+public:
+       ConeShape (SimdScalar radius,SimdScalar height);
+       
+       virtual SimdVector3     LocalGetSupportingVertex(const SimdVector3& vec) const;
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec) const;
+
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+       {
+               SimdTransform identity;
+               identity.setIdentity();
+               SimdVector3 aabbMin,aabbMax;
+               GetAabb(identity,aabbMin,aabbMax);
+
+               SimdVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
+
+               float margin = GetMargin();
+
+               SimdScalar lx=2.f*(halfExtents.x()+margin);
+               SimdScalar ly=2.f*(halfExtents.y()+margin);
+               SimdScalar lz=2.f*(halfExtents.z()+margin);
+               const SimdScalar x2 = lx*lx;
+               const SimdScalar y2 = ly*ly;
+               const SimdScalar z2 = lz*lz;
+               const SimdScalar scaledmass = mass * 0.08333333f;
+
+               inertia = scaledmass * (SimdVector3(y2+z2,x2+z2,x2+y2));
+
+//             inertia.x() = scaledmass * (y2+z2);
+//             inertia.y() = scaledmass * (x2+z2);
+//             inertia.z() = scaledmass * (x2+y2);
+       }
+
+
+
+               virtual int     GetShapeType() const { return CONE_SHAPE_PROXYTYPE; }
+
+               virtual char*   GetName()const 
+               {
+                       return "Cone";
+               }
+};
+
+
+#endif //CONE_MINKOWSKI_H
\ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.cpp
new file mode 100644 (file)
index 0000000..0206324
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#include "ConvexHullShape.h"
+#include "NarrowPhaseCollision/CollisionMargin.h"
+
+#include "SimdQuaternion.h"
+
+
+ConvexHullShape ::ConvexHullShape (SimdPoint3* points,int numPoints)
+{
+       m_points.resize(numPoints);
+       for (int i=0;i<numPoints;i++)
+               m_points[i] = points[i];
+}
+
+SimdVector3    ConvexHullShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const
+{
+       SimdVector3 supVec(0.f,0.f,0.f);
+       SimdScalar newDot,maxDot = -1e30f;
+
+       SimdVector3 vec = vec0;
+       SimdScalar lenSqr = vec.length2();
+       if (lenSqr < 0.0001f)
+       {
+               vec.setValue(1,0,0);
+       } else
+       {
+               float rlen = 1.f / sqrtf(lenSqr );
+               vec *= rlen;
+       }
+
+
+       for (int i=0;i<m_points.size();i++)
+       {
+               SimdPoint3 vtx = m_points[i] * m_localScaling;
+
+               newDot = vec.dot(vtx);
+               if (newDot > maxDot)
+               {
+                       maxDot = newDot;
+                       supVec = vtx;
+               }
+       }
+       return supVec;
+}
+
+
+SimdVector3    ConvexHullShape::LocalGetSupportingVertex(const SimdVector3& vec)const
+{
+       SimdVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
+
+       if ( GetMargin()!=0.f )
+       {
+               SimdVector3 vecnorm = vec;
+               if (vecnorm .length2() == 0.f)
+               {
+                       vecnorm.setValue(-1.f,-1.f,-1.f);
+               } 
+               vecnorm.normalize();
+               supVertex+= GetMargin() * vecnorm;
+       }
+       return supVertex;
+}
+
+
+
+
+
+void   ConvexHullShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+{
+       //not yet, return box inertia
+
+       float margin = GetMargin();
+
+       SimdTransform ident;
+       ident.setIdentity();
+       SimdVector3 aabbMin,aabbMax;
+       GetAabb(ident,aabbMin,aabbMax);
+       SimdVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
+
+       SimdScalar lx=2.f*(halfExtents.x()+margin);
+       SimdScalar ly=2.f*(halfExtents.y()+margin);
+       SimdScalar lz=2.f*(halfExtents.z()+margin);
+       const SimdScalar x2 = lx*lx;
+       const SimdScalar y2 = ly*ly;
+       const SimdScalar z2 = lz*lz;
+       const SimdScalar scaledmass = mass * 0.08333333f;
+
+       inertia = scaledmass * (SimdVector3(y2+z2,x2+z2,x2+y2));
+
+}
+
+
+
+//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
+//Please note that you can debug-draw ConvexHullShape with the Raytracer Demo
+int    ConvexHullShape::GetNumVertices() const
+{
+       return m_points.size();
+}
+
+int ConvexHullShape::GetNumEdges() const
+{
+       return m_points.size()*m_points.size();
+}
+
+void ConvexHullShape::GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const
+{
+
+       int index0 = i%m_points.size();
+       int index1 = i/m_points.size();
+       pa = m_points[index0];
+       pb = m_points[index1];
+}
+
+void ConvexHullShape::GetVertex(int i,SimdPoint3& vtx) const
+{
+       vtx = m_points[i];
+}
+
+int    ConvexHullShape::GetNumPlanes() const
+{
+       return 0;
+}
+
+void ConvexHullShape::GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const
+{
+       assert(0);
+}
+
+//not yet
+bool ConvexHullShape::IsInside(const SimdPoint3& pt,SimdScalar tolerance) const
+{
+       assert(0);
+       return false;
+}
+
diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.h b/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.h
new file mode 100644 (file)
index 0000000..5be0b61
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef CONVEX_HULL_SHAPE_H
+#define CONVEX_HULL_SHAPE_H
+
+#include "PolyhedralConvexShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+
+#include <vector>
+
+///ConvexHullShape implements an implicit (getSupportingVertex) Convex Hull of a Point Cloud (vertices)
+///No connectivity is needed. LocalGetSupportingVertex iterates linearly though all vertices.
+///on modern hardware, due to cache coherency this isn't that bad. Complex algorithms tend to trash the cash.
+///(memory is much slower then the cpu)
+class ConvexHullShape : public PolyhedralConvexShape
+{
+       std::vector<SimdPoint3> m_points;
+
+public:
+       ConvexHullShape(SimdPoint3* points,int numPoints);
+
+       void AddPoint(const SimdPoint3& point)
+       {
+               m_points.push_back(point);
+       }
+       virtual SimdVector3     LocalGetSupportingVertex(const SimdVector3& vec)const;
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
+
+       virtual int     GetShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
+
+       //debugging
+       virtual char*   GetName()const {return "Convex";}
+
+       
+       virtual int     GetNumVertices() const;
+       virtual int GetNumEdges() const;
+       virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const;
+       virtual void GetVertex(int i,SimdPoint3& vtx) const;
+       virtual int     GetNumPlanes() const;
+       virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const;
+       virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const;
+
+
+
+};
+
+
+#endif //CONVEX_HULL_SHAPE_H
\ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConvexShape.cpp
new file mode 100644 (file)
index 0000000..f2afb33
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#include "ConvexShape.h"
+
+ConvexShape::~ConvexShape()
+{
+
+}
+
+ConvexShape::ConvexShape()
+:m_collisionMargin(CONVEX_DISTANCE_MARGIN),
+m_localScaling(1.f,1.f,1.f)
+{
+}
+
+
+void   ConvexShape::setLocalScaling(const SimdVector3& scaling)
+{
+       m_localScaling = scaling;
+}
+
+
+
+void   ConvexShape::GetAabbSlow(const SimdTransform& trans,SimdVector3&minAabb,SimdVector3&maxAabb) const
+{
+
+       SimdScalar margin = 0.05f;
+       for (int i=0;i<3;i++)
+       {
+               SimdVector3 vec(0.f,0.f,0.f);
+               vec[i] = 1.f;
+               SimdVector3 tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis()));
+               maxAabb[i] = tmp[i]+margin;
+               vec[i] = -1.f;
+               tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis()));
+               minAabb[i] = tmp[i]-margin;
+       }
+};
+
+SimdVector3    ConvexShape::LocalGetSupportingVertex(const SimdVector3& vec)const
+ {
+        SimdVector3    supVertex = LocalGetSupportingVertexWithoutMargin(vec);
+
+       if ( GetMargin()!=0.f )
+       {
+               SimdVector3 vecnorm = vec;
+               if (vecnorm .length2() == 0.f)
+               {
+                       vecnorm.setValue(-1.f,-1.f,-1.f);
+               } 
+               vecnorm.normalize();
+               supVertex+= GetMargin() * vecnorm;
+       }
+       return supVertex;
+
+ }
+
+
diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexShape.h b/extern/bullet/Bullet/CollisionShapes/ConvexShape.h
new file mode 100644 (file)
index 0000000..345358e
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef CONVEX_SHAPE_INTERFACE1
+#define CONVEX_SHAPE_INTERFACE1
+
+#include "CollisionShape.h"
+
+#include "SimdVector3.h"
+#include "SimdTransform.h"
+#include "SimdMatrix3x3.h"
+#include <vector>
+#include "NarrowPhaseCollision/CollisionMargin.h"
+
+//todo: get rid of this ConvexCastResult thing!
+struct ConvexCastResult;
+
+
+/// ConvexShape is an abstract shape interface.
+/// The explicit part provides plane-equations, the implicit part provides GetClosestPoint interface.
+/// used in combination with GJK or ConvexCast
+class ConvexShape : public CollisionShape
+{
+public:
+       ConvexShape();
+
+       virtual ~ConvexShape();
+
+       virtual SimdVector3     LocalGetSupportingVertex(const SimdVector3& vec)const;
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec) const= 0;
+
+       // testing for hullnode code
+
+       ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
+       void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const
+       {
+               GetAabbSlow(t,aabbMin,aabbMax);
+       }
+
+
+       
+       virtual void GetAabbSlow(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
+
+
+       virtual void    setLocalScaling(const SimdVector3& scaling);
+
+
+       virtual void    SetMargin(float margin)
+       {
+               m_collisionMargin = margin;
+       }
+       virtual float   GetMargin() const
+       {
+               return m_collisionMargin;
+       }
+private:
+       SimdScalar      m_collisionMargin;
+       //local scaling. collisionMargin is not scaled !
+protected:
+       SimdVector3     m_localScaling;
+
+};
+
+
+
+#endif //CONVEX_SHAPE_INTERFACE1
diff --git a/extern/bullet/Bullet/CollisionShapes/CylinderShape.cpp b/extern/bullet/Bullet/CollisionShapes/CylinderShape.cpp
new file mode 100644 (file)
index 0000000..4af83d5
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#include "CylinderShape.h"
+#include "SimdPoint3.h"
+
+CylinderShape::CylinderShape (const SimdVector3& halfExtents)
+:BoxShape(halfExtents)
+{
+
+}
+
+
+CylinderShapeX::CylinderShapeX (const SimdVector3& halfExtents)
+:CylinderShape(halfExtents)
+{
+}
+
+
+CylinderShapeZ::CylinderShapeZ (const SimdVector3& halfExtents)
+:CylinderShape(halfExtents)
+{
+}
+
+
+
+SimdVector3 CylinderLocalSupportX(const SimdVector3& halfExtents,const SimdVector3& v) 
+{
+const int cylinderUpAxis = 0;
+const int XX = 1;
+const int YY = 0;
+const int ZZ = 2;
+
+       //mapping depends on how cylinder local orientation is
+       // extents of the cylinder is: X,Y is for radius, and Z for height
+
+
+       float radius = halfExtents[XX];
+       float halfHeight = halfExtents[cylinderUpAxis];
+
+
+    SimdVector3 tmp;
+       SimdScalar d ;
+
+    SimdScalar s = sqrtf(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
+    if (s != SimdScalar(0.0))
+       {
+        d = radius / s;  
+               tmp[XX] = v[XX] * d;
+               tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
+               tmp[ZZ] = v[ZZ] * d;
+               return tmp;
+       }
+    else
+       {
+           tmp[XX] = radius;
+               tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
+               tmp[ZZ] = SimdScalar(0.0);
+               return tmp;
+    }
+
+
+}
+
+
+
+
+
+
+SimdVector3 CylinderLocalSupportY(const SimdVector3& halfExtents,const SimdVector3& v) 
+{
+
+const int cylinderUpAxis = 1;
+const int XX = 0;
+const int YY = 1;
+const int ZZ = 2;
+
+
+       float radius = halfExtents[XX];
+       float halfHeight = halfExtents[cylinderUpAxis];
+
+
+    SimdVector3 tmp;
+       SimdScalar d ;
+
+    SimdScalar s = sqrtf(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
+    if (s != SimdScalar(0.0))
+       {
+        d = radius / s;  
+               tmp[XX] = v[XX] * d;
+               tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
+               tmp[ZZ] = v[ZZ] * d;
+               return tmp;
+       }
+    else
+       {
+           tmp[XX] = radius;
+               tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
+               tmp[ZZ] = SimdScalar(0.0);
+               return tmp;
+    }
+
+}
+
+SimdVector3 CylinderLocalSupportZ(const SimdVector3& halfExtents,const SimdVector3& v) 
+{
+const int cylinderUpAxis = 2;
+const int XX = 0;
+const int YY = 2;
+const int ZZ = 1;
+
+       //mapping depends on how cylinder local orientation is
+       // extents of the cylinder is: X,Y is for radius, and Z for height
+
+
+       float radius = halfExtents[XX];
+       float halfHeight = halfExtents[cylinderUpAxis];
+
+
+    SimdVector3 tmp;
+       SimdScalar d ;
+
+    SimdScalar s = sqrtf(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
+    if (s != SimdScalar(0.0))
+       {
+        d = radius / s;  
+               tmp[XX] = v[XX] * d;
+               tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
+               tmp[ZZ] = v[ZZ] * d;
+               return tmp;
+       }
+    else
+       {
+           tmp[XX] = radius;
+               tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
+               tmp[ZZ] = SimdScalar(0.0);
+               return tmp;
+    }
+
+
+}
+
+SimdVector3    CylinderShapeX::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+{
+       return CylinderLocalSupportX(GetHalfExtents(),vec);
+}
+SimdVector3    CylinderShapeZ::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+{
+       return CylinderLocalSupportZ(GetHalfExtents(),vec);
+}
+SimdVector3    CylinderShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+{
+       return CylinderLocalSupportY(GetHalfExtents(),vec);
+}
+
+
+
+
+
+
+
diff --git a/extern/bullet/Bullet/CollisionShapes/CylinderShape.h b/extern/bullet/Bullet/CollisionShapes/CylinderShape.h
new file mode 100644 (file)
index 0000000..d60bacf
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef CYLINDER_MINKOWSKI_H
+#define CYLINDER_MINKOWSKI_H
+
+#include "BoxShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+#include "SimdVector3.h"
+
+/// implements cylinder shape interface
+class CylinderShape : public BoxShape
+
+{
+
+public:
+       CylinderShape (const SimdVector3& halfExtents);
+       
+
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+
+
+
+       //use box inertia
+       //      virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
+
+       virtual int     GetShapeType() const
+       {
+               return CYLINDER_SHAPE_PROXYTYPE;
+       }
+       
+
+
+};
+
+class CylinderShapeX : public CylinderShape
+{
+public:
+       CylinderShapeX (const SimdVector3& halfExtents);
+
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+};
+
+class CylinderShapeZ : public CylinderShape
+{
+public:
+       CylinderShapeZ (const SimdVector3& halfExtents);
+
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+};
+
+
+#endif //CYLINDER_MINKOWSKI_H
\ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.cpp b/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.cpp
new file mode 100644 (file)
index 0000000..abb1bfd
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "MinkowskiSumShape.h"
+
+
+MinkowskiSumShape::MinkowskiSumShape(ConvexShape* shapeA,ConvexShape* shapeB)
+:m_shapeA(shapeA),
+m_shapeB(shapeB)
+{
+       m_transA.setIdentity();
+       m_transB.setIdentity();
+}
+
+SimdVector3 MinkowskiSumShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+{
+       SimdVector3 supVertexA = m_transA(m_shapeA->LocalGetSupportingVertexWithoutMargin(vec*m_transA.getBasis()));
+       SimdVector3 supVertexB = m_transB(m_shapeB->LocalGetSupportingVertexWithoutMargin(vec*m_transB.getBasis()));
+       return supVertexA + supVertexB;
+}
+
+float  MinkowskiSumShape::GetMargin() const
+{
+       return m_shapeA->GetMargin() + m_shapeB->GetMargin();
+}
+
+
+void   MinkowskiSumShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+{
+       assert(0);
+       inertia.setValue(0,0,0);
+}
diff --git a/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.h b/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.h
new file mode 100644 (file)
index 0000000..a286b66
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef MINKOWSKI_SUM_SHAPE_H
+#define MINKOWSKI_SUM_SHAPE_H
+
+#include "ConvexShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+
+/// MinkowskiSumShape represents implicit (getSupportingVertex) based minkowski sum of two convex implicit shapes.
+class MinkowskiSumShape : public ConvexShape
+{
+
+       SimdTransform   m_transA;
+       SimdTransform   m_transB;
+       ConvexShape*    m_shapeA;
+       ConvexShape*    m_shapeB;
+
+public:
+
+       MinkowskiSumShape(ConvexShape* shapeA,ConvexShape* shapeB);
+
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
+
+       void    SetTransformA(const SimdTransform&      transA) { m_transA = transA;}
+       void    SetTransformB(const SimdTransform&      transB) { m_transB = transB;}
+
+       const SimdTransform& GetTransformA()const  { return m_transA;}
+       const SimdTransform& GetTransformB()const  { return m_transB;}
+
+
+       virtual int     GetShapeType() const { return MINKOWSKI_SUM_SHAPE_PROXYTYPE; }
+
+       virtual float   GetMargin() const;
+
+       const ConvexShape*      GetShapeA() const { return m_shapeA;}
+       const ConvexShape*      GetShapeB() const { return m_shapeB;}
+
+       virtual char*   GetName()const 
+       {
+               return "MinkowskiSum";
+       }
+};
+
+#endif //MINKOWSKI_SUM_SHAPE_H
diff --git a/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.cpp b/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.cpp
new file mode 100644 (file)
index 0000000..d2e7fcc
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "MultiSphereShape.h"
+#include "NarrowPhaseCollision/CollisionMargin.h"
+#include "SimdQuaternion.h"
+
+MultiSphereShape::MultiSphereShape (const SimdVector3& inertiaHalfExtents,const SimdVector3* positions,const SimdScalar* radi,int numSpheres)
+:m_inertiaHalfExtents(inertiaHalfExtents)
+{
+       m_minRadius = 1e30f;
+
+       m_numSpheres = numSpheres;
+       for (int i=0;i<m_numSpheres;i++)
+       {
+               m_localPositions[i] = positions[i];
+               m_radi[i] = radi[i];
+               if (radi[i] < m_minRadius)
+                       m_minRadius = radi[i];
+       }
+       SetMargin(m_minRadius);
+
+}
+
+
+
+ SimdVector3   MultiSphereShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const
+{
+       int i;
+       SimdVector3 supVec(0,0,0);
+
+       SimdScalar maxDot(-1e30f);
+
+
+       SimdVector3 vec = vec0;
+       SimdScalar lenSqr = vec.length2();
+       if (lenSqr < 0.0001f)
+       {
+               vec.setValue(1,0,0);
+       } else
+       {
+               float rlen = 1.f / sqrtf(lenSqr );
+               vec *= rlen;
+       }
+
+       SimdVector3 vtx;
+       SimdScalar newDot;
+
+       const SimdVector3* pos = &m_localPositions[0];
+       const SimdScalar* rad = &m_radi[0];
+
+       for (i=0;i<m_numSpheres;i++)
+       {
+               vtx = (*pos) +vec*((*rad)-m_minRadius);
+               pos++;
+               rad++;
+               newDot = vec.dot(vtx);
+               if (newDot > maxDot)
+               {
+                       maxDot = newDot;
+                       supVec = vtx;
+               }
+       }
+
+       return supVec;
+
+}
+
+
+
+
+
+
+
+
+
+
+void   MultiSphereShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+{
+       //as an approximation, take the inertia of the box that bounds the spheres
+
+       SimdTransform ident;
+       ident.setIdentity();
+//     SimdVector3 aabbMin,aabbMax;
+
+//     GetAabb(ident,aabbMin,aabbMax);
+
+       SimdVector3 halfExtents = m_inertiaHalfExtents;//(aabbMax - aabbMin)* 0.5f;
+
+       float margin = CONVEX_DISTANCE_MARGIN;
+
+       SimdScalar lx=2.f*(halfExtents[0]+margin);
+       SimdScalar ly=2.f*(halfExtents[1]+margin);
+       SimdScalar lz=2.f*(halfExtents[2]+margin);
+       const SimdScalar x2 = lx*lx;
+       const SimdScalar y2 = ly*ly;
+       const SimdScalar z2 = lz*lz;
+       const SimdScalar scaledmass = mass * 0.08333333f;
+
+       inertia[0] = scaledmass * (y2+z2);
+       inertia[1] = scaledmass * (x2+z2);
+       inertia[2] = scaledmass * (x2+y2);
+
+}
+
+
+
diff --git a/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.h b/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.h
new file mode 100644 (file)
index 0000000..fd23be6
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef MULTI_SPHERE_MINKOWSKI_H
+#define MULTI_SPHERE_MINKOWSKI_H
+
+#include "ConvexShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+
+#define MAX_NUM_SPHERES 5
+
+///MultiSphereShape represents implicit convex hull of a collection of spheres (using getSupportingVertex)
+class MultiSphereShape : public ConvexShape
+
+{
+       
+       SimdVector3 m_localPositions[MAX_NUM_SPHERES];
+       SimdScalar  m_radi[MAX_NUM_SPHERES];
+       SimdVector3     m_inertiaHalfExtents;
+
+       int m_numSpheres;
+       float m_minRadius;
+
+
+
+
+
+public:
+       MultiSphereShape (const SimdVector3& inertiaHalfExtents,const SimdVector3* positions,const SimdScalar* radi,int numSpheres);
+
+       ///CollisionShape Interface
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
+
+       /// ConvexShape Interface
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+
+       virtual int     GetShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
+
+       virtual char*   GetName()const 
+       {
+               return "MultiSphere";
+       }
+
+};
+
+
+#endif //MULTI_SPHERE_MINKOWSKI_H
diff --git a/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.cpp b/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.cpp
new file mode 100644 (file)
index 0000000..84b164d
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include <CollisionShapes/PolyhedralConvexShape.h>
+
+PolyhedralConvexShape::PolyhedralConvexShape()
+
+{
+}
+
+SimdVector3    PolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const
+{
+       int i;
+       SimdVector3 supVec(0,0,0);
+
+       SimdScalar maxDot(-1e30f);
+
+       SimdVector3 vec = vec0;
+       SimdScalar lenSqr = vec.length2();
+       if (lenSqr < 0.0001f)
+       {
+               vec.setValue(1,0,0);
+       } else
+       {
+               float rlen = 1.f / sqrtf(lenSqr );
+               vec *= rlen;
+       }
+
+       SimdVector3 vtx;
+       SimdScalar newDot;
+
+       for (i=0;i<GetNumVertices();i++)
+       {
+               GetVertex(i,vtx);
+               newDot = vec.dot(vtx);
+               if (newDot > maxDot)
+               {
+                       maxDot = newDot;
+                       supVec = vtx;
+               }
+       }
+
+       return supVec;
+
+}
diff --git a/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.h b/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.h
new file mode 100644 (file)
index 0000000..faab0f3
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef BU_SHAPE
+#define BU_SHAPE
+
+#include <SimdPoint3.h>
+#include <SimdMatrix3x3.h>
+#include <CollisionShapes/ConvexShape.h>
+
+
+///PolyhedralConvexShape is an interface class for feature based (vertex/edge/face) convex shapes.
+class PolyhedralConvexShape : public ConvexShape
+{
+
+public:
+
+       PolyhedralConvexShape();
+       
+       //brute force implementations
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+
+       virtual int     GetNumVertices() const = 0 ;
+       virtual int GetNumEdges() const = 0;
+       virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const = 0;
+       virtual void GetVertex(int i,SimdPoint3& vtx) const = 0;
+       virtual int     GetNumPlanes() const = 0;
+       virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const = 0;
+//     virtual int GetIndex(int i) const = 0 ; 
+
+       virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const = 0;
+       
+};
+
+#endif //BU_SHAPE
diff --git a/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.cpp b/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.cpp
new file mode 100644 (file)
index 0000000..8a3833c
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "Simplex1to4Shape.h"
+#include "SimdMatrix3x3.h"
+
+BU_Simplex1to4::BU_Simplex1to4()
+:m_numVertices(0)
+{
+}
+
+BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0)
+:m_numVertices(0)
+{
+       AddVertex(pt0);
+}
+
+BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1)
+:m_numVertices(0)
+{
+       AddVertex(pt0);
+       AddVertex(pt1);
+}
+
+BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2)
+:m_numVertices(0)
+{
+       AddVertex(pt0);
+       AddVertex(pt1);
+       AddVertex(pt2);
+}
+
+BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2,const SimdPoint3& pt3)
+:m_numVertices(0)
+{
+       AddVertex(pt0);
+       AddVertex(pt1);
+       AddVertex(pt2);
+       AddVertex(pt3);
+}
+
+
+
+
+
+void BU_Simplex1to4::AddVertex(const SimdPoint3& pt)
+{
+       m_vertices[m_numVertices++] = pt;
+}
+
+
+int    BU_Simplex1to4::GetNumVertices() const
+{
+       return m_numVertices;
+}
+
+int BU_Simplex1to4::GetNumEdges() const
+{
+       //euler formula, F-E+V = 2, so E = F+V-2
+
+       switch (m_numVertices)
+       {
+       case 0:
+               return 0;
+       case 1: return 0;
+       case 2: return 1;
+       case 3: return 3;
+       case 4: return 6;
+
+
+       }
+
+       return 0;
+}
+
+void BU_Simplex1to4::GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const
+{
+       
+    switch (m_numVertices)
+       {
+
+       case 2: 
+               pa = m_vertices[0];
+               pb = m_vertices[1];
+               break;
+       case 3:  
+               switch (i)
+               {
+               case 0:
+                       pa = m_vertices[0];
+                       pb = m_vertices[1];
+                       break;
+               case 1:
+                       pa = m_vertices[1];
+                       pb = m_vertices[2];
+                       break;
+               case 2:
+                       pa = m_vertices[2];
+                       pb = m_vertices[0];
+                       break;
+
+               }
+               break;
+       case 4: 
+               switch (i)
+               {
+               case 0:
+                       pa = m_vertices[0];
+                       pb = m_vertices[1];
+                       break;
+               case 1:
+                       pa = m_vertices[1];
+                       pb = m_vertices[2];
+                       break;
+               case 2:
+                       pa = m_vertices[2];
+                       pb = m_vertices[0];
+                       break;
+               case 3:
+                       pa = m_vertices[0];
+                       pb = m_vertices[3];
+                       break;
+               case 4:
+                       pa = m_vertices[1];
+                       pb = m_vertices[3];
+                       break;
+               case 5:
+                       pa = m_vertices[2];
+                       pb = m_vertices[3];
+                       break;
+               }
+
+       }
+
+
+
+
+}
+
+void BU_Simplex1to4::GetVertex(int i,SimdPoint3& vtx) const
+{
+       vtx = m_vertices[i];
+}
+
+int    BU_Simplex1to4::GetNumPlanes() const
+{
+       switch (m_numVertices)
+       {
+       case 0:
+                       return 0;
+       case 1:
+                       return 0;
+       case 2:
+                       return 0;
+       case 3:
+                       return 2;
+       case 4:
+                       return 4;
+       default:
+               {
+               }
+       }
+       return 0;
+}
+
+
+void BU_Simplex1to4::GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const
+{
+       
+}
+
+int BU_Simplex1to4::GetIndex(int i) const
+{
+       return 0;
+}
+
+bool BU_Simplex1to4::IsInside(const SimdPoint3& pt,SimdScalar tolerance) const
+{
+       return false;
+}
+
diff --git a/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.h b/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.h
new file mode 100644 (file)
index 0000000..8feb995
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef BU_SIMPLEX_1TO4_SHAPE
+#define BU_SIMPLEX_1TO4_SHAPE
+
+
+#include <CollisionShapes/PolyhedralConvexShape.h>
+#include "BroadphaseCollision/BroadphaseProxy.h"
+
+
+///BU_Simplex1to4 implements feature based and implicit simplex of up to 4 vertices (tetrahedron, triangle, line, vertex).
+class BU_Simplex1to4 : public PolyhedralConvexShape
+{
+protected:
+
+       int     m_numVertices;
+       SimdPoint3      m_vertices[4];
+
+public:
+       BU_Simplex1to4();
+
+       BU_Simplex1to4(const SimdPoint3& pt0);
+       BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1);
+       BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2);
+       BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2,const SimdPoint3& pt3);
+
+    
+       void    Reset()
+       {
+               m_numVertices = 0;
+       }
+       
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+       {
+               inertia = SimdVector3(1.f,1.f,1.f);
+       }
+
+       virtual int     GetShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; }
+
+       void AddVertex(const SimdPoint3& pt);
+
+       //PolyhedralConvexShape interface
+
+       virtual int     GetNumVertices() const;
+
+       virtual int GetNumEdges() const;
+
+       virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const;
+       
+       virtual void GetVertex(int i,SimdPoint3& vtx) const;
+
+       virtual int     GetNumPlanes() const;
+
+       virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const;
+
+       virtual int GetIndex(int i) const;
+
+       virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const;
+
+
+       ///GetName is for debugging
+       virtual  char*  GetName()const { return "BU_Simplex1to4";}
+
+};
+
+#endif //BU_SIMPLEX_1TO4_SHAPE
diff --git a/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp b/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp
new file mode 100644 (file)
index 0000000..182b458
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#include "SphereShape.h"
+#include "NarrowPhaseCollision/CollisionMargin.h"
+
+#include "SimdQuaternion.h"
+
+
+SphereShape ::SphereShape (SimdScalar radius)
+: m_radius(radius)
+{
+       SetMargin( radius );
+}
+
+SimdVector3    SphereShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+{
+       return SimdVector3(0.f,0.f,0.f);
+}
+
+SimdVector3    SphereShape::LocalGetSupportingVertex(const SimdVector3& vec)const
+{
+       SimdScalar len = vec.length2();
+       if (fabsf(len) < 0.0001f)
+       {
+               return SimdVector3(GetMargin(),GetMargin(),GetMargin());
+       } 
+       return vec *  (GetMargin() / sqrtf(len));
+}
+
+
+void SphereShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const
+{
+       const SimdVector3& center = t.getOrigin();
+       SimdScalar radius = m_radius + CONVEX_DISTANCE_MARGIN;
+       radius += 1;
+
+       const SimdVector3 extent(radius,radius,radius);
+
+       aabbMin = center - extent;
+       aabbMax = center + extent;
+}
+
+
+
+void   SphereShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+{
+  SimdScalar elem = 0.4f * mass * m_radius*m_radius;
+       inertia[0] = inertia[1] = inertia[2] = elem;
+}
\ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/SphereShape.h b/extern/bullet/Bullet/CollisionShapes/SphereShape.h
new file mode 100644 (file)
index 0000000..6765c59
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef SPHERE_MINKOWSKI_H
+#define SPHERE_MINKOWSKI_H
+
+#include "ConvexShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+
+///SphereShape implements an implicit (getSupportingVertex) Sphere
+class SphereShape : public ConvexShape
+
+{
+       SimdScalar m_radius;
+
+public:
+       SphereShape (SimdScalar radius);
+       
+       
+       virtual SimdVector3     LocalGetSupportingVertex(const SimdVector3& vec)const;
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
+
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
+
+       virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
+
+       virtual int     GetShapeType() const { return SPHERE_SHAPE_PROXYTYPE; }
+
+       SimdScalar      GetRadius() { return m_radius;}
+
+       //debugging
+       virtual char*   GetName()const {return "SPHERE";}
+
+};
+
+
+#endif //SPHERE_MINKOWSKI_H
diff --git a/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.cpp b/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.cpp
new file mode 100644 (file)
index 0000000..bb0e7e2
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "StridingMeshInterface.h"
+
+StridingMeshInterface::~StridingMeshInterface()
+{
+
+}
\ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.h b/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.h
new file mode 100644 (file)
index 0000000..3bdcd7e
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef STRIDING_MESHINTERFACE_H
+#define STRIDING_MESHINTERFACE_H
+
+#include "SimdVector3.h"
+
+/// PHY_ScalarType enumerates possible scalar types.
+/// See the StridingMeshInterface for its use
+typedef enum PHY_ScalarType {
+       PHY_FLOAT,
+       PHY_DOUBLE,
+       PHY_INTEGER,
+       PHY_SHORT,
+       PHY_FIXEDPOINT88
+} PHY_ScalarType;
+
+///    StridingMeshInterface is the interface class for high performance access to triangle meshes
+/// It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory.
+class  StridingMeshInterface
+{
+       protected:
+       
+               SimdVector3 m_scaling;
+
+       public:
+               StridingMeshInterface() :m_scaling(1.f,1.f,1.f)
+               {
+                       
+               }
+
+               virtual ~StridingMeshInterface();
+               /// get read and write access to a subpart of a triangle mesh
+               /// this subpart has a continuous array of vertices and indices
+               /// in this way the mesh can be handled as chunks of memory with striding
+               /// very similar to OpenGL vertexarray support
+               /// make a call to unLockVertexBase when the read and write access is finished  
+       virtual void    getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0)=0;
+               
+
+               /// unLockVertexBase finishes the access to a subpart of the triangle mesh
+               /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
+               virtual void    unLockVertexBase(int subpart)=0;
+
+               /// getNumSubParts returns the number of seperate subparts
+               /// each subpart has a continuous array of vertices and indices
+               virtual int             getNumSubParts()=0;
+
+               virtual void    preallocateVertices(int numverts)=0;
+               virtual void    preallocateIndices(int numindices)=0;
+
+               const SimdVector3&      getScaling() {
+                       return m_scaling;
+               }
+               void    setScaling(const SimdVector3& scaling)
+               {
+                       m_scaling = scaling;
+               }
+};
+
+#endif //STRIDING_MESHINTERFACE_H
diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleCallback.h b/extern/bullet/Bullet/CollisionShapes/TriangleCallback.h
new file mode 100644 (file)
index 0000000..67d9556
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef TRIANGLE_CALLBACK_H
+#define TRIANGLE_CALLBACK_H
+
+#include "SimdVector3.h"
+
+
+class TriangleCallback
+{
+public:
+
+       virtual ~TriangleCallback();
+       virtual void ProcessTriangle(SimdVector3* triangle) = 0;
+};
+
+#endif //TRIANGLE_CALLBACK_H
diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMesh.cpp b/extern/bullet/Bullet/CollisionShapes/TriangleMesh.cpp
new file mode 100644 (file)
index 0000000..b528a93
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "TriangleMesh.h"
+#include <assert.h>
+
+static int     myindices[3] = {0,1,2};
+
+TriangleMesh::TriangleMesh ()
+{
+
+}
+
+void   TriangleMesh::getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart)
+{
+       numverts = 3;
+       *vertexbase = (unsigned char*)&m_triangles[subpart];
+       type = PHY_FLOAT;
+       stride = sizeof(SimdVector3);
+
+
+       numfaces = 1;
+       *indexbase = (unsigned char*) &myindices[0];
+       indicestype = PHY_INTEGER;
+       indexstride = sizeof(int);
+
+}
+
+int            TriangleMesh::getNumSubParts()
+{
+       return m_triangles.size();
+}
diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMesh.h b/extern/bullet/Bullet/CollisionShapes/TriangleMesh.h
new file mode 100644 (file)
index 0000000..6701ccb
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#ifndef TRIANGLE_MESH_H
+#define TRIANGLE_MESH_H
+
+#include "CollisionShapes/StridingMeshInterface.h"
+#include <vector>
+#include <SimdVector3.h>
+
+struct MyTriangle
+{
+       SimdVector3     m_vert0;
+       SimdVector3     m_vert1;
+       SimdVector3     m_vert2;
+};
+
+///TriangleMesh provides storage for a concave triangle mesh. It can be used as data for the TriangleMeshShape.
+class TriangleMesh : public StridingMeshInterface
+{
+       std::vector<MyTriangle> m_triangles;
+
+       public:
+               TriangleMesh ();
+
+               void    AddTriangle(const SimdVector3& vertex0,const SimdVector3& vertex1,const SimdVector3& vertex2)
+               {
+                       MyTriangle tri;
+                       tri.m_vert0 = vertex0;
+                       tri.m_vert1 = vertex1;
+                       tri.m_vert2 = vertex2;
+                       m_triangles.push_back(tri);
+               }
+
+
+//StridingMeshInterface interface implementation
+
+               virtual void    getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0);
+
+               /// unLockVertexBase finishes the access to a subpart of the triangle mesh
+               /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
+               virtual void    unLockVertexBase(int subpart) {}
+
+               /// getNumSubParts returns the number of seperate subparts
+               /// each subpart has a continuous array of vertices and indices
+               virtual int             getNumSubParts();
+               
+               virtual void    preallocateVertices(int numverts){}
+               virtual void    preallocateIndices(int numindices){}
+
+
+
+};
+
+#endif //TRIANGLE_MESH_H
\ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.cpp b/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.cpp
new file mode 100644 (file)
index 0000000..996c740
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#include "TriangleMeshShape.h"
+#include "SimdVector3.h"
+#include "SimdQuaternion.h"
+#include "StridingMeshInterface.h"
+#include "AabbUtil2.h"
+
+
+
+TriangleMeshShape::TriangleMeshShape(StridingMeshInterface* meshInterface)
+: m_meshInterface(meshInterface)
+{
+}
+
+TriangleMeshShape::~TriangleMeshShape()
+{
+               
+}
+
+
+
+
+void TriangleMeshShape::GetAabb(const SimdTransform& trans,SimdVector3& aabbMin,SimdVector3& aabbMax) const
+{
+       SimdScalar margin = 0.5f;
+       for (int i=0;i<3;i++)
+       {
+               SimdVector3 vec(0.f,0.f,0.f);
+               vec[i] = 1.f;
+               SimdVector3 tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis()));
+               aabbMax[i] = tmp[i]+margin;
+               vec[i] = -1.f;
+               tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis()));
+               aabbMin[i] = tmp[i]-margin;
+       }
+}
+
+
+TriangleCallback::~TriangleCallback()
+{
+
+}
+
+class SupportVertexCallback : public TriangleCallback
+{
+
+       SimdVector3 m_supportVertexLocal;
+public:
+
+       SimdTransform   m_worldTrans;
+       SimdScalar m_maxDot;
+       SimdVector3 m_supportVecLocal;
+
+       SupportVertexCallback(const SimdVector3& supportVecWorld,const SimdTransform& trans)
+               : m_supportVertexLocal(0.f,0.f,0.f), m_worldTrans(trans) ,m_maxDot(-1e30f)
+               
+       {
+               m_supportVecLocal = supportVecWorld * m_worldTrans.getBasis();
+       }
+
+       virtual void ProcessTriangle( SimdVector3* triangle)
+       {
+               for (int i=0;i<3;i++)
+               {
+                       SimdScalar dot = m_supportVecLocal.dot(triangle[i]);
+                       if (dot > m_maxDot)
+                       {
+                               m_maxDot = dot;
+                               m_supportVertexLocal = triangle[i];
+                       }
+               }
+       }
+
+       SimdVector3 GetSupportVertexWorldSpace()
+       {
+               return m_worldTrans(m_supportVertexLocal);
+       }
+
+       SimdVector3     GetSupportVertexLocal()
+       {
+               return m_supportVertexLocal;
+       }
+
+};
+
+       
+void TriangleMeshShape::setLocalScaling(const SimdVector3& scaling)
+{
+       m_meshInterface->setScaling(scaling);
+}
+
+void   TriangleMeshShape::ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const
+{
+
+       SimdVector3 meshScaling = m_meshInterface->getScaling();
+       int numtotalphysicsverts = 0;
+       int part,graphicssubparts = m_meshInterface->getNumSubParts();
+       for (part=0;part<graphicssubparts ;part++)
+       {
+               unsigned char * vertexbase;
+               unsigned char * indexbase;
+               int indexstride;
+               PHY_ScalarType type;
+               PHY_ScalarType gfxindextype;
+               int stride,numverts,numtriangles;
+               m_meshInterface->getLockedVertexIndexBase(&vertexbase,numverts,type,stride,&indexbase,indexstride,numtriangles,gfxindextype,part);
+               numtotalphysicsverts+=numtriangles*3; //upper bound
+
+       
+               int gfxindex;
+               SimdVector3 triangle[3];
+
+               for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
+               {
+               
+                       int     graphicsindex=0;
+
+                       for (int j=2;j>=0;j--)
+                       {
+                               ASSERT(gfxindextype == PHY_INTEGER);
+                               int* gfxbase = (int*)(indexbase+gfxindex*indexstride);
+                               graphicsindex = gfxbase[j];
+                               float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
+
+                               triangle[j] = SimdVector3(
+                                       graphicsbase[0]*meshScaling.getX(),
+                                       graphicsbase[1]*meshScaling.getY(),
+                                       graphicsbase[2]*meshScaling.getZ());
+                       }
+
+                       if (TestTriangleAgainstAabb2(&triangle[0],aabbMin,aabbMax))
+                       {
+                               //check aabb in triangle-space, before doing this
+                               callback->ProcessTriangle(triangle);
+                       }
+                       
+               }
+               
+               m_meshInterface->unLockVertexBase(part);
+       }
+
+
+}
+
+
+
+
+
+void   TriangleMeshShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+{
+       //moving concave objects not supported
+       assert(0);
+       inertia.setValue(0.f,0.f,0.f);
+}
+
+
+SimdVector3 TriangleMeshShape::LocalGetSupportingVertex(const SimdVector3& vec) const
+{
+       SimdVector3 supportVertex;
+
+       SimdTransform ident;
+       ident.setIdentity();
+
+       SupportVertexCallback supportCallback(vec,ident);
+
+       SimdVector3 aabbMax(1e30f,1e30f,1e30f);
+       
+       ProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
+               
+       supportVertex = supportCallback.GetSupportVertexLocal();
+
+       return supportVertex;
+}
diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.h b/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.h
new file mode 100644 (file)
index 0000000..ecd9cc5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef TRIANGLE_MESH_SHAPE_H
+#define TRIANGLE_MESH_SHAPE_H
+
+#include "CollisionShapes/CollisionShape.h"
+#include "BroadphaseCollision/BroadphaseProxy.h" // for the types
+
+#include "StridingMeshInterface.h"
+#include "TriangleCallback.h"
+
+
+
+///Concave triangle mesh. Uses an interface to access the triangles to allow for sharing graphics/physics triangles.
+class TriangleMeshShape : public CollisionShape
+{
+
+       StridingMeshInterface* m_meshInterface;
+       
+public:
+       TriangleMeshShape(StridingMeshInterface* meshInterface);
+
+       virtual ~TriangleMeshShape();
+
+
+       
+       virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec) const;
+
+       virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
+       {
+               assert(0);
+               return LocalGetSupportingVertex(vec);
+       }
+
+       virtual int     GetShapeType() const
+       {
+               return TRIANGLE_MESH_SHAPE_PROXYTYPE;
+       }
+
+       virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
+
+       void    ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const;
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
+
+       virtual void    setLocalScaling(const SimdVector3& scaling);
+       
+
+       //debugging
+       virtual char*   GetName()const {return "TRIANGLEMESH";}
+
+
+};
+
+#endif //TRIANGLE_MESH_SHAPE_H
diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleShape.h b/extern/bullet/Bullet/CollisionShapes/TriangleShape.h
new file mode 100644 (file)
index 0000000..58f83a8
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+#ifndef OBB_TRIANGLE_MINKOWSKI_H
+#define OBB_TRIANGLE_MINKOWSKI_H
+
+#include "ConvexShape.h"
+#include "CollisionShapes/BoxShape.h"
+
+class TriangleShape : public PolyhedralConvexShape
+{
+
+
+public:
+
+       SimdVector3     m_vertices1[3];
+
+
+       virtual int GetNumVertices() const
+       {
+               return 3;
+       }
+
+       const SimdVector3& GetVertexPtr(int index) const
+       {
+               return m_vertices1[index];
+       }
+       virtual void GetVertex(int index,SimdVector3& vert) const
+       {
+               vert = m_vertices1[index];
+       }
+       virtual int     GetShapeType() const
+       {
+               return TRIANGLE_SHAPE_PROXYTYPE;
+       }
+
+       virtual int GetNumEdges() const
+       {
+               return 3;
+       }
+       
+       virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const
+       {
+               GetVertex(i,pa);
+               GetVertex((i+1)%3,pb);
+       }
+
+       virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax)const 
+       {
+//             ASSERT(0);
+               GetAabbSlow(t,aabbMin,aabbMax);
+       }
+
+       SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& dir)const 
+       {
+               SimdVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
+               return m_vertices1[dots.maxAxis()];
+
+       }
+
+
+       TriangleShape(const SimdVector3& p0,const SimdVector3& p1,const SimdVector3& p2)
+       {
+               m_vertices1[0] = p0;
+               m_vertices1[1] = p1;
+               m_vertices1[2] = p2;
+       }
+
+       
+
+       virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const
+       {
+               GetPlaneEquation(i,planeNormal,planeSupport);
+       }
+
+       virtual int     GetNumPlanes() const
+       {
+               return 1;
+       }
+
+       void CalcNormal(SimdVector3& normal) const
+       {
+               normal = (m_vertices1[1]-m_vertices1[0]).cross(m_vertices1[2]-m_vertices1[0]);
+               normal.normalize();
+       }
+
+       virtual void GetPlaneEquation(int i, SimdVector3& planeNormal,SimdPoint3& planeSupport) const
+       {
+               CalcNormal(planeNormal);
+               planeSupport = m_vertices1[0];
+       }
+
+       virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
+       {
+               ASSERT(0);
+               inertia.setValue(0.f,0.f,0.f);
+       }
+
+               virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const
+       {
+               SimdVector3 normal;
+               CalcNormal(normal);
+               //distance to plane
+               SimdScalar dist = pt.dot(normal);
+               SimdScalar planeconst = m_vertices1[0].dot(normal);
+               dist -= planeconst;
+               if (dist >= -tolerance && dist <= tolerance)
+               {
+                       //inside check on edge-planes
+                       int i;
+                       for (i=0;i<3;i++)
+                       {
+                               SimdPoint3 pa,pb;
+                               GetEdge(i,pa,pb);
+                               SimdVector3 edge = pb-pa;
+                               SimdVector3 edgeNormal = edge.cross(normal);
+                               edgeNormal.normalize();
+                               SimdScalar dist = pt.dot( edgeNormal);
+                               SimdScalar edgeConst = pa.dot(edgeNormal);
+                               dist -= edgeConst;
+                               if (dist < -tolerance)
+                                       return false;
+                       }
+                       
+                       return true;
+               }
+
+               return false;
+       }
+               //debugging
+               virtual char*   GetName()const
+               {
+                       return "Triangle";
+               }
+
+
+};
+
+#endif //OBB_TRIANGLE_MINKOWSKI_H
\ No newline at end of file
diff --git a/extern/bullet/Bullet/Doxyfile b/extern/bullet/Bullet/Doxyfile
new file mode 100644 (file)
index 0000000..94d1d3c
--- /dev/null
@@ -0,0 +1,746 @@
+# Doxyfile 1.2.4
+
+# This file describes the settings to be used by doxygen for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project. 
+PROJECT_NAME           = Continuous Collision Detection Library
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = 
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, 
+# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian, 
+# Polish, Portuguese and Slovene.
+
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES 
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation. 
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation. 
+
+EXTRACT_STATIC         = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled. 
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled. 
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this. 
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed. 
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description. 
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used. 
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation. 
+
+INTERNAL_DOCS          = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a class diagram (in Html and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. 
+
+CLASS_DIAGRAMS         = YES
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation. 
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible. 
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden. 
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this. 
+
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file. 
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description. 
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements. 
+
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members. 
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order. 
+
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments. 
+
+TAB_SIZE               = 8
+
+# The ENABLE_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif. 
+
+ENABLED_SECTIONS       = 
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines. 
+
+ALIASES                = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used. 
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used. 
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled. 
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. 
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr. 
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces. 
+
+INPUT                  = .
+
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included. 
+
+FILE_PATTERNS          = *.h *.cpp *.c
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used. 
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag. 
+
+EXCLUDE                = 
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. 
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command). 
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included. 
+
+EXAMPLE_PATTERNS       = 
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command). 
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output. 
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse. 
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces. 
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20]) 
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers. 
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output. 
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path. 
+
+HTML_OUTPUT            = html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet 
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used. 
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation. 
+
+GENERATE_HTMLHELP      = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it. 
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation. 
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side pannel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Netscape 4.0+ 
+# or Internet explorer 4.0+). 
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown. 
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output. 
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path. 
+
+LATEX_OUTPUT           = latex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general. 
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used. 
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output. 
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing! 
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer. 
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation. 
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML. 
+
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path. 
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general. 
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using a WORD or other. 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links. 
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value. 
+
+RTF_STYLESHEET_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages 
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path. 
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3) 
+
+MAN_EXTENSION          = .3
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Warning: This feature 
+# is still experimental and very incomplete.
+
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files. 
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES. 
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags. 
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found. 
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor. 
+
+INCLUDE_PATH           = ../../generic/extern
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used. 
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. 
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition. 
+
+EXPAND_AS_DEFINED      = 
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles. 
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads. 
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed. 
+
+ALLEXTERNALS           = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl'). 
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default) 
+
+HAVE_DOT               = YES
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes. 
+
+COLLABORATION_GRAPH    = YES
+
+# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to 
+# YES then doxygen will generate a graph for each documented file showing 
+# the direct and indirect include dependencies of the file with other 
+# documented files. 
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to 
+# YES then doxygen will generate a graph for each documented header file showing 
+# the documented files that directly or indirectly include this file 
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one. 
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path. 
+
+DOT_PATH               = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images. 
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images. 
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs. 
+
+GENERATE_LEGEND        = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored. 
+
+SEARCHENGINE           = NO
+
+# The CGI_NAME tag should be the name of the CGI script that 
+# starts the search engine (doxysearch) with the correct parameters. 
+# A script with this name will be generated by doxygen. 
+
+CGI_NAME               = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the 
+# cgi binaries are located. See the documentation of your http daemon for 
+# details. 
+
+CGI_URL                = 
+
+# The DOC_URL tag should be the absolute URL to the directory where the 
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used. 
+
+DOC_URL                = 
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the 
+# documentation is located. If left blank the directory on the local machine 
+# will be used. 
+
+DOC_ABSPATH            = 
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
+# is installed. 
+
+BIN_ABSPATH            = c:\program files\doxygen\bin
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search 
+# the documentation for these projects as well. 
+
+EXT_DOC_PATHS          = 
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.cpp
new file mode 100644 (file)
index 0000000..8253e61
--- /dev/null
@@ -0,0 +1,355 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#include "BU_AlgebraicPolynomialSolver.h"
+#include <math.h>
+#include <SimdMinMax.h>
+
+int BU_AlgebraicPolynomialSolver::Solve2Quadratic(SimdScalar p, SimdScalar q) 
+{ 
+
+       SimdScalar basic_h_local;
+       SimdScalar basic_h_local_delta;
+       
+       basic_h_local       = p * 0.5f; 
+   basic_h_local_delta = basic_h_local * basic_h_local - q; 
+   if (basic_h_local_delta > 0.0f)  { 
+      basic_h_local_delta = sqrtf(basic_h_local_delta); 
+      m_roots[0]  = - basic_h_local + basic_h_local_delta; 
+      m_roots[1]  = - basic_h_local - basic_h_local_delta; 
+      return 2; 
+   } 
+   else if (SimdGreaterEqual(basic_h_local_delta, SIMD_EPSILON)) { 
+      m_roots[0]  = - basic_h_local; 
+      return 1; 
+   } 
+   else { 
+      return 0; 
+   } 
+ }
+
+
+int BU_AlgebraicPolynomialSolver::Solve2QuadraticFull(SimdScalar a,SimdScalar b, SimdScalar c) 
+{ 
+    SimdScalar radical = b * b - 4.0f * a * c;
+    if(radical >= 0.f)
+    {
+        SimdScalar sqrtRadical = sqrtf(radical); 
+        SimdScalar idenom = 1.0f/(2.0f * a);
+        m_roots[0]=(-b + sqrtRadical) * idenom;
+        m_roots[1]=(-b - sqrtRadical) * idenom;
+               return 2;
+       }
+       return 0;
+}
+
+
+#define cubic_rt(x) \
+ ((x) > 0.0f ? powf((SimdScalar)(x), 0.333333333333333333333333f) : \
+  ((x) < 0.0f ? -powf((SimdScalar)-(x), 0.333333333333333333333333f) : 0.0f))
+
+
+
+/*                                                                           */
+/* this function solves the following cubic equation:                        */
+/*                                                                           */
+/*              3          2                                                */
+/*      lead * x   +  a * x   +  b * x  +  c  =  0.                          */
+/*                                                                           */
+/* it returns the number of different roots found, and stores the roots in   */
+/* roots[0,2]. it returns -1 for a degenerate equation 0 = 0.                */
+/*                                                                           */
+int BU_AlgebraicPolynomialSolver::Solve3Cubic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c)
+{ 
+   SimdScalar p, q, r;
+   SimdScalar delta, u, phi;
+   SimdScalar dummy;
+
+   if (lead != 1.0) {
+      /*                                                                     */
+      /* transform into normal form: x^3 + a x^2 + b x + c = 0               */
+      /*                                                                     */
+      if (SimdEqual(lead, SIMD_EPSILON)) {
+         /*                                                                  */
+         /* we have  a x^2 + b x + c = 0                                     */
+         /*                                                                  */
+         if (SimdEqual(a, SIMD_EPSILON)) {
+            /*                                                               */
+            /* we have  b x + c = 0                                          */
+            /*                                                               */
+            if (SimdEqual(b, SIMD_EPSILON)) {
+               if (SimdEqual(c, SIMD_EPSILON)) {
+                  return -1;
+               }
+               else {
+                  return 0;
+               }
+            }
+            else {
+               m_roots[0] = -c / b;
+               return 1;
+            }
+         }
+         else {
+            p = c / a;
+            q = b / a;
+            return Solve2QuadraticFull(a,b,c);
+         }
+      }
+      else {
+         a = a / lead;
+         b = b / lead;
+         c = c / lead;
+      }
+   }
+               
+   /*                                                                        */
+   /* we substitute  x = y - a / 3  in order to eliminate the quadric term.  */
+   /* we get   x^3 + p x + q = 0                                             */
+   /*                                                                        */
+   a /= 3.0f;
+   u  = a * a;
+   p  = b / 3.0f - u;
+   q  = a * (2.0f * u - b) + c;
+
+   /*                                                                        */
+   /* now use Cardano's formula                                              */
+   /*                                                                        */
+   if (SimdEqual(p, SIMD_EPSILON)) {
+      if (SimdEqual(q, SIMD_EPSILON)) {
+         /*                                                                  */
+         /* one triple root                                                  */
+         /*                                                                  */
+         m_roots[0] = -a;
+         return 1;
+      }
+      else {
+         /*                                                                  */
+         /* one real and two complex roots                                   */
+         /*                                                                  */
+         m_roots[0] = cubic_rt(-q) - a;
+         return 1;
+      }
+   }
+
+   q /= 2.0f;
+   delta = p * p * p + q * q;
+   if (delta > 0.0f) {
+      /*                                                                     */
+      /* one real and two complex roots. note that  v = -p / u.              */
+      /*                                                                     */
+      u = -q + sqrtf(delta);
+      u = cubic_rt(u);
+      m_roots[0] = u - p / u - a;
+      return 1;
+   }
+   else if (delta < 0.0) {
+      /*                                                                     */
+      /* Casus irreducibilis: we have three real roots                       */
+      /*                                                                     */
+      r        = sqrtf(-p);
+      p       *= -r;
+      r       *= 2.0;
+      phi      = acosf(-q / p) / 3.0f;
+      dummy    = SIMD_2_PI / 3.0f; 
+      m_roots[0] = r * cosf(phi) - a;
+      m_roots[1] = r * cosf(phi + dummy) - a;
+      m_roots[2] = r * cosf(phi - dummy) - a;
+      return 3;
+   }
+   else {
+      /*                                                                     */
+      /* one single and one SimdScalar root                                      */
+      /*                                                                     */
+      r = cubic_rt(-q);
+      m_roots[0] = 2.0f * r - a;
+      m_roots[1] = -r - a;
+      return 2;
+   }
+}
+
+
+/*                                                                           */
+/* this function solves the following quartic equation:                      */
+/*                                                                           */
+/*             4           3          2                                      */
+/*     lead * x   +  a *  x   +  b * x   +  c * x  +  d = 0.                 */
+/*                                                                           */
+/* it returns the number of different roots found, and stores the roots in   */
+/* roots[0,3]. it returns -1 for a degenerate equation 0 = 0.                */
+/*                                                                           */
+int BU_AlgebraicPolynomialSolver::Solve4Quartic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c, SimdScalar d)
+{ 
+   SimdScalar p, q ,r;
+   SimdScalar u, v, w;
+   int i, num_roots, num_tmp;
+   //SimdScalar tmp[2];
+
+   if (lead != 1.0) {
+      /*                                                                     */
+      /* transform into normal form: x^4 + a x^3 + b x^2 + c x + d = 0       */
+      /*                                                                     */
+      if (SimdEqual(lead, SIMD_EPSILON)) {
+         /*                                                                  */
+         /* we have  a x^3 + b x^2 + c x + d = 0                             */
+         /*                                                                  */
+         if (SimdEqual(a, SIMD_EPSILON)) { 
+            /*                                                               */
+            /* we have  b x^2 + c x + d = 0                                  */
+            /*                                                               */
+            if (SimdEqual(b, SIMD_EPSILON)) {
+               /*                                                            */
+               /* we have  c x + d = 0                                       */
+               /*                                                            */
+               if (SimdEqual(c, SIMD_EPSILON)) {
+                  if (SimdEqual(d, SIMD_EPSILON)) {
+                     return -1;
+                  }
+                  else {
+                     return 0;
+                  }
+               }
+               else {
+                  m_roots[0] = -d / c;
+                  return 1;
+               }
+            }
+            else {
+               p = c / b;
+               q = d / b;
+               return Solve2QuadraticFull(b,c,d);
+               
+            }
+         }
+         else { 
+            return Solve3Cubic(1.0, b / a, c / a, d / a);
+         }
+      }
+      else {
+         a = a / lead;
+         b = b / lead;
+         c = c / lead;
+         d = d / lead;
+      }
+   }
+
+   /*                                                                        */
+   /* we substitute  x = y - a / 4  in order to eliminate the cubic term.    */
+   /* we get:  y^4 + p y^2 + q y + r = 0.                                    */
+   /*                                                                        */
+   a /= 4.0f;
+   p  = b - 6.0f * a * a;
+   q  = a * (8.0f * a * a - 2.0f * b) + c;
+   r  = a * (a * (b - 3.f * a * a) - c) + d;
+   if (SimdEqual(q, SIMD_EPSILON)) {
+      /*                                                                     */
+      /* biquadratic equation:  y^4 + p y^2 + r = 0.                         */
+      /*                                                                     */
+      num_roots = Solve2Quadratic(p, r);
+      if (num_roots > 0) {                 
+         if (m_roots[0] > 0.0f) {
+            if (num_roots > 1)  {
+               if ((m_roots[1] > 0.0f)  &&  (m_roots[1] != m_roots[0])) {
+                  u        = sqrtf(m_roots[1]);
+                  m_roots[2] =  u - a;
+                  m_roots[3] = -u - a;
+                  u        = sqrtf(m_roots[0]);
+                  m_roots[0] =  u - a;
+                  m_roots[1] = -u - a;
+                  return 4;
+               }
+               else {
+                  u        = sqrtf(m_roots[0]);
+                  m_roots[0] =  u - a;
+                  m_roots[1] = -u - a;
+                  return 2;
+               }
+            }
+            else {
+               u        = sqrtf(m_roots[0]);
+               m_roots[0] =  u - a;
+               m_roots[1] = -u - a;
+               return 2;
+            }
+         }
+      }
+      return 0;
+   }
+   else if (SimdEqual(r, SIMD_EPSILON)) {
+      /*                                                                     */
+      /* no absolute term:  y (y^3 + p y + q) = 0.                           */
+      /*                                                                     */
+      num_roots = Solve3Cubic(1.0, 0.0, p, q);
+      for (i = 0;  i < num_roots;  ++i)  m_roots[i] -= a;
+      if (num_roots != -1) {
+         m_roots[num_roots] = -a;
+         ++num_roots;
+      }
+      else {
+         m_roots[0]  = -a;
+         num_roots = 1;;
+      }
+      return num_roots;
+   }
+   else {
+      /*                                                                     */
+      /* we solve the resolvent cubic equation                               */
+      /*                                                                     */
+      num_roots = Solve3Cubic(1.0f, -0.5f * p, -r, 0.5f * r * p - 0.125f * q * q);
+      if (num_roots == -1) {
+         num_roots = 1;
+         m_roots[0]  = 0.0f;
+      }
+
+      /*                                                                     */
+      /* build two quadric equations                                         */
+      /*                                                                     */
+      w = m_roots[0];
+      u = w * w - r;
+      v = 2.0f * w - p;
+
+      if (SimdEqual(u, SIMD_EPSILON))
+         u = 0.0;
+      else if (u > 0.0f)
+         u = sqrtf(u);
+      else
+         return 0;
+      
+      if (SimdEqual(v, SIMD_EPSILON))
+         v = 0.0;
+      else if (v > 0.0f)
+         v = sqrtf(v);
+      else
+         return 0;
+
+      if (q < 0.0f)  v = -v;
+      w -= u;
+      num_roots=Solve2Quadratic(v, w);
+      for (i = 0;  i < num_roots;  ++i)  
+         {
+                 m_roots[i] -= a;
+         }
+      w += 2.0f *u;
+         SimdScalar tmp[2];
+         tmp[0] = m_roots[0];
+         tmp[1] = m_roots[1];
+
+      num_tmp = Solve2Quadratic(-v, w);
+      for (i = 0;  i < num_tmp;  ++i)
+         {
+                m_roots[i + num_roots] = tmp[i] - a;
+                m_roots[i]=tmp[i];
+         }
+
+      return  (num_tmp + num_roots);
+   }
+}
+
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.h
new file mode 100644 (file)
index 0000000..32986eb
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#ifndef BU_ALGEBRAIC_POLYNOMIAL_SOLVER_H
+#define BU_ALGEBRAIC_POLYNOMIAL_SOLVER_H
+
+#include "BU_PolynomialSolverInterface.h"
+
+/// BU_AlgebraicPolynomialSolver implements polynomial root finding by analytically solving algebraic equations.
+/// Polynomials up to 4rd degree are supported, Cardano's formula is used for 3rd degree
+class BU_AlgebraicPolynomialSolver : public BUM_PolynomialSolverInterface
+{
+public:
+       BU_AlgebraicPolynomialSolver() {};
+
+       int Solve2Quadratic(SimdScalar p, SimdScalar q);
+       int Solve2QuadraticFull(SimdScalar a,SimdScalar b, SimdScalar c);
+       int     Solve3Cubic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c);
+       int Solve4Quartic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c, SimdScalar d);
+       
+
+       SimdScalar GetRoot(int i) const 
+       {
+               return m_roots[i];
+       }
+
+private:
+       SimdScalar      m_roots[4];
+
+};
+
+#endif //BU_ALGEBRAIC_POLYNOMIAL_SOLVER_H
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.cpp
new file mode 100644 (file)
index 0000000..fa8091a
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#include "BU_Collidable.h"
+#include "CollisionShapes/CollisionShape.h"
+#include <SimdTransform.h>
+#include "BU_MotionStateInterface.h"
+
+BU_Collidable::BU_Collidable(BU_MotionStateInterface& motion,PolyhedralConvexShape& shape,void* userPointer )
+:m_motionState(motion),m_shape(shape),m_userPointer(userPointer)
+{
+}
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.h
new file mode 100644 (file)
index 0000000..7916442
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#ifndef BU_COLLIDABLE
+#define BU_COLLIDABLE
+
+
+class PolyhedralConvexShape;
+class BU_MotionStateInterface;
+#include <SimdPoint3.h>
+
+class BU_Collidable
+{
+public:
+       BU_Collidable(BU_MotionStateInterface& motion,PolyhedralConvexShape& shape, void* userPointer);
+
+       void*           GetUserPointer() const
+       {
+               return m_userPointer;
+       }
+
+       BU_MotionStateInterface&        GetMotionState()
+       {
+               return m_motionState;
+       }
+       inline const BU_MotionStateInterface&   GetMotionState() const
+       {
+               return m_motionState;
+       }
+       
+       inline const PolyhedralConvexShape&     GetShape() const
+       {
+               return m_shape;
+       };
+
+
+private:
+       BU_MotionStateInterface& m_motionState;
+       PolyhedralConvexShape&  m_shape;
+       void*           m_userPointer;
+
+};
+
+#endif //BU_COLLIDABLE
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.cpp
new file mode 100644 (file)
index 0000000..3f60f5d
--- /dev/null
@@ -0,0 +1,576 @@
+
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#include "BU_CollisionPair.h"
+#include "NarrowPhaseCollision/BU_VertexPoly.h"
+#include "NarrowPhaseCollision/BU_EdgeEdge.h"
+#include "BU_Collidable.h"
+
+
+#include "BU_MotionStateInterface.h"
+#include "CollisionShapes/PolyhedralConvexShape.h"
+#include <SimdMinMax.h>
+#include "SimdTransformUtil.h"
+
+
+
+BU_CollisionPair::BU_CollisionPair(const PolyhedralConvexShape* convexA,const PolyhedralConvexShape* convexB,SimdScalar tolerance)
+: m_convexA(convexA),m_convexB(convexB),m_screwing(SimdVector3(0,0,0),SimdVector3(0,0,0)),
+m_tolerance(tolerance)
+{
+
+}
+
+// if there exists a time-of-impact between any feature_pair (edgeA,edgeB),
+// (vertexA,faceB) or (vertexB,faceA) in [0..1], report true and smallest time
+
+
+/*
+bool BU_CollisionPair::GetTimeOfImpact(const SimdVector3& linearMotionA,const SimdQuaternion& angularMotionA,const SimdVector3& linearMotionB,const SimdQuaternion& angularMotionB, SimdScalar& toi,SimdTransform& impactTransA,SimdTransform& impactTransB)
+
+*/
+
+bool BU_CollisionPair::calcTimeOfImpact(
+                                       const SimdTransform& fromA,
+                                       const SimdTransform& toA,
+                                       const SimdTransform& fromB,
+                                       const SimdTransform& toB,
+                                       CastResult& result)
+{
+
+
+
+       
+       SimdVector3 linvelA,angvelA;
+       SimdVector3 linvelB,angvelB;
+
+       SimdTransformUtil::CalculateVelocity(fromA,toA,1.f,linvelA,angvelA);
+       SimdTransformUtil::CalculateVelocity(fromB,toB,1.f,linvelB,angvelB);
+
+
+       SimdVector3 linearMotionA = toA.getOrigin() - fromA.getOrigin();
+       SimdQuaternion angularMotionA(0,0,0,1.f);
+       SimdVector3 linearMotionB = toB.getOrigin() - fromB.getOrigin();
+       SimdQuaternion angularMotionB(0,0,0,1);
+       
+
+
+       result.m_fraction = 1.f;
+
+       SimdTransform impactTransA;
+       SimdTransform impactTransB;
+
+       int index=0;
+
+       SimdScalar toiUnscaled=result.m_fraction;
+       const SimdScalar toiUnscaledLimit = result.m_fraction;
+
+       SimdTransform a2w;
+       a2w = fromA;
+       SimdTransform b2w = fromB;
+
+/* debugging code
+       {
+               const int numvertsB = m_convexB->GetNumVertices();
+               for (int v=0;v<numvertsB;v++)
+               {
+                       SimdPoint3 pt;
+                       m_convexB->GetVertex(v,pt);
+                       pt = b2w * pt;
+                       char buf[1000];
+
+                       if (pt.y() < 0.)
+                       {
+                               sprintf(buf,"PRE ERROR (%d) %.20E %.20E %.20E!!!!!!!!!\n",v,pt.x(),pt.y(),pt.z());
+                               if (debugFile)
+                                       fwrite(buf,1,strlen(buf),debugFile);
+                       } else
+                       {
+                               sprintf(buf,"PRE %d = %.20E,%.20E,%.20E\n",v,pt.x(),pt.y(),pt.z());
+                               if (debugFile)
+                                       fwrite(buf,1,strlen(buf),debugFile);
+
+                       }
+               }
+       }
+*/
+
+
+       SimdTransform b2wp = b2w;
+       
+       b2wp.setOrigin(b2w.getOrigin() + linearMotionB);
+       b2wp.setRotation( b2w.getRotation() + angularMotionB);
+
+       impactTransB = b2wp;
+       
+       SimdTransform a2wp;
+       a2wp.setOrigin(a2w.getOrigin()+ linearMotionA);
+       a2wp.setRotation(a2w.getRotation()+angularMotionA);
+
+       impactTransA = a2wp;
+
+       SimdTransform a2winv;
+       a2winv = a2w.inverse();
+
+       SimdTransform b2wpinv;
+       b2wpinv = b2wp.inverse();
+
+       SimdTransform b2winv;
+       b2winv = b2w.inverse();
+
+       SimdTransform a2wpinv;
+       a2wpinv = a2wp.inverse();
+
+               //Redon's version with concatenated transforms
+
+       SimdTransform relative;
+
+       relative = b2w * b2wpinv * a2wp * a2winv;
+
+       //relative = a2winv * a2wp  * b2wpinv * b2w;
+
+       SimdQuaternion qrel;
+       relative.getBasis().getRotation(qrel);
+
+       SimdVector3 linvel = relative.getOrigin();
+
+       if (linvel.length() < SCREWEPSILON)
+       {
+               linvel.setValue(0.,0.,0.);
+       }
+       SimdVector3 angvel;
+       angvel[0] = 2.f * asinf (qrel[0]);
+       angvel[1] = 2.f * asinf (qrel[1]);
+       angvel[2] = 2.f * asinf (qrel[2]);
+       
+       if (angvel.length() < SCREWEPSILON)
+       {
+               angvel.setValue(0.f,0.f,0.f);
+       }
+
+       //Redon's version with concatenated transforms
+       m_screwing = BU_Screwing(linvel,angvel);
+       
+       SimdTransform w2s;
+       m_screwing.LocalMatrix(w2s);
+
+       SimdTransform s2w;
+       s2w = w2s.inverse();
+
+       //impactTransA = a2w;
+       //impactTransB = b2w;
+
+       bool hit = false;
+       
+       if (SimdFuzzyZero(m_screwing.GetS()) && SimdFuzzyZero(m_screwing.GetW()))
+       {
+               //W = 0 , S = 0 , no collision
+               //toi = 0;
+       /*      
+               {
+                       const int numvertsB = m_convexB->GetNumVertices();
+                       for (int v=0;v<numvertsB;v++)
+                       {
+                               SimdPoint3 pt;
+                               m_convexB->GetVertex(v,pt);
+                               pt = impactTransB * pt;
+                               char buf[1000];
+                               
+                               if (pt.y() < 0.)
+                               {
+                                       sprintf(buf,"EARLY POST ERROR (%d) %.20E,%.20E,%.20E!!!!!!!!!\n",v,pt.x(),pt.y(),pt.z());
+                                       if (debugFile)
+                                               fwrite(buf,1,strlen(buf),debugFile);
+                               }
+                               else
+                               {
+                                       sprintf(buf,"EARLY POST %d = %.20E,%.20E,%.20E\n",v,pt.x(),pt.y(),pt.z());
+                                       if (debugFile)
+                                               fwrite(buf,1,strlen(buf),debugFile);
+                               }
+                       }
+               }
+       */      
+               
+               return false;//don't continue moving within epsilon
+       }
+
+#define EDGEEDGE
+#ifdef EDGEEDGE
+
+       BU_EdgeEdge edgeEdge;
+
+       //for all edged in A check agains all edges in B
+       for (int ea = 0;ea < m_convexA->GetNumEdges();ea++)
+       {
+               SimdPoint3 pA0,pA1;
+
+               m_convexA->GetEdge(ea,pA0,pA1);
+
+               pA0= a2w * pA0;//in world space
+               pA0 = w2s * pA0;//in screwing space
+
+               pA1= a2w * pA1;//in world space
+               pA1 = w2s * pA1;//in screwing space
+
+               int numedgesB = m_convexB->GetNumEdges();
+               for (int eb = 0; eb < numedgesB;eb++)
+               {
+                       {
+                               SimdPoint3 pB0,pB1;
+                               m_convexB->GetEdge(eb,pB0,pB1);
+
+                               pB0= b2w * pB0;//in world space
+                               pB0 = w2s * pB0;//in screwing space
+
+                               pB1= b2w * pB1;//in world space
+                               pB1 = w2s * pB1;//in screwing space
+
+
+                               SimdScalar lambda,mu;
+                               
+                               toiUnscaled = 1.;
+
+                               SimdVector3 edgeDirA(pA1-pA0);
+                               SimdVector3 edgeDirB(pB1-pB0);
+
+                               if (edgeEdge.GetTimeOfImpact(m_screwing,pA0,edgeDirA,pB0,edgeDirB,toiUnscaled,lambda,mu))
+                               {
+                                       //printf("edgeedge potential hit\n");
+                                       if (toiUnscaled>=0)
+                                       {
+                                               if (toiUnscaled < toiUnscaledLimit)                                                     
+                                               {
+               
+                                                       //inside check is already done by checking the mu and gamma !
+
+                                                       SimdPoint3 vtx  = pA0+lambda * (pA1-pA0);
+                                                       SimdPoint3 hitpt = m_screwing.InBetweenPosition(vtx,toiUnscaled);
+                                                       
+                                                       SimdPoint3 hitptWorld =   s2w * hitpt;
+                                                       {
+
+                                                               if (toiUnscaled < result.m_fraction)
+                                                                       result.m_fraction = toiUnscaled;
+
+                                                               hit = true;
+
+                                                               SimdVector3 hitNormal = edgeDirB.cross(edgeDirA);
+                                                               
+                                                               hitNormal = m_screwing.InBetweenVector(hitNormal,toiUnscaled);
+                                                       
+
+                                                               hitNormal.normalize();
+                                                               
+                                                               //an approximated normal can be calculated by taking the cross product of both edges
+                                                               //take care of the sign !
+                                                               
+                                                               SimdVector3 hitNormalWorld = s2w.getBasis() * hitNormal ;
+                                               
+                                                               SimdScalar dist = m_screwing.GetU().dot(hitNormalWorld);
+                                                               if (dist > 0)
+                                                                       hitNormalWorld *= -1;
+                                                               
+                                                               //todo: this is the wrong point, because b2winv is still at begin of motion
+                                                               // not at time-of-impact location!
+                                                               //bhitpt = b2winv * hitptWorld;
+
+//                                                             m_manifold.SetContactPoint(BUM_FeatureEdgeEdge,index,ea,eb,hitptWorld,hitNormalWorld);
+                                                       }
+                                       
+                                               }
+                                       }
+                               }
+                       }
+
+                       index++;
+               }
+       };
+#endif //EDGEEDGE
+
+#define VERTEXFACE
+#ifdef VERTEXFACE
+
+       // for all vertices in A, for each face in B,do vertex-face
+       {
+               const int numvertsA = m_convexA->GetNumVertices();
+               for (int v=0;v<numvertsA;v++)
+               //int v=3;
+
+               {
+                       SimdPoint3 vtx;
+                       m_convexA->GetVertex(v,vtx);
+
+                       vtx = a2w * vtx;//in world space
+                       vtx = w2s * vtx;//in screwing space
+
+                       const int numplanesB = m_convexB->GetNumPlanes();
+
+                       for (int p = 0 ; p < numplanesB; p++)
+                       //int p=2;
+                       {
+
+                               {
+                               
+                                       SimdVector3 planeNorm;
+                                       SimdPoint3 planeSupport;
+
+                                       m_convexB->GetPlane(planeNorm,planeSupport,p);
+
+
+                                       planeSupport = b2w * planeSupport;//transform to world space
+                                       SimdVector3 planeNormWorld =  b2w.getBasis() * planeNorm;
+                               
+                                       planeSupport =  w2s * planeSupport  ; //transform to screwing space
+                                       planeNorm =  w2s.getBasis() * planeNormWorld;
+
+                                       planeNorm.normalize();
+
+                                       SimdScalar d = planeSupport.dot(planeNorm);
+                                       
+                                       SimdVector4 planeEq(planeNorm[0],planeNorm[1],planeNorm[2],d);
+                               
+                                       BU_VertexPoly vtxApolyB;
+
+                                       toiUnscaled = 1.;
+
+                                       if ((p==2) && (v==6))
+                                       {
+//                                             printf("%f toiUnscaled\n",toiUnscaled);
+
+                                       }
+                                       if (vtxApolyB.GetTimeOfImpact(m_screwing,vtx,planeEq,toiUnscaled,false))
+                                       {
+                                       
+
+
+                                               
+                                               if (toiUnscaled >= 0. )
+                                               {
+                                                       //not only collect the first point, get every contactpoint, later we have to check the
+                                                       //manifold properly!
+
+                                                       if (toiUnscaled <= toiUnscaledLimit)
+                                                       {
+       //                                                      printf("toiUnscaled %f\n",toiUnscaled );
+
+                                                               SimdPoint3 hitpt = m_screwing.InBetweenPosition(vtx,toiUnscaled);
+                                                               SimdVector3 hitNormal = m_screwing.InBetweenVector(planeNorm ,toiUnscaled);
+
+                                                               SimdVector3 hitNormalWorld = s2w.getBasis() * hitNormal ;
+                                                               SimdPoint3 hitptWorld = s2w * hitpt;
+
+
+                                                               hitpt = b2winv * hitptWorld;
+                                                               //vertex has to be 'within' the facet's boundary
+                                                               if (m_convexB->IsInside(hitpt,m_tolerance))
+                                                               {
+//                                                                     m_manifold.SetContactPoint(BUM_FeatureVertexFace, index,v,p,hitptWorld,hitNormalWorld);
+                                                                       
+                                                                       if (toiUnscaled < result.m_fraction)
+                                                                               result.m_fraction= toiUnscaled;
+                                                                       hit = true;
+
+                                                               }
+                                                       }
+                                               }
+                                       }
+                                       
+                               }
+
+                               index++;
+                       }
+               }
+       }
+
+       //
+       // for all vertices in B, for each face in A,do vertex-face
+       //copy and pasted from all verts A -> all planes B so potential typos!
+       //todo: make this into one method with a kind of 'swapped' logic
+       //
+       {
+               const int numvertsB = m_convexB->GetNumVertices();
+               for (int v=0;v<numvertsB;v++)
+               //int v=0;
+
+               {
+                       SimdPoint3 vtx;
+                       m_convexB->GetVertex(v,vtx);
+
+                       vtx = b2w * vtx;//in world space
+/*
+                       
+                       char buf[1000];
+
+                       if (vtx.y() < 0.)
+                       {
+                               sprintf(buf,"ERROR !!!!!!!!!\n",v,vtx.x(),vtx.y(),vtx.z());
+                               if (debugFile)
+                                       fwrite(buf,1,strlen(buf),debugFile);
+                       }
+                       sprintf(buf,"vertexWorld(%d) = (%.20E,%.20E,%.20E)\n",v,vtx.x(),vtx.y(),vtx.z());
+                       if (debugFile)
+                               fwrite(buf,1,strlen(buf),debugFile);
+
+*/                     
+                       vtx = w2s * vtx;//in screwing space
+
+                       const int numplanesA = m_convexA->GetNumPlanes();
+
+                       for (int p = 0 ; p < numplanesA; p++)
+                       //int p=2;
+                       {
+
+                               {
+                                       SimdVector3 planeNorm;
+                                       SimdPoint3 planeSupport;
+
+                                       m_convexA->GetPlane(planeNorm,planeSupport,p);
+
+
+                                       planeSupport = a2w * planeSupport;//transform to world space
+                                       SimdVector3 planeNormWorld =  a2w.getBasis() * planeNorm;
+                               
+                                       planeSupport =  w2s * planeSupport  ; //transform to screwing space
+                                       planeNorm =  w2s.getBasis() * planeNormWorld;
+
+                                       planeNorm.normalize();
+
+                                       SimdScalar d = planeSupport.dot(planeNorm);
+                                       
+                                       SimdVector4 planeEq(planeNorm[0],planeNorm[1],planeNorm[2],d);
+                               
+                                       BU_VertexPoly vtxBpolyA;
+
+                                       toiUnscaled = 1.;
+
+                                       if (vtxBpolyA.GetTimeOfImpact(m_screwing,vtx,planeEq,toiUnscaled,true))
+                                       {
+                                               if (toiUnscaled>=0.)
+                                               {
+                                                       if (toiUnscaled < toiUnscaledLimit)
+                                                       {
+                                                               SimdPoint3 hitpt = m_screwing.InBetweenPosition( vtx , -toiUnscaled);
+                                                               SimdVector3 hitNormal = m_screwing.InBetweenVector(-planeNorm ,-toiUnscaled);
+                                                               SimdScalar len =  hitNormal.length()-1;
+
+                                                               //assert( SimdFuzzyZero(len) );
+
+                                                               
+                                                               SimdVector3 hitNormalWorld = s2w.getBasis() * hitNormal ;
+                                                               SimdPoint3 hitptWorld = s2w * hitpt;
+                                                               hitpt = a2winv * hitptWorld;
+                                                       
+                                                       
+                                                               //vertex has to be 'within' the facet's boundary
+                                                               if (m_convexA->IsInside(hitpt,m_tolerance))
+                                                               {
+                                                                       
+//                                                                     m_manifold.SetContactPoint(BUM_FeatureFaceVertex,index,p,v,hitptWorld,hitNormalWorld);
+                                                                       if (toiUnscaled <result.m_fraction)
+                                                                               result.m_fraction = toiUnscaled;
+                                                                       hit = true;
+                                                               }
+                                                       }
+                                               
+                                               }
+                                       
+                                       }
+                                       }
+
+                       }
+               
+                       index++;
+               }
+       }
+       
+
+#endif// VERTEXFACE
+
+       //the manifold now consists of all points/normals generated by feature-pairs that have a time-of-impact within this frame
+       //in addition there are contact points from previous frames
+       //we have to cleanup the manifold, using an additional epsilon/tolerance
+       //as long as the distance from the contactpoint (in worldspace) to both objects is within this epsilon we keep the point
+       //else throw it away
+       
+
+       if (hit)
+       {
+
+               //try to avoid numerical drift on close contact
+               
+               if (result.m_fraction < 0.00001)
+               {
+//                     printf("toiUnscaledMin< 0.00001\n");
+                       impactTransA = a2w;
+                       impactTransB = b2w;
+
+               } else
+               {
+
+                       //SimdScalar vel = linearMotionB.length();
+                       
+                       //todo: check this margin
+                       result.m_fraction *= 0.99f;
+
+                       //move B to new position
+                       impactTransB.setOrigin(b2w.getOrigin()+ result.m_fraction*linearMotionB);
+                       SimdQuaternion ornB = b2w.getRotation()+angularMotionB*result.m_fraction;
+                       ornB.normalize();
+                       impactTransB.setRotation(ornB);
+
+                       //now transform A
+                       SimdTransform a2s,a2b;
+                       a2s.mult( w2s , a2w);
+                       a2s= m_screwing.InBetweenTransform(a2s,result.m_fraction);
+                       a2s.multInverseLeft(w2s,a2s);
+                       a2b.multInverseLeft(b2w, a2s);
+
+                       //transform by motion B
+                       impactTransA.mult(impactTransB, a2b);
+                       //normalize rotation
+                       SimdQuaternion orn;
+                       impactTransA.getBasis().getRotation(orn);
+                       orn.normalize();
+                       impactTransA.setBasis(SimdMatrix3x3(orn));
+               }
+       }
+
+/*
+       {
+               const int numvertsB = m_convexB->GetNumVertices();
+               for (int v=0;v<numvertsB;v++)
+               {
+                       SimdPoint3 pt;
+                       m_convexB->GetVertex(v,pt);
+                       pt = impactTransB * pt;
+                       char buf[1000];
+
+                       if (pt.y() < 0.)
+                       {
+                               sprintf(buf,"POST ERROR (%d) %.20E,%.20E,%.20E!!!!!!!!!\n",v,pt.x(),pt.y(),pt.z());
+                               if (debugFile)
+                                       fwrite(buf,1,strlen(buf),debugFile);
+                       }
+                       else
+                       {
+                               sprintf(buf,"POST %d = %.20E,%.20E,%.20E\n",v,pt.x(),pt.y(),pt.z());
+                               if (debugFile)
+                                       fwrite(buf,1,strlen(buf),debugFile);
+                       }
+               }
+       }
+*/
+       return hit;
+}
+
+
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.h
new file mode 100644 (file)
index 0000000..6bc09c2
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#ifndef BU_COLLISIONPAIR
+#define BU_COLLISIONPAIR
+
+#include <NarrowPhaseCollision/BU_Screwing.h>
+#include <NarrowPhaseCollision/ConvexCast.h>
+
+
+#include <SimdQuaternion.h>
+
+class PolyhedralConvexShape;
+
+
+///BU_CollisionPair implements collision algorithm for algebraic time of impact calculation of feature based shapes.
+class BU_CollisionPair : public ConvexCast
+{
+       
+public:
+       BU_CollisionPair(const PolyhedralConvexShape* convexA,const PolyhedralConvexShape* convexB,SimdScalar tolerance=0.2f);
+       //toi
+
+       virtual bool    calcTimeOfImpact(
+                                       const SimdTransform& fromA,
+                                       const SimdTransform& toA,
+                                       const SimdTransform& fromB,
+                                       const SimdTransform& toB,
+                                       CastResult& result);
+
+       
+       
+
+private:
+       const PolyhedralConvexShape*    m_convexA;
+       const PolyhedralConvexShape*    m_convexB;
+       BU_Screwing     m_screwing;
+       SimdScalar      m_tolerance;
+       
+};
+#endif //BU_COLLISIONPAIR
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.cpp
new file mode 100644 (file)
index 0000000..26a4fe7
--- /dev/null
@@ -0,0 +1,573 @@
+/*
+ * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies.
+ * Erwin Coumans makes no representations about the suitability 
+ * of this software for any purpose.  
+ * It is provided "as is" without express or implied warranty.
+*/
+
+#include "BU_EdgeEdge.h"
+#include "BU_Screwing.h"
+#include <SimdPoint3.h>
+#include <SimdPoint3.h>
+
+//#include "BU_IntervalArithmeticPolynomialSolver.h"
+#include "BU_AlgebraicPolynomialSolver.h"
+
+#define USE_ALGEBRAIC
+#ifdef USE_ALGEBRAIC   
+#define BU_Polynomial BU_AlgebraicPolynomialSolver
+#else  
+#define BU_Polynomial BU_IntervalArithmeticPolynomialSolver
+#endif
+
+BU_EdgeEdge::BU_EdgeEdge()
+{
+}
+
+
+bool BU_EdgeEdge::GetTimeOfImpact(
+                                                                 const BU_Screwing& screwAB,
+                                                                 const SimdPoint3& a,//edge in object A
+                                                                 const SimdVector3& u,
+                                                                 const SimdPoint3& c,//edge in object B
+                                                                 const SimdVector3& v,
+                                                                 SimdScalar &minTime,
+                                                                 SimdScalar &lambda1,
+                                                                 SimdScalar& mu1
+                                                                 
+                                                                 )
+{
+       bool hit=false;
+       
+       SimdScalar lambda;
+       SimdScalar mu;
+       
+       const SimdScalar w=screwAB.GetW();
+       const SimdScalar s=screwAB.GetS();
+       
+       if (SimdFuzzyZero(s) &&
+               SimdFuzzyZero(w))
+       {
+               //no motion, no collision
+               return false;
+       }
+       
+       if (SimdFuzzyZero(w) )
+       {
+               //pure translation W=0, S <> 0
+               //no trig, f(t)=t
+               SimdScalar det = u.y()*v.x()-u.x()*v.y();
+               if (!SimdFuzzyZero(det))
+               {               
+                       lambda = (a.x()*v.y() - c.x() * v.y() - v.x() * a.y() + v.x() * c.y()) / det;
+                       mu = (u.y() * a.x() - u.y() * c.x() - u.x() * a.y() + u.x() * c.y()) / det;
+
+                       if (mu >=0 && mu <= 1 && lambda >= 0 && lambda <= 1)
+                       {
+                               // single potential collision is
+                               SimdScalar t = (c.z()-a.z()+mu*v.z()-lambda*u.z())/s;
+                               //if this is on the edge, and time t within [0..1] report hit
+                               if (t>=0 && t <= minTime)
+                               {
+                                       hit = true;
+                                       lambda1 = lambda;
+                                       mu1 = mu;
+                                       minTime=t;
+                               }
+                       }
+                       
+               } else
+               {
+                       //parallel case, not yet
+               }
+       } else
+       {
+               if (SimdFuzzyZero(s) )
+               {
+                       if (SimdFuzzyZero(u.z()) )
+                       {
+                               if (SimdFuzzyZero(v.z()) )
+                               {
+                                       //u.z()=0,v.z()=0
+                                       if (SimdFuzzyZero(a.z()-c.z()))
+                                       {
+                                               //printf("NOT YET planar problem, 4 vertex=edge cases\n");
+                                               
+                                       } else
+                                       {
+                                               //printf("parallel but distinct planes, no collision\n");
+                                               return false;
+                                       }
+                                       
+                               } else
+                               {
+                                       SimdScalar mu = (a.z() - c.z())/v.z();
+                                       if (0<=mu && mu <= 1)
+                                       {
+                                       //      printf("NOT YET//u.z()=0,v.z()<>0\n");
+                                       } else
+                                       {
+                                               return false;
+                                       }
+                                       
+                               }
+                       } else
+                       {
+                               //u.z()<>0
+                               
+                               if (SimdFuzzyZero(v.z()) )
+                               {
+                                       //printf("u.z()<>0,v.z()=0\n");
+                                       lambda =  (c.z() - a.z())/u.z();
+                                       if (0<=lambda && lambda <= 1)
+                                       {
+                                               //printf("u.z()<>0,v.z()=0\n");
+                                               SimdPoint3 rotPt(a.x()+lambda * u.x(), a.y()+lambda * u.y(),0.f);
+                                               SimdScalar r2 = rotPt.length2();//px*px + py*py;
+                                               
+                                               //either y=a*x+b, or x = a*x+b...
+                                               //depends on whether value v.x() is zero or not
+                                               SimdScalar aa;
+                                               SimdScalar bb;
+                                               
+                                               if (SimdFuzzyZero(v.x()))
+                                               {
+                                                       aa = v.x()/v.y();
+                                                       bb= c.x()+  (-c.y() /v.y()) *v.x();
+                                               } else
+                                               {
+                                                       //line is c+mu*v;
+                                                       //x = c.x()+mu*v.x();
+                                                       //mu = ((x-c.x())/v.x());
+                                                       //y = c.y()+((x-c.x())/v.x())*v.y();
+                                                       //y = c.y()+  (-c.x() /v.x()) *v.y() + (x /v.x())   *v.y();
+                                                       //y = a*x+b,where a = v.y()/v.x(), b= c.y()+  (-c.x() /v.x()) *v.y();
+                                                       aa = v.y()/v.x();
+                                                       bb= c.y()+  (-c.x() /v.x()) *v.y();
+                                               }
+                                               
+                                               SimdScalar disc = aa*aa*r2 + r2 - bb*bb;
+                                               if (disc <0)
+                                               {
+                                                       //edge doesn't intersect the circle (motion of the vertex)
+                                                       return false;
+                                               }
+                                               SimdScalar rad = sqrtf(r2);
+                                               
+                                               if (SimdFuzzyZero(disc))
+                                               {
+                                                       SimdPoint3 intersectPt;
+                                                       
+                                                       SimdScalar mu;
+                                                       //intersectionPoint edge with circle;
+                                                       if (SimdFuzzyZero(v.x()))
+                                                       {
+                                                               intersectPt.setY( (-2*aa*bb)/(2*(aa*aa+1)));
+                                                               intersectPt.setX( aa*intersectPt.y()+bb );
+                                                               mu = ((intersectPt.y()-c.y())/v.y());
+                                                       } else
+                                                       {
+                                                               intersectPt.setX((-2*aa*bb)/(2*(aa*aa+1)));
+                                                               intersectPt.setY(aa*intersectPt.x()+bb);
+                                                               mu = ((intersectPt.getX()-c.getX())/v.getX());
+                                                               
+                                                       }
+                                                       
+                                                       if (0 <= mu && mu <= 1)
+                                                       {
+                                                               hit = Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime);
+                                                       }
+                                                       //only one solution
+                                               } else
+                                               {
+                                                       //two points...
+                                                       //intersectionPoint edge with circle;
+                                                       SimdPoint3 intersectPt;
+                                                       //intersectionPoint edge with circle;
+                                                       if (SimdFuzzyZero(v.x()))
+                           &